@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @since 0.0.1 |
| 75 | 75 | * |
| 76 | - * @return Plugin slug variable. |
|
| 76 | + * @return string slug variable. |
|
| 77 | 77 | */ |
| 78 | 78 | public function get_plugin_slug() { |
| 79 | 79 | return $this->plugin_slug; |
@@ -274,6 +274,9 @@ discard block |
||
| 274 | 274 | exit; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | + /** |
|
| 278 | + * @param string $type |
|
| 279 | + */ |
|
| 277 | 280 | public static function enable_metasave($type) |
| 278 | 281 | { |
| 279 | 282 | register_rest_field( $type, 'metadata', array( |
@@ -52,13 +52,13 @@ 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_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_lock_post', array($this, 'editus_lock_post')); |
|
| 62 | 62 | |
| 63 | 63 | // enable saving custom fields through REST API |
| 64 | 64 | self::enable_metasave('post'); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public static function get_instance() { |
| 90 | 90 | |
| 91 | 91 | // If the single instance hasn't been set, set it now. |
| 92 | - if ( null == self::$instance ) { |
|
| 92 | + if (null == self::$instance) { |
|
| 93 | 93 | self::$instance = new self; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -106,18 +106,18 @@ discard block |
||
| 106 | 106 | * WPMU is disabled or plugin is |
| 107 | 107 | * activated on an individual blog. |
| 108 | 108 | */ |
| 109 | - public static function activate( $network_wide ) { |
|
| 109 | + public static function activate($network_wide) { |
|
| 110 | 110 | |
| 111 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 111 | + if (function_exists('is_multisite') && is_multisite()) { |
|
| 112 | 112 | |
| 113 | - if ( $network_wide ) { |
|
| 113 | + if ($network_wide) { |
|
| 114 | 114 | |
| 115 | 115 | // Get all blog ids |
| 116 | 116 | $blog_ids = self::get_blog_ids(); |
| 117 | 117 | |
| 118 | - foreach ( $blog_ids as $blog_id ) { |
|
| 118 | + foreach ($blog_ids as $blog_id) { |
|
| 119 | 119 | |
| 120 | - switch_to_blog( $blog_id ); |
|
| 120 | + switch_to_blog($blog_id); |
|
| 121 | 121 | self::single_activate(); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -143,18 +143,18 @@ discard block |
||
| 143 | 143 | * WPMU is disabled or plugin is |
| 144 | 144 | * deactivated on an individual blog. |
| 145 | 145 | */ |
| 146 | - public static function deactivate( $network_wide ) { |
|
| 146 | + public static function deactivate($network_wide) { |
|
| 147 | 147 | |
| 148 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 148 | + if (function_exists('is_multisite') && is_multisite()) { |
|
| 149 | 149 | |
| 150 | - if ( $network_wide ) { |
|
| 150 | + if ($network_wide) { |
|
| 151 | 151 | |
| 152 | 152 | // Get all blog ids |
| 153 | 153 | $blog_ids = self::get_blog_ids(); |
| 154 | 154 | |
| 155 | - foreach ( $blog_ids as $blog_id ) { |
|
| 155 | + foreach ($blog_ids as $blog_id) { |
|
| 156 | 156 | |
| 157 | - switch_to_blog( $blog_id ); |
|
| 157 | + switch_to_blog($blog_id); |
|
| 158 | 158 | self::single_deactivate(); |
| 159 | 159 | |
| 160 | 160 | } |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @param int $blog_id ID of the new blog. |
| 180 | 180 | */ |
| 181 | - public function activate_new_site( $blog_id ) { |
|
| 181 | + public function activate_new_site($blog_id) { |
|
| 182 | 182 | |
| 183 | - if ( 1 !== did_action( 'wpmu_new_blog' ) ) { |
|
| 183 | + if (1 !== did_action('wpmu_new_blog')) { |
|
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - switch_to_blog( $blog_id ); |
|
| 187 | + switch_to_blog($blog_id); |
|
| 188 | 188 | self::single_activate(); |
| 189 | 189 | restore_current_blog(); |
| 190 | 190 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | WHERE archived = '0' AND spam = '0' |
| 210 | 210 | AND deleted = '0'"; |
| 211 | 211 | |
| 212 | - return $wpdb->get_col( $sql ); |
|
| 212 | + return $wpdb->get_col($sql); |
|
| 213 | 213 | |
| 214 | 214 | } |
| 215 | 215 | |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | private static function single_activate() { |
| 222 | 222 | |
| 223 | - $curr_version = get_option( 'lasso_version' ); |
|
| 223 | + $curr_version = get_option('lasso_version'); |
|
| 224 | 224 | |
| 225 | 225 | // update upgraded from |
| 226 | - if ( $curr_version ) { |
|
| 227 | - update_option( 'lasso_updated_from', $curr_version ); |
|
| 226 | + if ($curr_version) { |
|
| 227 | + update_option('lasso_updated_from', $curr_version); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // update lasso version option |
| 231 | - update_option( 'lasso_version', LASSO_VERSION ); |
|
| 231 | + update_option('lasso_version', LASSO_VERSION); |
|
| 232 | 232 | |
| 233 | 233 | // set transietn for activation welcome |
| 234 | - set_transient( '_lasso_welcome_redirect', true, 30 ); |
|
| 234 | + set_transient('_lasso_welcome_redirect', true, 30); |
|
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | } |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | public function load_plugin_textdomain() { |
| 254 | 254 | |
| 255 | 255 | $domain = $this->plugin_slug; |
| 256 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
| 256 | + $locale = apply_filters('plugin_locale', get_locale(), $domain); |
|
| 257 | 257 | |
| 258 | - $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
|
| 258 | + $out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo'); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | // new ajax function to lock post for editing |
| 262 | 262 | public function editus_lock_post() |
| 263 | 263 | { |
| 264 | - $post_id= $_POST["postid"]; |
|
| 264 | + $post_id = $_POST["postid"]; |
|
| 265 | 265 | $locked = wp_check_post_lock($post_id); |
| 266 | 266 | |
| 267 | 267 | if (!$locked) { |
@@ -269,18 +269,18 @@ discard block |
||
| 269 | 269 | echo "true"; |
| 270 | 270 | } else { |
| 271 | 271 | $user_info = get_userdata($locked); |
| 272 | - echo "Post opened by ".$user_info->first_name . " " . $user_info->last_name; |
|
| 272 | + echo "Post opened by ".$user_info->first_name." ".$user_info->last_name; |
|
| 273 | 273 | } |
| 274 | 274 | exit; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | public static function enable_metasave($type) |
| 278 | 278 | { |
| 279 | - register_rest_field( $type, 'metadata', array( |
|
| 280 | - 'get_callback' => function ( $data ) { |
|
| 281 | - return get_post_meta( $data['id']);//, '', '' ); |
|
| 279 | + register_rest_field($type, 'metadata', array( |
|
| 280 | + 'get_callback' => function($data) { |
|
| 281 | + return get_post_meta($data['id']); //, '', '' ); |
|
| 282 | 282 | }, |
| 283 | - 'update_callback' => function( $data, $post ) { |
|
| 283 | + 'update_callback' => function($data, $post) { |
|
| 284 | 284 | foreach ($data as $key => $value) { |
| 285 | 285 | update_post_meta($post->ID, $key, $value); |
| 286 | 286 | } |
@@ -294,57 +294,57 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | |
| 296 | 296 | |
| 297 | - $code= $_POST["code"]; |
|
| 297 | + $code = $_POST["code"]; |
|
| 298 | 298 | $atts = array( |
| 299 | 299 | ); |
| 300 | 300 | foreach ($_POST as $key => $value) { |
| 301 | - if ($key !="code" && $key !="action") { |
|
| 301 | + if ($key != "code" && $key != "action") { |
|
| 302 | 302 | //$shortcode = $shortcode.$key.'="'.$value.'" '; |
| 303 | 303 | $atts[$key] = $value; |
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | if ($code == "aesop_video") { |
| 307 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 307 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
| 308 | 308 | echo aesop_video_shortcode($atts); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | if ($code == "aesop_image") { |
| 312 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 312 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
| 313 | 313 | echo aesop_image_shortcode($atts); |
| 314 | 314 | } |
| 315 | 315 | if ($code == "aesop_quote") { |
| 316 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 316 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
| 317 | 317 | echo aesop_quote_shortcode($atts); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | if ($code == "aesop_parallax") { |
| 321 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 321 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
| 322 | 322 | echo aesop_parallax_shortcode($atts); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | if ($code == "aesop_character") { |
| 326 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 326 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
| 327 | 327 | echo aesop_character_shortcode($atts); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | if ($code == "aesop_collection") { |
| 331 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 331 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
| 332 | 332 | echo aesop_collection_shortcode($atts); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | if ($code == "aesop_chapter") { |
| 336 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 336 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
| 337 | 337 | echo aesop_chapter_shortcode($atts); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | if ($code == "aesop_content") { |
| 341 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 341 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
| 342 | 342 | echo aesop_content_shortcode($atts, $atts['content_data']); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | if ($code == "aesop_gallery") { |
| 346 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 347 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 346 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
| 347 | + echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]'); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | exit; |
@@ -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, .twitter-tweet, .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 | } |
| 207 | 207 | |
@@ -215,15 +215,15 @@ discard block |
||
| 215 | 215 | * @since 0.9.3 |
| 216 | 216 | * @return array all categoiries |
| 217 | 217 | */ |
| 218 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
| 218 | +function lasso_get_objects($taxonomy = 'category') { |
|
| 219 | 219 | |
| 220 | 220 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
| 221 | 221 | |
| 222 | - if ( empty( $objects) ) |
|
| 222 | + if (empty($objects)) |
|
| 223 | 223 | return; |
| 224 | 224 | |
| 225 | 225 | $out = array(); |
| 226 | - foreach( $objects as $object ) { |
|
| 226 | + foreach ($objects as $object) { |
|
| 227 | 227 | $out[] = $object->slug; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | * @since 0.9.4 |
| 239 | 239 | */ |
| 240 | 240 | function lasso_post_types_names() { |
| 241 | - $post_types = get_post_types( array( |
|
| 241 | + $post_types = get_post_types(array( |
|
| 242 | 242 | 'public' => true, |
| 243 | - ), 'objects' ); |
|
| 244 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
| 245 | - unset( $post_types[ 'attachment' ] ); |
|
| 243 | + ), 'objects'); |
|
| 244 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
| 245 | + unset($post_types['attachment']); |
|
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * Set which post types are allowed |
@@ -251,11 +251,11 @@ discard block |
||
| 251 | 251 | * |
| 252 | 252 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
| 253 | 253 | */ |
| 254 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post', 'page') ); |
|
| 255 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 256 | - foreach( $post_types as $name => $label ) { |
|
| 257 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
| 258 | - unset( $post_types[ $name ] ); |
|
| 254 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post', 'page')); |
|
| 255 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 256 | + foreach ($post_types as $name => $label) { |
|
| 257 | + if (!in_array($name, $allowed_post_types)) { |
|
| 258 | + unset($post_types[$name]); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | return $post_types; |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | function lasso_post_types() { |
| 266 | - $post_types = get_post_types( array( |
|
| 266 | + $post_types = get_post_types(array( |
|
| 267 | 267 | 'public' => true, |
| 268 | - ), 'names' ); |
|
| 268 | + ), 'names'); |
|
| 269 | 269 | //$post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
| 270 | - unset( $post_types[ 'attachment' ] ); |
|
| 270 | + unset($post_types['attachment']); |
|
| 271 | 271 | |
| 272 | 272 | /** |
| 273 | 273 | * Set which post types are allowed |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
| 278 | 278 | */ |
| 279 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
| 280 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 281 | - foreach( $post_types as $name => $label ) { |
|
| 282 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
| 283 | - unset( $post_types[ $name ] ); |
|
| 279 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
| 280 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 281 | + foreach ($post_types as $name => $label) { |
|
| 282 | + if (!in_array($name, $allowed_post_types)) { |
|
| 283 | + unset($post_types[$name]); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | return $post_types; |
@@ -299,22 +299,22 @@ discard block |
||
| 299 | 299 | * @uses lasso_modal_addons() |
| 300 | 300 | * @since 0.9.4 |
| 301 | 301 | */ |
| 302 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
| 302 | +function lasso_modal_addons_content($tab = '', $type) { |
|
| 303 | 303 | |
| 304 | - $name = lasso_clean_string( $tab['name'] ); |
|
| 304 | + $name = lasso_clean_string($tab['name']); |
|
| 305 | 305 | |
| 306 | - if ( 'tab' == $type ) { |
|
| 306 | + if ('tab' == $type) { |
|
| 307 | 307 | |
| 308 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
| 308 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
| 309 | 309 | |
| 310 | - } else if ( 'content' == $type ){ |
|
| 310 | + } else if ('content' == $type) { |
|
| 311 | 311 | |
| 312 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
| 313 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
| 312 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
| 313 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
| 314 | 314 | |
| 315 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 315 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 316 | 316 | %s%s |
| 317 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
| 317 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
| 318 | 318 | |
| 319 | 319 | } |
| 320 | 320 | |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | * |
| 330 | 330 | * @return void|string |
| 331 | 331 | */ |
| 332 | -function lasso_clean_string( $string = '' ) { |
|
| 332 | +function lasso_clean_string($string = '') { |
|
| 333 | 333 | |
| 334 | - if ( empty( $string ) ) |
|
| 334 | + if (empty($string)) |
|
| 335 | 335 | return; |
| 336 | 336 | |
| 337 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
| 337 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | * |
| 348 | 348 | * @return void|string |
| 349 | 349 | */ |
| 350 | -function lasso_unclean_string( $string = '' ) { |
|
| 350 | +function lasso_unclean_string($string = '') { |
|
| 351 | 351 | |
| 352 | - if ( empty( $string ) ) { |
|
| 352 | + if (empty($string)) { |
|
| 353 | 353 | return; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
| 356 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | |
@@ -368,28 +368,28 @@ discard block |
||
| 368 | 368 | * @param unknown $postid int the id of the post object to check against |
| 369 | 369 | * @since 0.9.9.7 added filter 'lasso_user_can_filter' |
| 370 | 370 | */ |
| 371 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
| 372 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
| 371 | +if (!function_exists('lasso_user_can')): |
|
| 372 | + function lasso_user_can($action = '', $postid = 0) { |
|
| 373 | 373 | $result = false; |
| 374 | - if ( empty( $action ) ) |
|
| 374 | + if (empty($action)) |
|
| 375 | 375 | $action = 'edit_posts'; |
| 376 | 376 | |
| 377 | - if ( empty( $postid ) ) |
|
| 377 | + if (empty($postid)) |
|
| 378 | 378 | $postid = get_the_ID(); |
| 379 | 379 | |
| 380 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
| 380 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
| 381 | 381 | // check against post types: |
| 382 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( 'post') ); |
|
| 383 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 384 | - $type = get_post_type( $postid ); |
|
| 385 | - if ( in_array( $type, $allowed_post_types ) ) { |
|
| 386 | - $result = true; |
|
| 382 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array('post')); |
|
| 383 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 384 | + $type = get_post_type($postid); |
|
| 385 | + if (in_array($type, $allowed_post_types)) { |
|
| 386 | + $result = true; |
|
| 387 | 387 | } |
| 388 | 388 | } else { |
| 389 | 389 | $result = false; |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - return apply_filters( 'lasso_user_can_filter', $result, $action, $postid); |
|
| 392 | + return apply_filters('lasso_user_can_filter', $result, $action, $postid); |
|
| 393 | 393 | } |
| 394 | 394 | endif; |
| 395 | 395 | |
@@ -398,25 +398,25 @@ discard block |
||
| 398 | 398 | * |
| 399 | 399 | * @since 0.9.5 |
| 400 | 400 | */ |
| 401 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
| 401 | +if (!function_exists('lasso_editor_empty_results')): |
|
| 402 | 402 | |
| 403 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
| 403 | + function lasso_editor_empty_results($type = 'posts') { |
|
| 404 | 404 | |
| 405 | - if ( 'posts' == $type ) { |
|
| 405 | + if ('posts' == $type) { |
|
| 406 | 406 | |
| 407 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
| 407 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
| 408 | 408 | $icon = 'lasso-icon-file-text2'; |
| 409 | 409 | $button = false; |
| 410 | 410 | |
| 411 | - } elseif ( 'revision' == $type ) { |
|
| 411 | + } elseif ('revision' == $type) { |
|
| 412 | 412 | |
| 413 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
| 413 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
| 414 | 414 | $icon = 'lasso-icon-history'; |
| 415 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
| 415 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
| 416 | 416 | |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - 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 ); |
|
| 419 | + 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); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | endif; |
@@ -14,8 +14,9 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
| 16 | 16 | |
| 17 | - if ( empty( $option ) ) |
|
| 18 | - return; |
|
| 17 | + if ( empty( $option ) ) { |
|
| 18 | + return; |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
| 21 | 22 | |
@@ -42,11 +43,12 @@ discard block |
||
| 42 | 43 | |
| 43 | 44 | $q = new wp_query( array( 'post_type' => 'ai_galleries', 'post_status' => 'publish' ) ); |
| 44 | 45 | |
| 45 | - if ( $q->have_posts() ) |
|
| 46 | - return true; |
|
| 47 | - else |
|
| 48 | - return false; |
|
| 49 | -} |
|
| 46 | + if ( $q->have_posts() ) { |
|
| 47 | + return true; |
|
| 48 | + } else { |
|
| 49 | + return false; |
|
| 50 | + } |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | /** |
| 52 | 54 | * Return a CSS class of an automatically supported theme |
@@ -192,13 +194,15 @@ discard block |
||
| 192 | 194 | */ |
| 193 | 195 | function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
| 194 | 196 | |
| 195 | - if ( empty( $postid ) ) |
|
| 196 | - $postid = get_the_ID(); |
|
| 197 | + if ( empty( $postid ) ) { |
|
| 198 | + $postid = get_the_ID(); |
|
| 199 | + } |
|
| 197 | 200 | |
| 198 | 201 | $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
| 199 | 202 | |
| 200 | - if ( empty( $objects) ) |
|
| 201 | - return; |
|
| 203 | + if ( empty( $objects) ) { |
|
| 204 | + return; |
|
| 205 | + } |
|
| 202 | 206 | |
| 203 | 207 | $out = ''; |
| 204 | 208 | foreach( $objects as $object ) { |
@@ -219,8 +223,9 @@ discard block |
||
| 219 | 223 | |
| 220 | 224 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
| 221 | 225 | |
| 222 | - if ( empty( $objects) ) |
|
| 223 | - return; |
|
| 226 | + if ( empty( $objects) ) { |
|
| 227 | + return; |
|
| 228 | + } |
|
| 224 | 229 | |
| 225 | 230 | $out = array(); |
| 226 | 231 | foreach( $objects as $object ) { |
@@ -331,8 +336,9 @@ discard block |
||
| 331 | 336 | */ |
| 332 | 337 | function lasso_clean_string( $string = '' ) { |
| 333 | 338 | |
| 334 | - if ( empty( $string ) ) |
|
| 335 | - return; |
|
| 339 | + if ( empty( $string ) ) { |
|
| 340 | + return; |
|
| 341 | + } |
|
| 336 | 342 | |
| 337 | 343 | return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
| 338 | 344 | } |
@@ -371,11 +377,13 @@ discard block |
||
| 371 | 377 | if ( !function_exists( 'lasso_user_can' ) ): |
| 372 | 378 | function lasso_user_can( $action = '', $postid = 0 ) { |
| 373 | 379 | $result = false; |
| 374 | - if ( empty( $action ) ) |
|
| 375 | - $action = 'edit_posts'; |
|
| 380 | + if ( empty( $action ) ) { |
|
| 381 | + $action = 'edit_posts'; |
|
| 382 | + } |
|
| 376 | 383 | |
| 377 | - if ( empty( $postid ) ) |
|
| 378 | - $postid = get_the_ID(); |
|
| 384 | + if ( empty( $postid ) ) { |
|
| 385 | + $postid = get_the_ID(); |
|
| 386 | + } |
|
| 379 | 387 | |
| 380 | 388 | if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
| 381 | 389 | // check against post types: |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | function __construct() { |
| 11 | 11 | |
| 12 | - add_action( 'admin_menu', array( $this, 'menu' ) ); |
|
| 13 | - add_action( 'network_admin_menu', array( $this, 'menu' ) ); |
|
| 14 | - add_action( 'wp_ajax_lasso-editor-settings', array( $this, 'process_settings' ) ); |
|
| 12 | + add_action('admin_menu', array($this, 'menu')); |
|
| 13 | + add_action('network_admin_menu', array($this, 'menu')); |
|
| 14 | + add_action('wp_ajax_lasso-editor-settings', array($this, 'process_settings')); |
|
| 15 | 15 | |
| 16 | 16 | } |
| 17 | 17 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | function menu() { |
| 24 | 24 | |
| 25 | 25 | // CHANGED Removed condition. |
| 26 | - add_submenu_page( 'lasso-editor', __( 'Settings', 'lasso' ), __( 'Settings', 'lasso' ), 'manage_options', 'lasso-editor-settings', array( $this, 'settings' ) ); |
|
| 26 | + add_submenu_page('lasso-editor', __('Settings', 'lasso'), __('Settings', 'lasso'), 'manage_options', 'lasso-editor-settings', array($this, 'settings')); |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
@@ -45,26 +45,26 @@ discard block |
||
| 45 | 45 | function process_settings() { |
| 46 | 46 | |
| 47 | 47 | // bail out if current user isn't and administrator and they are not logged in |
| 48 | - if ( !current_user_can( 'manage_options' ) || !is_user_logged_in() ) |
|
| 48 | + if (!current_user_can('manage_options') || !is_user_logged_in()) |
|
| 49 | 49 | return; |
| 50 | 50 | |
| 51 | - if ( isset( $_POST['action'] ) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer( 'nonce', 'lasso_editor_settings' ) ) { |
|
| 51 | + if (isset($_POST['action']) && 'lasso-editor-settings' == $_POST['action'] && check_admin_referer('nonce', 'lasso_editor_settings')) { |
|
| 52 | 52 | |
| 53 | - $options = isset( $_POST['lasso_editor'] ) ? $_POST['lasso_editor'] : false; |
|
| 53 | + $options = isset($_POST['lasso_editor']) ? $_POST['lasso_editor'] : false; |
|
| 54 | 54 | |
| 55 | 55 | $arr = $options['allowed_post_types']; |
| 56 | - $options = array_map( 'sanitize_text_field', $options ); |
|
| 57 | - $options['allowed_post_types'] = array_keys( $arr); |
|
| 56 | + $options = array_map('sanitize_text_field', $options); |
|
| 57 | + $options['allowed_post_types'] = array_keys($arr); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
| 61 | + if (function_exists('is_multisite') && is_multisite()) { |
|
| 62 | 62 | |
| 63 | - update_site_option( 'lasso_editor', $options ); |
|
| 63 | + update_site_option('lasso_editor', $options); |
|
| 64 | 64 | |
| 65 | 65 | } else { |
| 66 | 66 | |
| 67 | - update_option( 'lasso_editor', $options ); |
|
| 67 | + update_option('lasso_editor', $options); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | wp_send_json_success(); |
@@ -86,58 +86,58 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function lasso_editor_settings_form() { |
| 88 | 88 | |
| 89 | - if ( !is_user_logged_in() ) |
|
| 89 | + if (!is_user_logged_in()) |
|
| 90 | 90 | return; |
| 91 | 91 | |
| 92 | - $article_object = lasso_editor_get_option( 'article_class', 'lasso_editor' ); |
|
| 93 | - $featImgClass = lasso_editor_get_option( 'featimg_class', 'lasso_editor' ); |
|
| 94 | - $titleClass = lasso_editor_get_option( 'title_class', 'lasso_editor' ); |
|
| 92 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
| 93 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
| 94 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
| 95 | 95 | |
| 96 | - $post_new_disabled = lasso_editor_get_option( 'post_adding_disabled', 'lasso_editor' ); |
|
| 97 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
| 98 | - $post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
|
| 99 | - $shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
|
| 100 | - $enable_autosave = lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ); |
|
| 96 | + $post_new_disabled = lasso_editor_get_option('post_adding_disabled', 'lasso_editor'); |
|
| 97 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
| 98 | + $post_settings_disabled = lasso_editor_get_option('post_settings_disabled', 'lasso_editor'); |
|
| 99 | + $shortcodify_disabled = lasso_editor_get_option('shortcodify_disabled', 'lasso_editor'); |
|
| 100 | + $enable_autosave = lasso_editor_get_option('enable_autosave', 'lasso_editor'); |
|
| 101 | 101 | |
| 102 | - $toolbar_headings = lasso_editor_get_option( 'toolbar_headings', 'lasso_editor' ); |
|
| 103 | - $toolbar_show_color = lasso_editor_get_option( 'toolbar_show_color', 'lasso_editor' ); |
|
| 104 | - $toolbar_show_alignment = lasso_editor_get_option( 'toolbar_show_alignment', 'lasso_editor' ); |
|
| 102 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
| 103 | + $toolbar_show_color = lasso_editor_get_option('toolbar_show_color', 'lasso_editor'); |
|
| 104 | + $toolbar_show_alignment = lasso_editor_get_option('toolbar_show_alignment', 'lasso_editor'); |
|
| 105 | 105 | |
| 106 | - $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
| 107 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
| 106 | + $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
| 107 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
| 108 | 108 | $disable_tour = lasso_editor_get_option('disable_tour', 'lasso_editor'); |
| 109 | 109 | $show_ignored_items = lasso_editor_get_option('show_ignored_items', 'lasso_editor'); |
| 110 | 110 | $save_using_rest_disabled = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
| 111 | 111 | |
| 112 | - $default_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page')); |
|
| 113 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', $default_post_types); |
|
| 112 | + $default_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page')); |
|
| 113 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', $default_post_types); |
|
| 114 | 114 | |
| 115 | 115 | ?> |
| 116 | 116 | <div class="wrap"> |
| 117 | 117 | |
| 118 | - <h2><?php _e( 'Editus Settings', 'lasso' );?></h2> |
|
| 118 | + <h2><?php _e('Editus Settings', 'lasso'); ?></h2> |
|
| 119 | 119 | |
| 120 | 120 | <form id="lasso-editor-settings-form" class="lasso--form-settings" method="post" enctype="multipart/form-data"> |
| 121 | 121 | |
| 122 | - <?php do_action('lasso_settings_before');?> |
|
| 122 | + <?php do_action('lasso_settings_before'); ?> |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | |
| 126 | 126 | <div class="lasso-editor-settings--option-wrap"> |
| 127 | 127 | <div class="lasso-editor-settings--option-inner"> |
| 128 | - <label><?php _e( 'Enable for:', 'lasso' );?></label> |
|
| 129 | - <span class="lasso--setting-description"><?php _e( 'Enable Editus for the following post types.', 'lasso' );?></span> |
|
| 128 | + <label><?php _e('Enable for:', 'lasso'); ?></label> |
|
| 129 | + <span class="lasso--setting-description"><?php _e('Enable Editus for the following post types.', 'lasso'); ?></span> |
|
| 130 | 130 | <?php |
| 131 | 131 | $args = array( |
| 132 | 132 | 'public' => true |
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
| 136 | - $post_types = get_post_types( $args, 'objects' ); |
|
| 135 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
| 136 | + $post_types = get_post_types($args, 'objects'); |
|
| 137 | 137 | |
| 138 | - foreach ( $post_types as $post_type ) { |
|
| 139 | - $checked =""; |
|
| 140 | - if ( in_array( $post_type->name, $allowed_post_types ) ) { |
|
| 138 | + foreach ($post_types as $post_type) { |
|
| 139 | + $checked = ""; |
|
| 140 | + if (in_array($post_type->name, $allowed_post_types)) { |
|
| 141 | 141 | $checked = 'checked="checked"'; |
| 142 | 142 | } |
| 143 | 143 | echo '<label><input type="checkbox" '.$checked.' name="lasso_editor[allowed_post_types]['.$post_type->name.']" id="lasso_editor[allowed_post_types]['.$post_type->name.']" >'.$post_type->name.'</label>'; |
@@ -149,70 +149,70 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | <div class="lasso-editor-settings--option-wrap"> |
| 151 | 151 | <div class="lasso-editor-settings--option-inner"> |
| 152 | - <label><?php _e( 'Article Class', 'lasso' );?></label> |
|
| 153 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class (including the preceding dot) of container that holds the post. This should be the first parent container class that holds the_content.', 'lasso' );?></span> |
|
| 154 | - <input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr( $article_object );?>" placeholder=".entry-content"> |
|
| 152 | + <label><?php _e('Article Class', 'lasso'); ?></label> |
|
| 153 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class (including the preceding dot) of container that holds the post. This should be the first parent container class that holds the_content.', 'lasso'); ?></span> |
|
| 154 | + <input type="text" name="lasso_editor[article_class]" id="lasso_editor[article_class]" value="<?php echo esc_attr($article_object); ?>" placeholder=".entry-content"> |
|
| 155 | 155 | </div> |
| 156 | 156 | </div> |
| 157 | 157 | |
| 158 | 158 | <div class="lasso-editor-settings--option-wrap"> |
| 159 | 159 | <div class="lasso-editor-settings--option-inner"> |
| 160 | - <label><?php _e( 'Featured Image Class', 'lasso' );?></label> |
|
| 161 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class that uses a featured image as a background image. This currently only supports themes that have the featured image set as background image.', 'lasso' );?></span> |
|
| 162 | - <input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr( $featImgClass );?>" placeholder=".entry-content"> |
|
| 160 | + <label><?php _e('Featured Image Class', 'lasso'); ?></label> |
|
| 161 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class that uses a featured image as a background image. This currently only supports themes that have the featured image set as background image.', 'lasso'); ?></span> |
|
| 162 | + <input type="text" name="lasso_editor[featimg_class]" id="lasso_editor[featimg_class]" value="<?php echo esc_attr($featImgClass); ?>" placeholder=".entry-content"> |
|
| 163 | 163 | </div> |
| 164 | 164 | </div> |
| 165 | 165 | |
| 166 | 166 | <div class="lasso-editor-settings--option-wrap"> |
| 167 | 167 | <div class="lasso-editor-settings--option-inner"> |
| 168 | - <label><?php _e( 'Article Title Class', 'lasso' );?></label> |
|
| 169 | - <span class="lasso--setting-description"><?php _e( 'Provide the CSS class for the post title. This will enable you to update the title of the post by clicking and typing.', 'lasso' );?></span> |
|
| 170 | - <input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr( $titleClass );?>" placeholder=".entry-content"> |
|
| 168 | + <label><?php _e('Article Title Class', 'lasso'); ?></label> |
|
| 169 | + <span class="lasso--setting-description"><?php _e('Provide the CSS class for the post title. This will enable you to update the title of the post by clicking and typing.', 'lasso'); ?></span> |
|
| 170 | + <input type="text" name="lasso_editor[title_class]" id="lasso_editor[title_class]" value="<?php echo esc_attr($titleClass); ?>" placeholder=".entry-content"> |
|
| 171 | 171 | </div> |
| 172 | 172 | </div> |
| 173 | 173 | |
| 174 | 174 | <!-- Advanced --> |
| 175 | 175 | <div class="lasso-editor-settings--option-wrap"> |
| 176 | 176 | <div class="lasso-editor-settings--option-inner"> |
| 177 | - <label><?php _e( 'Ignored Items to Save', 'lasso' );?></label> |
|
| 178 | - <span class="lasso--setting-description"><?php _e( 'If your post container holds additional markup, list the css class names (comma separated, including the dot) of those items. When you enter the editor, Editus will remove (NOT delete) these items so that it does not save them as HTML.', 'lasso' );?></span> |
|
| 179 | - <textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNoSave );?></textarea> |
|
| 177 | + <label><?php _e('Ignored Items to Save', 'lasso'); ?></label> |
|
| 178 | + <span class="lasso--setting-description"><?php _e('If your post container holds additional markup, list the css class names (comma separated, including the dot) of those items. When you enter the editor, Editus will remove (NOT delete) these items so that it does not save them as HTML.', 'lasso'); ?></span> |
|
| 179 | + <textarea name="lasso_editor[dont_save]" id="lasso_editor[dont_save]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNoSave); ?></textarea> |
|
| 180 | 180 | </div> |
| 181 | 181 | </div> |
| 182 | 182 | |
| 183 | 183 | <div class="lasso-editor-settings--option-wrap"> |
| 184 | 184 | <div class="lasso-editor-settings--option-inner"> |
| 185 | - <label><?php _e( 'Read Only Items', 'lasso' );?></label> |
|
| 186 | - <span class="lasso--setting-description"><?php _e( 'If your post has items that should not be editable, list the css class names (comma separated, including the dot) of those items.', 'lasso' );?></span> |
|
| 187 | - <textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr( $objectsNonEditable );?></textarea> |
|
| 185 | + <label><?php _e('Read Only Items', 'lasso'); ?></label> |
|
| 186 | + <span class="lasso--setting-description"><?php _e('If your post has items that should not be editable, list the css class names (comma separated, including the dot) of those items.', 'lasso'); ?></span> |
|
| 187 | + <textarea name="lasso_editor[non_editable]" id="lasso_editor[non_editable]" placeholder=".classname, .another-class"><?php echo esc_attr($objectsNonEditable); ?></textarea> |
|
| 188 | 188 | </div> |
| 189 | 189 | </div> |
| 190 | 190 | |
| 191 | 191 | <div class="lasso-editor-settings--option-wrap"> |
| 192 | 192 | <div class="lasso-editor-settings--option-inner"> |
| 193 | - <input type="checkbox" class="checkbox" name="lasso_editor[show_ignored_items]" id="lasso_editor[show_ignored_items]" <?php echo checked( $show_ignored_items, 'on' );?> > |
|
| 194 | - <label for="lasso_editor[show_ignored_items]"> <?php _e( 'Show Ignored Items', 'lasso' );?></label> |
|
| 195 | - <span class="lasso--setting-description"><?php _e( 'By default the ignored items are hidden. Check this to show ignored items while keeping them uneditable.', 'lasso' );?></span> |
|
| 193 | + <input type="checkbox" class="checkbox" name="lasso_editor[show_ignored_items]" id="lasso_editor[show_ignored_items]" <?php echo checked($show_ignored_items, 'on'); ?> > |
|
| 194 | + <label for="lasso_editor[show_ignored_items]"> <?php _e('Show Ignored Items', 'lasso'); ?></label> |
|
| 195 | + <span class="lasso--setting-description"><?php _e('By default the ignored items are hidden. Check this to show ignored items while keeping them uneditable.', 'lasso'); ?></span> |
|
| 196 | 196 | </div> |
| 197 | 197 | </div> |
| 198 | 198 | |
| 199 | 199 | <div class="lasso-editor-settings--option-wrap"> |
| 200 | 200 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
| 201 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked( $toolbar_headings, 'on' );?> > |
|
| 202 | - <label for="lasso_editor[toolbar_headings]"><?php _e( 'Enable H2 and H3 Buttons', 'lasso' );?></label> |
|
| 203 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set H2 and H3 settings.', 'lasso' );?></span> |
|
| 201 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_headings]" id="lasso_editor[toolbar_headings]" <?php echo checked($toolbar_headings, 'on'); ?> > |
|
| 202 | + <label for="lasso_editor[toolbar_headings]"><?php _e('Enable H2 and H3 Buttons', 'lasso'); ?></label> |
|
| 203 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set H2 and H3 settings.', 'lasso'); ?></span> |
|
| 204 | 204 | |
| 205 | 205 | </div> |
| 206 | 206 | <div class="lasso-editor-settings--option-inner" style="border:none;"> |
| 207 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked( $toolbar_show_color, 'on' );?> > |
|
| 208 | - <label for="lasso_editor[toolbar_show_color]"><?php _e( 'Enable Text Color Buttons', 'lasso' );?></label> |
|
| 209 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set text colors.', 'lasso' );?></span> |
|
| 207 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_color]" id="lasso_editor[toolbar_show_color]" <?php echo checked($toolbar_show_color, 'on'); ?> > |
|
| 208 | + <label for="lasso_editor[toolbar_show_color]"><?php _e('Enable Text Color Buttons', 'lasso'); ?></label> |
|
| 209 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set text colors.', 'lasso'); ?></span> |
|
| 210 | 210 | |
| 211 | 211 | </div> |
| 212 | 212 | <div class="lasso-editor-settings--option-inner"> |
| 213 | - <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked( $toolbar_show_alignment, 'on' );?> > |
|
| 214 | - <label for="lasso_editor[toolbar_show_alignment]"><?php _e( 'Enable Text Align Buttons', 'lasso' );?></label> |
|
| 215 | - <span class="lasso--setting-description"><?php _e( 'Show the buttons to set text alignment.', 'lasso' );?></span> |
|
| 213 | + <input type="checkbox" class="checkbox" name="lasso_editor[toolbar_show_alignment]" id="lasso_editor[toolbar_show_alignment]" <?php echo checked($toolbar_show_alignment, 'on'); ?> > |
|
| 214 | + <label for="lasso_editor[toolbar_show_alignment]"><?php _e('Enable Text Align Buttons', 'lasso'); ?></label> |
|
| 215 | + <span class="lasso--setting-description"><?php _e('Show the buttons to set text alignment.', 'lasso'); ?></span> |
|
| 216 | 216 | |
| 217 | 217 | </div> |
| 218 | 218 | </div> |
@@ -227,70 +227,70 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | <div class="lasso-editor-settings--option-wrap"> |
| 229 | 229 | <div class="lasso-editor-settings--option-inner"> |
| 230 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked( $post_settings_disabled, 'on' );?> > |
|
| 231 | - <label for="lasso_editor[post_settings_disabled]"> <?php _e( 'Disable Post Settings', 'lasso' );?></label> |
|
| 232 | - <span class="lasso--setting-description"><?php _e( 'Check this to disable users from being able to edit post settings from the front-end.', 'lasso' );?></span> |
|
| 230 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_settings_disabled]" id="lasso_editor[post_settings_disabled]" <?php echo checked($post_settings_disabled, 'on'); ?> > |
|
| 231 | + <label for="lasso_editor[post_settings_disabled]"> <?php _e('Disable Post Settings', 'lasso'); ?></label> |
|
| 232 | + <span class="lasso--setting-description"><?php _e('Check this to disable users from being able to edit post settings from the front-end.', 'lasso'); ?></span> |
|
| 233 | 233 | </div> |
| 234 | 234 | </div> |
| 235 | 235 | |
| 236 | 236 | <div class="lasso-editor-settings--option-wrap"> |
| 237 | 237 | <div class="lasso-editor-settings--option-inner"> |
| 238 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked( $post_new_disabled, 'on' );?> > |
|
| 239 | - <label for="lasso_editor[post_adding_disabled]"><?php _e( 'Disable Post Adding', 'lasso' );?></label> |
|
| 240 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable users from being able to add new posts from the front-end.', 'lasso' );?></span> |
|
| 238 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_adding_disabled]" id="lasso_editor[post_adding_disabled]" <?php echo checked($post_new_disabled, 'on'); ?> > |
|
| 239 | + <label for="lasso_editor[post_adding_disabled]"><?php _e('Disable Post Adding', 'lasso'); ?></label> |
|
| 240 | + <span class="lasso--setting-description"><?php _e('Check this box to disable users from being able to add new posts from the front-end.', 'lasso'); ?></span> |
|
| 241 | 241 | </div> |
| 242 | 242 | </div> |
| 243 | 243 | |
| 244 | 244 | <div class="lasso-editor-settings--option-wrap"> |
| 245 | 245 | <div class="lasso-editor-settings--option-inner"> |
| 246 | - <input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked( $shortcodify_disabled, 'on' );?> > |
|
| 247 | - <label for="lasso_editor[shortcodify_disabled]"><?php _e( 'Disable Aesop Component Conversion', 'lasso' );?></label> |
|
| 248 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso' );?></span> |
|
| 246 | + <input type="checkbox" class="checkbox" name="lasso_editor[shortcodify_disabled]" id="lasso_editor[shortcodify_disabled]" <?php echo checked($shortcodify_disabled, 'on'); ?> > |
|
| 247 | + <label for="lasso_editor[shortcodify_disabled]"><?php _e('Disable Aesop Component Conversion', 'lasso'); ?></label> |
|
| 248 | + <span class="lasso--setting-description"><?php _e('Check this box to disable the conversion process used on Aesop Story Engine components.', 'lasso'); ?></span> |
|
| 249 | 249 | </div> |
| 250 | 250 | </div> |
| 251 | 251 | |
| 252 | 252 | <div class="lasso-editor-settings--option-wrap"> |
| 253 | 253 | <div class="lasso-editor-settings--option-inner"> |
| 254 | - <input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked( $enable_autosave, 'on' );?> > |
|
| 255 | - <label for="lasso_editor[enable_autosave]"><?php _e( 'Enable Auto Save', 'lasso' );?></label> |
|
| 256 | - <span class="lasso--setting-description"><?php _e( 'Check this box to enable auto save.', 'lasso' );?></span> |
|
| 254 | + <input type="checkbox" class="checkbox" name="lasso_editor[enable_autosave]" id="lasso_editor[enable_autosave]" <?php echo checked($enable_autosave, 'on'); ?> > |
|
| 255 | + <label for="lasso_editor[enable_autosave]"><?php _e('Enable Auto Save', 'lasso'); ?></label> |
|
| 256 | + <span class="lasso--setting-description"><?php _e('Check this box to enable auto save.', 'lasso'); ?></span> |
|
| 257 | 257 | </div> |
| 258 | 258 | </div> |
| 259 | 259 | |
| 260 | 260 | <div class="lasso-editor-settings--option-wrap"> |
| 261 | 261 | <div class="lasso-editor-settings--option-inner"> |
| 262 | - <input type="checkbox" class="checkbox" name="lasso_editor[post_save_disabled]" id="lasso_editor[post_save_disabled]" <?php echo checked( $save_to_post_disabled, 'on' );?> > |
|
| 263 | - <label for="lasso_editor[post_save_disabled]"><?php _e( 'Disable Post Saving', 'lasso' );?></label> |
|
| 264 | - <span class="lasso--setting-description"><?php _e( 'By default the editor will update the database with the post or page it is being used on. Check this box to disable this. If you check this box, it is assumed that you will be using the provided filters to save your own content.', 'lasso' );?></span> |
|
| 262 | + <input type="checkbox" class="checkbox" name="lasso_editor[post_save_disabled]" id="lasso_editor[post_save_disabled]" <?php echo checked($save_to_post_disabled, 'on'); ?> > |
|
| 263 | + <label for="lasso_editor[post_save_disabled]"><?php _e('Disable Post Saving', 'lasso'); ?></label> |
|
| 264 | + <span class="lasso--setting-description"><?php _e('By default the editor will update the database with the post or page it is being used on. Check this box to disable this. If you check this box, it is assumed that you will be using the provided filters to save your own content.', 'lasso'); ?></span> |
|
| 265 | 265 | |
| 266 | 266 | </div> |
| 267 | 267 | </div> |
| 268 | 268 | |
| 269 | 269 | <div class="lasso-editor-settings--option-wrap"> |
| 270 | 270 | <div class="lasso-editor-settings--option-inner"> |
| 271 | - <input type="checkbox" class="checkbox" name="lasso_editor[save_using_rest_disabled]" id="lasso_editor[save_using_rest_disabled]" <?php echo checked( $save_using_rest_disabled, 'on' );?> > |
|
| 272 | - <label for="lasso_editor[save_using_rest_disabled]"><?php _e( "Don't Use REST API to Save", 'lasso' );?></label> |
|
| 273 | - <span class="lasso--setting-description"><?php _e( 'By default the editor will use REST API to save posts. Check this box to use custom AJAX calls instead.', 'lasso' );?></span> |
|
| 271 | + <input type="checkbox" class="checkbox" name="lasso_editor[save_using_rest_disabled]" id="lasso_editor[save_using_rest_disabled]" <?php echo checked($save_using_rest_disabled, 'on'); ?> > |
|
| 272 | + <label for="lasso_editor[save_using_rest_disabled]"><?php _e("Don't Use REST API to Save", 'lasso'); ?></label> |
|
| 273 | + <span class="lasso--setting-description"><?php _e('By default the editor will use REST API to save posts. Check this box to use custom AJAX calls instead.', 'lasso'); ?></span> |
|
| 274 | 274 | |
| 275 | 275 | </div> |
| 276 | 276 | </div> |
| 277 | 277 | |
| 278 | 278 | <div class="lasso-editor-settings--option-wrap last"> |
| 279 | 279 | <div class="lasso-editor-settings--option-inner"> |
| 280 | - <input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked( $disable_tour, 'on' );?> > |
|
| 281 | - <label for="lasso_editor[disable_tour]"> <?php _e( 'Do Not Show Tour Dialog', 'lasso' );?></label> |
|
| 282 | - <span class="lasso--setting-description"><?php _e( 'Check this box to disable the tour dialog box for all users.', 'lasso' );?></span> |
|
| 280 | + <input type="checkbox" class="checkbox" name="lasso_editor[disable_tour]" id="lasso_editor[disable_tour]" <?php echo checked($disable_tour, 'on'); ?> > |
|
| 281 | + <label for="lasso_editor[disable_tour]"> <?php _e('Do Not Show Tour Dialog', 'lasso'); ?></label> |
|
| 282 | + <span class="lasso--setting-description"><?php _e('Check this box to disable the tour dialog box for all users.', 'lasso'); ?></span> |
|
| 283 | 283 | </div> |
| 284 | 284 | </div> |
| 285 | 285 | |
| 286 | 286 | |
| 287 | 287 | <div class="lasso-editor-settings--submit"> |
| 288 | 288 | <input type="hidden" name="action" value="lasso-editor-settings" /> |
| 289 | - <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Settings', 'lasso' );?>" /> |
|
| 290 | - <?php wp_nonce_field( 'nonce', 'lasso_editor_settings' ); ?> |
|
| 289 | + <input type="submit" class="button-primary" value="<?php esc_attr_e('Save Settings', 'lasso'); ?>" /> |
|
| 290 | + <?php wp_nonce_field('nonce', 'lasso_editor_settings'); ?> |
|
| 291 | 291 | </div> |
| 292 | 292 | |
| 293 | - <?php do_action('lasso_settings_after');?> |
|
| 293 | + <?php do_action('lasso_settings_after'); ?> |
|
| 294 | 294 | </form> |
| 295 | 295 | |
| 296 | 296 | </div><?php |