当前位置: 首页>>代码示例>>PHP>>正文


PHP get_themes函数代码示例

本文整理汇总了PHP中get_themes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_themes函数的具体用法?PHP get_themes怎么用?PHP get_themes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_themes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_vars

function show_vars()
{
    global $name;
    if (is_file("modules/{$name}/configure.php")) {
        $file = file("modules/{$name}/configure.php");
        $strfile = join("", $file);
        #eval("\n>\n$file\n<?php\n ");
        echo "<table>" . "<tr>" . "<td><textarea name=config_file cols=80 rows=25>{$strfile}</textarea></td>" . "</tr>" . "</table>";
        foreach ($file as $line) {
            if (strstr($line, "\$hlpdsk_theme")) {
                $theme_selected = substr(strstr($line, '"'), 1, -3);
                echo "theme selected<br>{$theme_selected}<br>";
            }
        }
        $themes = get_themes();
        foreach ($themes as $value) {
            if ($value == $theme_selected) {
                $options .= "<option value=\"{$value}\" selected>{$value}</option>\n";
            } else {
                $options .= "<option value=\"{$value}\">{$value}</option>\n";
            }
        }
        echo "<select>{$options}</select>";
    } else {
        write_config();
    }
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:27,代码来源:setup.php

示例2: get_post_templates

 /**
  * 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;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:35,代码来源:post-templates.php

示例3: DisplayThemeBar

function DisplayThemeBar($theme1)
        {
        global $lang,$flag_new_themes,$contact_sheet,$theme_images,$allow_share,$n,$baseurl;

        # Work out theme name
        $themename=$theme1;
        $theme_display=getval("theme_$n","off");
       
        $themes=get_themes(array($theme1));
        if (count($themes)>0)
                {
                ?>

<div
onclick="
var theme_display=get_cookie('theme_<?php echo $n?>');
if (theme_display=='off'){var toggle_theme_display='on';} else { var toggle_theme_display='off';}
SetCookie('theme_<?php echo $n?>',toggle_theme_display,1000);
jQuery('#themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>').slideToggle(0.2);


return false;">                
               
	<a href='#'><b><?php echo htmlspecialchars(stripslashes(i18n_get_translated(str_replace("*","",$themename)))) ?></b></a></div>
               
<div id="themebar_<?php echo htmlspecialchars(str_replace(array("\""," "),"",$themename)) ?>" style="display:<?php if ($theme_display == 'off'){echo 'none';} else {echo '';}?>" >
                <?php
                for ($m=0;$m<count($themes);$m++)
                        { ?><br>
                        &nbsp;&nbsp;&nbsp;<a href="<?php echo $baseurl?>/pages/search.php?search=!collection<?php echo $themes[$m]["ref"]?>&bc_from=themes"  title="<?php echo $lang["collectionviewhover"]?>"><?php echo htmlspecialchars(i18n_get_collection_name($themes[$m])) ?></a>
                        <?php
                        }
                ?><br><br></div><?php
                }
        }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:35,代码来源:themebar.php

示例4: select_themes

function select_themes()
{
    global $name;
    if (is_file("modules/{$name}/configure.php")) {
        $file = file("modules/{$name}/configure.php");
        foreach ($file as $line) {
            if (strstr($line, "\$hlpdsk_theme")) {
                $theme_selected = substr(strstr($line, '"'), 1, -3);
                $show = "theme selected<br>{$theme_selected}<br>";
            }
        }
        $themes = get_themes();
        foreach ($themes as $value) {
            if ($value == $theme_selected) {
                $options .= "<option value=\"{$value}\" selected>{$value}</option>\n";
            } else {
                $options .= "<option value=\"{$value}\">{$value}</option>\n";
            }
        }
        $theme_select = "<select name='theme_selected'>{$options}</select>";
        echo "<form action='modules.php?name={$name}&file=admin&func=change_theme' method='POST'>";
        echo "<table>" . "<tr>" . "<td>{$theme_select}</td>" . "</tr>" . "</table>";
        echo "<input name=submit type=submit></form>";
    }
}
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:25,代码来源:change_theme.php

示例5: default_theme_site_admin_options

function default_theme_site_admin_options()
{
    $themes = get_themes();
    $default_theme = get_site_option('default_theme');
    if (empty($default_theme)) {
        $default_theme = 'default';
    }
    ?>
		<h3><?php 
    _e('Theme Settings', 'defaulttheme');
    ?>
</h3>
		<table class="form-table">
      <tr valign="top"> 
      <th scope="row"><?php 
    _e('Default Theme', 'defaulttheme');
    ?>
</th>
      <td><select name="default_theme">
      <?php 
    foreach ($themes as $key => $theme) {
        $theme_key = wp_specialchars($theme['Stylesheet']);
        echo '<option value="' . $theme_key . '"' . ($theme_key == $default_theme ? ' selected' : '') . '>' . $key . '</option>' . "\n";
    }
    ?>
      </select>
      <br /><?php 
    _e('Default theme applied to new blogs.', 'defaulttheme');
    ?>
</td>
      </tr>
		</table>
<?php 
}
开发者ID:hscale,项目名称:webento,代码行数:34,代码来源:default-theme.php

示例6: _wprp_get_themes

/**
 * Return an array of installed themes
 *
 * @return array
 */
function _wprp_get_themes()
{
    require_once ABSPATH . '/wp-admin/includes/theme.php';
    // Get all themes
    $themes = get_themes();
    // Get the list of active themes
    $active = get_option('current_theme');
    // Force a theme update check
    wp_update_themes();
    // Different versions of wp store the updates in different places
    // TODO can we depreciate
    if (function_exists('get_site_transient') && ($transient = get_site_transient('update_themes'))) {
        $current = $transient;
    } elseif ($transient = get_transient('update_themes')) {
        $current = $transient;
    } else {
        $current = get_option('update_themes');
    }
    foreach ((array) $themes as $theme) {
        $new_version = isset($current->response[$theme['Template']]) ? $current->response[$theme['Template']]['new_version'] : null;
        if ($active == $theme['Name']) {
            $themes[$theme['Name']]['active'] = true;
        } else {
            $themes[$theme['Name']]['active'] = false;
        }
        if ($new_version) {
            $themes[$theme['Name']]['latest_version'] = $new_version;
            $themes[$theme['Name']]['latest_package'] = $current->response[$theme['Template']]['package'];
        } else {
            $themes[$theme['Name']]['latest_version'] = $theme['Version'];
        }
    }
    return $themes;
}
开发者ID:redferriswheel,项目名称:ZachFonville,代码行数:39,代码来源:wprp.themes.php

示例7: hybrid_get_post_templates

/**
 * 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;
}
开发者ID:nerdfiles,项目名称:tbotw.org,代码行数:40,代码来源:admin.php

示例8: multitheme_admin_save_page_beforepost

function multitheme_admin_save_page_beforepost()
{
    global $lang, $p_theme;
    echo '<tr>';
    echo '<td><label for="theme">' . $lang['multitheme']['page_edit'] . ' </label></td>';
    echo '<td><select name="theme" id="theme">';
    $themes = get_themes();
    if ($themes) {
        foreach ($themes as $theme) {
            if (isset($p_theme)) {
                if ($theme['dir'] == $p_theme) {
                    echo '<option value="' . $theme['dir'] . '" selected="selected">' . $theme['title'] . '</option>';
                } else {
                    echo '<option value="' . $theme['dir'] . '">' . $theme['title'] . '</option>';
                }
            } else {
                if ($theme['dir'] == THEME) {
                    echo '<option value="' . $theme['dir'] . '" selected="selected">' . $theme['title'] . '</option>';
                } else {
                    echo '<option value="' . $theme['dir'] . '">' . $theme['title'] . '</option>';
                }
            }
        }
    }
    echo '</select></td>';
    echo '</tr>';
}
开发者ID:MenZil,项目名称:pluck,代码行数:27,代码来源:multitheme.php

示例9: prepare_items

 function prepare_items()
 {
     global $status, $themes, $totals, $page, $orderby, $order, $s;
     nxt_reset_vars(array('orderby', 'order', 's'));
     $themes = array('all' => apply_filters('all_themes', get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array());
     $site_allowed_themes = get_site_allowed_themes();
     if (!$this->is_site_themes) {
         $allowed_themes = $site_allowed_themes;
         $themes_per_page = $this->get_items_per_page('themes_network_per_page');
     } else {
         $allowed_themes = nxtmu_get_blog_allowedthemes($this->site_id);
         $themes_per_page = $this->get_items_per_page('site_themes_network_per_page');
     }
     $current = get_site_transient('update_themes');
     foreach ((array) $themes['all'] as $key => $theme) {
         $theme_key = $theme['Stylesheet'];
         if (isset($allowed_themes[$theme_key])) {
             $themes['all'][$key]['enabled'] = true;
             $themes['enabled'][$key] = $themes['all'][$key];
         } else {
             $themes['all'][$key]['enabled'] = false;
             $themes['disabled'][$key] = $themes['all'][$key];
         }
         if (isset($current->response[$theme['Template']])) {
             $themes['upgrade'][$key] = $themes['all'][$key];
         }
         if ($this->is_site_themes && isset($site_allowed_themes[$theme_key])) {
             unset($themes['all'][$key]);
             unset($themes['enabled'][$key]);
             unset($themes['disabled'][$key]);
         }
     }
     if (!current_user_can('update_themes') || $this->is_site_themes) {
         $themes['upgrade'] = array();
     }
     if ($s) {
         $status = 'search';
         $themes['search'] = array_filter($themes['all'], array(&$this, '_search_callback'));
     }
     $totals = array();
     foreach ($themes as $type => $list) {
         $totals[$type] = count($list);
     }
     if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) {
         $status = 'all';
     }
     $this->items = $themes[$status];
     $total_this_page = $totals[$status];
     if ($orderby) {
         $orderby = ucfirst($orderby);
         $order = strtoupper($order);
         uasort($this->items, array(&$this, '_order_callback'));
     }
     $start = ($page - 1) * $themes_per_page;
     if ($total_this_page > $themes_per_page) {
         $this->items = array_slice($this->items, $start, $themes_per_page);
     }
     $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page));
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:59,代码来源:class-nxt-ms-themes-list-table.php

示例10: test_smaller_storage

 /**
  * Reducing in-memory size further.
  *
  * @ticket 11214
  */
 function test_smaller_storage()
 {
     $themes = get_themes();
     $this->_filter_out_themes_not_in_root($themes);
     $theme_names = array_keys($themes);
     $this->assertEquals(87, count($theme_names));
     $this->assertLessThanOrEqual(136342, strlen(serialize($themes)));
 }
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:13,代码来源:themeDirLarge.php

示例11: get_avaiable_themes

 public function get_avaiable_themes()
 {
     if (function_exists('wp_get_themes')) {
         $this->avaiable_themes = wp_get_themes();
     } else {
         $this->avaiable_themes = get_themes();
     }
 }
开发者ID:nobu222,项目名称:Wordpress1DayTraning,代码行数:8,代码来源:theme_switcher.php

示例12: getAndroidTemplate

function getAndroidTemplate()
{
    $androidTheme = get_option('android_theme');
    $themeList = get_themes();
    foreach ($themeList as $theme) {
        if ($theme['Name'] == $androidTheme) {
            return $theme['Stylesheet'];
        }
    }
}
开发者ID:revathskumar,项目名称:Coderepo,代码行数:10,代码来源:mobile-theme-switcher.php

示例13: _deprecated_get_theme_stylesheet

/**
 * 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'];
    }
}
开发者ID:iPublicis,项目名称:sitepush,代码行数:17,代码来源:sitepush.php

示例14: admin_toxid_preview_theme_field

 function admin_toxid_preview_theme_field()
 {
     $themes = array_keys(get_themes());
     $currentTheme = get_option('toxid_preview_theme');
     echo '<select name="toxid_preview_theme">';
     echo '<option>' . __('None') . '</option>';
     foreach ($themes as $theme) {
         printf('<option value="%s" %s>%s</option>', esc_attr($theme), $theme == $currentTheme ? 'selected' : '', esc_html($theme));
     }
     echo '</select>';
 }
开发者ID:s-diez,项目名称:TOXID-cURL,代码行数:11,代码来源:theme-switcher.php

示例15: pl_get_themes

function pl_get_themes()
{
    if (!class_exists('WP_Theme')) {
        return get_themes();
    }
    $themes = wp_get_themes();
    foreach ($themes as $key => $theme) {
        $theme_data[$key] = array('Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'Author Name' => $theme->display('Author', false), 'Author URI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'Template' => '' != $theme->display('Template', false, false) ? $theme->display('Template', false, false) : $key, 'Stylesheet' => $key, 'Stylesheet Files' => array(0 => sprintf('%s/style.css', $theme->get_stylesheet_directory())));
    }
    return $theme_data;
}
开发者ID:climo,项目名称:PageLines-Framework,代码行数:11,代码来源:deprecated.php


注:本文中的get_themes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。