Exemplo n.º 1
2
function create_zip($themeName)
{
    $exclude_files = array('.', '..', '.svn', 'thumbs.db', '!sources', 'style.less.cache', 'bootstrap.less.cache', '.gitignore', '.git');
    $all_themes_dir = str_replace('\\', '/', get_theme_root());
    $backup_dir = str_replace('\\', '/', WP_CONTENT_DIR) . '/themes_backup';
    $zip_name = $backup_dir . "/" . $themeName . '.zip';
    $backup_date = date("F d Y");
    if (is_dir($all_themes_dir . "/" . $themeName)) {
        $file_string = scan_dir($all_themes_dir . "/" . $themeName, $exclude_files);
    }
    if (function_exists('wp_get_theme')) {
        $backup_version = wp_get_theme($themeName)->Version;
    } else {
        $backup_version = get_current_theme($themeName)->Version;
    }
    if (!is_dir($backup_dir)) {
        if (mkdir($backup_dir, 0700)) {
            $htaccess_file = fopen($backup_dir . '/.htaccess', 'a');
            $htaccess_text = 'deny from all';
            fwrite($htaccess_file, $htaccess_text);
            fclose($htaccess_file);
        }
    }
    $zip = new PclZip($zip_name);
    if ($zip->create($file_string, PCLZIP_OPT_REMOVE_PATH, $all_themes_dir . "/" . $themeName) == 0) {
        die("Error : " . $zip->errorInfo(true));
    }
    update_option($themeName . "_date_backup", $backup_date, '', 'yes');
    update_option($themeName . "_version_backup", $backup_version, '', 'yes');
    echo $backup_date . "," . $backup_version;
}
Exemplo n.º 2
0
 function resolveConflicts()
 {
     $modelConfig =& WYSIJA::get('config', 'model');
     $possibleConflictiveThemes = $modelConfig->getValue('conflictiveThemes');
     $conflictingTheme = null;
     $currentTheme = strtolower(get_current_theme());
     foreach ($possibleConflictiveThemes as $keyTheme => $conflictTheme) {
         if ($keyTheme === $currentTheme) {
             $conflictingTheme = $keyTheme;
         }
     }
     if ($conflictingTheme !== null) {
         $helperConflicts =& WYSIJA::get('conflicts', 'helper');
         $helperConflicts->resolve(array($possibleConflictiveThemes[$conflictingTheme]));
     }
     $possibleConflictivePlugins = $modelConfig->getValue("conflictivePlugins");
     $conflictingPlugins = array();
     foreach ($possibleConflictivePlugins as $keyPlg => $conflictPlug) {
         if (WYSIJA::is_plugin_active($conflictPlug['file'])) {
             $conflictingPlugins[$keyPlg] = $conflictPlug;
         }
     }
     if ($conflictingPlugins) {
         $helperConflicts =& WYSIJA::get("conflicts", "helper");
         $helperConflicts->resolve($conflictingPlugins);
     }
 }
Exemplo n.º 3
0
 public function __construct()
 {
     View::share(array('theme' => get_current_theme(), 'pages' => array('products', 'categories', 'pages', 'purchases'), 'results' => array('Users' => admin_path('users'), 'Settings' => admin_path('settings'), 'Log out' => admin_path('logout')), 'welcome_message' => Plugin::fire('admin.welcome_message', 'Welcome to Aviate!')->last()));
     //  Don't use Bootstrap-style inputs
     Former::framework('Nude');
     return $this->beforeFilter('auth|install');
 }
Exemplo n.º 4
0
 /**
  * Scans the template files of the active theme, and returns an
  * array of [Template Name => {file}.php]
  *
  * @since 0.2.0
  *
  * @return array
  */
 function get_post_templates()
 {
     $themes = get_themes();
     $theme = get_current_theme();
     $templates = $themes[$theme]['Template Files'];
     $post_templates = array();
     $base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()));
     foreach ((array) $templates as $template) {
         $template = WP_CONTENT_DIR . str_replace(WP_CONTENT_DIR, '', $template);
         $basename = str_replace($base, '', $template);
         /** Don't allow template files in subdirectories */
         if (false !== strpos($basename, '/')) {
             continue;
         }
         $template_data = implode('', file($template));
         $name = '';
         if (preg_match('|Single Post Template:(.*)$|mi', $template_data, $name)) {
             $name = _cleanup_header_comment($name[1]);
         }
         if (!empty($name)) {
             if (basename($template) != basename(__FILE__)) {
                 $post_templates[trim($name)] = $basename;
             }
         }
     }
     return $post_templates;
 }
Exemplo n.º 5
0
    function show_box1()
    {
        $android_Theme = get_option('cart_android_theme');
        $iphone_Theme = get_option('cart_iphone_theme');
        $ipad_Theme = get_option('cart_ipad_theme');
        $themes = wp_get_themes();
        ?>
		<div class="inside">
		<p><?php 
        _e('Android Phone Theme Setup', 'WP-OliveCart');
        ?>
</p>
		<select name="android_theme">
     <?php 
        foreach ($themes as $theme) {
            if ($android_Theme == $theme['Name'] || $android_Theme == '' && $theme['Name'] == get_current_theme()) {
                echo '<option value="' . $theme['Name'] . '" selected="selected">' . $theme['Name'] . '</option>';
            } else {
                echo '<option value="' . $theme['Name'] . '">' . $theme['Name'] . '</option>';
            }
        }
        ?>
     	</select>

		</div>
		<?php 
    }
/**
 * Put together some debug info to send to SimpleReach when support
 * is requested.
 *
 * @author Eric Lubow <*****@*****.**>
 * @param None
 * @return String Debug info
 */
function srslide_create_debug_info()
{
    $attrs = array();
    $attrs['pid'] = get_option('srslide_pid');
    $attrs['email'] = get_option('srslide_sr_login');
    $attrs['website'] = get_option('siteurl');
    $attrs['account'] = get_option('blogname');
    $attrs['user_api_key'] = get_option('srslide_api_key');
    $attrs['wp_version'] = get_bloginfo('version');
    $attrs['plugin_version'] = SRSLIDE_PLUGIN_VERSION;
    $attrs['show_slide_logo'] = get_option('srslide_show_logo');
    $attrs['header_text'] = get_option('srslide_header_text');
    $attrs['use_wp_pages'] = get_option('srslide_use_pages');
    $attrs['styles'] = serialize(get_option('srslide_styles'));
    $attrs['account'] = get_option('blogname');
    $attrs['php_version'] = phpversion();
    $attrs['curl_version'] = _srslide_get_curl_version();
    $attrs['curl_ssl'] = _srslide_get_curl_ssl();
    $attrs['curl_https_enabled'] = _srslide_get_curl_ssl_enabled();
    $attrs['wp_plugins'] = _srslide_get_wp_plugins();
    if ($theme_name = get_current_theme()) {
        $attrs['theme'] = $theme_name;
        $theme_data = get_theme_data(get_stylesheet_directory() . '/style.css');
        if (is_array($theme_data)) {
            foreach ($theme_data as $k => $v) {
                $attrs['theme_' . $k] = $v;
            }
        }
    }
    $str = '';
    foreach ($attrs as $attr => $value) {
        $str .= $attr . ': ' . $value . "\n";
    }
    return $str;
}
 function __construct()
 {
     global $pagenow;
     add_action('init', array($this, 'init'));
     if (is_admin()) {
         // hooks for saving menus
         add_action('wp_create_nav_menu', array($this, 'wp_update_nav_menu'), 10, 2);
         add_action('wp_update_nav_menu', array($this, 'wp_update_nav_menu'), 10, 2);
         // hook for saving menu items
         add_action('wp_update_nav_menu_item', array($this, 'wp_update_nav_menu_item'), 10, 3);
         // filter for nav_menu_options
         add_filter('option_nav_menu_options', array($this, 'option_nav_menu_options'));
         add_action('wp_delete_nav_menu', array($this, 'wp_delete_nav_menu'));
         add_action('delete_post', array($this, 'wp_delete_nav_menu_item'));
     }
     // add language controls for menus no option but javascript
     if ($pagenow == 'nav-menus.php') {
         add_action('admin_footer', array($this, 'nav_menu_language_controls'), 10);
         wp_enqueue_script('wp_nav_menus', ICL_PLUGIN_URL . '/res/js/wp-nav-menus.js', ICL_SITEPRESS_VERSION, true);
         wp_enqueue_style('wp_nav_menus_css', ICL_PLUGIN_URL . '/res/css/wp-nav-menus.css', array(), ICL_SITEPRESS_VERSION, 'all');
         // filter posts by language
         add_action('parse_query', array($this, 'parse_query'));
         // filter taxonomies by language
         //add_action('get_terms', array($this, 'get_terms'));
         // filter menus by language
         add_filter('get_terms', array($this, 'get_terms_filter'), 1, 3);
     }
     add_filter('theme_mod_nav_menu_locations', array($this, 'theme_mod_nav_menu_locations'));
     $theme = get_current_theme();
     add_filter('pre_update_option_mods_' . $theme, array($this, 'pre_update_theme_mods_theme'));
     add_filter('wp_nav_menu_args', array($this, 'wp_nav_menu_args_filter'));
     add_filter('wp_nav_menu_items', array($this, 'wp_nav_menu_items_filter'));
 }
Exemplo n.º 8
0
function fblikejacker_hg3252325c () {
    global $currentdbversionfbj;
	$plugin_dir = basename(dirname(__FILE__));
	load_plugin_textdomain( 'fblikejacker', 'wp-content/plugins/' . $plugin_dir, $plugin_dir );
        
        $dbv = get_option('fblikejacker_dbv');
        $like_active = get_option('fblikejacker_like_active');
        
        if (($dbv != $currentdbversionfbj) && ($like_active != '0')) {
            update_option("fblikejacker_like_active",'1');
            update_option('fblikejacker_dbv',$currentdbversionfbj);
        } elseif (($dbv != $currentdbversionfbj) && ($like_active == '1')) {
            update_option('fblikejacker_dbv',$currentdbversionfbj);
        }
        
        # footer & header tester
        $tested  = get_option("fblikejacker_tested");
        $theme_name = get_current_theme();

        if ($tested != $theme_name) {
            update_option("fblikejacker_tested",$theme_name);
            
            add_action( 'admin_init', 'fblikejacker_check_head_footer' );
            add_action( 'wp_head', 'fblikejacker_test_head', 99999 ); 
            add_action( 'wp_footer', 'fblikejacker_test_footer', 99999 ); 
        
        }    
    
        if ( isset( $_GET['test-head'] ) )
		add_action( 'wp_head', 'fblikejacker_test_head', 99999 ); 
 
	if ( isset( $_GET['test-footer'] ) )
		add_action( 'wp_footer', 'fblikejacker_test_footer', 99999 );        
                
}
Exemplo n.º 9
0
/**
* Load theme's infinite scroll annotation file, if present in the IS plugin.
* The `setup_theme` action is used because the annotation files should be using `after_setup_theme` to register support for IS.
*
* As released in Jetpack 2.0, a child theme's parent wasn't checked for in the plugin's bundled support, hence the convoluted way the parent is checked for now.
*
* @uses is_admin, wp_get_theme, get_theme, get_current_theme, apply_filters
* @action setup_theme
* @return null
*/
function jetpack_load_infinite_scroll_annotation()
{
    if (is_admin() && isset($_GET['page']) && 'jetpack' == $_GET['page']) {
        $theme = function_exists('wp_get_theme') ? wp_get_theme() : get_theme(get_current_theme());
        if (!is_a($theme, 'WP_Theme') && !is_array($theme)) {
            return;
        }
        /**
         * Filter the directory where all Infinite Scroll compat files are located.
         *
         * @since 2.0.0
         *
         * @param string $var Infinite Scroll compat file URL.
         * @param string $theme['Stylesheet'] Theme directory URI.
         */
        $customization_file = apply_filters('infinite_scroll_customization_file', dirname(__FILE__) . "/infinite-scroll/themes/{$theme['Stylesheet']}.php", $theme['Stylesheet']);
        if (is_readable($customization_file)) {
            require_once $customization_file;
        } elseif (!empty($theme['Template'])) {
            $customization_file = dirname(__FILE__) . "/infinite-scroll/themes/{$theme['Template']}.php";
            if (is_readable($customization_file)) {
                require_once $customization_file;
            }
        }
    }
}
 /**
  * Upgrades theme to its latest version
  *
  * @since   1.0
  * @access  public
  *
  * @param   string        Name of the theme. If not set checks for updates for the current theme. Default ''.
  * @param   bool          Allow API calls to be cached. Default true.
  * @return  object        A stdClass object.
  */
 public function upgrade_theme($theme_name = '', $allow_cache = true)
 {
     $result = new stdClass();
     $result->success = false;
     if (empty($theme_name)) {
         $theme_name = function_exists('wp_get_theme') ? wp_get_theme()->Name : get_current_theme();
     }
     $installed_theme = $this->is_theme_installed($theme_name);
     if ($installed_theme == null) {
         $result->errors = array("'{$theme_name}' theme is not installed");
         return $result;
     }
     $purchased_themes = $this->api->wp_list_themes($allow_cache);
     $marketplace_theme_data = null;
     if ($errors = $this->api->api_errors()) {
         $result->errors = array();
         foreach ($errors as $k => $v) {
             array_push($result->errors, $v);
         }
         return $result;
     }
     foreach ($purchased_themes as $purchased) {
         if ($this->is_matching_themes($installed_theme, $purchased) && $this->is_newer_version_available($installed_theme['Version'], $purchased->version)) {
             $marketplace_theme_data = $purchased;
             break;
         }
     }
     if ($marketplace_theme_data == null) {
         $result->errors = array("There is no update available for '{$theme_name}'");
         return $result;
     }
     $result->success = $this->do_upgrade_theme($installed_theme['Title'], $marketplace_theme_data->item_id);
     $result->installation_feedback = $this->installation_feedback;
     return $result;
 }
Exemplo n.º 11
0
/**
 * A unique identifier is defined to store the options in the database and reference them from the theme.
 * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
 * If the identifier changes, it'll appear as if the options have been reset.
 * 
 */
function optionsframework_option_name()
{
    $themename = preg_replace("/\\W/", "", strtolower(get_current_theme()));
    $optionsframework_settings = get_option('optionsframework');
    $optionsframework_settings['id'] = $themename;
    update_option('optionsframework', $optionsframework_settings);
}
Exemplo n.º 12
0
/**
 * Function for getting an array of available custom templates with a specific header. Ideally,
 * this function would be used to grab custom singular post (any post type) templates.
 *
 * @since 0.7
 * @param array $args Arguments to check the templates against.
 * @return array $post_templates The array of templates.
 */
function hybrid_get_post_templates( $args = array() ) {

	$args = wp_parse_args( $args, array( 'label' => array( 'Post Template' ) ) );

	$themes = get_themes();
	$theme = get_current_theme();
	$templates = $themes[$theme]['Template Files'];
	$post_templates = array();

	if ( is_array( $templates ) ) {
		$base = array( trailingslashit( get_template_directory() ), trailingslashit( get_stylesheet_directory() ) );

		foreach ( $templates as $template ) {
			$basename = str_replace( $base, '', $template );

			$template_data = implode( '', file( $template ) );

			$name = '';
			foreach ( $args['label'] as $label ) {
				if ( preg_match( "|{$label}:(.*)$|mi", $template_data, $name ) ) {
					$name = _cleanup_header_comment( $name[1] );
					break;
				}
			}

			if ( !empty( $name ) )
				$post_templates[trim( $name )] = $basename;
		}
	}

	return $post_templates;
}
Exemplo n.º 13
0
 /**
  * Event called when ready to render the Metabox contents 
  *
  * @param int $id ID of the gallery
  * @param object $gallery The gallery object, or post data.
  */
 public function onRender($id, $gallery)
 {
     $current_theme = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
     // WP 3.4
     $vars = array('custom_css' => get_post_meta($id, self::MT_CSS, true), 'theme_name' => $current_theme);
     $this->owner->template->display('meta_gallery_css.html.twig', $vars);
 }
Exemplo n.º 14
0
function admin_top_level()
{
    global $top_level_basename;
    $top_level_basename = basename(__FILE__);
    $optionpage_top_level = get_current_theme() . " Options";
    add_menu_page($optionpage_top_level, $optionpage_top_level, 7, basename(__FILE__), 'customize_theme_page');
}
Exemplo n.º 15
0
function motopressReset()
{
    require_once 'verifyNonce.php';
    require_once 'settings.php';
    require_once 'access.php';
    require_once 'Requirements.php';
    global $motopressSettings;
    $templateDir = $motopressSettings['theme_root'] . '/' . get_current_theme() . '/';
    $resetDir = WP_CONTENT_DIR . '/motopress-theme-reset/' . get_current_theme() . '/';
    foreach (glob($resetDir . '*.php') as $file) {
        if (file_exists($templateDir . basename($file))) {
            file_put_contents($templateDir . basename($file), file_get_contents($file));
        }
    }
    foreach (glob($resetDir . 'wrapper/' . '*.php') as $file) {
        file_put_contents($templateDir . 'wrapper/' . basename($file), file_get_contents($file));
    }
    foreach (glob($resetDir . 'loop/' . '*.php') as $file) {
        file_put_contents($templateDir . 'loop/' . basename($file), file_get_contents($file));
    }
    foreach (glob($resetDir . 'static/' . '*.php') as $file) {
        file_put_contents($templateDir . 'static/' . basename($file), file_get_contents($file));
    }
    exit;
}
Exemplo n.º 16
0
/**
 * Defines an array of options that will be used to generate the settings page and be saved in the database.
 * When creating the "id" fields, make sure to use all lowercase and no spaces.
 *  
 */
function optionsframework_options()
{
    $themename = function_exists('wp_get_theme') ? wp_get_theme() : get_current_theme();
    $themename = $themename['Name'];
    $shortname = "of";
    //Stylesheet Reader
    $alt_stylesheets = array("black" => "black", "brown" => "brown", "blue" => "blue", "green" => "green", "pink" => "pink", "purple" => "purple", "red" => "red", "yellow" => "yellow");
    // Test data
    $test_array = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
    // Multicheck Array
    $multicheck_array = array("one" => "French Toast", "two" => "Pancake", "three" => "Omelette", "four" => "Crepe", "five" => "Waffle");
    // Multicheck Defaults
    $multicheck_defaults = array("one" => "1", "five" => "1");
    // Background Defaults
    $background_defaults = array('color' => '', 'image' => '', 'repeat' => 'repeat', 'position' => 'top center', 'attachment' => 'scroll');
    // Pull all the categories into an array
    $options_categories = array();
    $options_categories_obj = get_categories();
    foreach ($options_categories_obj as $category) {
        $options_categories[$category->cat_ID] = $category->cat_name;
    }
    // Pull all the pages into an array
    $options_pages = array();
    $options_pages_obj = get_pages('sort_column=post_parent,menu_order');
    $options_pages[''] = 'Select a page:';
    foreach ($options_pages_obj as $page) {
        $options_pages[$page->ID] = $page->post_title;
    }
    // If using image radio buttons, define a directory path
    $imagepath = get_stylesheet_directory_uri() . '/images/';
    $options = array(array("name" => "General Settings", "type" => "heading"), array("name" => "Custom Logo", "desc" => "Choose your own logo. Optimal Size: 215px Wide by 55px Height", "id" => "colorway_logo", "type" => "upload"), array("name" => "Custom Favicon", "desc" => "Specify a 16px x 16px image that will represent your website's favicon.", "id" => "colorway_favicon", "type" => "upload"), array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here.", "id" => "colorway_analytics", "std" => "", "type" => "textarea"), array("name" => "Body Background Image", "desc" => "Select image to change your website background", "id" => "inkthemes_bodybg", "std" => "", "type" => "upload"), array("name" => "Home Top Feature", "type" => "heading"), array("name" => "Home Top Feature Image", "desc" => "Choose Image for your Home Top Feature. Optimal Size: 900px x 350px", "id" => "colorway_slideimage1", "type" => "upload"), array("name" => "Home Top Feature Heading", "desc" => "Enter the Heading for Home Top Feature", "id" => "colorway_slideheading1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Heading Link", "desc" => "Enter the Link URL in Heading for Home Top Feature", "id" => "colorway_slidelink1", "std" => "", "type" => "text"), array("name" => "Home Top Feature Description", "desc" => "Description for Home Top Feature", "id" => "colorway_slidedescription1", "std" => "", "type" => "textarea"), array("name" => "Home Page Settings", "type" => "heading"), array("name" => "Home Page Intro", "desc" => "Enter your heading text for home page", "id" => "inkthemes_mainheading", "std" => "", "type" => "text"), array("name" => "First Feature Image", "desc" => "Choose image for your feature column first. Optimal size 198px x 115px", "id" => "inkthemes_fimg1", "std" => "", "type" => "upload"), array("name" => "First Feature Heading", "desc" => "Enter your heading line for first column", "id" => "inkthemes_headline1", "std" => "", "type" => "text"), array("name" => "First Feature Link", "desc" => "Enter your link for feature column first", "id" => "inkthemes_link1", "std" => "", "type" => "text"), array("name" => "First Feature Content", "desc" => "Enter your feature content for column first", "id" => "inkthemes_feature1", "std" => "", "type" => "textarea"), array("name" => "Second Feature Image", "desc" => "Choose image for your feature column second. Optimal size 198px x 115px", "id" => "inkthemes_fimg2", "std" => "", "type" => "upload"), array("name" => "Second Feature Heading", "desc" => "Enter your heading line for second column", "id" => "inkthemes_headline2", "std" => "", "type" => "text"), array("name" => "Second Feature Link", "desc" => "Enter your link for feature column second", "id" => "inkthemes_link2", "std" => "", "type" => "text"), array("name" => "Second Feature Content", "desc" => "Enter your feature content for column second", "id" => "inkthemes_feature2", "std" => "", "type" => "textarea"), array("name" => "Third Feature Image", "desc" => "Choose image for your feature column thrid. Optimal size 198px x 115px", "id" => "inkthemes_fimg3", "std" => "", "type" => "upload"), array("name" => "Third Feature Heading", "desc" => "Enter your heading line for third column", "id" => "inkthemes_headline3", "std" => "", "type" => "text"), array("name" => "Third Feature Link", "desc" => "Enter your link for feature column third", "id" => "inkthemes_link3", "std" => "", "type" => "text"), array("name" => "Third Feature Content", "desc" => "Enter your feature content for third column", "id" => "inkthemes_feature3", "std" => "", "type" => "textarea"), array("name" => "Fourth Feature Image", "desc" => "Choose image for your feature column fourth. Optimal size 198px x 115px", "id" => "inkthemes_fimg4", "std" => "", "type" => "upload"), array("name" => "Fourth Feature Heading", "desc" => "Enter your heading line for fourth column", "id" => "inkthemes_headline4", "std" => "", "type" => "text"), array("name" => "Fourth Feature link", "desc" => "Enter your link for feature column fourth", "id" => "inkthemes_link4", "std" => "", "type" => "text"), array("name" => "Fourth Feature Content", "desc" => "Enter your feature content for fourth column", "id" => "inkthemes_feature4", "std" => "", "type" => "textarea"), array("name" => "Home Page Testimonial", "desc" => "Enter your text for homepage testimonial in short paragraph.", "id" => "inkthemes_testimonial", "std" => "", "type" => "textarea"), $options[] = array("name" => "Styling Options", "type" => "heading"), array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => "inkthemes_customcss", "std" => "", "type" => "textarea"), array("name" => "Footer Settings", "type" => "heading"), array("name" => "Facebook URL", "desc" => "Enter your Facebook URL if you have one", "id" => "colorway_facebook", "std" => "", "type" => "text"), array("name" => "Twitter URL", "desc" => "Enter your Twitter URL if you have one", "id" => "colorway_twitter", "std" => "", "type" => "text"), array("name" => "RSS Feed URL", "desc" => "Enter your RSS Feed URL if you have one", "id" => "colorway_rss", "std" => "", "type" => "text"), array("name" => "Linked In URL", "desc" => "Enter your Linkedin URL if you have one", "id" => "colorway_linkedin", "std" => "", "type" => "text"), array("name" => "Stumble Upon URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_stumble", "std" => "", "type" => "text"), array("name" => "Digg URL", "desc" => "Enter your Stumble Upon URL if you have one", "id" => "colorway_digg", "std" => "", "type" => "text"));
    update_option('of_themename', $themename);
    return $options;
}
Exemplo n.º 17
0
        function settings_page()
        {
            ?>
			<div class="wrap">
			<?php 
            screen_icon();
            ?>
			<h2><?php 
            echo get_current_theme() . ' ';
            _e('Theme Options');
            ?>
</h2>
			<form method="post" action="options.php" enctype="multipart/form-data">
			<?php 
            settings_fields($this->namespace);
            // important!
            ?>

				<table class="form-table">
					<?php 
            echo $this->get_option_form_fields();
            ?>
				</table>
				<p class="submit">
					<input type="submit" class="button-primary" value="Save Changes" />
				</p>
			</div>
			<?php 
        }
Exemplo n.º 18
0
function w3tc_get_current_theme()
{
    global $wp_version;
    if (version_compare($wp_version, '3.4', '>=')) {
        return wp_get_theme();
    }
    return get_theme(get_current_theme());
}
Exemplo n.º 19
0
function concerto_install()
{
    if (get_current_theme() == 'Concerto' && get_option('concerto_is_installed') != 1) {
        require_once CONCERTO_LIBS . 'defaults.php';
        defaultOptions('default', null, true);
        update_option('concerto_is_installed', 1);
    }
}
Exemplo n.º 20
0
/**
 * Adds the Infinity submenu item to the WordPress menu
 *
 * @package Infinity
 * @subpackage dashboard
 */
function infinity_dashboard_menu_setup()
{
    // get name of current theme
    $theme_name = get_current_theme();
    // format title/page name
    $menu_title = sprintf(__('%s Options', infinity_text_domain), $theme_name);
    // add appearance submenu item
    add_theme_page($menu_title, $menu_title, 'manage_options', INFINITY_ADMIN_PAGE, 'infinity_dashboard_cpanel_screen');
}
Exemplo n.º 21
0
 function theme_path($filename = '')
 {
     $CI =& get_instance();
     if ($CI->session->userdata('preview_theme')) {
         echo base_url() . 'public_html/themes/' . $CI->session->userdata('preview_theme') . '/' . $filename;
     } else {
         echo base_url() . 'public_html/themes/' . get_current_theme() . '/' . $filename;
     }
 }
Exemplo n.º 22
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('voters_model');
     if (!$this->ion_auth->logged_in()) {
         redirect(base_url(), 'refresh');
     }
     $this->theme->set(get_current_theme('frontend'));
 }
Exemplo n.º 23
0
function wpTuneDebug($wptObject)
{
    global $user_level, $wp_version;
    // already pulled in by show code
    print '<br/><b>' . __('wpTuner Diagnostics', 'wptuner') . "</b><br/>\n";
    print __('Debug level: ', 'wptuner') . $wptObject->iDebugLevel . "<br/>\n";
    print __('User level: ', 'wptuner') . $user_level . "<br/>\n";
    print __('WP version: ', 'wptuner') . $wp_version . "<br/>\n";
    print __('PHP version: ', 'wptuner') . phpversion() . "<br/>\n";
    print __('MySQL version: ', 'wptuner') . mysql_get_server_info() . "<br/>\n";
    print __('WP theme: ', 'wptuner') . get_current_theme() . "<br/>\n";
    if ($wptObject->iDebugLevel & 16) {
        if (function_exists('get_plugins')) {
            print __('WP plugins: ', 'wptuner');
            if (!function_exists('is_plugin_active')) {
                function is_plugin_active($plugin)
                {
                    return in_array($plugin, get_option('active_plugins'));
                }
            }
            $all_plugins = get_plugins();
            $active_plugins = array();
            $inactive_plugins = array();
            foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
                //Filter into individual sections
                if (is_plugin_active($plugin_file)) {
                    $active_plugins[$plugin_file] = $plugin_data['Name'] . ' [' . $plugin_data['Version'] . ']';
                } else {
                    $inactive_plugins[$plugin_file] = $plugin_data['Name'] . ' [' . $plugin_data['Version'] . ']';
                }
            }
            if (is_array($active_plugins)) {
                print implode(', ', $active_plugins);
            }
            print " // ";
            if (is_array($inactive_plugins)) {
                print implode(', ', $inactive_plugins);
            }
            print "<br/>\n";
        }
    }
    if ($wptObject->iDebugLevel & 32) {
        print __('wpTuner Object: ', 'wptuner');
        print '<pre>' . htmlspecialchars(print_r($wptObject, TRUE)) . '</pre>';
        print "<br/>\n";
    }
    if ($wptObject->iDebugLevel & 64) {
        print __('PHP Info: ', 'wptuner');
        ob_start();
        phpinfo();
        preg_match('%<style type="text/css">(.*?)</style>.*?<body>(.*?)</body>%s', ob_get_clean(), $matches);
        # $matches [1]; # Style information
        # $matches [2]; # Body information
        echo "<div class='phpinfodisplay'><style type='text/css'>\n", join("\n", array_map(create_function('$i', 'return ".phpinfodisplay " . preg_replace( "/,/", ",.phpinfodisplay ", $i );'), preg_split('/\\n/', trim(preg_replace("/\nbody/", "\n", $matches[1]))))), "</style>\n", $matches[2], "\n</div>\n";
        print "<br/>\n";
    }
}
Exemplo n.º 24
0
/**
 * A unique identifier is defined to store the options in the database and reference them from the theme.
 * By default it uses the theme name, in lowercase and without spaces, but this can be changed if needed.
 * If the identifier changes, it'll appear as if the options have been reset.
 */
function optionsframework_option_name()
{
    // This gets the theme name from the stylesheet (lowercase and without spaces)
    $themename = function_exists('wp_get_theme') ? wp_get_theme()->Name : get_current_theme();
    $themename = preg_replace("/\\W/", "", strtolower($themename));
    $optionsframework_settings = get_option('optionsframework');
    $optionsframework_settings['id'] = $themename;
    update_option('optionsframework', $optionsframework_settings);
}
Exemplo n.º 25
0
 private function get_status($theme_name, $long = false)
 {
     if (get_current_theme() == $theme_name) {
         $line = '%g';
         $line .= $long ? 'Active' : 'A';
     } else {
         $line = $long ? 'Inactive' : 'I';
     }
     return $line;
 }
Exemplo n.º 26
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('theme');
     $this->load->model('election_model');
     if (!$this->aauth->is_loggedin() || $this->aauth->is_member('Default')) {
         redirect(base_url('backend/login'), 'refresh');
     }
     $this->theme->set(get_current_theme('backend'));
 }
Exemplo n.º 27
0
/**
 * Get directory name of current theme
 *
 * @since WordPress 3.4
 *
 * @return string
 */
function _deprecated_get_theme_stylesheet()
{
    if (function_exists('wp_get_theme')) {
        $theme = wp_get_theme();
        return $theme->stylesheet;
    } else {
        $themes = get_themes();
        return $themes[get_current_theme()]['Stylesheet'];
    }
}
Exemplo n.º 28
0
/**
 * @package d7
 * @subpackage boilerplate-theme_filters+hooks
 * @internal only called by `wp_enqueue_scripts` action
 *
 * @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
 * @link http://codex.wordpress.org/Function_Reference/wp_register_script
 * @link http://codex.wordpress.org/Function_Reference/get_bloginfo
 *
 * @uses get_bloginfo()         returns information about your site.
 * @uses wp_enqueue_script()    Enqueues javascript.
 */
function d7_enqueue_scripts()
{
    $script_location = 'js/main.js';
    wp_enqueue_script('basic', get_bloginfo('template_directory') . '/' . $script_location, array('jquery'), '1.0');
    $wp_object = array('templateUrl' => get_bloginfo('template_url'), 'stylesheetUrl' => get_bloginfo('stylesheet_url'), 'stylesheetDirectory' => get_bloginfo('stylesheet_directory'), 'siteName' => get_bloginfo('name'), 'description' => get_bloginfo('description'), 'currentTheme' => get_current_theme(), 'url' => get_bloginfo('url'));
    wp_localize_script('basic', 'D7WP', $wp_object);
    if (is_singular() && get_option('thread_comments') && comments_open()) {
        wp_enqueue_script('comment-reply');
    }
}
Exemplo n.º 29
0
 /**
  * @param bool $admin
  *
  * @return string the name of the current template
  */
 public function getDefaultTemplate($admin = false)
 {
     global $wp_version;
     if (version_compare($wp_version, "3.4", "<=")) {
         return get_current_theme();
     } else {
         $theme = wp_get_theme();
         return $theme->Name;
     }
 }
Exemplo n.º 30
0
function ecwid_get_theme_name()
{
    $version = get_bloginfo('version');
    if (version_compare($version, '3.4') < 0) {
        $theme_name = get_current_theme();
    } else {
        $theme = wp_get_theme();
        $theme_name = $theme->Name;
    }
    return $theme_name;
}