当前位置: 首页>>代码示例>>PHP>>正文


PHP pll_current_language函数代码示例

本文整理汇总了PHP中pll_current_language函数的典型用法代码示例。如果您正苦于以下问题:PHP pll_current_language函数的具体用法?PHP pll_current_language怎么用?PHP pll_current_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pll_current_language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_language

 /**
  * Action: Set Language
  *
  * @param string  $lang_slug
  * @param object  $current_lang  Current language
  */
 public function set_language($lang_slug, $current_lang)
 {
     $this->default_lang = pll_default_language();
     $this->current_lang = pll_current_language();
     acf_update_setting('default_language', $this->default_lang);
     acf_update_setting('current_language', $this->current_lang);
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:13,代码来源:acf.php

示例2: saveOrderLanguage

 /**
  * Save the order language with every checkout
  *
  * @param integer $order the order object
  */
 public function saveOrderLanguage($order)
 {
     $current = pll_current_language();
     if ($current) {
         pll_set_post_language($order, $current);
     }
 }
开发者ID:decarvalhoaa,项目名称:woopoly,代码行数:12,代码来源:Order.php

示例3: footsy

function footsy()
{
    global $popupBoxen;
    echo $popupBoxen;
    if (class_exists('PLL_Base')) {
        echo '<span id="pylangswitcher">';
        //  echo '<li><a id="notice-trans" href="#">notice! (08-30)</a></li>';
        // these are the publicly-available languages
        foreach (unserialize(PRODUCTION_LANGUAGES) as $lang) {
            if ($lang != pll_current_language()) {
                echo '<li><a href="' . get_permalink(pll_get_post(get_the_ID(), $lang)) . '">' . $lang . '</a></li>';
            }
        }
        // these are the ones in development
        if (userIsAdmin() || userIsTranslator() || userIsAssistant()) {
            foreach (unserialize(DEVELOPMENT_LANGUAGES) as $lang) {
                if ($lang != pll_current_language()) {
                    echo '<li><a href="' . get_permalink(pll_get_post(get_the_ID(), $lang)) . '">' . $lang . '</a></li>';
                }
            }
        }
        // old method:  echo pll_the_languages(array('echo'=>0,'display_names_as' => 'slug','hide_current' => 1));
        if (userIsAdmin() || userIsTranslator() || userIsAssistant()) {
            echo '<li><a href="' . admin_url('edit.php?post_type=page') . '">' . __t('Editor') . '</a></li>';
        }
        echo '</span>';
    }
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:28,代码来源:plugin-hooks.php

示例4: wp_new_user_notification

    function wp_new_user_notification($user_id, $plaintext_pass = '')
    {
        //pyboxlog('called wp_n_u_n', 1);
        $user = new WP_User($user_id);
        $body = __t('An account has been created for you on the Computer Science Circles website, with a randomly generated password.

User name: %username%
Current random password: %password%

Please visit
%loginurl%
and change your password to something you will remember. 
Press "%upprof%" once you are done.

Thanks from the Computer Science Circles team!
%siteurl%');
        //pyboxlog('locale:' . pll_current_language('locale'), 1);
        if (class_exists('PLL_Base')) {
            update_user_meta($user_id, 'user_lang', pll_current_language('locale'));
        }
        $subject = __t('Computer Science Circles: New account');
        $user_login = stripslashes($user->user_login);
        $user_email = stripslashes($user->user_email);
        $find = array('/%username%/i', '/%password%/i', '/%blogname%/i', '/%siteurl%/i', '/%loginurl%/i', '/%useremail%/i', '/%upprof%/i');
        $replace = array($user_login, $plaintext_pass, get_option('blogname'), get_option('siteurl'), get_option('siteurl') . '/wp-login.php', $user_email, __t('Update Profile'));
        $body = preg_replace($find, $replace, $body);
        $body = preg_replace("/%.*%/", "", $body);
        pb_mail('"' . get_option('blogname') . '" <' . CSCIRCLES_BOUNCE_EMAIL . '>', '<' . $user_email . '>', $subject, $body);
    }
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:29,代码来源:plugin-new-user-email.php

示例5: nav_menu_add_classes2

function nav_menu_add_classes2($items, $args)
{
    //print_r($items);
    global $post;
    $i = 0;
    $j = false;
    $a = false;
    foreach ($items as $item) {
        $i++;
        if (is_single() && get_post_type() == 'interesting-fact') {
            //get parent page ID by checking which page uses interesting fatcs page template
            $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/interesting_facts.php', 'lang' => pll_current_language('slug')));
            $parent_page_id = $pages[0]->ID;
            if ($item->object_id == $parent_page_id) {
                // $item->classes[] = 'current_page_parent';
                $item->classes[] = 'current_menu_item';
                $j = $i - 1;
                $a = $item->ID;
            }
        }
    }
    if ($j) {
        // $items[$j]->classes[] = 'current_page_parent';
        $items[1]->classes[] = 'current_page_ancestor';
    }
    if ($a) {
        echo $a;
    }
    return $items;
}
开发者ID:uoyknaht,项目名称:kc,代码行数:30,代码来源:not_used_functions.php

示例6: get_slug_pll

 public static function get_slug_pll($slug, $type)
 {
     $id = self::get_id_by_slug($slug, $type);
     $id = pll_get_post($id, pll_current_language());
     $data = get_post($id, ARRAY_A);
     return $data['post_name'];
 }
开发者ID:gnribeiro,项目名称:turim,代码行数:7,代码来源:Helper.php

示例7: get_context_data

 /**
  * Get data from context
  * @author Joachim Jensen <jv@intox.dk>
  * @since  2.0
  * @return array
  */
 public function get_context_data()
 {
     $data = array($this->id);
     if (function_exists('pll_current_language')) {
         $data[] = pll_current_language();
     }
     return $data;
 }
开发者ID:adamjcsmith,项目名称:new-csp,代码行数:14,代码来源:polylang.php

示例8: pll_get_locale

 /**
  * Filter WordPress current locale with Polylang's current locale.
  *
  * @used-by  Filters\"locale"
  * @param    string  $locale  The locale ID.
  */
 public function pll_get_locale($locale)
 {
     $pll_locale = pll_current_language('locale');
     if ($locale !== $pll_locale) {
         $locale = $pll_locale;
     }
     return $locale;
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:14,代码来源:compat.php

示例9: dbProblemSummary

function dbProblemSummary($limit, $sortname, $sortorder, $req = NULL)
{
    global $db_query_info;
    $db_query_info = array();
    if ($req == NULL) {
        $req = $_REQUEST;
    }
    $db_query_info['type'] = 'problem-summary';
    if (!is_user_logged_in()) {
        return __t("You must log in to view past submissions.");
    }
    $problemslug = getSoft($req, "p", "");
    //which problem?
    if ($problemslug == "") {
        return __t("You must enter a non-empty problem name.");
    }
    global $wpdb;
    $problem_table = $wpdb->prefix . "pb_problems";
    $problemname = $wpdb->get_var($wpdb->prepare("SELECT publicname FROM {$problem_table} WHERE lang = '%s' AND slug = '%s'", pll_current_language(), $problemslug));
    if ($problemname == null) {
        return sprintf(__t("Problem %s not found (at least in current language)"), $problemslug);
    }
    $db_query_info['problem'] = $problemslug;
    $u = wp_get_current_user();
    $uid = $u->ID;
    $db_query_info['viewuser'] = $uid;
    $ulogin = $u->user_login;
    $submit_table = $wpdb->prefix . "pb_submissions";
    $usermeta_table = $wpdb->prefix . "usermeta";
    $user_table = $wpdb->prefix . "users";
    $complete_table = $wpdb->prefix . "pb_completed";
    $count = $wpdb->get_var(userIsAdmin() ? "SELECT count(1) FROM {$user_table}" : $wpdb->prepare("SELECT count(1) FROM {$usermeta_table} WHERE meta_key=%s AND meta_value=%s", 'pbguru', $ulogin));
    $students = $wpdb->get_results(userIsAdmin() ? "SELECT ID FROM {$user_table} {$limit}" : $wpdb->prepare("SELECT user_id AS ID FROM {$usermeta_table} WHERE meta_key=%s AND meta_value=%s {$limit}", 'pbguru', $ulogin));
    // no sorting allowed due to weird nature of query
    $flexirows = array();
    foreach ($students as $r) {
        $sid = $r->ID;
        $sdata = $wpdb->get_row($wpdb->prepare("SELECT usercode, beginstamp FROM {$submit_table} \n                        WHERE userid={$sid} and problem='%s' and result='Y'\n                        ORDER BY beginstamp DESC limit 1", $problemslug));
        $s = get_userdata($sid);
        $cell = array();
        $cell['ID'] = $sid;
        $cell['info'] = userString($sid);
        if ($sdata != null) {
            $cell[__t('latest correct')] = prebox($sdata->usercode);
            $cell[__t('last time')] = $sdata->beginstamp;
            $cell[__t('first time')] = $wpdb->get_var($wpdb->prepare("SELECT time FROM {$complete_table} WHERE userid={$sid} and problem='%s'", $problemslug));
        } else {
            $cell[__t('latest correct')] = '<i>n/a</i>';
            $cell[__t('last time')] = '<i>n/a</i>';
            $cell[__t('first time')] = '<i>n/a</i>';
        }
        $flexirows[] = array('id' => $sid, 'cell' => $cell);
    }
    return array('total' => $count, 'rows' => $flexirows);
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:55,代码来源:db-problem-summary.php

示例10: nueva_url

function nueva_url()
{
    if (pll_current_language('slug') == "fr") {
        $url = home_url();
    } elseif (pll_current_language('slug') == "es") {
        $url = home_url();
    } else {
        $url = home_url();
    }
    echo $url;
}
开发者ID:bellop,项目名称:bellop,代码行数:11,代码来源:functions.php

示例11: addToContext

 /**
  * Add things to the context for every twig template
  * @param $context
  * @return mixed
  */
 function addToContext($context)
 {
     $context['menu'] = new TimberMenu();
     $context['site'] = $this;
     $context['is_home'] = is_front_page() ? "true" : "false";
     $context['home_url'] = get_home_url();
     if (function_exists("pll_current_language")) {
         $context['current_lang'] = pll_current_language();
     }
     return $context;
 }
开发者ID:VincentPeters,项目名称:stash,代码行数:16,代码来源:functions.php

示例12: get_language

 /**
  * Return the language 2-4 letters code
  *
  * @since   1.0.0
  *
  * @return     string 4 letters cod of the locale
  */
 function get_language()
 {
     if (defined('ICL_LANGUAGE_CODE')) {
         return ICL_LANGUAGE_CODE;
     } elseif (function_exists('cml_get_browser_lang')) {
         return cml_get_browser_lang();
     } elseif (function_exists('pll_current_language')) {
         return pll_current_language();
     } else {
         // Return a 2-4 letters code
         return get_locale();
     }
 }
开发者ID:wpbp,项目名称:language,代码行数:20,代码来源:language.php

示例13: get_site_language

 /**
  * Get the current language.
  *
  * Uses the WordPress locale setting, but also checks for WPML and Polylang.
  *
  * @return string
  */
 protected function get_site_language()
 {
     $language = get_bloginfo('language');
     if (defined('ICL_LANGUAGE_CODE')) {
         $language = ICL_LANGUAGE_CODE;
     }
     if (function_exists('pll_current_language')) {
         $language = pll_current_language('slug');
     }
     /**
      * Filters the displayed site language.
      *
      * @param string $language Site language.
      */
     return apply_filters('user_feedback_site_language', $language);
 }
开发者ID:kreapress,项目名称:user-feedback,代码行数:23,代码来源:DataProvider.php

示例14: add_to_context

 public function add_to_context($context)
 {
     /* Menu */
     $context['menu'] = new TimberMenu('primary_navigation');
     /* Site info */
     $context['site'] = $this;
     /* Boolean if is homepage */
     $context['is_home'] = is_front_page() ? "true" : "false";
     /* homepage url */
     $context['home_url'] = get_home_url();
     /* if multilang is enabled return current language */
     if (function_exists("pll_current_language")) {
         $context['current_lang'] = pll_current_language();
     }
     return $context;
 }
开发者ID:undefinedio,项目名称:stash,代码行数:16,代码来源:timber.php

示例15: search_link

 /**
  * Retrieve permalink for search.
  *
  * @param string $query Optional. The query string to use. If empty the current query is used.
  * @return string
  */
 function search_link($link, $search)
 {
     $lang = pll_current_language();
     $slug = pll_translations_x('search', 'URI slug', 'boilerplate', $lang);
     //$link = "/$slug/$search";
     $link = "/{$search}";
     $link = home_url(user_trailingslashit($link, 'search'));
     /**
      * Filter the search permalink.
      *
      * @param string $link   Search permalink.
      * @param string $search The URL-encoded search term.
      */
     var_dump($link);
     var_dump($search);
     return apply_filters('pll_search_link', $link, $search);
 }
开发者ID:locomotivemtl,项目名称:wordpress-boilerplate,代码行数:23,代码来源:search.php


注:本文中的pll_current_language函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。