本文整理汇总了PHP中Locales::getLocales方法的典型用法代码示例。如果您正苦于以下问题:PHP Locales::getLocales方法的具体用法?PHP Locales::getLocales怎么用?PHP Locales::getLocales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locales
的用法示例。
在下文中一共展示了Locales::getLocales方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
// load all the locale files
$locales = new Locales();
$siteLocales = $locales->getLocales();
$this->setValue("locales", $siteLocales);
parent::render();
}
示例2: render
function render()
{
// get the list of languages available, so that users can choose
$locales = Locales::getLocales();
$this->setValue("locales", $locales);
$config =& Config::getConfig();
// assign default Local to template
$this->setValue("defaultLocale", $config->getValue("default_locale"));
// and render the rest of the contents of the view
parent::render();
}
示例3: render
function render()
{
$this->setValue("blogsettings", $this->_blogInfo->getSettings());
$ts = new TemplateSets();
$templates = $ts->getBlogTemplateSets($this->_blogInfo->getId(), true);
$this->setValue("templates", $templates);
// loading all the locales from disk is a pretty heavy task but doing so, we'll get
// nice Locale object with things like the encoding, the description, etc... which looks
// waaaay nicer than just showing the locale code
$this->setValue("locales", Locales::getLocales());
parent::render();
}
示例4: AdminEditSiteBlogView
function AdminEditSiteBlogView($blogInfo, $editBlogInfo = null)
{
// fetch information about the blog we're editing
if ($editBlogInfo == null) {
$this->_editBlogInfo = $this->getSessionValue('editBlogInfo');
} else {
$this->_editBlogInfo = $editBlogInfo;
}
// this stuff is a bit weird but I couldn't find a better way to do it!
if ($this->_editBlogInfo) {
$this->AdminTemplatedView($blogInfo, 'editblog');
$this->_error = false;
$this->setSessionValue('editBlogInfo', $this->_editBlogInfo);
// ...
// export data to the view
$this->setValue('editblog', $this->_editBlogInfo);
$this->setValue('editblogsettings', $this->_editBlogInfo->getSettings());
// blog settings...
$blogTemplateSet = $this->_editBlogInfo->getTemplateSet();
$this->setValue('blogTemplate', $blogTemplateSet->getName());
$ts = new TemplateSets();
// get the blog template sets
$this->setValue('templates', $ts->getBlogTemplateSets($this->_editBlogInfo->getId(), true));
// and the list of locale availables
$this->setValue('locales', Locales::getLocales());
$this->setValue('blogStatus', $this->_editBlogInfo->getStatus());
$this->setValue('blogStatusList', BlogStatus::getStatusList());
$blogSettings = $this->_editBlogInfo->getSettings();
$this->setValue('blogTimeOffset', $blogSettings->getValue('time_offset'));
$this->setValue('blogOwner', $this->_editBlogInfo->getOwner());
$this->setValue('blogName', $this->_editBlogInfo->getBlog());
$this->setValue('blogLocale', $blogSettings->getValue("locale"));
$this->setValue('blogResourcesQuota', $this->_editBlogInfo->getResourcesQuota());
// get all the users
$users = new Users();
$siteUsers = $users->getAllUsers();
$this->notifyEvent(EVENT_USERS_LOADED, array('users' => &$siteUsers));
// set the blog users and the available users
$blogUsers = $users->getBlogUsers($this->_editBlogInfo->getId(), false);
$this->setValue('availableusers', $this->filterAvailableUsers($siteUsers, $blogUsers));
$this->setValue('blogusers', $blogUsers);
$this->setValue('siteusers', $siteUsers);
} else {
$this->AdminTemplatedView($blogInfo, 'error');
$this->setValue('message', 'Unexpected error loading blog!');
$this->_error = true;
}
}
示例5: perform
function perform()
{
// retrieve the values from the view
$this->_blogName = $this->_request->getValue("blogName");
$this->_ownerId = $this->_request->getValue("ownerid");
$this->_blogProperties = $this->_request->getValue("properties");
$this->_blogTemplate = $this->_request->getValue("blogTemplate");
$this->_blogLocale = $this->_request->getValue("blogLocale");
// configure the blog
$blogs = new Blogs();
$blog = new BlogInfo($this->_blogName, $this->_ownerId, "", "");
$blog->setProperties($this->_blogProperties);
$blog->setStatus(BLOG_STATUS_ACTIVE);
$blogSettings = $blog->getSettings();
$blogSettings->setValue("locale", $this->_blogLocale);
$blogSettings->setValue("template", $this->_blogTemplate);
$blog->setSettings($blogSettings);
// and now save it to the database
$newblogId = $blogs->addBlog($blog);
if (!$newblogId) {
$this->_view = new WizardView("step4");
$this->_view->setValue("siteLocales", Locales::getLocales());
$ts = new TemplateSets();
$this->_view->setValue("siteTemplates", $ts->getGlobalTemplateSets());
$this->_view->setErrorMessage("There was an error creating the new blog");
$this->setCommonData(true);
return false;
}
// if the blog was created, we can add some basic information
// add a category
$articleCategories = new ArticleCategories();
$articleCategory = new ArticleCategory("General", "", $newblogId, true);
$catId = $articleCategories->addArticleCategory($articleCategory);
// load the right locale
$locale =& Locales::getLocale($this->_blogLocale);
// and load the right text
$articleTopic = $locale->tr("register_default_article_topic");
$articleText = $locale->tr("register_default_article_text");
$article = new Article($articleTopic, $articleText, array($catId), $this->_ownerId, $newblogId, POST_STATUS_PUBLISHED, 0, array(), "welcome");
$t = new Timestamp();
$article->setDateObject($t);
$articles = new Articles();
$articles->addArticle($article);
// save a few things in the default configuration
$config =& Config::getConfig();
// default blog id
$config->saveValue("default_blog_id", (int) $newblogId);
// default locale
$config->saveValue("default_locale", $this->_blogLocale);
// and finally, the default template
$config->saveValue("default_template", $this->_blogTemplate);
//
// detect wether we have GD available and set the blog to use it
//
if (GdDetector::detectGd()) {
$config->saveValue("thumbnail_method", "gd");
$message = "GD has been detected and set as the backend for dealing with images.";
} else {
$pathToConvert = $config->getValue("path_to_convert");
if ($pathToConvert) {
$config->saveValue("thumbnail_method", "imagemagick");
$message = "ImageMagick has been detected and set as the backend for dealing with images.";
} else {
// nothing was found, so we'll have to do away with the 'null' resizer...
$config->saveValue("thumbnail_method", "null");
$message = "Neither GD nor ImageMagick have been detected in this host so it will not be possible to generate thumbnails from images.";
}
}
$this->_view = new WizardView("step5");
$this->_view->setValue("message", $message);
return true;
}