@@ -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,15 +108,15 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - return !empty( $out ) ? $out : false; |
|
| 111 | + return !empty($out) ? $out : false; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | function lasso_get_supported_theme_title_class() { |
| 115 | 115 | |
| 116 | 116 | $name = wp_get_theme()->get('Name'); |
| 117 | - $slug = lasso_clean_string( $name ); |
|
| 117 | + $slug = lasso_clean_string($name); |
|
| 118 | 118 | |
| 119 | - switch ( $slug ) { |
|
| 119 | + switch ($slug) { |
|
| 120 | 120 | |
| 121 | 121 | case 'aesop-story-theme': // aesop |
| 122 | 122 | $out = '.aesop-entry-title'; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | break; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - return !empty( $out ) ? $out : false; |
|
| 147 | + return !empty($out) ? $out : false; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @since 0.8.7 |
| 155 | 155 | * @return string of comma separated classes |
| 156 | 156 | */ |
| 157 | -function lasso_supported_no_save(){ |
|
| 157 | +function lasso_supported_no_save() { |
|
| 158 | 158 | |
| 159 | 159 | return apply_filters('lasso_dont_save', '.lasso--ignore, .sharedaddy, .us_wrapper, .twitter-tweet'); |
| 160 | 160 | } |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return array|mixed|object|string|void |
| 170 | 170 | */ |
| 171 | -function lasso_sanitize_data( $data ) { |
|
| 172 | - return \lasso\sanatize::do_sanitize( $data ); |
|
| 171 | +function lasso_sanitize_data($data) { |
|
| 172 | + return \lasso\sanatize::do_sanitize($data); |
|
| 173 | 173 | |
| 174 | 174 | } |
| 175 | 175 | |
@@ -179,18 +179,18 @@ discard block |
||
| 179 | 179 | * @since 0.9.3 |
| 180 | 180 | * @return string of comma delimited category slugs |
| 181 | 181 | */ |
| 182 | -function lasso_get_post_objects( $postid = '', $taxonomy = 'category') { |
|
| 182 | +function lasso_get_post_objects($postid = '', $taxonomy = 'category') { |
|
| 183 | 183 | |
| 184 | - if ( empty( $postid ) ) |
|
| 184 | + if (empty($postid)) |
|
| 185 | 185 | $postid = get_the_ID(); |
| 186 | 186 | |
| 187 | - $objects = 'category' == $taxonomy ? get_the_category( $postid ) : get_the_tags( $postid ); |
|
| 187 | + $objects = 'category' == $taxonomy ? get_the_category($postid) : get_the_tags($postid); |
|
| 188 | 188 | |
| 189 | - if ( empty( $objects) ) |
|
| 189 | + if (empty($objects)) |
|
| 190 | 190 | return; |
| 191 | 191 | |
| 192 | 192 | $out = ''; |
| 193 | - foreach( $objects as $object ) { |
|
| 193 | + foreach ($objects as $object) { |
|
| 194 | 194 | $out .= $object->slug.', '; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -204,15 +204,15 @@ discard block |
||
| 204 | 204 | * @since 0.9.3 |
| 205 | 205 | * @return array all categoiries |
| 206 | 206 | */ |
| 207 | -function lasso_get_objects( $taxonomy = 'category' ) { |
|
| 207 | +function lasso_get_objects($taxonomy = 'category') { |
|
| 208 | 208 | |
| 209 | 209 | $objects = 'category' == $taxonomy ? get_categories(array('hide_empty' => 0)) : get_tags(array('hide_empty' => 0)); |
| 210 | 210 | |
| 211 | - if ( empty( $objects) ) |
|
| 211 | + if (empty($objects)) |
|
| 212 | 212 | return; |
| 213 | 213 | |
| 214 | 214 | $out = array(); |
| 215 | - foreach( $objects as $object ) { |
|
| 215 | + foreach ($objects as $object) { |
|
| 216 | 216 | $out[] = $object->slug; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | function lasso_post_types() { |
| 230 | 230 | |
| 231 | - $post_types = get_post_types( array( |
|
| 231 | + $post_types = get_post_types(array( |
|
| 232 | 232 | 'public' => true, |
| 233 | - ), 'objects' ); |
|
| 234 | - $post_types = array_combine( array_keys( $post_types ), wp_list_pluck( $post_types, 'label' ) ); |
|
| 235 | - unset( $post_types[ 'attachment' ] ); |
|
| 233 | + ), 'objects'); |
|
| 234 | + $post_types = array_combine(array_keys($post_types), wp_list_pluck($post_types, 'label')); |
|
| 235 | + unset($post_types['attachment']); |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Set which post types are allowed |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | * |
| 242 | 242 | * @param array $allowed_post_types Array of names (not labels) of allowed post types. Must be registered. |
| 243 | 243 | */ |
| 244 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', array( 'post', 'page' ) ); |
|
| 245 | - foreach( $post_types as $name => $label ) { |
|
| 246 | - if ( ! in_array( $name, $allowed_post_types ) ) { |
|
| 247 | - unset( $post_types[ $name ] ); |
|
| 244 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', array('post', 'page')); |
|
| 245 | + foreach ($post_types as $name => $label) { |
|
| 246 | + if (!in_array($name, $allowed_post_types)) { |
|
| 247 | + unset($post_types[$name]); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | } |
@@ -264,22 +264,22 @@ discard block |
||
| 264 | 264 | * @uses lasso_modal_addons() |
| 265 | 265 | * @since 0.9.4 |
| 266 | 266 | */ |
| 267 | -function lasso_modal_addons_content( $tab = '', $type ){ |
|
| 267 | +function lasso_modal_addons_content($tab = '', $type) { |
|
| 268 | 268 | |
| 269 | - $name = lasso_clean_string( $tab['name'] ); |
|
| 269 | + $name = lasso_clean_string($tab['name']); |
|
| 270 | 270 | |
| 271 | - if ( 'tab' == $type ) { |
|
| 271 | + if ('tab' == $type) { |
|
| 272 | 272 | |
| 273 | - $out = sprintf( '<li data-addon-name="%s">%s</li>', $name, $tab['name'] ); |
|
| 273 | + $out = sprintf('<li data-addon-name="%s">%s</li>', $name, $tab['name']); |
|
| 274 | 274 | |
| 275 | - } else if ( 'content' == $type ){ |
|
| 275 | + } else if ('content' == $type) { |
|
| 276 | 276 | |
| 277 | - $content = isset( $tab['content'] ) && is_callable( $tab['content'] ) ? call_user_func( $tab['content'] ) : false; |
|
| 278 | - $options = isset( $tab['options'] ) && is_callable( $tab['options'] ) ? call_user_func( $tab['options'] ) : false; |
|
| 277 | + $content = isset($tab['content']) && is_callable($tab['content']) ? call_user_func($tab['content']) : false; |
|
| 278 | + $options = isset($tab['options']) && is_callable($tab['options']) ? call_user_func($tab['options']) : false; |
|
| 279 | 279 | |
| 280 | - $out = sprintf( '<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 280 | + $out = sprintf('<div class="lasso--modal__content not-visible" data-addon-content="%s"> |
|
| 281 | 281 | %s%s |
| 282 | - </div>', $name, $content, lasso_option_form( $name, $options ) ); |
|
| 282 | + </div>', $name, $content, lasso_option_form($name, $options)); |
|
| 283 | 283 | |
| 284 | 284 | } |
| 285 | 285 | |
@@ -294,12 +294,12 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @return void|string |
| 296 | 296 | */ |
| 297 | -function lasso_clean_string( $string = '' ) { |
|
| 297 | +function lasso_clean_string($string = '') { |
|
| 298 | 298 | |
| 299 | - if ( empty( $string ) ) |
|
| 299 | + if (empty($string)) |
|
| 300 | 300 | return; |
| 301 | 301 | |
| 302 | - return sanitize_text_field( strtolower( preg_replace('/[\s_]/', '-', $string ) ) ); |
|
| 302 | + return sanitize_text_field(strtolower(preg_replace('/[\s_]/', '-', $string))); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -312,13 +312,13 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @return void|string |
| 314 | 314 | */ |
| 315 | -function lasso_unclean_string( $string = '' ) { |
|
| 315 | +function lasso_unclean_string($string = '') { |
|
| 316 | 316 | |
| 317 | - if ( empty( $string ) ) { |
|
| 317 | + if (empty($string)) { |
|
| 318 | 318 | return; |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - return sanitize_text_field( strtolower( str_replace( '-', '_', $string ) ) ); |
|
| 321 | + return sanitize_text_field(strtolower(str_replace('-', '_', $string))); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
@@ -333,16 +333,16 @@ discard block |
||
| 333 | 333 | * @param unknown $postid int the id of the post object to check against |
| 334 | 334 | * @since 1.0 |
| 335 | 335 | */ |
| 336 | -if ( !function_exists( 'lasso_user_can' ) ): |
|
| 337 | - function lasso_user_can( $action = '', $postid = 0 ) { |
|
| 336 | +if (!function_exists('lasso_user_can')): |
|
| 337 | + function lasso_user_can($action = '', $postid = 0) { |
|
| 338 | 338 | |
| 339 | - if ( empty( $action ) ) |
|
| 339 | + if (empty($action)) |
|
| 340 | 340 | $action = 'edit_posts'; |
| 341 | 341 | |
| 342 | - if ( empty( $postid ) ) |
|
| 342 | + if (empty($postid)) |
|
| 343 | 343 | $postid = get_the_ID(); |
| 344 | 344 | |
| 345 | - if ( is_user_logged_in() && current_user_can( $action, $postid ) ) { |
|
| 345 | + if (is_user_logged_in() && current_user_can($action, $postid)) { |
|
| 346 | 346 | |
| 347 | 347 | return true; |
| 348 | 348 | |
@@ -360,25 +360,25 @@ discard block |
||
| 360 | 360 | * |
| 361 | 361 | * @since 0.9.5 |
| 362 | 362 | */ |
| 363 | -if ( !function_exists('lasso_editor_empty_results') ): |
|
| 363 | +if (!function_exists('lasso_editor_empty_results')): |
|
| 364 | 364 | |
| 365 | - function lasso_editor_empty_results( $type = 'posts' ){ |
|
| 365 | + function lasso_editor_empty_results($type = 'posts') { |
|
| 366 | 366 | |
| 367 | - if ( 'posts' == $type ) { |
|
| 367 | + if ('posts' == $type) { |
|
| 368 | 368 | |
| 369 | - $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso') ); |
|
| 369 | + $string = apply_filters('lasso_empty_state_message', __('No posts to show', 'lasso')); |
|
| 370 | 370 | $icon = 'lasso-icon-file-text2'; |
| 371 | 371 | $button = false; |
| 372 | 372 | |
| 373 | - } elseif ( 'revision' == $type ) { |
|
| 373 | + } elseif ('revision' == $type) { |
|
| 374 | 374 | |
| 375 | - $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso') ); |
|
| 375 | + $string = apply_filters('lasso_empty_state_message', __('No revisions found', 'lasso')); |
|
| 376 | 376 | $icon = 'lasso-icon-history'; |
| 377 | - $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close','lasso') ); |
|
| 377 | + $button = sprintf('<a href="#" class="lasso--btn-secondary" id="lasso--close-modal">%s</a>', __('Close', 'lasso')); |
|
| 378 | 378 | |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - 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 ); |
|
| 381 | + 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); |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | endif; |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class assets { |
| 12 | 12 | |
| 13 | - public function __construct(){ |
|
| 13 | + public function __construct() { |
|
| 14 | 14 | |
| 15 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
| 15 | + add_action('wp_enqueue_scripts', array($this, 'scripts')); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function scripts(){ |
|
| 18 | + public function scripts() { |
|
| 19 | 19 | |
| 20 | - if ( lasso_user_can('edit_posts') ) { |
|
| 20 | + if (lasso_user_can('edit_posts')) { |
|
| 21 | 21 | |
| 22 | 22 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
| 23 | 23 | |
@@ -32,78 +32,78 @@ discard block |
||
| 32 | 32 | // url for json api |
| 33 | 33 | $home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
| 34 | 34 | |
| 35 | - $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
| 35 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
| 36 | 36 | |
| 37 | - $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
| 37 | + $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
| 38 | 38 | |
| 39 | - $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
| 40 | - $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
| 41 | - if (empty( $titleClass )) { |
|
| 39 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
| 40 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
| 41 | + if (empty($titleClass)) { |
|
| 42 | 42 | $titleClass = lasso_get_supported_theme_title_class(); |
| 43 | 43 | } |
| 44 | - $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
| 45 | - $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
| 44 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
| 45 | + $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
|
| 46 | 46 | |
| 47 | 47 | // post id reference |
| 48 | - $postid = get_the_ID(); |
|
| 48 | + $postid = get_the_ID(); |
|
| 49 | 49 | |
| 50 | 50 | $strings = array( |
| 51 | - 'save' => __('Save','lasso'), |
|
| 52 | - 'saving' => __('Saving...','lasso'), |
|
| 53 | - 'saved' => __('Saved!','lasso'), |
|
| 54 | - 'adding' => __('Adding...','lasso'), |
|
| 55 | - 'added' => __('Added!','lasso'), |
|
| 56 | - 'loading' => __('Loading...','lasso'), |
|
| 57 | - 'loadMore' => __('Load More','lasso'), |
|
| 58 | - 'noPostsFound' => __('No more posts found','lasso'), |
|
| 59 | - 'galleryCreated' => __('Gallery Created!','lasso'), |
|
| 60 | - 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
| 61 | - 'justWrite' => __('Just write...','lasso'), |
|
| 62 | - 'chooseImage' => __('Choose an image','lasso'), |
|
| 63 | - 'updateImage' => __('Update Image','lasso'), |
|
| 64 | - 'insertImage' => __('Insert Image','lasso'), |
|
| 65 | - 'selectImage' => __('Select Image','lasso'), |
|
| 66 | - 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
| 67 | - 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
| 68 | - 'chooseImages' => __('Choose images','lasso'), |
|
| 69 | - 'editImage' => __('Edit Image','lasso'), |
|
| 70 | - 'addImages' => __('Add Images','lasso'), |
|
| 71 | - 'addNewGallery' => __('Add New Gallery','lasso'), |
|
| 72 | - 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
| 73 | - 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
| 74 | - 'publishPost' => __('Publish Post?','lasso'), |
|
| 75 | - 'publishYes' => __('Yes, publish it!','lasso'), |
|
| 76 | - 'deletePost' => __('Trash Post?','lasso'), |
|
| 77 | - 'deleteYes' => __('Yes, trash it!','lasso'), |
|
| 78 | - 'warning' => __('Oh snap!','laso'), |
|
| 79 | - 'cancelText' => __('O.K. got it!','lasso'), |
|
| 80 | - 'missingClass' => __('It looks like we are missing the Article CSS class. Editus will not function correctly without this CSS class.','lasso'), |
|
| 51 | + 'save' => __('Save', 'lasso'), |
|
| 52 | + 'saving' => __('Saving...', 'lasso'), |
|
| 53 | + 'saved' => __('Saved!', 'lasso'), |
|
| 54 | + 'adding' => __('Adding...', 'lasso'), |
|
| 55 | + 'added' => __('Added!', 'lasso'), |
|
| 56 | + 'loading' => __('Loading...', 'lasso'), |
|
| 57 | + 'loadMore' => __('Load More', 'lasso'), |
|
| 58 | + 'noPostsFound' => __('No more posts found', 'lasso'), |
|
| 59 | + 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
| 60 | + 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
| 61 | + 'justWrite' => __('Just write...', 'lasso'), |
|
| 62 | + 'chooseImage' => __('Choose an image', 'lasso'), |
|
| 63 | + 'updateImage' => __('Update Image', 'lasso'), |
|
| 64 | + 'insertImage' => __('Insert Image', 'lasso'), |
|
| 65 | + 'selectImage' => __('Select Image', 'lasso'), |
|
| 66 | + 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
| 67 | + 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
| 68 | + 'chooseImages' => __('Choose images', 'lasso'), |
|
| 69 | + 'editImage' => __('Edit Image', 'lasso'), |
|
| 70 | + 'addImages' => __('Add Images', 'lasso'), |
|
| 71 | + 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
| 72 | + 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
| 73 | + 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
| 74 | + 'publishPost' => __('Publish Post?', 'lasso'), |
|
| 75 | + 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
| 76 | + 'deletePost' => __('Trash Post?', 'lasso'), |
|
| 77 | + 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
| 78 | + 'warning' => __('Oh snap!', 'laso'), |
|
| 79 | + 'cancelText' => __('O.K. got it!', 'lasso'), |
|
| 80 | + 'missingClass' => __('It looks like we are missing the Article CSS class. Editus will not function correctly without this CSS class.', 'lasso'), |
|
| 81 | 81 | 'missingConfirm' => __('Update Settings', 'lasso'), |
| 82 | - 'helperText' => __('one more letter','lasso'), |
|
| 82 | + 'helperText' => __('one more letter', 'lasso'), |
|
| 83 | 83 | 'editingBackup' => __('You are currently editing a backup copy of this post.') |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | - $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
| 86 | + $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
| 87 | 87 | |
| 88 | 88 | $gallery_class = new gallery(); |
| 89 | 89 | $gallery_nonce_action = $gallery_class->nonce_action; |
| 90 | - $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
| 90 | + $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
| 91 | 91 | |
| 92 | 92 | // localized objects |
| 93 | 93 | $objects = array( |
| 94 | - 'ajaxurl' => esc_url( $api_url ), |
|
| 94 | + 'ajaxurl' => esc_url($api_url), |
|
| 95 | 95 | 'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
| 96 | 96 | 'article_object' => $article_object, |
| 97 | 97 | 'featImgClass' => $featImgClass, |
| 98 | 98 | 'titleClass' => $titleClass, |
| 99 | 99 | 'strings' => $strings, |
| 100 | - 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
| 101 | - 'post_status' => get_post_status( $postid ), |
|
| 100 | + 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
| 101 | + 'post_status' => get_post_status($postid), |
|
| 102 | 102 | 'postid' => $postid, |
| 103 | 103 | 'permalink' => get_permalink(), |
| 104 | 104 | 'edit_others_pages' => current_user_can('edit_others_pages') ? 'true' : 'false', |
| 105 | 105 | 'edit_others_posts' => current_user_can('edit_others_posts') ? 'true' : 'false', |
| 106 | - 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
| 106 | + 'userCanEdit' => current_user_can('edit_post', $postid), |
|
| 107 | 107 | 'can_publish_posts' => current_user_can('publish_posts'), |
| 108 | 108 | 'can_publish_pages' => current_user_can('publish_pages'), |
| 109 | 109 | 'author' => is_user_logged_in() ? get_current_user_ID() : false, |
@@ -135,22 +135,22 @@ discard block |
||
| 135 | 135 | 'postTags' => lasso_get_objects('tag'), |
| 136 | 136 | 'noResultsDiv' => lasso_editor_empty_results(), |
| 137 | 137 | 'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
| 138 | - 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
| 139 | - 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
| 140 | - 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
| 141 | - 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
| 138 | + 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
| 139 | + 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
| 140 | + 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
| 141 | + 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
| 142 | 142 | 'revisionModal' => lasso_editor_revision_modal() |
| 143 | 143 | ); |
| 144 | 144 | |
| 145 | 145 | |
| 146 | 146 | // wp api client |
| 147 | - wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
| 148 | - $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
| 149 | - wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
| 147 | + wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
| 148 | + $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
| 149 | + wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
| 150 | 150 | |
| 151 | - $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 152 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
| 153 | - wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
| 151 | + $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
| 152 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery'), LASSO_VERSION, true); |
|
| 153 | + wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | } |