Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
wp-content
/
plugins
/
social-pug
:
index.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php /** * Plugin Name: Grow by Mediavine * Plugin URI: https://marketplace.mediavine.com/grow-social-pro/ * Description: Add beautiful social sharing buttons to your posts, pages and custom post types. * Version: 1.7.0 * Author: Mediavine * Author URI: https://marketplace.mediavine.com/ * Text Domain: social-pug * Domain Path: /translations/ * License: GPL2 * * == Copyright == * Copyright 2016 Mediavine (www.mediavine.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ Class Social_Pug { /* * The Constructor * */ public function __construct() { // Defining constants define('DPSP_VERSION', '1.7.0'); define('DPSP_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename(__FILE__) ) ); define('DPSP_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ) ); define('DPSP_TRANSLATION_DIR', DPSP_PLUGIN_DIR . '/translations' ); define('DPSP_TRANSLATION_TEXTDOMAIN', 'social-pug' ); // Hooks add_action( 'init', array( $this, 'init_translation' ) ); add_action( 'admin_menu', array( $this, 'add_main_menu_page' ), 10 ); add_action( 'admin_menu', array( $this, 'remove_main_menu_page' ), 11 ); add_action( 'admin_enqueue_scripts', array( $this, 'init_admin_scripts' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'init_front_end_scripts' ) ); add_action( 'admin_init', array( $this, 'update_database' ) ); add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ) ); add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_plugin_action_links' ) ); $this->load_resources_front_end(); add_action( 'init', array( $this, 'load_resources_admin' ) ); } /* * Loads the translations files if they exist * */ public function init_translation() { load_plugin_textdomain( 'social-pug', false, DPSP_TRANSLATION_DIR ); } /* * Add the main menu page * */ public function add_main_menu_page() { add_menu_page( __('Grow', 'social-pug'), __('Grow', 'social-pug'), 'manage_options', 'dpsp-social-pug', '','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI0LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAyMCAyMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjAgMjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojMjMxRjIwO30KPC9zdHlsZT4KPGc+Cgk8cGF0aCBjbGFzcz0ic3QwIiBkPSJNMC4wOSw3LjE1Yy0wLjAzLDAuMTktMC42Niw0Ljc0LDEuODksNy4yOWMxLjcsMS43MSw0LjMsMi4wMSw1Ljg5LDIuMDFjMC4zNywwLDAuNjgtMC4wMiwwLjkyLTAuMDMKCQljLTAuNDctMC4xNS0xLjM1LTAuNDYtMi4zLTAuOTlDNS43MSwxNSw1LjAyLDE0LjUsNC40NSwxMy45NmMtMC43Mi0wLjY5LTEuMjYtMS40NS0xLjYtMi4y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wLjM0LTAuMDFjLTAuMDYtMS4zNiwwLjE0LTMuNjIsMS40LTQuODljMS4yMi0xLjI0LDMuMjctMS40NSw0LjU0LTEuNDUKCQljMC4xMiwwLDAuMjMsMCwwLjM0LDAuMDFDMTguMDIsOS40MSwxNy45MSwxMS43NCwxNi41NywxMy4xeiIvPgo8L2c+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 ) { // TODO: Replace this with .env check. $VERSION = '1.0.0'; if( strpos( $hook, 'dpsp' ) !== false ) { wp_register_script( 'select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js', array( 'jquery' ) ); wp_enqueue_script( 'select2-js' ); wp_register_style( 'select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/css/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.$VERSION.js", array('jquery-ui-sortable', 'jquery' ) ); wp_enqueue_script( 'dpsp-touch-punch-js' ); } wp_register_style( 'dpsp-dashboard-style', plugin_dir_url( __FILE__ ) . "assets/dist/style-dashboard.$VERSION.css", array(), DPSP_VERSION ); wp_enqueue_style( 'dpsp-dashboard-style' ); wp_register_script( 'dpsp-dashboard-js' , plugin_dir_url( __FILE__ ) . "assets/dist/dashboard.$VERSION.js", array( 'jquery' ), DPSP_VERSION ); wp_enqueue_script( 'dpsp-dashboard-js' ); wp_register_style( 'dpsp-frontend-style', plugin_dir_url( __FILE__ ) . "assets/dist/style-frontend.$VERSION.css", array(), DPSP_VERSION ); wp_enqueue_style( 'dpsp-frontend-style' ); /** * Enqueue additional admin scripts * */ do_action( 'dpsp_enqueue_admin_scripts' ); } /* * Enqueue scripts for the front-end * */ public function init_front_end_scripts() { // TODO: Replace this with Mediavine Development Plugin stuff. $IS_DEVELOPMENT = false; // TODO: Replace this with .env check. $VERSION = "1.0.0"; $settings = get_option('dpsp_settings'); if ( $IS_DEVELOPMENT ) { if( isset($settings['optimize_javascript']) && $settings['optimize_javascript'] ) { wp_register_style( 'mv-grow-frontend-style', plugin_dir_url( __FILE__ ) . "assets/dist/dev-entry.css" ); wp_enqueue_style( 'mv-grow-frontend-style' ); wp_register_script( 'mv-grow-frontend-bundled-js', plugin_dir_url( __FILE__ ) . 'assets/dist/dev-entry.js', array(), null, true ); wp_enqueue_script( 'mv-grow-frontend-bundled-js' ); } else { wp_register_style( 'mv-grow-frontend-style', plugin_dir_url( __FILE__ ) . "assets/dist/dev-entry-jquery.css" ); wp_enqueue_style( 'mv-grow-frontend-style' ); wp_register_script( 'mv-grow-frontend-bundled-js', plugin_dir_url( __FILE__ ) . 'assets/dist/dev-entry-jquery.js', array('jquery'), null, true ); wp_enqueue_script( 'mv-grow-frontend-bundled-js' ); } } else { if( isset($settings['optimize_javascript']) && $settings['optimize_javascript'] ) { wp_register_style( 'mv-grow-frontend-style', plugin_dir_url( __FILE__ ) . "assets/dist/style-frontend.$VERSION.css" ); wp_enqueue_style( 'mv-grow-frontend-style' ); wp_register_script( 'mv-grow-frontend-js', plugin_dir_url( __FILE__ ) . "assets/dist/front-end.$VERSION.js", array(), null, true); wp_enqueue_script( 'mv-grow-frontend-js' ); } else { wp_register_style( 'mv-grow-frontend-style', plugin_dir_url( __FILE__ ) . "assets/dist/style-frontend-jquery.$VERSION.css" ); wp_enqueue_style( 'mv-grow-frontend-style' ); wp_register_script( 'mv-grow-frontend-js', plugin_dir_url( __FILE__ ) . "assets/dist/front-end-jquery.$VERSION.js", array('jquery'), null, true ); wp_enqueue_script( 'mv-grow-frontend-js' ); } } } /* * 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 = get_option( 'dpsp_version', '' ); if( $dpsp_db_version != DPSP_VERSION ) { // Update default settings dpsp_default_settings(); update_option( 'dpsp_version', DPSP_VERSION ); // Add first time activation if( get_option( 'dpsp_first_activation', '' ) == '' ) update_option( 'dpsp_first_activation', time() ); else update_option( 'dpsp_welcome_screen_got_it', 1 ); /** * 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, DPSP_VERSION ); } } /* * Replace admin footer text with a rate plugin message * */ public function admin_footer_text( $text ) { if( isset( $_GET['page'] ) && strpos( $_GET['page'], 'dpsp' ) !== false ) { return sprintf( __( 'If you enjoy using <strong>Grow by Mediavine</strong>, please <a href="%s" target="_blank">leave us a ★★★★★ rating</a>. Big thank you for this!', 'social-pug' ), 'https://wordpress.org/support/view/plugin-reviews/social-pug?rate=5#postform' ); } return $text; } /* * 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 front-end * */ public function load_resources_front_end() { // Database version update file if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions-version-update.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions-version-update.php' ); // Functions if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions.php' ); // Share counts functions if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions-share-counts.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions-share-counts.php' ); // Cron jobs if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions-cron.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions-cron.php' ); // Frontend rendering if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions-frontend.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions-frontend.php' ); } /* * Include plugin files for the admin area * */ public function load_resources_admin() { // Admin functions and pages if( file_exists( DPSP_PLUGIN_DIR . '/inc/functions-admin.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/functions-admin.php' ); if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-toolkit.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-toolkit.php' ); // Network locations admin pages $network_locations = dpsp_get_network_locations(); foreach( $network_locations as $location_slug ) { if( dpsp_is_location_active( $location_slug ) ) { if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-' . str_replace( '_','-', $location_slug ) . '.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-' . str_replace( '_','-', $location_slug ) . '.php' ); } } if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-settings.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-settings.php' ); if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-extensions.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/submenu-page-extensions.php' ); // Feedback form if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/feedback-form/functions.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/feedback-form/functions.php' ); if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/feedback-form/functions-ajax.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/feedback-form/functions-ajax.php' ); // Admin extras if( file_exists( DPSP_PLUGIN_DIR . '/inc/admin/admin-metaboxes.php' ) ) include_once( DPSP_PLUGIN_DIR . '/inc/admin/admin-metaboxes.php' ); } } // Let's get the party started new Social_Pug; /* * Activation hooks * */ register_activation_hook( __FILE__, 'dpsp_default_settings' ); register_activation_hook( __FILE__, 'dpsp_set_cron_jobs' ); /* * Deactivation hooks * */ register_deactivation_hook( __FILE__, 'dpsp_stop_cron_jobs' );