1515 * @wordpress-plugin
1616 * Plugin Name: CBX Taxonomy
1717 * Plugin URI: https://wordpress.org/plugins/cbxtaxonomy
18- * Description: Custom taxonomy system for custom table/custom object types. This feature plugin is required for CBXResume, CBXJob and others codeboxr's plugins.
19- * Version: 1.0.0
20- * Requires at least: 3.5
21- * Requires PHP: 7.4
18+ * Description: Custom taxonomy system for custom table/custom object types. This feature plugin is required for ComfortResume, ComfortJob and others plugins.
19+ * Version: 1.0.1
20+ * Requires at least: 5.3
21+ * Requires PHP: 8.2
2222 * Author: Codeboxr
2323 * Author URI: https://codeboxr.com
2424 * License: GPL-2.0+
2525 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
26- * Text Domain: cbxtaxonomy
26+ * Text Domain: cbxwptaxonomy
2727 * Domain Path: /languages
2828 */
2929
3030// If this file is called directly, abort.
31- if (! defined ('WPINC ' ) ) {
31+ if ( ! defined ( 'WPINC ' ) ) {
3232 die;
3333}
3434
35- defined ('CBXTAXONOMY_PLUGIN_NAME ' ) or define ('CBXTAXONOMY_PLUGIN_NAME ' , 'cbxtaxonomy ' );
36- defined ('CBXTAXONOMY_PLUGIN_VERSION ' ) or define ('CBXTAXONOMY_PLUGIN_VERSION ' , '1.0.0 ' );
37- defined ('CBXTAXONOMY_BASE_NAME ' ) or define ('CBXTAXONOMY_BASE_NAME ' , plugin_basename (__FILE__ ));
38- defined ('CBXTAXONOMY_ROOT_PATH ' ) or define ('CBXTAXONOMY_ROOT_PATH ' , plugin_dir_path (__FILE__ ));
39- defined ('CBXTAXONOMY_ROOT_URL ' ) or define ('CBXTAXONOMY_ROOT_URL ' , plugin_dir_url (__FILE__ ));
40- defined ('CBXTAXONOMY_DEV_MODE ' ) or define ('CBXTAXONOMY_DEV_MODE ' , true );
35+ use Cbx \Taxonomy \CBXTaxonomyHelper ;
4136
42- require_once CBXTAXONOMY_ROOT_PATH . "lib/autoload.php " ;
37+ defined ( 'CBXTAXONOMY_PLUGIN_NAME ' ) or define ( 'CBXTAXONOMY_PLUGIN_NAME ' , 'cbxtaxonomy ' );
38+ defined ( 'CBXTAXONOMY_PLUGIN_VERSION ' ) or define ( 'CBXTAXONOMY_PLUGIN_VERSION ' , '1.0.1 ' );
39+ defined ( 'CBXTAXONOMY_BASE_NAME ' ) or define ( 'CBXTAXONOMY_BASE_NAME ' , plugin_basename ( __FILE__ ) );
40+ defined ( 'CBXTAXONOMY_ROOT_PATH ' ) or define ( 'CBXTAXONOMY_ROOT_PATH ' , plugin_dir_path ( __FILE__ ) );
41+ defined ( 'CBXTAXONOMY_ROOT_URL ' ) or define ( 'CBXTAXONOMY_ROOT_URL ' , plugin_dir_url ( __FILE__ ) );
4342
44- register_activation_hook (__FILE__ , 'activate_cbxtaxonomy ' );
45- register_deactivation_hook (__FILE__ , 'deactivate_cbxtaxonomy ' );
43+ //for development purpose only
44+ defined ( 'CBXTAXONOMY_DEV_MODE ' ) or define ( 'CBXTAXONOMY_DEV_MODE ' , true );
45+
46+ // Include the main CBXTaxonomy class.
47+ if ( ! class_exists ( 'CBXTaxonomy ' , false ) ) {
48+ include_once CBXTAXONOMY_ROOT_PATH . 'includes/CBXTaxonomy.php ' ;
49+ }
50+
51+
52+ register_activation_hook ( __FILE__ , 'activate_cbxtaxonomy ' );
53+ register_deactivation_hook ( __FILE__ , 'deactivate_cbxtaxonomy ' );
4654
4755/**
4856 * * The code that runs during plugin activation.
4957 * The code that runs during plugin deactivation.
5058 */
51- function activate_cbxtaxonomy ()
52- {
53- \Cbx \Taxonomy \CBXTaxonomyHelper::load_orm ();
54- \Cbx \Taxonomy \CBXTaxonomyHelper::active_plugin ();
55- }
59+ function activate_cbxtaxonomy () {
60+ cbxtaxonomy ();
61+
62+ CBXTaxonomyHelper::load_orm ();
63+ CBXTaxonomyHelper::active_plugin ();
64+ }//end function activate_cbxtaxonomy
5665
5766/**
5867 * The code that runs during plugin deactivation.
5968 */
60- function deactivate_cbxtaxonomy ()
61- {
62- \ Cbx \ Taxonomy \ CBXTaxonomyHelper::load_orm ();
63- }
69+ function deactivate_cbxtaxonomy () {
70+ //cbxtaxonomy();
71+ // CBXTaxonomyHelper::load_orm();
72+ }//end function deactivate_cbxtaxonomy
6473
6574
6675/**
67- * Init cbxtaxonomy plugin
76+ * Returns the main instance of CBXTaxonomy.
77+ *
78+ * @since 1.0
6879 */
69- function cbxtaxonomy ()
70- {
71- if (defined ('CBXTAXONOMY_PLUGIN_NAME ' )) {
72- \Cbx \Taxonomy \CBXTaxonomy::instance ();
80+ function cbxtaxonomy () { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
81+ global $ cbxtaxonomy ;
82+
83+ // If the global variable is not already set, initialize it
84+ if ( ! isset ( $ cbxtaxonomy ) ) {
85+ $ cbxtaxonomy = run_cbxtaxonomy ();
7386 }
74- }//end function cbxtaxonomy
7587
76- add_action ('plugins_loaded ' , 'cbxtaxonomy ' );
88+ return $ cbxtaxonomy ;
89+ }//end function cbxtaxonomy_core
90+
91+ /**
92+ * Initialize ComfortResume pro plugin
93+ * @since 1.0.0
94+ */
95+ function run_cbxtaxonomy () {
96+ return CBXTaxonomy::instance ();
97+ }//end function run_cbxtaxonomy
98+
99+ /**
100+ * Init cbxtaxonomy plugin
101+ */
102+ function cbxtaxonomy_init () {
103+ $ GLOBALS ['cbxtaxonomy ' ] = run_cbxtaxonomy ();
104+ }//end function cbxtaxonomy_init
77105
106+ add_action ( 'plugins_loaded ' , 'cbxtaxonomy_init ' );
0 commit comments