示例#1
0
 /**
  * Action hook handler for theme updates checks. Intercepts theme update data before they are written into a transient.
  * Don't use directly.
  * 
  * Hooked on 'pre_set_site_transient_update_themes' action hook.
  *
  * @param object $transient An object containing the theme-update information returned by WordPress.org API.
  * @return object
  */
 function ci_theme_update_check_admin_handler($transient)
 {
     if (CI_THEME_UPDATES === true) {
         $latest_version = ci_theme_update_check();
         if ($latest_version !== false and version_compare($latest_version, CI_THEME_VERSION, '>')) {
             $theme_slug = 'wp_' . CI_THEME_NAME . '5';
             $transient->checked[CI_THEME_NAME] = CI_THEME_VERSION;
             $transient->response[$theme_slug] = array('new_version' => $latest_version, 'url' => 'http://www.cssigniter.com/ignite/themes/' . CI_THEME_NAME, 'package' => '');
         }
     }
     return $transient;
 }
function ci_settings_page()
{
    ?>
	<div class="wrap">
		<h2>
			<?php 
    if (!CI_WHITELABEL) {
        /* translators: %1$s is the theme name. %2$s is the theme's version number prepended by a 'v', e.g. v1.2 */
        echo sprintf(_x('%1$s Settings v%2$s', 'theme name settings version', 'ci_theme'), CI_THEME_NICENAME, CI_THEME_VERSION);
    } else {
        echo sprintf(_x('%s Settings', 'theme name settings', 'ci_theme'), CI_THEME_NICENAME);
    }
    ?>
		</h2>

		<?php 
    if (!CI_WHITELABEL) {
        ?>
			<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fcssigniter&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=true&amp;share=false&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>
		<?php 
    }
    ?>

		<?php 
    $latest_version = ci_theme_update_check();
    ?>
		<?php 
    if ($latest_version !== false && version_compare($latest_version, CI_THEME_VERSION, '>')) {
        ?>
			<div id="theme-update">
				<?php 
        echo sprintf(__('A theme update is available. The latest version is <b>%1$s</b> and you are running <b>%2$s</b>', 'ci_theme'), $latest_version, CI_THEME_VERSION);
        ?>
			</div>
		<?php 
    }
    ?>
	
		<?php 
    $panel_classes = ci_theme_classes();
    unset($panel_classes['theme_color_scheme']);
    ?>
		<div id="ci_panel" class="<?php 
    echo implode(' ', $panel_classes);
    ?>
">
			<form method="post" action="options.php" id="theform" enctype="multipart/form-data">
				<?php 
    settings_fields('ci-settings-group');
    $theme_options = get_option(THEME_OPTIONS);
    ?>
				<div id="ci_header">
					<?php 
    if (!CI_WHITELABEL) {
        ?>
						<img src="<?php 
        echo esc_url(apply_filters('ci_panel_logo_url', get_child_or_parent_file_uri('/panel/img/logo.png'), '/panel/img/logo.png'));
        ?>
"/>
					<?php 
    }
    ?>
				</div>

				<?php 
    if (isset($_POST['reset'])) {
        ?>
					<div class="resetbox"><?php 
        _e('Settings reset!', 'ci_theme');
        ?>
</div>
				<?php 
    }
    ?>

				<div class="success"></div>

				<div class="ci_save ci_save_top group">
					<p>
						<?php 
    $docs_links = array();
    if (CI_DOCS != '') {
        $docs_links[] = sprintf('<a href="%s">%s</a>', esc_url(CI_DOCS), __('Documentation', 'ci_theme'));
    }
    if (CI_FORUM != '') {
        $docs_links[] = sprintf('<a href="%s">%s</a>', esc_url(CI_FORUM), __('Support forum', 'ci_theme'));
    }
    echo implode(' | ', $docs_links);
    ?>
					</p>
					<input type="submit" class="button-primary save" value="<?php 
    esc_attr_e('Save Changes', 'ci_theme');
    ?>
"/>
				</div>

				<div id="ci_main" class="group">
	
					<?php 
    // Each tab is responsible for adding itself to the list of the panel tabs.
    // The priority on add_filter() affects the order of the tabs.
    // Tab files are automatically loaded for initialization by the function load_ci_defaults().
    // Child themes have a chance to load their tabs (or unload the parent theme's tabs) only after
    // the parent theme has initialized its tabs.
    $paneltabs = apply_filters('ci_panel_tabs', array());
    ?>
	
					<div id="ci_sidebar_back"></div>
					<div id="ci_sidebar">
						<ul>
							<?php 
    $tabNum = 1;
    foreach ($paneltabs as $name => $title) {
        $firstclass = $tabNum == 1 ? 'active' : '';
        echo sprintf('<li id="%1$s"><a href="#tab%2$s" rel="tab%2$s" class="%3$s"><span>%4$s</span></a></li>', esc_attr($name), esc_attr($tabNum), esc_attr($firstclass), $title);
        $tabNum++;
    }
    ?>
						</ul>
					</div><!-- /sidebar -->
	
					<div id="ci_options">
						<div id="ci_options_inner">
							<?php 
    $tabNum = 1;
    foreach ($paneltabs as $name => $title) {
        $firstclass = $tabNum == 1 ? 'one' : '';
        ?>
<div id="tab<?php 
        echo esc_attr($tabNum);
        ?>
" class="tab <?php 
        echo esc_attr($firstclass);
        ?>
"><?php 
        get_template_part(CI_PANEL_TABS_DIR . '/' . $name);
        ?>
</div><?php 
        $tabNum++;
    }
    ?>
						</div>
					</div><!-- #ci_options -->
	
				</div><!-- #ci_main -->
				<div class="ci_save group">
					<input type="submit" class="button-primary save" value="<?php 
    esc_attr_e('Save Changes', 'ci_theme');
    ?>
"/>
				</div>
			</form>
		</div><!-- #ci_panel -->
	
		<div id="ci-reset-box">
			<form method="post" action="">
				<input type="hidden" name="reset" value="reset" />
				<input type="submit" class="button" value="<?php 
    esc_attr_e('Reset Settings', 'ci_theme');
    ?>
" onclick="return confirm('<?php 
    esc_attr_e('Are you sure? All settings will be lost!', 'ci_theme');
    ?>
'); "/>
			</form>
		</div>
	</div><!-- wrap -->
	<?php 
}