Ejemplo n.º 1
0
 /**
  * Display update information
  *
  * @access public
  */
 public function backendHtml()
 {
     global $current_screen;
     $parent_string = is_child_theme() ? 'Parent Theme (' . ucfirst($this->theme_name) . ')' : 'Theme';
     if (empty($this->user_name) || empty($this->api_key)) {
         echo Message::display(Translate::params('Once you have entered and saved your Username and API Key WordPress will check for
                     updates every 12 Hours and notify you here, if one is available <br/><br/> Your
                     current %s Version Number is <strong> %s </strong>', $parent_string, $this->version), 'updated');
         UpdateNotifier::getInstance();
     } else {
         if (($update = $this->isThemeUpdated()) !== false) {
             if ($current_screen->base != 'update-core') {
                 $target = network_admin_url('update-core.php?action=do-theme-upgrade');
                 $data = array('new_version' => $update['new_version'], 'target' => $target, 'parent' => $parent_string, 'version' => $this->version, 'theme_name' => $this->theme_name);
                 $view = View::render('Helper/auto-update', $data);
                 echo $view;
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * add new menu page
  *
  * @param \SilverWp\ThemeOption\Menu\MenuAbstract $menu_class
  *
  * @return \SilverWp\ThemeOption\ThemeOptionAbstract
  * @throws Exception
  * @access public
  */
 public function addMenu(MenuAbstract $menu_class)
 {
     if (!$menu_class instanceof MenuAbstract) {
         throw new Exception(Translate::params('Class %s isn\'t instance of SilverWp\\ThemeOption\\Menu\\MenuAbstract', $menu_class));
     }
     if (in_array($menu_class, $this->menu)) {
         return;
     }
     $this->menu[] = $menu_class;
     return $this;
 }
Ejemplo n.º 3
0
    /**
     *
     * update notifier information
     *
     * @access public
     * @return void
     */
    public function showInfo()
    {
        // This tells the function to cache the remote call for 21600 seconds (6 hours)
        $xml = $this->getLatestThemeVersion(21600);
        // Get theme data from style.css (current version is what we want)
        $theme_data = array('Name' => $this->getThemeInfo('Name'), 'Version' => $this->getThemeInfo('Version'));
        ?>

		<style>
			.update-nag {
				display: none;
			}

			#instructions {
				max-width: 800px;
			}

			h3.title {
				margin: 30px 0 0 0;
				padding: 30px 0 0 0;
				border-top: 1px solid #ddd;
			}
		</style>

		<div class="wrap">

			<div id="icon-tools" class="icon32"></div>
			<h2><?php 
        echo $theme_data['Name'] . Translate::translate('Theme Updates');
        ?>
</h2>

			<div id="message" class="updated below-h2">
				<p><strong>
						<?php 
        echo Translate::params('There is a new version of the %s theme available', $theme_data['Name']);
        ?>
						.</strong> You have version
					<?php 
        echo $theme_data['Version'];
        ?>
					installed. Update to version
					<?php 
        echo $xml->latest;
        ?>
					.</p></div>

			<img style="float: left; margin: 0 20px 20px 0; border: 1px solid #ddd;"
			     src="<?php 
        echo esc_url(get_template_directory_uri()) . '/screenshot.png';
        ?>
"/>

			<div id="instructions" style="max-width: 800px;">
				<h3><?php 
        echo Translate::translate('Update Download and Instructions');
        ?>
</h3>

				<p>
					<?php 
        echo Translate::params('<strong>Please note:</strong> make a <strong> backup</strong> of the Theme inside your WordPress installation folder<strong> /wp-content/themes/%s/</strong>', sanitize_title($theme_data['Name']));
        ?>
 </p>

				<p>
					<?php 
        echo Translate::translate('To update the Theme, login to your account, head over to your <strong>downloads</strong> section and re-download the theme like you did when you bought it.');
        ?>
				</p>

				<p>
					<?php 
        echo Translate::params('Extract the zip\'s contents, look for the extracted theme folder, and after you have all the new files upload them using FTP to the <strong>/wp-content/themes/%s/</strong> folder overwriting the old ones (this is why it\'s important to backup any changes you\'ve made to the theme files)', sanitize_title($theme_data['Name']));
        ?>
					.
				</p>

				<p>
					<?php 
        echo Translate::translate('If you didn\'t make any changes to the theme files, you are free to overwrite them with the new ones without the risk of losing theme settings, pages, posts, etc, and backwards compatibility is guaranteed');
        ?>
					.
				</p>
			</div>

			<div class="clear"></div>

			<h3 class="title"><?php 
        echo Translate::translate('Changelog');
        ?>
</h3>
			<?php 
        echo $xml->changelog;
        ?>
		</div>
	<?php 
    }
Ejemplo n.º 4
0
 /**
  * Add control or section to menu page
  *
  * @param  $control
  *
  * @return $this
  * @throws \SilverWp\ThemeOption\Exception
  * @access
  */
 public function addControl($control)
 {
     if ($control instanceof ControlInterface || $control instanceof SectionInterface) {
         $this->settings['controls'][] = $control->getSettings();
     } else {
         throw new Exception(Translate::params('Argument passed to %s::addControl() isn\'t instance of SilverWp\\Helper\\Control\\ControlInterface or SilverWp\\ThemeOption\\Menu\\SectionInterface', __CLASS__));
     }
     return $this;
 }