@@ -12,24 +12,24 @@ discard block |
||
| 12 | 12 | * @return the option value |
| 13 | 13 | * @since 1.0 |
| 14 | 14 | */ |
| 15 | -if( !function_exists('lasso_editor_get_option')): |
|
| 16 | - function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
| 15 | +if (!function_exists('lasso_editor_get_option')): |
|
| 16 | + function lasso_editor_get_option($option, $section, $default = '') { |
|
| 17 | 17 | |
| 18 | - if ( empty( $option ) ) |
|
| 18 | + if (empty($option)) |
|
| 19 | 19 | return; |
| 20 | 20 | |
| 21 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 21 | + if (function_exists('is_multisite') && is_multisite()) { |
|
| 22 | 22 | |
| 23 | - $options = get_site_option( $section ); |
|
| 23 | + $options = get_site_option($section); |
|
| 24 | 24 | |
| 25 | 25 | } else { |
| 26 | 26 | |
| 27 | - $options = get_option( $section ); |
|
| 27 | + $options = get_option($section); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $options = apply_filters( 'editus_filter_options', $options ); |
|
| 30 | + $options = apply_filters('editus_filter_options', $options); |
|
| 31 | 31 | |
| 32 | - if ( isset( $options[$option] ) ) { |
|
| 32 | + if (isset($options[$option])) { |
|
| 33 | 33 | return $options[$option]; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | function lasso_editor_galleries_exist() { |
| 46 | 46 | |
| 47 | - $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
|
| 47 | + $q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish')); |
|
| 48 | 48 | |
| 49 | - if ( $q->have_posts() ) |
|
| 49 | + if ($q->have_posts()) |
|
| 50 | 50 | return true; |
| 51 | 51 | else |
| 52 | 52 | return false; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | function lasso_get_supported_theme_class() { |
| 62 | 62 | |
| 63 | 63 | $name = wp_get_theme()->get('Name'); |
| 64 | - $slug = lasso_clean_string( $name ); |
|
| 64 | + $slug = lasso_clean_string($name); |
|
| 65 | 65 | |
| 66 | - switch ( $slug ) { |
|
| 66 | + switch ($slug) { |
|
| 67 | 67 | case 'aesop-story-theme': // aesop |
| 68 | 68 | $out = '.aesop-entry-content'; |
| 69 | 69 | break; |
@@ -112,16 +112,16 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - return apply_filters('lasso_content_class', !empty( $out ) ? $out : false); |
|
| 115 | + return apply_filters('lasso_content_class', !empty($out) ? $out : false); |
|
| 116 | 116 | //return !empty( $out ) ? $out : false; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | function lasso_get_supported_theme_title_class() { |
| 120 | 120 | |
| 121 | 121 | $name = wp_get_theme()->get('Name'); |
| 122 | - $slug = lasso_clean_string( $name ); |
|
| 122 | + $slug = lasso_clean_string($name); |
|
| 123 | 123 | |
| 124 | - switch ( $slug ) { |
|
| 124 | + switch ($slug) { |
|
| 125 | 125 | |
| 126 | 126 | case 'aesop-story-theme': // aesop |
| 127 | 127 | $out = '.aesop-entry-title'; |
@@ -149,16 +149,16 @@ discard block |
||
| 149 | 149 | break; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return apply_filters('lasso_title_class', !empty( $out ) ? $out : false); |
|
| 152 | + return apply_filters('lasso_title_class', !empty($out) ? $out : false); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | //since 0.9.9.6 |
| 156 | 156 | function lasso_get_supported_theme_featured_image_class() { |
| 157 | 157 | |
| 158 | 158 | $name = wp_get_theme()->get('Name'); |
| 159 | - $slug = lasso_clean_string( $name ); |
|
| 159 | + $slug = lasso_clean_string($name); |
|
| 160 | 160 | |
| 161 | - return apply_filters('lasso_featured_image_class', !empty( $out ) ? $out : false); |
|
| 161 | + return apply_filters('lasso_featured_image_class', !empty($out) ? $out : false); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @since 0.8.7 |
| 170 | 170 | * @return string of comma separated classes |
| 171 | 171 | */ |
| 172 | -function lasso_supported_no_save(){ |
|
| 172 | +function lasso_supported_no_save() { |
|
| 173 | 173 | |
| 174 | 174 | return apply_filters('lasso_dont_save', '.lasso--ignore,.sharedaddy,.us_wrapper,.meta,.edit-link,.ssba,.addtoany_share_save_container,.mashsb-container,.heateor_sss_sharing_container,.nc_socialPanel,.jp-relatedposts,.fb-comments,.adsbygoogle,.swp_social_panel'); |
| 175 | 175 | } |
@@ -183,8 +183,8 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @return array|mixed|object|string|void |
| 185 | 185 | */ |
| 186 | -function lasso_sanitize_data( $data ) { |
|
| 187 | - return \lasso\sanatize::do_sanitize( $data ); |
|
| 186 | +function lasso_sanitize_data($data) { |
|
| 187 | + return \lasso\sanatize::do_sanitize($data); |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
@@ -194,18 +194,18 @@ discard block |
||
| 194 | 194 | * @since 0.9.3 |
| 195 | 195 | * @return string of comma delimited category slugs |
| 196 | 196 | */ |
| 197 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
| 197 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
| 198 | 198 | |
| 199 | - if ( empty( $postid ) ) |
|
| 199 | + if (empty($postid)) |
|
| 200 | 200 | $postid = get_the_ID(); |
| 201 | 201 | |
| 202 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
| 202 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
| 203 | 203 | |
| 204 | - if ( empty( $objects) ) |
|
| 204 | + if (empty($objects)) |
|
| 205 | 205 | return; |
| 206 | 206 | |
| 207 | 207 | $out = ''; |
| 208 | - foreach( $objects as $object ) { |
|
| 208 | + foreach ($objects as $object) { |
|
| 209 | 209 | //$out .= $object->slug.', '; |
| 210 | 210 | $out .= $object->name.','; |
| 211 | 211 | } |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | * @since 0.9.3 |
| 221 | 221 | * @return array all categoiries |
| 222 | 222 | */ |
| 223 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
| 223 | +function lasso_get_objects($taxonomy = 'category') { |
|
| 224 | 224 | |
| 225 | 225 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
| 226 | 226 | |
| 227 | - if ( empty( $objects) ) |
|
| 227 | + if (empty($objects)) |
|
| 228 | 228 | return; |
| 229 | 229 | |
| 230 | 230 | $out = ""; |
| 231 | - foreach( $objects as $object ) { |
|
| 231 | + foreach ($objects as $object) { |
|
| 232 | 232 | $out .= $object->name.','; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | * @since 0.9.4 |
| 244 | 244 | */ |
| 245 | 245 | function lasso_post_types_names() { |
| 246 | - $post_types = get_post_types( array( |
|
| 246 | + $post_types = get_post_types(array( |
|
| 247 | 247 | 'public' => true, |
| 248 | - ), 'objects' ); |
|
| 249 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
| 250 | - unset( $post_types[ 'attachment' ] ); |
|
| 248 | + ), 'objects'); |
|
| 249 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
| 250 | + unset($post_types['attachment']); |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * Set which post types are allowed |
@@ -256,14 +256,14 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
| 258 | 258 | */ |
| 259 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
| 260 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 259 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
| 260 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 261 | 261 | if (!current_user_can('edit_pages')) { |
| 262 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
| 262 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
| 263 | 263 | } |
| 264 | - foreach( $post_types as $name => $label ) { |
|
| 265 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
| 266 | - unset( $post_types[ $name ] ); |
|
| 264 | + foreach ($post_types as $name => $label) { |
|
| 265 | + if (!in_array($name, $allowed_post_types)) { |
|
| 266 | + unset($post_types[$name]); |
|
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | return $post_types; |
@@ -271,10 +271,10 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | |
| 273 | 273 | function lasso_post_types() { |
| 274 | - $post_types = get_post_types( array( |
|
| 274 | + $post_types = get_post_types(array( |
|
| 275 | 275 | 'public' => true, |
| 276 | - ), 'names' ); |
|
| 277 | - unset( $post_types[ 'attachment' ] ); |
|
| 276 | + ), 'names'); |
|
| 277 | + unset($post_types['attachment']); |
|
| 278 | 278 | |
| 279 | 279 | /** |
| 280 | 280 | * Set which post types are allowed |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
| 285 | 285 | */ |
| 286 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
| 287 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 288 | - foreach( $post_types as $name => $label ) { |
|
| 289 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
| 290 | - unset( $post_types[ $name ] ); |
|
| 286 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
| 287 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 288 | + foreach ($post_types as $name => $label) { |
|
| 289 | + if (!in_array($name, $allowed_post_types)) { |
|
| 290 | + unset($post_types[$name]); |
|
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | return $post_types; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | global $wp_post_types; |
| 298 | 298 | $post_types = lasso_post_types(); |
| 299 | 299 | $rest_base = array(); |
| 300 | - foreach ( $post_types as $post_type) { |
|
| 300 | + foreach ($post_types as $post_type) { |
|
| 301 | 301 | $rest_base[$post_type] = $wp_post_types[$post_type]->rest_base; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -315,22 +315,22 @@ discard block |
||
| 315 | 315 | * @uses lasso_modal_addons() |
| 316 | 316 | * @since 0.9.4 |
| 317 | 317 | */ |
| 318 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
| 318 | +function lasso_modal_addons_content($tab = '', $type) { |
|
| 319 | 319 | |
| 320 | - $name = lasso_clean_string( $tab['name'] ); |
|
| 320 | + $name = lasso_clean_string($tab['name']); |
|
| 321 | 321 | |
| 322 | - if ( 'tab' == $type ) { |
|
| 322 | + if ('tab' == $type) { |
|
| 323 | 323 | |
| 324 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
| 324 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
| 325 | 325 | |
| 326 | - } else if ( 'content' == $type ){ |
|
| 326 | + } else if ('content' == $type) { |
|
| 327 | 327 | |
| 328 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
| 329 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
| 328 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
| 329 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
| 330 | 330 | |
| 331 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 331 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 332 | 332 | %s%s |
| 333 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
| 333 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
| 334 | 334 | |
| 335 | 335 | } |
| 336 | 336 | |
@@ -345,12 +345,12 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @return void|string |
| 347 | 347 | */ |
| 348 | -function lasso_clean_string( $string = '' ) { |
|
| 348 | +function lasso_clean_string($string = '') { |
|
| 349 | 349 | |
| 350 | - if ( empty( $string ) ) |
|
| 350 | + if (empty($string)) |
|
| 351 | 351 | return; |
| 352 | 352 | |
| 353 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
| 353 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
@@ -363,13 +363,13 @@ discard block |
||
| 363 | 363 | * |
| 364 | 364 | * @return void|string |
| 365 | 365 | */ |
| 366 | -function lasso_unclean_string( $string = '' ) { |
|
| 366 | +function lasso_unclean_string($string = '') { |
|
| 367 | 367 | |
| 368 | - if ( empty( $string ) ) { |
|
| 368 | + if (empty($string)) { |
|
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
| 372 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | |
@@ -384,40 +384,40 @@ discard block |
||
| 384 | 384 | * @param unknown $postid int the id of the post object to check against |
| 385 | 385 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
| 386 | 386 | */ |
| 387 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
| 388 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
| 387 | +if (!function_exists('lasso_user_can')): |
|
| 388 | + function lasso_user_can($action = '', $postid = 0) { |
|
| 389 | 389 | $result = false; |
| 390 | - if ( empty( $action ) ) |
|
| 390 | + if (empty($action)) |
|
| 391 | 391 | $action = 'edit_posts'; |
| 392 | 392 | |
| 393 | - if ( empty( $postid ) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
| 393 | + if (empty($postid) && $action != 'edit_posts' && $action != 'publish_posts' && $action != 'delete_posts') |
|
| 394 | 394 | $postid = get_the_ID(); |
| 395 | 395 | |
| 396 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
| 396 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
| 397 | 397 | // check against post types: |
| 398 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
| 398 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
| 399 | 399 | |
| 400 | 400 | if (!current_user_can('edit_pages')) { |
| 401 | - $allowed_post_types = array_diff($allowed_post_types,array('page')); |
|
| 401 | + $allowed_post_types = array_diff($allowed_post_types, array('page')); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | if (!empty($allowed_post_types) && !empty($postid)) { |
| 405 | - $type = get_post_type( $postid ); |
|
| 406 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 405 | + $type = get_post_type($postid); |
|
| 406 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 407 | 407 | |
| 408 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
| 409 | - $result = true; |
|
| 408 | + if (in_array($type, $allowed_post_types)) { |
|
| 409 | + $result = true; |
|
| 410 | 410 | } |
| 411 | 411 | } else { |
| 412 | 412 | //we are not checking against a post, return true |
| 413 | - $result = true; |
|
| 413 | + $result = true; |
|
| 414 | 414 | } |
| 415 | 415 | } else { |
| 416 | 416 | $result = false; |
| 417 | 417 | } |
| 418 | 418 | //if ( function_exists( 'is_gutenberg_page' ) && has_blocks() ) return false; |
| 419 | 419 | |
| 420 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
| 420 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
| 421 | 421 | } |
| 422 | 422 | endif; |
| 423 | 423 | |
@@ -426,25 +426,25 @@ discard block |
||
| 426 | 426 | * |
| 427 | 427 | * @since 0.9.5 |
| 428 | 428 | */ |
| 429 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
| 429 | +if (!function_exists('lasso_editor_empty_results')): |
|
| 430 | 430 | |
| 431 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
| 431 | + function lasso_editor_empty_results($type = 'posts') { |
|
| 432 | 432 | |
| 433 | - if ( 'posts' == $type ) { |
|
| 433 | + if ('posts' == $type) { |
|
| 434 | 434 | |
| 435 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
| 435 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
| 436 | 436 | $icon = 'lasso-icon-file-text2'; |
| 437 | 437 | $button = false; |
| 438 | 438 | |
| 439 | - } elseif ( 'revision' == $type ) { |
|
| 439 | + } elseif ('revision' == $type) { |
|
| 440 | 440 | |
| 441 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
| 441 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
| 442 | 442 | $icon = 'lasso-icon-history'; |
| 443 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
| 443 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
| 444 | 444 | |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - 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 ); |
|
| 447 | + 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); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | endif; |
@@ -18,27 +18,27 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | // If this file is called directly, abort. |
| 21 | -if ( ! defined( 'WPINC' ) ) { |
|
| 21 | +if (!defined('WPINC')) { |
|
| 22 | 22 | die; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Set some constants |
| 26 | -define( 'LASSO_VERSION', '1.0.6' ); |
|
| 27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); |
|
| 29 | -define( 'LASSO_FILE', __FILE__ ); |
|
| 26 | +define('LASSO_VERSION', '1.0.6'); |
|
| 27 | +define('LASSO_DIR', plugin_dir_path(__FILE__)); |
|
| 28 | +define('LASSO_URL', plugins_url('', __FILE__)); |
|
| 29 | +define('LASSO_FILE', __FILE__); |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Load plugin if PHP version is 5.4 or later. |
| 33 | 33 | */ |
| 34 | -if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { |
|
| 34 | +if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
|
| 35 | 35 | |
| 36 | - include_once( LASSO_DIR . '/bootstrap.php' ); |
|
| 36 | + include_once(LASSO_DIR.'/bootstrap.php'); |
|
| 37 | 37 | |
| 38 | 38 | } else { |
| 39 | 39 | |
| 40 | 40 | add_action('admin_head', 'lasso_fail_notice'); |
| 41 | - function lasso_fail_notice(){ |
|
| 41 | + function lasso_fail_notice() { |
|
| 42 | 42 | |
| 43 | 43 | printf('<div class="error"><p>Editus requires PHP 5.4 or higher.</p></div>'); |
| 44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
| 49 | -function lasso_show_in_rest($args, $post_type){ |
|
| 49 | +function lasso_show_in_rest($args, $post_type) { |
|
| 50 | 50 | |
| 51 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
| 52 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 53 | - if (in_array( $post_type,$allowed_post_types)) { |
|
| 51 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( )); |
|
| 52 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 53 | + if (in_array($post_type, $allowed_post_types)) { |
|
| 54 | 54 | $args['show_in_rest'] = true; |
| 55 | 55 | if ($post_type != 'post' && $post_type != 'page') { |
| 56 | 56 | $args['rest_base'] = $post_type; |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | )); |
| 68 | 68 | |
| 69 | 69 | // Gutenberg |
| 70 | -if( function_exists( 'is_gutenberg_page' ) ) { |
|
| 71 | - function add_raw_to_post( $response, $post, $request ) { |
|
| 70 | +if (function_exists('is_gutenberg_page')) { |
|
| 71 | + function add_raw_to_post($response, $post, $request) { |
|
| 72 | 72 | $response_data = $response->get_data(); |
| 73 | - if ( is_array( $response_data['content'] )) { |
|
| 74 | - $response_data['content']['raw'] = $post->post_content ; |
|
| 75 | - $response->set_data( $response_data ); |
|
| 73 | + if (is_array($response_data['content'])) { |
|
| 74 | + $response_data['content']['raw'] = $post->post_content; |
|
| 75 | + $response->set_data($response_data); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $response; |
| 79 | 79 | } |
| 80 | - add_filter( "rest_prepare_post", 'add_raw_to_post', 10, 3 ); |
|
| 80 | + add_filter("rest_prepare_post", 'add_raw_to_post', 10, 3); |
|
| 81 | 81 | } |
| 82 | 82 | |