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


PHP Lang::getAvailableLanguages方法代码示例

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


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

示例1: view

 public function view()
 {
     $this->appendSubheading(__('Preferences'));
     $bIsWritable = true;
     $formHasErrors = is_array($this->_errors) && !empty($this->_errors);
     if (!is_writable(CONFIG)) {
         $this->pageAlert(__('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.'), Alert::ERROR);
         $bIsWritable = false;
     } else {
         if ($formHasErrors) {
             $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR);
         } else {
             if (isset($this->_context[0]) && $this->_context[0] == 'success') {
                 $this->pageAlert(__('Preferences saved.'), Alert::SUCCESS);
             }
         }
     }
     // Get available languages
     $languages = Lang::getAvailableLanguages(new ExtensionManager(Administration::instance()));
     if (count($languages) > 1) {
         // Create language selection
         $group = new XMLElement('fieldset');
         $group->setAttribute('class', 'settings');
         $group->appendChild(new XMLElement('legend', __('System Language')));
         $label = Widget::Label();
         // Get language names
         asort($languages);
         foreach ($languages as $code => $name) {
             $options[] = array($code, $code == Symphony::Configuration()->get('lang', 'symphony'), $name);
         }
         $select = Widget::Select('settings[symphony][lang]', $options);
         $label->appendChild($select);
         $group->appendChild($label);
         $group->appendChild(new XMLElement('p', __('Authors can set up a differing language in their profiles.'), array('class' => 'help')));
         // Append language selection
         $this->Form->appendChild($group);
     }
     ###
     # Delegate: AddCustomPreferenceFieldsets
     # Description: Add Extension custom preferences. Use the $wrapper reference to append objects.
     $this->_Parent->ExtensionManager->notifyMembers('AddCustomPreferenceFieldsets', '/system/preferences/', array('wrapper' => &$this->Form));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $attr = array('accesskey' => 's');
     if (!$bIsWritable) {
         $attr['disabled'] = 'disabled';
     }
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', $attr));
     $this->Form->appendChild($div);
 }
开发者ID:bauhouse,项目名称:sym-calendar,代码行数:50,代码来源:content.systempreferences.php

示例2: viewLanguages

 protected function viewLanguages()
 {
     $h2 = new XMLElement('h2', __('Language selection'));
     $p = new XMLElement('p', __('This installation can speak in different languages, which one are you fluent in?'));
     $this->Form->appendChild($h2);
     $this->Form->appendChild($p);
     $languages = array();
     foreach (Lang::getAvailableLanguages(false) as $code => $lang) {
         $languages[] = array($code, $code === 'en', $lang);
     }
     if (count($languages) > 1) {
         $languages[0][1] = false;
         $languages[1][1] = true;
     }
     $this->Form->appendChild(Widget::Select('lang', $languages));
     $Submit = new XMLElement('div', null, array('class' => 'submit'));
     $Submit->appendChild(Widget::Input('action[proceed]', __('Proceed with installation'), 'submit'));
     $this->Form->appendChild($Submit);
 }
开发者ID:nils-werner,项目名称:symphony-2,代码行数:19,代码来源:class.installerpage.php

示例3: setLanguage

function setLanguage()
{
    require_once 'symphony/lib/toolkit/class.lang.php';
    $lang = NULL;
    if (!empty($_REQUEST['lang'])) {
        $l = preg_replace('/[^a-zA-Z\\-]/', '', $_REQUEST['lang']);
        if (file_exists("./symphony/lib/lang/lang.{$l}.php")) {
            $lang = $l;
        }
    }
    if ($lang === NULL) {
        foreach (Lang::getBrowserLanguages() as $l) {
            if (file_exists("./symphony/lib/lang/lang.{$l}.php")) {
                $lang = $l;
            }
            break;
        }
    }
    ## none of browser accepted languages is available, get first available
    if ($lang === NULL) {
        ## default to English
        if (file_exists('./symphony/lib/lang/lang.en.php')) {
            $lang = 'en';
        } else {
            $l = Lang::getAvailableLanguages();
            if (is_array($l) && count($l) > 0) {
                $lang = $l[0];
            }
        }
    }
    if ($lang === NULL) {
        return NULL;
    }
    try {
        Lang::init('./symphony/lib/lang/lang.%s.php', $lang);
    } catch (Exception $s) {
        return NULL;
    }
    define('__LANG__', $lang);
    return $lang;
}
开发者ID:knupska,项目名称:symphony-2,代码行数:41,代码来源:install.php

示例4: run

 public function run()
 {
     // Make sure a log file is available
     if (is_null(Symphony::Log()) || !file_exists(Symphony::Log()->getLogPath())) {
         self::__render(new InstallerPage('missing-log'));
     }
     // Check essential server requirements
     $errors = self::__checkRequirements();
     if (!empty($errors)) {
         Symphony::Log()->pushToLog(sprintf('Installer - Missing requirements.'), E_ERROR, true);
         foreach ($errors as $err) {
             Symphony::Log()->pushToLog(sprintf('Requirement - %s', $err['msg']), E_ERROR, true);
         }
         self::__render(new InstallerPage('requirements', array('errors' => $errors)));
     }
     // If language is not set and there is language packs available, show language selection pages
     if (!isset($_POST['lang']) && count(Lang::getAvailableLanguages(false)) > 1) {
         self::__render(new InstallerPage('languages'));
     }
     // Check for configuration errors and, if there are no errors, install Symphony!
     if (isset($_POST['fields'])) {
         $errors = self::__checkConfiguration();
         if (!empty($errors)) {
             Symphony::Log()->pushToLog(sprintf('Installer - Wrong configuration.'), E_ERROR, true);
             foreach ($errors as $err) {
                 Symphony::Log()->pushToLog(sprintf('Configuration - %s', $err['msg']), E_ERROR, true);
             }
         } else {
             $disabled_extensions = self::__install();
             self::__render(new InstallerPage('success', array('disabled-extensions' => $disabled_extensions)));
         }
     }
     // Display the Installation page
     self::__render(new InstallerPage('configuration', array('errors' => $errors, 'default-config' => Symphony::Configuration()->get())));
 }
开发者ID:hananils,项目名称:pompodium,代码行数:35,代码来源:class.installer.php

示例5: define

$header = '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title><!-- TITLE --></title>
		<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
		<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
	</head>' . CRLF;
define('kHEADER', $header);
$footer = '
</html>';
define('kFOOTER', $footer);
$warnings = array('no-symphony-dir' => __('No <code>/symphony</code> directory was found at this location. Please upload the contents of Symphony\'s install package here.'), 'no-write-permission-workspace' => __('Symphony does not have write permission to the existing <code>/workspace</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-manifest' => __('Symphony does not have write permission to the <code>/manifest</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-root' => __('Symphony does not have write permission to the root directory. Please modify permission settings on this directory. This is necessary only if you are not including a workspace, and can be reverted once installation is complete.'), 'no-write-permission-htaccess' => __('Symphony does not have write permission to the temporary <code>htaccess</code> file. Please modify permission settings on this file so it can be written to, and renamed.'), 'no-write-permission-symphony' => __('Symphony does not have write permission to the <code>/symphony</code> directory. Please modify permission settings on this directory. This is necessary only during installation, and can be reverted once installation is complete.'), 'existing-htaccess' => __('There appears to be an existing <code>.htaccess</code> file in the Symphony install location. To avoid name clashes, you will need to delete or rename this file.'), 'existing-htaccess-symphony' => __('There appears to be an existing <code>.htaccess</code> file in the <code>/symphony</code> directory.'), 'no-database-connection' => __('Symphony was unable to connect to the specified database. You may need to modify host or port settings.'), 'database-incorrect-version' => __('Symphony requires <code>MySQL 4.1</code> or greater to work. This requirement must be met before installation can proceed.'), 'database-table-clash' => __('The table prefix <code><!-- TABLE-PREFIX --></code> is already in use. Please choose a different prefix to use with Symphony.'), 'user-password-mismatch' => __('The password and confirmation did not match. Please retype your password.'), 'user-invalid-email' => __('This is not a valid email address. You must provide an email address since you will need it if you forget your password.'), 'user-no-username' => __('You must enter a Username. This will be your Symphony login information.'), 'user-no-password' => __('You must enter a Password. This will be your Symphony login information.'), 'user-no-name' => __('You must enter your name.'));
$notices = array('existing-workspace' => __('An existing <code>/workspace</code> directory was found at this location. Symphony will use this workspace.'));
$languages = array();
foreach (array_keys(Lang::getAvailableLanguages()) as $lang) {
    $languages[] = '<a href="?lang=' . $lang . '">' . $lang . '</a>';
}
$languages = count($languages) > 1 ? implode(', ', $languages) : '';
function installResult(&$Page, &$install_log, $start)
{
    if (!defined('_INSTALL_ERRORS_')) {
        $install_log->writeToLog("============================================", true);
        $install_log->writeToLog("INSTALLATION COMPLETED: Execution Time - " . max(1, time() - $start) . " sec (" . date("d.m.y H:i:s") . ")", true);
        $install_log->writeToLog("============================================" . CRLF . CRLF . CRLF, true);
    } else {
        $install_log->pushToLog(_INSTALL_ERRORS_, E_ERROR, true);
        $install_log->writeToLog("============================================", true);
        $install_log->writeToLog("INSTALLATION ABORTED: Execution Time - " . max(1, time() - $start) . " sec (" . date("d.m.y H:i:s") . ")", true);
        $install_log->writeToLog("============================================" . CRLF . CRLF . CRLF, true);
        $Page->setPage('failure');
开发者ID:bauhouse,项目名称:sym-calendar,代码行数:31,代码来源:include.install.php

示例6: __form


//.........这里部分代码省略.........
     $callback = Administration::instance()->getPageCallback();
     $placeholder = $callback['context'][0] == 'edit' ? __('New Password') : __('Password');
     $label = Widget::Label(NULL, NULL, 'column');
     $label->appendChild(Widget::Input('fields[password]', NULL, 'password', array('placeholder' => $placeholder)));
     $fieldset->appendChild(isset($this->_errors['password']) ? Widget::Error($label, $this->_errors['password']) : $label);
     // Confirm password
     $label = Widget::Label(NULL, NULL, 'column');
     $label->appendChild(Widget::Input('fields[password-confirmation]', NULL, 'password', array('placeholder' => __('Confirm Password'))));
     $fieldset->appendChild(isset($this->_errors['password-confirmation']) ? Widget::Error($label, $this->_errors['password']) : $label);
     $group->appendChild($fieldset);
     // Auth token
     if (Administration::instance()->Author->isDeveloper()) {
         $label = Widget::Label();
         $input = Widget::Input('fields[auth_token_active]', 'yes', 'checkbox');
         if ($author->isTokenActive()) {
             $input->setAttribute('checked', 'checked');
         }
         $temp = SYMPHONY_URL . '/login/' . $author->createAuthToken() . '/';
         $label->setValue(__('%s Allow remote login via', array($input->generate())) . ' <a href="' . $temp . '">' . $temp . '</a>');
         $group->appendChild($label);
     }
     $label = Widget::Label(__('Default Area'));
     $sections = SectionManager::fetch(NULL, 'ASC', 'sortorder');
     $options = array();
     // If the Author is the Developer, allow them to set the Default Area to
     // be the Sections Index.
     if ($author->isDeveloper()) {
         $options[] = array('/blueprints/sections/', $author->get('default_area') == '/blueprints/sections/', __('Sections Index'));
     }
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $s) {
             $options[] = array($s->get('id'), $author->get('default_area') == $s->get('id'), $s->get('name'));
         }
     }
     /**
      * Allows injection or manipulation of the Default Area dropdown for an Author.
      * Take care with adding in options that are only valid for Developers, as if a
      * normal Author is set to that option, they will be redirected to their own
      * Author record.
      *
      *
      * @delegate AddDefaultAuthorAreas
      * @since Symphony 2.2
      * @param string $context
      * '/system/authors/'
      * @param array $options
      * An associative array of options, suitable for use for the Widget::Select
      * function. By default this will be an array of the Sections in the current
      * installation. New options should be the path to the page after the `SYMPHONY_URL`
      * constant.
      * @param string $default_area
      * The current `default_area` for this Author.
      */
     Symphony::ExtensionManager()->notifyMembers('AddDefaultAuthorAreas', '/system/authors/', array('options' => &$options, 'default_area' => $author->get('default_area')));
     $label->appendChild(Widget::Select('fields[default_area]', $options));
     $group->appendChild($label);
     $this->Form->appendChild($group);
     // Custom Language Selection
     $languages = Lang::getAvailableLanguages();
     if (count($languages) > 1) {
         // Get language names
         asort($languages);
         $group = new XMLElement('fieldset');
         $group->setAttribute('class', 'settings');
         $group->appendChild(new XMLElement('legend', __('Custom Preferences')));
         $label = Widget::Label(__('Language'));
         $options = array(array(NULL, is_null($author->get('language')), __('System Default')));
         foreach ($languages as $code => $name) {
             $options[] = array($code, $code == $author->get('language'), $name);
         }
         $select = Widget::Select('fields[language]', $options);
         $label->appendChild($select);
         $group->appendChild($label);
         $this->Form->appendChild($group);
     }
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Author'), 'submit', array('accesskey' => 's')));
     if ($this->_context[0] == 'edit' && !$isOwner && !$author->isPrimaryAccount()) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this author'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this author?')));
         $div->appendChild($button);
     }
     $this->Form->appendChild($div);
     /**
      * Allows the injection of custom form fields given the current `$this->Form`
      * object. Please note that this custom data should be saved in own extension
      * tables and that modifying `tbl_authors` to house your data is highly discouraged.
      *
      * @delegate AddElementstoAuthorForm
      * @since Symphony 2.2
      * @param string $context
      * '/system/authors/'
      * @param XMLElement $form
      * The contents of `$this->Form` after all the default form elements have been appended.
      * @param Author $author
      * The current Author object that is being edited
      */
     Symphony::ExtensionManager()->notifyMembers('AddElementstoAuthorForm', '/system/authors/', array('form' => &$this->Form, 'author' => $author));
 }
开发者ID:bauhouse,项目名称:Piano-Sonata,代码行数:101,代码来源:content.systemauthors.php

示例7: rtrim

} else {
    $fields['docroot'] = rtrim(getcwd_safe(), '/');
    $fields['database']['host'] = 'localhost';
    $fields['database']['port'] = '3306';
    $fields['database']['prefix'] = 'sym_';
    $fields['permission']['file'] = '0775';
    $fields['permission']['directory'] = '0775';
    $conf = getDynamicConfiguration();
    $fields['general']['sitename'] = $conf['general']['sitename'];
    $fields['region']['date_format'] = $conf['region']['date_format'];
    $fields['region']['time_format'] = $conf['region']['time_format'];
}
$warnings = array('no-symphony-dir' => __('No <code>/symphony</code> directory was found at this location. Please upload the contents of Symphony\'s install package here.'), 'no-write-permission-workspace' => __('Symphony does not have write permission to the existing <code>/workspace</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-manifest' => __('Symphony does not have write permission to the <code>/manifest</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-root' => __('Symphony does not have write permission to the root directory. Please modify permission settings on this directory. This is necessary only if you are not including a workspace, and can be reverted once installation is complete.'), 'no-write-permission-htaccess' => __('Symphony does not have write permission to the temporary <code>htaccess</code> file. Please modify permission settings on this file so it can be written to, and renamed.'), 'no-write-permission-symphony' => __('Symphony does not have write permission to the <code>/symphony</code> directory. Please modify permission settings on this directory. This is necessary only during installation, and can be reverted once installation is complete.'), 'existing-htaccess' => __('There appears to be an existing <code>.htaccess</code> file in the Symphony install location. To avoid name clashes, you will need to delete or rename this file.'), 'existing-htaccess-symphony' => __('There appears to be an existing <code>.htaccess</code> file in the <code>/symphony</code> directory.'), 'no-database-connection' => __('Symphony was unable to connect to the specified database. You may need to modify host or port settings.'), 'database-table-clash' => __('The table prefix <code><!-- TABLE-PREFIX --></code> is already in use. Please choose a different prefix to use with Symphony.'), 'user-password-mismatch' => __('The password and confirmation did not match. Please retype your password.'), 'user-invalid-email' => __('This is not a valid email address. You must provide an email address since you will need it if you forget your password.'), 'user-no-username' => __('You must enter a Username. This will be your Symphony login information.'), 'user-no-password' => __('You must enter a Password. This will be your Symphony login information.'), 'user-no-name' => __('You must enter your name.'));
$notices = array('existing-workspace' => __('An existing <code>/workspace</code> directory was found at this location. Symphony will use this workspace.'));
$languages = array();
foreach (Lang::getAvailableLanguages() as $lang) {
    $languages[] = '<a href="?lang=' . $lang . '">' . $lang . '</a>';
}
$languages = count($languages) > 1 ? implode(', ', $languages) : '';
class Display
{
    function index(&$Page, &$Contents, $fields)
    {
        global $warnings;
        global $notices;
        global $languages;
        $Form = new XMLElement('form');
        $Form->setAttribute('action', kINSTALL_FILENAME . ($_GET['lang'] ? '?lang=' . $_GET['lang'] : ''));
        $Form->setAttribute('method', 'post');
        /** 
         *
开发者ID:bauhouse,项目名称:sym-fluid960gs,代码行数:31,代码来源:include.install.php

示例8: view

 /**
  * Display overview page
  */
 function view()
 {
     $this->setPageType('table');
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Localisation Manager'))));
     $this->appendSubheading(__('Language Manager'));
     $this->addScriptToHead(URL . '/extensions/localisationmanager/assets/sortit.js', 101);
     // Get extensions
     $overview = Symphony::ExtensionManager()->listAll();
     // Add core
     $overview['symphony'] = array('name' => 'Symphony Core', 'handle' => 'symphony');
     // Sort by  name:
     uasort($overview, array('contentExtensionLocalisationManagerLocalisations', 'sortByName'));
     // Create table head
     $thead = array(array(__('Name'), 'col'), array(__('Export dictionary'), 'col'), array(__('Create dictionary'), 'col'));
     // Create table body
     $tbody = array();
     // Create rows
     if (is_array($overview)) {
         foreach ($overview as $name => $details) {
             if (strpos($about['handle'], 'lang_') !== false) {
                 continue;
             }
             $langlinks = '';
             // Extensions
             if ($name != 'symphony') {
                 $path = EXTENSIONS . '/' . $name . '/lang/';
                 if (file_exists($path)) {
                     $directory = new DirectoryIterator($path);
                     foreach ($directory as $file) {
                         if ($file->isDot()) {
                             continue;
                         }
                         include $file->getPathname();
                         // Get language code
                         $code = explode('.', $file);
                         $code = $code[1];
                         // Create link
                         if (!empty($langlinks)) {
                             $langlinks .= ', ';
                         }
                         $langlinks .= '<a href="' . URL . '/symphony/extension/localisationmanager/download/' . $details['handle'] . '/' . $code . '/">' . ($about['name'] ? $about['name'] : $code) . '</a>';
                     }
                 }
             } else {
                 foreach (Lang::getAvailableLanguages() as $code => $language) {
                     if ($code == 'en') {
                         continue;
                     }
                     // Create link
                     if (!empty($langlinks)) {
                         $langlinks .= ', ';
                     }
                     $langlinks .= '<a href="' . URL . '/symphony/extension/localisationmanager/download/symphony/' . $code . '/">' . $language . '</a>';
                 }
             }
             // Status
             $class = NULL;
             if (empty($langlinks)) {
                 $langlinks = __('No language available');
                 $class = 'inactive';
             }
             // Create cells
             $td1 = Widget::TableData($details['name']);
             $td2 = Widget::TableData(str_replace('%ext%', $about['handle'], $langlinks), $class);
             $td3 = Widget::TableData('+ <a href="' . URL . '/symphony/extension/localisationmanager/download/' . $details['handle'] . '">' . __('Add language') . '</a>');
             // Populate table body
             $tbody[] = Widget::TableRow(array($td1, $td2, $td3), NULL);
         }
     }
     // Build table
     $table = Widget::Table(Widget::TableHead($thead), NULL, Widget::TableBody($tbody));
     // Append table
     $this->Form->appendChild($table);
 }
开发者ID:symphonists,项目名称:localisationmanager,代码行数:77,代码来源:content.localisations.php

示例9: function

ConfigValidator::addCheck('lang_selector_enabled', function ($value, &$error) {
    if (!$value) {
        return true;
    }
    if (Config::get('lang_url_enabled')) {
        return true;
    }
    $error = 'lang_url_enabled must be set to true if lang_selector_enabled is, otherwise the language selector won\'t work';
    return false;
});
ConfigValidator::addCheck('default_language', function ($lang, &$error) {
    if (!$lang) {
        return true;
    }
    $lang = Lang::realCode($lang);
    $available = Lang::getAvailableLanguages();
    if (array_key_exists($lang, $available)) {
        return true;
    }
    $error = 'default_language must be one of the available languages defined in locale.php (' . implode(', ', array_keys($available)) . ')';
    return false;
});
ConfigValidator::addCheck('allow_transfer_expiry_date_extension', function ($pattern, &$error) {
    if (!$pattern) {
        return true;
    }
    if (!is_array($pattern)) {
        $pattern = array($pattern);
    }
    if (!is_int($pattern[0]) || $pattern[0] <= 0) {
        $error = 'allow_transfer_expiry_date_extension expects at least one positive non-zero integer';
开发者ID:eheb,项目名称:renater-decide,代码行数:31,代码来源:ConfigValidation.php

示例10: __form


//.........这里部分代码省略.........
     $group->appendChild(isset($this->_errors['email']) ? $this->wrapFormElementWithError($label, $this->_errors['email']) : $label);
     $this->Form->appendChild($group);
     ###
     ### Login Details ###
     $group = new XMLElement('fieldset');
     $group->setAttribute('class', 'settings');
     $group->appendChild(new XMLElement('legend', __('Login Details')));
     $div = new XMLElement('div');
     $div->setAttribute('class', 'group');
     $label = Widget::Label(__('Username'));
     $label->appendChild(Widget::Input('fields[username]', $author->get('username'), NULL));
     $div->appendChild(isset($this->_errors['username']) ? $this->wrapFormElementWithError($label, $this->_errors['username']) : $label);
     // Only developers can change the user type. Primary account should NOT be able to change this
     if (Administration::instance()->Author->isDeveloper() && !$author->isPrimaryAccount()) {
         $label = Widget::Label(__('User Type'));
         $options = array(array('author', false, __('Author')), array('developer', $author->isDeveloper(), __('Developer')));
         $label->appendChild(Widget::Select('fields[user_type]', $options));
         $div->appendChild($label);
     }
     $group->appendChild($div);
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     if ($this->_context[0] == 'edit') {
         $div->setAttribute('id', 'change-password');
         if (!Administration::instance()->Author->isDeveloper() || $isOwner === true) {
             $div->setAttribute('class', 'triple group');
             $label = Widget::Label(__('Old Password'));
             if (isset($this->_errors['old-password'])) {
                 $label->setAttributeArray(array('class' => 'contains-error', 'title' => $this->_errors['old-password']));
             }
             $label->appendChild(Widget::Input('fields[old-password]', NULL, 'password'));
             $div->appendChild(isset($this->_errors['old-password']) ? $this->wrapFormElementWithError($label, $this->_errors['old-password']) : $label);
         }
     }
     $label = Widget::Label($this->_context[0] == 'edit' ? __('New Password') : __('Password'));
     $label->appendChild(Widget::Input('fields[password]', NULL, 'password'));
     $div->appendChild(isset($this->_errors['password']) ? $this->wrapFormElementWithError($label, $this->_errors['password']) : $label);
     $label = Widget::Label($this->_context[0] == 'edit' ? __('Confirm New Password') : __('Confirm Password'));
     if (isset($this->_errors['password-confirmation'])) {
         $label->setAttributeArray(array('class' => 'contains-error', 'title' => $this->_errors['password-confirmation']));
     }
     $label->appendChild(Widget::Input('fields[password-confirmation]', NULL, 'password'));
     $div->appendChild($label);
     $group->appendChild($div);
     if ($this->_context[0] == 'edit') {
         $group->appendChild(new XMLElement('p', __('Leave password fields blank to keep the current password'), array('class' => 'help')));
     }
     if (Administration::instance()->Author->isDeveloper()) {
         $label = Widget::Label();
         $input = Widget::Input('fields[auth_token_active]', 'yes', 'checkbox');
         if ($author->get('auth_token_active') == 'yes') {
             $input->setAttribute('checked', 'checked');
         }
         $temp = URL . '/symphony/login/' . $author->createAuthToken() . '/';
         $label->setValue(__('%1$s Allow remote login via <a href="%2$s">%2$s</a>', array($input->generate(), $temp)));
         $group->appendChild($label);
     }
     $label = Widget::Label(__('Default Section'));
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $options = array();
     if (is_array($sections) && !empty($sections)) {
         foreach ($sections as $s) {
             $options[] = array($s->get('id'), $author->get('default_section') == $s->get('id'), $s->get('name'));
         }
     }
     $label->appendChild(Widget::Select('fields[default_section]', $options));
     $group->appendChild($label);
     $this->Form->appendChild($group);
     ###
     ### Custom Language Selection ###
     $languages = Lang::getAvailableLanguages(Administration::instance()->ExtensionManager);
     if (count($languages) > 1) {
         // Get language names
         asort($languages);
         $group = new XMLElement('fieldset');
         $group->setAttribute('class', 'settings');
         $group->appendChild(new XMLElement('legend', __('Custom Preferences')));
         $div = new XMLElement('div');
         $div->setAttribute('class', 'group');
         $label = Widget::Label(__('Language'));
         $options = array(array(NULL, is_null($author->get('language')), __('System Default')));
         foreach ($languages as $code => $name) {
             $options[] = array($code, $code == $author->get('language'), $name);
         }
         $select = Widget::Select('fields[language]', $options);
         $label->appendChild($select);
         $group->appendChild($label);
         $this->Form->appendChild($group);
     }
     ###
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : __('Create Author'), 'submit', array('accesskey' => 's')));
     if ($this->_context[0] == 'edit' && !$isOwner && !$author->isPrimaryAccount()) {
         $button = new XMLElement('button', __('Delete'));
         $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this author'), 'type' => 'submit'));
         $div->appendChild($button);
     }
     $this->Form->appendChild($div);
 }
开发者ID:njmcgee,项目名称:njmcgee2,代码行数:101,代码来源:content.systemauthors.php

示例11: __form

 private function __form()
 {
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $center = $layout->createColumn(Layout::LARGE);
     $right = $layout->createColumn(Layout::SMALL);
     require_once LIB . '/class.field.php';
     ## Handle unknow context
     if (!in_array($this->_context[0], array('new', 'edit'))) {
         throw new AdministrationPageNotFoundException();
     }
     $callback = Administration::instance()->getPageCallback();
     if (isset($callback['flag'])) {
         switch ($callback['flag']) {
             case 'saved':
                 $this->alerts()->append(__('User updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/system/users/new/', ADMIN_URL . '/system/users/')), AlertStack::SUCCESS);
                 break;
             case 'created':
                 $this->alerts()->append(__('User created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/system/users/new/', ADMIN_URL . '/system/users/')), AlertStack::SUCCESS);
                 break;
         }
     }
     $isOwner = false;
     /*if(isset($_POST['fields']))
     				$user = $this->user;
     
     			elseif($this->_context[0] == 'edit'){
     
     				if(!$user_id = $this->_context[1]) redirect(ADMIN_URL . '/system/users/');
     
     				if(!$user = UserManager::fetchByID($user_id)){
     					throw new SymphonyErrorPage('The user profile you requested does not exist.', 'User not found');
     				}
     			}
     
     			else */
     if ($this->_context[0] == 'edit' && $this->user->id == Administration::instance()->User->id) {
         $isOwner = true;
     }
     $this->setTitle(__($this->_context[0] == 'new' ? '%1$s &ndash; %2$s &ndash; Untitled' : '%1$s &ndash; %2$s &ndash; %3$s', array(__('Symphony'), __('Users'), $this->user->getFullName())));
     $this->appendSubheading($this->_context[0] == 'new' ? __('New User') : $this->user->getFullName());
     ### Essentials ###
     $fieldset = Widget::Fieldset(__('Essentials'));
     $label = Widget::Label(__('First Name'));
     $label->appendChild(Widget::Input('fields[first_name]', $this->user->{'first_name'}));
     $fieldset->appendChild(isset($this->errors->{'first-name'}) ? Widget::wrapFormElementWithError($label, $this->errors->{'first-name'}) : $label);
     $label = Widget::Label(__('Last Name'));
     $label->appendChild(Widget::Input('fields[last_name]', $this->user->{'last_name'}));
     $fieldset->appendChild(isset($this->errors->{'last-name'}) ? Widget::wrapFormElementWithError($label, $this->errors->{'last-name'}) : $label);
     $label = Widget::Label(__('Email Address'));
     $label->appendChild(Widget::Input('fields[email]', $this->user->email));
     $fieldset->appendChild(isset($this->errors->email) ? Widget::wrapFormElementWithError($label, $this->errors->email) : $label);
     $left->appendChild($fieldset);
     ###
     ### Login Details ###
     $fieldset = Widget::Fieldset(__('Login Details'));
     $label = Widget::Label(__('Username'));
     $label->appendChild(Widget::Input('fields[username]', $this->user->username, NULL));
     $fieldset->appendChild(isset($this->errors->username) ? Widget::wrapFormElementWithError($label, $this->errors->username) : $label);
     if ($this->_context[0] == 'edit') {
         $fieldset->setAttribute('id', 'change-password');
     }
     $label = Widget::Label($this->_context[0] == 'edit' ? __('New Password') : __('Password'));
     $label->appendChild(Widget::Input('fields[password]', NULL, 'password'));
     $fieldset->appendChild(isset($this->errors->password) ? Widget::wrapFormElementWithError($label, $this->errors->password) : $label);
     $label = Widget::Label($this->_context[0] == 'edit' ? __('Confirm New Password') : __('Confirm Password'));
     if (isset($this->errors->{'password-confirmation'})) {
         $label->setAttributeArray(array('class' => 'contains-error', 'title' => $this->errors->{'password-confirmation'}));
     }
     $label->appendChild(Widget::Input('fields[password-confirmation]', NULL, 'password'));
     $fieldset->appendChild($label);
     if ($this->_context[0] == 'edit') {
         $fieldset->appendChild($this->createElement('p', __('Leave password fields blank to keep the current password'), array('class' => 'help')));
     }
     $label = Widget::Label();
     $input = Widget::Input('fields[auth_token_active]', 'yes', 'checkbox');
     if ($this->user->auth_token_active == 'yes') {
         $input->setAttribute('checked', 'checked');
     }
     $temp = ADMIN_URL . '/login/' . $this->user->createAuthToken() . '/';
     $label->appendChild($input);
     $label->appendChild(new DOMText(__('Allow remote login via ')));
     $label->appendChild(Widget::Anchor($temp, $temp));
     $fieldset->appendChild($label);
     $center->appendChild($fieldset);
     ### Default Section ###
     $fieldset = Widget::Fieldset(__('Custom Preferences'));
     $label = Widget::Label(__('Default Section'));
     //$sections = SectionManager::instance()->fetch(NULL, 'ASC', 'sortorder');
     $options = array();
     //if(is_array($sections) && !empty($sections))
     foreach (new SectionIterator() as $s) {
         $options[] = array($s->handle, $this->user->default_section == $s->handle, $s->name);
     }
     $label->appendChild(Widget::Select('fields[default_section]', $options));
     $fieldset->appendChild($label);
     ### Custom Language Selection ###
     $languages = Lang::getAvailableLanguages(true);
     if (count($languages > 1)) {
         // Get language names
//.........这里部分代码省略.........
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:content.systemusers.php

示例12: define

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title><!-- TITLE --></title>
		<link rel="stylesheet" type="text/css" href="' . kINSTALL_ASSET_LOCATION . '/main.css"/>
		<script type="text/javascript" src="' . kINSTALL_ASSET_LOCATION . '/main.js"></script>
	</head>' . CRLF;
define('kHEADER', $header);
$footer = '
</html>';
define('kFOOTER', $footer);
$warnings = array('no-symphony-dir' => __('No <code>/symphony</code> directory was found at this location. Please upload the contents of Symphony\'s install package here.'), 'no-write-permission-workspace' => __('Symphony does not have write permission to the existing <code>/workspace</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-manifest' => __('Symphony does not have write permission to the <code>/manifest</code> directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive <code>chmod -R</code> command.'), 'no-write-permission-root' => __('Symphony does not have write permission to the root directory. Please modify permission settings on this directory. This is necessary only if you are not including a workspace, and can be reverted once installation is complete.'), 'no-write-permission-htaccess' => __('Symphony does not have write permission to the temporary <code>htaccess</code> file. Please modify permission settings on this file so it can be written to, and renamed.'), 'no-write-permission-symphony' => __('Symphony does not have write permission to the <code>/symphony</code> directory. Please modify permission settings on this directory. This is necessary only during installation, and can be reverted once installation is complete.'), 'no-database-connection' => __('Symphony was unable to connect to the specified database. You may need to modify host or port settings.'), 'database-incorrect-version' => __('Symphony requires <code>MySQL 4.1</code> or greater to work. This requirement must be met before installation can proceed.'), 'database-table-clash' => __('The table prefix <code><!-- TABLE-PREFIX --></code> is already in use. Please choose a different prefix to use with Symphony.'), 'user-password-mismatch' => __('The password and confirmation did not match. Please retype your password.'), 'user-invalid-email' => __('This is not a valid email address. You must provide an email address since you will need it if you forget your password.'), 'user-no-username' => __('You must enter a Username. This will be your Symphony login information.'), 'user-no-password' => __('You must enter a Password. This will be your Symphony login information.'), 'user-no-name' => __('You must enter your name.'));
$notices = array('existing-workspace' => __('An existing <code>/workspace</code> directory was found at this location. Symphony will use this workspace.'));
$languages = array();
$current = $_REQUEST['lang'];
foreach (Lang::getAvailableLanguages(false) as $code => $lang) {
    $class = '';
    if ($current == $code || $current == NULL && $code == 'en') {
        $class = ' class="selected"';
    }
    $languages[] = '<li' . $class . '><a href="?lang=' . $code . '">' . $lang . '</a></li>';
}
$languages = implode('', $languages);
function installResult(&$Page, &$install_log, $start)
{
    if (!defined('_INSTALL_ERRORS_')) {
        $install_log->writeToLog("============================================", true);
        $install_log->writeToLog("INSTALLATION COMPLETED: Execution Time - " . max(1, time() - $start) . " sec (" . date("d.m.y H:i:s") . ")", true);
        $install_log->writeToLog("============================================" . CRLF . CRLF . CRLF, true);
    } else {
        $install_log->pushToLog(_INSTALL_ERRORS_, E_ERROR, true);
开发者ID:shobhalakshminarayana,项目名称:Bugaroo,代码行数:31,代码来源:include.install.php

示例13: foreach

<li>
    <a href="{cfg:application_url}" title="{tr:home_page}">
        <span class="fi-home"></span> <label>{tr:home_page}</label>
    </a>
</li>

<?php 
if (Config::get('lang_url_enabled') && Config::get('lang_selector_enabled')) {
    ?>
<li class="has-dropdown" data-action="select_language">
    <a href="#" title="{tr:select_language}">
        <span class="fa fa-language"></span> <label>{tr:language}</label>
    </a>
    <ul class="dropdown">
        <?php 
    foreach (Lang::getAvailableLanguages() as $lang => $content) {
        ?>
        <li>
            <a class="<?php 
        if ($lang == Lang::getCode()) {
            echo 'nocursor';
        }
        ?>
" data-lang="<?php 
        echo $lang;
        ?>
" title="<?php 
        echo $content['name'];
        ?>
">
                <img src="{img:core/<?php 
开发者ID:eheb,项目名称:renater-decide,代码行数:31,代码来源:menu.php

示例14: __set

 /**
  * Setter
  * 
  * @param string $property property to get
  * @param mixed $value value to set property to
  * 
  * @throws BadVoucherException
  * @throws BadStatusException
  * @throws BadExpireException
  * @throws PropertyAccessException
  */
 public function __set($property, $value)
 {
     if ($property == 'additional_attributes') {
         $this->additional_attributes = (object) (array) $value;
     } else {
         if ($property == 'lang') {
             if (!array_key_exists($value, Lang::getAvailableLanguages())) {
                 throw new BadLangCodeException($value);
             }
             $this->lang = (string) $value;
         } else {
             if ($property == 'email_addresses') {
                 if (!is_array($value)) {
                     $value = array($value);
                 }
                 foreach ($value as $email) {
                     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                         throw new BadEmailException($value);
                     }
                 }
                 $this->email_addresses = $value;
             } else {
                 if ($property == 'name') {
                     $this->name = (string) $value;
                 } else {
                     throw new PropertyAccessException($this, $property);
                 }
             }
         }
     }
 }
开发者ID:eheb,项目名称:renater-decide,代码行数:42,代码来源:UserBase.class.php

示例15: showLangSelector

 /**
  * Allows to show the lang selector button
  */
 private function showLangSelector()
 {
     echo "<li class='has-dropdown' id='li_lang'>";
     echo "    <a href='#' title='Choisissez votre langue'><i class='fa fa-language'></i><label>" . lang::tr('Language') . "</label></a>";
     echo "    <ul class='dropdown'>";
     $langs = Lang::getAvailableLanguages();
     $currentLang = Lang::getCode();
     foreach ($langs as $lang => $content) {
         echo "<li>";
         echo "<a class='lang" . ($lang == $currentLang ? ' nocursor' : '') . "' data-lang='" . $lang . "' title='" . $content['name'] . "'>";
         echo "<img src='" . Config::get('site_url') . ('/lib/images/' . $lang . '.png') . "'/> <label>" . $content['name'] . "</label>";
         if ($lang == $currentLang) {
             echo " <i class='fa fa-check'></i>";
         }
         echo "</a>";
         echo "</li>";
     }
     echo "</ul>";
     echo "</li>";
 }
开发者ID:eheb,项目名称:renater-foodle,代码行数:23,代码来源:NotesMenu.class.php


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