@@ -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', '0.10.0.3' ); |
|
27 | -define( 'LASSO_DIR', plugin_dir_path( __FILE__ ) ); |
|
28 | -define( 'LASSO_URL', plugins_url( '', __FILE__ ) ); |
|
29 | -define( 'LASSO_FILE', __FILE__ ); |
|
26 | +define('LASSO_VERSION', '0.10.0.3'); |
|
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>Lasso 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 |
@@ -10,21 +10,21 @@ discard block |
||
10 | 10 | |
11 | 11 | class assets { |
12 | 12 | |
13 | - public function __construct(){ |
|
13 | + public function __construct() { |
|
14 | 14 | |
15 | - add_action('wp_enqueue_scripts', array($this,'scripts')); |
|
15 | + add_action('wp_enqueue_scripts', array($this, 'scripts')); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function scripts(){ |
|
18 | + public function scripts() { |
|
19 | 19 | |
20 | 20 | |
21 | - if ( lasso_user_can('edit_posts')) { |
|
21 | + if (lasso_user_can('edit_posts')) { |
|
22 | 22 | |
23 | 23 | wp_enqueue_style('lasso-style', LASSO_URL.'/public/assets/css/lasso.css', LASSO_VERSION, true); |
24 | 24 | |
25 | 25 | //don't load autocomplete if it's a stockholm theme |
26 | - $themename = wp_get_theme()->get('Name'); |
|
27 | - if ($themename !='Stockholm' ) { |
|
26 | + $themename = wp_get_theme()->get('Name'); |
|
27 | + if ($themename != 'Stockholm') { |
|
28 | 28 | wp_enqueue_script('jquery-ui-autocomplete'); |
29 | 29 | } |
30 | 30 | wp_enqueue_script('jquery-ui-draggable'); |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | // url for json api |
38 | 38 | $home_url = function_exists('json_get_url_prefix') ? json_get_url_prefix() : false; |
39 | 39 | |
40 | - $article_object = lasso_editor_get_option('article_class','lasso_editor'); |
|
40 | + $article_object = lasso_editor_get_option('article_class', 'lasso_editor'); |
|
41 | 41 | |
42 | - $article_object = empty( $article_object ) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
42 | + $article_object = empty($article_object) && lasso_get_supported_theme_class() ? lasso_get_supported_theme_class() : $article_object; |
|
43 | 43 | |
44 | - $featImgClass = lasso_editor_get_option('featimg_class','lasso_editor'); |
|
45 | - if (empty( $featImgClass )) { |
|
44 | + $featImgClass = lasso_editor_get_option('featimg_class', 'lasso_editor'); |
|
45 | + if (empty($featImgClass)) { |
|
46 | 46 | $featImgClass = lasso_get_supported_theme_featured_image_class(); |
47 | 47 | } |
48 | - $titleClass = lasso_editor_get_option('title_class','lasso_editor'); |
|
49 | - if (empty( $titleClass )) { |
|
48 | + $titleClass = lasso_editor_get_option('title_class', 'lasso_editor'); |
|
49 | + if (empty($titleClass)) { |
|
50 | 50 | $titleClass = lasso_get_supported_theme_title_class(); |
51 | 51 | } |
52 | - $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
53 | - $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
52 | + $toolbar_headings = lasso_editor_get_option('toolbar_headings', 'lasso_editor'); |
|
53 | + $toolbar_headings_h4 = lasso_editor_get_option('toolbar_headings_h4', 'lasso_editor'); |
|
54 | 54 | $objectsNoSave = lasso_editor_get_option('dont_save', 'lasso_editor'); |
55 | - $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
55 | + $objectsNonEditable = lasso_editor_get_option('non_editable', 'lasso_editor'); |
|
56 | 56 | $disableRESTSave = lasso_editor_get_option('save_using_rest_disabled', 'lasso_editor'); |
57 | - $save_to_post_disabled = lasso_editor_get_option( 'post_save_disabled', 'lasso_editor' ); |
|
57 | + $save_to_post_disabled = lasso_editor_get_option('post_save_disabled', 'lasso_editor'); |
|
58 | 58 | |
59 | - $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor','b'); |
|
60 | - $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor','i'); |
|
59 | + $bold_tag = lasso_editor_get_option('bold_tag', 'lasso_editor', 'b'); |
|
60 | + $i_tag = lasso_editor_get_option('i_tag', 'lasso_editor', 'i'); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | //text alignement |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | |
72 | 72 | if ($show_color) { |
73 | 73 | //color picker |
74 | - wp_enqueue_style( 'wp-color-picker' ); |
|
75 | - wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), false, 1 ); |
|
74 | + wp_enqueue_style('wp-color-picker'); |
|
75 | + wp_enqueue_script('iris', admin_url('js/iris.min.js'), array('jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch'), false, 1); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | // click to insert components, not drag and drop |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | // custom fields |
83 | 83 | |
84 | - $custom_fields = apply_filters( 'editus_custom_fields', null ); //array('testFieldName' => '#field1'); |
|
84 | + $custom_fields = apply_filters('editus_custom_fields', null); //array('testFieldName' => '#field1'); |
|
85 | 85 | |
86 | 86 | |
87 | 87 | |
@@ -92,52 +92,52 @@ discard block |
||
92 | 92 | $delta = time() - $post_date; |
93 | 93 | |
94 | 94 | $strings = array( |
95 | - 'save' => __('Save','lasso'), |
|
96 | - 'cancel' => __('Cancel','lasso'), |
|
97 | - 'exiteditor' => __('Exit Editor','lasso'), |
|
98 | - 'saving' => __('Saving...','lasso'), |
|
99 | - 'saved' => __('Saved!','lasso'), |
|
100 | - 'adding' => __('Adding...','lasso'), |
|
101 | - 'added' => __('Added!','lasso'), |
|
102 | - 'loading' => __('Loading...','lasso'), |
|
103 | - 'loadMore' => __('Load More','lasso'), |
|
104 | - 'close' => __('Close','lasso'), |
|
105 | - 'noPostsFound' => __('No more posts found','lasso'), |
|
106 | - 'fetchFail' => __('Fetching failed.','lasso'), |
|
107 | - 'galleryCreated' => __('Gallery Created!','lasso'), |
|
108 | - 'galleryUpdated' => __('Gallery Updated!','lasso'), |
|
109 | - 'justWrite' => __('Just write...','lasso'), |
|
110 | - 'chooseImage' => __('Choose an image','lasso'), |
|
111 | - 'updateImage' => __('Update Image','lasso'), |
|
112 | - 'insertImage' => __('Insert Image','lasso'), |
|
113 | - 'selectImage' => __('Select Image','lasso'), |
|
114 | - 'removeFeatImg' => __('Remove featured image?','lasso'), |
|
115 | - 'updateSelectedImg' => __('Update Selected Image','lasso'), |
|
116 | - 'chooseImages' => __('Choose images','lasso'), |
|
117 | - 'editImage' => __('Edit Image','lasso'), |
|
118 | - 'addImages' => __('Add Images','lasso'), |
|
119 | - 'addNewGallery' => __('Add New Gallery','lasso'), |
|
120 | - 'selectGallery' => __('Select Lasso Gallery Image','lasso'), |
|
121 | - 'useSelectedImages' => __('Use Selected Images','lasso'), |
|
122 | - 'publishPost' => __('Publish Post?','lasso'), |
|
123 | - 'publishYes' => __('Yes, publish it!','lasso'), |
|
124 | - 'deletePost' => __('Trash Post?','lasso'), |
|
125 | - 'deleteYes' => __('Yes, trash it!','lasso'), |
|
126 | - 'warning' => __('Oh snap!','laso'), |
|
127 | - 'cancelText' => __('O.K. got it!','lasso'), |
|
128 | - 'missingClass' => __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.','lasso'), |
|
95 | + 'save' => __('Save', 'lasso'), |
|
96 | + 'cancel' => __('Cancel', 'lasso'), |
|
97 | + 'exiteditor' => __('Exit Editor', 'lasso'), |
|
98 | + 'saving' => __('Saving...', 'lasso'), |
|
99 | + 'saved' => __('Saved!', 'lasso'), |
|
100 | + 'adding' => __('Adding...', 'lasso'), |
|
101 | + 'added' => __('Added!', 'lasso'), |
|
102 | + 'loading' => __('Loading...', 'lasso'), |
|
103 | + 'loadMore' => __('Load More', 'lasso'), |
|
104 | + 'close' => __('Close', 'lasso'), |
|
105 | + 'noPostsFound' => __('No more posts found', 'lasso'), |
|
106 | + 'fetchFail' => __('Fetching failed.', 'lasso'), |
|
107 | + 'galleryCreated' => __('Gallery Created!', 'lasso'), |
|
108 | + 'galleryUpdated' => __('Gallery Updated!', 'lasso'), |
|
109 | + 'justWrite' => __('Just write...', 'lasso'), |
|
110 | + 'chooseImage' => __('Choose an image', 'lasso'), |
|
111 | + 'updateImage' => __('Update Image', 'lasso'), |
|
112 | + 'insertImage' => __('Insert Image', 'lasso'), |
|
113 | + 'selectImage' => __('Select Image', 'lasso'), |
|
114 | + 'removeFeatImg' => __('Remove featured image?', 'lasso'), |
|
115 | + 'updateSelectedImg' => __('Update Selected Image', 'lasso'), |
|
116 | + 'chooseImages' => __('Choose images', 'lasso'), |
|
117 | + 'editImage' => __('Edit Image', 'lasso'), |
|
118 | + 'addImages' => __('Add Images', 'lasso'), |
|
119 | + 'addNewGallery' => __('Add New Gallery', 'lasso'), |
|
120 | + 'selectGallery' => __('Select Lasso Gallery Image', 'lasso'), |
|
121 | + 'useSelectedImages' => __('Use Selected Images', 'lasso'), |
|
122 | + 'publishPost' => __('Publish Post?', 'lasso'), |
|
123 | + 'publishYes' => __('Yes, publish it!', 'lasso'), |
|
124 | + 'deletePost' => __('Trash Post?', 'lasso'), |
|
125 | + 'deleteYes' => __('Yes, trash it!', 'lasso'), |
|
126 | + 'warning' => __('Oh snap!', 'laso'), |
|
127 | + 'cancelText' => __('O.K. got it!', 'lasso'), |
|
128 | + 'missingClass' => __('It looks like we are either missing the Article CSS class, or it is configured incorrectly. Editus will not function correctly without this CSS class.', 'lasso'), |
|
129 | 129 | 'missingConfirm' => __('Update Settings', 'lasso'), |
130 | - 'helperText' => __('one more letter','lasso'), |
|
130 | + 'helperText' => __('one more letter', 'lasso'), |
|
131 | 131 | 'editingBackup' => __('You are currently editing a backup copy of this post.'), |
132 | 132 | 'selectText' => __('Please Select Text First.'), |
133 | 133 | |
134 | 134 | ); |
135 | 135 | |
136 | - $api_url = trailingslashit( home_url() ) . 'lasso-internal-api'; |
|
136 | + $api_url = trailingslashit(home_url()).'lasso-internal-api'; |
|
137 | 137 | |
138 | 138 | $gallery_class = new gallery(); |
139 | 139 | $gallery_nonce_action = $gallery_class->nonce_action; |
140 | - $gallery_nonce = wp_create_nonce( $gallery_nonce_action ); |
|
140 | + $gallery_nonce = wp_create_nonce($gallery_nonce_action); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | if ($allow_change_date) { |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | |
153 | 153 | if (function_exists('rest_url')) { |
154 | 154 | //$rest_root = esc_url_raw( rest_url()); |
155 | - $rest_nonce = wp_create_nonce( 'wp_rest' ); |
|
156 | - $settings = array( 'root' => $rest_root, 'nonce' => $rest_nonce ); |
|
157 | - wp_enqueue_script( 'wp-api', '', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
158 | - wp_localize_script( 'wp-api', 'wpApiSettings', $settings ); |
|
159 | - wp_localize_script( 'wp-api', 'WP_API_Settings', $settings ); |
|
155 | + $rest_nonce = wp_create_nonce('wp_rest'); |
|
156 | + $settings = array('root' => $rest_root, 'nonce' => $rest_nonce); |
|
157 | + wp_enqueue_script('wp-api', '', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
158 | + wp_localize_script('wp-api', 'wpApiSettings', $settings); |
|
159 | + wp_localize_script('wp-api', 'WP_API_Settings', $settings); |
|
160 | 160 | |
161 | - if ( class_exists( 'WP_REST_Controller' )) { |
|
161 | + if (class_exists('WP_REST_Controller')) { |
|
162 | 162 | // we are using REST API V2 |
163 | 163 | $using_restapiv2 = true; |
164 | 164 | } |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | // localized objects |
168 | 168 | $objects = array( |
169 | - 'ajaxurl' => esc_url( $api_url ), |
|
170 | - 'ajaxurl2' => esc_url( admin_url( 'admin-ajax.php' )), |
|
169 | + 'ajaxurl' => esc_url($api_url), |
|
170 | + 'ajaxurl2' => esc_url(admin_url('admin-ajax.php')), |
|
171 | 171 | 'rest_root' => $rest_root, |
172 | 172 | 'rest_nonce' => $rest_nonce, |
173 | 173 | 'editor' => 'lasso--content', // ID of editable content (without #) DONT CHANGE |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | 'featImgClass' => $featImgClass, |
176 | 176 | 'titleClass' => $titleClass, |
177 | 177 | 'strings' => $strings, |
178 | - 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url( 'settings.php?page=lasso-editor' ) : admin_url( 'admin.php?page=lasso-editor-settings' ), |
|
179 | - 'post_status' => get_post_status( $postid ), |
|
178 | + 'settingsLink' => function_exists('is_multisite') && is_multisite() ? network_admin_url('settings.php?page=lasso-editor') : admin_url('admin.php?page=lasso-editor-settings'), |
|
179 | + 'post_status' => get_post_status($postid), |
|
180 | 180 | 'postid' => $postid, |
181 | 181 | 'permalink' => $permalink, |
182 | 182 | 'edit_others_pages' => current_user_can('edit_others_pages') ? true : false, |
183 | 183 | 'edit_others_posts' => current_user_can('edit_others_posts') ? true : false, |
184 | - 'userCanEdit' => current_user_can('edit_post', $postid ), |
|
184 | + 'userCanEdit' => current_user_can('edit_post', $postid), |
|
185 | 185 | 'can_publish_posts' => current_user_can('publish_posts'), |
186 | 186 | 'can_publish_pages' => current_user_can('publish_pages'), |
187 | 187 | 'author' => is_user_logged_in() ? get_current_user_ID() : false, |
@@ -216,26 +216,26 @@ discard block |
||
216 | 216 | 'postTags' => lasso_get_objects('tag'), |
217 | 217 | 'noResultsDiv' => lasso_editor_empty_results(), |
218 | 218 | 'noRevisionsDiv' => lasso_editor_empty_results('revision'), |
219 | - 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider( $postid ) : false, |
|
220 | - 'mapLocations' => get_post_meta( $postid, 'ase_map_component_locations' ), |
|
221 | - 'mapStart' => get_post_meta( $postid, 'ase_map_component_start_point', true ), |
|
222 | - 'mapZoom' => get_post_meta( $postid, 'ase_map_component_zoom', true ), |
|
219 | + 'mapTileProvider' => function_exists('aesop_map_tile_provider') ? aesop_map_tile_provider($postid) : false, |
|
220 | + 'mapLocations' => get_post_meta($postid, 'ase_map_component_locations'), |
|
221 | + 'mapStart' => get_post_meta($postid, 'ase_map_component_start_point', true), |
|
222 | + 'mapZoom' => get_post_meta($postid, 'ase_map_component_zoom', true), |
|
223 | 223 | 'revisionModal' => lasso_editor_revision_modal(), |
224 | 224 | 'isMobile' => wp_is_mobile(), |
225 | - 'enableAutoSave' => lasso_editor_get_option( 'enable_autosave', 'lasso_editor' ), |
|
225 | + 'enableAutoSave' => lasso_editor_get_option('enable_autosave', 'lasso_editor'), |
|
226 | 226 | 'showColor' => $show_color, |
227 | 227 | 'showAlignment' => $show_align, |
228 | 228 | 'showIgnoredItems' => lasso_editor_get_option('show_ignored_items', 'lasso_editor'), |
229 | 229 | 'restapi2' => $using_restapiv2, |
230 | 230 | 'saveusingrest' => $using_restapiv2 && !$disableRESTSave, |
231 | - 'newObjectContent' => apply_filters( 'lasso_new_object_content', __( 'Once upon a time...','lasso') ), |
|
231 | + 'newObjectContent' => apply_filters('lasso_new_object_content', __('Once upon a time...', 'lasso')), |
|
232 | 232 | 'disableSavePost' => $save_to_post_disabled, |
233 | 233 | 'boldTag' => $bold_tag, |
234 | 234 | 'iTag' => $i_tag, |
235 | 235 | 'customFields' => $custom_fields, |
236 | - 'clickToInsert' => ($insert_comp_ui !='drag'), |
|
237 | - 'buttonOnEmptyP' => ($insert_comp_ui =='mediumcom'), // auto show a button to insert components on an empty paragraph |
|
238 | - 'skipToEdit' =>( $delta < 10 ) // if it's a new post, skip to edit mode |
|
236 | + 'clickToInsert' => ($insert_comp_ui != 'drag'), |
|
237 | + 'buttonOnEmptyP' => ($insert_comp_ui == 'mediumcom'), // auto show a button to insert components on an empty paragraph |
|
238 | + 'skipToEdit' =>($delta < 10) // if it's a new post, skip to edit mode |
|
239 | 239 | ); |
240 | 240 | |
241 | 241 | |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | |
245 | 245 | if (!$using_restapiv2) { |
246 | 246 | // enqueue REST API V1 |
247 | - wp_enqueue_script( 'wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array( 'jquery', 'underscore', 'backbone' ), LASSO_VERSION, true ); |
|
248 | - $settings = array( 'root' => home_url( $home_url ), 'nonce' => wp_create_nonce( 'wp_json' ) ); |
|
249 | - wp_localize_script( 'wp-api-js', 'WP_API_Settings', $settings ); |
|
247 | + wp_enqueue_script('wp-api-js', LASSO_URL.'/public/assets/js/source/util--wp-api.js', array('jquery', 'underscore', 'backbone'), LASSO_VERSION, true); |
|
248 | + $settings = array('root' => home_url($home_url), 'nonce' => wp_create_nonce('wp_json')); |
|
249 | + wp_localize_script('wp-api-js', 'WP_API_Settings', $settings); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | if ($allow_change_date) { |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | wp_enqueue_style('jquery-ui'); |
256 | 256 | } |
257 | 257 | |
258 | - $postfix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min'; |
|
258 | + $postfix = (defined('SCRIPT_DEBUG') && true === SCRIPT_DEBUG) ? '' : '.min'; |
|
259 | 259 | if ($show_color) { |
260 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api','iris'), LASSO_VERSION, true); |
|
260 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api', 'iris'), LASSO_VERSION, true); |
|
261 | 261 | } else { |
262 | - wp_enqueue_script('lasso', LASSO_URL. "/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
262 | + wp_enqueue_script('lasso', LASSO_URL."/public/assets/js/lasso{$postfix}.js", array('jquery', 'wp-api'), LASSO_VERSION, true); |
|
263 | 263 | } |
264 | - wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects ) ); |
|
264 | + wp_localize_script('lasso', 'lasso_editor', apply_filters('lasso_localized_objects', $objects)); |
|
265 | 265 | |
266 | 266 | |
267 | 267 | } |
@@ -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 |