PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/mytube.pm/wp-content/plugins/social-pug/inc/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/mytube.pm/wp-content/plugins/social-pug/inc/class-social-pug.php |
<?php class Social_Pug { /** @var string|null Build tool sets this. */ const VERSION = '1.19.1 '; /** @var string|null Version number for this release. @deprecated Use MV_GROW_VERSION */ public static $VERSION; private static $instance = null; /** @var \Mediavine\Grow\Asset_Loader */ public $asset_loader = null; /** @var \Mediavine\Grow\Frontend_Data */ public $frontend_data = null; /** @var \Mediavine\Grow\Admin_Notices */ public $admin_notices = null; /** @var \Mediavine\Grow\Settings_API */ public $settings_api = null; /** @var \Mediavine\Grow\Networks */ public $networks = null; /** @var \Mediavine\Grow\Icons */ public $icons = null; /** @var \Mediavine\Grow\Tools\Toolkit Container for all the tools. */ public $tools = null; /** * Determine our version number depending on whether plugin has been built or is in development. */ public function set_version() { if ( ! is_null( self::VERSION ) ) { // If the build tool has run, use its version. self::$VERSION = self::VERSION; define( 'MV_GROW_VERSION', self::VERSION ); } else { // Dynamically set version in `kernl.version`. $kernl_version = explode( "\n", file_get_contents( __DIR__ . '/../kernl.version' ) )[0]; // {{-KERNL_VERSION-}} DO NOT REMOVE: WILL BE REPLACED IN BUILD self::$VERSION = $kernl_version; define( 'MV_GROW_VERSION', $kernl_version ); } } /** * Singleton factory. * * @return Social_Pug|null */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); self::$instance->init(); } return self::$instance; } /** * Plugin bootstrap. */ public function init() { $this->set_version(); define( 'DPSP_VERSION', self::$VERSION ); define( 'DPSP_TRANSLATION_TEXTDOMAIN', 'social-pug' ); // Register feature flags early. add_action( 'after_setup_theme', '\Mediavine\Grow\register_flags' ); // Setup compatibility hooks. add_action( 'wp_head', [ 'Mediavine\Grow\Compatibility', 'disable_known_meta_tags' ], 1 ); add_action( 'wp', [ 'Mediavine\Grow\Compatibility', 'set_yoast_meta_data' ], 10 ); add_action( 'mv_grow_meta_tag_hook', [ 'Mediavine\Grow\Compatibility', 'set_yoast_meta_tag_hook' ], 10 ); $this->settings_api = \Mediavine\Grow\Settings_API::get_instance(); $this->setup_integrations(); $this->setup_free_tools(); $this->asset_loader = \Mediavine\Grow\Asset_Loader::get_instance(); $this->frontend_data = \Mediavine\Grow\Frontend_Data::get_instance(); $this->networks = \Mediavine\Grow\Networks::get_instance(); $this->icons = \Mediavine\Grow\Icons::get_instance(); // Meta tags add_action( apply_filters( 'mv_grow_meta_tag_hook', 'wp_head' ), [ 'Mediavine\Grow\Meta_Tags', 'build_and_output' ], 1 ); // Activation & deativation hooks. register_activation_hook( mv_grow_get_activation_path(), 'dpsp_default_settings' ); register_activation_hook( mv_grow_get_activation_path(), 'dpsp_set_cron_jobs' ); register_deactivation_hook( mv_grow_get_activation_path(), 'dpsp_stop_cron_jobs' ); add_action( 'init', [ $this, 'init_translation' ] ); add_action( 'admin_menu', [ $this, 'add_main_menu_page' ], 10 ); add_action( 'admin_menu', [ $this, 'remove_main_menu_page' ], 25 ); add_action( 'admin_enqueue_scripts', [ $this, 'init_admin_scripts' ], 100 ); add_action( 'wp_enqueue_scripts', [ $this->asset_loader, 'register_front_end_scripts' ] ); add_action( 'wp_enqueue_scripts', [ $this->asset_loader, 'enqueue_scripts' ] ); add_action( 'wp_footer', [ $this->asset_loader, 'maybe_dequeue' ] ); add_action( 'admin_init', [ $this, 'update_database' ] ); add_filter( 'body_class', [ $this, 'add_body_class' ] ); // Add a class to the admin body to tell plugin pages apart add_filter( 'admin_body_class', [ $this, 'admin_body_class' ] ); add_filter( 'plugin_action_links_' . MV_GROW_PLUGIN_BASENAME, [ $this, 'add_plugin_action_links' ] ); // Not sure why this is in a hook, so I'm leaving it for now, but this should be looked into. // TODO: It's also in the regular `init` hook, so not sure why it's called `load_resources_admin` - STA add_action( 'init', [ $this, 'load_resources_admin' ] ); // Hook registration in functions files. dpsp_register_functions(); dpsp_register_functions_admin(); dpsp_register_functions_cron(); dpsp_register_functions_mobile(); dpsp_register_functions_post(); dpsp_register_functions_share_counts(); dpsp_register_functions_tools(); // Hook registration in tools files. dpsp_register_floating_sidebar(); dpsp_register_inline_content(); // Hook registration in admin files. dpsp_register_admin_metaboxes(); dpsp_register_admin_widgets(); dpsp_register_admin_debugger(); dpsp_register_admin_settings(); dpsp_register_admin_toolkit(); // Version-specific feature registration. if ( class_exists( '\Mediavine\Grow\Shortcodes' ) && ! self::is_free() ) { $this->register_pro_features(); } else { $this->register_free_features(); } // This must happen after register_free_features() otherwise pro notices will show up on free $this->admin_notices = \Mediavine\Grow\Admin_Notices::get_instance(); } /** * Register Pro-only features. */ public function register_pro_features() { dpsp_register_functions_version_update(); \Mediavine\Grow\Shortcodes::register_shortcodes(); \Mediavine\Grow\Activation::get_instance(); \Mediavine\Grow\Data_Sync::get_instance(); $this->setup_pro_tools(); add_action( 'admin_init', 'Mediavine\Grow\Intercom::get_instance' ); // Register Gutenberg editor assets add_action( 'enqueue_block_editor_assets', [ $this, 'init_gutenberg_scripts' ] ); dpsp_register_follow_widget(); dpsp_register_import_export(); dpsp_register_link_shortening(); dpsp_register_link_shortening_bitly(); dpsp_register_link_shortening_branch(); dpsp_register_social_shares_recovery(); dpsp_register_utm_tracking(); dpsp_register_click_tweet(); dpsp_register_images_pinterest(); dpsp_register_pop_up(); dpsp_register_sticky_bar(); } /** * Register Free-only features. */ public function register_free_features() { add_action( 'dpsp_enqueue_admin_scripts', 'dpsp_enqueue_admin_scripts_feedback' ); //add_action( 'admin_footer', 'dpsp_output_feedback_form' ); //add_action( 'wp_ajax_dpsp_ajax_send_feedback', 'dpsp_ajax_send_feedback' ); add_action( 'dpsp_submenu_page_bottom', 'dpsp_add_submenu_page_sidebar' ); add_action( 'admin_menu', 'dpsp_register_extensions_subpage', 102 ); add_filter( 'mv_grow_is_free', '__return_true' ); } /** * Integrations bootstrap. */ public function setup_integrations() { $integration_container = \Mediavine\Grow\Integrations\Container::get_instance(); $integration_container->add_integrations( [ \Mediavine\Grow\Integrations\MV_Trellis::get_instance(), \Mediavine\Grow\Integrations\MV_Create::get_instance(), ] ); } /** * Register all tool classes with the main class */ public function setup_pro_tools() { $tool_container = \Mediavine\Grow\Tools\Toolkit::get_instance(); $tools = [ new \Mediavine\Grow\Tools\Pop_Up(), new \Mediavine\Grow\Tools\Pinterest(), new \Mediavine\Grow\Tools\Floating_Sidebar(), new \Mediavine\Grow\Tools\Import_Export(), new \Mediavine\Grow\Tools\Follow_Widget(), new \Mediavine\Grow\Tools\Sticky_Bar(), ]; $tool_container->add( $tools ); foreach ( $tools as $tool ) { $this->settings_api->register_setting( $tool ); } $this->tools = $tool_container; } /** * Register all tool classes available with free version */ public function setup_free_tools() { $tool_container = \Mediavine\Grow\Tools\Toolkit::get_instance(); $tools = [ new \Mediavine\Grow\Tools\Inline_Content(), new \Mediavine\Grow\Tools\Floating_Sidebar(), ]; $tool_container->add( $tools ); foreach ( $tools as $tool ) { $this->settings_api->register_setting( $tool ); } $this->tools = $tool_container; } public static function assets_url() { return plugin_dir_url( __FILE__ ); } public function add_body_class( $body_classes ) { $active_tools = Mediavine\Grow\Settings::get_setting( 'dpsp_active_tools' ); if ( in_array( 'share_sidebar', $active_tools, true ) && ! in_array( 'has_grow_sidebar', $body_classes, true ) ) { $body_classes[] = 'has-grow-sidebar'; $sidebar_settings = Mediavine\Grow\Settings::get_setting( 'dpsp_location_sidebar', 'not_set' ); if ( isset( $sidebar_settings['display']['show_mobile'] ) ) { $body_classes[] = 'has-grow-sidebar-mobile'; } } return $body_classes; } /** * Loads the translations files if they exist * */ public function init_translation() { load_plugin_textdomain( DPSP_TRANSLATION_TEXTDOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/translations' ); } /** * Add the main menu page * */ public function add_main_menu_page() { add_menu_page( __( 'Grow Social by Mediavine', 'social-pug' ), __( 'Grow', 'social-pug' ), 'manage_options', 'dpsp-social-pug', '', 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyMCAyMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjAgMjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojMjMxRjIwO30KPC9zdHlsZT4KPGc+Cgk8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMC4wOSw3LjE1Yy0wLjAzLDAuMTktMC42Niw0Ljc0LDEuODksNy4yOWMxLjcsMS43MSw0LjMsMi4wMSw1Ljg5LDIuMDFjMC4zNywwLDAuNjgtMC4wMiwwLjkyLTAuMDMKCQljLTAuNDctMC4xNS0xLjM1LTAuNDYtMi4zLTAuOTlDNS43MSwxNSw1LjAyLDE0LjUsNC40NSwxMy45NmMtMC43Mi0wLjY5LTEuMjYtMS40NS0xLjYtMi4yN0MyLjQ5LDEwLjgxLDIuMzQsOS44MiwyLjQsOC43NQoJCWMwLjA0LTAuNzksMC4yLTEuNjMsMC40OC0yLjVjLTAuMi0wLjAxLTAuMzktMC4wMS0wLjU3LTAuMD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uMDFDMTguMDIsOS40MSwxNy45MSwxMS43NCwxNi41NywxMy4xeiIvPgo8L2c+Cjwvc3ZnPgo=' ); } /** * Remove the main menu page as we will rely only on submenu pages * */ public function remove_main_menu_page() { remove_submenu_page( 'dpsp-social-pug', 'dpsp-social-pug' ); } /** * Enqueue scripts and styles for the admin dashboard * */ public function init_admin_scripts( $hook ) { if ( strpos( $hook, 'dpsp' ) !== false ) { wp_register_script( 'select2-js', DPSP_PLUGIN_DIR_URL . 'assets/libs/select2/select2.min.js', [ 'jquery' ] ); wp_enqueue_script( 'select2-js' ); wp_register_style( 'select2-css', DPSP_PLUGIN_DIR_URL . 'assets/libs/select2/select2.min.css' ); wp_enqueue_style( 'select2-css' ); wp_register_script( 'dpsp-touch-punch-js', plugin_dir_url( __FILE__ ) . 'assets/dist/jquery.ui.touch-punch.min.' . self::$VERSION . '.js', [ 'jquery-ui-sortable', 'jquery', ] ); wp_enqueue_script( 'dpsp-touch-punch-js' ); wp_enqueue_script( 'wp-color-picker' ); wp_enqueue_style( 'wp-color-picker' ); } wp_register_style( 'dpsp-dashboard-style-pro', DPSP_PLUGIN_DIR_URL . 'assets/dist/style-dashboard-pro.' . self::$VERSION . '.css', [], self::$VERSION ); wp_enqueue_style( 'dpsp-dashboard-style-pro' ); wp_register_script( 'dpsp-dashboard-js-pro', DPSP_PLUGIN_DIR_URL . 'assets/dist/dashboard-pro.' . self::$VERSION . '.js', [ 'jquery-ui-sortable', 'jquery', ], self::$VERSION ); wp_enqueue_script( 'dpsp-dashboard-js-pro' ); wp_register_style( 'dpsp-frontend-style-pro', DPSP_PLUGIN_DIR_URL . 'assets/dist/style-frontend-pro.' . self::$VERSION . '.css', [], self::$VERSION ); wp_enqueue_style( 'dpsp-frontend-style-pro' ); } /** * Enqueue scripts that are Gutenberg specific * */ public function init_gutenberg_scripts() { $IS_DEVELOPMENT = apply_filters( 'mv_grow_dev_mode', false ); $script_url = $IS_DEVELOPMENT ? DPSP_PLUGIN_DIR_URL . 'assets/dist/dev-entry.js' : DPSP_PLUGIN_DIR_URL . 'assets/dist/block-editor.' . self::$VERSION . '.js'; wp_enqueue_script( 'dpsp-block-editor', $script_url, [ 'wp-components', 'wp-blocks', 'wp-compose', 'wp-editor', 'wp-element', 'wp-i18n', ], self::$VERSION ); } /** * Fallback for setting defaults when updating the plugin, * as register_activation_hook does not fire for automatic updates * */ public function update_database() { $dpsp_db_version = Mediavine\Grow\Settings::get_setting( 'dpsp_version', '' ); if ( self::$VERSION !== $dpsp_db_version ) { dpsp_default_settings(); update_option( 'dpsp_version', self::$VERSION ); // Add first time activation if ( '' === Mediavine\Grow\Settings::get_setting( 'dpsp_first_activation', '' ) ) { update_option( 'dpsp_first_activation', time() ); /** * Do extra actions on plugin's first ever activation * */ do_action( 'dpsp_first_activation' ); } // Update Sidebar button style from 1,2,3 to 1,5,8 $dpsp_location_sidebar = dpsp_get_location_settings( 'sidebar' ); if ( '2' === $dpsp_location_sidebar['button_style'] ) { $dpsp_location_sidebar['button_style'] = 5; } if ( '3' === $dpsp_location_sidebar['button_style'] ) { $dpsp_location_sidebar['button_style'] = 8; } update_option( 'dpsp_location_sidebar', $dpsp_location_sidebar ); /** * Do extra database updates on plugin update * * @param string $dpsp_db_version - the previous version of the plugin * @param string DPSP_VERSION - the new (current) version of the plugin * */ do_action( 'dpsp_update_database', $dpsp_db_version, self::$VERSION ); } } /** * Add custom plugin CSS classes to the admin body classes * */ public function admin_body_class( $classes ) { $page = filter_input( INPUT_GET, 'page' ); if ( empty( $page ) ) { return $classes; } if ( false === strpos( $page, 'dpsp-' ) ) { return $classes; } return $classes . ' dpsp-pagestyles'; } /** * Add extra action links in the plugins page * */ public function add_plugin_action_links( $links ) { $links[] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=dpsp-toolkit' ) ) . '">' . __( 'Settings', 'social-pug' ) . '</a>'; return $links; } /** * Include plugin files for the admin area */ public function load_resources_admin() { $this->setup_integrations(); } /** * Whether or not this instance of the plugin is free * @return bool */ public static function is_free() { return (bool) apply_filters( 'mv_grow_is_free', false ); } /** * Return the branding name based on free vs pro * * @return string */ public static function get_branding_name() { if ( Social_Pug::is_free() ) { return __( 'Grow Social by Mediavine', 'social-pug' ); } return __( 'Grow Social Pro by Mediavine', 'social-pug' ); } }