@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $disable_tour = lasso_editor_get_option('disable_tour', 'lasso_editor'); |
| 15 | 15 | if (!$disable_tour) { |
| 16 | - add_action( 'wp_footer', array( $this, 'draw_tour' ) ); |
|
| 16 | + add_action('wp_footer', array($this, 'draw_tour')); |
|
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function draw_tour() { |
| 25 | 25 | |
| 26 | - $tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true ); |
|
| 26 | + $tour_hidden = get_user_meta(get_current_user_ID(), 'lasso_hide_tour', true); |
|
| 27 | 27 | |
| 28 | - if ( lasso_user_can() && !$tour_hidden ) { |
|
| 28 | + if (lasso_user_can() && !$tour_hidden) { |
|
| 29 | 29 | |
| 30 | 30 | global $post; |
| 31 | 31 | |
| 32 | - $nonce = wp_create_nonce( 'lasso-editor-tour' ); |
|
| 32 | + $nonce = wp_create_nonce('lasso-editor-tour'); |
|
| 33 | 33 | |
| 34 | 34 | // let users add custom css classes |
| 35 | - $custom_classes = apply_filters( 'lasso_modal_tour_classes', '' ); |
|
| 35 | + $custom_classes = apply_filters('lasso_modal_tour_classes', ''); |
|
| 36 | 36 | |
| 37 | 37 | ?> |
| 38 | - <div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class( $custom_classes );?>"> |
|
| 38 | + <div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class($custom_classes); ?>"> |
|
| 39 | 39 | <script> |
| 40 | 40 | (function( $ ) { |
| 41 | 41 | $(document).ready(function(){ |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | </script> |
| 57 | 57 | <div class="lasso--modal__inner"> |
| 58 | 58 | |
| 59 | - <?php echo self::tour_slides();?> |
|
| 59 | + <?php echo self::tour_slides(); ?> |
|
| 60 | 60 | |
| 61 | 61 | <div class="lasso--postsettings__footer"> |
| 62 | 62 | |
| 63 | 63 | <div class="lasso--postsettings__option"> |
| 64 | 64 | <label for="hide_tour" class="checkbox-control checkbox"> |
| 65 | - <input type="checkbox" id="hide_tour" name="hide_tour" <?php checked( $tour_hidden, 1 ); ?>> |
|
| 65 | + <input type="checkbox" id="hide_tour" name="hide_tour" <?php checked($tour_hidden, 1); ?>> |
|
| 66 | 66 | <span class="control-indicator"></span> |
| 67 | - <?php _e('Don\'t show this again','lasso');?> |
|
| 67 | + <?php _e('Don\'t show this again', 'lasso'); ?> |
|
| 68 | 68 | </label> |
| 69 | 69 | </div> |
| 70 | 70 | |
| 71 | - <input id ="editus_tour_submit" type="submit" value="<?php _e( 'Okay, got it!', 'lasso' );?>" data-nonce="<?php echo $nonce;?>" > |
|
| 71 | + <input id ="editus_tour_submit" type="submit" value="<?php _e('Okay, got it!', 'lasso'); ?>" data-nonce="<?php echo $nonce; ?>" > |
|
| 72 | 72 | </div> |
| 73 | 73 | |
| 74 | 74 | </div> |
@@ -92,20 +92,20 @@ discard block |
||
| 92 | 92 | <?php |
| 93 | 93 | |
| 94 | 94 | $out = '<ul><li>'; |
| 95 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg' ); |
|
| 96 | - $out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.','lasso').'</p>'; |
|
| 95 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg'); |
|
| 96 | + $out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.', 'lasso').'</p>'; |
|
| 97 | 97 | $out .= '</li><li>'; |
| 98 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg' ); |
|
| 99 | - $out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.','lasso').'</p>'; |
|
| 98 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg'); |
|
| 99 | + $out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.', 'lasso').'</p>'; |
|
| 100 | 100 | $out .= '</li><li>'; |
| 101 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg' ); |
|
| 102 | - $out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.','lasso').'</p>'; |
|
| 101 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg'); |
|
| 102 | + $out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.', 'lasso').'</p>'; |
|
| 103 | 103 | $out .= '</li><li>'; |
| 104 | - $out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg' ); |
|
| 105 | - $out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.','lasso').'</p>'; |
|
| 104 | + $out .= sprintf('<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg'); |
|
| 105 | + $out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.', 'lasso').'</p>'; |
|
| 106 | 106 | $out .= '</li></ul>'; |
| 107 | 107 | |
| 108 | - echo apply_filters( 'lasso_tour_slides', $out ); |
|
| 108 | + echo apply_filters('lasso_tour_slides', $out); |
|
| 109 | 109 | |
| 110 | 110 | ?></div><?php |
| 111 | 111 | |
@@ -28,26 +28,26 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @since 1.0 |
| 30 | 30 | */ |
| 31 | - public function post( $data ) { |
|
| 31 | + public function post($data) { |
|
| 32 | 32 | |
| 33 | - $title = $data[ 'story_title' ]; |
|
| 33 | + $title = $data['story_title']; |
|
| 34 | 34 | |
| 35 | - $object = is_null( $data[ 'object'] ) ? false : $data[ 'object' ]; |
|
| 35 | + $object = is_null($data['object']) ? false : $data['object']; |
|
| 36 | 36 | |
| 37 | 37 | // insert a new post |
| 38 | 38 | $args = array( |
| 39 | 39 | 'post_title' => $title, |
| 40 | 40 | 'post_status' => 'draft', |
| 41 | 41 | 'post_type' => $object, |
| 42 | - 'post_content' => apply_filters( 'lasso_new_object_content', '<p>'.__( 'Once upon a time...','lasso').'</p>' ) |
|
| 42 | + 'post_content' => apply_filters('lasso_new_object_content', '<p>'.__('Once upon a time...', 'lasso').'</p>') |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - $postid = wp_insert_post( apply_filters( 'lasso_insert_object_args', $args ) ); |
|
| 45 | + $postid = wp_insert_post(apply_filters('lasso_insert_object_args', $args)); |
|
| 46 | 46 | |
| 47 | - do_action( 'lasso_new_object', $postid, $object, $title, get_current_user_ID() ); |
|
| 47 | + do_action('lasso_new_object', $postid, $object, $title, get_current_user_ID()); |
|
| 48 | 48 | |
| 49 | 49 | return array( |
| 50 | - 'postlink' => get_permalink( $postid ) |
|
| 50 | + 'postlink' => get_permalink($postid) |
|
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | 53 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
| 61 | 61 | */ |
| 62 | 62 | public static function params() { |
| 63 | - $params[ 'process_new_object_post' ] = array( |
|
| 64 | - 'story_title' => array( 'wp_strip_all_tags', 'trim' ), |
|
| 63 | + $params['process_new_object_post'] = array( |
|
| 64 | + 'story_title' => array('wp_strip_all_tags', 'trim'), |
|
| 65 | 65 | 'object' => 'trim' |
| 66 | 66 | ); |
| 67 | 67 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @return array Array of additional functions to use to authorize action. |
| 78 | 78 | */ |
| 79 | 79 | public static function auth_callbacks() { |
| 80 | - $params[ 'process_new_object_post' ] = array(); |
|
| 80 | + $params['process_new_object_post'] = array(); |
|
| 81 | 81 | |
| 82 | 82 | return $params; |
| 83 | 83 | |
@@ -43,23 +43,23 @@ discard block |
||
| 43 | 43 | $plugin = lasso::get_instance(); |
| 44 | 44 | $this->plugin_slug = $plugin->get_plugin_slug(); |
| 45 | 45 | |
| 46 | - add_action( 'admin_head', array( $this, 'admin_assets' ) ); |
|
| 47 | - add_action( 'admin_notices', array( $this, 'license_nag' ) ); |
|
| 48 | - add_action( 'admin_head', array( $this, 'dismiss_nag' ) ); |
|
| 49 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_meta' ), 10, 2 ); |
|
| 46 | + add_action('admin_head', array($this, 'admin_assets')); |
|
| 47 | + add_action('admin_notices', array($this, 'license_nag')); |
|
| 48 | + add_action('admin_head', array($this, 'dismiss_nag')); |
|
| 49 | + add_filter('plugin_row_meta', array($this, 'plugin_meta'), 10, 2); |
|
| 50 | 50 | |
| 51 | - if ( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 51 | + if (!class_exists('EDD_SL_Plugin_Updater')) { |
|
| 52 | 52 | include LASSO_DIR.'admin/includes/EDD_SL_Plugin_Updater.php'; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if ( !class_exists( 'TGM_Plugin_Activation' ) ) { |
|
| 55 | + if (!class_exists('TGM_Plugin_Activation')) { |
|
| 56 | 56 | include LASSO_DIR.'admin/includes/class-tgm-plugin-activation.php'; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | new menus\welcome(); |
| 60 | 60 | new menus\settings(); |
| 61 | 61 | |
| 62 | - if ( !defined( 'LASSO_AGENCY_MODE' ) ) { |
|
| 62 | + if (!defined('LASSO_AGENCY_MODE')) { |
|
| 63 | 63 | new menus\license(); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public static function get_instance() { |
| 76 | 76 | |
| 77 | 77 | // If the single instance hasn't been set, set it now. |
| 78 | - if ( null == self::$instance ) { |
|
| 78 | + if (null == self::$instance) { |
|
| 79 | 79 | self::$instance = new self; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | 'dashboard_page_lasso-welcome-screen' |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - foreach ( $pages as $page ) { |
|
| 100 | + foreach ($pages as $page) { |
|
| 101 | 101 | wp_enqueue_media(); |
| 102 | - wp_enqueue_style( 'wp-color-picker'); |
|
| 103 | - wp_enqueue_script( 'wp-color-picker'); |
|
| 102 | + wp_enqueue_style('wp-color-picker'); |
|
| 103 | + wp_enqueue_script('wp-color-picker'); |
|
| 104 | 104 | |
| 105 | - wp_enqueue_script( 'lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array( 'jquery','wp-color-picker' ), LASSO_VERSION, true ); |
|
| 106 | - wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION ); |
|
| 105 | + wp_enqueue_script('lasso-editor-settings-script', LASSO_URL.'/admin/assets/js/lasso-editor-settings.js', array('jquery', 'wp-color-picker'), LASSO_VERSION, true); |
|
| 106 | + wp_enqueue_style('lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -116,15 +116,15 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return array new array of links for our plugin listing on plugins.php |
| 118 | 118 | */ |
| 119 | - public function plugin_meta( $links, $file ) { |
|
| 119 | + public function plugin_meta($links, $file) { |
|
| 120 | 120 | |
| 121 | - if ( strpos( $file, 'lasso.php' ) !== false && !defined( 'LASSO_AGENCY_MODE' ) ) { |
|
| 121 | + if (strpos($file, 'lasso.php') !== false && !defined('LASSO_AGENCY_MODE')) { |
|
| 122 | 122 | |
| 123 | 123 | $new_links = array( |
| 124 | 124 | '<a href="http://edituswp.com/help" target="_blank">Help</a>' |
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | - $links = array_merge( $links, $new_links ); |
|
| 127 | + $links = array_merge($links, $new_links); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | return $links; |
@@ -136,35 +136,35 @@ discard block |
||
| 136 | 136 | * @since 0.9.7 |
| 137 | 137 | * @todo make dismissible |
| 138 | 138 | */ |
| 139 | - public function license_nag(){ |
|
| 139 | + public function license_nag() { |
|
| 140 | 140 | |
| 141 | - $screen = get_current_screen(); |
|
| 142 | - $welcome = 'toplevel_page_lasso-editor' == $screen->id; |
|
| 143 | - $license = get_option( 'lasso_license_key' ); |
|
| 144 | - $status = get_option( 'lasso_license_status' ); |
|
| 141 | + $screen = get_current_screen(); |
|
| 142 | + $welcome = 'toplevel_page_lasso-editor' == $screen->id; |
|
| 143 | + $license = get_option('lasso_license_key'); |
|
| 144 | + $status = get_option('lasso_license_status'); |
|
| 145 | 145 | |
| 146 | - $message_empty = apply_filters('lasso_empty_license_message','Your license key for support and automatic updates for Editus is missing!'); |
|
| 147 | - $message_invalid = apply_filters('lasso_invalid_license_message','Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.'); |
|
| 148 | - $message_inactive = apply_filters('lasso_inactive_license_message','It looks like your license key has not yet been activated.'); |
|
| 146 | + $message_empty = apply_filters('lasso_empty_license_message', 'Your license key for support and automatic updates for Editus is missing!'); |
|
| 147 | + $message_invalid = apply_filters('lasso_invalid_license_message', 'Oh snap! It looks like your Editus license key is invalid. Might check here to see if its been added correctly.'); |
|
| 148 | + $message_inactive = apply_filters('lasso_inactive_license_message', 'It looks like your license key has not yet been activated.'); |
|
| 149 | 149 | |
| 150 | - $license_link = sprintf('<a href="%s">Update License</a>', esc_url( add_query_arg( array( 'page' => 'lasso-license' ), admin_url('admin.php') ) ) ); |
|
| 151 | - $dismiss_link = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url( add_query_arg( 'lasso-notice', 'dismiss' ) ), __('Dismiss this notice.','lasso') ); |
|
| 150 | + $license_link = sprintf('<a href="%s">Update License</a>', esc_url(add_query_arg(array('page' => 'lasso-license'), admin_url('admin.php')))); |
|
| 151 | + $dismiss_link = sprintf('<a style="text-decoration:none;" href="%s" id="lasso-dismiss-notice" class="notice-dismiss"><span class="screen-reader-text">%s</span></a>', esc_url(add_query_arg('lasso-notice', 'dismiss')), __('Dismiss this notice.', 'lasso')); |
|
| 152 | 152 | |
| 153 | - $not_hidden = get_user_meta( get_current_user_ID(), 'lasso_license_nag_dismissed', true ); |
|
| 153 | + $not_hidden = get_user_meta(get_current_user_ID(), 'lasso_license_nag_dismissed', true); |
|
| 154 | 154 | |
| 155 | - if ( current_user_can('manage_options') && !$welcome && !defined( 'LASSO_AGENCY_MODE') && !$not_hidden ) { |
|
| 155 | + if (current_user_can('manage_options') && !$welcome && !defined('LASSO_AGENCY_MODE') && !$not_hidden) { |
|
| 156 | 156 | |
| 157 | - if ( empty( $license ) ) { |
|
| 157 | + if (empty($license)) { |
|
| 158 | 158 | |
| 159 | - printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link ); |
|
| 159 | + printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_empty, $license_link, $dismiss_link); |
|
| 160 | 160 | |
| 161 | - } else if ( 'invalid' == $status ){ // license key entered wrong or something |
|
| 161 | + } else if ('invalid' == $status) { // license key entered wrong or something |
|
| 162 | 162 | |
| 163 | - printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link , $dismiss_link ); |
|
| 163 | + printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_invalid, $license_link, $dismiss_link); |
|
| 164 | 164 | |
| 165 | - } else if ( empty( $status ) ){ // license key saved but not activated |
|
| 165 | + } else if (empty($status)) { // license key saved but not activated |
|
| 166 | 166 | |
| 167 | - printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link ); |
|
| 167 | + printf('<div class="lasso-notice error" style="position:relative;"><p>%s %s</p>%s</div>', $message_inactive, $license_link, $dismiss_link); |
|
| 168 | 168 | |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function dismiss_nag() { |
| 180 | 180 | |
| 181 | - if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) { |
|
| 182 | - update_user_meta( get_current_user_id(), 'lasso_license_nag_dismissed', 1 ); |
|
| 181 | + if (isset($_GET['lasso-notice']) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options')) { |
|
| 182 | + update_user_meta(get_current_user_id(), 'lasso_license_nag_dismissed', 1); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -52,28 +52,28 @@ discard block |
||
| 52 | 52 | * @param string $method The name of the callback method. |
| 53 | 53 | |
| 54 | 54 | */ |
| 55 | - public function __construct( $action, $callback_class) { |
|
| 56 | - if ( ! is_object( $callback_class ) ) { |
|
| 55 | + public function __construct($action, $callback_class) { |
|
| 56 | + if (!is_object($callback_class)) { |
|
| 57 | 57 | $this->callback_instance = new $callback_class; |
| 58 | - }else{ |
|
| 58 | + } else { |
|
| 59 | 59 | $this->callback_instance = $callback_class; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( $this->check_nonce() ) { |
|
| 63 | - if ( is_object( $this->callback_instance ) && $this->if_implements() ) { |
|
| 64 | - if ( $this->other_auth_checks( $action ) ) { |
|
| 62 | + if ($this->check_nonce()) { |
|
| 63 | + if (is_object($this->callback_instance) && $this->if_implements()) { |
|
| 64 | + if ($this->other_auth_checks($action)) { |
|
| 65 | 65 | $this->status_code = 200; |
| 66 | 66 | } else { |
| 67 | - $this->error_message = __( 'Unauthorized action', 'lasso' ); |
|
| 67 | + $this->error_message = __('Unauthorized action', 'lasso'); |
|
| 68 | 68 | $this->status_code = 401; |
| 69 | 69 | } |
| 70 | 70 | } else { |
| 71 | - $this->error_message = __( 'All callback classes used for processing the Editus Internal API must implement the lasso\internal_api\api_action interface.', 'lasso' ); |
|
| 71 | + $this->error_message = __('All callback classes used for processing the Editus Internal API must implement the lasso\internal_api\api_action interface.', 'lasso'); |
|
| 72 | 72 | $this->status_code = 401; |
| 73 | 73 | } |
| 74 | 74 | } else { |
| 75 | 75 | $this->status_code = 401; |
| 76 | - $this->error_message = __( 'Nonce invalid', 'lasso' ); |
|
| 76 | + $this->error_message = __('Nonce invalid', 'lasso'); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | } |
@@ -89,20 +89,20 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @return bool True if auth checks were all postive. |
| 91 | 91 | */ |
| 92 | - protected function other_auth_checks( $action ) { |
|
| 92 | + protected function other_auth_checks($action) { |
|
| 93 | 93 | $auth_callbacks = $this->callback_instance->auth_callbacks(); |
| 94 | 94 | |
| 95 | - if ( is_array( $auth_callbacks ) && isset( $auth_callbacks[ $action ] ) && is_array( $auth_callbacks[ $action ] ) ) { |
|
| 96 | - $checks = $auth_callbacks[ $action ]; |
|
| 97 | - if ( is_array( $checks ) ) { |
|
| 98 | - foreach ( $checks as $check ) { |
|
| 99 | - if ( is_array( $check ) ) { |
|
| 100 | - $check = call_user_func( array( $check[0], $check[1] ) ); |
|
| 95 | + if (is_array($auth_callbacks) && isset($auth_callbacks[$action]) && is_array($auth_callbacks[$action])) { |
|
| 96 | + $checks = $auth_callbacks[$action]; |
|
| 97 | + if (is_array($checks)) { |
|
| 98 | + foreach ($checks as $check) { |
|
| 99 | + if (is_array($check)) { |
|
| 100 | + $check = call_user_func(array($check[0], $check[1])); |
|
| 101 | 101 | } else { |
| 102 | - $check = call_user_func( $check ); |
|
| 102 | + $check = call_user_func($check); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( false === $check ) { |
|
| 105 | + if (false === $check) { |
|
| 106 | 106 | return false; |
| 107 | 107 | |
| 108 | 108 | } |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | protected function if_implements() { |
| 129 | 129 | |
| 130 | - $implements = class_implements( $this->callback_instance ); |
|
| 131 | - if ( is_array( $implements ) && in_array( 'lasso\internal_api\api_action', $implements ) ) { |
|
| 130 | + $implements = class_implements($this->callback_instance); |
|
| 131 | + if (is_array($implements) && in_array('lasso\internal_api\api_action', $implements)) { |
|
| 132 | 132 | return true; |
| 133 | 133 | |
| 134 | 134 | } |
@@ -147,13 +147,13 @@ discard block |
||
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | 149 | protected function check_nonce() { |
| 150 | - if ( isset( $this->callback_instance->nonce_action ) ) { |
|
| 150 | + if (isset($this->callback_instance->nonce_action)) { |
|
| 151 | 151 | $nonce = $this->callback_instance->nonce_action; |
| 152 | - }else{ |
|
| 152 | + } else { |
|
| 153 | 153 | $nonce = 'lasso_editor'; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - return wp_verify_nonce( $_POST[ 'nonce' ], $nonce ); |
|
| 156 | + return wp_verify_nonce($_POST['nonce'], $nonce); |
|
| 157 | 157 | |
| 158 | 158 | } |
| 159 | 159 | |
@@ -24,35 +24,35 @@ discard block |
||
| 24 | 24 | global $wp_query; |
| 25 | 25 | |
| 26 | 26 | //get action, and if set, possibly act |
| 27 | - $action = $wp_query->get( 'action' ); |
|
| 28 | - if ( $action && strpos( $_SERVER['REQUEST_URI'], 'lasso-internal-api' ) ) { |
|
| 27 | + $action = $wp_query->get('action'); |
|
| 28 | + if ($action && strpos($_SERVER['REQUEST_URI'], 'lasso-internal-api')) { |
|
| 29 | 29 | |
| 30 | - $response = __( 'Editus API Error.', 'lasso' ); |
|
| 30 | + $response = __('Editus API Error.', 'lasso'); |
|
| 31 | 31 | $code = 400; |
| 32 | 32 | |
| 33 | 33 | //see if have a nonce. Will verify it in auth class. |
| 34 | - if ( isset( $_POST[ 'nonce' ] ) ) { |
|
| 34 | + if (isset($_POST['nonce'])) { |
|
| 35 | 35 | |
| 36 | - $callback = self::find_callback( strip_tags( $action ) ); |
|
| 37 | - if ( is_int( $callback ) ) { |
|
| 36 | + $callback = self::find_callback(strip_tags($action)); |
|
| 37 | + if (is_int($callback)) { |
|
| 38 | 38 | $code = $callback; |
| 39 | - }elseif( ! class_exists( $callback['class'] ) ) { |
|
| 39 | + }elseif (!class_exists($callback['class'])) { |
|
| 40 | 40 | $code = 415; |
| 41 | - }else { |
|
| 42 | - $action = str_replace( '-', '_', $action ); |
|
| 41 | + } else { |
|
| 42 | + $action = str_replace('-', '_', $action); |
|
| 43 | 43 | $callback_instance = new $callback['class']; |
| 44 | - $auth = self::auth( $action, $callback_instance, $callback['method'] ); |
|
| 45 | - if ( 200 == $auth->status_code && is_array( $callback ) ) { |
|
| 44 | + $auth = self::auth($action, $callback_instance, $callback['method']); |
|
| 45 | + if (200 == $auth->status_code && is_array($callback)) { |
|
| 46 | 46 | $code = 200; |
| 47 | - $data = new find_data( $callback_instance, $action ); |
|
| 48 | - if ( is_array( $data->data ) && ! empty( $data->data ) ) { |
|
| 49 | - $response = self::route( $action, $callback_instance, $callback['method'], $data->data ); |
|
| 47 | + $data = new find_data($callback_instance, $action); |
|
| 48 | + if (is_array($data->data) && !empty($data->data)) { |
|
| 49 | + $response = self::route($action, $callback_instance, $callback['method'], $data->data); |
|
| 50 | 50 | } else { |
| 51 | 51 | $code = 500; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } else { |
| 55 | - if ( isset( $auth->error_message ) && is_string( $auth->error_message ) ) { |
|
| 55 | + if (isset($auth->error_message) && is_string($auth->error_message)) { |
|
| 56 | 56 | $response = $auth->error_message; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - }else{ |
|
| 64 | + } else { |
|
| 65 | 65 | $code = 401; |
| 66 | - $response = __( 'Nonce not set.', 'lasso' ); |
|
| 66 | + $response = __('Nonce not set.', 'lasso'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - self::respond( $response, $code ); |
|
| 69 | + self::respond($response, $code); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return \lasso\internal_api\auth |
| 87 | 87 | */ |
| 88 | - protected static function auth( $action, $callback ) { |
|
| 89 | - return new auth( $action, $callback ); |
|
| 88 | + protected static function auth($action, $callback) { |
|
| 89 | + return new auth($action, $callback); |
|
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
@@ -99,15 +99,15 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return array |
| 101 | 101 | */ |
| 102 | - protected static function find_callback( $action ) { |
|
| 103 | - if ( $action ) { |
|
| 104 | - $parts = explode( '_', $action ); |
|
| 102 | + protected static function find_callback($action) { |
|
| 103 | + if ($action) { |
|
| 104 | + $parts = explode('_', $action); |
|
| 105 | 105 | |
| 106 | - if ( isset( $parts[0] ) && isset( $parts[1] ) && isset( $parts[2] ) ) { |
|
| 107 | - $class = str_replace( '-', '_', $parts[1] ); |
|
| 106 | + if (isset($parts[0]) && isset($parts[1]) && isset($parts[2])) { |
|
| 107 | + $class = str_replace('-', '_', $parts[1]); |
|
| 108 | 108 | |
| 109 | 109 | $class = "\\lasso\\{$parts[0]}\\{$class}"; |
| 110 | - $callback = str_replace( '-', '_', $parts[2] ); |
|
| 110 | + $callback = str_replace('-', '_', $parts[2]); |
|
| 111 | 111 | |
| 112 | 112 | return array( |
| 113 | 113 | 'class' => $class, |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return mixed |
| 138 | 138 | */ |
| 139 | - protected static function route( $action, $callback, $method, $data ) { |
|
| 140 | - if ( method_exists( $callback, $method ) ) { |
|
| 141 | - $response = call_user_func( array( $callback, $method ), $data ); |
|
| 139 | + protected static function route($action, $callback, $method, $data) { |
|
| 140 | + if (method_exists($callback, $method)) { |
|
| 141 | + $response = call_user_func(array($callback, $method), $data); |
|
| 142 | 142 | |
| 143 | 143 | return $response; |
| 144 | 144 | |
@@ -156,29 +156,29 @@ discard block |
||
| 156 | 156 | * @param array|string $response The response message to send. |
| 157 | 157 | * @param bool|int $code Response code or bool. If is bool, response code will be 200 or 401 |
| 158 | 158 | */ |
| 159 | - protected static function respond( $response, $code ) { |
|
| 160 | - if ( true === $code ) { |
|
| 159 | + protected static function respond($response, $code) { |
|
| 160 | + if (true === $code) { |
|
| 161 | 161 | $code = 200; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if ( false == $code ) { |
|
| 164 | + if (false == $code) { |
|
| 165 | 165 | $code = 401; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if ( is_string( $response ) ) { |
|
| 168 | + if (is_string($response)) { |
|
| 169 | 169 | $data[] = $response; |
| 170 | - }elseif( is_array( $response ) ) { |
|
| 170 | + }elseif (is_array($response)) { |
|
| 171 | 171 | $data = $response; |
| 172 | - }else{ |
|
| 172 | + } else { |
|
| 173 | 173 | $data[] = $code; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - status_header( $code ); |
|
| 176 | + status_header($code); |
|
| 177 | 177 | nocache_headers(); |
| 178 | - if ( 200 == $code ) { |
|
| 179 | - wp_send_json_success( $data ); |
|
| 180 | - }else{ |
|
| 181 | - wp_send_json_error( $data ); |
|
| 178 | + if (200 == $code) { |
|
| 179 | + wp_send_json_success($data); |
|
| 180 | + } else { |
|
| 181 | + wp_send_json_error($data); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | public static function init() { |
| 202 | 202 | |
| 203 | - if ( ! self::$instance ) { |
|
| 203 | + if (!self::$instance) { |
|
| 204 | 204 | self::$instance = new self; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -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; |
@@ -15,21 +15,21 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @param array $fields |
| 17 | 17 | */ |
| 18 | - public function __construct( $fields ) { |
|
| 18 | + public function __construct($fields) { |
|
| 19 | 19 | $this->fields = $fields; |
| 20 | - add_filter( 'lasso_api_params', function( $params ) { |
|
| 21 | - foreach( $this->fields as $field => $cbs ) { |
|
| 20 | + add_filter('lasso_api_params', function($params) { |
|
| 21 | + foreach ($this->fields as $field => $cbs) { |
|
| 22 | 22 | //$field = lasso_clean_string( $field ); |
| 23 | - $params[ 'process_meta_update' ][ $field ] = $cbs; |
|
| 23 | + $params['process_meta_update'][$field] = $cbs; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | return $params; |
| 27 | 27 | |
| 28 | 28 | }); |
| 29 | 29 | |
| 30 | - add_filter( 'lasso_meta_fields', function( $allowed ) { |
|
| 30 | + add_filter('lasso_meta_fields', function($allowed) { |
|
| 31 | 31 | |
| 32 | - foreach( array_keys( $this->fields ) as $field ) { |
|
| 32 | + foreach (array_keys($this->fields) as $field) { |
|
| 33 | 33 | //$field = lasso_clean_string( $field ); |
| 34 | 34 | $allowed[] = $field; |
| 35 | 35 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * Get an array of addon data for the settings modal |
| 44 | 44 | * @since 0.9.4 |
| 45 | 45 | */ |
| 46 | -function lasso_get_modal_tabs(){ |
|
| 46 | +function lasso_get_modal_tabs() { |
|
| 47 | 47 | |
| 48 | 48 | $tabs = array(); |
| 49 | 49 | |
@@ -60,34 +60,34 @@ discard block |
||
| 60 | 60 | * @uses lasso_modal_addons_content() |
| 61 | 61 | * @since 0.9.4 |
| 62 | 62 | */ |
| 63 | -function lasso_modal_addons( $type = 'tab' ){ |
|
| 63 | +function lasso_modal_addons($type = 'tab') { |
|
| 64 | 64 | |
| 65 | 65 | $tabs = lasso_get_modal_tabs(); |
| 66 | 66 | $out = ''; |
| 67 | 67 | |
| 68 | - if ( $tabs ): |
|
| 68 | + if ($tabs): |
|
| 69 | 69 | |
| 70 | - if ( 'tab' == $type ) { |
|
| 70 | + if ('tab' == $type) { |
|
| 71 | 71 | |
| 72 | 72 | $out = '<ul class="lasso--modal__tabs">'; |
| 73 | 73 | |
| 74 | 74 | $out .= '<li class="active-tab" data-addon-name="core">Editus</li>'; |
| 75 | 75 | |
| 76 | - foreach ( $tabs as $tab ) { |
|
| 76 | + foreach ($tabs as $tab) { |
|
| 77 | 77 | |
| 78 | - if ( isset( $tab ) ) { |
|
| 78 | + if (isset($tab)) { |
|
| 79 | 79 | |
| 80 | - $out .= lasso_modal_addons_content( $tab, $type ); |
|
| 80 | + $out .= lasso_modal_addons_content($tab, $type); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $out .= '</ul>'; |
| 85 | 85 | |
| 86 | - } elseif ( 'content' == $type ) { |
|
| 87 | - foreach ( $tabs as $tab ) { |
|
| 86 | + } elseif ('content' == $type) { |
|
| 87 | + foreach ($tabs as $tab) { |
|
| 88 | 88 | |
| 89 | - if ( isset( $tab ) ) { |
|
| 90 | - $out .= lasso_modal_addons_content( $tab , $type ); |
|
| 89 | + if (isset($tab)) { |
|
| 90 | + $out .= lasso_modal_addons_content($tab, $type); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | endif; |
| 97 | 97 | |
| 98 | - return !empty( $out ) ? $out : false; |
|
| 98 | + return !empty($out) ? $out : false; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -115,26 +115,26 @@ discard block |
||
| 115 | 115 | * @since 0.9.5 |
| 116 | 116 | * @subpackage lasso_modal_addons_content |
| 117 | 117 | */ |
| 118 | -function lasso_option_form( $name = '', $options = array() ){ |
|
| 118 | +function lasso_option_form($name = '', $options = array()) { |
|
| 119 | 119 | |
| 120 | 120 | ob_start(); |
| 121 | 121 | |
| 122 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
| 122 | + if (empty($name) || empty($options) || !is_array($options)) |
|
| 123 | 123 | return; |
| 124 | 124 | |
| 125 | 125 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
| 126 | - $key = sprintf('_lasso_%s_settings', $name ); |
|
| 126 | + $key = sprintf('_lasso_%s_settings', $name); |
|
| 127 | 127 | |
| 128 | - $out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">' ); |
|
| 128 | + $out = sprintf('<form id="lasso--custom-field-form" class="lasso--post-form">'); |
|
| 129 | 129 | |
| 130 | - $out .= lasso_option_fields( $name, $options ); |
|
| 131 | - $out .='<div class="form--bottom">'; |
|
| 132 | - $out .='<input type="submit" value="'.__( 'Save', 'lasso' ).'">'; |
|
| 133 | - $out .='<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
| 134 | - $out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
| 135 | - $out .='<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
| 136 | - $out .='<input type="hidden" name="action" value="process_meta_update">'; |
|
| 137 | - $out .='</div>'; |
|
| 130 | + $out .= lasso_option_fields($name, $options); |
|
| 131 | + $out .= '<div class="form--bottom">'; |
|
| 132 | + $out .= '<input type="submit" value="'.__('Save', 'lasso').'">'; |
|
| 133 | + $out .= '<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
| 134 | + $out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
| 135 | + $out .= '<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
| 136 | + $out .= '<input type="hidden" name="action" value="process_meta_update">'; |
|
| 137 | + $out .= '</div>'; |
|
| 138 | 138 | |
| 139 | 139 | $out .= '</form>'; |
| 140 | 140 | |
@@ -192,20 +192,20 @@ discard block |
||
| 192 | 192 | * @since 0.9.5 |
| 193 | 193 | * @subpackage lasso_modal_addons_content |
| 194 | 194 | */ |
| 195 | -function lasso_option_fields( $name = '', $options = array() ){ |
|
| 195 | +function lasso_option_fields($name = '', $options = array()) { |
|
| 196 | 196 | |
| 197 | - $out = ''; |
|
| 197 | + $out = ''; |
|
| 198 | 198 | $before = '<div class="lasso--postsettings__option">'; |
| 199 | 199 | $after = '</div>'; |
| 200 | 200 | |
| 201 | - if ( empty( $name ) || empty( $options ) ) |
|
| 201 | + if (empty($name) || empty($options)) |
|
| 202 | 202 | return; |
| 203 | 203 | |
| 204 | - foreach ( (array) $options as $option ) { |
|
| 204 | + foreach ((array) $options as $option) { |
|
| 205 | 205 | |
| 206 | - $type = isset( $option['type'] ) ? $option['type'] : 'text'; |
|
| 206 | + $type = isset($option['type']) ? $option['type'] : 'text'; |
|
| 207 | 207 | |
| 208 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,$type ), $after ); |
|
| 208 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, $type), $after); |
|
| 209 | 209 | |
| 210 | 210 | } |
| 211 | 211 | |
@@ -223,44 +223,44 @@ discard block |
||
| 223 | 223 | * @param $type string text, textarea, checkbox, color |
| 224 | 224 | * @since 5.0 |
| 225 | 225 | */ |
| 226 | -function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
|
| 226 | +function lasso_option_engine_option($name = '', $option = '', $type = '') { |
|
| 227 | 227 | |
| 228 | - if ( empty( $type ) || empty( $option ) ) |
|
| 228 | + if (empty($type) || empty($option)) |
|
| 229 | 229 | return; |
| 230 | 230 | |
| 231 | - $id = isset( $option['id'] ) ? $option['id'] : false; |
|
| 231 | + $id = isset($option['id']) ? $option['id'] : false; |
|
| 232 | 232 | //$id = $id ? lasso_clean_string( $id ) : false; |
| 233 | 233 | |
| 234 | - $desc = isset( $option['desc'] ) ? $option['desc'] : false; |
|
| 234 | + $desc = isset($option['desc']) ? $option['desc'] : false; |
|
| 235 | 235 | |
| 236 | - $value = get_post_meta( get_the_id(), $option[ 'id' ], true ); |
|
| 236 | + $value = get_post_meta(get_the_id(), $option['id'], true); |
|
| 237 | 237 | |
| 238 | - switch ( $type ) { |
|
| 238 | + switch ($type) { |
|
| 239 | 239 | case 'text': |
| 240 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value ); |
|
| 240 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value); |
|
| 241 | 241 | break; |
| 242 | 242 | case 'textarea': |
| 243 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>',$id, esc_html( $desc ), $id, $id, $value ); |
|
| 243 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><textarea id="lasso--post-option-%s" name="%s">%s</textarea>', $id, esc_html($desc), $id, $id, $value); |
|
| 244 | 244 | break; |
| 245 | 245 | case 'imgurl': |
| 246 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image" class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>',$id, esc_html( $desc ), $value, $id, $id, $value ); |
|
| 246 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><img src="%s" style="height:80px;"><input id="lasso--post-option-%s" class="editus-custom-field-text" name="%s" type="text" value="%s" style="display:none;"><div title="Replace Image" class="editus-customtab-image-control" style="float:left;"><i class="lasso-icon-image" style="font-size:20px;padding:5px;"></i></div><div title="Remove Image" class="editus-customtab-image-remove" style="float:left;"><i class="lasso-icon-bin2" style="font-size:20px;padding:5px;"></i></div>', $id, esc_html($desc), $value, $id, $id, $value); |
|
| 247 | 247 | break; |
| 248 | 248 | case 'checkbox': |
| 249 | - $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s',$id, $id, $id ,esc_html( $desc ) ); |
|
| 249 | + $out = sprintf('<label for="lasso--post-option-%s" class="checkbox-control checkbox"><input id="lasso--post-option-%s" type="checkbox" name="%s" class="checkbox"><span class="control-indicator"></span>%s', $id, $id, $id, esc_html($desc)); |
|
| 250 | 250 | break; |
| 251 | 251 | case 'dropdown': |
| 252 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">',$id, esc_html( $desc ), $id, $id); |
|
| 252 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><select id="lasso--post-option-%s" name="%s">', $id, esc_html($desc), $id, $id); |
|
| 253 | 253 | $options = explode(";", $option['options']); |
| 254 | 254 | foreach ($options as &$opt) { |
| 255 | 255 | $opts = explode(":", $opt); |
| 256 | 256 | if ($opts[0] == $value) { |
| 257 | - $out .= sprintf('<option value = "%s" selected>%s</option>',$opts[0], $opts[1]); |
|
| 257 | + $out .= sprintf('<option value = "%s" selected>%s</option>', $opts[0], $opts[1]); |
|
| 258 | 258 | } else { |
| 259 | - $out .= sprintf('<option value = "%s">%s</option>',$opts[0], $opts[1]); |
|
| 259 | + $out .= sprintf('<option value = "%s">%s</option>', $opts[0], $opts[1]); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $out .='</select>'; |
|
| 263 | + $out .= '</select>'; |
|
| 264 | 264 | break; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return bool Always returns true. |
| 30 | 30 | */ |
| 31 | - public function update( $data ) { |
|
| 31 | + public function update($data) { |
|
| 32 | 32 | |
| 33 | - $post_id = isset( $data['post_id'] ) ? $data['post_id'] : false; |
|
| 33 | + $post_id = isset($data['post_id']) ? $data['post_id'] : false; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @param array $allowed_fields The fields |
| 42 | 42 | */ |
| 43 | - $allowed_fields = apply_filters( 'lasso_meta_fields', array() ); |
|
| 43 | + $allowed_fields = apply_filters('lasso_meta_fields', array()); |
|
| 44 | 44 | |
| 45 | - file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data,true)); |
|
| 45 | + file_put_contents(WP_PLUGIN_DIR."/file1.txt", print_r($data, true)); |
|
| 46 | 46 | |
| 47 | - if ( ! empty( $allowed_fields ) ) { |
|
| 48 | - foreach( $allowed_fields as $field ) { |
|
| 49 | - if ( isset( $data[ $field ] ) ) { |
|
| 47 | + if (!empty($allowed_fields)) { |
|
| 48 | + foreach ($allowed_fields as $field) { |
|
| 49 | + if (isset($data[$field])) { |
|
| 50 | 50 | //this original line changed dash to underscore |
| 51 | 51 | //update_post_meta( $post_id, lasso_unclean_string( $field ), $data[ $field ] ); |
| 52 | - update_post_meta( $post_id, $field, $data[ $field ] ); |
|
| 52 | + update_post_meta($post_id, $field, $data[$field]); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - do_action( 'editus_after_meta_update', $post_id, $data ); |
|
| 57 | + do_action('editus_after_meta_update', $post_id, $data); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | return true; |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return array Array of keys to pull from $data per action and their sanitization callback |
| 70 | 70 | */ |
| 71 | - public static function params(){ |
|
| 72 | - $params[ 'process_meta_update' ] = array( |
|
| 71 | + public static function params() { |
|
| 72 | + $params['process_meta_update'] = array( |
|
| 73 | 73 | 'post_id' => 'absint', |
| 74 | 74 | 'tab_name' => 'trim' |
| 75 | 75 | ); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return array Array of additional functions to use to authorize action. |
| 87 | 87 | */ |
| 88 | 88 | public static function auth_callbacks() { |
| 89 | - $params[ 'process_meta_update' ] = array( |
|
| 89 | + $params['process_meta_update'] = array( |
|
| 90 | 90 | 'lasso_user_can' |
| 91 | 91 | ); |
| 92 | 92 | |