本文整理汇总了PHP中hybrid_get_textdomain函数的典型用法代码示例。如果您正苦于以下问题:PHP hybrid_get_textdomain函数的具体用法?PHP hybrid_get_textdomain怎么用?PHP hybrid_get_textdomain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hybrid_get_textdomain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the theme framework, loads the required files, and calls the
* functions needed to run the theme.
*
* @since 0.7
*/
function init() {
/* Define theme constants. */
$this->constants();
/* Load theme functions. */
$this->functions();
/* Load theme extensions. */
$this->extensions();
/* Load legacy files and functions. */
$this->legacy();
/* Load admin files. */
$this->admin();
/* Theme prefix for creating things such as filter hooks (i.e., "$prefix_hook_name"). */
$this->prefix = hybrid_get_prefix();
/* Load theme textdomain. */
$domain = hybrid_get_textdomain();
$locale = get_locale();
load_textdomain( $domain, locate_template( array( "languages/{$domain}-{$locale}.mo", "{$domain}-{$locale}.mo" ) ) );
/* Initialize the theme's default actions. */
$this->actions();
/* Initialize the theme's default filters. */
$this->filters();
/* Theme init hook. */
do_action( "{$this->prefix}_init" );
}
示例2: Hybrid_Widget_Calendar
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 0.6
*/
function Hybrid_Widget_Calendar() {
$this->prefix = hybrid_get_prefix();
$this->textdomain = hybrid_get_textdomain();
$widget_ops = array( 'classname' => 'calendar', 'description' => __( 'An advanced widget that gives you total control over the output of your calendar.', $this->textdomain ) );
$control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => "{$this->prefix}-calendar" );
$this->WP_Widget( "{$this->prefix}-calendar", __( 'Calendar', $this->textdomain ), $widget_ops, $control_ops );
}
示例3: Hybrid_Widget_Bookmarks
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 0.6
*/
function Hybrid_Widget_Bookmarks() {
$this->prefix = hybrid_get_prefix();
$this->textdomain = hybrid_get_textdomain();
$widget_ops = array( 'classname' => 'bookmarks', 'description' => __( 'An advanced widget that gives you total control over the output of your bookmarks (links).', $this->textdomain ) );
$control_ops = array( 'width' => 800, 'height' => 350, 'id_base' => "{$this->prefix}-bookmarks" );
$this->WP_Widget( "{$this->prefix}-bookmarks", __( 'Bookmarks', $this->textdomain ), $widget_ops, $control_ops );
}
示例4: hybrid_meta_revised
/**
* Add the revised meta tag on single posts and pages (or any post type). This shows the last time the post
* was modified.
*
* @since 0.4.0
*/
function hybrid_meta_revised() {
$revised = '';
if ( is_singular() )
$revised = '<meta name="revised" content="' . get_the_modified_time( esc_attr__( 'l, F jS, Y, g:i a', hybrid_get_textdomain() ) ) . '" />' . "\n";
echo apply_atomic( 'meta_revised', $revised );
}
示例5: Hybrid_Widget_Search
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 0.6
*/
function Hybrid_Widget_Search() {
$this->prefix = hybrid_get_prefix();
$this->textdomain = hybrid_get_textdomain();
$widget_ops = array( 'classname' => 'search', 'description' => __( 'An advanced widget that gives you total control over the output of your search form.', $this->textdomain ) );
$control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-search" );
$this->WP_Widget( "{$this->prefix}-search", __( 'Search', $this->textdomain ), $widget_ops, $control_ops );
}
示例6: Hybrid_Widget_Nav_Menu
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 0.6
*/
function Hybrid_Widget_Nav_Menu() {
$this->prefix = hybrid_get_prefix();
$this->textdomain = hybrid_get_textdomain();
$widget_ops = array( 'classname' => 'nav-menu', 'description' => __( 'An advanced widget that gives you total control over the output of your menus.', $this->textdomain ) );
$control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-nav-menu" );
$this->WP_Widget( "{$this->prefix}-nav-menu", __( 'Navigation Menu', $this->textdomain ), $widget_ops, $control_ops );
}
示例7: custom_field_series
/**
* Grabs series by custom field. Checks for other articles in the series.
* Series identified custom field key 'Series' and unique value.
*
* @todo Fix the multiple hyphens in the series class.
* @todo Allow filtering of title.
*
* @since 0.1
* @param array $args Array of arguments.
*/
function custom_field_series( $args = array() ) {
global $post;
$textdomain = hybrid_get_textdomain();
$series_meta = get_metadata( 'post', $post->ID, 'Series', true );
if ( $series_meta ) {
$defaults = array(
'order' => 'DESC',
'orderby' => 'ID',
'include' => '',
'exclude' => '',
'post_type' => 'any',
'numberposts' => -1,
'meta_key' => 'Series',
'meta_value' => $series_meta,
'echo' => true
);
$args = apply_filters( 'custom_field_series_args', $args );
$args = wp_parse_args( $args, $defaults );
$series_posts = get_posts( $args );
if ( $series_posts ) {
$class = str_replace( array( '_', ' ', ' ' ) , '-', $series_meta );
$class = preg_replace('/[^A-Za-z0-9-]/', '', $class );
$class = strtolower( $class );
$series = '<div class="series series-' . $class . '">';
$series .= '<h4 class="series-title">' . __( 'Articles in this series', $textdomain) . '</h4>';
$series .= '<ul>';
foreach ( $series_posts as $serial ) {
if ( $serial->ID == $post->ID )
$series .= '<li class="current-post">' . $serial->post_title . '</li>';
else
$series .= '<li><a href="' . get_permalink( $serial->ID ) . '" title="' . esc_attr( $serial->post_title ) . '">' . $serial->post_title . '</a></li>';
}
$series .= '</ul></div>';
}
}
$series = apply_filters( 'custom_field_series', $series );
if ( $args['echo'] && $series )
echo $series;
elseif ( $series )
return $series;
}
示例8: hybrid_get_sidebars
/**
* Returns an array of the core framework's available sidebars for use in themes. We'll just set the
* ID (array keys), name, and description of each sidebar. The other sidebar arguments will be set when the
* sidebar is registered.
*
* @since 1.2.0
*/
function hybrid_get_sidebars()
{
/* Get the theme textdomain. */
$domain = hybrid_get_textdomain();
/* Set up an array of sidebars. */
$sidebars = array('primary' => array('name' => _x('Primary', 'sidebar', $domain), 'description' => __('The main (primary) widget area, most often used as a sidebar.', $domain)), 'secondary' => array('name' => _x('Secondary', 'sidebar', $domain), 'description' => __('The second most important widget area, most often used as a secondary sidebar.', $domain)), 'subsidiary' => array('name' => _x('Subsidiary', 'sidebar', $domain), 'description' => __('A widget area loaded in the footer of the site.', $domain)), 'header' => array('name' => _x('Header', 'sidebar', $domain), 'description' => __('Displayed within the site\'s header area.', $domain)), 'before-content' => array('name' => _x('Before Content', 'sidebar', $domain), 'description' => __('Loaded before the page\'s main content area.', $domain)), 'after-content' => array('name' => _x('After Content', 'sidebar', $domain), 'description' => __('Loaded after the page\'s main content area.', $domain)), 'after-singular' => array('name' => _x('After Singular', 'sidebar', $domain), 'description' => __('Loaded on singular post (page, attachment, etc.) views before the comments area.', $domain)));
/* Return the sidebars. */
return $sidebars;
}
示例9: hybrid_post_meta_box_args
/**
* Creates the settings for the post meta box depending on some things in how the theme are set up. Most
* of the available options depend on theme-supported features of the framework.
*
* @since 0.7.0
* @param string $type The post type of the current post in the post editor.
*/
function hybrid_post_meta_box_args( $type = '' ) {
/* Set up some default variables. */
$prefix = hybrid_get_prefix();
$domain = hybrid_get_textdomain();
$meta = array();
/* If no post type is given, default to 'post'. */
if ( empty( $type ) )
$type = 'post';
/* If the current theme supports the 'hybrid-core-seo' feature. */
if ( current_theme_supports( 'hybrid-core-seo' ) ) {
$meta['title'] = array( 'name' => 'Title', 'title' => sprintf( __( 'Document Title: %s', $domain ), '<code><title></code>' ), 'type' => 'text' );
$meta['description'] = array( 'name' => 'Description', 'title' => sprintf( __( 'Meta Description: %s', $domain ), '<code><meta></code>' ), 'type' => 'textarea' );
$meta['keywords'] = array( 'name' => 'Keywords', 'title' => sprintf( __( 'Meta Keywords: %s', $domain ), '<code><meta></code>' ), 'type' => 'text' );
}
/* If the current theme supports the 'custom-field-series' extension. */
if ( current_theme_supports( 'custom-field-series' ) )
$meta['series'] = array( 'name' => 'Series', 'title' => __( 'Series:', $domain ), 'type' => 'text' );
/* If the current theme supports the 'get-the-image' extension. */
if ( current_theme_supports( 'get-the-image' ) )
$meta['thumbnail'] = array( 'name' => 'Thumbnail', 'title' => __( 'Thumbnail:', $domain ), 'type' => 'text' );
/* If the current theme supports the 'post-stylesheets' extension. */
if ( current_theme_supports( 'post-stylesheets' ) )
$meta['stylesheet'] = array( 'name' => 'Stylesheet', 'title' => __( 'Stylesheet:', $domain ), 'type' => 'text' );
/* If the current theme supports the 'hybrid-core-template-hierarchy' and is not a page or attachment. */
if ( current_theme_supports( 'hybrid-core-template-hierarchy' ) && 'page' != $type && 'attachment' != $type ) {
/* Get the post type object. */
$post_type_object = get_post_type_object( $type );
/* If the post type object returns a singular name or name. */
if ( !empty( $post_type_object->labels->singular_name ) || !empty( $post_type_object->name ) ) {
/* Get a list of available custom templates for the post type. */
$templates = hybrid_get_post_templates( array( 'label' => array( "{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template" ) ) );
/* If templates found, allow user to select one. */
if ( 0 != count( $templates ) )
$meta['template'] = array( 'name' => "_wp_{$type}_template", 'title' => __( 'Template:', $domain ), 'type' => 'select', 'options' => $templates, 'use_key_and_value' => true );
}
}
/* $prefix_$type_meta_boxes filter is deprecated. Use $prefix_$type_meta_box_args instead. */
$meta = apply_filters( "{$prefix}_{$type}_meta_boxes", $meta );
/* Allow per-post_type filtering of the meta box arguments. */
return apply_filters( "{$prefix}_{$type}_meta_box_args", $meta );
}
示例10: __construct
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 1.2.0
*/
function __construct()
{
/* Set the widget textdomain. */
$this->textdomain = hybrid_get_textdomain();
/* Set up the widget options. */
$widget_options = array('classname' => 'archives', 'description' => esc_html__('An advanced widget that gives you total control over the output of your archives.', $this->textdomain));
/* Set up the widget control options. */
$control_options = array('width' => 525, 'height' => 350);
/* Create the widget. */
$this->WP_Widget('hybrid-archives', __('Archives', $this->textdomain), $widget_options, $control_options);
}
示例11: __construct
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 1.2.0
*/
function __construct()
{
/* Set the widget prefix. */
$this->prefix = hybrid_get_prefix();
/* Set the widget textdomain. */
$this->textdomain = hybrid_get_textdomain();
/* Set up the widget options. */
$widget_options = array('classname' => 'calendar', 'description' => esc_html__('An advanced widget that gives you total control over the output of your calendar.', $this->textdomain));
/* Set up the widget control options. */
$control_options = array('width' => 200, 'height' => 350);
/* Create the widget. */
$this->WP_Widget('hybrid-calendar', __('Calendar', $this->textdomain), $widget_options, $control_options);
}
示例12: hybrid_meta_box_post_display_template
/**
* Displays the post template meta box.
*
* @since 1.2.0
*/
function hybrid_meta_box_post_display_template($object, $box)
{
/* Get the post type object. */
$post_type_object = get_post_type_object($object->post_type);
/* If the post type object returns a singular name or name. */
if (!empty($post_type_object->labels->singular_name) || !empty($post_type_object->name)) {
/* Get a list of available custom templates for the post type. */
$templates = hybrid_get_post_templates(array('label' => array("{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template")));
}
?>
<input type="hidden" name="hybrid-core-post-meta-box-template" value="<?php
echo wp_create_nonce(basename(__FILE__));
?>
" />
<p>
<?php
if (0 != count($templates)) {
?>
<select name="hybrid-post-template" id="hybrid-post-template" class="widefat">
<option value=""></option>
<?php
foreach ($templates as $label => $template) {
?>
<option value="<?php
echo esc_attr($template);
?>
" <?php
selected(esc_attr(get_post_meta($object->ID, "_wp_{$post_type_object->name}_template", true)), esc_attr($template));
?>
><?php
echo esc_html($label);
?>
</option>
<?php
}
?>
</select>
<?php
} else {
?>
<?php
_e('No templates exist for this post type.', hybrid_get_textdomain());
?>
<?php
}
?>
</p>
<?php
}
示例13: hybrid_meta_box_post_display_seo
/**
* Displays the post SEO meta box.
*
* @since 1.2.0
*/
function hybrid_meta_box_post_display_seo($object, $box)
{
$domain = hybrid_get_textdomain();
?>
<input type="hidden" name="hybrid-core-post-meta-box-seo" value="<?php
echo wp_create_nonce(basename(__FILE__));
?>
" />
<div class="hybrid-post-settings">
<p>
<label for="hybrid-document-title"><?php
_e('Document Title:', $domain);
?>
</label>
<br />
<input type="text" name="hybrid-document-title" id="hybrid-document-title" value="<?php
echo esc_attr(get_post_meta($object->ID, 'Title', true));
?>
" size="30" tabindex="30" style="width: 99%;" />
</p>
<p>
<label for="hybrid-meta-description"><?php
_e('Meta Description:', $domain);
?>
</label>
<br />
<textarea name="hybrid-meta-description" id="hybrid-meta-description" cols="60" rows="2" tabindex="30" style="width: 99%;"><?php
echo esc_textarea(get_post_meta($object->ID, 'Description', true));
?>
</textarea>
</p>
<p>
<label for="hybrid-meta-keywords"><?php
_e('Meta Keywords:', $domain);
?>
</label>
<br />
<input type="text" name="hybrid-meta-keywords" id="hybrid-meta-keywords" value="<?php
echo esc_attr(get_post_meta($object->ID, 'Keywords', true));
?>
" size="30" tabindex="30" style="width: 99%;" />
</p>
</div><!-- .form-table --><?php
}
示例14: Hybrid_Widget_Authors
/**
* Set up the widget's unique name, ID, class, description, and other options.
* @since 0.6
*/
function Hybrid_Widget_Authors() {
$this->prefix = hybrid_get_prefix();
$this->textdomain = hybrid_get_textdomain();
$widget_ops = array( 'classname' => 'authors', 'description' => __( 'An advanced widget that gives you total control over the output of your author lists.',$this->textdomain ) );
$control_ops = array( 'width' => 525, 'height' => 350, 'id_base' => "{$this->prefix}-authors" );
$this->WP_Widget( "{$this->prefix}-authors", __( 'Authors', $this->textdomain ), $widget_ops, $control_ops );
add_action( 'delete_user', array( &$this, 'delete_transient' ) );
add_action( 'user_register', array( &$this, 'delete_transient' ) );
add_action( 'profile_update', array( &$this, 'delete_transient' ) );
add_action( 'save_post', array( &$this, 'delete_transient' ) );
add_action( 'deleted_post', array( &$this, 'delete_transient' ) );
}
示例15: hybrid_load_textdomain
/**
* Filters the 'load_textdomain_mofile' filter hook so that we can change the directory and file name
* of the mofile for translations. This allows child themes to have a folder called /languages with translations
* of their parent theme so that the translations aren't lost on a parent theme upgrade.
*
* @since 0.9.0
* @param string $mofile File name of the .mo file.
* @param string $domain The textdomain currently being filtered.
*/
function hybrid_load_textdomain($mofile, $domain)
{
/* If the $domain is for the parent or child theme, search for a $domain-$locale.mo file. */
if ($domain == hybrid_get_textdomain() || $domain == hybrid_get_child_textdomain()) {
/* Check for a $domain-$locale.mo file in the parent and child theme root and /languages folder. */
$locale = get_locale();
$locate_mofile = locate_template(array("languages/{$domain}-{$locale}.mo", "{$domain}-{$locale}.mo"));
/* If a mofile was found based on the given format, set $mofile to that file name. */
if (!empty($locate_mofile)) {
$mofile = $locate_mofile;
}
}
/* Return the $mofile string. */
return $mofile;
}