Current File : /dom405686/wp-content/plugins/pws-core/includes/class-GD-cORe.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The core plugin class.
*
* This is used to define internationalization, admin-specific hooks, and
* public-facing site hooks.
*
* Also maintains the unique identifier of this plugin as well as the current
* version of the plugin.
*
* @since 3.0.0
* @package GD_cORe
* @subpackage GD_cORe/includes
*/
class GD_cORe {
/**
* The loader that's responsible for maintaining and registering all hooks that power
* the plugin.
*
* @since 3.0.0
* @access protected
* @var GD_cORe_Loader $loader Maintains and registers all hooks for the plugin.
*/
protected $loader;
/**
* The unique identifier of this plugin.
*
* @since 3.0.0
* @access protected
* @var string $plugin_name The string used to uniquely identify this plugin.
*/
protected $plugin_name;
/**
* The current version of the plugin.
*
* @since 3.0.0
* @access protected
* @var string $version The current version of the plugin.
*/
protected $version;
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since 3.0.0
*/
public function __construct() {
if ( defined( 'GD_cORe_VERSION' ) ) {
$this->version = GD_cORe_VERSION;
} else {
$this->version = '4.1.16';
}
$this->plugin_name = 'gd-core';
$this->load_dependencies();
$this->set_locale();
$this->define_admin_hooks();
$this->define_public_hooks();
$this->run_version_migrations();
}
/**
* Load the required dependencies for this plugins public functions.
*
* Include the following files that make up the plugin:
*
* - GD_cORe_Loader. Orchestrates the hooks of the plugin.
* - GD_cORe_i18n. Defines internationalization functionality.
* - GD_cORe_Public. Defines all hooks for the public side of the site.
*
* Create an instance of the loader which will be used to register the hooks
* with WordPress.
*
* @since 3.0.0
* @access private
*/
private function load_dependencies() {
/**
* The class responsible for defining all classes responsible for api and plugin functionality
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/handlers/register.php';
/**
* The class responsible for orchestrating the actions and filters of the
* core plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-GD-cORe-loader.php';
/**
* The class responsible for coordinating updates with Github and make sure the plugin is always updated.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-GD-cORe-updater.php';
new GD_cORe_Updater( GD_cORe_ROOT_PATH_FILE);
/**
* The class responsible for defining internationalization functionality
* of the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-GD-cORe-i18n.php';
/**
* The class responsible for defining all actions that occur in the public-facing
* side of the site.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-GD-cORe-public.php';
/**
*
* Loads all functions/files related to admin funcitionality.
*/
if(is_admin() && is_user_logged_in() && current_user_can('manage_options')){
/* *
* The class responsible for defining all actions that occur in the admin area.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-GD-cORe-admin.php';
/**
* The class responsible for defining all plugin configurations
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/handlers/plugin_configs/register.php';
/**
* The class responsible for defining all defualt theme configurations
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/handlers/default_configs/register.php';
}
$this->loader = new GD_cORe_Loader();
}
/**
* Define the locale for this plugin for internationalization.
*
* Uses the GD_cORe_i18n class in order to set the domain and to register the hook
* with WordPress.
*
* @since 3.0.0
* @access private
*/
private function set_locale() {
$plugin_i18n = new GD_cORe_i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
/**
* Register all of the hooks related to the admin area functionality
* of the plugin.
*
* @since 3.0.0
* @access private
*/
private function define_admin_hooks() {
if ( ! is_admin() || ! is_user_logged_in() || ! current_user_can('manage_options') ) {
return;
}
$plugin_admin = new GD_cORe_Admin( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'add_admin_page' );
$this->loader->add_action('admin_footer', $plugin_admin, 'core_cache_scripts');
$this->loader->add_action( 'wp_ajax_core_flush_cache', $plugin_admin, 'core_flush');
}
/**
* Register all of the hooks related to the public-facing functionality
* of the plugin.
*
* @since 3.0.0
* @access private
*/
private function define_public_hooks() {
$plugin_public = new GD_cORe_Public( $this->get_plugin_name(), $this->get_version() );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
$this->loader->add_action( 'admin_bar_menu', $plugin_public, 'gd_core_Dropdown' , 100);
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'core_cache_scripts');
}
/**
* Run the loader to execute all of the hooks with WordPress.
*
* @since 3.0.0
*/
public function run() {
$this->loader->run();
}
/**
* The name of the plugin used to uniquely identify it within the context of
* WordPress and to define internationalization functionality.
*
* @since 3.0.0
* @return string The name of the plugin.
*/
public function get_plugin_name() {
return $this->plugin_name;
}
/**
* The reference to the class that orchestrates the hooks with the plugin.
*
* @since 3.0.0
* @return GD_cORe_Loader Orchestrates the hooks of the plugin.
*/
public function get_loader() {
return $this->loader;
}
/**
* Retrieve the version number of the plugin.
*
* @since 3.0.0
* @return string The version number of the plugin.
*/
public function get_version() {
return $this->version;
}
/**
* Run version-based migrations
*
* @since 3.20.0
* @access private
*/
private function run_version_migrations() {
// Get stored version and current version
$stored_version = get_option('gd_core_version', '0.0.0');
$current_version = $this->version;
// Only run migrations if version has changed
if (version_compare($stored_version, $current_version, '<')) {
$this->execute_migrations($stored_version, $current_version);
// Update stored version
update_option('gd_core_version', $current_version);
// Log migration execution
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log("GD cORe: Version migration from $stored_version to $current_version completed");
}
}
}
/**
* Execute specific migrations based on version changes
*
* @since 3.20.0
* @access private
* @param string $old_version The previous version
* @param string $new_version The current version
*/
private function execute_migrations($old_version, $new_version) {
// Migration for WP Rocket consumer email update (version 3.20.0+)
if (version_compare($old_version, '3.20.0', '<') && version_compare($new_version, '3.20.0', '>=')) {
$this->migrate_wp_rocket_consumer_email();
}
if (version_compare($old_version, '4.0.0', '<') && version_compare($new_version, '4.0.0', '>=')) {
$this->ensure_database_tables_exist();
}
}
/**
* Migrate WP Rocket consumer email to correct value
*
* @since 3.20.0
* @access private
*/
private function migrate_wp_rocket_consumer_email() {
// Check if WP Rocket is installed and active
if (!function_exists('is_plugin_active') || !is_plugin_active('wp-rocket/wp-rocket.php')) {
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('GD cORe: WP Rocket migration skipped - plugin not active');
}
return;
}
// Get current WP Rocket settings
$current_settings = get_option('wp_rocket_settings', array());
// Check if consumer_email exists and needs updating
if (isset($current_settings['consumer_email'])) {
$current_email = $current_settings['consumer_email'];
$correct_email = 'pwstech@godaddy.com';
// Only update if the email is different from the correct one
if ($current_email !== $correct_email) {
// Update to correct email
$current_settings['consumer_email'] = $correct_email;
// Update the settings
update_option('wp_rocket_settings', $current_settings, false);
// Log the migration
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log("GD cORe: Migrated WP Rocket consumer_email from '$current_email' to '$correct_email'");
}
} else {
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('GD cORe: WP Rocket consumer_email already correct, no migration needed');
}
}
} else {
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('GD cORe: WP Rocket settings not found, cannot migrate consumer_email');
}
}
}
/**
* Ensure database tables exist (for plugin updates/replacements)
* This method checks if required tables exist and creates them if they don't
*
* @since 4.0.0
* @access private
*/
private function ensure_database_tables_exist() {
global $wpdb;
// Check if the lighthouse reports table exists
$table_name = $wpdb->prefix . 'gdcore_lighthouse_reports';
$table_exists = $wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name;
// Load the activator class to use its table creation method
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-GD-cORe-activator.php';
$result = GD_cORe_Activator::create_database_tables();
// Log the table creation attempt
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('GD cORe: Database tables checked/created. Table exists: ' . ($table_exists ? 'yes' : 'no') . ', Version: ' . $current_version);
}
}
}
Distinguish Your Business From The Rest With The People That Make Up Your Team
We go Beyond a Resume to find high value, committed people
ready, willing, and able to add true value toward your organization's mission.
The right people make or break your business
We focus on resolving two types of challenges surrounding staffing and recruiting at Beyond a Resume: The first challenge comes when a business continues to grow, but does not have the full-time, internal, talent acquisition resources to hire the right people or talent necessary to keep up with their rate of progression as a company.
The second is a business that has a dedicated internal Human Resources Team, but requires outsourced assistance when the volume of people and talent needed exceeds short term internal capacity, OR the position(s) they seek to fill demand a specific skill set that is difficult to find, requiring added bandwidth.
In nearly any line of business, growth is a challenge in and of itself. Yet, the real problems arise in managing growth to ensure your progress remains profitable, sustainable, and repeatable. The biggest factor in this equation is usually found in your people. When you have the right people, success is unlimited. On the other hand, when you don’t have the right people in place or are having trouble finding enough of the right people, failure or stagnation is imminent.
The frustration that comes with the process of “hiring” can bring you to new levels of stress as the time cost involved eats away at your production elsewhere. If you have experienced this in the past, or are currently struggling with this issue, you’re certainly not alone. You may simply need the right partner to take the worst parts of this process off your plate so you can concentrate on your responsibilities, while we work diligently to reduce the noise and deliver only the ideal candidates worth your time and attention.
People can make or break your business and we go Beyond a Resume to find high value, committed people ready, willing, and able to add true value.