コード例 #1
0
ファイル: dotpay.php プロジェクト: dotpay/dotpay
 /**
  * Returns language code for customer language
  * @return string
  */
 public function getDotLang()
 {
     $lang = strtolower(LanguageCore::getIsoById($this->context->cookie->id_lang));
     if (in_array($lang, $this->config->getDotpayAvailableLanguage())) {
         return $lang;
     } else {
         return "en";
     }
 }
コード例 #2
0
ファイル: LegacyContext.php プロジェクト: M03G/PrestaShop
 /**
  * Returns language ISO code set for the current employee
  * @return array Languages
  */
 public function getEmployeeLanguageIso()
 {
     return \LanguageCore::getIsoById($this->getContext()->employee->id_lang);
 }
コード例 #3
0
 public function countProductWords($products)
 {
     if (!$products) {
         return array();
     }
     $counts = array();
     if (is_array($products)) {
         foreach ($products as $id_product) {
             $counts = $this->array_merge_sum($this->countProductWords($id_product), $counts);
         }
         return $counts;
     } else {
         $id_product = $products;
     }
     $product = new Product($id_product, true);
     foreach ($product->name as $id_lang => $name) {
         $counts['name'][LanguageCore::getIsoById($id_lang)] = str_word_count($name);
     }
     foreach ($product->description as $id_lang => $description) {
         $counts['description'][LanguageCore::getIsoById($id_lang)] = str_word_count($description);
     }
     foreach ($product->description_short as $id_lang => $description_short) {
         $counts['description_short'][LanguageCore::getIsoById($id_lang)] = str_word_count($description_short);
     }
     foreach ($product->meta_title as $id_lang => $meta_title) {
         $counts['meta_title'][LanguageCore::getIsoById($id_lang)] = str_word_count($meta_title);
     }
     foreach ($product->meta_description as $id_lang => $meta_description) {
         $counts['meta_description'][LanguageCore::getIsoById($id_lang)] = str_word_count($meta_description);
     }
     foreach ($product->meta_keywords as $id_lang => $meta_keywords) {
         $counts['meta_keywords'][LanguageCore::getIsoById($id_lang)] = str_word_count($meta_keywords);
     }
     foreach ($product->link_rewrite as $id_lang => $link_rewrite) {
         $counts['link_rewrite'][LanguageCore::getIsoById($id_lang)] = str_word_count($link_rewrite);
     }
     if ($product->tags) {
         foreach ($product->tags as $id_lang => $tags) {
             $tags_count = 0;
             foreach ($tags as $tag) {
                 $tags_count += str_word_count($tag);
             }
             $counts['tags'][LanguageCore::getIsoById($id_lang)] = $tags_count;
         }
     }
     return $counts;
 }
コード例 #4
0
 /**
  * Returns language iso from context.
  */
 private function getLanguageIso()
 {
     $langId = Context::getContext()->employee instanceof \Employee ? Context::getContext()->employee->id_lang : Context::getContext()->language->iso_code;
     return \LanguageCore::getIsoById($langId);
 }