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


PHP ET::getLanguages方法代码示例

本文整理汇总了PHP中ET::getLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP ET::getLanguages方法的具体用法?PHP ET::getLanguages怎么用?PHP ET::getLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ET的用法示例。


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

示例1: uninstall

 /**
  * Uninstall a language by removing its directory.
  *
  * @param string $language The name of the language.
  * @return void
  */
 public function uninstall($language = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Make sure the language exists.
     $languages = ET::getLanguages();
     if (!$language or !in_array($language, $languages)) {
         return;
     }
     // Attempt to remove the directory. If we couldn't, show a "not writable" message.
     if (!is_writable($file = PATH_LANGUAGES) or !is_writable($file = PATH_LANGUAGES . "/{$language}") or !rrmdir($file)) {
         $this->message(sprintf(T("message.notWritable"), $file), "warning");
     } else {
         $this->message(T("message.languageUninstalled"), "success");
     }
     $this->redirect(URL("admin/languages"));
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:24,代码来源:ETLanguagesAdminController.class.php

示例2: index

 /**
  * Show and process the settings form.
  *
  * @return void
  */
 public function index()
 {
     // Make an array of languages for the default forum language select.
     $languages = array();
     foreach (ET::getLanguages() as $v) {
         $languages[$v] = ET::$languageInfo[$v]["name"];
     }
     // Get a list of member groups.
     $groups = ET::groupModel()->getAll();
     // Set up the form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/settings");
     // Set the default values for the forum inputs.
     $form->setValue("forumTitle", C("esoTalk.forumTitle"));
     $form->setValue("language", C("esoTalk.language"));
     $form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
     $form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
     $form->setValue("registrationOpen", C("esoTalk.registration.open"));
     $form->setValue("memberListVisibleToGuests", C("esoTalk.members.visibleToGuests"));
     $form->setValue("requireAdminApproval", C("esoTalk.registration.requireAdminApproval"));
     $form->setValue("requireEmailConfirmation", C("esoTalk.registration.requireEmailConfirmation"));
     // If the save button was clicked...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array("esoTalk.forumTitle" => $form->getValue("forumTitle"), "esoTalk.language" => $form->getValue("language"), "esoTalk.forumLogo" => $form->getValue("forumHeader") == "image" ? $this->uploadHeaderImage($form) : false, "esoTalk.defaultRoute" => $form->getValue("defaultRoute"), "esoTalk.registration.open" => $form->getValue("registrationOpen"), "esoTalk.registration.requireEmailConfirmation" => $form->getValue("requireEmailConfirmation"), "esoTalk.members.visibleToGuests" => $form->getValue("memberListVisibleToGuests"));
         // Make sure a forum title is present.
         if (!strlen($config["esoTalk.forumTitle"])) {
             $form->error("forumTitle", T("message.empty"));
         }
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $this->message(T("message.changesSaved"), "success");
             $this->redirect(URL("admin/settings"));
         }
     }
     $this->data("form", $form);
     $this->data("languages", $languages);
     $this->data("groups", $groups);
     $this->title = T("Forum Settings");
     $this->render("admin/settings");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:46,代码来源:ETSettingsAdminController.class.php

示例3: action_index

 /**
  * Show and process the settings form.
  *
  * @return void
  */
 public function action_index()
 {
     // Make an array of languages for the default forum language select.
     $languages = array();
     foreach (ET::getLanguages() as $v) {
         $languages[$v] = ET::$languageInfo[$v]["name"];
     }
     // Set up the form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/settings");
     // Set the default values for the forum inputs.
     $form->setValue("forumTitle", C("esoTalk.forumTitle"));
     $form->setValue("language", C("esoTalk.language"));
     $form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
     $form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
     $form->setValue("forumVisibleToGuests", C("esoTalk.visibleToGuests"));
     $form->setValue("memberListVisibleToGuests", C("esoTalk.members.visibleToGuests"));
     $form->setValue("registrationOpen", C("esoTalk.registration.open"));
     $form->setValue("requireConfirmation", C("esoTalk.registration.requireConfirmation"));
     $c = C("esoTalk.conversation.editPostTimeLimit");
     if ($c === -1) {
         $form->setValue("editPostMode", "forever");
     } elseif ($c === "reply") {
         $form->setValue("editPostMode", "reply");
     } else {
         $form->setValue("editPostMode", "custom");
         $form->setValue("editPostTimeLimit", $c);
     }
     // If the save button was clicked...
     if ($form->validPostBack("save")) {
         $forumLogo = false;
         if ($form->getValue("forumHeader") == "image") {
             if ($form->getValue("forumHeaderOld") != "image") {
                 $forumLogo = $this->uploadHeaderImage($form);
             } else {
                 $forumLogo = !empty($_FILES["forumHeaderImage"]['tmp_name']) ? $this->uploadHeaderImage($form) : C("esoTalk.forumLogo");
             }
         }
         // Construct an array of config options to write.
         $config = array("esoTalk.forumTitle" => $form->getValue("forumTitle"), "esoTalk.language" => $form->getValue("language"), "esoTalk.forumLogo" => $forumLogo, "esoTalk.defaultRoute" => $form->getValue("defaultRoute"), "esoTalk.visibleToGuests" => $form->getValue("forumVisibleToGuests"), "esoTalk.members.visibleToGuests" => $form->getValue("forumVisibleToGuests") and $form->getValue("memberListVisibleToGuests"), "esoTalk.registration.open" => $form->getValue("registrationOpen"), "esoTalk.registration.requireConfirmation" => in_array($v = $form->getValue("requireConfirmation"), array(false, "email", "approval")) ? $v : false);
         switch ($form->getValue("editPostMode")) {
             case "forever":
                 $config["esoTalk.conversation.editPostTimeLimit"] = -1;
                 break;
             case "reply":
                 $config["esoTalk.conversation.editPostTimeLimit"] = "reply";
                 break;
             case "custom":
                 $config["esoTalk.conversation.editPostTimeLimit"] = (int) $form->getValue("editPostTimeLimit");
                 break;
         }
         // Make sure a forum title is present.
         if (!strlen($config["esoTalk.forumTitle"])) {
             $form->error("forumTitle", T("message.empty"));
         }
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $this->message(T("message.changesSaved"), "success autoDismiss");
             $this->redirect(URL("admin/settings"));
         }
     }
     $this->data("form", $form);
     $this->data("languages", $languages);
     $this->title = T("Forum Settings");
     $this->render("admin/settings");
 }
开发者ID:davchezt,项目名称:fireside,代码行数:71,代码来源:ETSettingsAdminController.class.php

示例4: saveLanguage

 /**
  * Save the contents of the language field when the general settings form is submitted.
  *
  * @param string $key The name of the field that was submitted.
  * @param ETForm $form The form object.
  * @param array $preferences An array of preferences to write to the database.
  * @return string
  */
 public function saveLanguage($key, $form, &$preferences)
 {
     $language = $form->getValue($key);
     if (!in_array($language, ET::getLanguages()) or $language == C("esoTalk.language")) {
         $language = null;
     }
     $preferences["language"] = $language;
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:16,代码来源:ETSettingsController.class.php


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