本文整理汇总了PHP中Languages类的典型用法代码示例。如果您正苦于以下问题:PHP Languages类的具体用法?PHP Languages怎么用?PHP Languages使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Languages类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllWebSiteLanguage
public function getAllWebSiteLanguage()
{
$languageSelect = new Languages();
$select = $languageSelect->select();
$languageData = $languageSelect->fetchAll($select);
return $languageData;
}
示例2: getMainform
/**
*
*/
public function getMainform()
{
$this->setName('safinstances');
$label = new Zend_Form_Element_Text('label');
$label->setLabel('label');
$label->setRequired(true);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Save');
$submit->setAttrib('id', 'submitbuttona');
$domain = new Zend_Form_Element_Text('domain');
$domain->setLabel('Main domain name');
$domain->setRequired(true);
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('Description');
$languagesId = new Zend_Form_Element_Select('languages_id');
$options = new Languages();
foreach ($options->fetchAlltoFlatArray() as $k => $v) {
$languagesId->addMultiOption($k, $v['mlabel']);
}
$languagesId->setLabel('Main language');
$creationdate = new Zend_Form_Element_Text('creationdate');
$creationdate->setLabel('Creation date');
$offlinedate = new Zend_Form_Element_Text('offlinedate');
$offlinedate->setLabel('Offline date');
$active = new Zend_Form_Element_Checkbox('active');
$active->setLabel('Is Active?');
$offlinemessage = new Zend_Form_Element_Textarea('offlinemessage');
$offlinemessage->setLabel('Offline message');
$this->addElements(array($this->idb, $this->hashb, $label, $domain, $description, $languagesId, $creationdate, $offlinedate, $active, $offlinemessage));
$this->addElements(array($submit));
return $this;
}
示例3: constructRulesUsingCallBack
function constructRulesUsingCallBack($rules, \Languages $langs, $task)
{
foreach ($rules as $fieldType => $rule) {
foreach ($langs->all() as $lang) {
$task($langRules, $fieldType, $lang, $rule);
}
}
return $langRules;
}
示例4: Show
public function Show($parameters)
{
$output = "";
$ns = new Zend_Session_Namespace();
$languageID = Languages::get_language_id($ns->lang);
$mainviewhelper = new Zend_View();
$mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
$view = new Zend_View();
$view->addScriptPath('../library/Shineisp/Custom/views');
$translator = Shineisp_Registry::getInstance()->Zend_Translate;
if (!empty($parameters['code'])) {
$code = $parameters['code'];
} else {
return "";
}
// Get the products
$data = Products::GetProductsByGroupCode($code, $languageID);
// Check the existence of the mandatories attributes
if (!empty($data['attributes'][0])) {
$view->attributes = $data['attributes'];
}
// Check if there are values set for the group of the product selected
if (!empty($data['attributes_values'][0])) {
$view->values = $data['attributes_values'];
}
// Get the products
if (!empty($data['products'][0])) {
$view->products = $data['products'];
}
$view->mainviewhelper = $mainviewhelper;
// Path of the template
return $view->render('productsattributes.phtml');
}
示例5: _initLanguages
protected function _initLanguages()
{
$this->languages = \Languages::findByPublished(true);
if (sizeof($this->languages) < 2) {
$this->currentLang = $this->languages[0];
return;
}
$currentLangCode = $this->request()->get('lang');
if (!$currentLangCode) {
$currentLangCode = Factory::getCookie()->read('lang');
}
if (!$currentLangCode) {
$this->currentLang = \Languages::findOneByDefault(true);
$currentLangCode = $this->currentLang->getLangCode();
}
Factory::getCookie()->write('lang', $currentLangCode);
if (Factory::getRouter()->getUrl() == '/' && !$this->request()->get('lang')) {
$this->redirect($currentLangCode);
}
if (!$this->currentLang) {
$this->currentLang = \Languages::findOneByLangCode($currentLangCode);
}
$translator = Translator::getInstance();
$translator->setLocale($currentLangCode);
Cms::$currentLang = $this->currentLang;
}
示例6: details
/**
* Show template details page
*
* @param void
* @return null
*/
function details()
{
if ($this->active_template->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$template_data = $this->request->post('template');
if (!is_array($template_data)) {
$template_data = array('subject' => $this->active_template->getSubject(), 'body' => $this->active_template->getBody());
}
// if
$this->smarty->assign(array('template' => $template, 'template_data' => $template_data, 'languages' => Languages::findAll()));
if ($this->request->isSubmitted()) {
$this->active_template->setAttributes($template_data);
$save = $template->save();
if ($save && !is_error($save)) {
flash_success('Email template has been updated');
$this->redirectTo('admin_settings_email_templates');
} else {
$this->smarty->assign('errors', $save);
}
// if
}
// if
}
示例7: preDispatch
/**
* Load all the resources
* @see Zend_Controller_Action::preDispatch()
*/
public function preDispatch()
{
$module = $this->getRequest()->getModuleName();
$controller = $this->getRequest()->getControllerName();
// Get all the resources set in the layout.xml file
$css = Shineisp_Commons_Layout::getResources($module, $controller, "css", "base");
$js = Shineisp_Commons_Layout::getResources($module, $controller, "js", "base");
$template = Shineisp_Commons_Layout::getTemplate($module, $controller, "base");
$this->view->doctype('XHTML1_TRANSITIONAL');
$this->view->addBasePath(PUBLIC_PATH . "/skins/setup/base/");
$this->view->headTitle("ShineISP Setup");
$this->view->headMeta()->setName('robots', "INDEX, FOLLOW");
$this->view->headMeta()->setName('author', "Shine Software Company");
$this->view->headMeta()->setName('keywords', "shine software, isp software");
$this->view->headMeta()->setName('description', "This is the ShineISP setup configuration");
$this->view->headLink()->headLink(array('rel' => 'icon', 'type' => 'image/x-icon', 'href' => "/skins/{$module}/base/images/favicon.ico"));
$this->view->headTitle()->setSeparator(' - ');
foreach ($js as $item) {
$this->view->headScript()->appendFile($item['resource']);
}
foreach ($css as $item) {
$this->view->headLink()->appendStylesheet($item['resource']);
}
$this->getHelper('layout')->setLayout('1column');
$session = new Zend_Session_Namespace('setup');
Languages::setDefaultLanguage(PUBLIC_PATH, $session->locale);
if (empty($session->db)) {
$this->_helper->redirector('index', 'database', 'setup');
}
if (empty($session->permissions) || $session->permissions == false) {
$this->_helper->redirector('index', 'checker', 'setup');
}
}
示例8: init
public function init()
{
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$translate = Shineisp_Registry::get('Zend_Translate');
$this->addElement('text', 'title', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Title'), 'class' => 'form-control'));
$this->addElement('textarea', 'body', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Body'), 'class' => 'form-control col-lg-12'));
$this->addElement('text', 'var', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('URL-Key'), 'description' => $translate->_('This is the name of the page. For multilanguages website you can create more page with the same Url-key with different languages.'), 'rows' => 5, 'class' => 'form-control'));
$this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'description' => $translate->_('separate each keyword by a comma'), 'class' => 'col-lg-12 form-control'));
$this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Blocks'), 'class' => 'form-control'));
$this->addElement('textarea', 'xmllayout', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('XML Layout'), 'class' => 'form-control'));
$this->addElement('checkbox', 'blog', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('is Blog post'), 'class' => 'form-control'));
$this->addElement('select', 'parent_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Parent'), 'class' => 'form-control'));
$this->getElement('parent_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getList(true));
$this->addElement('select', 'layout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Content layouts'), 'class' => 'form-control'));
$this->getElement('layout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getLayouts());
$this->addElement('select', 'pagelayout', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Page layouts'), 'class' => 'form-control'));
$this->getElement('pagelayout')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(CmsPages::getPageLayouts());
$this->addElement('multiselect', 'language_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Language'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 3', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4 col-sm-4'));
$this->getElement('language_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Languages::getList());
$this->addElement('checkbox', 'showinmenu', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Show in the navigation menu'), 'class' => 'form-control'));
$this->addElement('checkbox', 'showonrss', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Publish on RSS Feed'), 'class' => 'form-control'));
$this->addElement('checkbox', 'active', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Active'), 'class' => 'form-control'));
$this->addElement('hidden', 'page_id');
}
示例9: Iterator
/**
* Iterator
* Get all the blocks and attach the content within the view called
* @param array $blocks
* @param string $side
*/
private function Iterator($blocks, $side)
{
$ns = new Zend_Session_Namespace('Admin');
$languageID = Languages::get_language_id($ns->lang);
if (!empty($blocks['side'])) {
if ($blocks['side'] == $side) {
$blocks = $blocks['block'];
if (count($blocks) > 1) {
foreach ($blocks as $block) {
$block = CmsBlocks::findbyvar($block['name'], $languageID);
if (!empty($block[0]['body'])) {
echo $block[0]['body'];
}
}
} else {
$block = CmsBlocks::findbyvar($blocks['name'], $languageID);
if (!empty($block[0]['body'])) {
echo $block[0]['body'];
} else {
echo $blocks['name'] . " block not found.";
}
}
}
}
}
示例10: instance
private static function instance()
{
if (!self::$instance instanceof Languages) {
self::$instance = new Languages();
}
return self::$instance;
}
示例11: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setAttrib('accept-charset', 'UTF-8');
$this->setName('safinstances');
$id = new Zend_Form_Element_Hidden('id');
$hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$label = new Zend_Form_Element_Text('label');
$label->setLabel('label');
$domain = new Zend_Form_Element_Text('domain');
$domain->setLabel('domain');
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('description');
$rootpath = new Zend_Form_Element_Text('rootpath');
$rootpath->setLabel('rootpath');
$languagesId = new Zend_Form_Element_Select('languages_id');
$options = new Languages();
$languagesId->addMultiOption('', '----------');
foreach ($options->fetchAlltoFlatArray() as $k => $v) {
$languagesId->addMultiOption($k, $v['mlabel']);
}
$languagesId->setLabel('languages_id');
$database = new Zend_Form_Element_Text('database');
$database->setLabel('database');
$secdomains = new Zend_Form_Element_Text('secdomains');
$secdomains->setLabel('secdomains');
$creationdate = new Zend_Form_Element_Text('creationdate');
$creationdate->setLabel('creationdate');
$offlinedate = new Zend_Form_Element_Text('offlinedate');
$offlinedate->setLabel('offlinedate');
$active = new Zend_Form_Element_Checkbox('active');
$active->setLabel('active');
$offlinemessage = new Zend_Form_Element_Text('offlinemessage');
$offlinemessage->setLabel('offlinemessage');
$metatags = new Zend_Form_Element_Text('metakeywords');
$metatags->setLabel('metakeywords');
$pagMenusSafinstances = new PagmenuslistForm('PagmenusSafinstances');
$pagMenusSafinstances->setLabel('PagmenusSafinstances');
$safinstancesSafModules = new SafmoduleslistForm('SafinstancesSafmodules');
$safinstancesSafModules->setLabel('SafinstancesSafmodules');
$safinstancesUsers = new UserslistForm('SafinstancesUsers');
$safinstancesUsers->setLabel('SafinstancesUsers');
$this->addElements(array($id, $hash, $label, $domain, $description, $rootpath, $languagesId, $database, $secdomains, $creationdate, $offlinedate, $active, $offlinemessage, $safinstancestypeId, $metatags, $pagMenusSafinstances, $safinstancesSafModules, $safinstancesUsers));
$this->addElements(array($submit));
}
示例12: init
public function init()
{
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$this->addElement('select', 'locale', array('decorators' => array('Bootstrap'), 'label' => 'Language', 'class' => 'form-control', 'multioptions' => Languages::getLanguageFiles(PUBLIC_PATH . "/languages")));
$this->addElement('textarea', 'agreement', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'label' => 'Agreements', 'rows' => '10', 'value' => Shineisp_Commons_Utilities::readfile(PUBLIC_PATH . "/../LICENSE")));
$this->addElement('select', 'chkagreement', array('decorators' => array('Bootstrap'), 'label' => 'I agree with the legal terms', 'class' => 'form-control', 'multioptions' => array(1 => 'YES, I agree with the legal terms', 0 => 'NO, I disagree with these legal terms')));
$this->addElement('submit', 'submit', array('label' => 'Continue', 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
}
示例13: DropDown
public static function DropDown()
{
$res = array();
foreach (Languages::model()->findAll() as $record) {
$res[$record->idLanguages] = $record->LanguagesName;
}
return $res;
}
示例14: execute
public function execute()
{
if (!function_exists('memory_get_usage')) {
$this->error("You must compile PHP with --enable-memory-limit", true);
}
$langtool = new Languages();
$memlast = $memstart = memory_get_usage();
$this->output("Base memory usage: {$memstart}\n");
foreach ($langtool->getLanguages() as $langcode) {
Language::factory($langcode);
$memstep = memory_get_usage();
$this->output(sprintf("%12s: %d\n", $langcode, $memstep - $memlast));
$memlast = $memstep;
}
$memend = memory_get_usage();
$this->output(' Total Usage: ' . ($memend - $memstart) . "\n");
}
示例15: getTranslations
/**
* Get the list of the languages by page_id
*
*
* @param integer $index
*/
public static function getTranslations($pageid)
{
$items = array();
$records = Doctrine_Query::create()->from('CmsPagesData')->where("page_id = ?", $pageid)->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
foreach ($records as $record) {
$items[] = Languages::getLanguageLabel($record['language_id']);
}
return implode(", ", $items);
}