@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | require_once LASSO_DIR.'/public/includes/wrap-shortcodes.php'; |
53 | 53 | |
54 | 54 | // Activate plugin when new blog is added |
55 | - add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) ); |
|
55 | + add_action('wpmu_new_blog', array($this, 'activate_new_site')); |
|
56 | 56 | |
57 | 57 | // Load plugin text domain |
58 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
58 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
59 | 59 | |
60 | - add_action( 'wp_ajax_get_aesop_component', array( $this, 'get_aesop_component' ) ); |
|
61 | - add_action( 'wp_ajax_editus_do_shortcode', array( $this, 'editus_do_shortcode' ) ); |
|
62 | - add_action( 'wp_ajax_editus_lock_post', array( $this, 'editus_lock_post' ) ); |
|
60 | + add_action('wp_ajax_get_aesop_component', array($this, 'get_aesop_component')); |
|
61 | + add_action('wp_ajax_editus_do_shortcode', array($this, 'editus_do_shortcode')); |
|
62 | + add_action('wp_ajax_editus_lock_post', array($this, 'editus_lock_post')); |
|
63 | 63 | |
64 | 64 | // enable saving custom fields through REST API |
65 | 65 | self::enable_metasave('post'); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public static function get_instance() { |
91 | 91 | |
92 | 92 | // If the single instance hasn't been set, set it now. |
93 | - if ( null == self::$instance ) { |
|
93 | + if (null == self::$instance) { |
|
94 | 94 | self::$instance = new self; |
95 | 95 | } |
96 | 96 | |
@@ -107,18 +107,18 @@ discard block |
||
107 | 107 | * WPMU is disabled or plugin is |
108 | 108 | * activated on an individual blog. |
109 | 109 | */ |
110 | - public static function activate( $network_wide ) { |
|
110 | + public static function activate($network_wide) { |
|
111 | 111 | |
112 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
112 | + if (function_exists('is_multisite') && is_multisite()) { |
|
113 | 113 | |
114 | - if ( $network_wide ) { |
|
114 | + if ($network_wide) { |
|
115 | 115 | |
116 | 116 | // Get all blog ids |
117 | 117 | $blog_ids = self::get_blog_ids(); |
118 | 118 | |
119 | - foreach ( $blog_ids as $blog_id ) { |
|
119 | + foreach ($blog_ids as $blog_id) { |
|
120 | 120 | |
121 | - switch_to_blog( $blog_id ); |
|
121 | + switch_to_blog($blog_id); |
|
122 | 122 | self::single_activate(); |
123 | 123 | } |
124 | 124 | |
@@ -144,18 +144,18 @@ discard block |
||
144 | 144 | * WPMU is disabled or plugin is |
145 | 145 | * deactivated on an individual blog. |
146 | 146 | */ |
147 | - public static function deactivate( $network_wide ) { |
|
147 | + public static function deactivate($network_wide) { |
|
148 | 148 | |
149 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
149 | + if (function_exists('is_multisite') && is_multisite()) { |
|
150 | 150 | |
151 | - if ( $network_wide ) { |
|
151 | + if ($network_wide) { |
|
152 | 152 | |
153 | 153 | // Get all blog ids |
154 | 154 | $blog_ids = self::get_blog_ids(); |
155 | 155 | |
156 | - foreach ( $blog_ids as $blog_id ) { |
|
156 | + foreach ($blog_ids as $blog_id) { |
|
157 | 157 | |
158 | - switch_to_blog( $blog_id ); |
|
158 | + switch_to_blog($blog_id); |
|
159 | 159 | self::single_deactivate(); |
160 | 160 | |
161 | 161 | } |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @param int $blog_id ID of the new blog. |
181 | 181 | */ |
182 | - public function activate_new_site( $blog_id ) { |
|
182 | + public function activate_new_site($blog_id) { |
|
183 | 183 | |
184 | - if ( 1 !== did_action( 'wpmu_new_blog' ) ) { |
|
184 | + if (1 !== did_action('wpmu_new_blog')) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | - switch_to_blog( $blog_id ); |
|
188 | + switch_to_blog($blog_id); |
|
189 | 189 | self::single_activate(); |
190 | 190 | restore_current_blog(); |
191 | 191 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | WHERE archived = '0' AND spam = '0' |
211 | 211 | AND deleted = '0'"; |
212 | 212 | |
213 | - return $wpdb->get_col( $sql ); |
|
213 | + return $wpdb->get_col($sql); |
|
214 | 214 | |
215 | 215 | } |
216 | 216 | |
@@ -221,18 +221,18 @@ discard block |
||
221 | 221 | */ |
222 | 222 | private static function single_activate() { |
223 | 223 | |
224 | - $curr_version = get_option( 'lasso_version' ); |
|
224 | + $curr_version = get_option('lasso_version'); |
|
225 | 225 | |
226 | 226 | // update upgraded from |
227 | - if ( $curr_version ) { |
|
228 | - update_option( 'lasso_updated_from', $curr_version ); |
|
227 | + if ($curr_version) { |
|
228 | + update_option('lasso_updated_from', $curr_version); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // update lasso version option |
232 | - update_option( 'lasso_version', LASSO_VERSION ); |
|
232 | + update_option('lasso_version', LASSO_VERSION); |
|
233 | 233 | |
234 | 234 | // set transietn for activation welcome |
235 | - set_transient( '_lasso_welcome_redirect', true, 30 ); |
|
235 | + set_transient('_lasso_welcome_redirect', true, 30); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | } |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | public function load_plugin_textdomain() { |
255 | 255 | |
256 | 256 | $domain = $this->plugin_slug; |
257 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
257 | + $locale = apply_filters('plugin_locale', get_locale(), $domain); |
|
258 | 258 | |
259 | - $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
|
259 | + $out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo'); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // new ajax function to lock post for editing |
263 | 263 | public function editus_lock_post() |
264 | 264 | { |
265 | - $post_id= $_POST["postid"]; |
|
265 | + $post_id = $_POST["postid"]; |
|
266 | 266 | $locked = wp_check_post_lock($post_id); |
267 | 267 | |
268 | 268 | if (!$locked) { |
@@ -270,18 +270,18 @@ discard block |
||
270 | 270 | echo "true"; |
271 | 271 | } else { |
272 | 272 | $user_info = get_userdata($locked); |
273 | - echo "Post opened by ".$user_info->first_name . " " . $user_info->last_name; |
|
273 | + echo "Post opened by ".$user_info->first_name." ".$user_info->last_name; |
|
274 | 274 | } |
275 | 275 | exit; |
276 | 276 | } |
277 | 277 | |
278 | 278 | public static function enable_metasave($type) |
279 | 279 | { |
280 | - register_rest_field( $type, 'metadata', array( |
|
281 | - 'get_callback' => function ( $data ) { |
|
282 | - return get_post_meta( $data['id']);//, '', '' ); |
|
280 | + register_rest_field($type, 'metadata', array( |
|
281 | + 'get_callback' => function($data) { |
|
282 | + return get_post_meta($data['id']); //, '', '' ); |
|
283 | 283 | }, |
284 | - 'update_callback' => function( $data, $post ) { |
|
284 | + 'update_callback' => function($data, $post) { |
|
285 | 285 | foreach ($data as $key => $value) { |
286 | 286 | update_post_meta($post->ID, $key, $value); |
287 | 287 | } |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | public function editus_do_shortcode() |
294 | 294 | { |
295 | 295 | |
296 | - $code= $_POST["code"]; |
|
296 | + $code = $_POST["code"]; |
|
297 | 297 | $code = str_replace('\"', '"', $code); |
298 | - $out = lasso_wrap_shortcodes( $code); |
|
298 | + $out = lasso_wrap_shortcodes($code); |
|
299 | 299 | //file_put_contents(WP_PLUGIN_DIR."/file9.txt", $out); |
300 | - $out = do_shortcode($out); |
|
300 | + $out = do_shortcode($out); |
|
301 | 301 | //file_put_contents(WP_PLUGIN_DIR."/file10.txt", $out); |
302 | 302 | echo $out; |
303 | 303 | exit; |
@@ -307,53 +307,53 @@ discard block |
||
307 | 307 | { |
308 | 308 | |
309 | 309 | |
310 | - $code= $_POST["code"]; |
|
310 | + $code = $_POST["code"]; |
|
311 | 311 | $atts = array( |
312 | 312 | ); |
313 | 313 | foreach ($_POST as $key => $value) { |
314 | - if ($key !="code" && $key !="action") { |
|
314 | + if ($key != "code" && $key != "action") { |
|
315 | 315 | //$shortcode = $shortcode.$key.'="'.$value.'" '; |
316 | 316 | $atts[$key] = $value; |
317 | 317 | } |
318 | 318 | } |
319 | 319 | if ($code == "aesop_video") { |
320 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
320 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
321 | 321 | echo aesop_video_shortcode($atts); |
322 | 322 | } |
323 | 323 | else if ($code == "aesop_image") { |
324 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
324 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
325 | 325 | echo aesop_image_shortcode($atts); |
326 | 326 | } |
327 | 327 | else if ($code == "aesop_quote") { |
328 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
328 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
329 | 329 | echo aesop_quote_shortcode($atts); |
330 | 330 | } |
331 | 331 | else if ($code == "aesop_parallax") { |
332 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
332 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
333 | 333 | echo aesop_parallax_shortcode($atts); |
334 | 334 | } |
335 | 335 | else if ($code == "aesop_character") { |
336 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
336 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
337 | 337 | echo aesop_character_shortcode($atts); |
338 | 338 | } |
339 | 339 | else if ($code == "aesop_collection") { |
340 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
340 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
341 | 341 | echo aesop_collection_shortcode($atts); |
342 | 342 | } |
343 | 343 | else if ($code == "aesop_chapter") { |
344 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
344 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
345 | 345 | echo aesop_chapter_shortcode($atts); |
346 | 346 | } |
347 | 347 | else if ($code == "aesop_content") { |
348 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
348 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
349 | 349 | echo aesop_content_shortcode($atts, $atts['content_data']); |
350 | 350 | } |
351 | 351 | else if ($code == "aesop_gallery") { |
352 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
353 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
352 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
353 | + echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]'); |
|
354 | 354 | } |
355 | 355 | else if ($code == "aesop_audio") { |
356 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
356 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
357 | 357 | echo aesop_audio_shortcode($atts); |
358 | 358 | } |
359 | 359 | else { |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | * @return the option value |
13 | 13 | * @since 1.0 |
14 | 14 | */ |
15 | -function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
15 | +function lasso_editor_get_option($option, $section, $default = '') { |
|
16 | 16 | |
17 | - if ( empty( $option ) ) |
|
17 | + if (empty($option)) |
|
18 | 18 | return; |
19 | 19 | |
20 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
20 | + if (function_exists('is_multisite') && is_multisite()) { |
|
21 | 21 | |
22 | - $options = get_site_option( $section ); |
|
22 | + $options = get_site_option($section); |
|
23 | 23 | |
24 | 24 | } else { |
25 | 25 | |
26 | - $options = get_option( $section ); |
|
26 | + $options = get_option($section); |
|
27 | 27 | } |
28 | 28 | |
29 | - if ( isset( $options[$option] ) ) { |
|
29 | + if (isset($options[$option])) { |
|
30 | 30 | return $options[$option]; |
31 | 31 | } |
32 | 32 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function lasso_editor_galleries_exist() { |
42 | 42 | |
43 | - $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
|
43 | + $q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish')); |
|
44 | 44 | |
45 | - if ( $q->have_posts() ) |
|
45 | + if ($q->have_posts()) |
|
46 | 46 | return true; |
47 | 47 | else |
48 | 48 | return false; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | function lasso_get_supported_theme_class() { |
58 | 58 | |
59 | 59 | $name = wp_get_theme()->get('Name'); |
60 | - $slug = lasso_clean_string( $name ); |
|
60 | + $slug = lasso_clean_string($name); |
|
61 | 61 | |
62 | - switch ( $slug ) { |
|
62 | + switch ($slug) { |
|
63 | 63 | case 'aesop-story-theme': // aesop |
64 | 64 | $out = '.aesop-entry-content'; |
65 | 65 | break; |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | |
109 | 109 | } |
110 | 110 | |
111 | - return apply_filters('lasso_content_class', !empty( $out ) ? $out : false); |
|
111 | + return apply_filters('lasso_content_class', !empty($out) ? $out : false); |
|
112 | 112 | //return !empty( $out ) ? $out : false; |
113 | 113 | } |
114 | 114 | |
115 | 115 | function lasso_get_supported_theme_title_class() { |
116 | 116 | |
117 | 117 | $name = wp_get_theme()->get('Name'); |
118 | - $slug = lasso_clean_string( $name ); |
|
118 | + $slug = lasso_clean_string($name); |
|
119 | 119 | |
120 | - switch ( $slug ) { |
|
120 | + switch ($slug) { |
|
121 | 121 | |
122 | 122 | case 'aesop-story-theme': // aesop |
123 | 123 | $out = '.aesop-entry-title'; |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | break; |
146 | 146 | } |
147 | 147 | |
148 | - return apply_filters('lasso_title_class', !empty( $out ) ? $out : false); |
|
148 | + return apply_filters('lasso_title_class', !empty($out) ? $out : false); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | //since 0.9.9.6 |
152 | 152 | function lasso_get_supported_theme_featured_image_class() { |
153 | 153 | |
154 | 154 | $name = wp_get_theme()->get('Name'); |
155 | - $slug = lasso_clean_string( $name ); |
|
155 | + $slug = lasso_clean_string($name); |
|
156 | 156 | |
157 | - return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false); |
|
157 | + return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @since 0.8.7 |
166 | 166 | * @return string of comma separated classes |
167 | 167 | */ |
168 | -function lasso_supported_no_save(){ |
|
168 | +function lasso_supported_no_save() { |
|
169 | 169 | |
170 | 170 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .meta, .edit-link, .ssba, .jp-relatedposts, .fb-comments'); |
171 | 171 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return array|mixed|object|string|void |
181 | 181 | */ |
182 | -function lasso_sanitize_data( $data ) { |
|
183 | - return \lasso\sanatize::do_sanitize( $data ); |
|
182 | +function lasso_sanitize_data($data) { |
|
183 | + return \lasso\sanatize::do_sanitize($data); |
|
184 | 184 | |
185 | 185 | } |
186 | 186 | |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | * @since 0.9.3 |
191 | 191 | * @return string of comma delimited category slugs |
192 | 192 | */ |
193 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
193 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
194 | 194 | |
195 | - if ( empty( $postid ) ) |
|
195 | + if (empty($postid)) |
|
196 | 196 | $postid = get_the_ID(); |
197 | 197 | |
198 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
198 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
199 | 199 | |
200 | - if ( empty( $objects) ) |
|
200 | + if (empty($objects)) |
|
201 | 201 | return; |
202 | 202 | |
203 | 203 | $out = ''; |
204 | - foreach( $objects as $object ) { |
|
204 | + foreach ($objects as $object) { |
|
205 | 205 | //$out .= $object->slug.', '; |
206 | 206 | $out .= $object->name.','; |
207 | 207 | } |
@@ -216,15 +216,15 @@ discard block |
||
216 | 216 | * @since 0.9.3 |
217 | 217 | * @return array all categoiries |
218 | 218 | */ |
219 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
219 | +function lasso_get_objects($taxonomy = 'category') { |
|
220 | 220 | |
221 | 221 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
222 | 222 | |
223 | - if ( empty( $objects) ) |
|
223 | + if (empty($objects)) |
|
224 | 224 | return; |
225 | 225 | |
226 | 226 | $out = ""; |
227 | - foreach( $objects as $object ) { |
|
227 | + foreach ($objects as $object) { |
|
228 | 228 | $out .= $object->name.','; |
229 | 229 | } |
230 | 230 | |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @since 0.9.4 |
240 | 240 | */ |
241 | 241 | function lasso_post_types_names() { |
242 | - $post_types = get_post_types( array( |
|
242 | + $post_types = get_post_types(array( |
|
243 | 243 | 'public' => true, |
244 | - ), 'objects' ); |
|
245 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
246 | - unset( $post_types[ 'attachment' ] ); |
|
244 | + ), 'objects'); |
|
245 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
246 | + unset($post_types['attachment']); |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Set which post types are allowed |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
254 | 254 | */ |
255 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
256 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
255 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
256 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
257 | 257 | if (!current_user_can('edit_pages')) { |
258 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
258 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
259 | 259 | } |
260 | - foreach( $post_types as $name => $label ) { |
|
261 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
262 | - unset( $post_types[ $name ] ); |
|
260 | + foreach ($post_types as $name => $label) { |
|
261 | + if (!in_array($name, $allowed_post_types)) { |
|
262 | + unset($post_types[$name]); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | return $post_types; |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | function lasso_post_types() { |
270 | - $post_types = get_post_types( array( |
|
270 | + $post_types = get_post_types(array( |
|
271 | 271 | 'public' => true, |
272 | - ), 'names' ); |
|
273 | - unset( $post_types[ 'attachment' ] ); |
|
272 | + ), 'names'); |
|
273 | + unset($post_types['attachment']); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Set which post types are allowed |
@@ -279,11 +279,11 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
281 | 281 | */ |
282 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
283 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
284 | - foreach( $post_types as $name => $label ) { |
|
285 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
286 | - unset( $post_types[ $name ] ); |
|
282 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
283 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
284 | + foreach ($post_types as $name => $label) { |
|
285 | + if (!in_array($name, $allowed_post_types)) { |
|
286 | + unset($post_types[$name]); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | return $post_types; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | global $wp_post_types; |
294 | 294 | $post_types = lasso_post_types(); |
295 | 295 | $rest_base = array(); |
296 | - foreach ( $post_types as $post_type) { |
|
296 | + foreach ($post_types as $post_type) { |
|
297 | 297 | $rest_base[$post_type] = $wp_post_types[$post_type]->rest_base; |
298 | 298 | } |
299 | 299 | |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | * @uses lasso_modal_addons() |
312 | 312 | * @since 0.9.4 |
313 | 313 | */ |
314 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
314 | +function lasso_modal_addons_content($tab = '', $type) { |
|
315 | 315 | |
316 | - $name = lasso_clean_string( $tab['name'] ); |
|
316 | + $name = lasso_clean_string($tab['name']); |
|
317 | 317 | |
318 | - if ( 'tab' == $type ) { |
|
318 | + if ('tab' == $type) { |
|
319 | 319 | |
320 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
320 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
321 | 321 | |
322 | - } else if ( 'content' == $type ){ |
|
322 | + } else if ('content' == $type) { |
|
323 | 323 | |
324 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
325 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
324 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
325 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
326 | 326 | |
327 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
327 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
328 | 328 | %s%s |
329 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
329 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
330 | 330 | |
331 | 331 | } |
332 | 332 | |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @return void|string |
343 | 343 | */ |
344 | -function lasso_clean_string( $string = '' ) { |
|
344 | +function lasso_clean_string($string = '') { |
|
345 | 345 | |
346 | - if ( empty( $string ) ) |
|
346 | + if (empty($string)) |
|
347 | 347 | return; |
348 | 348 | |
349 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
349 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return void|string |
361 | 361 | */ |
362 | -function lasso_unclean_string( $string = '' ) { |
|
362 | +function lasso_unclean_string($string = '') { |
|
363 | 363 | |
364 | - if ( empty( $string ) ) { |
|
364 | + if (empty($string)) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | |
368 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
368 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -380,39 +380,39 @@ discard block |
||
380 | 380 | * @param unknown $postid int the id of the post object to check against |
381 | 381 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
382 | 382 | */ |
383 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
384 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
383 | +if (!function_exists('lasso_user_can')): |
|
384 | + function lasso_user_can($action = '', $postid = 0) { |
|
385 | 385 | $result = false; |
386 | - if ( empty( $action ) ) |
|
386 | + if (empty($action)) |
|
387 | 387 | $action = 'edit_posts'; |
388 | 388 | |
389 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
389 | + if (empty($postid) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
390 | 390 | $postid = get_the_ID(); |
391 | 391 | |
392 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
392 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
393 | 393 | // check against post types: |
394 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
394 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
395 | 395 | |
396 | 396 | if (!current_user_can('edit_pages')) { |
397 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
397 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | if (!empty($allowed_post_types) && !empty($postid)) { |
401 | - $type = get_post_type( $postid ); |
|
402 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
401 | + $type = get_post_type($postid); |
|
402 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
403 | 403 | |
404 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
405 | - $result = true; |
|
404 | + if (in_array($type, $allowed_post_types)) { |
|
405 | + $result = true; |
|
406 | 406 | } |
407 | 407 | } else { |
408 | 408 | //we are not checking against a post, return true |
409 | - $result = true; |
|
409 | + $result = true; |
|
410 | 410 | } |
411 | 411 | } else { |
412 | 412 | $result = false; |
413 | 413 | } |
414 | 414 | |
415 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
415 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
416 | 416 | } |
417 | 417 | endif; |
418 | 418 | |
@@ -421,25 +421,25 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @since 0.9.5 |
423 | 423 | */ |
424 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
424 | +if (!function_exists('lasso_editor_empty_results')): |
|
425 | 425 | |
426 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
426 | + function lasso_editor_empty_results($type = 'posts') { |
|
427 | 427 | |
428 | - if ( 'posts' == $type ) { |
|
428 | + if ('posts' == $type) { |
|
429 | 429 | |
430 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
430 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
431 | 431 | $icon = 'lasso-icon-file-text2'; |
432 | 432 | $button = false; |
433 | 433 | |
434 | - } elseif ( 'revision' == $type ) { |
|
434 | + } elseif ('revision' == $type) { |
|
435 | 435 | |
436 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
436 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
437 | 437 | $icon = 'lasso-icon-history'; |
438 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
438 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
439 | 439 | |
440 | 440 | } |
441 | 441 | |
442 | - return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button ); |
|
442 | + return sprintf('<div id="lasso--empty-state" class="lasso--empty-state"><i class="lasso--empty-state-icon lasso-icon %s"></i><p>%s</p>%s</div>', $icon, $string, $button); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | endif; |