本文整理汇总了PHP中get_locale函数的典型用法代码示例。如果您正苦于以下问题:PHP get_locale函数的具体用法?PHP get_locale怎么用?PHP get_locale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_locale函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: UM_Mail
function UM_Mail($user_id_or_email = 1, $subject_line = 'Email Subject', $template, $path = null, $args = array())
{
if (absint($user_id_or_email)) {
$user = get_userdata($user_id_or_email);
$email = $user->user_email;
} else {
$email = $user_id_or_email;
}
$headers = 'From: ' . um_get_option('mail_from') . ' <' . um_get_option('mail_from_addr') . '>' . "\r\n";
$attachments = null;
if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html')) {
$path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . get_locale() . '/' . $template . '.html';
} else {
if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html')) {
$path_to_email = get_stylesheet_directory() . '/ultimate-member/templates/email/' . $template . '.html';
} else {
$path_to_email = $path . $template . '.html';
}
}
if (um_get_option('email_html')) {
$message = file_get_contents($path_to_email);
add_filter('wp_mail_content_type', 'um_mail_content_type');
} else {
$message = um_get_option('email-' . $template) ? um_get_option('email-' . $template) : 'Untitled';
}
$message = um_convert_tags($message, $args);
wp_mail($email, $subject_line, $message, $headers, $attachments);
}
开发者ID:lytranuit,项目名称:wordpress,代码行数:28,代码来源:um-short-functions.php
示例2: load_textdomain
/**
* Load textdomain
*/
function load_textdomain()
{
$domain = 'wp_jwt_auth';
$locale = apply_filters('plugin_locale', get_locale(), $domain);
load_textdomain($domain, WP_LANG_DIR . '/wp-jwt-authentication/' . $domain . '-' . $locale . '.mo');
load_plugin_textdomain($domain, FALSE, dirname(plugin_basename(__FILE__)) . '/languages/');
}
开发者ID:YanikPei,项目名称:wp-jwt-authentication,代码行数:10,代码来源:wp-authentication-kit.php
示例3: admin_enqueue_scripts
/**
* Enqueue scripts and styles
*
* @return void
*/
static function admin_enqueue_scripts()
{
$url = RWMB_CSS_URL . 'jqueryui';
wp_register_style('jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17');
wp_register_style('jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17');
wp_register_style('jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_register_style('jquery-ui-slider', "{$url}/jquery.ui.slider.css", array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_enqueue_style('jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.css", array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.7');
$url = RWMB_JS_URL . 'jqueryui';
wp_register_script('jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.js", array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.7', true);
$deps = array('jquery-ui-timepicker');
$locale = str_replace('_', '-', get_locale());
$timepicker_locale_js_url = '';
if (file_exists(RWMB_DIR . "js/jqueryui/timepicker-i18n/jquery-ui-timepicker-{$locale}.js")) {
$timepicker_locale_js_url = "{$url}/timepicker-i18n/jquery-ui-timepicker-{$locale}.js";
} elseif (strlen($locale) > 2 && file_exists(RWMB_DIR . 'js/jqueryui/timepicker-i18n/jquery-ui-timepicker-' . substr($locale, 0, 2) . '.js')) {
$timepicker_locale_js_url = "{$url}/timepicker-i18n/jquery-ui-timepicker-" . substr($locale, 0, 2) . '.js';
}
if ($timepicker_locale_js_url) {
wp_register_script('jquery-ui-timepicker-i18n', $timepicker_locale_js_url, array('jquery-ui-timepicker'), '0.9.7', true);
$deps = array('jquery-ui-timepicker-i18n');
}
wp_enqueue_script('rwmb-time', RWMB_JS_URL . 'time.js', $deps, RWMB_VER, true);
wp_localize_script('rwmb-time', 'RWMB_Timepicker', array('lang' => $locale));
}
开发者ID:sammyboy45467,项目名称:wp-theme,代码行数:30,代码来源:time.php
示例4: hocwp_dashboard_widget_cache
function hocwp_dashboard_widget_cache($widget_id, $callback, $args = array())
{
$loading = hocwp_dashboard_widget_loading();
$locale = get_locale();
$transient_name = 'hocwp_dashboard_%s';
$transient_name = hocwp_build_transient_name($transient_name, $widget_id . '_' . $locale);
if (false !== ($output = get_transient($transient_name)) && !empty($output)) {
echo $output;
return true;
}
if (!HOCWP_DOING_AJAX) {
echo $loading;
}
if (hocwp_callback_exists($callback)) {
ob_start();
call_user_func($callback, $args);
$html_data = ob_get_clean();
if (!empty($html_data)) {
set_transient($transient_name, $html_data, 12 * HOUR_IN_SECONDS);
}
} else {
echo hocwp_build_message(__('Please set a valid callback for this widget!', 'hocwp-theme'), '');
}
return true;
}
开发者ID:skylarkcob,项目名称:hocwp-projects,代码行数:25,代码来源:utils.php
示例5: i18n
/**
* Internationalization setup
*
* @return void
*/
public function i18n()
{
$domain = 'better-blockquotes';
$locale = apply_filters('plugin_locale', get_locale(), $domain);
load_textdomain($domain, WP_LANG_DIR . "/tinymce-email-button/{$domain}-{$locale}.mo");
load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages/');
}
开发者ID:andershal,项目名称:better-blockquotes,代码行数:12,代码来源:better-blockquotes.php
示例6: foghorn_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override foghorn_setup() in a child theme, add your own foghorn_setup to your child theme's
* functions.php file.
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To style the visual editor.
* @uses add_theme_support() To add support for post thumbnails and automatic feed links.
* @uses register_nav_menus() To add support for navigation menus.
* @uses add_custom_background() To add support for a custom background.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Foghorn 0.1
*/
function foghorn_setup()
{
/**
* Set the content width based on the theme's design and stylesheet.
*/
if (!isset($content_width)) {
$content_width = 560;
}
// Make Foghorn translatable
load_theme_textdomain('foghorn', TEMPLATEPATH . '/languages');
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/{$locale}.php";
if (is_readable($locale_file)) {
require_once $locale_file;
}
// Styles the visual editor with editor-style.css to match the theme style
add_editor_style();
// Add default posts and comments RSS feed links to <head>.
add_theme_support('automatic-feed-links');
// This theme uses wp_nav_menu() in one location.
register_nav_menu('primary', __('Primary Menu', 'foghorn'));
// Adds support for custom backgrounds
add_custom_background();
// Adds theme support for thumbnails
add_theme_support('post-thumbnails');
// Creates an image thumbnail size for multiple displays
add_image_size('multiple-thumb', 325, 205, true);
// Sets up the option panel functions
require_once TEMPLATEPATH . '/extensions/options-functions.php';
}
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:49,代码来源:functions.php
示例7: wpcf7_akismet
function wpcf7_akismet($spam)
{
if ($spam) {
return $spam;
}
if (!wpcf7_akismet_is_available()) {
return false;
}
if (!($params = wpcf7_akismet_submitted_params())) {
return false;
}
$c = array();
$c['comment_author'] = $params['author'];
$c['comment_author_email'] = $params['author_email'];
$c['comment_author_url'] = $params['author_url'];
$c['comment_content'] = $params['content'];
$c['blog'] = get_option('home');
$c['blog_lang'] = get_locale();
$c['blog_charset'] = get_option('blog_charset');
$c['user_ip'] = $_SERVER['REMOTE_ADDR'];
$c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$c['referrer'] = $_SERVER['HTTP_REFERER'];
// http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
$c['comment_type'] = 'contact-form';
if ($permalink = get_permalink()) {
$c['permalink'] = $permalink;
}
$ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW');
foreach ($_SERVER as $key => $value) {
if (!in_array($key, (array) $ignore)) {
$c["{$key}"] = $value;
}
}
return wpcf7_akismet_comment_check($c);
}
开发者ID:zoran180,项目名称:natashazindrou,代码行数:35,代码来源:akismet.php
示例8: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
$instance['lang'] = substr(strtoupper(get_locale()), 0, 2);
echo $args['before_widget'];
if ($instance['title']) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$data_attribs = array('widget-id', 'theme', 'link-color', 'border-color', 'chrome', 'tweet-limit');
$attribs = array('width', 'height', 'lang');
// Start tag output
echo '<a class="twitter-timeline"';
foreach ($data_attribs as $att) {
if (!empty($instance[$att])) {
if ('tweet-limit' == $att && 0 === $instance[$att]) {
continue;
}
if (is_array($instance[$att])) {
echo ' data-' . esc_attr($att) . '="' . esc_attr(join(' ', $instance['chrome'])) . '"';
} else {
echo ' data-' . esc_attr($att) . '="' . esc_attr($instance[$att]) . '"';
}
}
}
foreach ($attribs as $att) {
if (!empty($instance[$att])) {
echo ' ' . esc_attr($att) . '="' . esc_attr($instance[$att]) . '"';
}
}
echo '>' . esc_html__('My Tweets', 'jetpack') . '</a>';
// End tag output
echo $args['after_widget'];
do_action('jetpack_bump_stats_extras', 'widget', 'twitter_timeline');
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:41,代码来源:twitter-timeline.php
示例9: register_plugin
function register_plugin($name, $base)
{
$this->plugin_name = $name;
$this->plugin_base = rtrim(dirname($base), DS);
$this->enqueue_scripts();
$this->enqueue_styles();
$this->initialize_classes();
$this->initialize_options();
if (function_exists('load_plugin_textdomain')) {
$currentlocale = get_locale();
if (!empty($currentlocale)) {
$moFile = dirname(__FILE__) . DS . "languages" . DS . $this->plugin_name . "-" . $currentlocale . ".mo";
if (@file_exists($moFile) && is_readable($moFile)) {
load_textdomain($this->plugin_name, $moFile);
}
}
}
if ($this->debugging == true) {
global $wpdb;
$wpdb->show_errors();
error_reporting(E_ALL);
@ini_set('display_errors', 1);
}
return true;
}
开发者ID:jhersonn20,项目名称:myportal,代码行数:25,代码来源:slideshow-gallery-plugin.php
示例10: load_plugin_textdomain
public function load_plugin_textdomain()
{
$domain = 'ut_portfolio_lang';
$locale = apply_filters('plugin_locale', get_locale(), $domain);
load_textdomain($domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo');
load_plugin_textdomain($domain, FALSE, dirname(plugin_basename($this->file)) . '/lang/');
}
开发者ID:amptdesign,项目名称:ampt-2016,代码行数:7,代码来源:class-ut-portfolio-template.php
示例11: admin_register_scripts
/**
* Register scripts and styles
*/
public static function admin_register_scripts()
{
$url = RWMB_CSS_URL . 'jqueryui';
wp_register_style('jquery-ui-core', "{$url}/jquery.ui.core.css", array(), '1.8.17');
wp_register_style('jquery-ui-theme', "{$url}/jquery.ui.theme.css", array(), '1.8.17');
wp_register_style('wp-datepicker', RWMB_CSS_URL . 'datepicker.css', array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_register_style('jquery-ui-datepicker', "{$url}/jquery.ui.datepicker.css", array('wp-datepicker'), '1.8.17');
wp_register_style('jquery-ui-slider', "{$url}/jquery.ui.slider.css", array('jquery-ui-core', 'jquery-ui-theme'), '1.8.17');
wp_register_style('jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.min.css", array('jquery-ui-datepicker', 'jquery-ui-slider', 'wp-datepicker'), '1.5.0');
$url = RWMB_JS_URL . 'jqueryui';
wp_register_script('jquery-ui-datepicker-i18n', "{$url}/jquery-ui-i18n.min.js", array('jquery-ui-datepicker'), '1.11.4', true);
wp_register_script('jquery-ui-timepicker', "{$url}/jquery-ui-timepicker-addon.min.js", array('jquery-ui-datepicker', 'jquery-ui-slider'), '1.5.0', true);
wp_register_script('jquery-ui-timepicker-i18n', "{$url}/jquery-ui-timepicker-addon-i18n.min.js", array('jquery-ui-timepicker'), '1.5.0', true);
wp_register_script('rwmb-datetime', RWMB_JS_URL . 'datetime.js', array('jquery-ui-datepicker-i18n', 'jquery-ui-timepicker-i18n'), RWMB_VER, true);
wp_register_script('rwmb-date', RWMB_JS_URL . 'date.js', array('jquery-ui-datepicker-i18n', 'jquery-ui-timepicker-i18n'), RWMB_VER, true);
wp_register_script('rwmb-time', RWMB_JS_URL . 'time.js', array('jquery-ui-timepicker-i18n'), RWMB_VER, true);
/**
* Add data to scripts. Prevent loading localized string twice.
* @link https://github.com/rilwis/meta-box/issues/850
*/
$wp_scripts = wp_scripts();
$handles = array('datetime', 'date', 'time');
$locale = str_replace('_', '-', get_locale());
$locale_short = substr($locale, 0, 2);
$data = array('locale' => $locale, 'localeShort' => $locale_short);
foreach ($handles as $handle) {
if (!$wp_scripts->get_data("rwmb-{$handle}", 'data')) {
wp_localize_script("rwmb-{$handle}", 'RWMB_' . ucfirst($handle), $data);
}
}
}
开发者ID:kevin578,项目名称:mrteacherkevin,代码行数:34,代码来源:datetime.php
示例12: danhuaer_setup
function danhuaer_setup()
{
add_editor_style();
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
load_theme_textdomain('danhuaer', get_template_directory() . '/languages');
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/{$locale}.php";
if (is_readable($locale_file)) {
require_once $locale_file;
}
register_nav_menus(array('primary' => __('Primary Navigation', 'danhuaer')));
add_custom_background();
if (!defined('HEADER_TEXTCOLOR')) {
define('HEADER_TEXTCOLOR', '');
}
// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
if (!defined('HEADER_IMAGE')) {
define('HEADER_IMAGE', '%s/i/headers/home-banner.jpg');
}
// The height and width of your custom header. You can hook into the theme's own filters to change these values.
// Add a filter to danhuaer_header_image_width and danhuaer_header_image_height to change these values.
define('HEADER_IMAGE_WIDTH', apply_filters('danhuaer_header_image_width', 1440));
define('HEADER_IMAGE_HEIGHT', apply_filters('danhuaer_header_image_height', 198));
// Don't support text inside the header image.
if (!defined('NO_HEADER_TEXT')) {
define('NO_HEADER_TEXT', true);
}
// Add a way for the custom header to be styled in the admin panel that controls
// custom headers. See danhuaer_admin_header_style(), below.
add_custom_image_header('', 'danhuaer_admin_header_style');
// ... and thus ends the changeable header business.
// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers(array('berries' => array('url' => '%s/i/headers/neihan-banner.jpg', 'thumbnail_url' => '%s/i/headers/neihan-banner.jpg', 'description' => __('Berries', 'danhuaer')), 'path' => array('url' => '%s/i/headers/home-banner.jpg', 'thumbnail_url' => '%s/i/headers/home-banner.jpg', 'description' => __('Path', 'danhuaer'))));
}
开发者ID:nicevoice,项目名称:Danhuaer_wordpress_theme,代码行数:35,代码来源:functions.php
示例13: ClaroPHPMailer
function ClaroPHPMailer()
{
//prevent phpMailer from echo'ing anything
parent::__construct(true);
// set charset
$this->CharSet = get_locale('charset');
if (get_conf('smtp_host') != '') {
// set smtp mode and smtp host
$this->IsSMTP();
$this->Host = get_conf('smtp_host');
if (get_conf('smtp_username') != '') {
// SMTP authentification
$this->SMTPAuth = true;
// turn on SMTP
$this->Username = get_conf('smtp_username');
// SMTP username
$this->Password = get_conf('smtp_password');
// SMTP password
}
if (get_conf('smtp_port') != '') {
$this->Port = (int) get_conf('smtp_port');
}
if (get_conf('smtp_secure') != '') {
$this->SMTPSecure = get_conf('smtp_secure');
}
} else {
// set sendmail mode
$this->IsMail();
}
}
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:sendmail.lib.php
示例14: __construct
/**
* Set up the class.
*
* @access protected
* @since 1.0.0
*/
protected function __construct()
{
$this->languages_directory = apply_filters('charitable_extension_boilerplate_languages_directory', 'charitable-extension-boilerplate/languages');
$this->locale = apply_filters('plugin_locale', get_locale(), $this->textdomain);
$this->mofile = sprintf('%1$s-%2$s.mo', $this->textdomain, $this->locale);
$this->load_textdomain();
}
开发者ID:Charitable,项目名称:Charitable-Extension-Boilerplate,代码行数:13,代码来源:class-charitable-extension-boilerplate-i18n.php
示例15: load_translation
public function load_translation()
{
$this->l = get_locale();
if (!empty($this->l)) {
load_plugin_textdomain('gd-bbpress-attachments', false, 'gd-bbpress-attachments/languages');
}
}
开发者ID:alvarpoon,项目名称:anbig,代码行数:7,代码来源:class.php
示例16: sfc_load_api
function sfc_load_api($appid)
{
?>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php
echo $appid;
?>
', status: true, cookie: true, xfbml: true });
<?php
do_action('sfc_async_init');
// do any other actions sub-plugins might need to do here
?>
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/<?php
echo get_locale();
?>
/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<?php
}
开发者ID:Gecka-Apps,项目名称:Simple-Facebook-Connect,代码行数:27,代码来源:sfc-base.php
示例17: init_language
function init_language()
{
$locale = apply_filters("plugin_locale", get_locale(), 'wplms-dashboard');
if (file_exists(dirname(__FILE__) . '/languages/wplms-dashboard-' . $locale . '.mo')) {
load_textdomain('wplms-dashboard', dirname(__FILE__) . '/languages/wplms-dashboard-' . $locale . '.mo');
}
}
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:7,代码来源:dashboard.php
示例18: geodir_load_translation_geodirpayment
function geodir_load_translation_geodirpayment()
{
$locale = apply_filters('plugin_locale', get_locale(), GEODIRPAYMENT_TEXTDOMAIN);
load_textdomain(GEODIRPAYMENT_TEXTDOMAIN, WP_LANG_DIR . '/' . GEODIRPAYMENT_TEXTDOMAIN . '/' . GEODIRPAYMENT_TEXTDOMAIN . '-' . $locale . '.mo');
load_plugin_textdomain(GEODIRPAYMENT_TEXTDOMAIN, false, dirname(plugin_basename(__FILE__)) . '/geodir-payment-languages');
include_once 'language.php';
}
开发者ID:poweronio,项目名称:mbsite,代码行数:7,代码来源:geodir_payment_manager.php
示例19: toolbox_setup
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* To override toolbox_setup() in a child theme, add your own toolbox_setup to your child theme's
* functions.php file.
*/
function toolbox_setup()
{
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on toolbox, use a find and replace
* to change 'toolbox' to the name of your theme in all the template files
*/
load_theme_textdomain('toolbox', get_template_directory() . '/languages');
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/{$locale}.php";
if (is_readable($locale_file)) {
require_once $locale_file;
}
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support('automatic-feed-links');
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus(array('primary' => __('Primary Menu', 'toolbox')));
/**
* Add support for the Aside and Gallery Post Formats
*/
add_theme_support('post-formats', array('aside', 'image', 'gallery'));
}
开发者ID:rajankz,项目名称:webspace,代码行数:37,代码来源:functions.php
示例20: __construct
/**
* Class constructor
*/
function __construct()
{
//Language Setup
$locale = get_locale();
load_plugin_textdomain($this->localization_domain, false, dirname(plugin_basename(__FILE__)) . '/lang/');
$this->hooks();
}
开发者ID:doobas,项目名称:kazinopaslaptys,代码行数:10,代码来源:User-Specific-Content.php
注:本文中的get_locale函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论