本文整理汇总了PHP中get_language_attributes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_language_attributes函数的具体用法?PHP get_language_attributes怎么用?PHP get_language_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_language_attributes函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header_data
/**
* Header data for header section
*
* @return array
*/
public static function header_data()
{
$header_image = get_header_image();
$page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width();
$header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false)));
$header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name'));
return $header;
}
示例2: language_attributes
/**
* Displays the language attributes for the html tag.
*
* Builds up a set of html attributes containing the text direction and language
* information for the page.
*
* @since 2.1.0
* @since 4.3.0 Converted into a wrapper for get_language_attributes().
*
* @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
*/
function language_attributes($doctype = 'html')
{
echo get_language_attributes($doctype);
}
示例3: getFunctions
/**
* Returns a list of functions to add to the existing list.
*
* @return Twig_SimpleFunction[]
*/
public function getFunctions()
{
$html_safe = ['is_safe' => array('html')];
$funcs = [];
// home_url
$funcs[] = new Twig_SimpleFunction('home_url', function ($blog_id = null, $path = '', $scheme = null) {
return get_home_url($blog_id, $path, $scheme);
}, $html_safe);
// blog_info
$funcs[] = new Twig_SimpleFunction('blog_info', function ($show, $filter = 'raw') {
return get_bloginfo($show, $filter);
}, $html_safe);
// wp_title
$funcs[] = new Twig_SimpleFunction('wp_title', function ($sep = '»', $dir = '') {
return wp_title($sep, false, $dir);
}, $html_safe);
// the_archive_title()
$funcs[] = new Twig_SimpleFunction('the_archive_title', function () {
global $wp_locale;
if (is_category()) {
$title = sprintf(__('Category: %s'), single_cat_title('', false));
} elseif (is_tag()) {
$title = sprintf(__('Tag: %s'), single_tag_title('', false));
} elseif (is_author()) {
$title = sprintf(__('Author: %s'), '<span class="vcard">' . get_the_author() . '</span>');
} elseif (is_year()) {
$title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format')));
} elseif (is_month()) {
$title = sprintf(__('Month: %s'), $wp_locale->get_month(get_query_var('monthnum')));
} elseif (is_day()) {
$title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format')));
} elseif (is_tax('post_format')) {
if (is_tax('post_format', 'post-format-aside')) {
$title = _x('Asides', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-gallery')) {
$title = _x('Galleries', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-image')) {
$title = _x('Images', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-video')) {
$title = _x('Videos', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-quote')) {
$title = _x('Quotes', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-link')) {
$title = _x('Links', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-status')) {
$title = _x('Statuses', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-audio')) {
$title = _x('Audio', 'post format archive title');
} elseif (is_tax('post_format', 'post-format-chat')) {
$title = _x('Chats', 'post format archive title');
}
} elseif (is_post_type_archive()) {
$title = sprintf(__('Archives: %s'), post_type_archive_title('', false));
} elseif (is_tax()) {
$tax = get_taxonomy(get_queried_object()->taxonomy);
/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
$title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false));
} else {
$title = __('Archives');
}
return apply_filters('get_the_archive_title', $title);
}, $html_safe);
// wp_head
$funcs[] = new Twig_SimpleFunction('wp_head', function () {
ob_start();
wp_head();
$content = ob_get_clean();
return $content;
}, $html_safe);
// wp_footer
$funcs[] = new Twig_SimpleFunction('wp_footer', function () {
ob_start();
wp_footer();
$content = ob_get_clean();
return $content;
}, $html_safe);
// language_attributes
$funcs[] = new Twig_SimpleFunction('language_attributes', function ($doctype = 'html') {
return get_language_attributes($doctype);
}, $html_safe);
// get_option
$funcs[] = new Twig_SimpleFunction('get_option', function ($option, $default = '') {
return get_option($option, $default);
}, $html_safe);
// body_class
$funcs[] = new Twig_SimpleFunction('body_class', function ($class = '') {
return 'class="' . join(' ', get_body_class($class)) . '"';
}, $html_safe);
// post_class
$funcs[] = new Twig_SimpleFunction('post_class', function ($class = '') {
return 'class="' . join(' ', get_post_class($class)) . '"';
}, $html_safe);
// header_image
$funcs[] = new Twig_SimpleFunction('header_image', function () {
return get_header_image();
//.........这里部分代码省略.........
示例4: trim
$banned_hosts_display = trim($banned_hosts_display);
$banned_referers_display = trim($banned_referers_display);
$banned_user_agents_display = trim($banned_user_agents_display);
$banned_exclude_ips_display = trim($banned_exclude_ips_display);
$banned_stats = get_option('banned_stats');
$banned_options = get_option('banned_options');
?>
<script type="text/javascript">
/* <![CDATA[*/
var checked = 0;
function banned_default_templates(template) {
var default_template;
switch(template) {
case "message":
default_template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" <?php
echo str_replace('"', '\\"', get_language_attributes());
?>
>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<?php
echo get_option('blog_charset');
?>
\" />\n<title>%SITE_NAME% - %SITE_URL%</title>\n</head>\n<body>\n<div id=\"wp-ban-container\">\n<p style=\"text-align: center; font-weight: bold;\"><?php
_e('You Are Banned.', 'wp-ban');
?>
</p>\n</div>\n</body>\n</html>";
break;
}
jQuery("#banned_template_" + template).val(default_template);
}
function toggle_checkbox() {
for(i = 0; i < <?php
echo sizeof($banned_stats['users']);
示例5: ban_activate
function ban_activate()
{
add_option('banned_ips', array());
add_option('banned_hosts', array());
add_option('banned_stats', array('users' => array(), 'count' => 0));
add_option('banned_message', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html xmlns="http://www.w3.org/1999/xhtml" ' . get_language_attributes() . '>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/html; charset=' . get_option('blog_charset') . '" />' . "\n" . '<title>%SITE_NAME% - %SITE_URL%</title>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . '<div id="wp-ban-container">' . "\n" . '<p style="text-align: center; font-weight: bold;">' . __('You Are Banned.', 'wp-ban') . '</p>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>', 'Banned Message');
// Database Upgrade For WP-Ban 1.11
add_option('banned_referers', array());
add_option('banned_exclude_ips', array());
add_option('banned_ips_range', array());
// Database Upgrade For WP-Ban 1.30
add_option('banned_user_agents', array());
// Database Upgrade For WP-Ban 1.64
add_option('banned_options', array('reverse_proxy' => 0));
}
示例6: register
/**
* @param Pimple\Container $app
* @return void
*/
public function register(Container $app)
{
$app['view'] = function (Container $app) {
// Basic configuration information
$loader = new Twig_Loader_Filesystem($this->config['view_path']);
$twig = new Twig_Environment($loader, ['cache' => $this->config['cache_path'] . '/views', 'auto_reload' => true, 'debug' => env('APP_DEBUG'), 'strict_variables' => true]);
// Additional template functions
$post = new Twig_SimpleFunction('post', function ($ids, $withCustomFields = true, $type = 'post') {
$collection = Post::make();
if ($withCustomFields) {
$collection->withCustomFields();
}
return $collection->in($ids)->type($type)->first();
});
$posts = new Twig_SimpleFunction('posts', function ($ids, $withCustomFields = true, $type = 'post') {
$collection = Post::make();
if ($withCustomFields) {
$collection->withCustomFields();
}
return $collection->in($ids)->type($type)->get();
});
$user = new Twig_SimpleFunction('user', function ($ids, $withCustomFields = true) {
$collection = User::make();
if ($withCustomFields) {
$collection->withCustomFields();
}
return $collection->in($ids)->first();
});
$users = new Twig_SimpleFunction('users', function ($ids, $withCustomFields = true) {
$collection = User::make();
if ($withCustomFields) {
$collection->withCustomFields();
}
return $collection->in($ids)->get();
});
$images = new Twig_SimpleFunction('images', function ($ids, $size = null) {
return Image::make()->in($ids)->size($size)->get();
});
$image = new Twig_SimpleFunction('image', function ($ids, $size = null) {
return Image::make()->in($ids)->size($size)->first();
});
$dump = new Twig_SimpleFunction('dump', function ($value) {
return var_dump($value);
});
$dd = new Twig_SimpleFunction('dd', function ($value) {
return dd($value);
});
$pagination = new Twig_SimpleFunction('pagination', function ($value = 3) {
return Pagination::get($value);
});
$wp_footer = new Twig_SimpleFunction('wp_footer', function () {
return wp_footer();
});
$wp_head = new Twig_SimpleFunction('wp_head', function () {
return wp_head();
});
$wp_title = new Twig_SimpleFunction('wp_title', function () {
return wp_title();
});
// Global variables
$twig->addGlobal('languages', get_language_attributes());
// Register all of the custom functions
$twig->addFunction($post);
$twig->addFunction($posts);
$twig->addFunction($user);
$twig->addFunction($users);
$twig->addFunction($images);
$twig->addFunction($image);
$twig->addFunction($dump);
$twig->addFunction($dd);
$twig->addFunction($pagination);
$twig->addFunction($wp_footer);
$twig->addFunction($wp_head);
$twig->addFunction($wp_title);
return $twig;
};
}