@@ -163,6 +163,9 @@ |
||
| 163 | 163 | return $content; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | + /** |
|
| 167 | + * @param string $content |
|
| 168 | + */ |
|
| 166 | 169 | protected function remove_comments($content) { |
| 167 | 170 | return preg_replace('/<!--(.*)-->/Uis', '', $content); |
| 168 | 171 | } |
@@ -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', |
@@ -18,27 +18,27 @@ |
||
| 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.9.13.1' ); |
|
| 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.9.13.1'); |
|
| 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 | |