Current Path : /var/test/www/ya/wp-content/plugins/meanthemes-tools/ |
Current File : /var/test/www/ya/wp-content/plugins/meanthemes-tools/meanthemes-tools.php |
<?php /* Plugin Name: MeanThemes Tools Plugin URI: http://www.meanthemes.com/plugins/meanthemes-tools/ Description: Enhance your MeanThemes Themes. Version: 3.0.6 Author: MeanThemes Author URI: http://www.meanthemes.com */ // // Language Translation // function meanthemessocial_load_textdomain() { load_plugin_textdomain( 'meanthemes', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); } add_action( 'init', 'meanthemessocial_load_textdomain' ); // // Add admin page // include_once 'settings/options-page.php'; // // Add settings link // function meanthemes_tools_settings_link($links) { $settings_link = '<a href="options-general.php?page=meanthemes_tools">' . __('Settings','meanthemes') .'</a>'; array_unshift($links, $settings_link); return $links; } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'meanthemes_tools_settings_link' ); // // Include Custom Post Types // include_once 'custom-post-type/portfolio.php'; include_once 'custom-post-type/book.php'; include_once 'custom-post-type/team.php'; include_once 'custom-post-type/service.php'; include_once 'custom-post-type/homepage-items.php'; include_once 'custom-post-type/testimonial.php'; include_once 'custom-post-type/slider.php'; include_once 'custom-post-type/logo.php'; include_once 'custom-post-type/event.php'; // // Include Shortcodes // include_once 'include/shortcodes.php'; // // Include Custom Meta // include_once 'include/custom-meta.php'; // // Include Widgets // include_once 'include/widgets.php'; // // Include Custom Fields for Authors // include_once 'include/author.php'; // // Include Enhancements // include_once 'include/enhance.php'; // // Load front end scripts // add_action( 'wp_enqueue_scripts', 'meanthemes_tools_load_css' ); function meanthemes_tools_load_css() { // Font Awesome, de-register first for any other plugin using it, then enqueue local copy wp_deregister_style( 'font-awesome' ); wp_enqueue_style( 'font-awesome', plugin_dir_url( __FILE__ ) . 'assets/css/font-awesome.min.css', array(), '4.7.0', 'screen' ); } // Inline styles for faster page render function meanthemes_fa_social_css() { $css_img_base = plugin_dir_url( __FILE__ ) . 'assets/img/'; ?> <style type="text/css"> .social-fa {padding: 0 4px;vertical-align:middle;}.social-fa .fa {text-indent: 0;font-size: 14px;font-size: 1.4rem;line-height: 10px;color:#000; -o-transition: opacity 0.5s ease-in;-webkit-transition: opacity 0.5s ease-in;-moz-transition: opacity 0.5s ease-in;transition: opacity 0.5s ease-in;opacity: 0.5;filter: alpha(opacity=50);}.social-fa:hover .fa {opacity: 0.9;filter: alpha(opacity=90);}.social-fa.white .fa {color:#fff;}.social-fa .fa .i {position: absolute; left: -99999px; font-size: 0;} a.social.snapchat { background: url(<?php echo esc_url( $css_img_base ); ?>social-snapchat-black.png) 0 0 no-repeat;} a.social.white.snapchat { background: url(<?php echo esc_url( $css_img_base ); ?>social-snapchat-white.png) 0 0 no-repeat;} @media only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 1.5/1), only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-device-pixel-ratio: 1.5) { a.social.snapchat { background: url(<?php echo esc_url( $css_img_base ); ?>social-snapchat-black@2x.png) 0 0 no-repeat;background-size: 21px 21px;} a.social.white.snapchat { background: url(<?php echo esc_url( $css_img_base ); ?>social-snapchat-white@2x.png) 0 0 no-repeat;background-size: 21px 21px;} } </style> <?php } add_action( 'wp_head', 'meanthemes_fa_social_css' ); // // Automatic Plugin Updates // require 'plugin-updates/plugin-update-checker.php'; $MyUpdateChecker = PucFactory::buildUpdateChecker( 'http://www.meanthemes.com/plugin-updates/meanthemes-tools.json', __FILE__, 'meanthemes-tools' ); // // Rewrite rules on plugin activation/deactivation // register_activation_hook(__FILE__, 'meanthemes_tools_activate'); add_action('admin_init', 'meanthemes_tools_redirect'); function meanthemes_tools_activate() { add_option('meanthemes_tools_do_activation_redirect', true); } function meanthemes_tools_redirect() { if (get_option('meanthemes_tools_do_activation_redirect', false)) { delete_option('meanthemes_tools_do_activation_redirect'); if(!isset($_GET['activate-multi'])) { exit( wp_redirect( admin_url( 'options-general.php?page=meanthemes_tools' ) ) ); } } } register_deactivation_hook( __FILE__, 'meanthemes_tools_deactivate' ); function meanthemes_tools_deactivate() { flush_rewrite_rules(); } // Update nag for updates... /* Display a notice that can be dismissed */ /* add_action('admin_notices', 'update_admin_notice'); function update_admin_notice() { global $current_user ; $user_id = $current_user->ID; // Check that the user hasn't already clicked to ignore the message if ( ! get_user_meta($user_id, 'update_ignore_notice') ) { echo '<div class="updated settings-error notice is-dismissible"><p>'; printf(__('<p>Thanks for using MeanThemes Tools, please visit <a href="/wp-admin/options-general.php?page=meanthemes_tools">MeanThemes Tools settings</a> to set up your permalinks for your MeanThemes custom post types.<a href="%1$s"><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></a></p><p><strong>Don\'t forget... </strong>to sign up for the <a href="http://www.meanthemes.com/sign-up/" target="_blank">MeanThemes Newsletter</a> for updates on new themes, freebies and WordPress, HTML and CSS tips.</p>'), '?update_nag_ignore=0'); echo "<p></p></div>"; } } add_action('admin_init', 'update_nag_ignore'); function update_nag_ignore() { global $current_user; $user_id = $current_user->ID; // If user clicks to ignore the notice, add that to their user meta if ( isset($_GET['update_nag_ignore']) && '0' == $_GET['update_nag_ignore'] ) { add_user_meta($user_id, 'update_ignore_notice', 'true', true); } } */ add_action('admin_notices', 'mt_update_admin_notice_20012017'); function mt_update_admin_notice_20012017() { global $current_user ; $user_id = $current_user->ID; /* Check that the user hasn't already clicked to ignore the message */ if ( ! get_user_meta($user_id, 'mt_update_ignore_notice_20012017') ) { $mt_tools_link = get_admin_url() . 'options-general.php?page=meanthemes_tools'; echo '<div class="updated notice"><p>'; printf(__('<p>Thanks for using MeanThemes Tools, please visit <a href="'.$mt_tools_link.'">MeanThemes Tools settings</a> to set up your permalinks for your MeanThemes custom post types.</p><p><strong>Don\'t forget... </strong>to sign up for the <a href="http://www.meanthemes.com/sign-up/" target="_blank">MeanThemes Newsletter</a> for updates on new themes, freebies and WordPress, HTML and CSS tips.</p><p><a href="%1$s"><strong>Dismiss this notice</strong></a></p>'), '?mt_update_nag_ignore_20012017=0'); echo "</p></div>"; } } add_action('admin_init', 'mt_update_nag_ignore_20012017'); function mt_update_nag_ignore_20012017() { global $current_user; $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset($_GET['mt_update_nag_ignore_20012017']) && '0' == $_GET['mt_update_nag_ignore_20012017'] ) { add_user_meta($user_id, 'mt_update_ignore_notice_20012017', 'true', true); } } // Set responsive images on/off based on MeanThemes Tools settings $options = get_option( 'meanthemes_tools_settings' ); // Check if( (isset($options[ 'meanthemes_tools_responsive_images' ])) && ($options[ 'meanthemes_tools_responsive_images' ]) ) { // Disable srcset everywhere function disable_srcset( $sources ) { return false; } add_filter( 'wp_calculate_image_srcset', 'disable_srcset' ); } ?>