| @@ -13,18 +13,18 @@ | ||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | if ( ! class_exists( 'WINP_Plugin' ) ) { |
| 16 | 16 | |
| 17 | - class WINP_Plugin extends Wbcr_Factory450_Plugin { | |
| 17 | + class WINP_Plugin extends Wbcr_Factory419_Plugin { | |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var Wbcr_Factory450_Plugin | |
| 20 | + * @var Wbcr_Factory419_Plugin | |
| 21 | 21 | */ |
| 22 | 22 | private static $app; |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @param string $plugin_path |
| 26 | - * @param array $data | |
| 26 | + * @param array $data | |
| 27 | 27 | * |
| 28 | 28 | * @throws Exception |
| 29 | 29 | */ |
| 30 | 30 | public function __construct( $plugin_path, $data ) { |
| @@ -94,11 +94,11 @@ | ||
| 94 | 94 | return new WINP_Common_Snippet(); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 99 | + * @since 2.2.0 | |
| 98 | 100 | * @throws \Exception |
| 99 | - * @since 2.2.0 | |
| 100 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 101 | 101 | */ |
| 102 | 102 | /*public function plugins_loaded() { |
| 103 | 103 | $this->register_pages(); |
| 104 | 104 | }*/ |
| @@ -108,11 +108,11 @@ | ||
| 108 | 108 | $this->registerActivation( 'WINP_Activation' ); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 113 | + * @since 2.2.0 | |
| 112 | 114 | * @throws \Exception |
| 113 | - * @since 2.2.0 | |
| 114 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 115 | 115 | */ |
| 116 | 116 | public function register_pages() { |
| 117 | 117 | require_once( WINP_PLUGIN_DIR . '/admin/pages/page.php' ); |
| 118 | 118 | |
| @@ -123,11 +123,11 @@ | ||
| 123 | 123 | $this->registerPage( 'WINP_AboutPage', WINP_PLUGIN_DIR . '/admin/pages/about.php' ); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 128 | + * @since 2.2.0 | |
| 127 | 129 | * @throws \Exception |
| 128 | - * @since 2.2.0 | |
| 129 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 130 | 130 | */ |
| 131 | 131 | public function register_depence_pages() { |
| 132 | 132 | require_once( WINP_PLUGIN_DIR . '/admin/pages/page.php' ); |
| 133 | 133 | |
| @@ -136,11 +136,11 @@ | ||
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 141 | + * @since 2.2.0 | |
| 140 | 142 | * @throws \Exception |
| 141 | - * @since 2.2.0 | |
| 142 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 143 | 143 | */ |
| 144 | 144 | private function register_types() { |
| 145 | 145 | require_once( WINP_PLUGIN_DIR . '/admin/types/snippets-post-types.php' ); |
| 146 | 146 | Wbcr_FactoryTypes410::register( 'WINP_SnippetsType', $this ); |
| @@ -153,10 +153,13 @@ | ||
| 153 | 153 | * @author Alexander Kovalev <alex.kovalevv@gmail.com> |
| 154 | 154 | * @since 2.2.0 |
| 155 | 155 | */ |
| 156 | 156 | private function register_shortcodes() { |
| 157 | + $is_cron = WINP_Helper::doing_cron(); | |
| 158 | + $is_rest = WINP_Helper::doing_rest_api(); | |
| 159 | + | |
| 157 | 160 | $action = WINP_Plugin::app()->request->get( 'action', '' ); |
| 158 | - if ( ! ( 'edit' == $action && is_admin() ) ) { | |
| 161 | + if ( ! ( 'edit' == $action && is_admin() ) && ! $is_cron && ! $is_rest ) { | |
| 159 | 162 | if ( WINP_Plugin::app()->getOption( 'support_old_shortcodes' ) ) { |
| 160 | 163 | // todo: Deprecated |
| 161 | 164 | require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-insert-php.php' ); |
| 162 | 165 | } |
| @@ -167,9 +170,8 @@ | ||
| 167 | 170 | require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-universal.php' ); |
| 168 | 171 | require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-css.php' ); |
| 169 | 172 | require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-js.php' ); |
| 170 | 173 | require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-html.php' ); |
| 171 | - require_once( WINP_PLUGIN_DIR . '/includes/shortcodes/shortcode-ad.php' ); | |
| 172 | 174 | |
| 173 | 175 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodePhp', $this ); |
| 174 | 176 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeText', $this ); |
| 175 | 177 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeUniversal', $this ); |
| @@ -175,9 +177,8 @@ | ||
| 175 | 177 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeUniversal', $this ); |
| 176 | 178 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeCss', $this ); |
| 177 | 179 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeJs', $this ); |
| 178 | 180 | WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeHtml', $this ); |
| 179 | - WINP_Helper::register_shortcode( 'WINP_SnippetShortcodeAdvert', $this ); | |
| 180 | 181 | } |
| 181 | 182 | } |
| 182 | 183 | |
| 183 | 184 | /** |
| @@ -213,11 +214,11 @@ | ||
| 213 | 214 | |
| 214 | 215 | /** |
| 215 | 216 | * Initialization and require files for backend. |
| 216 | 217 | * |
| 218 | + * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 219 | + * @since 2.2.0 | |
| 217 | 220 | * @throws \Exception |
| 218 | - * @since 2.2.0 | |
| 219 | - * @author Alexander Kovalev <alex.kovalevv@gmail.com> | |
| 220 | 221 | */ |
| 221 | 222 | private function load_backend() { |
| 222 | 223 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.snippets.viewtable.php' ); |
| 223 | 224 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.filter.snippet.php' ); |
| @@ -224,8 +225,9 @@ | ||
| 224 | 225 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.actions.snippet.php' ); |
| 225 | 226 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.import.snippet.php' ); |
| 226 | 227 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.notices.php' ); |
| 227 | 228 | require_once( WINP_PLUGIN_DIR . '/admin/includes/class.request.php' ); |
| 229 | + require_once( WINP_PLUGIN_DIR . '/admin/includes/class.dashboard.widget.php' ); | |
| 228 | 230 | require_once( WINP_PLUGIN_DIR . '/admin/metaboxes/metabox.php' ); |
| 229 | 231 | require_once( WINP_PLUGIN_DIR . '/admin/boot.php' ); |
| 230 | 232 | |
| 231 | 233 | $this->get_common_object()->registerHooks(); |
| @@ -235,8 +237,9 @@ | ||
| 235 | 237 | new WINP_Filter_List(); |
| 236 | 238 | new WINP_Export_Snippet(); |
| 237 | 239 | new WINP_Import_Snippet(); |
| 238 | 240 | new WINP_WarningNotices(); |
| 241 | + new WINP_Dashboard_Widget(); | |
| 239 | 242 | |
| 240 | 243 | # Required for i18n to be loaded properly |
| 241 | 244 | add_action( 'plugins_loaded', [ $this, 'register_pages' ] ); |
| 242 | 245 | |
| @@ -242,33 +245,7 @@ | ||
| 242 | 245 | |
| 243 | 246 | # Required for compatibility with the premium plugin. |
| 244 | 247 | # We set the priority to 30 to wait for the premium plugin to load. |
| 245 | 248 | add_action( 'plugins_loaded', [ $this, 'register_depence_pages' ], 30 ); |
| 246 | - | |
| 247 | - add_action( 'wbcr_factory_forms_447_register_controls', function () { | |
| 248 | - $colorControls = array( | |
| 249 | - [ | |
| 250 | - 'type' => 'winp-dropdown', | |
| 251 | - 'class' => 'WINP_FactoryForms_Dropdown', | |
| 252 | - 'include' => WINP_PLUGIN_DIR . '/includes/controls/class.dropdown.php' | |
| 253 | - ], | |
| 254 | - ); | |
| 255 | - $this->forms->registerControls( $colorControls ); | |
| 256 | - } ); | |
| 257 | 249 | } |
| 258 | - | |
| 259 | - /** | |
| 260 | - * Метод проверяет активацию премиум плагина и наличие действующего лицензионного ключа | |
| 261 | - * | |
| 262 | - * @return bool | |
| 263 | - */ | |
| 264 | - public function is_premium() { | |
| 265 | - if ( $this->premium->is_active() && $this->premium->is_activate() //&& $this->premium->is_install_package() | |
| 266 | - ) { | |
| 267 | - return true; | |
| 268 | - } else { | |
| 269 | - return false; | |
| 270 | - } | |
| 271 | - } | |
| 272 | - | |
| 273 | 250 | } |
| 274 | 251 | } |