@@ -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', |
@@ -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> |
@@ -16,80 +16,80 @@ discard block |
||
16 | 16 | |
17 | 17 | $array = array( |
18 | 18 | 'quote' => array( |
19 | - 'name' => __('Quote','lasso'), |
|
19 | + 'name' => __('Quote', 'lasso'), |
|
20 | 20 | 'content' => lasso_quote_component(), |
21 | 21 | ), |
22 | 22 | 'image' => array( |
23 | - 'name' => __('Image','lasso'), |
|
23 | + 'name' => __('Image', 'lasso'), |
|
24 | 24 | 'content' => lasso_image_component(), |
25 | 25 | ), |
26 | 26 | 'parallax' => array( |
27 | - 'name' => __('Parallax','lasso'), |
|
27 | + 'name' => __('Parallax', 'lasso'), |
|
28 | 28 | 'content' => lasso_parallax_component(), |
29 | 29 | ), |
30 | 30 | 'audio' => array( |
31 | - 'name' => __('Audio','lasso'), |
|
31 | + 'name' => __('Audio', 'lasso'), |
|
32 | 32 | 'content' => lasso_audio_component(), |
33 | 33 | ), |
34 | 34 | 'content' => array( |
35 | - 'name' => __('Content','lasso'), |
|
35 | + 'name' => __('Content', 'lasso'), |
|
36 | 36 | 'content' => lasso_content_component(), |
37 | 37 | ), |
38 | 38 | 'character' => array( |
39 | - 'name' => __('Character','lasso'), |
|
39 | + 'name' => __('Character', 'lasso'), |
|
40 | 40 | 'content' => lasso_character_component(), |
41 | 41 | ), |
42 | 42 | 'collection' => array( |
43 | - 'name' => __('Collection','lasso'), |
|
43 | + 'name' => __('Collection', 'lasso'), |
|
44 | 44 | 'content' => lasso_collections_component(), |
45 | 45 | ), |
46 | 46 | 'document' => array( |
47 | - 'name' => __('Document','lasso'), |
|
47 | + 'name' => __('Document', 'lasso'), |
|
48 | 48 | 'content' => lasso_document_component(), |
49 | 49 | ), |
50 | 50 | 'gallery' => array( |
51 | - 'name' => __('Gallery','lasso'), |
|
51 | + 'name' => __('Gallery', 'lasso'), |
|
52 | 52 | 'content' => lasso_gallery_component(), |
53 | 53 | ), |
54 | 54 | 'chapter' => array( |
55 | - 'name' => __('Chapter','lasso'), |
|
55 | + 'name' => __('Chapter', 'lasso'), |
|
56 | 56 | 'content' => lasso_heading_component(), |
57 | 57 | ), |
58 | 58 | 'map' => array( |
59 | - 'name' => __('Map','lasso'), |
|
59 | + 'name' => __('Map', 'lasso'), |
|
60 | 60 | 'content' => lasso_map_component(), |
61 | 61 | ), |
62 | 62 | 'timeline_stop' => array( |
63 | - 'name' => __('Timeline','lasso'), |
|
63 | + 'name' => __('Timeline', 'lasso'), |
|
64 | 64 | 'content' => lasso_timeline_component(), |
65 | 65 | ), |
66 | 66 | 'video' => array( |
67 | - 'name' => __('Video','lasso'), |
|
67 | + 'name' => __('Video', 'lasso'), |
|
68 | 68 | 'content' => lasso_video_component(), |
69 | 69 | ), |
70 | 70 | 'wpimg' => array( |
71 | - 'name' => __('WordPress Image','lasso'), |
|
71 | + 'name' => __('WordPress Image', 'lasso'), |
|
72 | 72 | 'content' => lasso_wp_image(), |
73 | 73 | ), |
74 | 74 | 'wpquote' => array( |
75 | - 'name' => __('WordPress Quote','lasso'), |
|
75 | + 'name' => __('WordPress Quote', 'lasso'), |
|
76 | 76 | 'content' => lasso_wp_quote(), |
77 | 77 | ), |
78 | 78 | 'gallery_pop' => array( |
79 | - 'name' => __('Gallery Pop','lasso'), |
|
79 | + 'name' => __('Gallery Pop', 'lasso'), |
|
80 | 80 | 'content' => lasso_gallery_pop_component(), |
81 | 81 | ), |
82 | 82 | 'events' => array( |
83 | - 'name' => __('Events','lasso'), |
|
83 | + 'name' => __('Events', 'lasso'), |
|
84 | 84 | 'content' => lasso_event_component(), |
85 | 85 | ), |
86 | 86 | 'wpvideo' => array( |
87 | - 'name' => __('WordPress Image','lasso'), |
|
87 | + 'name' => __('WordPress Image', 'lasso'), |
|
88 | 88 | 'content' => lasso_wp_video(), |
89 | 89 | ), |
90 | 90 | ); |
91 | 91 | |
92 | - return apply_filters( 'lasso_components', $array ); |
|
92 | + return apply_filters('lasso_components', $array); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -115,132 +115,132 @@ discard block |
||
115 | 115 | */ |
116 | 116 | |
117 | 117 | // 1 |
118 | -if ( !function_exists( 'lasso_quote_component' ) ): |
|
118 | +if (!function_exists('lasso_quote_component')): |
|
119 | 119 | function lasso_quote_component() { |
120 | 120 | |
121 | - return do_shortcode( '[aesop_quote quote="The Universe is made of stories, not of atoms."]' ); |
|
121 | + return do_shortcode('[aesop_quote quote="The Universe is made of stories, not of atoms."]'); |
|
122 | 122 | } |
123 | 123 | endif; |
124 | 124 | |
125 | 125 | // 2 |
126 | -if ( !function_exists( 'lasso_image_component' ) ): |
|
126 | +if (!function_exists('lasso_image_component')): |
|
127 | 127 | function lasso_image_component() { |
128 | 128 | |
129 | - return do_shortcode( '[aesop_image img="'.LASSO_URL.'/public/assets/img/empty-img.png" align="center" imgwidth="800px"]' ); |
|
129 | + return do_shortcode('[aesop_image img="'.LASSO_URL.'/public/assets/img/empty-img.png" align="center" imgwidth="800px"]'); |
|
130 | 130 | } |
131 | 131 | endif; |
132 | 132 | |
133 | 133 | // 3 |
134 | -if ( !function_exists( 'lasso_parallax_component' ) ): |
|
134 | +if (!function_exists('lasso_parallax_component')): |
|
135 | 135 | function lasso_parallax_component() { |
136 | 136 | |
137 | - return do_shortcode( '[aesop_parallax img="'.LASSO_URL.'/public/assets/img/empty-img.png"]' ); |
|
137 | + return do_shortcode('[aesop_parallax img="'.LASSO_URL.'/public/assets/img/empty-img.png"]'); |
|
138 | 138 | } |
139 | 139 | endif; |
140 | 140 | |
141 | 141 | // 4 |
142 | -if ( !function_exists( 'lasso_audio_component' ) ): |
|
142 | +if (!function_exists('lasso_audio_component')): |
|
143 | 143 | function lasso_audio_component() { |
144 | 144 | |
145 | - return do_shortcode( '[aesop_audio src="http://users.skynet.be/fa046054/home/P22/track06.mp3"]' ); |
|
145 | + return do_shortcode('[aesop_audio src="http://users.skynet.be/fa046054/home/P22/track06.mp3"]'); |
|
146 | 146 | |
147 | 147 | } |
148 | 148 | endif; |
149 | 149 | |
150 | 150 | // 5 |
151 | -if ( !function_exists( 'lasso_content_component' ) ): |
|
151 | +if (!function_exists('lasso_content_component')): |
|
152 | 152 | function lasso_content_component() { |
153 | 153 | |
154 | - return do_shortcode( '[aesop_content]Start typing here...[/aesop_content]' ); |
|
154 | + return do_shortcode('[aesop_content]Start typing here...[/aesop_content]'); |
|
155 | 155 | } |
156 | 156 | endif; |
157 | 157 | |
158 | 158 | // 6 |
159 | -if ( !function_exists( 'lasso_character_component' ) ): |
|
159 | +if (!function_exists('lasso_character_component')): |
|
160 | 160 | function lasso_character_component() { |
161 | 161 | |
162 | - return do_shortcode( '[aesop_character img="'.LASSO_URL.'/public/assets/img/empty-img.png" name="Joes Apartment" width="150px"]' ); |
|
162 | + return do_shortcode('[aesop_character img="'.LASSO_URL.'/public/assets/img/empty-img.png" name="Joes Apartment" width="150px"]'); |
|
163 | 163 | |
164 | 164 | } |
165 | 165 | endif; |
166 | 166 | |
167 | 167 | // 7 |
168 | -if ( !function_exists( 'lasso_collections_component' ) ): |
|
168 | +if (!function_exists('lasso_collections_component')): |
|
169 | 169 | function lasso_collections_component() { |
170 | 170 | |
171 | - return do_shortcode( '[aesop_collection]' ); |
|
171 | + return do_shortcode('[aesop_collection]'); |
|
172 | 172 | } |
173 | 173 | endif; |
174 | 174 | |
175 | 175 | // 8 |
176 | -if ( !function_exists( 'lasso_document_component' ) ): |
|
176 | +if (!function_exists('lasso_document_component')): |
|
177 | 177 | function lasso_document_component() { |
178 | 178 | |
179 | - return do_shortcode( '[aesop_document src="'.LASSO_URL.'/public/assets/img/empty-img.png" ]' ); |
|
179 | + return do_shortcode('[aesop_document src="'.LASSO_URL.'/public/assets/img/empty-img.png" ]'); |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | endif; |
183 | 183 | |
184 | 184 | // 9 |
185 | -if ( !function_exists( 'lasso_gallery_component' ) ): |
|
185 | +if (!function_exists('lasso_gallery_component')): |
|
186 | 186 | function lasso_gallery_component() { |
187 | 187 | |
188 | - return do_shortcode( '[aesop_gallery]' ); |
|
188 | + return do_shortcode('[aesop_gallery]'); |
|
189 | 189 | |
190 | 190 | } |
191 | 191 | endif; |
192 | 192 | |
193 | 193 | // 10 |
194 | -if ( !function_exists( 'lasso_heading_component' ) ): |
|
194 | +if (!function_exists('lasso_heading_component')): |
|
195 | 195 | function lasso_heading_component() { |
196 | 196 | |
197 | - return do_shortcode( '[aesop_chapter title="Chapter One" img="'.LASSO_URL.'/public/assets/img/empty-img.png" full="on"]' ); |
|
197 | + return do_shortcode('[aesop_chapter title="Chapter One" img="'.LASSO_URL.'/public/assets/img/empty-img.png" full="on"]'); |
|
198 | 198 | } |
199 | 199 | endif; |
200 | 200 | |
201 | 201 | // 11 |
202 | -if ( !function_exists( 'lasso_map_component' ) ): |
|
202 | +if (!function_exists('lasso_map_component')): |
|
203 | 203 | function lasso_map_component() { |
204 | 204 | |
205 | 205 | return '<form id="lasso--map-form" class="aesop-component aesop-map-component lasso--map-drag-holder" enctype="multipart/form-data"> |
206 | 206 | '.lasso_map_form_footer().' |
207 | - '.do_shortcode( '[aesop_map sticky="off"]' ).' |
|
207 | + '.do_shortcode('[aesop_map sticky="off"]').' |
|
208 | 208 | </form>'; |
209 | 209 | |
210 | 210 | } |
211 | 211 | endif; |
212 | 212 | |
213 | 213 | // 12 |
214 | -if ( !function_exists( 'lasso_timeline_component' ) ): |
|
214 | +if (!function_exists('lasso_timeline_component')): |
|
215 | 215 | function lasso_timeline_component() { |
216 | 216 | |
217 | - return do_shortcode( '[aesop_timeline_stop num="Title" title="2014"]' ); |
|
217 | + return do_shortcode('[aesop_timeline_stop num="Title" title="2014"]'); |
|
218 | 218 | |
219 | 219 | } |
220 | 220 | endif; |
221 | 221 | |
222 | 222 | // 13 |
223 | -if ( !function_exists( 'lasso_video_component' ) ): |
|
223 | +if (!function_exists('lasso_video_component')): |
|
224 | 224 | function lasso_video_component() { |
225 | 225 | |
226 | - return do_shortcode( '[aesop_video src="vimeo" id="59940289" width="100%" align="center"]' ); |
|
226 | + return do_shortcode('[aesop_video src="vimeo" id="59940289" width="100%" align="center"]'); |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | endif; |
230 | 230 | |
231 | 231 | // 14 - since 0.9.1 |
232 | -if ( !function_exists('lasso_wp_image') ): |
|
232 | +if (!function_exists('lasso_wp_image')): |
|
233 | 233 | |
234 | - function lasso_wp_image(){ |
|
234 | + function lasso_wp_image() { |
|
235 | 235 | return '<div data-component-type="wpimg" class="lasso--wpimg__wrap lasso-component"><img class="wp-image-0" src="'.LASSO_URL.'/public/assets/img/empty-img.png"></div>'; |
236 | 236 | } |
237 | 237 | |
238 | 238 | endif; |
239 | 239 | |
240 | 240 | // 15 - since 0.9.2 |
241 | -if ( !function_exists('lasso_wp_quote') ): |
|
241 | +if (!function_exists('lasso_wp_quote')): |
|
242 | 242 | |
243 | - function lasso_wp_quote(){ |
|
243 | + function lasso_wp_quote() { |
|
244 | 244 | return '<blockquote data-component-type="wpquote" class="lasso--wpquote lasso-component"><p>The universe is made of stories.</p></blockquote>'; |
245 | 245 | } |
246 | 246 | |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | |
249 | 249 | // 16 gallery pop added but not fully supported as of 0.9.9.11 |
250 | 250 | |
251 | -if ( !function_exists( 'lasso_gallery_pop_component' ) ): |
|
251 | +if (!function_exists('lasso_gallery_pop_component')): |
|
252 | 252 | function lasso_gallery_pop_component() { |
253 | - return do_shortcode( '[aesop_gallery_pop]' ); |
|
253 | + return do_shortcode('[aesop_gallery_pop]'); |
|
254 | 254 | } |
255 | 255 | endif; |
256 | 256 | |
257 | 257 | // 17 - work in progress |
258 | 258 | |
259 | -if ( !function_exists( 'lasso_event_component' ) ): |
|
259 | +if (!function_exists('lasso_event_component')): |
|
260 | 260 | function lasso_event_component() { |
261 | 261 | $id = editus_get_one_id('aesop_events'); |
262 | 262 | return '<div data-component-type="events" class="aesop-component lasso-component"><p>Aesop Event: After setting the event, save and reload the page.</p></div>'; |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | endif; |
265 | 265 | |
266 | 266 | // 18 - work in progress |
267 | -if ( !function_exists('lasso_wp_video') ): |
|
267 | +if (!function_exists('lasso_wp_video')): |
|
268 | 268 | |
269 | - function lasso_wp_video(){ |
|
269 | + function lasso_wp_video() { |
|
270 | 270 | return '<div data-component-type="wpvideo" class="lasso--wpvideo__wrap lasso-component"><video class="wp-video-0"></video>'; |
271 | 271 | } |
272 | 272 | |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | // helper function to retrieve one id for default option |
276 | 276 | function editus_get_one_id($type) |
277 | 277 | { |
278 | - $args = array( 'posts_per_page' => 1, 'post_type' => $type ); |
|
279 | - $posts = get_posts( $args ); |
|
280 | - if ( $posts ) { |
|
281 | - foreach ( $posts as $post ) { |
|
278 | + $args = array('posts_per_page' => 1, 'post_type' => $type); |
|
279 | + $posts = get_posts($args); |
|
280 | + if ($posts) { |
|
281 | + foreach ($posts as $post) { |
|
282 | 282 | return $post->ID; |
283 | 283 | } |
284 | 284 | } |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | -if ( lasso_user_can( 'edit_posts' ) && ! is_admin() ) { |
|
10 | - add_filter( 'the_content', 'lasso_wrap_shortcodes', 9 ); |
|
9 | +if (lasso_user_can('edit_posts') && !is_admin()) { |
|
10 | + add_filter('the_content', 'lasso_wrap_shortcodes', 9); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
@@ -20,33 +20,33 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string |
22 | 22 | */ |
23 | -function lasso_wrap_shortcodes( $content ) { |
|
23 | +function lasso_wrap_shortcodes($content) { |
|
24 | 24 | global $shortcode_tags; |
25 | 25 | |
26 | - if ( false === strpos( $content, '[' ) ) { |
|
26 | + if (false === strpos($content, '[')) { |
|
27 | 27 | return $content; |
28 | 28 | } |
29 | 29 | |
30 | - if ( empty( $shortcode_tags ) || ! is_array( $shortcode_tags ) ) { |
|
30 | + if (empty($shortcode_tags) || !is_array($shortcode_tags)) { |
|
31 | 31 | return $content; |
32 | 32 | } |
33 | 33 | |
34 | - $tagnames = array_keys( $shortcode_tags ); |
|
35 | - $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) ); |
|
34 | + $tagnames = array_keys($shortcode_tags); |
|
35 | + $tagregexp = join('|', array_map('preg_quote', $tagnames)); |
|
36 | 36 | $pattern = "/\\[($tagregexp)/s"; |
37 | 37 | |
38 | - if ( 0 === preg_match( $pattern, $content ) ) { |
|
38 | + if (0 === preg_match($pattern, $content)) { |
|
39 | 39 | // Avoids parsing HTML when there are no shortcodes or embeds anyway. |
40 | 40 | return $content; |
41 | 41 | } |
42 | 42 | |
43 | - $content = do_shortcodes_in_html_tags( $content, true ,$tagnames); |
|
43 | + $content = do_shortcodes_in_html_tags($content, true, $tagnames); |
|
44 | 44 | |
45 | 45 | $pattern = get_shortcode_regex(); |
46 | - $content = preg_replace_callback( "/$pattern/s", 'lasso_wrap_shortcode_tag', $content ); |
|
46 | + $content = preg_replace_callback("/$pattern/s", 'lasso_wrap_shortcode_tag', $content); |
|
47 | 47 | |
48 | 48 | // Always restore square braces so we don't break things like <!--[if IE ]> |
49 | - $content = unescape_invalid_shortcodes( $content ); |
|
49 | + $content = unescape_invalid_shortcodes($content); |
|
50 | 50 | |
51 | 51 | return $content; |
52 | 52 | } |
@@ -60,33 +60,33 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | -function lasso_wrap_shortcode_tag( $m ) { |
|
63 | +function lasso_wrap_shortcode_tag($m) { |
|
64 | 64 | // allow [[foo]] syntax for escaping a tag |
65 | - if ( $m[1] == '[' && $m[6] == ']' ) { |
|
66 | - return substr( $m[0], 1, - 1 ); |
|
65 | + if ($m[1] == '[' && $m[6] == ']') { |
|
66 | + return substr($m[0], 1, - 1); |
|
67 | 67 | } |
68 | - $exception_arr1 = array('aesop_gallery_pop','aesop_character_carousel'); |
|
69 | - $exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler','av_textblock','av_toggle_container','av_toggle'); |
|
70 | - $exception_arr2 = apply_filters('lasso_wrap_shortcode_exceptions',$exception_arr2); |
|
68 | + $exception_arr1 = array('aesop_gallery_pop', 'aesop_character_carousel'); |
|
69 | + $exception_arr2 = array('su_box', 'su_note', 'su_document', 'su_spoiler', 'av_textblock', 'av_toggle_container', 'av_toggle'); |
|
70 | + $exception_arr2 = apply_filters('lasso_wrap_shortcode_exceptions', $exception_arr2); |
|
71 | 71 | |
72 | - if ( strpos( $m[2],'aesop_' ) === 0 ) { |
|
72 | + if (strpos($m[2], 'aesop_') === 0) { |
|
73 | 73 | // check against the exceptions |
74 | - if (strpos_arr($m[2],$exception_arr1)===false) { |
|
74 | + if (strpos_arr($m[2], $exception_arr1) === false) { |
|
75 | 75 | return $m[0]; |
76 | 76 | } |
77 | 77 | } |
78 | - if (strpos_arr($m[2],$exception_arr2)!==false) { |
|
78 | + if (strpos_arr($m[2], $exception_arr2) !== false) { |
|
79 | 79 | return $m[0]; |
80 | 80 | } |
81 | 81 | |
82 | - return '<!--EDITUS_OTHER_SHORTCODE_START|[' . $m[0] . ']-->' . $m[0] . '<!--EDITUS_OTHER_SHORTCODE_END-->'; |
|
82 | + return '<!--EDITUS_OTHER_SHORTCODE_START|['.$m[0].']-->'.$m[0].'<!--EDITUS_OTHER_SHORTCODE_END-->'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /* a helper function */ |
86 | 86 | function strpos_arr($haystack, $needle) { |
87 | - if(!is_array($needle)) $needle = array($needle); |
|
88 | - foreach($needle as $what) { |
|
89 | - if(($pos = strpos($haystack, $what))!==false) return $pos; |
|
87 | + if (!is_array($needle)) $needle = array($needle); |
|
88 | + foreach ($needle as $what) { |
|
89 | + if (($pos = strpos($haystack, $what)) !== false) return $pos; |
|
90 | 90 | } |
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | \ No newline at end of file |
@@ -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 |
@@ -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 |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | require_once LASSO_DIR.'/public/includes/wrap-shortcodes.php'; |
53 | 53 | |
54 | 54 | // Activate plugin when new blog is added |
55 | - add_action( 'wpmu_new_blog', array( $this, 'activate_new_site' ) ); |
|
55 | + add_action('wpmu_new_blog', array($this, 'activate_new_site')); |
|
56 | 56 | |
57 | 57 | // Load plugin text domain |
58 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
58 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
59 | 59 | |
60 | - add_action( 'wp_ajax_get_aesop_component', array( $this, 'get_aesop_component' ) ); |
|
61 | - add_action( 'wp_ajax_editus_do_shortcode', array( $this, 'editus_do_shortcode' ) ); |
|
62 | - add_action( 'wp_ajax_editus_lock_post', array( $this, 'editus_lock_post' ) ); |
|
63 | - add_action( 'wp_ajax_editus_hide_tour', array( $this, 'editus_hide_tour' ) ); |
|
64 | - add_action( 'wp_ajax_editus_set_post_setting', array( $this, 'editus_set_post_setting' ) ); |
|
60 | + add_action('wp_ajax_get_aesop_component', array($this, 'get_aesop_component')); |
|
61 | + add_action('wp_ajax_editus_do_shortcode', array($this, 'editus_do_shortcode')); |
|
62 | + add_action('wp_ajax_editus_lock_post', array($this, 'editus_lock_post')); |
|
63 | + add_action('wp_ajax_editus_hide_tour', array($this, 'editus_hide_tour')); |
|
64 | + add_action('wp_ajax_editus_set_post_setting', array($this, 'editus_set_post_setting')); |
|
65 | 65 | |
66 | 66 | // enable saving custom fields through REST API |
67 | 67 | self::enable_metasave('post'); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | public static function get_instance() { |
93 | 93 | |
94 | 94 | // If the single instance hasn't been set, set it now. |
95 | - if ( null == self::$instance ) { |
|
95 | + if (null == self::$instance) { |
|
96 | 96 | self::$instance = new self; |
97 | 97 | } |
98 | 98 | |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | * WPMU is disabled or plugin is |
110 | 110 | * activated on an individual blog. |
111 | 111 | */ |
112 | - public static function activate( $network_wide ) { |
|
112 | + public static function activate($network_wide) { |
|
113 | 113 | |
114 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
114 | + if (function_exists('is_multisite') && is_multisite()) { |
|
115 | 115 | |
116 | - if ( $network_wide ) { |
|
116 | + if ($network_wide) { |
|
117 | 117 | |
118 | 118 | // Get all blog ids |
119 | 119 | $blog_ids = self::get_blog_ids(); |
120 | 120 | |
121 | - foreach ( $blog_ids as $blog_id ) { |
|
121 | + foreach ($blog_ids as $blog_id) { |
|
122 | 122 | |
123 | - switch_to_blog( $blog_id ); |
|
123 | + switch_to_blog($blog_id); |
|
124 | 124 | self::single_activate(); |
125 | 125 | } |
126 | 126 | |
@@ -146,18 +146,18 @@ discard block |
||
146 | 146 | * WPMU is disabled or plugin is |
147 | 147 | * deactivated on an individual blog. |
148 | 148 | */ |
149 | - public static function deactivate( $network_wide ) { |
|
149 | + public static function deactivate($network_wide) { |
|
150 | 150 | |
151 | - if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
|
151 | + if (function_exists('is_multisite') && is_multisite()) { |
|
152 | 152 | |
153 | - if ( $network_wide ) { |
|
153 | + if ($network_wide) { |
|
154 | 154 | |
155 | 155 | // Get all blog ids |
156 | 156 | $blog_ids = self::get_blog_ids(); |
157 | 157 | |
158 | - foreach ( $blog_ids as $blog_id ) { |
|
158 | + foreach ($blog_ids as $blog_id) { |
|
159 | 159 | |
160 | - switch_to_blog( $blog_id ); |
|
160 | + switch_to_blog($blog_id); |
|
161 | 161 | self::single_deactivate(); |
162 | 162 | |
163 | 163 | } |
@@ -181,13 +181,13 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @param int $blog_id ID of the new blog. |
183 | 183 | */ |
184 | - public function activate_new_site( $blog_id ) { |
|
184 | + public function activate_new_site($blog_id) { |
|
185 | 185 | |
186 | - if ( 1 !== did_action( 'wpmu_new_blog' ) ) { |
|
186 | + if (1 !== did_action('wpmu_new_blog')) { |
|
187 | 187 | return; |
188 | 188 | } |
189 | 189 | |
190 | - switch_to_blog( $blog_id ); |
|
190 | + switch_to_blog($blog_id); |
|
191 | 191 | self::single_activate(); |
192 | 192 | restore_current_blog(); |
193 | 193 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | WHERE archived = '0' AND spam = '0' |
213 | 213 | AND deleted = '0'"; |
214 | 214 | |
215 | - return $wpdb->get_col( $sql ); |
|
215 | + return $wpdb->get_col($sql); |
|
216 | 216 | |
217 | 217 | } |
218 | 218 | |
@@ -223,18 +223,18 @@ discard block |
||
223 | 223 | */ |
224 | 224 | private static function single_activate() { |
225 | 225 | |
226 | - $curr_version = get_option( 'lasso_version' ); |
|
226 | + $curr_version = get_option('lasso_version'); |
|
227 | 227 | |
228 | 228 | // update upgraded from |
229 | - if ( $curr_version ) { |
|
230 | - update_option( 'lasso_updated_from', $curr_version ); |
|
229 | + if ($curr_version) { |
|
230 | + update_option('lasso_updated_from', $curr_version); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // update lasso version option |
234 | - update_option( 'lasso_version', LASSO_VERSION ); |
|
234 | + update_option('lasso_version', LASSO_VERSION); |
|
235 | 235 | |
236 | 236 | // set transietn for activation welcome |
237 | - set_transient( '_lasso_welcome_redirect', true, 30 ); |
|
237 | + set_transient('_lasso_welcome_redirect', true, 30); |
|
238 | 238 | |
239 | 239 | |
240 | 240 | } |
@@ -256,15 +256,15 @@ discard block |
||
256 | 256 | public function load_plugin_textdomain() { |
257 | 257 | |
258 | 258 | $domain = $this->plugin_slug; |
259 | - $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
259 | + $locale = apply_filters('plugin_locale', get_locale(), $domain); |
|
260 | 260 | |
261 | - $out = load_textdomain( $domain, trailingslashit( LASSO_DIR ). 'languages/' . $domain . '-' . $locale . '.mo' ); |
|
261 | + $out = load_textdomain($domain, trailingslashit(LASSO_DIR).'languages/'.$domain.'-'.$locale.'.mo'); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // new ajax function to lock post for editing |
265 | 265 | public function editus_lock_post() |
266 | 266 | { |
267 | - $post_id= $_POST["postid"]; |
|
267 | + $post_id = $_POST["postid"]; |
|
268 | 268 | $locked = wp_check_post_lock($post_id); |
269 | 269 | |
270 | 270 | if (!$locked) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | echo "true"; |
273 | 273 | } else { |
274 | 274 | $user_info = get_userdata($locked); |
275 | - echo "Post opened by ".$user_info->first_name . " " . $user_info->last_name; |
|
275 | + echo "Post opened by ".$user_info->first_name." ".$user_info->last_name; |
|
276 | 276 | } |
277 | 277 | exit; |
278 | 278 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | { |
283 | 283 | $user_id = get_current_user_ID(); |
284 | 284 | |
285 | - update_user_meta( $user_id, 'lasso_hide_tour', true ); |
|
285 | + update_user_meta($user_id, 'lasso_hide_tour', true); |
|
286 | 286 | exit; |
287 | 287 | } |
288 | 288 | |
@@ -293,14 +293,14 @@ discard block |
||
293 | 293 | $data = array(); |
294 | 294 | parse_str($_POST['data'], $data); |
295 | 295 | |
296 | - if (!wp_verify_nonce( $data[ 'nonce' ], 'lasso-update-post-settings' )) { |
|
296 | + if (!wp_verify_nonce($data['nonce'], 'lasso-update-post-settings')) { |
|
297 | 297 | wp_send_json_error(); |
298 | 298 | exit; |
299 | 299 | } |
300 | 300 | |
301 | - $status = isset( $data['status'] ) ? $data['status'] : false; |
|
302 | - $postid = isset( $data['postid'] ) ? $data['postid'] : false; |
|
303 | - $slug = isset( $data['story_slug'] ) ? $data['story_slug'] : false; |
|
301 | + $status = isset($data['status']) ? $data['status'] : false; |
|
302 | + $postid = isset($data['postid']) ? $data['postid'] : false; |
|
303 | + $slug = isset($data['story_slug']) ? $data['story_slug'] : false; |
|
304 | 304 | |
305 | 305 | |
306 | 306 | $args = array( |
@@ -311,33 +311,33 @@ discard block |
||
311 | 311 | |
312 | 312 | |
313 | 313 | |
314 | - wp_update_post( apply_filters( 'lasso_object_status_update_args', $args ) ); |
|
314 | + wp_update_post(apply_filters('lasso_object_status_update_args', $args)); |
|
315 | 315 | |
316 | 316 | // update categories |
317 | - $cats = isset( $data['story_cats'] ) ? $data['story_cats'] : false; |
|
317 | + $cats = isset($data['story_cats']) ? $data['story_cats'] : false; |
|
318 | 318 | |
319 | - self::set_post_terms( $postid, $cats, 'category' ); |
|
319 | + self::set_post_terms($postid, $cats, 'category'); |
|
320 | 320 | |
321 | 321 | // update tags |
322 | - $tags = isset( $data['story_tags'] ) ? $data['story_tags'] : false; |
|
323 | - self::set_post_terms( $postid, $tags, 'post_tag' ); |
|
322 | + $tags = isset($data['story_tags']) ? $data['story_tags'] : false; |
|
323 | + self::set_post_terms($postid, $tags, 'post_tag'); |
|
324 | 324 | |
325 | 325 | //update date |
326 | - $date = isset( $data['post_date'] ) ? $data['post_date'] : false; |
|
327 | - self::set_date( $postid, $date ); |
|
326 | + $date = isset($data['post_date']) ? $data['post_date'] : false; |
|
327 | + self::set_date($postid, $date); |
|
328 | 328 | |
329 | - do_action( 'lasso_post_updated', $postid, $slug, $status, get_current_user_ID() ); |
|
329 | + do_action('lasso_post_updated', $postid, $slug, $status, get_current_user_ID()); |
|
330 | 330 | wp_send_json_success(); |
331 | 331 | exit; |
332 | 332 | } |
333 | 333 | |
334 | 334 | public static function enable_metasave($type) |
335 | 335 | { |
336 | - register_rest_field( $type, 'metadata', array( |
|
337 | - 'get_callback' => function ( $data ) { |
|
338 | - return get_post_meta( $data['id']);//, '', '' ); |
|
336 | + register_rest_field($type, 'metadata', array( |
|
337 | + 'get_callback' => function($data) { |
|
338 | + return get_post_meta($data['id']); //, '', '' ); |
|
339 | 339 | }, |
340 | - 'update_callback' => function( $data, $post ) { |
|
340 | + 'update_callback' => function($data, $post) { |
|
341 | 341 | foreach ($data as $key => $value) { |
342 | 342 | update_post_meta($post->ID, $key, $value); |
343 | 343 | } |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | public function editus_do_shortcode() |
350 | 350 | { |
351 | 351 | |
352 | - $code= $_POST["code"]; |
|
352 | + $code = $_POST["code"]; |
|
353 | 353 | $code = str_replace('\"', '"', $code); |
354 | 354 | |
355 | - $code_wrapped = lasso_wrap_shortcodes( $code); |
|
356 | - $out = do_shortcode($code); |
|
355 | + $code_wrapped = lasso_wrap_shortcodes($code); |
|
356 | + $out = do_shortcode($code); |
|
357 | 357 | if ($out != '') { |
358 | - $out = do_shortcode($code_wrapped); |
|
358 | + $out = do_shortcode($code_wrapped); |
|
359 | 359 | echo $out; |
360 | 360 | exit; |
361 | 361 | } |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | /** @var \WP_Embed $wp_embed */ |
366 | 366 | global $wp_embed; |
367 | 367 | $wp_embed->post_ID = $_POST["ID"]; |
368 | - $out =$wp_embed->run_shortcode( $code_wrapped ); |
|
368 | + $out = $wp_embed->run_shortcode($code_wrapped); |
|
369 | 369 | |
370 | 370 | echo $out; |
371 | 371 | exit; |
@@ -375,53 +375,53 @@ discard block |
||
375 | 375 | { |
376 | 376 | |
377 | 377 | |
378 | - $code= $_POST["code"]; |
|
378 | + $code = $_POST["code"]; |
|
379 | 379 | $atts = array( |
380 | 380 | ); |
381 | 381 | foreach ($_POST as $key => $value) { |
382 | - if ($key !="code" && $key !="action") { |
|
382 | + if ($key != "code" && $key != "action") { |
|
383 | 383 | //$shortcode = $shortcode.$key.'="'.$value.'" '; |
384 | 384 | $atts[$key] = $value; |
385 | 385 | } |
386 | 386 | } |
387 | 387 | if ($code == "aesop_video") { |
388 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
388 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-video.php'); |
|
389 | 389 | echo aesop_video_shortcode($atts); |
390 | 390 | } |
391 | 391 | else if ($code == "aesop_image") { |
392 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
392 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-image.php'); |
|
393 | 393 | echo aesop_image_shortcode($atts); |
394 | 394 | } |
395 | 395 | else if ($code == "aesop_quote") { |
396 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
396 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-quote.php'); |
|
397 | 397 | echo aesop_quote_shortcode($atts); |
398 | 398 | } |
399 | 399 | else if ($code == "aesop_parallax") { |
400 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
400 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-parallax.php'); |
|
401 | 401 | echo aesop_parallax_shortcode($atts); |
402 | 402 | } |
403 | 403 | else if ($code == "aesop_character") { |
404 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
404 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-character.php'); |
|
405 | 405 | echo aesop_character_shortcode($atts); |
406 | 406 | } |
407 | 407 | else if ($code == "aesop_collection") { |
408 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
408 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-collections.php'); |
|
409 | 409 | echo aesop_collection_shortcode($atts); |
410 | 410 | } |
411 | 411 | else if ($code == "aesop_chapter") { |
412 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
412 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-heading.php'); |
|
413 | 413 | echo aesop_chapter_shortcode($atts); |
414 | 414 | } |
415 | 415 | else if ($code == "aesop_content") { |
416 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
416 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-cbox.php'); |
|
417 | 417 | echo aesop_content_shortcode($atts, $atts['content_data']); |
418 | 418 | } |
419 | 419 | else if ($code == "aesop_gallery") { |
420 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
421 | - echo do_shortcode( '[aesop_gallery id="'.$atts["id"].'"]'); |
|
420 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-gallery.php'); |
|
421 | + echo do_shortcode('[aesop_gallery id="'.$atts["id"].'"]'); |
|
422 | 422 | } |
423 | 423 | else if ($code == "aesop_audio") { |
424 | - require_once( ABSPATH . '/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
424 | + require_once(ABSPATH.'/wp-content/plugins/aesop-story-engine/public/includes/components/component-audio.php'); |
|
425 | 425 | echo aesop_audio_shortcode($atts); |
426 | 426 | } |
427 | 427 | else { |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | |
438 | 438 | exit; |
439 | 439 | } |
440 | - public function set_post_terms( $postid, $value, $taxonomy ) { |
|
441 | - if( $value ) { |
|
442 | - $value = explode( ',', $value ); |
|
443 | - $allow_new_category = lasso_editor_get_option( 'allow_new_category', 'lasso_editor' ); |
|
440 | + public function set_post_terms($postid, $value, $taxonomy) { |
|
441 | + if ($value) { |
|
442 | + $value = explode(',', $value); |
|
443 | + $allow_new_category = lasso_editor_get_option('allow_new_category', 'lasso_editor'); |
|
444 | 444 | |
445 | - if ($taxonomy =='category') { |
|
445 | + if ($taxonomy == 'category') { |
|
446 | 446 | // convert from names to category ids |
447 | 447 | $cats = array(); |
448 | 448 | foreach ($value as $cat) { |
449 | 449 | $cat_id = get_cat_ID($cat); |
450 | - if ($cat_id !=0) { |
|
450 | + if ($cat_id != 0) { |
|
451 | 451 | $cats [] = $cat_id; |
452 | 452 | } else if ($allow_new_category) { |
453 | 453 | $cats [] = wp_create_category($cat); |
@@ -456,27 +456,27 @@ discard block |
||
456 | 456 | $value = $cats; |
457 | 457 | } |
458 | 458 | |
459 | - $result = wp_set_object_terms( $postid, $value, $taxonomy ); |
|
459 | + $result = wp_set_object_terms($postid, $value, $taxonomy); |
|
460 | 460 | } |
461 | - else { |
|
461 | + else { |
|
462 | 462 | //remove all terms from post |
463 | - $result = wp_set_object_terms( $postid, null, $taxonomy ); |
|
463 | + $result = wp_set_object_terms($postid, null, $taxonomy); |
|
464 | 464 | } |
465 | 465 | |
466 | - if ( ! is_wp_error( $result ) ) { |
|
466 | + if (!is_wp_error($result)) { |
|
467 | 467 | return true; |
468 | - }else{ |
|
468 | + } else { |
|
469 | 469 | return false; |
470 | 470 | } |
471 | 471 | } |
472 | 472 | |
473 | - public function set_date( $postid, $value) { |
|
474 | - if( $value ) { |
|
473 | + public function set_date($postid, $value) { |
|
474 | + if ($value) { |
|
475 | 475 | wp_update_post( |
476 | - array ( |
|
476 | + array( |
|
477 | 477 | 'ID' => $postid, // ID of the post to update |
478 | - 'post_date' => date( 'Y-m-d H:i:s', strtotime($value) ), |
|
479 | - 'post_date_gmt' => gmdate( 'Y-m-d H:i:s', strtotime($value) ), |
|
478 | + 'post_date' => date('Y-m-d H:i:s', strtotime($value)), |
|
479 | + 'post_date_gmt' => gmdate('Y-m-d H:i:s', strtotime($value)), |
|
480 | 480 | ) |
481 | 481 | ); |
482 | 482 | } |
@@ -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,36 +60,36 @@ 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 ) { |
|
86 | + } elseif ('content' == $type) { |
|
87 | 87 | |
88 | 88 | |
89 | - foreach ( $tabs as $tab ) { |
|
89 | + foreach ($tabs as $tab) { |
|
90 | 90 | |
91 | - if ( isset( $tab ) ) { |
|
92 | - $out .= lasso_modal_addons_content( $tab , $type ); |
|
91 | + if (isset($tab)) { |
|
92 | + $out .= lasso_modal_addons_content($tab, $type); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | endif; |
99 | 99 | |
100 | - return !empty( $out ) ? $out : false; |
|
100 | + return !empty($out) ? $out : false; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,26 +117,26 @@ discard block |
||
117 | 117 | * @since 0.9.5 |
118 | 118 | * @subpackage lasso_modal_addons_content |
119 | 119 | */ |
120 | -function lasso_option_form( $name = '', $options = array() ){ |
|
120 | +function lasso_option_form($name = '', $options = array()) { |
|
121 | 121 | |
122 | 122 | ob_start(); |
123 | 123 | |
124 | - if ( empty( $name ) || empty( $options ) || !is_array( $options ) ) |
|
124 | + if (empty($name) || empty($options) || !is_array($options)) |
|
125 | 125 | return; |
126 | 126 | |
127 | 127 | $nonce = wp_create_nonce('lasso-process-post-meta'); |
128 | - $key = sprintf('_lasso_%s_settings', $name ); |
|
128 | + $key = sprintf('_lasso_%s_settings', $name); |
|
129 | 129 | |
130 | - $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">' ); |
|
130 | + $out = sprintf('<form id="lasso--post-form" class="lasso--post-form">'); |
|
131 | 131 | |
132 | - $out .= lasso_option_fields( $name, $options ); |
|
133 | - $out .='<div class="form--bottom">'; |
|
134 | - $out .='<input type="submit" value="'._e( 'Save', 'lasso' ).'">'; |
|
135 | - $out .='<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
136 | - $out .='<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
137 | - $out .='<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
138 | - $out .='<input type="hidden" name="action" value="process_meta_update">'; |
|
139 | - $out .='</div>'; |
|
132 | + $out .= lasso_option_fields($name, $options); |
|
133 | + $out .= '<div class="form--bottom">'; |
|
134 | + $out .= '<input type="submit" value="'._e('Save', 'lasso').'">'; |
|
135 | + $out .= '<input type="hidden" name="tab_name" value="'.$key.'">'; |
|
136 | + $out .= '<input type="hidden" name="post_id" value="'.get_the_ID().'">'; |
|
137 | + $out .= '<input type="hidden" name="nonce" value="'.$nonce.'">'; |
|
138 | + $out .= '<input type="hidden" name="action" value="process_meta_update">'; |
|
139 | + $out .= '</div>'; |
|
140 | 140 | |
141 | 141 | $out .= '</form>'; |
142 | 142 | |
@@ -154,28 +154,28 @@ discard block |
||
154 | 154 | * @since 0.9.5 |
155 | 155 | * @subpackage lasso_modal_addons_content |
156 | 156 | */ |
157 | -function lasso_option_fields( $name = '', $options = array() ){ |
|
157 | +function lasso_option_fields($name = '', $options = array()) { |
|
158 | 158 | |
159 | - $out = ''; |
|
159 | + $out = ''; |
|
160 | 160 | $before = '<div class="lasso--postsettings__option">'; |
161 | 161 | $after = '</div>'; |
162 | 162 | |
163 | - if ( empty( $name ) || empty( $options ) ) |
|
163 | + if (empty($name) || empty($options)) |
|
164 | 164 | return; |
165 | 165 | |
166 | - foreach ( (array) $options as $option ) { |
|
166 | + foreach ((array) $options as $option) { |
|
167 | 167 | |
168 | - $type = isset( $option['type'] ) ? $option['type'] : 'text'; |
|
168 | + $type = isset($option['type']) ? $option['type'] : 'text'; |
|
169 | 169 | |
170 | - switch ( $type ) { |
|
170 | + switch ($type) { |
|
171 | 171 | case 'text': |
172 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'text' ), $after ); |
|
172 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'text'), $after); |
|
173 | 173 | break; |
174 | 174 | case 'textarea': |
175 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'textarea' ), $after ); |
|
175 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'textarea'), $after); |
|
176 | 176 | break; |
177 | 177 | case 'checkbox': |
178 | - $out .= sprintf('%s%s%s', $before, lasso_option_engine_option( $name, $option,'checkbox' ), $after ); |
|
178 | + $out .= sprintf('%s%s%s', $before, lasso_option_engine_option($name, $option, 'checkbox'), $after); |
|
179 | 179 | break; |
180 | 180 | } |
181 | 181 | |
@@ -193,27 +193,27 @@ discard block |
||
193 | 193 | * @param $type string text, textarea, checkbox, color |
194 | 194 | * @since 5.0 |
195 | 195 | */ |
196 | -function lasso_option_engine_option( $name = '', $option = '', $type = '') { |
|
196 | +function lasso_option_engine_option($name = '', $option = '', $type = '') { |
|
197 | 197 | |
198 | - if ( empty( $type ) || empty( $option ) ) |
|
198 | + if (empty($type) || empty($option)) |
|
199 | 199 | return; |
200 | 200 | |
201 | - $id = isset( $option['id'] ) ? $option['id'] : false; |
|
202 | - $id = $id ? lasso_clean_string( $id ) : false; |
|
201 | + $id = isset($option['id']) ? $option['id'] : false; |
|
202 | + $id = $id ? lasso_clean_string($id) : false; |
|
203 | 203 | |
204 | - $desc = isset( $option['desc'] ) ? $option['desc'] : false; |
|
204 | + $desc = isset($option['desc']) ? $option['desc'] : false; |
|
205 | 205 | |
206 | - $value = get_post_meta( get_the_id(), $option[ 'id' ], true ); |
|
206 | + $value = get_post_meta(get_the_id(), $option['id'], true); |
|
207 | 207 | |
208 | - switch ( $type ) { |
|
208 | + switch ($type) { |
|
209 | 209 | case 'text': |
210 | - $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">',$id, esc_html( $desc ), $id, $id, $value ); |
|
210 | + $out = sprintf('<label for="lasso--post-option-%s">%s</label><input id="lasso--post-option-%s" name="%s" type="text" value="%s">', $id, esc_html($desc), $id, $id, $value); |
|
211 | 211 | break; |
212 | 212 | case 'textarea': |
213 | - $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 ); |
|
213 | + $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); |
|
214 | 214 | break; |
215 | 215 | case 'checkbox': |
216 | - $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 ) ); |
|
216 | + $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)); |
|
217 | 217 | break; |
218 | 218 | } |
219 | 219 |
@@ -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 |