Пример #1
0
/**
 * Add rating links to the admin dashboard
 *
 * @since	    1.0.0
 * @global		string $typenow
 * @param       string $footer_text The existing footer text
 * @return      string
 */
function mashsb_admin_rate_us($footer_text)
{
    global $typenow;
    if (mashsb_is_admin_page()) {
        $rate_text = sprintf(__('Thank you for using <a href="%1$s" target="_blank">Mashshare</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a> and help to support this project.<br>Something not working as expected or need help for customizing Mashshare? Read our <a href="https://www.mashshare.net/faq/" target="blank">FAQ</a> and visit the Mashshare <a href="https://mashshare.net/support" target="blank">Support Forum</a>', 'mashsb'), 'https://www.mashshare.net', 'http://wordpress.org/support/view/plugin-reviews/mashsharer?filter=5#postform');
        return str_replace('</span>', '', '') . $rate_text . '</span>';
    } else {
        return $footer_text;
    }
}
Пример #2
0
/**
 * Add rating links to the settings footer
 *
 * @since	1.0.0
 * @return      string
 */
function mashsb_admin_rate_us()
{
    if (mashsb_is_admin_page()) {
        //		$rate_text = sprintf( __( 'Thank you for using <a href="%1$s" target="_blank">Mashshare</a>! Please <a href="%2$s" target="_blank">rate us</a> on <a href="%2$s" target="_blank">WordPress.org</a> and help to support this project.<br>Something not working as expected or need help? Read our <a href="%3$s" target="blank">Documentation</a>', 'mashsb' ),
        //			'https://www.mashshare.net',
        //			'http://wordpress.org/support/view/plugin-reviews/mashsharer?filter=5#postform',
        //			'http://docs.mashshare.net/'
        //		);
        $rate_text = sprintf(__('Please do us a BIG favor and give us a 5 star rating <a href="%1$s" target="blank">here.</a> Need help? Read our <a href="%2$s" target="blank">Documentation</a><br>If you`re not happy, please <a href="%3$s" target="blank">get in touch with us</a>, so that we can sort it out. Thank you!', 'mashsb'), 'http://wordpress.org/support/view/plugin-reviews/mashsharer?filter=5#postform', 'http://docs.mashshare.net/', 'https://www.mashshare.net/contact-developer/');
        return $rate_text;
    }
}
Пример #3
0
/**
 * Load Admin Scripts
 *
 * Enqueues the required admin scripts.
 *
 * @since 1.0
 * @global $post
 * @param string $hook Page hook
 * @return void
 */
function mashsb_load_admin_scripts($hook)
{
    if (!apply_filters('mashsb_load_admin_scripts', mashsb_is_admin_page(), $hook)) {
        return;
    }
    global $wp_version;
    $js_dir = MASHSB_PLUGIN_URL . 'assets/js/';
    $css_dir = MASHSB_PLUGIN_URL . 'assets/css/';
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = mashsbIsDebugMode() ? '' : '.min';
    //$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
    //echo $css_dir . 'mashsb-admin' . $suffix . '.css', MASHSB_VERSION;
    // These have to be global
    wp_enqueue_script('mashsb-admin-scripts', $js_dir . 'mashsb-admin' . $suffix . '.js', array('jquery'), MASHSB_VERSION, false);
    wp_enqueue_script('jquery-ui-sortable');
    wp_enqueue_script('media-upload');
    //Provides all the functions needed to upload, validate and give format to files.
    wp_enqueue_script('thickbox');
    //Responsible for managing the modal window.
    wp_enqueue_style('thickbox');
    //Provides the styles needed for this window.
    wp_enqueue_style('mashsb-admin', $css_dir . 'mashsb-admin' . $suffix . '.css', MASHSB_VERSION);
}
Пример #4
0
/**
 * Return update notice 101
 * @since 3.2.0
 */
function mashsb_update_notice_101()
{
    if (!mashsb_is_admin_page()) {
        return false;
    }
    $notice_id = '101';
    //unique id of our notice
    $message = sprintf(__('Admin notices are pain but read this one or you will miss how to fix your facebook share counts in MashShare: <p><strong style="font-weight:bold;">Go to <a href="%1s">Settings->Networks</a> and request your access token via facebook login - That\'s all. ' . '<a href="#" id="mashsb_notice_101_resp"> Whats also new? </a> </strong>' . '<div style="display:none;" id="mashsb_notice_101_more">' . '<ul style="font-weight:600;">' . '<li>- Full Width Responsive Buttons (Enable them from <a href="%2s">Visual Setting</a>)<li>' . '<li>- Most Shared Posts Widget incl. Thumbnails</li>' . '<li>- Cumulate Http(s) Shares - Move your site to ssl without loosing shares</li>' . '</div>', 'mashsb'), admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsservices_header', admin_url() . 'admin.php?page=mashsb-settings#mashsb_settingsstyle_header');
    if (get_option('mashsb_update_notice_' . $notice_id) === 'yes') {
        // admin notice after updating Mashshare
        echo '<div class="mashsb_update_notice_' . $notice_id . ' update-nag">' . $message . '<p><a href="javascript:void(0);" class="mashsb_hide_' . $notice_id . '" title="I got it" style="text-decoration:none;">- Ok, Do Not Show Again</a></a>' . '</div>' . '<script>
    jQuery( document ).ready(function( $ ) {
        jQuery(\'.mashsb_hide_' . $notice_id . '\').click(function(){
            var data={
            \'action\':\'mashsb_hide_notice\',
            \'id\':\'101\',
            }
            jQuery.ajax({
                url: "' . admin_url('admin-ajax.php') . '",
                type: "post",
                data: data,
                dataType: "json",
                async: !0,
                success: function(e) {
                    if (e=="success") {
                       jQuery(\'.mashsb_update_notice_' . $notice_id . '\').hide();	   
                    }
                }
            });
        })
        jQuery(\'#mashsb_notice_101_resp\').click(function(e){
        e.preventDefault();
            jQuery(\'#mashsb_notice_101_more\').show()
        });
        
});
    </script>';
    }
}
Пример #5
0
/**
 * Load Admin Scripts
 *
 * Enqueues the required admin scripts.
 *
 * @since 1.0
 * @global $post
 * @param string $hook Page hook
 * @return string custom css into
 */
function mashsb_load_admin_scripts($hook)
{
    if (!apply_filters('mashsb_load_admin_scripts', mashsb_is_admin_page(), $hook)) {
        return;
    }
    global $mashsb_options;
    $js_dir = MASHSB_PLUGIN_URL . 'assets/js/';
    $css_dir = MASHSB_PLUGIN_URL . 'assets/css/';
    // Use minified libraries if Mashshare debug mode is turned off
    $suffix = mashsbIsDebugMode() ? '' : '.min';
    wp_enqueue_script('mashsb-admin-scripts', $js_dir . 'mashsb-admin' . $suffix . '.js', array('jquery'), MASHSB_VERSION, false);
    wp_enqueue_script('jquery-ui-sortable');
    wp_enqueue_script('media-upload');
    //Provides all the functions needed to upload, validate and give format to files.
    wp_enqueue_script('thickbox');
    //Responsible for managing the modal window.
    wp_enqueue_style('thickbox');
    //Provides the styles needed for this window.
    wp_enqueue_style('mashsb-admin', $css_dir . 'mashsb-admin' . $suffix . '.css', MASHSB_VERSION);
    wp_register_style('jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), MASHSB_VERSION);
    wp_enqueue_style('jquery-chosen');
    wp_register_script('jquery-chosen', $js_dir . 'chosen.jquery' . $suffix . '.js', array('jquery'), MASHSB_VERSION);
    wp_enqueue_script('jquery-chosen');
}
Пример #6
0
function mashsb_ratelimit_callback()
{
    global $mashsb_options;
    if (!mashsb_is_admin_page() || !isset($mashsb_options['debug_mode']) || !function_exists('curl_init')) {
        return '';
    }
    $url = 'http://graph.facebook.com/?id=http://www.google.com';
    //$url = 'http://graph.facebook.com/';
    $curl_handle = curl_init();
    curl_setopt($curl_handle, CURLOPT_URL, $url);
    curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
    curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
    $buffer = curl_exec($curl_handle);
    curl_close($curl_handle);
    if (empty($buffer)) {
        print "Nothing returned from url.<p>";
    } else {
        print '<div style="max-width:200px;">' . $buffer . '</div>';
    }
}