@@ -11,16 +11,16 @@ discard block |
||
11 | 11 | |
12 | 12 | public function __construct() { |
13 | 13 | |
14 | - $disable_tour = lasso_editor_get_option('disable_tour', 'lasso_editor'); |
|
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 | |
20 | 20 | /** |
21 | - * Draw the modal used to house the walk through |
|
22 | - * @since 0.6 |
|
23 | - */ |
|
21 | + * Draw the modal used to house the walk through |
|
22 | + * @since 0.6 |
|
23 | + */ |
|
24 | 24 | public function draw_tour() { |
25 | 25 | |
26 | 26 | $tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true ); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | - * Draw the inner slides for the welcome walkthrough |
|
84 | - * @since 0.6 |
|
85 | - */ |
|
83 | + * Draw the inner slides for the welcome walkthrough |
|
84 | + * @since 0.6 |
|
85 | + */ |
|
86 | 86 | public function tour_slides() { ?> |
87 | 87 | |
88 | 88 | <div id="lasso--loading" class="lasso--loading"><div class="lasso--loader"></div></div> |
@@ -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 |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | // only run on posts and pages if user is logged in |
13 | 13 | if ( is_user_logged_in() && lasso_user_can('edit_posts') ) { |
14 | - if ( !class_exists( 'WP_REST_Controller' ) ) { |
|
15 | - // using rest api v1 |
|
14 | + if ( !class_exists( 'WP_REST_Controller' ) ) { |
|
15 | + // using rest api v1 |
|
16 | 16 | ?> |
17 | 17 | <script type="text/html" id="lasso-tmpl--post"> |
18 | 18 | <li> |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | <?php |
32 | 32 | } else { |
33 | 33 | // using rest api v2 |
34 | - ?> |
|
34 | + ?> |
|
35 | 35 | <script type="text/html" id="lasso-tmpl--post"> |
36 | 36 | <li> |
37 | 37 | <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.id %>" > |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | </li> |
48 | 48 | </script> |
49 | 49 | <?php |
50 | - } |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
@@ -1,28 +1,28 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( !function_exists( 'lasso_backbone_templates' ) ): |
|
3 | +if (!function_exists('lasso_backbone_templates')): |
|
4 | 4 | |
5 | 5 | add_action('wp_footer', 'lasso_backbone_templates'); |
6 | - function lasso_backbone_templates(){ |
|
6 | + function lasso_backbone_templates() { |
|
7 | 7 | |
8 | 8 | $can_delete = lasso_user_can('delete_posts'); |
9 | 9 | $can_delete_class = $can_delete ? false : 'no-delete'; |
10 | 10 | |
11 | 11 | |
12 | 12 | // only run on posts and pages if user is logged in |
13 | - if ( is_user_logged_in() && lasso_user_can('edit_posts') ) { |
|
14 | - if ( !class_exists( 'WP_REST_Controller' ) ) { |
|
13 | + if (is_user_logged_in() && lasso_user_can('edit_posts')) { |
|
14 | + if (!class_exists('WP_REST_Controller')) { |
|
15 | 15 | // using rest api v1 |
16 | 16 | ?> |
17 | 17 | <script type="text/html" id="lasso-tmpl--post"> |
18 | 18 | <li> |
19 | - <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
19 | + <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.ID %>" > |
|
20 | 20 | <%= post.title %> |
21 | 21 | |
22 | 22 | <div class="lasso--post-list__controls"> |
23 | - <span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span> |
|
24 | - <?php if( $can_delete ): ?> |
|
25 | - <span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span> |
|
23 | + <span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span> |
|
24 | + <?php if ($can_delete): ?> |
|
25 | + <span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span> |
|
26 | 26 | <?php endif; ?> |
27 | 27 | </div> |
28 | 28 | </a> |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | ?> |
35 | 35 | <script type="text/html" id="lasso-tmpl--post"> |
36 | 36 | <li> |
37 | - <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class;?> <%= post.status %>" data-postid="<%= post.id %>" > |
|
37 | + <a href="<%= post.link %>" class="lasso--post-list__item <?php echo $can_delete_class; ?> <%= post.status %>" data-postid="<%= post.id %>" > |
|
38 | 38 | <%= post.title.rendered %> |
39 | 39 | |
40 | 40 | <div class="lasso--post-list__controls"> |
41 | - <span title="<?php echo esc_attr_e('Edit Post','lasso');?>" id="lasso--post__edit"></span> |
|
42 | - <?php if( $can_delete ): ?> |
|
43 | - <span title="<?php echo esc_attr_e('Delete Post','lasso');?>" id="lasso--post__delete"></span> |
|
41 | + <span title="<?php echo esc_attr_e('Edit Post', 'lasso'); ?>" id="lasso--post__edit"></span> |
|
42 | + <?php if ($can_delete): ?> |
|
43 | + <span title="<?php echo esc_attr_e('Delete Post', 'lasso'); ?>" id="lasso--post__delete"></span> |
|
44 | 44 | <?php endif; ?> |
45 | 45 | </div> |
46 | 46 | </a> |
@@ -146,7 +146,7 @@ |
||
146 | 146 | */ |
147 | 147 | protected function replace_rendered_shortcodes( $content ) { |
148 | 148 | //debug line |
149 | - //file_put_contents(WP_PLUGIN_DIR."/file1.txt", $content); |
|
149 | + //file_put_contents(WP_PLUGIN_DIR."/file1.txt", $content); |
|
150 | 150 | |
151 | 151 | |
152 | 152 | if ( false === strpos( $content, '--EDITUS_OTHER_SHORTCODE_START|' ) ) { |
@@ -19,27 +19,27 @@ discard block |
||
19 | 19 | * |
20 | 20 | * @return bool Always returns true. |
21 | 21 | */ |
22 | - public function content( $data ) { |
|
22 | + public function content($data) { |
|
23 | 23 | |
24 | 24 | $save_to_post_disabled = $this->save_to_post_disables(); |
25 | 25 | |
26 | - $postid = (int) $data[ 'post_id' ]; |
|
27 | - $content = $this->replace_rendered_shortcodes( $data[ 'content' ] ); |
|
28 | - $content = $this->remove_comments( $content ); |
|
26 | + $postid = (int) $data['post_id']; |
|
27 | + $content = $this->replace_rendered_shortcodes($data['content']); |
|
28 | + $content = $this->remove_comments($content); |
|
29 | 29 | |
30 | - if ( 'off' == $save_to_post_disabled || empty( $save_to_post_disabled ) ) { |
|
30 | + if ('off' == $save_to_post_disabled || empty($save_to_post_disabled)) { |
|
31 | 31 | |
32 | 32 | $args = array( |
33 | 33 | 'ID' => (int) $postid, |
34 | 34 | 'post_content' => $content |
35 | 35 | ); |
36 | 36 | |
37 | - wp_update_post( apply_filters( 'lasso_object_save_args', $args ) ); |
|
37 | + wp_update_post(apply_filters('lasso_object_save_args', $args)); |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | |
41 | 41 | // run save action |
42 | - do_action( 'lasso_post_saved', $postid, $content, get_current_user_ID() ); |
|
42 | + do_action('lasso_post_saved', $postid, $content, get_current_user_ID()); |
|
43 | 43 | |
44 | 44 | return true; |
45 | 45 | |
@@ -54,25 +54,25 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return bool Always returns true. |
56 | 56 | */ |
57 | - public function publish_content( $data ) { |
|
57 | + public function publish_content($data) { |
|
58 | 58 | $save_to_post_disabled = $this->save_to_post_disables(); |
59 | 59 | |
60 | - $postid = (int) $data[ 'post_id' ]; |
|
61 | - $content = $this->replace_rendered_shortcodes( $data[ 'content' ] ); |
|
62 | - $content = $this->remove_comments( $content ); |
|
60 | + $postid = (int) $data['post_id']; |
|
61 | + $content = $this->replace_rendered_shortcodes($data['content']); |
|
62 | + $content = $this->remove_comments($content); |
|
63 | 63 | |
64 | - if ( 'off' == $save_to_post_disabled || empty( $save_to_post_disabled ) ) { |
|
64 | + if ('off' == $save_to_post_disabled || empty($save_to_post_disabled)) { |
|
65 | 65 | |
66 | - $args = array ( |
|
66 | + $args = array( |
|
67 | 67 | 'ID' => $postid, |
68 | 68 | 'post_content' => $content, |
69 | 69 | 'post_status' => 'publish' |
70 | 70 | ); |
71 | - wp_update_post( apply_filters( 'lasso_object_publish_args', $args ) ); |
|
71 | + wp_update_post(apply_filters('lasso_object_publish_args', $args)); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
75 | - do_action( 'lasso_post_published', $postid, $content, get_current_user_ID() ); |
|
75 | + do_action('lasso_post_published', $postid, $content, get_current_user_ID()); |
|
76 | 76 | |
77 | 77 | return true; |
78 | 78 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
87 | 87 | */ |
88 | - public static function params(){ |
|
89 | - $params[ 'process_save_content' ] = array( |
|
88 | + public static function params() { |
|
89 | + $params['process_save_content'] = array( |
|
90 | 90 | 'post_id' => 'absint', |
91 | 91 | 'content' => 'wp_kses_post' |
92 | 92 | ); |
93 | 93 | |
94 | - $params[ 'process_save_publish_content' ] = array( |
|
94 | + $params['process_save_publish_content'] = array( |
|
95 | 95 | 'post_id' => 'absint', |
96 | 96 | 'content' => 'wp_kses_post' |
97 | 97 | ); |
@@ -107,11 +107,11 @@ discard block |
||
107 | 107 | * @return array Array of additional functions to use to authorize action. |
108 | 108 | */ |
109 | 109 | public static function auth_callbacks() { |
110 | - $params[ 'process_save_content' ] = array( |
|
110 | + $params['process_save_content'] = array( |
|
111 | 111 | 'lasso_user_can' |
112 | 112 | ); |
113 | 113 | |
114 | - $params[ 'process_save_publish_content' ] = array(); |
|
114 | + $params['process_save_publish_content'] = array(); |
|
115 | 115 | |
116 | 116 | return $params; |
117 | 117 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return bool |
128 | 128 | */ |
129 | 129 | protected function save_to_post_disables() { |
130 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
130 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
131 | 131 | |
132 | 132 | return $save_to_post_disabled; |
133 | 133 | |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @return string |
146 | 146 | */ |
147 | - protected function replace_rendered_shortcodes( $content ) { |
|
147 | + protected function replace_rendered_shortcodes($content) { |
|
148 | 148 | //debug line |
149 | 149 | //file_put_contents(WP_PLUGIN_DIR."/file1.txt", $content); |
150 | 150 | |
151 | 151 | |
152 | - if ( false === strpos( $content, '--EDITUS_OTHER_SHORTCODE_START|' ) ) { |
|
152 | + if (false === strpos($content, '--EDITUS_OTHER_SHORTCODE_START|')) { |
|
153 | 153 | return $content; |
154 | 154 | } |
155 | - $content = htmlspecialchars_decode ($content); |
|
155 | + $content = htmlspecialchars_decode($content); |
|
156 | 156 | |
157 | 157 | $content = preg_replace( |
158 | 158 | '/<!--EDITUS_OTHER_SHORTCODE_START\|\[(.*?)\]-->(.*?)<!--EDITUS_OTHER_SHORTCODE_END-->/s', |
@@ -63,8 +63,9 @@ |
||
63 | 63 | |
64 | 64 | function lasso_editor_get_option( $option, $section, $default = '' ) { |
65 | 65 | |
66 | - if ( empty( $option ) ) |
|
67 | - return; |
|
66 | + if ( empty( $option ) ) { |
|
67 | + return; |
|
68 | + } |
|
68 | 69 | |
69 | 70 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
70 | 71 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
49 | 49 | function lasso_show_in_rest($args, $post_type){ |
50 | 50 | |
51 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
51 | + $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
52 | 52 | $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
53 | 53 | if (in_array( $post_type,$allowed_post_types)) { |
54 | 54 | $args['show_in_rest'] = true; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - return $args; |
|
60 | + return $args; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -106,25 +106,25 @@ discard block |
||
106 | 106 | //table codes to be added |
107 | 107 | class editus_table { |
108 | 108 | |
109 | - public function __construct(){ |
|
110 | - $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | - if ($add_table) { |
|
112 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
109 | + public function __construct(){ |
|
110 | + $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
|
111 | + if ($add_table) { |
|
112 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
113 | 113 | |
114 | - } |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | |
117 | - function scripts() |
|
118 | - { |
|
119 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | - add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | - wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | - wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | - } |
|
117 | + function scripts() |
|
118 | + { |
|
119 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | + add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | + wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | + wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
124 | + } |
|
125 | 125 | |
126 | - function editus_table_edit_menu() |
|
127 | - { ?> |
|
126 | + function editus_table_edit_menu() |
|
127 | + { ?> |
|
128 | 128 | |
129 | 129 | <ul class='editus-table-menu'> |
130 | 130 | <li data-action="insertcol"><?php echo __('Insert Column','lasso')?></li> |
@@ -134,31 +134,31 @@ discard block |
||
134 | 134 | <li data-action="deltable"><?php echo __('Delete Table','lasso')?></li |
135 | 135 | </ul> |
136 | 136 | <?php |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | 139 | |
140 | - function editus_html_table() |
|
141 | - { |
|
142 | - return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure><p><br></p>'; |
|
143 | - } |
|
140 | + function editus_html_table() |
|
141 | + { |
|
142 | + return '<figure class="wp-block-table"><table><tr><th>Cell 1</th><th>Cell 2</th></tr><tr><td>Cell 3</td><td>Cell 4</td></tr></table></figure><p><br></p>'; |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | - function editus_components_add_table( $array ){ |
|
147 | - $custom = array( |
|
148 | - 'htmltable' => array( |
|
149 | - 'name' => __('HTML Table','lasso'), |
|
150 | - 'content' => self::editus_html_table(), |
|
151 | - ) |
|
152 | - ); |
|
153 | - return array_merge( $array, $custom ); |
|
154 | - } |
|
146 | + function editus_components_add_table( $array ){ |
|
147 | + $custom = array( |
|
148 | + 'htmltable' => array( |
|
149 | + 'name' => __('HTML Table','lasso'), |
|
150 | + 'content' => self::editus_html_table(), |
|
151 | + ) |
|
152 | + ); |
|
153 | + return array_merge( $array, $custom ); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | |
157 | - function editus_toolbar_components_add_table( ) { |
|
158 | - ?> |
|
157 | + function editus_toolbar_components_add_table( ) { |
|
158 | + ?> |
|
159 | 159 | <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
160 | 160 | <?php |
161 | - } |
|
161 | + } |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -169,41 +169,41 @@ discard block |
||
169 | 169 | //table codes to be added |
170 | 170 | class editus_paragraph { |
171 | 171 | |
172 | - public function __construct(){ |
|
173 | - $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
174 | - if ($add_paragraph) { |
|
175 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
172 | + public function __construct(){ |
|
173 | + $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
|
174 | + if ($add_paragraph) { |
|
175 | + add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
176 | 176 | |
177 | - } |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | |
180 | - function scripts() |
|
181 | - { |
|
182 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style')); |
|
183 | - add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1); |
|
184 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 ); |
|
185 | - //wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
186 | - //wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
187 | - } |
|
180 | + function scripts() |
|
181 | + { |
|
182 | + add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style')); |
|
183 | + add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1); |
|
184 | + add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 ); |
|
185 | + //wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
186 | + //wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
187 | + } |
|
188 | 188 | |
189 | - function editus_components_add_paragraph( $array ){ |
|
190 | - $custom = array( |
|
191 | - 'htmlparagraph' => array( |
|
192 | - 'name' => __('HTML Paragraph','lasso'), |
|
193 | - 'content' => self::editus_html_paragraph(), |
|
194 | - ) |
|
195 | - ); |
|
196 | - return array_merge( $array, $custom ); |
|
197 | - } |
|
189 | + function editus_components_add_paragraph( $array ){ |
|
190 | + $custom = array( |
|
191 | + 'htmlparagraph' => array( |
|
192 | + 'name' => __('HTML Paragraph','lasso'), |
|
193 | + 'content' => self::editus_html_paragraph(), |
|
194 | + ) |
|
195 | + ); |
|
196 | + return array_merge( $array, $custom ); |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | - function editus_html_paragraph() |
|
201 | - { |
|
202 | - return '<p contenteditable="true"><br></p>'; |
|
203 | - } |
|
200 | + function editus_html_paragraph() |
|
201 | + { |
|
202 | + return '<p contenteditable="true"><br></p>'; |
|
203 | + } |
|
204 | 204 | |
205 | - function editus_paragraph_style() |
|
206 | - { ?> |
|
205 | + function editus_paragraph_style() |
|
206 | + { ?> |
|
207 | 207 | <style> |
208 | 208 | #lasso-toolbar--components__list .lasso-toolbar--component__htmlparagraph:before |
209 | 209 | { |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | } |
213 | 213 | </style> |
214 | 214 | <?php |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | 217 | |
218 | - function editus_toolbar_components_add_paragraph( ) { |
|
219 | - ?> |
|
218 | + function editus_toolbar_components_add_paragraph( ) { |
|
219 | + ?> |
|
220 | 220 | <li data-type="htmlparagraph" title="<?php esc_attr_e( 'HTML Paragraph', 'lasso' );?>" class="quote lasso-toolbar--component__htmlparagraph dashicons dashicons-editor-paragraph"></li> |
221 | 221 | <?php |
222 | - } |
|
222 | + } |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | new editus_paragraph(); |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | */ |
19 | 19 | |
20 | 20 | // If this file is called directly, abort. |
21 | -if ( ! defined( 'WPINC' ) ) { |
|
21 | +if (!defined('WPINC')) { |
|
22 | 22 | die; |
23 | 23 | } |
24 | 24 | |
25 | 25 | // Set some constants |
26 | -define( 'LASSO_VERSION', '1.7.0' ); |
|
27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); |
|
28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); |
|
29 | -define( 'LASSO_FILE', __FILE__ ); |
|
26 | +define('LASSO_VERSION', '1.7.0'); |
|
27 | +define('LASSO_DIR', plugin_dir_path(__FILE__)); |
|
28 | +define('LASSO_URL', plugins_url('', __FILE__)); |
|
29 | +define('LASSO_FILE', __FILE__); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Load plugin if PHP version is 5.4 or later. |
33 | 33 | */ |
34 | -if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) { |
|
34 | +if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
|
35 | 35 | |
36 | - include_once( LASSO_DIR . '/bootstrap.php' ); |
|
36 | + include_once(LASSO_DIR.'/bootstrap.php'); |
|
37 | 37 | |
38 | 38 | } else { |
39 | 39 | |
40 | 40 | add_action('admin_head', 'lasso_fail_notice'); |
41 | - function lasso_fail_notice(){ |
|
41 | + function lasso_fail_notice() { |
|
42 | 42 | |
43 | 43 | printf('<div class="error"><p>Editus requires PHP 5.4 or higher.</p></div>'); |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | add_filter('register_post_type_args', 'lasso_show_in_rest', 10, 2); |
49 | -function lasso_show_in_rest($args, $post_type){ |
|
49 | +function lasso_show_in_rest($args, $post_type) { |
|
50 | 50 | |
51 | - $allowed_post_types = lasso_editor_get_option( 'allowed_post_types', 'lasso_editor', array( ) ); |
|
52 | - $allowed_post_types = apply_filters( 'lasso_allowed_post_types', $allowed_post_types ); |
|
53 | - if (in_array( $post_type,$allowed_post_types)) { |
|
51 | + $allowed_post_types = lasso_editor_get_option('allowed_post_types', 'lasso_editor', array( )); |
|
52 | + $allowed_post_types = apply_filters('lasso_allowed_post_types', $allowed_post_types); |
|
53 | + if (in_array($post_type, $allowed_post_types)) { |
|
54 | 54 | $args['show_in_rest'] = true; |
55 | 55 | if ($post_type != 'post' && $post_type != 'page') { |
56 | 56 | $args['rest_base'] = $post_type; |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | -function lasso_editor_get_option( $option, $section, $default = '' ) { |
|
64 | +function lasso_editor_get_option($option, $section, $default = '') { |
|
65 | 65 | |
66 | - if ( empty( $option ) ) |
|
66 | + if (empty($option)) |
|
67 | 67 | return; |
68 | 68 | |
69 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
69 | + if (function_exists('is_multisite') && is_multisite()) { |
|
70 | 70 | |
71 | - $options = get_site_option( $section ); |
|
71 | + $options = get_site_option($section); |
|
72 | 72 | |
73 | 73 | } else { |
74 | 74 | |
75 | - $options = get_option( $section ); |
|
75 | + $options = get_option($section); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( isset( $options[$option] ) ) { |
|
78 | + if (isset($options[$option])) { |
|
79 | 79 | return $options[$option]; |
80 | 80 | } |
81 | 81 | |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | )); |
89 | 89 | |
90 | 90 | // Gutenberg |
91 | -if( function_exists( 'is_gutenberg_page' ) ) { |
|
92 | - function add_raw_to_post( $response, $post, $request ) { |
|
91 | +if (function_exists('is_gutenberg_page')) { |
|
92 | + function add_raw_to_post($response, $post, $request) { |
|
93 | 93 | $response_data = $response->get_data(); |
94 | - if ( is_array( $response_data['content'] )) { |
|
95 | - $response_data['content']['raw'] = $post->post_content ; |
|
96 | - $response->set_data( $response_data ); |
|
94 | + if (is_array($response_data['content'])) { |
|
95 | + $response_data['content']['raw'] = $post->post_content; |
|
96 | + $response->set_data($response_data); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $response; |
100 | 100 | } |
101 | - add_filter( "rest_prepare_post", 'add_raw_to_post', 10, 3 ); |
|
101 | + add_filter("rest_prepare_post", 'add_raw_to_post', 10, 3); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -106,32 +106,32 @@ discard block |
||
106 | 106 | //table codes to be added |
107 | 107 | class editus_table { |
108 | 108 | |
109 | - public function __construct(){ |
|
109 | + public function __construct() { |
|
110 | 110 | $add_table = lasso_editor_get_option('add_table', 'lasso_editor', false); |
111 | 111 | if ($add_table) { |
112 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
112 | + add_action('wp_enqueue_scripts', array($this, 'scripts')); |
|
113 | 113 | |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | function scripts() |
118 | 118 | { |
119 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_table_edit_menu')); |
|
120 | - add_filter('lasso_components',array($this,'editus_components_add_table'),10,1); |
|
121 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_table'), 10 ); |
|
122 | - wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
|
123 | - wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
|
119 | + add_action('lasso_editor_controls_after_outside', array($this, 'editus_table_edit_menu')); |
|
120 | + add_filter('lasso_components', array($this, 'editus_components_add_table'), 10, 1); |
|
121 | + add_action('lasso_toolbar_components', array($this, 'editus_toolbar_components_add_table'), 10); |
|
122 | + wp_enqueue_style('editus-table-style', LASSO_URL.'/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true); |
|
123 | + wp_enqueue_script('editus_table', LASSO_URL.'/public/assets/js/editus-table-edit-public.js', array('jquery'), LASSO_VERSION, true); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | function editus_table_edit_menu() |
127 | 127 | { ?> |
128 | 128 | |
129 | 129 | <ul class='editus-table-menu'> |
130 | - <li data-action="insertcol"><?php echo __('Insert Column','lasso')?></li> |
|
131 | - <li data-action="insertrow"><?php echo __('Insert Row','lasso')?></li> |
|
132 | - <li data-action="delcol"><?php echo __('Delete Column','lasso')?></li> |
|
133 | - <li data-action="delrow"><?php echo __('Delete Row','lasso')?></li> |
|
134 | - <li data-action="deltable"><?php echo __('Delete Table','lasso')?></li |
|
130 | + <li data-action="insertcol"><?php echo __('Insert Column', 'lasso')?></li> |
|
131 | + <li data-action="insertrow"><?php echo __('Insert Row', 'lasso')?></li> |
|
132 | + <li data-action="delcol"><?php echo __('Delete Column', 'lasso')?></li> |
|
133 | + <li data-action="delrow"><?php echo __('Delete Row', 'lasso')?></li> |
|
134 | + <li data-action="deltable"><?php echo __('Delete Table', 'lasso')?></li |
|
135 | 135 | </ul> |
136 | 136 | <?php |
137 | 137 | } |
@@ -143,20 +143,20 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | |
146 | - function editus_components_add_table( $array ){ |
|
146 | + function editus_components_add_table($array) { |
|
147 | 147 | $custom = array( |
148 | 148 | 'htmltable' => array( |
149 | - 'name' => __('HTML Table','lasso'), |
|
149 | + 'name' => __('HTML Table', 'lasso'), |
|
150 | 150 | 'content' => self::editus_html_table(), |
151 | 151 | ) |
152 | 152 | ); |
153 | - return array_merge( $array, $custom ); |
|
153 | + return array_merge($array, $custom); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
157 | 157 | function editus_toolbar_components_add_table( ) { |
158 | 158 | ?> |
159 | - <li data-type="htmltable" title="<?php esc_attr_e( 'HTML Table', 'lasso' );?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
|
159 | + <li data-type="htmltable" title="<?php esc_attr_e('HTML Table', 'lasso'); ?>" class="quote lasso-toolbar--component__htmltable dashicons dashicons-grid-view"></li> |
|
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | } |
@@ -169,31 +169,31 @@ discard block |
||
169 | 169 | //table codes to be added |
170 | 170 | class editus_paragraph { |
171 | 171 | |
172 | - public function __construct(){ |
|
172 | + public function __construct() { |
|
173 | 173 | $add_paragraph = lasso_editor_get_option('add_paragraph', 'lasso_editor', false); |
174 | 174 | if ($add_paragraph) { |
175 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
175 | + add_action('wp_enqueue_scripts', array($this, 'scripts')); |
|
176 | 176 | |
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | 180 | function scripts() |
181 | 181 | { |
182 | - add_action('lasso_editor_controls_after_outside', array($this,'editus_paragraph_style')); |
|
183 | - add_filter('lasso_components',array($this,'editus_components_add_paragraph'),10,1); |
|
184 | - add_action( 'lasso_toolbar_components', array($this,'editus_toolbar_components_add_paragraph'), 10 ); |
|
182 | + add_action('lasso_editor_controls_after_outside', array($this, 'editus_paragraph_style')); |
|
183 | + add_filter('lasso_components', array($this, 'editus_components_add_paragraph'), 10, 1); |
|
184 | + add_action('lasso_toolbar_components', array($this, 'editus_toolbar_components_add_paragraph'), 10); |
|
185 | 185 | //wp_enqueue_style( 'editus-table-style', LASSO_URL. '/public/assets/css/editus-table-edit-public.css', LASSO_VERSION, true ); |
186 | 186 | //wp_enqueue_script( 'editus_table', LASSO_URL. '/public/assets/js/editus-table-edit-public.js', array( 'jquery' ), LASSO_VERSION, true ); |
187 | 187 | } |
188 | 188 | |
189 | - function editus_components_add_paragraph( $array ){ |
|
189 | + function editus_components_add_paragraph($array) { |
|
190 | 190 | $custom = array( |
191 | 191 | 'htmlparagraph' => array( |
192 | - 'name' => __('HTML Paragraph','lasso'), |
|
192 | + 'name' => __('HTML Paragraph', 'lasso'), |
|
193 | 193 | 'content' => self::editus_html_paragraph(), |
194 | 194 | ) |
195 | 195 | ); |
196 | - return array_merge( $array, $custom ); |
|
196 | + return array_merge($array, $custom); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | function editus_toolbar_components_add_paragraph( ) { |
219 | 219 | ?> |
220 | - <li data-type="htmlparagraph" title="<?php esc_attr_e( 'HTML Paragraph', 'lasso' );?>" class="quote lasso-toolbar--component__htmlparagraph dashicons dashicons-editor-paragraph"></li> |
|
220 | + <li data-type="htmlparagraph" title="<?php esc_attr_e('HTML Paragraph', 'lasso'); ?>" class="quote lasso-toolbar--component__htmlparagraph dashicons dashicons-editor-paragraph"></li> |
|
221 | 221 | <?php |
222 | 222 | } |
223 | 223 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @since 0.9.3 |
135 | 135 | * |
136 | 136 | * @param int $postid The current postid |
137 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
137 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
138 | 138 | * @param string $taxonomy The name of the taxonomy to which the term belongs. |
139 | 139 | * |
140 | 140 | * @return bool True if update was successful, false if not. |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | if ($taxonomy =='category') { |
150 | - // convert from names to category ids |
|
150 | + // convert from names to category ids |
|
151 | 151 | $cats = array(); |
152 | 152 | if (is_array($value)) { |
153 | 153 | foreach ($value as $cat) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * |
180 | 180 | * |
181 | 181 | * @param int $postid The current postid |
182 | - * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
182 | + * @param string|bool $value The term slug, or a comma separated list of slugs. Or false to remove all terms set for post. |
|
183 | 183 | * The first item is the name of taxonomy |
184 | 184 | * |
185 | 185 | * @return bool True if update was successful, false if not. |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $value = explode( ',', $value ); |
193 | 193 | } |
194 | 194 | |
195 | - // Deleting first array item |
|
195 | + // Deleting first array item |
|
196 | 196 | $taxonomy = array_shift($value); |
197 | 197 | $cats = array(); |
198 | 198 | foreach ($value as $cat) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | if( $value ) { |
216 | 216 | $time = current_time('mysql'); |
217 | - wp_update_post( |
|
217 | + wp_update_post( |
|
218 | 218 | array ( |
219 | 219 | 'ID' => $postid, // ID of the post to update |
220 | 220 | 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | use lasso\internal_api\api_action; |
11 | 11 | |
12 | -class update_object implements api_action{ |
|
12 | +class update_object implements api_action { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * The nonce action for this request. |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return bool Always returns true. |
31 | 31 | */ |
32 | - public function post( $data ) { |
|
32 | + public function post($data) { |
|
33 | 33 | |
34 | - $status = isset( $data['status'] ) ? $data['status'] : false; |
|
35 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
36 | - $slug = isset( $data['story_slug'] ) ? $data['story_slug'] : false; |
|
34 | + $status = isset($data['status']) ? $data['status'] : false; |
|
35 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
36 | + $slug = isset($data['story_slug']) ? $data['story_slug'] : false; |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
@@ -43,28 +43,28 @@ discard block |
||
43 | 43 | 'post_status' => $status |
44 | 44 | ); |
45 | 45 | |
46 | - wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) ); |
|
46 | + wp_update_post(apply_filters('lasso_object_status_update_args', $args)); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | // update categories |
50 | - $cats = isset( $data['story_cats'] ) ? $data['story_cats'] : false; |
|
51 | - self::set_post_terms( $postid, $cats, 'category' ); |
|
50 | + $cats = isset($data['story_cats']) ? $data['story_cats'] : false; |
|
51 | + self::set_post_terms($postid, $cats, 'category'); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // update tags |
55 | - $tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false; |
|
56 | - self::set_post_terms( $postid, $tags, 'post_tag' ); |
|
55 | + $tags = isset($data['story_tags']) ? $data['story_tags'] : false; |
|
56 | + self::set_post_terms($postid, $tags, 'post_tag'); |
|
57 | 57 | |
58 | 58 | // update custom taxonomy |
59 | - $taxs = isset( $data['story_custom_taxonomy'] ) ? $data['story_custom_taxonomy'] : false; |
|
60 | - self::set_custom_taxonomy( $postid, $taxs ); |
|
59 | + $taxs = isset($data['story_custom_taxonomy']) ? $data['story_custom_taxonomy'] : false; |
|
60 | + self::set_custom_taxonomy($postid, $taxs); |
|
61 | 61 | |
62 | 62 | //update date |
63 | - $date = isset( $data['post_date'] ) ? $data['post_date'] : false; |
|
64 | - self::set_date( $postid, $date ); |
|
63 | + $date = isset($data['post_date']) ? $data['post_date'] : false; |
|
64 | + self::set_date($postid, $date); |
|
65 | 65 | |
66 | 66 | |
67 | - do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() ); |
|
67 | + do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID()); |
|
68 | 68 | |
69 | 69 | return true; |
70 | 70 | |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
80 | 80 | */ |
81 | - public static function params(){ |
|
82 | - $params[ 'process_update_object_post' ] = array( |
|
81 | + public static function params() { |
|
82 | + $params['process_update_object_post'] = array( |
|
83 | 83 | 'postid' => 'absint', |
84 | 84 | 'status' => 'strip_tags', |
85 | 85 | 'story_slug' => array( |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return array Array of additional functions to use to authorize action. |
118 | 118 | */ |
119 | 119 | public static function auth_callbacks() { |
120 | - $params[ 'process_update_object_post' ] = array( |
|
120 | + $params['process_update_object_post'] = array( |
|
121 | 121 | 'lasso_user_can' |
122 | 122 | ); |
123 | 123 | |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return bool True if update was successful, false if not. |
141 | 141 | */ |
142 | - public function set_post_terms( $postid, $value, $taxonomy ) { |
|
143 | - if( $value ) { |
|
142 | + public function set_post_terms($postid, $value, $taxonomy) { |
|
143 | + if ($value) { |
|
144 | 144 | // first check if multiple, make array if so. |
145 | - if ( self::has_multiple_objects( $value ) ) { |
|
146 | - $value = explode( ',', $value ); |
|
145 | + if (self::has_multiple_objects($value)) { |
|
146 | + $value = explode(',', $value); |
|
147 | 147 | } |
148 | 148 | |
149 | - if ($taxonomy =='category') { |
|
149 | + if ($taxonomy == 'category') { |
|
150 | 150 | // convert from names to category ids |
151 | 151 | $cats = array(); |
152 | 152 | if (is_array($value)) { |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
|
162 | + $result = wp_set_object_terms($postid, $value, $taxonomy); |
|
163 | 163 | } |
164 | - else { |
|
164 | + else { |
|
165 | 165 | //remove all terms from post |
166 | - $result = wp_set_object_terms( $postid, null, $taxonomy ); |
|
166 | + $result = wp_set_object_terms($postid, null, $taxonomy); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - if ( ! is_wp_error( $result ) ) { |
|
170 | + if (!is_wp_error($result)) { |
|
171 | 171 | return true; |
172 | - }else{ |
|
172 | + } else { |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | } |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return bool True if update was successful, false if not. |
186 | 186 | */ |
187 | - public function set_custom_taxonomy( $postid, $value) { |
|
187 | + public function set_custom_taxonomy($postid, $value) { |
|
188 | 188 | |
189 | - if( $value ) { |
|
189 | + if ($value) { |
|
190 | 190 | // first check if multiple, make array if so. |
191 | - if ( self::has_multiple_objects( $value ) ) { |
|
192 | - $value = explode( ',', $value ); |
|
191 | + if (self::has_multiple_objects($value)) { |
|
192 | + $value = explode(',', $value); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | // Deleting first array item |
@@ -201,24 +201,24 @@ discard block |
||
201 | 201 | $value = $cats; |
202 | 202 | |
203 | 203 | |
204 | - $result = wp_set_object_terms( $postid, $cats, $taxonomy ); |
|
205 | - if ( ! is_wp_error( $result ) ) { |
|
204 | + $result = wp_set_object_terms($postid, $cats, $taxonomy); |
|
205 | + if (!is_wp_error($result)) { |
|
206 | 206 | return true; |
207 | - }else{ |
|
207 | + } else { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | - public function set_date( $postid, $value) { |
|
213 | + public function set_date($postid, $value) { |
|
214 | 214 | |
215 | - if( $value ) { |
|
215 | + if ($value) { |
|
216 | 216 | $time = current_time('mysql'); |
217 | 217 | wp_update_post( |
218 | - array ( |
|
218 | + array( |
|
219 | 219 | 'ID' => $postid, // ID of the post to update |
220 | - 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
|
221 | - 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime($value) ), |
|
220 | + 'post_date' => date('Y-m-d H:i:s', strtotime($value)), |
|
221 | + 'post_date_gmt' => gmdate('Y-m-d H:i:s', strtotime($value)), |
|
222 | 222 | ) |
223 | 223 | ); |
224 | 224 | } |
@@ -232,9 +232,9 @@ discard block |
||
232 | 232 | * @return bool True if there are multiple terms; otherwise, false. |
233 | 233 | * @since 0.9.3 |
234 | 234 | */ |
235 | - public function has_multiple_objects( $value ) { |
|
235 | + public function has_multiple_objects($value) { |
|
236 | 236 | |
237 | - return 0 < strpos( $value, ',' ); |
|
237 | + return 0 < strpos($value, ','); |
|
238 | 238 | |
239 | 239 | } |
240 | 240 |
@@ -160,8 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
163 | - } |
|
164 | - else { |
|
163 | + } else { |
|
165 | 164 | //remove all terms from post |
166 | 165 | $result = wp_set_object_terms( $postid, null, $taxonomy ); |
167 | 166 | |
@@ -169,7 +168,7 @@ discard block |
||
169 | 168 | |
170 | 169 | if ( ! is_wp_error( $result ) ) { |
171 | 170 | return true; |
172 | - }else{ |
|
171 | + } else{ |
|
173 | 172 | return false; |
174 | 173 | } |
175 | 174 | } |
@@ -204,7 +203,7 @@ discard block |
||
204 | 203 | $result = wp_set_object_terms( $postid, $cats, $taxonomy ); |
205 | 204 | if ( ! is_wp_error( $result ) ) { |
206 | 205 | return true; |
207 | - }else{ |
|
206 | + } else{ |
|
208 | 207 | return false; |
209 | 208 | } |
210 | 209 | } |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | |
100 | 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 | 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 | 106 | wp_enqueue_style( 'lasso-editor-settings-style', LASSO_URL.'/admin/assets/css/lasso-editor-settings.css', LASSO_VERSION ); |
@@ -131,11 +131,11 @@ discard block |
||
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
134 | - * Adds an admin notice reminding the user if their license key has not been saved |
|
135 | - * |
|
136 | - * @since 0.9.7 |
|
137 | - * @todo make dismissible |
|
138 | - */ |
|
134 | + * Adds an admin notice reminding the user if their license key has not been saved |
|
135 | + * |
|
136 | + * @since 0.9.7 |
|
137 | + * @todo make dismissible |
|
138 | + */ |
|
139 | 139 | public function license_nag(){ |
140 | 140 | |
141 | 141 | $screen = get_current_screen(); |
@@ -156,26 +156,26 @@ discard block |
||
156 | 156 | |
157 | 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 | 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 | 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 | } |
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
175 | - * Process hiding the dimiss |
|
176 | - * |
|
177 | - * @since 0.9.7 |
|
178 | - */ |
|
175 | + * Process hiding the dimiss |
|
176 | + * |
|
177 | + * @since 0.9.7 |
|
178 | + */ |
|
179 | 179 | public function dismiss_nag() { |
180 | 180 | |
181 | 181 | if ( isset( $_GET['lasso-notice'] ) && 'dismiss' == $_GET['lasso-notice'] && current_user_can('manage_options') ) { |
@@ -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 | } |
@@ -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 |
@@ -119,8 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | ob_start(); |
121 | 121 | |
122 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
123 | - return; |
|
122 | + if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) { |
|
123 | + return; |
|
124 | + } |
|
124 | 125 | |
125 | 126 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
126 | 127 | $key = sprintf('_lasso_%s_settings', $name ); |
@@ -198,8 +199,9 @@ discard block |
||
198 | 199 | $before = '<div class="lasso--postsettings__option">'; |
199 | 200 | $after = '</div>'; |
200 | 201 | |
201 | - if ( empty( $name ) || empty( $options ) ) |
|
202 | - return; |
|
202 | + if ( empty( $name ) || empty( $options ) ) { |
|
203 | + return; |
|
204 | + } |
|
203 | 205 | |
204 | 206 | foreach ( (array) $options as $option ) { |
205 | 207 | |
@@ -225,8 +227,9 @@ discard block |
||
225 | 227 | */ |
226 | 228 | function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
227 | 229 | |
228 | - if ( empty( $type ) || empty( $option ) ) |
|
229 | - return; |
|
230 | + if ( empty( $type ) || empty( $option ) ) { |
|
231 | + return; |
|
232 | + } |
|
230 | 233 | |
231 | 234 | $id = isset( $option['id'] ) ? $option['id'] : false; |
232 | 235 | //$id = $id ? lasso_clean_string( $id ) : false; |
@@ -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 |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | // udpate start point |
48 | - $point = json_decode( $start_point, true ); |
|
48 | + $point = json_decode( $start_point, true ); |
|
49 | 49 | update_post_meta( $postid, 'ase_map_component_start_point', $point ); |
50 | 50 | |
51 | 51 | // update zoom |
@@ -28,28 +28,28 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return bool Always returns true. |
30 | 30 | */ |
31 | - public function save( $data ) { |
|
31 | + public function save($data) { |
|
32 | 32 | |
33 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
34 | - $locations = isset( $data['ase-map-component-locations'] ) ? $data['ase-map-component-locations'] : false; |
|
35 | - $start_point = isset( $data['ase-map-component-start-point'] ) ? $data['ase-map-component-start-point']: false; |
|
36 | - $zoom = isset( $data['ase-map-component-zoom'] ) ? $data['ase-map-component-zoom' ] : false; |
|
33 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
34 | + $locations = isset($data['ase-map-component-locations']) ? $data['ase-map-component-locations'] : false; |
|
35 | + $start_point = isset($data['ase-map-component-start-point']) ? $data['ase-map-component-start-point'] : false; |
|
36 | + $zoom = isset($data['ase-map-component-zoom']) ? $data['ase-map-component-zoom'] : false; |
|
37 | 37 | |
38 | - if ( is_array( $locations ) ) { |
|
39 | - delete_post_meta( $postid, 'ase_map_component_locations' ); |
|
38 | + if (is_array($locations)) { |
|
39 | + delete_post_meta($postid, 'ase_map_component_locations'); |
|
40 | 40 | |
41 | 41 | // update locations if set |
42 | - foreach ( $locations as $location ) { |
|
43 | - $point = json_decode( urldecode( $location ), true ); |
|
44 | - add_post_meta( $postid, 'ase_map_component_locations', $point ); |
|
42 | + foreach ($locations as $location) { |
|
43 | + $point = json_decode(urldecode($location), true); |
|
44 | + add_post_meta($postid, 'ase_map_component_locations', $point); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | // udpate start point |
48 | - $point = json_decode( $start_point, true ); |
|
49 | - update_post_meta( $postid, 'ase_map_component_start_point', $point ); |
|
48 | + $point = json_decode($start_point, true); |
|
49 | + update_post_meta($postid, 'ase_map_component_start_point', $point); |
|
50 | 50 | |
51 | 51 | // update zoom |
52 | - update_post_meta( $postid, 'ase_map_component_zoom', $zoom ); |
|
52 | + update_post_meta($postid, 'ase_map_component_zoom', $zoom); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | return true; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return array Array of keys to pull from $_POST per action and their sanitization callback |
65 | 65 | */ |
66 | - public static function params(){ |
|
67 | - $params[ 'process_map_save' ] = array( |
|
66 | + public static function params() { |
|
67 | + $params['process_map_save'] = array( |
|
68 | 68 | 'postid' => 'absint', |
69 | 69 | 'ase-map-component-locations' => 'lasso_sanitize_data', |
70 | 70 | 'ase-map-component-start-point' => array( |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @return array Array of additional functions to use to authorize action. |
89 | 89 | */ |
90 | 90 | public static function auth_callbacks() { |
91 | - $params[ 'process_map_save' ] = array( |
|
91 | + $params['process_map_save'] = array( |
|
92 | 92 | 'lasso_user_can' |
93 | 93 | ); |
94 | 94 |