Passed
Push — master ( 545f87...b2393f )
by Swapnil V.
01:59
created
shortcodely.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 */
35 35
 
36 36
 add_action('in_widget_form', 'Shortcodely_spice_get_widget_id');
37
-function Shortcodely_spice_get_widget_id( $widget_instance ) 
37
+function Shortcodely_spice_get_widget_id($widget_instance) 
38 38
 {
39 39
     /*
40 40
          * Main function to get widget id
41 41
          * 
42 42
          */
43 43
     echo '<p><strong>To use as shortcode with id:</strong> ';
44
-    if ($widget_instance->number == '__i__' ) {
44
+    if ($widget_instance->number == '__i__') {
45 45
         echo 'Save the widget first!</p>';
46 46
     } else {
47 47
         echo '[do_widget id=' . $widget_instance->id . ']</p>';
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 /**
52 52
  * @return callable
53 53
  */
54
-function shortcodely_remove_widget_class( $params ) 
54
+function shortcodely_remove_widget_class($params) 
55 55
 {
56 56
     /* 
57 57
     * Remove the widget classes
58 58
     */
59
-    if (! empty($params[0]['before_widget']) ) {
59
+    if ( ! empty($params[0]['before_widget'])) {
60 60
         $params[0]['before_widget'] =
61 61
             str_replace('"widget ', '"', $params[0]['before_widget']);
62 62
     }
63 63
 
64
-    if (! empty($params[0]['before_title']) ) {
64
+    if ( ! empty($params[0]['before_title'])) {
65 65
         $params[0]['before_title']
66 66
             = $params[0]['before_title'] = str_replace('widget-title', '', $params[0]['before_title']);
67 67
     }
@@ -193,46 +193,46 @@  discard block
 block discarded – undo
193 193
         }
194 194
             // if we have id, get the sidebar for it
195 195
             $sidebarid = shortcodely_get_widgets_sidebar($id);
196
-        if (! $sidebarid ) {
196
+        if ( ! $sidebarid) {
197 197
             $output = '<br />Widget not in any sidebars<br />';
198 198
 
199 199
             return $output;
200 200
         }
201 201
     }
202 202
 
203
-    if (empty($widget) ) {
203
+    if (empty($widget)) {
204 204
         $widget = '';
205 205
     }
206
-    if (empty($id) ) {
206
+    if (empty($id)) {
207 207
         $id = '';
208 208
     }
209 209
 
210
-    if (empty($widget_ids) ) {
210
+    if (empty($widget_ids)) {
211 211
         $output = '<br />Error: Your Requested widget "' . $widget . ' ' . $id . '" is not in the widget list.<br />';
212 212
         $output .= shortcodely_show_widget_debug('empty', $name, $id, $sidebar);
213 213
 
214 214
         return $output;
215 215
     }
216 216
 
217
-    if (empty($widget) ) {
217
+    if (empty($widget)) {
218 218
         $widget = '';
219 219
     }
220 220
 
221 221
     //$content = '';
222 222
     /* if the widget is in our chosen sidebar, then use the options stored for that */
223 223
 
224
-    if (( ! isset($_wp_sidebars_widgets[ $sidebarid ])) or (empty($_wp_sidebars_widgets[ $sidebarid ])) ) { // try upgrade
224
+    if (( ! isset($_wp_sidebars_widgets[$sidebarid])) or (empty($_wp_sidebars_widgets[$sidebarid]))) { // try upgrade
225 225
         shortcodely_upgrade_sidebar();
226 226
     }
227 227
 
228 228
     //if we have a specific sidebar selected, use that
229
-    if ((isset($_wp_sidebars_widgets[ $sidebarid ])) and ( ! empty($_wp_sidebars_widgets[ $sidebarid ])) ) {
229
+    if ((isset($_wp_sidebars_widgets[$sidebarid])) and ( ! empty($_wp_sidebars_widgets[$sidebarid]))) {
230 230
         /* get the intersect of the 2 widget setups so we just get the widget we want	*/
231 231
 
232
-        $wid = array_intersect($_wp_sidebars_widgets[ $sidebarid ], $widget_ids);
232
+        $wid = array_intersect($_wp_sidebars_widgets[$sidebarid], $widget_ids);
233 233
     } else { /* the sidebar is not defined or selected - should not happen */
234
-        if (isset($debug) ) {    // only do this in debug mode
235
-            if (! isset($_wp_sidebars_widgets[ $sidebarid ]) ) {
234
+        if (isset($debug)) {    // only do this in debug mode
235
+            if ( ! isset($_wp_sidebars_widgets[$sidebarid])) {
236 236
                 $output = '<p>Error: Sidebar "' . $sidebar . '" with sidebarid "' . $sidebarid . '" is not defined.</p>';
237 237
             } // shouldnt happen - maybe someone running content filters on save
238 238
             else {
@@ -384,19 +384,19 @@  discard block
 block discarded – undo
384 384
 
385 385
     global $wp_registered_widgets, $_wp_sidebars_widgets, $wp_registered_sidebars;
386 386
 
387
-    if (function_exists('register_sidebar') ) {    // maybe later, get the first main sidebar and copy it's before/after etc
387
+    if (function_exists('register_sidebar')) {    // maybe later, get the first main sidebar and copy it's before/after etc
388 388
         $args = array(
389 389
         'name' => 'Widgets for Shortcodes',
390
-        'id' => 'widgets_for_shortcodes',    // hope to avoid losing widgets
390
+        'id' => 'widgets_for_shortcodes', // hope to avoid losing widgets
391 391
         'description' => __('Sidebar to hold widgets and their settings. These widgets will be used in a shortcode.	This sidebars widgets should be saved with your theme settings now.', 'shortcodely-shortcode-any-widget'),
392
-        'before_widget' => '<aside' . ' id="%1$s" class="%2$s ">',    // 201402 to match twentyfourteen theme
392
+        'before_widget' => '<aside' . ' id="%1$s" class="%2$s ">', // 201402 to match twentyfourteen theme
393 393
         'after_widget' => '</aside>',
394 394
         'before_title' => '<h1 class="widget-title" >', // 201402 maybe dont use widget class - we are in content here not in a widget area but others want the widget styling. ?
395 395
         'after_title' => '</h1>',
396 396
         );
397 397
 
398
-        if (! empty($wp_registered_sidebars) ) {    // we got some sidebars already.
399
-                $main_sidebar = reset($wp_registered_sidebars);    // Grab the first sidebar and use that as defaults for the widgets
398
+        if ( ! empty($wp_registered_sidebars)) {    // we got some sidebars already.
399
+                $main_sidebar = reset($wp_registered_sidebars); // Grab the first sidebar and use that as defaults for the widgets
400 400
                 $args['before_widget'] = $main_sidebar['before_widget'];
401 401
                 $args['after_widget'] = $main_sidebar['after_widget'];
402 402
                 $args['before_title'] = $main_sidebar['before_title'];
Please login to merge, or discard this patch.
shortcodely-admin-form-html.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __('Settings', 'shortcodely-shortcode-any-widget') . '</a>';
69 69
                 array_unshift($links, $settings_link);
70 70
             }
71
-             return $links;
71
+                return $links;
72 72
         }
73 73
 
74 74
         /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
          */
77 77
         public function admin_heading( $title ) 
78 78
         {
79
-             echo '<div class="wrap" >
79
+                echo '<div class="wrap" >
80 80
 			<div id="icon-options-general" class="icon32"><br />
81 81
 			</div>
82 82
 			<h2>' . $title . ' </h2>';
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
          * This is a "Docblock Comment," also known as a "docblock."    The class'
40 40
          * docblock, below, contains a complete description of how to write these.
41 41
          */
42
-        public $homepage        = '';
42
+        public $homepage = '';
43 43
         public $parent_slug = 'plugin_listings_menu';
44
-        public $accesslvl        = 'manage_options';
44
+        public $accesslvl = 'manage_options';
45 45
         public function __construct() 
46 46
         {
47
-                add_action('admin_menu', array( &$this, 'register_settings_page' ));
48
-                add_filter('plugin_action_links', array( &$this, 'add_action_link' ), 10, 2);
47
+                add_action('admin_menu', array(&$this, 'register_settings_page'));
48
+                add_filter('plugin_action_links', array(&$this, 'add_action_link'), 10, 2);
49 49
         }
50 50
         public function register_settings_page() 
51 51
         {
52
-                add_options_page($this->longname, $this->shortname, $this->accesslvl, $this->hook, array( &$this, 'config_page' ));
52
+                add_options_page($this->longname, $this->shortname, $this->accesslvl, $this->hook, array(&$this, 'config_page'));
53 53
         }
54 54
         public function plugin_options_url() 
55 55
         {
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
         /**
59 59
          * Add a link to the settings page to the plugins list
60 60
          */
61
-        public function add_action_link( $links, $file ) 
61
+        public function add_action_link($links, $file) 
62 62
         {
63 63
             static $this_plugin;
64
-            if (empty($this_plugin) ) {
64
+            if (empty($this_plugin)) {
65 65
                 $this_plugin = $this->filename;
66 66
             }
67
-            if ($file == $this_plugin ) {
67
+            if ($file == $this_plugin) {
68 68
                 $settings_link = '<a href="' . $this->plugin_options_url() . '">' . __('Settings', 'shortcodely-shortcode-any-widget') . '</a>';
69 69
                 array_unshift($links, $settings_link);
70 70
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         /**
75 75
          * @param string $title
76 76
          */
77
-        public function admin_heading( $title ) 
77
+        public function admin_heading($title) 
78 78
         {
79 79
              echo '<div class="wrap" >
80 80
 			<div id="icon-options-general" class="icon32"><br />
Please login to merge, or discard this patch.
shortcodely-utilities.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
 /**
120 120
  * @param string $type
121 121
  */
122
-function shortcodely_show_widget_debug( $type, $name, $id, $sidebar ) 
122
+function shortcodely_show_widget_debug($type, $name, $id, $sidebar) 
123 123
 {
124 124
     global $wp_registered_sidebars, $wp_registered_widgets, $_wp_sidebars_widgets, $debugcount;
125 125
     // only do these debug if we are logged in and are the administrator
Please login to merge, or discard this patch.