Completed
Pull Request — 8.x-1.x (#33)
by
unknown
02:29
created
src/Plugin/CKEditorPlugin/DrupalUrl.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
    * {@inheritdoc}
26 26
    */
27 27
   public function getFile() {
28
-    return drupal_get_path('module', 'url_embed') . '/js/plugins/drupalurl/plugin.js';
28
+    return drupal_get_path('module', 'url_embed').'/js/plugins/drupalurl/plugin.js';
29 29
   }
30 30
 
31 31
   /**
Please login to merge, or discard this patch.
src/Plugin/EmbedType/Url.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
    * {@inheritdoc}
24 24
    */
25 25
   public function getDefaultIconUrl() {
26
-    return file_create_url(drupal_get_path('module', 'url_embed') . '/js/plugins/drupalurl/urlembed.png');
26
+    return file_create_url(drupal_get_path('module', 'url_embed').'/js/plugins/drupalurl/urlembed.png');
27 27
   }
28 28
 }
Please login to merge, or discard this patch.
src/Tests/LinkEmbedFormatterTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
  *
19 19
  * @group url_embed
20 20
  */
21
-class LinkEmbedFormatterTest extends LinkFieldTest{
21
+class LinkEmbedFormatterTest extends LinkFieldTest {
22 22
 
23 23
   /**
24 24
    * Modules to enable.
Please login to merge, or discard this patch.
src/Tests/UrlEmbedDialogTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@
 block discarded – undo
66 66
   public function getEmbedDialog($filter_format_id = NULL, $embed_button_id = NULL) {
67 67
     $url = 'url-embed/dialog';
68 68
     if (!empty($filter_format_id)) {
69
-      $url .= '/' . $filter_format_id;
69
+      $url .= '/'.$filter_format_id;
70 70
       if (!empty($embed_button_id)) {
71
-        $url .= '/' . $embed_button_id;
71
+        $url .= '/'.$embed_button_id;
72 72
       }
73 73
     }
74 74
     return $this->drupalGet($url);
Please login to merge, or discard this patch.
src/Plugin/Filter/ConvertUrlToEmbedFilter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
     // optional for all protocols.
79 79
     // @see \Drupal\Component\Utility\UrlHelper::stripDangerousProtocols()
80 80
     $protocols = \Drupal::getContainer()->getParameter('filter_protocols');
81
-    $protocols = implode(':(?://)?|', $protocols) . ':(?://)?';
81
+    $protocols = implode(':(?://)?|', $protocols).':(?://)?';
82 82
 
83 83
     $valid_url_path_characters = "[\p{L}\p{M}\p{N}!\*\';:=\+,\.\$\/%#\[\]\-_~@&]";
84 84
 
85 85
     // Allow URL paths to contain balanced parens
86 86
     // 1. Used in Wikipedia URLs like /Primer_(film)
87 87
     // 2. Used in IIS sessions like /S(dfd346)/
88
-    $valid_url_balanced_parens = '\('. $valid_url_path_characters . '+\)';
88
+    $valid_url_balanced_parens = '\('.$valid_url_path_characters.'+\)';
89 89
 
90 90
     // Valid end-of-path characters (so /foo. does not gobble the period).
91 91
     // 1. Allow =&# for empty URL parameters and other URL-join artifacts
92
-    $valid_url_ending_characters = '[\p{L}\p{M}\p{N}:_+~#=/]|(?:' . $valid_url_balanced_parens . ')';
92
+    $valid_url_ending_characters = '[\p{L}\p{M}\p{N}:_+~#=/]|(?:'.$valid_url_balanced_parens.')';
93 93
 
94 94
     $valid_url_query_chars = '[a-zA-Z0-9!?\*\'@\(\);:&=\+\$\/%#\[\]\-_\.,~|]';
95 95
     $valid_url_query_ending_chars = '[a-zA-Z0-9_&=#\/]';
96 96
 
97 97
     //full path
98 98
     //and allow @ in a url, but only in the middle. Catch things like http://example.com/@user/
99
-    $valid_url_path = '(?:(?:'.$valid_url_path_characters . '*(?:'.$valid_url_balanced_parens .$valid_url_path_characters . '*)*'. $valid_url_ending_characters . ')|(?:@' . $valid_url_path_characters . '+\/))';
99
+    $valid_url_path = '(?:(?:'.$valid_url_path_characters.'*(?:'.$valid_url_balanced_parens.$valid_url_path_characters.'*)*'.$valid_url_ending_characters.')|(?:@'.$valid_url_path_characters.'+\/))';
100 100
 
101 101
     // Prepare domain name pattern.
102 102
     // The ICANN seems to be on track towards accepting more diverse top level
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     $domain = '(?:[\p{L}\p{M}\p{N}._+-]+\.)?[\p{L}\p{M}]{2,64}\b';
106 106
     $ip = '(?:[0-9]{1,3}\.){3}[0-9]{1,3}';
107 107
     $auth = '[\p{L}\p{M}\p{N}:%_+*~#?&=.,/;-]+@';
108
-    $trail = '('.$valid_url_path.'*)?(\\?'.$valid_url_query_chars .'*'.$valid_url_query_ending_chars.')?';
108
+    $trail = '('.$valid_url_path.'*)?(\\?'.$valid_url_query_chars.'*'.$valid_url_query_ending_chars.')?';
109 109
 
110 110
     // Match absolute URLs.
111 111
     $url_pattern = "(?:$auth)?(?:$domain|$ip)/?(?:$trail)?";
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
           // function contained in $task.
138 138
           $chunks[$i] = preg_replace_callback(
139 139
             $pattern,
140
-            function ($match) {
140
+            function($match) {
141 141
               if (\Drupal::service('url_embed')->getEmbed(Html::decodeEntities($match[1]))) {
142
-                return '<drupal-url data-embed-url="' . $match[1] . '"></drupal-url>';
142
+                return '<drupal-url data-embed-url="'.$match[1].'"></drupal-url>';
143 143
               }
144 144
               else {
145 145
                 return $match[1];
Please login to merge, or discard this patch.
src/Tests/ConvertUrlToEmbedFilterTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $settings['title'] = 'Test convert url to embed with sample Twitter url';
81 81
     $settings['body'] = [['value' => $content, 'format' => 'custom_format']];
82 82
     $node = $this->drupalCreateNode($settings);
83
-    $this->drupalGet('node/' . $node->id());
83
+    $this->drupalGet('node/'.$node->id());
84 84
     $this->assertRaw('<drupal-url data-embed-url="https://twitter.com/drupal/status/735873777683320832"></drupal-url>');
85 85
     $this->assertNoText(strip_tags($content), 'URL does not appear in the output when embed is successful.');
86 86
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     $settings['title'] = 'Test convert url to embed with non valid URL';
91 91
     $settings['body'] = [['value' => $content, 'format' => 'custom_format']];
92 92
     $node = $this->drupalCreateNode($settings);
93
-    $this->drupalGet('node/' . $node->id());
93
+    $this->drupalGet('node/'.$node->id());
94 94
     $this->assertRaw($content);
95 95
 
96 96
     /** @var \Drupal\filter\FilterFormatInterface $format */
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     $settings['title'] = 'Test convert url to embed with sample Twitter url and no prefix';
107 107
     $settings['body'] = [['value' => $content, 'format' => 'custom_format']];
108 108
     $node = $this->drupalCreateNode($settings);
109
-    $this->drupalGet('node/' . $node->id());
109
+    $this->drupalGet('node/'.$node->id());
110 110
     $this->assertRaw(strip_tags($content));
111 111
     $this->assertNoRaw('<drupal-url data-embed-url="https://twitter.com/drupal/status/735873777683320832"></drupal-url>');
112 112
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     $settings['title'] = 'Test convert url to embed with sample Twitter url with the prefix';
117 117
     $settings['body'] = [['value' => $content, 'format' => 'custom_format']];
118 118
     $node = $this->drupalCreateNode($settings);
119
-    $this->drupalGet('node/' . $node->id());
119
+    $this->drupalGet('node/'.$node->id());
120 120
     $this->assertRaw('<drupal-url data-embed-url="https://twitter.com/drupal/status/735873777683320832"></drupal-url>');
121 121
     $this->assertNoText(strip_tags($content), 'URL does not appear in the output when embed is successful.');
122 122
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     $settings['title'] = 'Test convert url to embed with sample Twitter url with wrong prefix';
127 127
     $settings['body'] = [['value' => $content, 'format' => 'custom_format']];
128 128
     $node = $this->drupalCreateNode($settings);
129
-    $this->drupalGet('node/' . $node->id());
129
+    $this->drupalGet('node/'.$node->id());
130 130
     $this->assertRaw(strip_tags($content));
131 131
     $this->assertNoRaw('<drupal-url data-embed-url="https://twitter.com/drupal/status/735873777683320832"></drupal-url>');
132 132
   }
Please login to merge, or discard this patch.
src/Tests/UrlEmbedFilterTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
    */
25 25
   public function testFilter() {
26 26
     // Tests url embed using sample flickr url.
27
-    $content = '<drupal-url data-embed-url="' . static::FLICKR_URL . '">This placeholder should not be rendered.</drupal-url>';
27
+    $content = '<drupal-url data-embed-url="'.static::FLICKR_URL.'">This placeholder should not be rendered.</drupal-url>';
28 28
     $settings = array();
29 29
     $settings['type'] = 'page';
30 30
     $settings['title'] = 'Test url embed with sample flickr url';
31 31
     $settings['body'] = array(array('value' => $content, 'format' => 'custom_format'));
32 32
     $node = $this->drupalCreateNode($settings);
33
-    $this->drupalGet('node/' . $node->id());
33
+    $this->drupalGet('node/'.$node->id());
34 34
     $this->assertRaw(static::FLICKR_OUTPUT_WYSIWYG);
35 35
     $this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
36 36
 
@@ -41,27 +41,27 @@  discard block
 block discarded – undo
41 41
     $settings['title'] = 'Test that placeholder is retained when specified URL does not exists';
42 42
     $settings['body'] = array(array('value' => $content, 'format' => 'custom_format'));
43 43
     $node = $this->drupalCreateNode($settings);
44
-    $this->drupalGet('node/' . $node->id());
44
+    $this->drupalGet('node/'.$node->id());
45 45
     $this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is unsuccessful.');
46 46
 
47 47
     // Test that tag of container element is not replaced when it's not
48 48
     // <drupal-url>.
49
-    $content = '<not-drupal-url data-embed-url="' . static::FLICKR_URL . '" data-url-provider="Flickr">this placeholder should not be rendered.</not-drupal-url>';
49
+    $content = '<not-drupal-url data-embed-url="'.static::FLICKR_URL.'" data-url-provider="Flickr">this placeholder should not be rendered.</not-drupal-url>';
50 50
     $settings = array();
51 51
     $settings['type'] = 'page';
52 52
     $settings['title'] = 'test url embed with embed-url';
53 53
     $settings['body'] = array(array('value' => $content, 'format' => 'custom_format'));
54 54
     $node = $this->drupalCreateNode($settings);
55
-    $this->drupalget('node/' . $node->id());
55
+    $this->drupalget('node/'.$node->id());
56 56
     $this->assertRaw('</not-drupal-url>');
57
-    $content = '<div data-embed-url="' . static::FLICKR_URL . '">this placeholder should not be rendered.</div>';
57
+    $content = '<div data-embed-url="'.static::FLICKR_URL.'">this placeholder should not be rendered.</div>';
58 58
     $settings = array();
59 59
     $settings['type'] = 'page';
60 60
     $settings['title'] = 'test url embed with embed-url';
61 61
     $settings['body'] = array(array('value' => $content, 'format' => 'custom_format'));
62 62
     $node = $this->drupalCreateNode($settings);
63
-    $this->drupalget('node/' . $node->id());
64
-    $this->assertRaw('<div data-embed-url="' . static::FLICKR_URL . '"');
63
+    $this->drupalget('node/'.$node->id());
64
+    $this->assertRaw('<div data-embed-url="'.static::FLICKR_URL.'"');
65 65
 
66 66
     // Enable the settings option to use a responsive wrapper
67 67
     $format = FilterFormat::load('custom_format');
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
     $format->save();
72 72
 
73 73
     // Tests responsive url embed using sample flickr url.
74
-    $content = '<drupal-url data-embed-url="' . static::FLICKR_URL . '">This placeholder should not be rendered.</drupal-url>';
74
+    $content = '<drupal-url data-embed-url="'.static::FLICKR_URL.'">This placeholder should not be rendered.</drupal-url>';
75 75
     $settings = array();
76 76
     $settings['type'] = 'page';
77 77
     $settings['title'] = 'Test responsive url embed with sample Flickr url';
78 78
     $settings['body'] = array(array('value' => $content, 'format' => 'custom_format'));
79 79
     $node = $this->drupalCreateNode($settings);
80
-    $this->drupalGet('node/' . $node->id());
81
-    $this->assertRaw('<div class="responsive-embed" style="padding-bottom: 66.699%">' . static::FLICKR_OUTPUT_WYSIWYG . '</div>');
80
+    $this->drupalGet('node/'.$node->id());
81
+    $this->assertRaw('<div class="responsive-embed" style="padding-bottom: 66.699%">'.static::FLICKR_OUTPUT_WYSIWYG.'</div>');
82 82
     $this->assertNoText(strip_tags($content), 'Placeholder does not appear in the output when embed is successful.');
83 83
 
84 84
   }
Please login to merge, or discard this patch.
url_embed.module 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
25 25
 
26 26
   // Add the responsive embed css if the url_embed module has it enabled
27 27
   if (!empty($config['settings']['enable_responsive'])) {
28
-    $css[] = drupal_get_path('module', 'url_embed') . '/css/url_embed.responsive.css';
28
+    $css[] = drupal_get_path('module', 'url_embed').'/css/url_embed.responsive.css';
29 29
   }
30 30
 }
Please login to merge, or discard this patch.