本文整理汇总了PHP中theme函数的典型用法代码示例。如果您正苦于以下问题:PHP theme函数的具体用法?PHP theme怎么用?PHP theme使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goodboymytheme_preprocess_page
/**
* Preprocessor for page.tpl.php template file.
*/
function goodboymytheme_preprocess_page(&$vars, $hook)
{
//----------------------------------------------------Goodboy my custom Stage 4 p.5
if (arg(0) == 'node') {
if ($vars['node']->type == 'film') {
$vars['title'] = 'Films Films Films';
}
}
// For easy printing of variables.
$vars['logo_img'] = '';
if (!empty($vars['logo'])) {
$vars['logo_img'] = theme('image', array('path' => $vars['logo'], 'alt' => t('Home'), 'title' => t('Home')));
}
$vars['linked_logo_img'] = '';
if (!empty($vars['logo_img'])) {
$vars['linked_logo_img'] = l($vars['logo_img'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home')), 'html' => TRUE));
}
$vars['linked_site_name'] = '';
if (!empty($vars['site_name'])) {
$vars['linked_site_name'] = l($vars['site_name'], '<front>', array('attributes' => array('rel' => 'home', 'title' => t('Home'))));
}
// Site navigation links.
$vars['main_menu_links'] = '';
if (isset($vars['main_menu'])) {
$vars['main_menu_links'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'main-menu', 'class' => array('inline', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
}
$vars['secondary_menu_links'] = '';
if (isset($vars['secondary_menu'])) {
$vars['secondary_menu_links'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('id' => 'secondary-menu', 'class' => array('inline', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
}
}
示例2: getHtmlContent
public function getHtmlContent()
{
$result = $this->getHtmlList();
$result .= '<hr/><p>' . l('[XML]', 'tour/' . $this->getId() . '/xml') . '</p>';
return $result;
return theme('chgk_db_champ_full', $this);
}
示例3: tibco_styles_form_element_label
/**
* Implements theme_form_element_label().
*/
function tibco_styles_form_element_label($variables)
{
$element = $variables['element'];
// This is also used in the installer, pre-database setup.
$t = get_t();
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
return '';
}
// If the element is required, a required marker is appended to the label.
$required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
$title = filter_xss_admin($element['#title']);
$attributes = array();
// Style the label as class option to display inline with the element.
if ($element['#title_display'] == 'after') {
$attributes['class'] = 'option';
} elseif ($element['#title_display'] == 'invisible') {
$attributes['class'] = 'element-invisible';
}
if (!empty($element['#id'])) {
$attributes['for'] = $element['#id'];
}
$help = '';
if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
$help = $element['#checkbox_suffix'];
}
// The leading whitespace helps visually separate fields from inline labels.
return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
示例4: garland_preprocess_page
/**
* Override or insert variables into the page template.
*/
function garland_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
if (isset($vars['main_menu'])) {
$vars['primary_nav'] = theme('links', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['primary_nav'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_nav'] = theme('links', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_nav'] = FALSE;
}
// Prepare header
$site_fields = array();
if (!empty($vars['site_name'])) {
$site_fields[] = check_plain($vars['site_name']);
}
if (!empty($vars['site_slogan'])) {
$site_fields[] = check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) {
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
}
$vars['site_html'] = implode(' ', $site_fields);
}
示例5: user_last_login_by_day
/**
* Example function: creates a graph of user logins by day.
*/
function user_last_login_by_day($n = 40)
{
$query = db_select('users');
$query->addField('users', 'name');
$query->addField('users', 'uid');
$query->addField('users', 'created');
$query->condition('uid', 0, '>');
$query->orderBy('created', 'DESC');
$query->range(0, $n);
$result = $query->execute();
$g = graphapi_new_graph();
$now = time();
$days = array();
foreach ($result as $user) {
$uid = $user->uid;
$user_id = 'user_' . $uid;
$day = intval(($now - $user->created) / (24 * 60 * 60));
$day_id = 'data_' . $day;
graphapi_set_node_title($g, $user_id, l($user->name, "user/" . $uid));
graphapi_set_node_title($g, $day_id, "Day " . $day);
graphapi_set_link_data($g, $user_id, $day_id, array('color' => '#F0F'));
}
$options = array('width' => 400, 'height' => 400, 'item-width' => 50, 'engine' => 'graph_phyz');
return theme('graphapi_dispatch', array('graph' => $g, 'config' => $options));
}
示例6: singular_settings
/**
* Implementation of hook_settings() for themes.
*/
function singular_settings($settings)
{
// Add js & css
drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
drupal_add_js('misc/farbtastic/farbtastic.js');
drupal_add_js(drupal_get_path('theme', 'singular') . '/js/settings.js');
drupal_add_css(drupal_get_path('theme', 'singular') . '/css/settings.css');
file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY, 'file_directory_path');
// Check for a new uploaded logo, and use that instead.
if ($file = file_save_upload('background_file', array('file_validate_is_image' => array()))) {
$parts = pathinfo($file->filename);
$filename = 'singular_background.' . $parts['extension'];
if (file_copy($file, $filename, FILE_EXISTS_REPLACE)) {
$settings['background_path'] = $file->filepath;
}
}
$form = array();
$form['layout'] = array('#title' => t('Layout'), '#type' => 'select', '#options' => array('fixed' => t('Fixed width'), 'fluid' => t('Fluid width')), '#default_value' => !empty($settings['layout']) ? $settings['layout'] : 'fixed');
$form['messages'] = array('#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Autoclose messages'), '#descriptions' => t('Select the message types to close automatically after a few seconds.'));
$form['messages']['autoclose'] = array('#type' => 'checkboxes', '#options' => array('status' => t('Status'), 'warning' => t('Warning'), 'error' => t('Error')), '#default_value' => !empty($settings['autoclose']) ? $settings['autoclose'] : array('status'));
$form['style'] = array('#title' => t('Styles'), '#type' => 'select', '#options' => singular_get_styles(), '#default_value' => !empty($settings['style']) ? $settings['style'] : 'sea');
$form['custom'] = array('#tree' => FALSE, '#type' => 'fieldset', '#attributes' => array('class' => $form['style']['#default_value'] == 'custom' ? 'singular-custom-settings' : 'singular-custom-settings hidden'));
$form['custom']['background_file'] = array('#type' => 'file', '#title' => t('Background image'), '#maxlength' => 40);
if (!empty($settings['background_path'])) {
$form['custom']['background_preview'] = array('#type' => 'markup', '#value' => !empty($settings['background_path']) ? theme('image', $settings['background_path'], NULL, NULL, array('width' => '100'), FALSE) : '');
}
$form['custom']['background_path'] = array('#type' => 'value', '#value' => !empty($settings['background_path']) ? $settings['background_path'] : '');
$form['custom']['background_color'] = array('#title' => t('Background color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['background_color']) ? $settings['background_color'] : '#888888', '#suffix' => '<div id="singular-colorpicker"></div>');
$form['custom']['background_repeat'] = array('#title' => t('Tile'), '#type' => 'select', '#options' => array('no-repeat' => t('Don\'t tile'), 'repeat-x' => t('Horizontal'), 'repeat-y' => t('Vertical'), 'repeat' => t('Both')), '#default_value' => !empty($settings['background_repeat']) ? $settings['background_repeat'] : 'no-repeat');
return $form;
}
示例7: fever_links__system_main_menu
function fever_links__system_main_menu($vars)
{
$class = implode($vars['attributes']['class'], ' ');
$html = '<ul class="' . $class . '">';
foreach ($vars['links'] as $key => $link) {
if (is_numeric($key)) {
$sub_menu = '';
$link_class = '';
$link_title = '<span>';
$link_title .= $link['#title'];
// Check for sub menu - note I've only checked this for 2 levels
// it might not work for 3 level menus.
if (!empty($link['#below'])) {
$link_class = ' class="dropdown"';
$link['#attributes']['class'][] = 'dropdown-toggle';
$link['#attributes']['data-toggle'][] = 'dropdown';
// And recurse.
$sub_menu = theme('links__system_main_menu', array('links' => $link['#below'], 'attributes' => array('class' => array('dropdown-menu'))));
}
$html .= '<li' . $link_class . '>' . l($link_title, $link['#href'], array('html' => 'true', 'attributes' => $link['#attributes'])) . '</span>' . $sub_menu . '</li>';
}
}
$html .= '</ul>';
return $html;
}
示例8: settings_page
function settings_page($args)
{
if ($args[1] == 'save') {
$settings['browser'] = $_POST['browser'];
$settings['gwt'] = $_POST['gwt'];
$settings['colours'] = $_POST['colours'];
$settings['reverse'] = $_POST['reverse'];
setcookie_year('settings', base64_encode(serialize($settings)));
twitter_refresh('');
}
$modes = array('mobile' => 'Normal phone', 'touch' => 'Touch phone', 'desktop' => 'PC/Laptop', 'text' => 'Text only', 'worksafe' => 'Work Safe', 'bigtouch' => 'Big Touch');
$gwt = array('off' => 'direct', 'on' => 'via GWT');
$colour_schemes = array();
foreach ($GLOBALS['colour_schemes'] as $id => $info) {
list($name, $colours) = explode('|', $info);
$colour_schemes[$id] = $name;
}
$content .= '<form action="settings/save" method="post"><p>Colour scheme:<br /><select name="colours">';
$content .= theme('options', $colour_schemes, setting_fetch('colours', 1));
$content .= '</select></p><p>Mode:<br /><select name="browser">';
$content .= theme('options', $modes, $GLOBALS['current_theme']);
$content .= '</select></p><p>External links go:<br /><select name="gwt">';
$content .= theme('options', $gwt, setting_fetch('gwt', $GLOBALS['current_theme'] == 'text' ? 'on' : 'off'));
$content .= '</select><small><br />Google Web Transcoder (GWT) converts third-party sites into small, speedy pages suitable for older phones and people with less bandwidth.</small></p>';
$content .= '<p><label><input type="checkbox" name="reverse" value="yes" ' . (setting_fetch('reverse') == 'yes' ? ' checked="checked" ' : '') . ' /> Attempt to reverse the conversation thread view.</label></p>';
$content .= '<p><input type="submit" value="Save" /></p></form>';
$content .= '<hr /><p>Visit <a href="reset">Reset</a> if things go horribly wrong - it will log you out and clear all settings.</p>';
return theme('page', 'Settings', $content);
}
示例9: colourise_preprocess_page
function colourise_preprocess_page(&$vars)
{
// Theme Main and secondary links.
if (isset($vars['main_menu'])) {
$vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'inline', 'main-menu'))));
} else {
$vars['primary_nav'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_menus'] = theme('links', $vars['secondary_menu'], array('class' => 'links secondary-menu'));
}
// Set Accessibility nav bar
if (isset($vars['main_menu'])) {
$vars['nav_access'] = '
<ul id="nav-access" class="hidden">
<li><a href="#main-menu" accesskey="N" title="' . t('Skip to Main Menu') . '">' . t('Skip to Main Menu') . '</a></li>
<li><a href="#main-content" accesskey="M" title="' . t('Skip to Main Content') . '">' . t('Skip to Main Content') . '</a></li>
</ul>
';
} else {
$vars['nav_access'] = '
<ul id="nav-access" class="hidden">
<li><a href="#main-content" accesskey="M" title="' . t('Skip to Main Content') . '">' . t('Skip to Main Content') . '</a></li>
</ul>
';
}
}
示例10: _myu_user_dropdown
function _myu_user_dropdown()
{
global $user;
global $language;
$items = array();
if ($user->uid === 0) {
$login_link = l('<span>' . t('Login') . '</span>', '', array('attributes' => array('class' => 'login dropdown-toggle', 'data-toggle' => 'modal'), 'fragment' => 'login', 'external' => TRUE, 'html' => TRUE));
return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $login_link . '</li></ul>';
} else {
$username = '';
if (!empty($user->picture)) {
$fid = $user->picture;
$file = file_load($fid);
$username = theme('image_style', array('path' => $file->uri, 'style_name' => '29x29', 'attributes' => array('class' => 'img-circle')));
}
$username .= '<span class="username username-hide-on-mobile">' . format_username($GLOBALS['user']) . '</span><i class="fa fa-angle-down"></i>';
$username_link = l($username, 'javascript:;', array('html' => TRUE, 'language' => $language, 'external' => TRUE, 'attributes' => array('class' => 'dropdown-toggle', 'data-close-others' => 'true', 'data-hover' => 'dropdown', 'data-toggle' => 'dropdown')));
$user_menu = menu_tree('user-menu');
foreach ($user_menu as $menu_link) {
if (isset($menu_link['#original_link'])) {
$items[] = l($menu_link['#original_link']['title'], $menu_link['#original_link']['href'], array('language' => $language));
}
}
$user_menu_list = theme('item_list', array('items' => $items, 'type' => 'ul', 'attributes' => array('class' => 'dropdown-menu dropdown-menu-default')));
return '<ul class="menu nav navbar-nav user"><li class="dropdown dropdown-user">' . $username_link . $user_menu_list . '</li></ul>';
}
}
示例11: popup_parse
/**
* Parse popup message
*
* @param mysql_resource mysql_resource result of mysql_query
*
* @return string
*/
function popup_parse($mysql_resource)
{
static $pcont = 0;
$output = '';
$vars = array();
while ($s = @mysql_fetch_row($mysql_resource)) {
$pcont++;
$vars["ID"] = $s[0];
$vars["MAC"] = $s[1];
$vars["IP"] = $s[2];
$vars["COMP"] = htmlspecialchars($s[3]);
$vars["NICK"] = htmlspecialchars($s[4]);
$vars["DATE"] = $s[9];
$vars["TO"] = htmlspecialchars($s[6]);
$s[8] = str_replace("http://remont.lvs.ru", "_DND мудак_", $s[8]);
$s[8] = str_replace("http://www.evrostroika.ru", "_DND мудак_", $s[8]);
$vars["MESSAGE"] = popup_messageparse($s[8], $pcont == 2);
if ($s[1] == '00:11:22:22:11:00') {
$vars["MESSAGE"] = "Здравствуйте! Мне двадцать лет, я бородат, живу с мамой, тролль, лжец и девственник. Вот и сейчас...\n\nP.S. Извените за неровный почерк.";
}
$vars["spam"] = $s[1] == '00:11:22:22:11:00';
$vars["spam"] = 'spambot' == $vars["NICK"] || $vars['spam'];
$vars["spam"] = $vars['spam'] || strrpos($vars["MESSAGE"], "У кого есть эти файлы ? :") !== false;
//$vars["spam"] = $vars['spam'] || ('satt'==strtolower($vars["NICK"]));
$output .= theme("popup", $vars);
}
return $output;
}
示例12: theme
/**
* if we are using a theming system, invoke theme, else just print the
* content
*
* @param string $content the content that will be themed
* @param boolean $print are we displaying to the screen or bypassing theming?
* @param boolean $maintenance for maintenance mode
*
* @return void prints content on stdout
* @access public
*/
function theme(&$content, $print = FALSE, $maintenance = FALSE)
{
$ret = FALSE;
// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
// but the parts should be copied into cleaner subclass implementations
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal && function_exists('theme') && !$print) {
if ($maintenance) {
drupal_set_breadcrumb('');
drupal_maintenance_theme();
if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
CRM_Utils_System::addHTMLHead($region->render(''));
}
print theme('maintenance_page', array('content' => $content));
exit;
}
$ret = TRUE;
// TODO: Figure out why D7 returns but everyone else prints
}
$out = $content;
$config =& CRM_Core_Config::singleton();
if (!$print && $config->userFramework == 'WordPress') {
if (is_admin()) {
require_once ABSPATH . 'wp-admin/admin-header.php';
} else {
// FIX ME: we need to figure out to replace civicrm content on the frontend pages
}
}
if ($ret) {
return $out;
} else {
print $out;
}
}
示例13: importacionesgm_preprocess_html
/**
* Implements hook_preprocess_html().
* Meta tags https://drupal.org/node/1468582#comment-5698732
*/
function importacionesgm_preprocess_html(&$variables)
{
$meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8'));
drupal_add_html_head($meta_charset, 'meta_charset');
$meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1'));
drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible');
$meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width'));
drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized');
$meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true'));
drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly');
$meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
drupal_add_html_head($meta_viewport, 'meta_viewport');
$meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on'));
drupal_add_html_head($meta_cleartype, 'meta_cleartype');
// Use html5shiv.
if (theme_get_setting('html5shim')) {
$element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'importacionesgm') . '/js/html5shiv-printshiv.js'))));
$html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n");
drupal_add_html_head($html5shim, 'sonambulo_html5shim');
}
// Use Respond.js.
if (theme_get_setting('respond_js')) {
drupal_add_js(drupal_get_path('theme', 'importacionesgm') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100));
}
// Use normalize.css
if (theme_get_setting('normalize_css')) {
drupal_add_css(drupal_get_path('theme', 'importacionesgm') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100));
}
}
示例14: theme
/**
* if we are using a theming system, invoke theme, else just print the
* content
*
* @param string $type name of theme object/file
* @param string $content the content that will be themed
* @param array $args the args for the themeing function if any
* @param boolean $print are we displaying to the screen or bypassing theming?
* @param boolean $ret should we echo or return output
* @param boolean $maintenance for maintenance mode
*
* @return void prints content on stdout
* @access public
*/
function theme($type, &$content, $args = NULL, $print = FALSE, $ret = FALSE, $maintenance = FALSE)
{
// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
// but the parts should be copied into cleaner subclass implementations
if (function_exists('theme') && !$print) {
if ($maintenance) {
drupal_set_breadcrumb('');
drupal_maintenance_theme();
print theme('maintenance_page', array('content' => $content));
exit;
}
$out = $content;
$ret = TRUE;
} else {
$out = $content;
}
$config =& CRM_Core_Config::singleton();
if (!$print && $config->userFramework == 'WordPress') {
if (is_admin()) {
require_once ABSPATH . 'wp-admin/admin-header.php';
} else {
// FIX ME: we need to figure out to replace civicrm content on the frontend pages
}
}
if ($ret) {
return $out;
} else {
print $out;
}
}
示例15: renderImage
public function renderImage($image)
{
$variables = array();
$variables['style_name'] = 'xl';
$variables['path'] = $image['uri'];
return theme('image_style', $variables);
}