Exemplo n.º 1
0
    /**
     * Build Html and die() with response 503
     * 
     */
    public function do_maintenance()
    {
        $level = empty($this->params['maintenance_mode_enable']['level']) ? null : $this->params['maintenance_mode_enable']['level'];
        $ucan = B5F_MTT_Utils::maintenance_user_level($level);
        if (!current_user_can($ucan)) {
            // BROWSER TITLE
            $title = !empty($this->params['maintenance_mode_enable']['title']) ? $this->params['maintenance_mode_enable']['title'] : get_bloginfo('name') . __(' | Maintenance Mode', 'mtt');
            // IMAGES
            $theUrl = B5F_MTT_Init::get_instance()->plugin_url;
            $custom_stripes = $theUrl . 'images/pattern.png';
            $custom_bg = $theUrl . 'images/kub-locked.png';
            // LINE 0
            $siteName = !empty($this->params['maintenance_mode_enable']['line0']) ? $this->params['maintenance_mode_enable']['line0'] : __('Site in maintenance', 'mtt');
            // LINE 1
            $line1Text = !empty($this->params['maintenance_mode_enable']['line1']) ? $this->params['maintenance_mode_enable']['line1'] : '<b>' . get_bloginfo('name') . '</b><br> ' . get_bloginfo('description');
            // LINE 2
            $line2Text = !empty($this->params['maintenance_mode_enable']['line2']) ? $this->params['maintenance_mode_enable']['line2'] : str_replace('http://', '', get_bloginfo('url'));
            // HTML BACKGROUND
            $stripes = !empty($this->params['maintenance_mode_enable']['html_img']['src']) ? $this->params['maintenance_mode_enable']['html_img']['src'] : '';
            if ($stripes != '') {
                $stripes = 'html{background:url(' . $stripes . ') repeat}';
            } else {
                $stripes = 'html{background:url(' . $custom_stripes . ') repeat}';
            }
            // BOX ("body") BACKGROUND
            $box_bg = !empty($this->params['maintenance_mode_enable']['body_img']['src']) ? $this->params['maintenance_mode_enable']['body_img']['src'] : '';
            $box_shadow = '-webkit-border-radius: 23px; border-radius: 23px; -moz-box-shadow: 5px 5px 8px #DCDCDC; -webkit-box-shadow: 5px 5px 8px #DCDCDC; box-shadow: 5px 5px 8px #DCDCDC;';
            if ('' != $box_bg) {
                $box_bg = 'background:url(' . $box_bg . ') no-repeat;';
            } else {
                $box_bg = 'background: rgba(51, 102, 153, 0.75) url(' . $custom_bg . ') no-repeat 30px 30px;';
            }
            // CUSTOM CSS
            if (!empty($this->params['maintenance_mode_enable']['extra_css'])) {
                $extraCss = '.class-name {}' != $this->params['maintenance_mode_enable']['extra_css'] ? $this->params['maintenance_mode_enable']['extra_css'] : '';
            } else {
                $extraCss = '';
            }
            // CSS of this file
            $msg = <<<CSS
<style type="text/css">
\t*{padding:0;margin:0}
\t{$stripes}
\tbody{
\t\tborder:0;
\t\twidth:900px;
\t\tmax-width:900px;
\t\theight:560px;
\t\t{$box_bg} ;
\t\tfont-family:'Myriad Pro',Arial,Helvetica,sans-serif;
\t\tmargin: 0 auto;
\t\t{$box_shadow};
\t}
\t#header{height:397px;margin-bottom:-200px}
\t#wrapper{width:467px;margin:80px auto}
\th1{padding-top:180px;color:#fff;font-size:2em;font-weight:bold;text-align:center;white-space:nowrap;text-shadow: 0.1em 0.1em 0.2em black;border-bottom:0px}
\th2{color:#fff;font-size:12px;letter-spacing: 0.1em;font-weight:bold;text-align:center;text-shadow: 0.1em 0.1em 1.2em black;margin-top:.5em}
\t#when,.textwidget{color:#000; font-size:1.2em;text-align:center;margin-top:1.5em;}
        a { color: #fff; }
        a:hover { color: #000; }
\t{$extraCss}
</style>
CSS;
            // html of this file
            $msg .= <<<HTML
<div id="wrapper">
<div id="header" class="blank">
<h1>{$siteName}</h1>
</div>
<div id="when">
{$line1Text}
<h2><a href="http://{$line2Text}">{$line2Text}</a></h2> 
</div>

</div>
HTML;
            wp_die($msg, $title, array('response' => 503));
        }
    }
Exemplo n.º 2
0
 /**
  * Admin Init Hooks
  * 
  */
 public function mtt_admin_init()
 {
     if (defined('DOING_AJAX') && DOING_AJAX) {
         return;
     }
     $page = $this->options_class->_Slug;
     $cache = B5F_MTT_Init::$disable_scripts_cache ? time() : null;
     # Basic stuff
     wp_register_style('mtt_admin_css', B5F_MTT_Init::get_instance()->plugin_url . 'css/admin.css', array(), $cache);
     wp_register_script('mtt_admin_js', B5F_MTT_Init::get_instance()->plugin_url . 'js/mtt.js', array(), $cache, true);
     add_action('admin_print_scripts-' . $page, array($this, 'admin_print_scripts'), 5);
     add_filter('media_upload_default_tab', array($this, 'upload_default_tab'));
     add_action('admin_print_styles-media-upload-popup', array($this, 'upload_popup_style'));
 }
Exemplo n.º 3
0
 /**
  * Block menu hover intent, speeds up the menu
  */
 public function hoverintent()
 {
     wp_enqueue_script('disable-admin-hoverintent', B5F_MTT_Init::get_instance()->plugin_url . 'js/disableadminhi.js', array(), time());
 }
Exemplo n.º 4
0
 /**
  * Stylesheet for hiding dashboard help elements
  */
 public function admin_print_scripts()
 {
     $cache = B5F_MTT_Init::$disable_scripts_cache ? time() : null;
     wp_register_style('mtt-hide-help', B5F_MTT_Init::get_instance()->plugin_url . 'css/hide-help.css', array(), $cache);
     wp_enqueue_style('mtt-hide-help');
 }
Exemplo n.º 5
0
 /**
  * Access this plugin’s working instance
  *
  * @wp-hook plugins_loaded
  * @since   2.0
  * @return  object of this class
  */
 public static function get_instance()
 {
     NULL === self::$instance and self::$instance = new self();
     return self::$instance;
 }
Exemplo n.º 6
0
    public function mtt_meta_box()
    {
        $logo = B5F_MTT_Init::get_instance()->plugin_url . 'images/mtt-logo.png';
        $mtt_tb_title = B5F_MTT_Init::$version . ' ' . B5F_MTT_Admin::$mtt_tb_title;
        $version = B5F_MTT_Init::$version;
        $multisite = is_multisite() ? is_super_admin() : true;
        ?>

		<script>

		</script>
		<div class="mtt-box">
			<div class="inner">
				<div id="icon-options-mtt" class="icon32">
					<a href="http://www.rodbuaiz.com">
						<img src="<?php 
        echo $logo;
        ?>
" alt="rodbuaiz.com" title="rodbuaiz.com"/>
					</a>
				</div>
				<h2>Admin Tweaks<br/>
					<em style="font-size:.5em;"><?php 
        _e('version', 'mtt');
        ?>
 
						<?php 
        if ($multisite) {
            ?>
							<a id="open-tb" class="thickbox" title="<?php 
            echo "Admin Tweaks " . __('version', 'mtt') . $version;
            ?>
" href="javascript:void(0);">
						<?php 
        }
        ?>
						<?php 
        echo $version;
        ?>
						<?php 
        if ($multisite) {
            ?>
							</a>
						<?php 
        }
        ?>
					</em>

				</h2>
				<div id="mtt-other-info">
				<ul class="left hl" style="margin: -12px 0 6px 0;text-align: right;">
					<li id="bsf-link"><?php 
        _e("by", 'mtt');
        ?>
 brasofilo</li>
				</ul>
				<?php 
        B5F_MTT_Utils::print_repository_info();
        ?>
				<hr style="opacity:.3"/>

				<br style="clear:both"/>
				</div>

				<label for="mtt_verbose_plugin_helper" class="no-class">
					<input name="mtt_verbose_plugin_helper" id="mtt_verbose_plugin_helper" type="checkbox" class="no-toggle"> <?php 
        _e('Hide the plugin help texts', 'mtt');
        ?>
				</label>

				<p class="desc-field">
					<span style="color:#C5C5C5">
						<?php 
        _e('(some settings need a second refresh for being visible)', 'mtt');
        ?>
					</span>
				</p>
				<br style="clear:both"/>

				<div class="submit update-button mtt-update">
					<button class="button-primary" id="mtt-submit" title="<?php 
        _e('Update settings', 'mtt');
        ?>
"/><?php 
        _e('Update settings', 'mtt');
        ?>
</button>
				</div>

				<br style="clear:both"/>


			</div>


			<?php 
        //			if( check_admin_referer( 'admin-page-class.php', 'BF_Admin_Page_Class_nonce' ) )
        if (isset($_POST['BF_Admin_Page_Class_nonce']) && wp_verify_nonce($_POST['BF_Admin_Page_Class_nonce'], 'admin-page-class.php')) {
            if (isset($_POST['mtt_reset_plugin']) && in_array('do_it', $_POST['mtt_reset_plugin'])) {
                delete_option(B5F_MTT_Init::$opt_name);
            }
            if (isset($_POST['action']) && $_POST['action'] == 'save') {
                echo '<div id="alert_bar" class="footer">';
                echo '<script type="text/javascript">jQuery(document).ready(function ($) {close_update_msg();});</script>';
                echo '<p><strong>' . __('Settings updated.', 'mtt') . '</strong></p></div>';
            }
        }
        /*
        			  if ( $msg_revisions == 'yes' )
        			  {
        			  echo '<script type="text/javascript">jQuery(document).ready( function($) {	$("#alert_bar").slideDown(); window.setTimeout(function(){$("#alert_bar").slideUp()},7500);});</script>';
        			  ?>
        			  <p><strong><?php _e( 'Revisions deleted from database.', 'mtt' ); ?></strong></p><?php
        			  }
        
        			  if ( $msg_reset == 'yes' )
        			  {
        			  echo '<script type="text/javascript">jQuery(document).ready( function($) {	$("#alert_bar").slideDown(); window.setTimeout(function(){$("#alert_bar").slideUp()},7500);});</script>';
        			  ?>
        			  <p><strong><?php _e( 'Settings reset.', 'mtt' ); ?></strong></p><?php
        			  }
        			  ?>
        			  </div> */
        ?>
			<div class="footer">

				<ul class="right hl">
					<li><a href="http://wordpress.org/support/view/plugin-reviews/many-tips-together"
						   target="_blank"><?php 
        _e("Rate MTT in wordpress.org", 'mtt');
        ?>
</a></li>
					<li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JNJXKWBYM9JP6&lc=ES&item_name=Admin%20Tweaks%20%3a%20Rodolfo%20Buaiz&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted"
						   target="_blank"><?php 
        _e("Invite me a beer :o)]", 'mtt');
        ?>
</a></li>
				</ul>
			</div>
		</div>
		<?php 
    }