| @@ -1,272 +1,365 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * The file that defines the core plugin class | |
| 5 | - * | |
| 6 | - * A class definition that includes attributes and functions used across both the | |
| 7 | - * public-facing side of the site and the admin area. | |
| 8 | - * | |
| 9 | - * @link https://ays-pro.com/ | |
| 10 | - * @since 1.0.0 | |
| 11 | - * | |
| 12 | - * @package Chart_Builder | |
| 13 | - * @subpackage Chart_Builder/includes | |
| 14 | - */ | |
| 15 | - | |
| 16 | -/** | |
| 17 | - * The core plugin class. | |
| 18 | - * | |
| 19 | - * This is used to define internationalization, admin-specific hooks, and | |
| 20 | - * public-facing site hooks. | |
| 21 | - * | |
| 22 | - * Also maintains the unique identifier of this plugin as well as the current | |
| 23 | - * version of the plugin. | |
| 24 | - * | |
| 25 | - * @since 1.0.0 | |
| 26 | - * @package Chart_Builder | |
| 27 | - * @subpackage Chart_Builder/includes | |
| 28 | - * @author Chart Builder Team <info@ays-pro.com> | |
| 29 | - */ | |
| 30 | -class Chart_Builder { | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * The loader that's responsible for maintaining and registering all hooks that power | |
| 34 | - * the plugin. | |
| 35 | - * | |
| 36 | - * @since 1.0.0 | |
| 37 | - * @access protected | |
| 38 | - * @var Chart_Builder_Loader $loader Maintains and registers all hooks for the plugin. | |
| 39 | - */ | |
| 40 | - protected $loader; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * The unique identifier of this plugin. | |
| 44 | - * | |
| 45 | - * @since 1.0.0 | |
| 46 | - * @access protected | |
| 47 | - * @var string $plugin_name The string used to uniquely identify this plugin. | |
| 48 | - */ | |
| 49 | - protected $plugin_name; | |
| 50 | - | |
| 51 | - /** | |
| 52 | - * The current version of the plugin. | |
| 53 | - * | |
| 54 | - * @since 1.0.0 | |
| 55 | - * @access protected | |
| 56 | - * @var string $version The current version of the plugin. | |
| 57 | - */ | |
| 58 | - protected $version; | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * Define the core functionality of the plugin. | |
| 62 | - * | |
| 63 | - * Set the plugin name and the plugin version that can be used throughout the plugin. | |
| 64 | - * Load the dependencies, define the locale, and set the hooks for the admin area and | |
| 65 | - * the public-facing side of the site. | |
| 66 | - * | |
| 67 | - * @since 1.0.0 | |
| 68 | - */ | |
| 69 | - public function __construct() { | |
| 70 | - if ( defined( 'CHART_BUILDER_VERSION' ) ) { | |
| 71 | - $this->version = CHART_BUILDER_VERSION; | |
| 72 | - } else { | |
| 73 | - $this->version = '1.0.0'; | |
| 74 | - } | |
| 75 | - $this->plugin_name = "chart-builder"; | |
| 76 | - | |
| 77 | - $this->load_dependencies(); | |
| 78 | - $this->set_locale(); | |
| 79 | - $this->define_admin_hooks(); | |
| 80 | - $this->define_public_hooks(); | |
| 81 | - | |
| 82 | - } | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * Load the required dependencies for this plugin. | |
| 86 | - * | |
| 87 | - * Include the following files that make up the plugin: | |
| 88 | - * | |
| 89 | - * - Chart_Builder_Loader. Orchestrates the hooks of the plugin. | |
| 90 | - * - Chart_Builder_i18n. Defines internationalization functionality. | |
| 91 | - * - Chart_Builder_Admin. Defines all hooks for the admin area. | |
| 92 | - * - Chart_Builder_Public. Defines all hooks for the public side of the site. | |
| 93 | - * | |
| 94 | - * Create an instance of the loader which will be used to register the hooks | |
| 95 | - * with WordPress. | |
| 96 | - * | |
| 97 | - * @since 1.0.0 | |
| 98 | - * @access private | |
| 99 | - */ | |
| 100 | - private function load_dependencies() { | |
| 101 | - | |
| 102 | - if ( ! class_exists( 'WP_List_Table' ) ) { | |
| 103 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); | |
| 104 | - } | |
| 105 | - | |
| 106 | - /** | |
| 107 | - * The classes responsible for defining all actions including db that occur in the plugin area. | |
| 108 | - */ | |
| 109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-functions.php'; | |
| 110 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-db-actions.php'; | |
| 111 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-actions.php'; | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * The class responsible for defining all functions for getting all form integrations | |
| 115 | - */ | |
| 116 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-integrations.php'; | |
| 117 | - | |
| 118 | - /** | |
| 119 | - * The class responsible for orchestrating the actions and filters of the | |
| 120 | - * core plugin. | |
| 121 | - */ | |
| 122 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-loader.php'; | |
| 123 | - | |
| 124 | - /** | |
| 125 | - * The class responsible for defining internationalization functionality | |
| 126 | - * of the plugin. | |
| 127 | - */ | |
| 128 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-i18n.php'; | |
| 129 | - | |
| 130 | - /** | |
| 131 | - * The class responsible for defining all actions that occur in the admin area. | |
| 132 | - */ | |
| 133 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-chart-builder-admin.php'; | |
| 134 | - | |
| 135 | - /** | |
| 136 | - * The class responsible for defining all actions that occur in the public-facing | |
| 137 | - * side of the site. | |
| 138 | - */ | |
| 139 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-chart-builder-public.php'; | |
| 140 | - | |
| 141 | - $this->loader = new Chart_Builder_Loader(); | |
| 142 | - | |
| 143 | - } | |
| 144 | - | |
| 145 | - /** | |
| 146 | - * Define the locale for this plugin for internationalization. | |
| 147 | - * | |
| 148 | - * Uses the Chart_Builder_i18n class in order to set the domain and to register the hook | |
| 149 | - * with WordPress. | |
| 150 | - * | |
| 151 | - * @since 1.0.0 | |
| 152 | - * @access private | |
| 153 | - */ | |
| 154 | - private function set_locale() { | |
| 155 | - | |
| 156 | - $plugin_i18n = new Chart_Builder_i18n(); | |
| 157 | - | |
| 158 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); | |
| 159 | - | |
| 160 | - } | |
| 161 | - | |
| 162 | - /** | |
| 163 | - * Register all of the hooks related to the admin area functionality | |
| 164 | - * of the plugin. | |
| 165 | - * | |
| 166 | - * @since 1.0.0 | |
| 167 | - * @access private | |
| 168 | - */ | |
| 169 | - private function define_admin_hooks() { | |
| 170 | - | |
| 171 | - $plugin_admin = new Chart_Builder_Admin( $this->get_plugin_name(), $this->get_version() ); | |
| 172 | - | |
| 173 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); | |
| 174 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); | |
| 175 | - | |
| 176 | - | |
| 177 | - $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' ); | |
| 178 | - | |
| 179 | - // $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_general_settings_submenu', 120 ); | |
| 180 | - | |
| 181 | - | |
| 182 | - // Add Chart page sources contents | |
| 183 | - $this->loader->add_action( 'ays_cb_chart_page_sources_contents', $plugin_admin, 'ays_chart_page_source_contents', 10, 3 ); | |
| 184 | - // $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_import_from_wordpress_settings', 50, 2 ); | |
| 185 | - $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_manual_settings', 70, 2 ); | |
| 186 | - | |
| 187 | - // Add Chart page settings contents | |
| 188 | - $this->loader->add_action( 'ays_cb_chart_page_settings_contents', $plugin_admin, 'ays_chart_page_settings_contents', 10, 3 ); | |
| 189 | - $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_general_settings', 50, 2 ); | |
| 190 | - $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_styles_settings', 60, 2 ); | |
| 191 | - $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_tooltip_settings', 70, 2 ); | |
| 192 | - | |
| 193 | - | |
| 194 | - // Add Settings link to the plugin | |
| 195 | - $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_name . '.php' ); | |
| 196 | - $this->loader->add_filter( 'plugin_action_links_' . $plugin_basename, $plugin_admin, 'add_action_links' ); | |
| 197 | - | |
| 198 | - | |
| 199 | - // Admin AJAX action | |
| 200 | - $this->loader->add_action( 'wp_ajax_ays_chart_admin_ajax', $plugin_admin, 'ays_admin_ajax' ); | |
| 201 | - $this->loader->add_action( 'wp_ajax_nopriv_ays_chart_admin_ajax', $plugin_admin, 'ays_admin_ajax' ); | |
| 202 | - $this->loader->add_action( 'wp_ajax_deactivate_plugin_option_cb', $plugin_admin, 'deactivate_plugin_option'); | |
| 203 | - $this->loader->add_action( 'wp_ajax_nopriv_deactivate_plugin_option_cb', $plugin_admin, 'deactivate_plugin_option'); | |
| 204 | - | |
| 205 | - } | |
| 206 | - | |
| 207 | - /** | |
| 208 | - * Register all of the hooks related to the public-facing functionality | |
| 209 | - * of the plugin. | |
| 210 | - * | |
| 211 | - * @since 1.0.0 | |
| 212 | - * @access private | |
| 213 | - */ | |
| 214 | - private function define_public_hooks() { | |
| 215 | - | |
| 216 | - $plugin_public = new Chart_Builder_Public( $this->get_plugin_name(), $this->get_version() ); | |
| 217 | - | |
| 218 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); | |
| 219 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); | |
| 220 | - | |
| 221 | - } | |
| 222 | - | |
| 223 | - /** | |
| 224 | - * Register all of the hooks related to the integrations functionality | |
| 225 | - * of the plugin. | |
| 226 | - * | |
| 227 | - * @since 1.0.0 | |
| 228 | - * @access private | |
| 229 | - */ | |
| 230 | - | |
| 231 | - | |
| 232 | - /** | |
| 233 | - * Run the loader to execute all of the hooks with WordPress. | |
| 234 | - * | |
| 235 | - * @since 1.0.0 | |
| 236 | - */ | |
| 237 | - public function run() { | |
| 238 | - $this->loader->run(); | |
| 239 | - } | |
| 240 | - | |
| 241 | - /** | |
| 242 | - * The name of the plugin used to uniquely identify it within the context of | |
| 243 | - * WordPress and to define internationalization functionality. | |
| 244 | - * | |
| 245 | - * @since 1.0.0 | |
| 246 | - * @return string The name of the plugin. | |
| 247 | - */ | |
| 248 | - public function get_plugin_name() { | |
| 249 | - return $this->plugin_name; | |
| 250 | - } | |
| 251 | - | |
| 252 | - /** | |
| 253 | - * The reference to the class that orchestrates the hooks with the plugin. | |
| 254 | - * | |
| 255 | - * @since 1.0.0 | |
| 256 | - * @return Chart_Builder_Loader Orchestrates the hooks of the plugin. | |
| 257 | - */ | |
| 258 | - public function get_loader() { | |
| 259 | - return $this->loader; | |
| 260 | - } | |
| 261 | - | |
| 262 | - /** | |
| 263 | - * Retrieve the version number of the plugin. | |
| 264 | - * | |
| 265 | - * @since 1.0.0 | |
| 266 | - * @return string The version number of the plugin. | |
| 267 | - */ | |
| 268 | - public function get_version() { | |
| 269 | - return $this->version; | |
| 270 | - } | |
| 271 | - | |
| 272 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * The file that defines the core plugin class | |
| 5 | + * | |
| 6 | + * A class definition that includes attributes and functions used across both the | |
| 7 | + * public-facing side of the site and the admin area. | |
| 8 | + * | |
| 9 | + * @link https://ays-pro.com/ | |
| 10 | + * @since 1.0.0 | |
| 11 | + * | |
| 12 | + * @package Chart_Builder | |
| 13 | + * @subpackage Chart_Builder/includes | |
| 14 | + */ | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * The core plugin class. | |
| 18 | + * | |
| 19 | + * This is used to define internationalization, admin-specific hooks, and | |
| 20 | + * public-facing site hooks. | |
| 21 | + * | |
| 22 | + * Also maintains the unique identifier of this plugin as well as the current | |
| 23 | + * version of the plugin. | |
| 24 | + * | |
| 25 | + * @since 1.0.0 | |
| 26 | + * @package Chart_Builder | |
| 27 | + * @subpackage Chart_Builder/includes | |
| 28 | + * @author Chart Builder Team <info@ays-pro.com> | |
| 29 | + */ | |
| 30 | +class Chart_Builder { | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * The loader that's responsible for maintaining and registering all hooks that power | |
| 34 | + * the plugin. | |
| 35 | + * | |
| 36 | + * @since 1.0.0 | |
| 37 | + * @access protected | |
| 38 | + * @var Chart_Builder_Loader $loader Maintains and registers all hooks for the plugin. | |
| 39 | + */ | |
| 40 | + protected $loader; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * The unique identifier of this plugin. | |
| 44 | + * | |
| 45 | + * @since 1.0.0 | |
| 46 | + * @access protected | |
| 47 | + * @var string $plugin_name The string used to uniquely identify this plugin. | |
| 48 | + */ | |
| 49 | + protected $plugin_name; | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * The current version of the plugin. | |
| 53 | + * | |
| 54 | + * @since 1.0.0 | |
| 55 | + * @access protected | |
| 56 | + * @var string $version The current version of the plugin. | |
| 57 | + */ | |
| 58 | + protected $version; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Define the core functionality of the plugin. | |
| 62 | + * | |
| 63 | + * Set the plugin name and the plugin version that can be used throughout the plugin. | |
| 64 | + * Load the dependencies, define the locale, and set the hooks for the admin area and | |
| 65 | + * the public-facing side of the site. | |
| 66 | + * | |
| 67 | + * @since 1.0.0 | |
| 68 | + */ | |
| 69 | + public function __construct() { | |
| 70 | + if ( defined( 'CHART_BUILDER_VERSION' ) ) { | |
| 71 | + $this->version = CHART_BUILDER_VERSION; | |
| 72 | + } else { | |
| 73 | + $this->version = '1.0.0'; | |
| 74 | + } | |
| 75 | + $this->plugin_name = "chart-builder"; | |
| 76 | + | |
| 77 | + $this->load_dependencies(); | |
| 78 | + $this->set_locale(); | |
| 79 | + $this->define_admin_hooks(); | |
| 80 | + $this->define_public_hooks(); | |
| 81 | + $this->define_integrations_hooks(); | |
| 82 | + $this->define_custom_post_type_hooks(); | |
| 83 | + | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Load the required dependencies for this plugin. | |
| 88 | + * | |
| 89 | + * Include the following files that make up the plugin: | |
| 90 | + * | |
| 91 | + * - Chart_Builder_Loader. Orchestrates the hooks of the plugin. | |
| 92 | + * - Chart_Builder_i18n. Defines internationalization functionality. | |
| 93 | + * - Chart_Builder_Admin. Defines all hooks for the admin area. | |
| 94 | + * - Chart_Builder_Public. Defines all hooks for the public side of the site. | |
| 95 | + * | |
| 96 | + * Create an instance of the loader which will be used to register the hooks | |
| 97 | + * with WordPress. | |
| 98 | + * | |
| 99 | + * @since 1.0.0 | |
| 100 | + * @access private | |
| 101 | + */ | |
| 102 | + private function load_dependencies() { | |
| 103 | + | |
| 104 | + if ( ! class_exists( 'WP_List_Table' ) ) { | |
| 105 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); | |
| 106 | + } | |
| 107 | + | |
| 108 | + /** | |
| 109 | + * The classes responsible for defining all actions including db that occur in the plugin area. | |
| 110 | + */ | |
| 111 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-functions.php'; | |
| 112 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-settings-db-actions.php'; | |
| 113 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-db-actions.php'; | |
| 114 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-actions.php'; | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * The class responsible for defining all functions for getting all form integrations | |
| 118 | + */ | |
| 119 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-integrations.php'; | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * The class responsible for orchestrating the actions and filters of the | |
| 123 | + * core plugin. | |
| 124 | + */ | |
| 125 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-loader.php'; | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * The class responsible for defining internationalization functionality | |
| 129 | + * of the plugin. | |
| 130 | + */ | |
| 131 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-i18n.php'; | |
| 132 | + | |
| 133 | + /** | |
| 134 | + * The class responsible for defining all actions that occur in the admin area. | |
| 135 | + */ | |
| 136 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-chart-builder-admin.php'; | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * The class responsible for defining all actions that occur in the public-facing | |
| 140 | + * side of the site. | |
| 141 | + */ | |
| 142 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-chart-builder-public.php'; | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * The class responsible for defining all functions for getting all custom post type functions | |
| 146 | + */ | |
| 147 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-chart-builder-custom-post-type.php'; | |
| 148 | + | |
| 149 | + | |
| 150 | + $this->loader = new Chart_Builder_Loader(); | |
| 151 | + | |
| 152 | + } | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * Define the locale for this plugin for internationalization. | |
| 156 | + * | |
| 157 | + * Uses the Chart_Builder_i18n class in order to set the domain and to register the hook | |
| 158 | + * with WordPress. | |
| 159 | + * | |
| 160 | + * @since 1.0.0 | |
| 161 | + * @access private | |
| 162 | + */ | |
| 163 | + private function set_locale() { | |
| 164 | + | |
| 165 | + $plugin_i18n = new Chart_Builder_i18n(); | |
| 166 | + | |
| 167 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); | |
| 168 | + | |
| 169 | + } | |
| 170 | + | |
| 171 | + /** | |
| 172 | + * Register all of the hooks related to the admin area functionality | |
| 173 | + * of the plugin. | |
| 174 | + * | |
| 175 | + * @since 1.0.0 | |
| 176 | + * @access private | |
| 177 | + */ | |
| 178 | + private function define_admin_hooks() { | |
| 179 | + | |
| 180 | + $plugin_admin = new Chart_Builder_Admin( $this->get_plugin_name(), $this->get_version() ); | |
| 181 | + | |
| 182 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); | |
| 183 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); | |
| 184 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'disable_scripts', 100 ); | |
| 185 | + | |
| 186 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_admin_menu' ); | |
| 187 | + | |
| 188 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_charts_submenu', 115 ); | |
| 189 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_add_new_submenu', 120 ); | |
| 190 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_general_settings_submenu', 125 ); | |
| 191 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_dashboard_submenu', 130 ); | |
| 192 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_featured_plugins_submenu', 135 ); | |
| 193 | + $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_plugin_chart_features_submenu', 145 ); | |
| 194 | + | |
| 195 | + | |
| 196 | + // Add Chart page sources contents | |
| 197 | + $this->loader->add_action( 'ays_cb_chart_page_sources_contents', $plugin_admin, 'ays_chart_page_source_contents', 10, 3 ); | |
| 198 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_import_from_csv_settings', 40, 2 ); | |
| 199 | + // $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_import_from_wordpress_settings', 50, 2 ); | |
| 200 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_import_from_db_settings', 60, 2 ); | |
| 201 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_import_from_external_db_settings', 65, 2 ); | |
| 202 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_quiz_maker_integration_settings', 70, 2 ); | |
| 203 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_woocommerce_integration_settings', 80, 2 ); | |
| 204 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_admin, 'source_contents_manual_settings', 90, 2 ); | |
| 205 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings_chartjs', $plugin_admin, 'source_contents_manual_settings_chartjs', 90, 2 ); | |
| 206 | + | |
| 207 | + // Add Chart page settings contents | |
| 208 | + $this->loader->add_action( 'ays_cb_chart_page_settings_contents', $plugin_admin, 'ays_chart_page_settings_contents', 10, 3 ); | |
| 209 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_general_settings', 50, 2 ); | |
| 210 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_tooltip_settings', 70, 2 ); | |
| 211 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_legend_settings', 80, 2 ); | |
| 212 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_horizontal_axis_settings', 90, 2 ); | |
| 213 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_vertical_axis_settings', 100, 2 ); | |
| 214 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_animation_settings', 110, 2 ); | |
| 215 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_live_chart_settings', 115, 2 ); | |
| 216 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings', $plugin_admin, 'settings_contents_export_options', 120, 2 ); | |
| 217 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings_chartjs', $plugin_admin, 'settings_contents_general_settings_chartjs', 50, 2 ); | |
| 218 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings_chartjs', $plugin_admin, 'settings_contents_tooltip_settings_chartjs', 50, 2 ); | |
| 219 | + $this->loader->add_filter( 'ays_cb_chart_page_settings_contents_settings_chartjs', $plugin_admin, 'settings_contents_legend_settings_chartjs', 50, 2 ); | |
| 220 | + | |
| 221 | + // Add Chart page styles contents | |
| 222 | + $this->loader->add_action( 'ays_cb_chart_page_styles_contents', $plugin_admin, 'ays_chart_page_styles_contents', 10, 3 ); | |
| 223 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings', $plugin_admin, 'settings_contents_chart_styles_settings', 50, 2 ); | |
| 224 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings', $plugin_admin, 'settings_contents_chart_area_styles_settings', 60, 2 ); | |
| 225 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings', $plugin_admin, 'settings_contents_title_styles_settings', 70, 2 ); | |
| 226 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings', $plugin_admin, 'settings_contents_description_styles_settings', 80, 2 ); | |
| 227 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings_chartjs', $plugin_admin, 'settings_contents_chart_styles_settings_chartjs', 50, 2 ); | |
| 228 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings_chartjs', $plugin_admin, 'settings_contents_title_styles_settings_chartjs', 70, 2 ); | |
| 229 | + $this->loader->add_filter( 'ays_cb_chart_page_styles_contents_settings_chartjs', $plugin_admin, 'settings_contents_description_styles_settings_chartjs', 80, 2 ); | |
| 230 | + | |
| 231 | + // Add Chart page advanced settings contents | |
| 232 | + $this->loader->add_action( 'ays_cb_chart_page_advanced_settings_contents', $plugin_admin, 'ays_chart_page_advanced_settings_contents', 10, 3 ); | |
| 233 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings', $plugin_admin, 'settings_contents_advanced_settings', 50, 2 ); | |
| 234 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings', $plugin_admin, 'settings_contents_slices_settings', 60, 2 ); | |
| 235 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings', $plugin_admin, 'settings_contents_series_settings', 70, 2 ); | |
| 236 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings', $plugin_admin, 'settings_contents_row_settings', 80, 2 ); | |
| 237 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings_chartjs', $plugin_admin, 'settings_contents_advanced_settings_chartjs', 50, 2 ); | |
| 238 | + $this->loader->add_filter( 'ays_cb_chart_page_advanced_settings_contents_settings_chartjs', $plugin_admin, 'settings_contents_slices_settings_chartjs', 50, 2 ); | |
| 239 | + | |
| 240 | + // Add Settings link to the plugin | |
| 241 | + $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . $this->plugin_name . '.php' ); | |
| 242 | + $this->loader->add_filter( 'plugin_action_links_' . $plugin_basename, $plugin_admin, 'add_action_links' ); | |
| 243 | + | |
| 244 | + | |
| 245 | + // Admin AJAX action | |
| 246 | + $this->loader->add_action( 'wp_ajax_ays_chart_admin_ajax', $plugin_admin, 'ays_admin_ajax' ); | |
| 247 | + $this->loader->add_action( 'wp_ajax_nopriv_ays_chart_admin_ajax', $plugin_admin, 'ays_admin_ajax' ); | |
| 248 | + $this->loader->add_action( 'wp_ajax_deactivate_plugin_option_cb', $plugin_admin, 'deactivate_plugin_option'); | |
| 249 | + $this->loader->add_action( 'wp_ajax_nopriv_deactivate_plugin_option_cb', $plugin_admin, 'deactivate_plugin_option'); | |
| 250 | + | |
| 251 | + $this->loader->add_action( 'wp_ajax_ays_chart_install_plugin', $plugin_admin, 'ays_chart_install_plugin' ); | |
| 252 | + $this->loader->add_action( 'wp_ajax_nopriv_ays_chart_install_plugin', $plugin_admin, 'ays_chart_install_plugin' ); | |
| 253 | + | |
| 254 | + $this->loader->add_action( 'wp_ajax_ays_chart_activate_plugin', $plugin_admin, 'ays_chart_activate_plugin' ); | |
| 255 | + $this->loader->add_action( 'wp_ajax_nopriv_ays_chart_activate_plugin', $plugin_admin, 'ays_chart_activate_plugin' ); | |
| 256 | + | |
| 257 | + $this->loader->add_action( 'elementor/widgets/widgets_registered', $plugin_admin, 'chart_builder_el_widgets_registered' ); | |
| 258 | + | |
| 259 | + $this->loader->add_action( 'in_admin_footer', $plugin_admin, 'chart_builder_admin_footer', 1 ); | |
| 260 | + | |
| 261 | + // Sale Banner | |
| 262 | + $this->loader->add_action( 'admin_notices', $plugin_admin, 'ays_chart_sale_banner', 1 ); | |
| 263 | + $this->loader->add_action( 'wp_ajax_ays_chart_dismiss_button', $plugin_admin, 'ays_chart_dismiss_button' ); | |
| 264 | + $this->loader->add_action( 'wp_ajax_nopriv_ays_chart_dismiss_button', $plugin_admin, 'ays_chart_dismiss_button' ); | |
| 265 | + } | |
| 266 | + | |
| 267 | + /** | |
| 268 | + * Register all of the hooks related to the public-facing functionality | |
| 269 | + * of the plugin. | |
| 270 | + * | |
| 271 | + * @since 1.0.0 | |
| 272 | + * @access private | |
| 273 | + */ | |
| 274 | + private function define_public_hooks() { | |
| 275 | + | |
| 276 | + $plugin_public = new Chart_Builder_Public( $this->get_plugin_name(), $this->get_version() ); | |
| 277 | + $this->loader->add_action( 'wp_head', $plugin_public, 'add_custom_chart_styles' ); | |
| 278 | + // $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); | |
| 279 | + // $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); | |
| 280 | + | |
| 281 | + } | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * Register all of the hooks related to the integrations functionality | |
| 285 | + * of the plugin. | |
| 286 | + * | |
| 287 | + * @since 1.0.0 | |
| 288 | + * @access private | |
| 289 | + */ | |
| 290 | + private function define_integrations_hooks() { | |
| 291 | + | |
| 292 | + $plugin_integrations = new Chart_Builder_Integrations( $this->get_plugin_name(), $this->get_version() ); | |
| 293 | + | |
| 294 | + // Form Maker Integrations / form page | |
| 295 | + $this->loader->add_action( 'ays_cb_chart_page_integrations', $plugin_integrations, 'ays_chart_page_integrations_content' ); | |
| 296 | + | |
| 297 | + // Form Maker Integrations / settings page | |
| 298 | + $this->loader->add_action( 'ays_cb_settings_page_integrations', $plugin_integrations, 'ays_settings_page_integrations_content' ); | |
| 299 | + | |
| 300 | + | |
| 301 | + // ===== Google integration ===== | |
| 302 | + | |
| 303 | + // Google integration / settings page | |
| 304 | + $this->loader->add_filter( 'ays_cb_settings_page_integrations_contents', $plugin_integrations, 'ays_settings_page_google_sheet_content', 50, 2 ); | |
| 305 | + $this->loader->add_filter( 'ays_cb_chart_page_sources_contents_settings', $plugin_integrations, 'source_contents_import_from_google_sheet_settings', 50, 2 ); | |
| 306 | + | |
| 307 | + // ===== Google integration ===== | |
| 308 | + | |
| 309 | + // ===== Database integration ===== | |
| 310 | + $this->loader->add_filter( 'ays_cb_settings_page_integrations_contents', $plugin_integrations, 'ays_settings_page_database_content', 50, 3 ); | |
| 311 | + | |
| 312 | + // ===== Database integration ===== | |
| 313 | + } | |
| 314 | + | |
| 315 | + /** | |
| 316 | + * Run the loader to execute all of the hooks with WordPress. | |
| 317 | + * | |
| 318 | + * @since 1.0.0 | |
| 319 | + */ | |
| 320 | + private function define_custom_post_type_hooks(){ | |
| 321 | + $plugin_custom_post_type = new Chart_Builder_Custom_Post_Type( $this->get_plugin_name(), $this->get_version() ); | |
| 322 | + } | |
| 323 | + | |
| 324 | + | |
| 325 | + /** | |
| 326 | + * Run the loader to execute all of the hooks with WordPress. | |
| 327 | + * | |
| 328 | + * @since 1.0.0 | |
| 329 | + */ | |
| 330 | + public function run() { | |
| 331 | + $this->loader->run(); | |
| 332 | + } | |
| 333 | + | |
| 334 | + /** | |
| 335 | + * The name of the plugin used to uniquely identify it within the context of | |
| 336 | + * WordPress and to define internationalization functionality. | |
| 337 | + * | |
| 338 | + * @since 1.0.0 | |
| 339 | + * @return string The name of the plugin. | |
| 340 | + */ | |
| 341 | + public function get_plugin_name() { | |
| 342 | + return $this->plugin_name; | |
| 343 | + } | |
| 344 | + | |
| 345 | + /** | |
| 346 | + * The reference to the class that orchestrates the hooks with the plugin. | |
| 347 | + * | |
| 348 | + * @since 1.0.0 | |
| 349 | + * @return Chart_Builder_Loader Orchestrates the hooks of the plugin. | |
| 350 | + */ | |
| 351 | + public function get_loader() { | |
| 352 | + return $this->loader; | |
| 353 | + } | |
| 354 | + | |
| 355 | + /** | |
| 356 | + * Retrieve the version number of the plugin. | |
| 357 | + * | |
| 358 | + * @since 1.0.0 | |
| 359 | + * @return string The version number of the plugin. | |
| 360 | + */ | |
| 361 | + public function get_version() { | |
| 362 | + return $this->version; | |
| 363 | + } | |
| 364 | + | |
| 365 | +} | |