Esempio n. 1
0
function microblogposter_custom_meta($post, $metabox)
{
    $default_pbehavior_value = false;
    $enabled_custom_updates_name = "microblogposter_enabled_custom_updates";
    $enabled_custom_updates_value = get_option($enabled_custom_updates_name, "");
    $enabled_custom_updates = json_decode($enabled_custom_updates_value, true);
    $screen = get_current_screen();
    if ($screen->action != 'add') {
        if (is_array($enabled_custom_updates) && !empty($enabled_custom_updates)) {
            if (in_array($metabox['args']['type'], $enabled_custom_updates)) {
                $default_pbehavior_value = true;
            }
        }
    }
    ?>
    <input type="checkbox" id="microblogposteroff" name="microblogposteroff" <?php 
    if ($default_pbehavior_value) {
        echo 'checked="checked"';
    }
    ?>
 /> 
    <label for="microblogposteroff"><?php 
    _e('Disable Microblog Poster this time?', 'microblog-poster');
    ?>
</label>
    <?php 
    if (MicroblogPoster_Poster::is_method_callable('MicroblogPoster_Poster_Pro', 'show_control_dashboard')) {
        MicroblogPoster_Poster_Pro::show_control_dashboard();
    } else {
        ?>
        <style>
            #mbp_upgrade_notice_div_microblogposter
            {
                margin-top: 10px;
            }
        </style>
        
        <script>
            function mbp_show_upgrade_notice_microblogposter()
            {
                if(jQuery('#mbp_upgrade_notice_div_microblogposter').is(':visible'))
                {
                    jQuery('#mbp_upgrade_notice_div_microblogposter').hide();
                    jQuery('#mbp_upgrade_notice_lnk_microblogposter').html('<?php 
        _e('Show complete Control Dashboard', 'microblog-poster');
        ?>
');
                }
                else
                {
                    jQuery('#mbp_upgrade_notice_div_microblogposter').show();
                    jQuery('#mbp_upgrade_notice_lnk_microblogposter').html('<?php 
        _e('Hide complete Control Dashboard', 'microblog-poster');
        ?>
');
                }    
                
            }
        </script>
        &nbsp;<a href="#" id="mbp_upgrade_notice_lnk_microblogposter" onclick="mbp_show_upgrade_notice_microblogposter();return false;" ><?php 
        _e('Show complete Control Dashboard', 'microblog-poster');
        ?>
</a>
        <div id="mbp_upgrade_notice_div_microblogposter" style="display:none;"><?php 
        _e('Available with the Pro / Enterprise Add-on.', 'microblog-poster');
        ?>
 <a href="http://efficientscripts.com/microblogposterpro" target="_blank"><?php 
        _e('Upgrade Now', 'microblog-poster');
        ?>
</a></div>
        <?php 
    }
}
function microblogposter_custom_meta($post, $metabox)
{
    $default_pbehavior_value = false;
    $pro_control_dash_mode_name = "microblogposter_plg_control_dash_mode";
    $pro_control_dash_mode_value = get_option($pro_control_dash_mode_name, "");
    $enabled_custom_updates_name = "microblogposter_enabled_custom_updates";
    $enabled_custom_updates_value = get_option($enabled_custom_updates_name, "");
    $enabled_custom_updates = json_decode($enabled_custom_updates_value, true);
    $screen = get_current_screen();
    if ($screen->action != 'add') {
        if (is_array($enabled_custom_updates) && !empty($enabled_custom_updates)) {
            if (in_array($metabox['args']['type'], $enabled_custom_updates)) {
                $default_pbehavior_value = true;
            }
        }
    }
    ?>
    <input type="checkbox" id="microblogposteroff" name="microblogposteroff" <?php 
    if ($default_pbehavior_value) {
        echo 'checked="checked"';
    }
    ?>
 /> 
    <label for="microblogposteroff">Disable Microblog Poster this time?</label>
    <?php 
    if (MicroblogPoster_Poster::is_method_callable('MicroblogPoster_Poster_Pro', 'show_control_dashboard') && !$pro_control_dash_mode_value) {
        MicroblogPoster_Poster_Pro::show_control_dashboard();
    } elseif (MicroblogPoster_Poster::is_method_callable('MicroblogPoster_Poster_Pro', 'show_control_dashboard') && $pro_control_dash_mode_value == '1') {
        echo "<br />The Control Dashboard part for checking/unchecking specific accounts is disabled in plugin's settings. MicroblogPoster will cross-post to all your social accounts.";
    } else {
        ?>
        <style>
            #mbp_upgrade_notice_div_microblogposter
            {
                margin-top: 10px;
            }
        </style>
        
        <script>
            function mbp_show_upgrade_notice_microblogposter()
            {
                if(jQuery('#mbp_upgrade_notice_div_microblogposter').is(':visible'))
                {
                    jQuery('#mbp_upgrade_notice_div_microblogposter').hide();
                    jQuery('#mbp_upgrade_notice_lnk_microblogposter').html('Show complete Control Dashboard');
                }
                else
                {
                    jQuery('#mbp_upgrade_notice_div_microblogposter').show();
                    jQuery('#mbp_upgrade_notice_lnk_microblogposter').html('Hide complete Control Dashboard');
                }    
                
            }
        </script>
        &nbsp;<a href="#" id="mbp_upgrade_notice_lnk_microblogposter" onclick="mbp_show_upgrade_notice_microblogposter();return false;" >Show complete Control Dashboard</a>
        <div id="mbp_upgrade_notice_div_microblogposter" style="display:none;">Available with the Pro Add-on. <a href="http://efficientscripts.com/microblogposterpro" target="_blank">Upgrade Now</a></div>
        <?php 
    }
}