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); }
/** * 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/'); }
/** * 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)); }
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; }
/** * 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/'); }
/** * 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'; }
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); }
/** * 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'); }
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; }
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/'); }
/** * 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); } } }
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')))); }
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(); } }
/** * 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(); }
public function load_translation() { $this->l = get_locale(); if (!empty($this->l)) { load_plugin_textdomain('gd-bbpress-attachments', false, 'gd-bbpress-attachments/languages'); } }
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 }
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'); } }
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'; }
/** * 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')); }
/** * Class constructor */ function __construct() { //Language Setup $locale = get_locale(); load_plugin_textdomain($this->localization_domain, false, dirname(plugin_basename(__FILE__)) . '/lang/'); $this->hooks(); }
/** * Init the Database Abstraction layer for NextGEN Gallery * */ function __construct() { $this->plugin_locale_path = NGGALLERY_ABSPATH . 'lang/'; $this->locale = get_locale(); $this->mo_file = trailingslashit($this->plugin_locale_path) . $this->domain . '-' . $this->locale . '.mo'; $this->mo_url = trailingslashit($this->remote_locale_url) . $this->domain . '-' . $this->locale . '.mo'; }
function mm_ux_log($args = array()) { $url = "https://ssl.google-analytics.com/collect"; global $title; if (empty($_SERVER['REQUEST_URI'])) { return; } $path = explode('wp-admin', $_SERVER['REQUEST_URI']); if (empty($path) || empty($path[1])) { $path = array("", " "); } $defaults = array('v' => '1', 'tid' => 'UA-39246514-3', 't' => 'pageview', 'cid' => md5(get_option('siteurl')), 'uid' => md5(get_option('siteurl') . get_current_user_id()), 'cn' => 'mojo_wp_plugin', 'cs' => 'mojo_wp_plugin', 'cm' => 'plugin_admin', 'ul' => get_locale(), 'dp' => $path[1], 'sc' => '', 'ua' => @$_SERVER['HTTP_USER_AGENT'], 'dl' => $path[1], 'dh' => get_option('siteurl'), 'dt' => $title, 'ec' => '', 'ea' => '', 'el' => '', 'ev' => ''); if (isset($_SERVER['REMOTE_ADDR'])) { $defaults['uip'] = $_SERVER['REMOTE_ADDR']; } $params = wp_parse_args($args, $defaults); $test = get_transient('mm_test', ''); if (isset($test['key']) && isset($test['name'])) { $params['cm'] = $params['cm'] . "_" . $test['name'] . "_" . $test['key']; } //use test account for testing if (defined('WP_DEBUG') && WP_DEBUG) { $params['tid'] = 'UA-19617272-27'; } $z = wp_rand(0, 1000000000); $query = http_build_query(array_filter($params)); $args = array('body' => $query, 'method' => 'POST', 'blocking' => false); $url = add_query_arg(array('z' => $z), $url); wp_remote_post($url, $args); }
/** * Initiate actions. * * @since 1.0. * * @return UnboxInit */ public function __construct() { global $pagenow; // Create the key needed for checking the theme self::$key = 'unbox-' . md5(wp_get_theme()->template); // Determine the path of the Unbox directory relative to the theme directory self::$path = $this->get_relative_path(); // Only load if on the right page if ('themes.php' === $pagenow && isset($_GET['activated']) && true === (bool) $_GET['activated'] && !$this->is_unboxed()) { /** * Load the .mo file. This is a reworking of "load_plugin_textdomain". Given that this is a plugin within * a theme, the file paths do not work correctly with "load_plugin_textdomain" or "load_theme_textdomain". * This functionality implements identical functionality with the correct paths. */ $domain = 'unbox'; $locale = apply_filters('plugin_locale', get_locale(), $domain); $path = WP_LANG_DIR . '/themes/'; $mofile = $domain . '-' . $locale . '.mo'; // Attempt to load from within the languages directory if (true !== load_textdomain($domain, $path . $mofile)) { // As a fallback, load from the plugin $path = trailingslashit(get_template_directory()) . self::$path . '/languages/'; load_textdomain($domain, $path . $mofile); } // Add the CSS and JS to display the unboxing add_action('admin_enqueue_scripts', array($this, 'load_assets'), 20); // Add the HTML to display the unboxing add_action('admin_footer', array($this, 'load_template'), 20); // Because everything is unboxed, denote that the unboxing happened $this->denote_unboxed(); } }
public static function get_template($args = '') { global $l10n; $defaults = array('locale' => null, 'title' => ''); $args = wp_parse_args($args, $defaults); $locale = $args['locale']; $title = $args['title']; if ($locale) { $mo_orig = $l10n['contact-form-7']; wpcf7_load_textdomain($locale); } self::$current = $contact_form = new self(); $contact_form->title = $title ? $title : __('Untitled', 'contact-form-7'); $contact_form->locale = $locale ? $locale : get_locale(); $properties = $contact_form->get_properties(); foreach ($properties as $key => $value) { $properties[$key] = WPCF7_ContactFormTemplate::get_default($key); } $contact_form->properties = $properties; $contact_form = apply_filters('wpcf7_contact_form_default_pack', $contact_form, $args); if (isset($mo_orig)) { $l10n['contact-form-7'] = $mo_orig; } return $contact_form; }
function wpcf7_load_textdomain($locale = null) { global $l10n; $domain = 'contact-form-7'; if (get_locale() == $locale) { $locale = null; } if (empty($locale)) { if (is_textdomain_loaded($domain)) { return true; } else { return load_plugin_textdomain($domain, false, $domain . '/languages'); } } else { $mo_orig = $l10n[$domain]; unload_textdomain($domain); $mofile = $domain . '-' . $locale . '.mo'; $path = WP_PLUGIN_DIR . '/' . $domain . '/languages'; if ($loaded = load_textdomain($domain, $path . '/' . $mofile)) { return $loaded; } else { $mofile = WP_LANG_DIR . '/plugins/' . $mofile; return load_textdomain($domain, $mofile); } $l10n[$domain] = $mo_orig; } return false; }
function __construct() { // helpers add_filter('acf/helpers/get_path', array($this, 'helpers_get_path'), 1, 1); add_filter('acf/helpers/get_dir', array($this, 'helpers_get_dir'), 1, 1); // vars $this->settings = array('path' => apply_filters('acf/helpers/get_path', __FILE__), 'dir' => apply_filters('acf/helpers/get_dir', __FILE__), 'hook' => basename(dirname(__FILE__)) . '/' . basename(__FILE__), 'version' => '4.4.5', 'upgrade_version' => '3.4.1', 'include_3rd_party' => false); // set text domain load_textdomain('acf', $this->settings['path'] . 'lang/acf-' . get_locale() . '.mo'); // actions add_action('init', array($this, 'init'), 1); add_action('acf/pre_save_post', array($this, 'save_post_lock'), 0); add_action('acf/pre_save_post', array($this, 'save_post_unlock'), 999); add_action('acf/save_post', array($this, 'save_post_lock'), 0); add_action('acf/save_post', array($this, 'save_post'), 10); add_action('acf/save_post', array($this, 'save_post_unlock'), 999); add_action('acf/create_fields', array($this, 'create_fields'), 1, 2); // filters add_filter('acf/get_info', array($this, 'get_info'), 1, 1); add_filter('acf/parse_types', array($this, 'parse_types'), 1, 1); add_filter('acf/get_post_types', array($this, 'get_post_types'), 1, 3); add_filter('acf/get_taxonomies_for_select', array($this, 'get_taxonomies_for_select'), 1, 2); add_filter('acf/get_image_sizes', array($this, 'get_image_sizes'), 1, 1); add_filter('acf/get_post_id', array($this, 'get_post_id'), 1, 1); // includes $this->include_before_theme(); add_action('after_setup_theme', array($this, 'include_after_theme'), 1); add_action('after_setup_theme', array($this, 'include_3rd_party'), 1); }
/** * Include Google fonts */ public static function fonts_url() { $fonts_url = ''; $locale = get_locale(); $cyrillic_locales = array('ru_RU', 'mk_MK', 'ky_KY', 'bg_BG', 'sr_RS', 'uk', 'bel'); /** * Translators: If there are characters in your language that are not * supported by Lora, translate this to 'off'. Do not translate * into your own language. */ $libre = _x('on', 'Libre Baskerville font: on or off', 'photolab'); /** * Translators: If there are characters in your language that are not * supported by Open Sans, translate this to 'off'. Do not translate * into your own language. */ $open_sans = _x('on', 'Open Sans font: on or off', 'photolab'); if ('off' !== $libre || 'off' !== $open_sans) { $font_families = array(); if ('off' !== $libre) { $font_families[] = 'Libre Baskerville:400,700,400italic'; } if ('off' !== $open_sans) { $font_families[] = 'Open Sans:300,400,700,400italic,700italic'; } $query_args = array('family' => urlencode(implode('|', $font_families)), 'subset' => urlencode('latin,latin-ext')); if (in_array($locale, $cyrillic_locales)) { $query_args['subset'] = urlencode('latin,latin-ext,cyrillic'); } $fonts_url = add_query_arg($query_args, '//fonts.googleapis.com/css'); } return $fonts_url; }
/** * since 3.2.9.2 */ function qtranxf_default_enabled_languages() { //$locale = defined('WPLANG') ? WPLANG : get_option('WPLANG','en_US'); $locale = get_locale(); if (!$locale) { $locale = 'en_US'; } $lang = null; $locales = qtranxf_default_locale(); foreach ($locales as $ln => $lo) { if ($lo != $locale) { continue; } $lang = $ln; break; } if (!$lang) { $lang = substr($locale, 0, 2); } if (!qtranxf_language_predefined($lang)) { $langs = array(); $langs['language_name'][$lang] = 'Unknown'; $langs['flag'][$lang] = 'us.png'; $langs['locale'][$lang] = $locale; $langs['date_format'][$lang] = '%A %B %e%q, %Y'; $langs['time_format'][$lang] = '%I:%M %p'; $langs['not_available'][$lang] = 'Sorry, this entry is only available in %LANG:, : and %.'; qtranxf_save_languages($langs); } //qtranxf_dbg_log('qtranxf_default_enabled_languages: $lang='.$lang.' $locale:',$locale); return array($lang, $lang != 'en' ? 'en' : 'de'); //return array( 'de', 'en', 'zh' ); }
/** * 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'); wp_register_script('jquery-ui-timepicker', RWMB_JS_URL . 'jqueryui/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '0.9.7', true); // Load localized scripts $locale = str_replace('_', '-', get_locale()); $date_path = 'jqueryui/datepicker-i18n/jquery.ui.datepicker-' . $locale . '.js'; $time_path = 'jqueryui/timepicker-i18n/jquery-ui-timepicker-' . $locale . '.js'; $deps = array('jquery-ui-datepicker', 'jquery-ui-timepicker'); if (file_exists(RWMB_DIR . 'js/' . $date_path)) { wp_register_script('jquery-ui-datepicker-i18n', RWMB_JS_URL . $date_path, array('jquery-ui-datepicker'), '1.8.17', true); $deps[] = 'jquery-ui-datepicker-i18n'; } if (file_exists(RWMB_DIR . 'js/' . $time_path)) { wp_register_script('jquery-ui-timepicker-i18n', RWMB_JS_URL . $time_path, array('jquery-ui-timepicker'), '1.8.17', true); $deps[] = 'jquery-ui-timepicker-i18n'; } wp_enqueue_script('rwmb-datetime', RWMB_JS_URL . 'datetime.js', $deps, RWMB_VER, true); wp_localize_script('rwmb-datetime', 'RWMB_Datetimepicker', array('lang' => $locale)); }
/** * Load the plugin text domain for translation. * * @since 1.7.0 */ public function load_plugin_textdomain() { $domain = 'optionsframework'; $locale = apply_filters('plugin_locale', get_locale(), $domain); load_textdomain($domain, trailingslashit(WP_LANG_DIR) . $domain . '/' . $domain . '-' . $locale . '.mo'); load_plugin_textdomain($domain, FALSE, basename(dirname(__FILE__)) . '/languages'); }