/** * Add an update or error notice to the dashboard when needed */ public function display_notice() { global $pagenow; // Theme update notifications if ($pagenow == 'index.php') { wolf_theme_update_notification_message(); } if (WOLF_ERROR_NOTICES) { /* Error notices --------------------------------------------------------*/ // No cURL $no_cURL = __('The <strong>cURL</strong> extension is not installed on your server. This extension is required to display theme update notifications.', 'wolf'); if (!function_exists('curl_init')) { wolf_admin_notice($no_cURL, 'error', true, 'no_cURL'); } // No GD library $no_GD_library = __('The <strong>GD library</strong> extension is not installed on your server. This extension is essential to Wordpress to be able to resize your images. Please contact your hosting service for more informations.', 'wolf'); if (!extension_loaded('gd') && !function_exists('gd_info')) { wolf_admin_notice($no_GD_library, 'error', true, 'no_GD_library'); } } /* Always display wrong theme installation notice -------------------------------------------------------------------*/ /* Incorect Installation */ $wrong_install = sprintf(__('It seems that <strong>the theme has been installed incorrectly</strong>. Go <a href="%s" target="_blank">here</a> to find instructions about theme installation.', 'wolf'), 'http://wolfthemes.com/common-wordpress-theme-issues/'); $wolf_wp_themes_folder = basename(dirname(dirname(dirname(__FILE__)))); if ($wolf_wp_themes_folder != 'themes') { wolf_admin_notice($wrong_install, 'error'); } return false; }
/** * Render Theme Options inputs */ public function render() { $theme_version = 'v.' . WOLF_THEME_VERSION; /* If a child theme is used and update notces are enabled, we show the parent theme version */ if (is_child_theme() && WOLF_UPDATE_NOTICE) { $theme_version = sprintf(__('v.%1$s (Parent Theme v.%2$s)', 'wolf'), wp_get_theme()->Version, WOLF_THEME_VERSION); } ?> <div id="wolf-framework-messages"> <?php // Check for theme update and set an admin notification if needed wolf_theme_update_notification_message(); if (WOLF_ENABLE_OPTIONS_EXPORTER) { wolf_check_folder(WOLF_THEME_DIR . '/includes/admin/export'); } ?> </div> <div class="wrap"> <form id="wolf-theme-options-form" method="post" action="<?php echo esc_url(admin_url('admin.php?page=wolf-theme-options')); ?> " enctype="multipart/form-data"> <?php wp_nonce_field('wolf_save_theme_options', 'wolf_save_theme_options_nonce'); ?> <h2 class="nav-tab-wrapper"> <div class="tabs" id="tabs1"> <?php foreach ($this->options as $value) { ?> <?php if ($value['type'] == 'open') { ?> <a href="#<?php echo sanitize_title($value['label']); ?> " class="nav-tab"><?php echo sanitize_text_field($value['label']); ?> </a> <?php } } ?> <?php if (class_exists('ZipArchive') && WOLF_ENABLE_OPTIONS_EXPORTER) { ?> <a href="#import" class="nav-tab"><?php _e('Export/Import', 'wolf'); ?> </a> <?php } ?> </div> </h2> <div class="content"> <?php foreach ($this->options as $value) { if (!isset($value['def'])) { $value['def'] = ''; } if (!isset($value['desc'])) { $value['desc'] = ''; } if ($value['type'] == 'open') { ?> <div id="<?php echo sanitize_title($value['label']); ?> " class="wolf-options-panel"> <p><?php echo sanitize_text_field($value['desc']); ?> </p> <?php } elseif ($value['type'] == 'close') { // vertical-align:middle; margin-left:10px; display:none; ?> <div class="wolf-options-actions"> <span class="submit"> <input name="wolf-theme-options-save" type="submit" class="wolf-theme-options-save button-primary menu-save" value="<?php _e('Save changes', 'wolf'); ?> "> <img class="options-loader" style="vertical-align:middle; margin-left:10px; display:none;" src="<?php echo esc_url(admin_url('images/loading.gif')); ?> " alt="loader"> <div style="float:none; clear:both"></div> </span> <div class="clear"></div> </div> </div><!-- panel --> <?php } elseif ($value['type'] == 'subtitle') { ?> <div class="wolf_title wolf_subtitle"> <h3> <?php echo sanitize_text_field($value['label']); ?> <br><small><?php echo sanitize_text_field($value['desc']); ?> </small> </h3> <div class="clear"></div> </div> <?php } elseif ($value['type'] == 'section_open') { $title = isset($value['label']) ? $value['label'] : ''; $desc = isset($value['desc']) ? $value['desc'] : ''; $section_id = isset($value['id']) ? $value['id'] : 'section'; $dependency = isset($value['dependency']) ? $value['dependency'] : array(); $class = "option-section-{$section_id}"; $data = ''; if (array() != $dependency) { $class .= ' has-dependency'; $data .= ' data-dependency-element="' . $dependency['element'] . '"'; $value_list = ''; foreach ($dependency['value'] as $value) { $value_list .= '"' . $value . '",'; } $value_list = rtrim($value_list, ','); $dependency_value = "[{$value_list}]"; $data .= " data-dependency-values='{$dependency_value}'"; } ?> <div class="<?php echo esc_attr($class); ?> "<?php echo $data; ?> > <div class="section-title"> <?php if ($title) { ?> <h3><?php echo sanitize_text_field($title); ?> </h3> <?php } ?> <p class="description"><?php echo $desc; ?> </p> </div> <table class="form-table"> <tbody> <?php } elseif ($value['type'] == 'section_close') { ?> </tbody> </table> </div> <?php } else { $this->do_input($value); } // foreach $options } ?> <?php if (class_exists('ZipArchive') && WOLF_ENABLE_OPTIONS_EXPORTER) { ?> <div id="import" class="wolf-options-panel"> <p><?php _e('Here you can export or import your theme options in zip file format', 'wolf'); ?> </p> <p> <input type="file" name="wolf-options-import-file"> <input id="wolf-import-options" type="submit" name="wolf-options-import-file-submit" class="button" value="<?php _e('Import Options', 'wolf'); ?> "> </p> <p> <input id="wolf-export-options" type="submit" name="wolf-options-export-file-submit" class="button" value="<?php _e('Export Options', 'wolf'); ?> "> </p> </div> <?php } ?> <input type="hidden" name="action" value="save"> </form> </div> <!-- .content --> <?php $reset_options_confirm = __('Are you sure to want to reset all options ?', 'wolf'); ?> <div id="wolf-options-footer"> <form method="post" action="<?php echo esc_url(admin_url('admin.php?page=wolf-theme-options')); ?> "> <p id="reset"> <input name="wolf-reset-all-options" type="submit" value="<?php _e('Reset all options', 'wolf'); ?> " onclick="if (window.confirm( '<?php echo esc_js($reset_options_confirm); ?> ' ) ) {location.href='default.htm';return true;} else {return false;}"> <input type="hidden" name="action" value="wolf-reset-all-options"> </p> </form> <p id="theme-version"><?php echo sanitize_text_field(wp_get_theme()->Name); ?> <small><?php echo sanitize_text_field($theme_version); ?> </small></p> </div> </div><!-- .wrap --> <?php if (WOLF_DEBUG) { echo "<br><br>options"; debug(get_option('wolf_theme_options_' . wolf_get_theme_slug())); echo "<br><br>posted"; debug($_POST); } //end wolf_options_admin }