| @@ -23,10 +23,10 @@ | ||
| 23 | 23 | * Мы решили добавить в это сообщение кнопку для перехода в безопасный режим. |
| 24 | 24 | */ |
| 25 | 25 | add_filter( 'wp_php_error_message', function ( $message ) { |
| 26 | 26 | $safe_mode_url = admin_url( 'edit.php?post_type=' . WINP_SNIPPETS_POST_TYPE . '&wbcr-php-snippets-safe-mode' ); |
| 27 | - $safe_mode_button = '<div style="margin:20px 0;padding:20px; background:#ffe8e8;">' . __( 'If you see this message after saving the snippet to the Woody Code Snippets plugin, please enable safe mode in the Woody plugin. Safe mode will allow you to continue working in the admin panel of your site and change the snippet in which you made a php error.', 'insert_php' ) . '</div>'; | |
| 28 | - $safe_mode_button .= '<a href="' . $safe_mode_url . '" class="button">' . __( 'Enable safe mode in Woody Code Snippets', 'insert_php' ) . '</a>'; | |
| 27 | + $safe_mode_button = '<div style="margin:20px 0;padding:20px; background:#ffe8e8;">' . __( 'If you see this message after saving the snippet to the Woody ad snippets plugin, please enable safe mode in the Woody plugin. Safe mode will allow you to continue working in the admin panel of your site and change the snippet in which you made a php error.', 'insert_php' ) . '</div>'; | |
| 28 | + $safe_mode_button .= '<a href="' . $safe_mode_url . '" class="button">' . __( 'Enable safe mode in Woody ad snippets', 'insert_php' ) . '</a>'; | |
| 29 | 29 | |
| 30 | 30 | return $message . $safe_mode_button; |
| 31 | 31 | } ); |
| 32 | 32 | |
| @@ -40,13 +40,14 @@ | ||
| 40 | 40 | |
| 41 | 41 | $plugin = WINP_Plugin::app(); |
| 42 | 42 | |
| 43 | 43 | // Register metaboxes |
| 44 | - require_once WINP_PLUGIN_DIR . '/admin/metaboxes/base-options.php' ; | |
| 44 | + require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/base-options.php' ); | |
| 45 | 45 | WINP_Helper::register_factory_metaboxes( new WINP_BaseOptionsMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin ); |
| 46 | 46 | |
| 47 | - if ( ( defined( 'FACTORY_ADVERTS_DEBUG' ) && FACTORY_ADVERTS_DEBUG ) || ! WINP_Plugin::app()->premium->is_activate() ) { | |
| 48 | - require_once WINP_PLUGIN_DIR . '/admin/metaboxes/info.php' ; | |
| 47 | + //if ( current_user_can( 'install_plugins' ) && ! is_plugin_active( 'robin-image-optimizer/robin-image-optimizer.php' ) ) { | |
| 48 | + if ( ! WINP_Plugin::app()->premium->is_activate() ) { | |
| 49 | + require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/info.php' ); | |
| 49 | 50 | WINP_Helper::register_factory_metaboxes( new WINP_InfoMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin ); |
| 50 | 51 | } |
| 51 | 52 | |
| 52 | 53 | $snippet_type = WINP_Helper::get_snippet_type(); |
| @@ -51,9 +52,9 @@ | ||
| 51 | 52 | |
| 52 | 53 | $snippet_type = WINP_Helper::get_snippet_type(); |
| 53 | 54 | |
| 54 | 55 | if ( $snippet_type !== WINP_SNIPPET_TYPE_PHP ) { |
| 55 | - require_once WINP_PLUGIN_DIR . '/admin/metaboxes/view-options.php' ; | |
| 56 | + require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/view-options.php' ); | |
| 56 | 57 | WINP_Helper::register_factory_metaboxes( new WINP_ViewOptionsMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin ); |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | do_action( 'wbcr/inp/boot/metaboxes/revisions', '' ); |
| @@ -59,16 +60,15 @@ | ||
| 59 | 60 | do_action( 'wbcr/inp/boot/metaboxes/revisions', '' ); |
| 60 | 61 | |
| 61 | 62 | // If the user has updated the plugin or activated it for the first time, |
| 62 | 63 | // you need to show the page "What's new?" |
| 63 | - /* | |
| 64 | - if ( ! WINP_Plugin::app()->isNetworkAdmin() ) { | |
| 64 | + if ( ! WINP_Plugin::app()->isNetworkAdmin() ) { | |
| 65 | 65 | $about_page_viewed = WINP_Plugin::app()->request->get( 'wbcr_inp_about_page_viewed', null ); |
| 66 | 66 | if ( is_null( $about_page_viewed ) ) { |
| 67 | - if ( WINP_Helper::is_need_show_about_page() && current_user_can( 'manage_options' ) ) { | |
| 67 | + if ( WINP_Helper::is_need_show_about_page() ) { | |
| 68 | 68 | try { |
| 69 | 69 | $redirect_url = ''; |
| 70 | - if ( class_exists( 'Wbcr_FactoryPages456' ) ) { | |
| 70 | + if ( class_exists( 'Wbcr_FactoryPages419' ) ) { | |
| 71 | 71 | $redirect_url = WINP_Plugin::app()->getPluginPageUrl( 'about', [ 'wbcr_inp_about_page_viewed' => 1 ] ); |
| 72 | 72 | } |
| 73 | 73 | if ( $redirect_url ) { |
| 74 | 74 | wp_safe_redirect( $redirect_url ); |
| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | if ( $redirect_url ) { |
| 74 | 74 | wp_safe_redirect( $redirect_url ); |
| 75 | 75 | die(); |
| 76 | 76 | } |
| 77 | - } catch ( Exception $e ) { | |
| 77 | + } catch( Exception $e ) { | |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } else { |
| 81 | 81 | if ( WINP_Helper::is_need_show_about_page() ) { |
| @@ -82,15 +82,14 @@ | ||
| 82 | 82 | delete_option( $plugin->getOptionName( 'what_new_210' ) ); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | - */ | |
| 87 | 86 | } ); |
| 88 | 87 | |
| 89 | 88 | function wbcr_inp_admin_revisions() { |
| 90 | 89 | $plugin = WINP_Plugin::app(); |
| 91 | 90 | |
| 92 | - require_once WINP_PLUGIN_DIR . '/admin/metaboxes/revisions.php' ; | |
| 91 | + require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/revisions.php' ); | |
| 93 | 92 | WINP_Helper::register_factory_metaboxes( new WINP_RevisionsMetaBox( $plugin ), WINP_SNIPPETS_POST_TYPE, $plugin ); |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | 95 | add_action( 'wbcr/inp/boot/metaboxes/revisions', 'wbcr_inp_admin_revisions' ); |
| @@ -126,9 +125,9 @@ | ||
| 126 | 125 | 'post-new.php', |
| 127 | 126 | 'widgets.php' |
| 128 | 127 | ]; |
| 129 | 128 | |
| 130 | - if ( ! in_array( $hook, $pages ) || ! current_user_can( 'edit_posts' ) ) { | |
| 129 | + if ( ! in_array( $hook, $pages ) || ! current_user_can( 'manage_options' ) ) { | |
| 131 | 130 | return; |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | wp_enqueue_script( 'wbcr-inp-tinymce-button-widget', WINP_PLUGIN_URL . '/admin/assets/js/tinymce4.4.js', [ 'jquery' ], WINP_Plugin::app()->getPluginVersion(), true ); |
| @@ -143,15 +142,15 @@ | ||
| 143 | 142 | * @since 1.1.0 |
| 144 | 143 | * @see before_wp_tiny_mce |
| 145 | 144 | */ |
| 146 | 145 | function wbcr_inp_tinymce_data( $hook ) { |
| 147 | - if ( ! current_user_can( 'edit_posts' ) ) { | |
| 146 | + if ( ! current_user_can( 'manage_options' ) ) { | |
| 148 | 147 | return; |
| 149 | 148 | } |
| 150 | 149 | |
| 151 | 150 | // styles for the plugin shorcodes |
| 152 | 151 | $shortcode_icon = WINP_PLUGIN_URL . '/admin/assets/img/shortcode-icon5.png'; |
| 153 | - $shortcode_title = __( 'Woody Code Snippets', 'insert-php' ); | |
| 152 | + $shortcode_title = __( 'Woody ad snippets', 'insert-php' ); | |
| 154 | 153 | |
| 155 | 154 | $result = WINP_Helper::get_shortcode_data( true ); |
| 156 | 155 | $shortcode_snippets_json = json_encode( $result ); |
| 157 | 156 | ?> |
| @@ -161,11 +160,11 @@ | ||
| 161 | 160 | background: url("<?php echo $shortcode_icon ?>") center no-repeat; |
| 162 | 161 | } |
| 163 | 162 | </style> |
| 164 | 163 | <script> |
| 165 | - var wbcr_inp_tinymce_snippets_button_title = '<?php echo $shortcode_title ?>'; | |
| 166 | - var wbcr_inp_post_tinymce_nonce = '<?php echo wp_create_nonce( 'wbcr_inp_tinymce_post_nonce' ) ?>'; | |
| 167 | - var wbcr_inp_shortcode_snippets = <?php echo $shortcode_snippets_json ?>; | |
| 164 | + var wbcr_inp_tinymce_snippets_button_title = '<?php echo $shortcode_title ?>'; | |
| 165 | + var wbcr_inp_post_tinymce_nonce = '<?php echo wp_create_nonce( 'wbcr_inp_tinymce_post_nonce' ) ?>'; | |
| 166 | + var wbcr_inp_shortcode_snippets = <?php echo $shortcode_snippets_json ?>; | |
| 168 | 167 | </script> |
| 169 | 168 | <!-- /end <?php echo WINP_Plugin::app()->getPluginTitle() ?> for tinymce --> |
| 170 | 169 | <?php |
| 171 | 170 | } |
| @@ -176,11 +175,11 @@ | ||
| 176 | 175 | |
| 177 | 176 | /** |
| 178 | 177 | * Deactivate snippet on trashed |
| 179 | 178 | * |
| 179 | + * @since 2.0.6 | |
| 180 | + * | |
| 180 | 181 | * @param $post_id |
| 181 | - * | |
| 182 | - * @since 2.0.6 | |
| 183 | 182 | * |
| 184 | 183 | */ |
| 185 | 184 | function wbcr_inp_trash_post( $post_id ) { |
| 186 | 185 | $post_type = get_post_type( $post_id ); |