| @@ -66,18 +66,33 @@ | ||
| 66 | 66 | $this->define_public_hooks(); |
| 67 | 67 | $this->set_locale(); |
| 68 | 68 | } |
| 69 | 69 | /** |
| 70 | + * Define constant if not already set | |
| 71 | + * | |
| 72 | + * @since 2.2.0 | |
| 73 | + * | |
| 74 | + * @param string $name Define constant. | |
| 75 | + * @param string|bool $value Define constant. | |
| 76 | + */ | |
| 77 | + public function define( $name, $value ) { | |
| 78 | + if ( ! defined( $name ) ) { | |
| 79 | + define( $name, $value ); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 70 | 84 | * Define constants |
| 71 | 85 | * |
| 72 | 86 | * @since 2.2.0 |
| 73 | 87 | */ |
| 74 | 88 | public function define_constants() { |
| 75 | - define( 'SP_PC_VERSION', $this->version ); | |
| 76 | - define( 'SP_PC_PLUGIN_NAME', $this->plugin_name ); | |
| 77 | - define( 'SP_PC_PATH', plugin_dir_path( dirname( __FILE__ ) ) ); | |
| 78 | - define( 'SP_PC_TEMPLATE_PATH', plugin_dir_path( dirname( __FILE__ ) ) . 'public/template/' ); | |
| 79 | - define( 'SP_PC_URL', plugin_dir_url( dirname( __FILE__ ) ) ); | |
| 89 | + $this->define( 'SP_PC_VERSION', $this->version ); | |
| 90 | + $this->define( 'SP_PC_PLUGIN_NAME', $this->plugin_name ); | |
| 91 | + $this->define( 'SP_PC_PATH', plugin_dir_path( dirname( __FILE__ ) ) ); | |
| 92 | + $this->define( 'SP_PC_TEMPLATE_PATH', plugin_dir_path( dirname( __FILE__ ) ) . 'public/template/' ); | |
| 93 | + $this->define( 'SP_PC_URL', plugin_dir_url( dirname( __FILE__ ) ) ); | |
| 94 | + $this->define( 'SMART_POST_SHOW_BASENAME', SMART_POST_SHOW_BASENAME ); | |
| 80 | 95 | } |
| 81 | 96 | |
| 82 | 97 | /** |
| 83 | 98 | * Load the required dependencies for this plugin. |
| @@ -122,13 +137,8 @@ | ||
| 122 | 137 | */ |
| 123 | 138 | require_once SP_PC_PATH . 'includes/class-smart-post-show-updates.php'; |
| 124 | 139 | |
| 125 | 140 | /** |
| 126 | - * The class responsible for Export Import functionality of the plugin. | |
| 127 | - */ | |
| 128 | - require_once SP_PC_PATH . 'includes/class-smart-post-show-import-export.php'; | |
| 129 | - | |
| 130 | - /** | |
| 131 | 141 | * The class responsible for defining all actions that occur in the admin area. |
| 132 | 142 | */ |
| 133 | 143 | require_once SP_PC_PATH . 'admin/class-smart-post-show-admin.php'; |
| 134 | 144 | |
| @@ -135,15 +145,14 @@ | ||
| 135 | 145 | /** |
| 136 | 146 | * The class responsible for defining metabox setup that occur in the admin area. |
| 137 | 147 | */ |
| 138 | 148 | require_once SP_PC_PATH . '/admin/views/sp-framework/classes/setup.class.php'; |
| 139 | - require_once SP_PC_PATH . '/public/helpers/sp-pc-output.php'; | |
| 149 | + | |
| 140 | 150 | /** |
| 141 | 151 | * The class responsible for defining all actions that occur in the public-facing |
| 142 | 152 | * side of the site. |
| 143 | 153 | */ |
| 144 | 154 | require_once SP_PC_PATH . 'public/class-smart-post-show-public.php'; |
| 145 | - require_once SP_PC_PATH . 'admin/preview/class-spsp-preview.php'; | |
| 146 | 155 | |
| 147 | 156 | /** |
| 148 | 157 | * The class responsible for review notice. |
| 149 | 158 | */ |
| @@ -148,23 +157,8 @@ | ||
| 148 | 157 | * The class responsible for review notice. |
| 149 | 158 | */ |
| 150 | 159 | require_once SP_PC_PATH . 'admin/views/notices/review.php'; |
| 151 | 160 | |
| 152 | - // Elementor shortcode addons. | |
| 153 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 154 | - if ( ( is_plugin_active( 'elementor/elementor.php' ) || is_plugin_active_for_network( 'elementor/elementor.php' ) ) ) { | |
| 155 | - require_once SP_PC_PATH . 'admin/class-smart-post-show-element-shortcode-addons.php'; | |
| 156 | - require_once SP_PC_PATH . 'admin/class-smart-post-show-element-shortcode-addons-deprecated.php'; | |
| 157 | - } | |
| 158 | - | |
| 159 | - /** | |
| 160 | - * Gutenberg block. | |
| 161 | - */ | |
| 162 | - if ( version_compare( $GLOBALS['wp_version'], '5.3', '>=' ) ) { | |
| 163 | - require_once SP_PC_PATH . 'admin/class-smart-post-show-gutenberg-block.php'; | |
| 164 | - new Smart_Post_Show_Gutenberg_Block(); | |
| 165 | - } | |
| 166 | - | |
| 167 | 161 | } |
| 168 | 162 | |
| 169 | 163 | /** |
| 170 | 164 | * Define the locale for this plugin for internationalization. |
| @@ -214,18 +208,13 @@ | ||
| 214 | 208 | // Post save and update messages. |
| 215 | 209 | $this->loader->add_filter( 'post_updated_messages', $plugin_admin, 'sppcp_update', 10, 1 ); |
| 216 | 210 | // Help Page. |
| 217 | 211 | $help_menu = new SPS_Help(); |
| 218 | - $this->loader->add_action( 'admin_menu', $help_menu, 'help_page_menu', 20 ); | |
| 212 | + $this->loader->add_action( 'admin_menu', $help_menu, 'help_page_menu', 25 ); | |
| 219 | 213 | // Premium Page. |
| 220 | 214 | $premium_menu = new SPS_Premium(); |
| 221 | - $this->loader->add_action( 'admin_menu', $premium_menu, 'premium_page_menu', 25 ); | |
| 215 | + $this->loader->add_action( 'admin_menu', $premium_menu, 'premium_page_menu', 20 ); | |
| 222 | 216 | |
| 223 | - $import_export = new Smart_Post_Show_Import_Export( SP_PC_PLUGIN_NAME, SP_PC_VERSION ); | |
| 224 | - | |
| 225 | - $this->loader->add_action( 'wp_ajax_pcp_export_shortcodes', $import_export, 'export_shortcodes' ); | |
| 226 | - $this->loader->add_action( 'wp_ajax_pcp_import_shortcodes', $import_export, 'import_shortcodes' ); | |
| 227 | - | |
| 228 | 217 | // after activated plugin redirect to help page. |
| 229 | 218 | $this->loader->add_action( 'activated_plugin', $plugin_admin, 'redirect_help_page' ); |
| 230 | 219 | } |
| 231 | 220 | |
| @@ -238,9 +227,9 @@ | ||
| 238 | 227 | */ |
| 239 | 228 | private function define_public_hooks() { |
| 240 | 229 | $plugin_public = new Smart_Post_Show_Public( SP_PC_PLUGIN_NAME, SP_PC_VERSION ); |
| 241 | 230 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
| 242 | - $this->loader->add_action( 'wp_loaded', $plugin_public, 'register_all_scripts' ); | |
| 231 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); | |
| 243 | 232 | } |
| 244 | 233 | |
| 245 | 234 | /** |
| 246 | 235 | * Run the loader to execute all of the hooks with WordPress. |