PluginProbe
CBX Bookmark & Favorite / 2.0.9
CBX Bookmark & Favorite v2.0.9
2.0.10 2.0.9 trunk 1.7.22 1.7.24 1.7.25 1.7.26 1.7.27 1.7.28 1.7.29 1.7.31 1.8.0 1.8.1 1.8.10 1.8.11 1.8.12 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.8 1.8.9 1.9.0 1.9.1 All 42 releases
cbxwpbookmark / cbxwpbookmark.php

cbxwpbookmark.php in CBX Bookmark & Favorite 2.0.9, at cbxwpbookmark.php

181 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link codeboxr.com
11 * @since 1.0.0
12 * @package Cbxwpbookmark
13 *
14 * @wordpress-plugin
15 * Plugin Name: CBX Bookmark & Favorite
16 * Plugin URI: https://codeboxr.com/product/cbx-wordpress-bookmark
17 * Description: List/category based bookmark for WordPress, create your own private or public list of favorite posts, page, custom object
18 * Version: 2.0.9
19 * Author: Codeboxr Team
20 * Author URI: https://codeboxr.com
21 * License: GPL-2.0+
22 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
23 * Text Domain: cbxwpbookmark
24 * Domain Path: /languages
25 */
26
27 // If this file is called directly, abort.
28 if ( ! defined( 'WPINC' ) ) {
29 die;
30 }
31
32
33 defined( 'CBXWPBOOKMARK_PLUGIN_NAME' ) or define( 'CBXWPBOOKMARK_PLUGIN_NAME', 'cbxwpbookmark' );
34 defined( 'CBXWPBOOKMARK_PLUGIN_VERSION' ) or define( 'CBXWPBOOKMARK_PLUGIN_VERSION', '2.0.9' );
35 defined( 'CBXWPBOOKMARK_BASE_NAME' ) or define( 'CBXWPBOOKMARK_BASE_NAME', plugin_basename( __FILE__ ) );
36 defined( 'CBXWPBOOKMARK_ROOT_PATH' ) or define( 'CBXWPBOOKMARK_ROOT_PATH', plugin_dir_path( __FILE__ ) );
37 defined( 'CBXWPBOOKMARK_ROOT_URL' ) or define( 'CBXWPBOOKMARK_ROOT_URL', plugin_dir_url( __FILE__ ) );
38
39
40 defined( 'CBXWPBOOKMARK_DEV_MODE' ) or define( 'CBXWPBOOKMARK_DEV_MODE', false );
41
42 defined( 'CBXWPBOOKMARK_PHP_MIN_VERSION' ) or define( 'CBXWPBOOKMARK_PHP_MIN_VERSION', '7.4' );
43 defined( 'CBXWPBOOKMARK_WP_MIN_VERSION' ) or define( 'CBXWPBOOKMARK_WP_MIN_VERSION', '5.9' );
44 defined( 'CBXWPBOOKMARK_PRO_VERSION' ) or define( 'CBXWPBOOKMARK_PRO_VERSION', '2.0.9' );
45
46
47 // Include the main Bookmark class.
48 if ( ! class_exists( 'CBXWPBookmark', false ) ) {
49 include_once CBXWPBOOKMARK_ROOT_PATH . 'includes/CBXWPBookmark.php';
50 }
51
52 register_activation_hook( __FILE__, 'cbxwpbookmark_activate' );
53 register_deactivation_hook( __FILE__, 'cbxwpbookmark_deactivate' );
54
55 /**
56 * The code that runs during plugin activation.
57 * This action is documented in includes/class-cbxwpbookmark-activator.php
58 */
59 function cbxwpbookmark_activate() {
60 try {
61 $wp_version = CBXWPBOOKMARK_WP_MIN_VERSION;
62 $php_version = CBXWPBOOKMARK_PHP_MIN_VERSION;
63
64 if ( ! cbxwpbookmark_compatible_wp_version( $wp_version ) ) {
65 deactivate_plugins( plugin_basename( __FILE__ ) );
66 /* translators: %s: wordpress version */
67 wp_die( sprintf( esc_html__( 'CBX Bookmark plugin requires WordPress %s or higher!', 'cbxwpbookmark' ), esc_attr($wp_version) ) );
68 }
69
70 if ( ! cbxwpbookmark_compatible_php_version( $php_version ) ) {
71 deactivate_plugins( plugin_basename( __FILE__ ) );
72 /* translators: %s: php version */
73 wp_die( sprintf( esc_html__( 'CBX Bookmark plugin requires PHP %s or higher!', 'cbxwpbookmark' ), esc_attr($php_version) ) );
74 }
75
76 cbxwpbookmark_core();
77
78 //load orm
79 CBXWPBookmarkHelper::load_orm();
80
81 //do some extra on plugin activation
82 CBXWPBookmarkHelper::activate();
83
84 CBXWPBookmarkHelper::customizer_default_adjust( true );
85
86 } catch (Throwable $e) {
87
88 if(defined('WP_DEBUG') && WP_DEBUG && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG){
89 //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log, WordPress.PHP.DevelopmentFunctions.error_log_print_r
90 error_log(print_r([
91 'message' => $e->getMessage(),
92 'file' => $e->getFile(),
93 'line' => $e->getLine(),
94 'trace' => $e->getTraceAsString(),
95 ], true));
96 }
97
98
99 deactivate_plugins(plugin_basename(__FILE__));
100
101 wp_die(
102 sprintf(
103 'Activation error: %s',
104 esc_html($e->getMessage())
105 )
106 );
107 }
108 }//end memthod cbxwpbookmark_activate
109
110 /**
111 * The code that runs during plugin deactivation.
112 * This action is documented in includes/class-cbxwpbookmark-deactivator.php
113 */
114 function cbxwpbookmark_deactivate() {
115 //require_once plugin_dir_path( __FILE__ ) . 'includes/class-cbxwpbookmark-deactivator.php';
116 CBXWPBookmarkHelper::deactivate();
117 }//end method cbxwpbookmark_deactivate
118
119 /**
120 * Checking wp version
121 *
122 * @param $version
123 *
124 * @return bool
125 * @since 1.0.0
126 */
127 function cbxwpbookmark_compatible_wp_version( $version = CBXWPBOOKMARK_WP_MIN_VERSION ) {
128 if ( version_compare( $GLOBALS['wp_version'], $version, '<' ) ) {
129 return false;
130 }
131
132 // Add sanity checks for other version requirements here
133 return true;
134 }//end function cbxwpbookmark_compatible_wp_version
135
136 /**
137 * Checking php version
138 *
139 * @param $version
140 *
141 * @return bool
142 * @since 1.0.0
143 */
144 function cbxwpbookmark_compatible_php_version( $version = CBXWPBOOKMARK_PHP_MIN_VERSION ) {
145 if ( version_compare( PHP_VERSION, $version, '<' ) ) {
146 return false;
147 }
148
149 return true;
150 }//end function cbxwpbookmark_compatible_php_version
151
152 /**
153 * Returns the main instance of CBXWPBookmark.
154 *
155 * @since 1.0.0
156 */
157 function cbxwpbookmark_core() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
158 global $cbxwpbookmark_core;
159
160 if ( ! isset( $cbxwpbookmark_core ) ) {
161 $cbxwpbookmark_core = cbxwpbookmark_run_core();
162 }
163
164 return $cbxwpbookmark_core;
165 }//end method cbxwpbookmark_core
166
167
168 /**
169 * Begins execution of the plugin.
170 *
171 * Since everything within the plugin is registered via hooks,
172 * then kicking off the plugin from this point in the file does
173 * not affect the page life cycle.
174 *
175 * @since 1.7.13
176 */
177 function cbxwpbookmark_run_core() {
178 return CBXWPBookmark::instance();
179 }//end function cbxwpbookmark_run_core
180
181 $GLOBALS['cbxwpbookmark_core'] = cbxwpbookmark_run_core();