本文整理汇总了PHP中F0FInflector::pluralize方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FInflector::pluralize方法的具体用法?PHP F0FInflector::pluralize怎么用?PHP F0FInflector::pluralize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FInflector
的用法示例。
在下文中一共展示了F0FInflector::pluralize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Public constructor. Instantiates a F0FViewCsv object.
*
* @param array $config The configuration data array
*/
public function __construct($config = array())
{
// Make sure $config is an array
if (is_object($config)) {
$config = (array) $config;
} elseif (!is_array($config)) {
$config = array();
}
parent::__construct($config);
if (array_key_exists('csv_header', $config)) {
$this->csvHeader = $config['csv_header'];
} else {
$this->csvHeader = $this->input->getBool('csv_header', true);
}
if (array_key_exists('csv_filename', $config)) {
$this->csvFilename = $config['csv_filename'];
} else {
$this->csvFilename = $this->input->getString('csv_filename', '');
}
if (empty($this->csvFilename)) {
$view = $this->input->getCmd('view', 'cpanel');
$view = F0FInflector::pluralize($view);
$this->csvFilename = strtolower($view);
}
if (array_key_exists('csv_fields', $config)) {
$this->csvFields = $config['csv_fields'];
}
}
示例2: getRepeatable
public function getRepeatable()
{
$html = '';
// Find which is the relation to use
if ($this->item instanceof F0FTable) {
// Pluralize the name to match that of the relation
$relation_name = F0FInflector::pluralize($this->name);
// Get the relation
$iterator = $this->item->getRelations()->getMultiple($relation_name);
$results = array();
// Decide which class name use in tag markup
$class = !empty($this->element['class']) ? $this->element['class'] : F0FInflector::singularize($this->name);
foreach ($iterator as $item) {
$markup = '<span class="%s">%s</span>';
// Add link if show_link parameter is set
if (!empty($this->element['url']) && !empty($this->element['show_link']) && $this->element['show_link']) {
// Parse URL
$url = $this->getReplacedPlaceholders($this->element['url'], $item);
// Set new link markup
$markup = '<a class="%s" href="' . JRoute::_($url) . '">%s</a>';
}
array_push($results, sprintf($markup, $class, $item->get($item->getColumnAlias('title'))));
}
// Join all html segments
$html .= implode(', ', $results);
}
// Parse field parameters
if (empty($html) && !empty($this->element['empty_replacement'])) {
$html = JText::_($this->element['empty_replacement']);
}
return $html;
}
示例3: addSubmenuLink
private function addSubmenuLink($view, $parent = null)
{
static $activeView = null;
if (empty($activeView)) {
$activeView = $this->input->getCmd('view', 'cpanel');
}
if ($activeView == 'cpanels') {
$activeView = 'cpanel';
}
$key = strtoupper($this->component) . '_TITLE_' . strtoupper($view);
if (strtoupper(JText::_($key)) == $key) {
$altview = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
$key2 = strtoupper($this->component) . '_TITLE_' . strtoupper($altview);
if (strtoupper(JText::_($key2)) == $key2) {
$name = ucfirst($view);
} else {
$name = JText::_($key2);
}
} else {
$name = JText::_($key);
}
$link = 'index.php?option=' . $this->component . '&view=' . $view;
$active = $view == $activeView;
$this->appendLink($name, $link, $active, null, $parent);
}
示例4: accessAllowed
/**
* Checks if the user should be granted access to the current view,
* based on his Master Password setting.
*
* @param string view Optional. The string to check. Leave null to use the current view.
*
* @return bool
*/
public function accessAllowed($view = null)
{
if (interface_exists('JModel')) {
$params = JModelLegacy::getInstance('Storage', 'AdmintoolsModel');
} else {
$params = JModel::getInstance('Storage', 'AdmintoolsModel');
}
if (empty($view)) {
$view = $this->input->get('view', 'cpanel');
}
$altView = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
if (!in_array($view, $this->views) && !in_array($altView, $this->views)) {
return true;
}
$masterHash = $params->getValue('masterpassword', '');
if (!empty($masterHash)) {
$masterHash = md5($masterHash);
// Compare the master pw with the one the user entered
$session = JFactory::getSession();
$userHash = $session->get('userpwhash', '', 'admintools');
if ($userHash != $masterHash) {
// The login is invalid. If the view is locked I'll have to kick the user out.
$lockedviews_raw = $params->getValue('lockedviews', '');
if (!empty($lockedviews_raw)) {
$lockedViews = explode(",", $lockedviews_raw);
if (in_array($view, $lockedViews) || in_array($altView, $lockedViews)) {
return false;
}
}
}
}
return true;
}
示例5: noop
public function noop()
{
if ($customURL = $this->input->getString('returnurl', '')) {
$customURL = base64_decode($customURL);
}
$url = !empty($customURL) ? $customURL : 'index.php?option=' . $this->component . '&view=' . F0FInflector::pluralize($this->view);
$this->setRedirect($url);
}
示例6: onBeforeUnpublish
public function onBeforeUnpublish()
{
$customURL = $this->input->getString('returnurl', '');
if (!$customURL) {
$scan_id = $this->input->getCmd('scan_id', 0);
$url = 'index.php?option=' . $this->component . '&view=' . F0FInflector::pluralize($this->view) . '&scan_id=' . $scan_id;
$this->input->set('returnurl', base64_encode($url));
}
return $this->checkACL('admintools.security');
}
示例7: onAfterStore
/**
* Save fields for many-to-many relations in their pivot tables.
*
* @param F0FTable $table Current item table.
*
* @return bool True if the object can be saved successfully, false elsewhere.
* @throws Exception The error message get trying to save fields into the pivot tables.
*/
public function onAfterStore(&$table)
{
// Retrieve the relations configured for this table
$input = new F0FInput();
$key = $table->getConfigProviderKey() . '.relations';
$relations = $table->getConfigProvider()->get($key, array());
// Abandon the process if not a save task
if (!in_array($input->getWord('task'), array('apply', 'save', 'savenew'))) {
return true;
}
// For each relation check relative field
foreach ($relations as $relation) {
// Only if it is a multiple relation, sure!
if ($relation['type'] == 'multiple') {
// Retrive the fully qualified relation data from F0FTableRelations object
$relation = array_merge(array('itemName' => $relation['itemName']), $table->getRelations()->getRelation($relation['itemName'], $relation['type']));
// Deduce the name of the field used in the form
$field_name = F0FInflector::pluralize($relation['itemName']);
// If field exists we catch its values!
$field_values = $input->get($field_name, array(), 'array');
// If the field exists, build the correct pivot couple objects
$new_couples = array();
foreach ($field_values as $value) {
$new_couples[] = array($relation['ourPivotKey'] => $table->getId(), $relation['theirPivotKey'] => $value);
}
// Find existent relations in the pivot table
$query = $table->getDbo()->getQuery(true)->select($relation['ourPivotKey'] . ', ' . $relation['theirPivotKey'])->from($relation['pivotTable'])->where($relation['ourPivotKey'] . ' = ' . $table->getId());
$existent_couples = $table->getDbo()->setQuery($query)->loadAssocList();
// Find new couples and create its
foreach ($new_couples as $couple) {
if (!in_array($couple, $existent_couples)) {
$query = $table->getDbo()->getQuery(true)->insert($relation['pivotTable'])->columns($relation['ourPivotKey'] . ', ' . $relation['theirPivotKey'])->values($couple[$relation['ourPivotKey']] . ', ' . $couple[$relation['theirPivotKey']]);
// Use database to create the new record
if (!$table->getDbo()->setQuery($query)->execute()) {
throw new Exception('Can\'t create the relation for the ' . $relation['pivotTable'] . ' table');
}
}
}
// Now find the couples no more present, that will be deleted
foreach ($existent_couples as $couple) {
if (!in_array($couple, $new_couples)) {
$query = $table->getDbo()->getQuery(true)->delete($relation['pivotTable'])->where($relation['ourPivotKey'] . ' = ' . $couple[$relation['ourPivotKey']])->where($relation['theirPivotKey'] . ' = ' . $couple[$relation['theirPivotKey']]);
// Use database to create the new record
if (!$table->getDbo()->setQuery($query)->execute()) {
throw new Exception('Can\'t delete the relation for the ' . $relation['pivotTable'] . ' table');
}
}
}
}
}
return true;
}
示例8: onBeforeDispatch
public function onBeforeDispatch()
{
// You can't fix stupid… but you can try working around it
if (!function_exists('json_encode') || !function_exists('json_decode')) {
require_once JPATH_ADMINISTRATOR . '/components/' . $this->component . '/helpers/jsonlib.php';
}
$result = parent::onBeforeDispatch();
if ($result) {
// Merge the language overrides
$paths = array(JPATH_ADMINISTRATOR, JPATH_ROOT);
$jlang = JFactory::getLanguage();
$jlang->load($this->component, $paths[0], 'en-GB', true);
$jlang->load($this->component, $paths[0], null, true);
$jlang->load($this->component, $paths[1], 'en-GB', true);
$jlang->load($this->component, $paths[1], null, true);
$jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
$jlang->load($this->component . '.override', $paths[0], null, true);
$jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
$jlang->load($this->component . '.override', $paths[1], null, true);
// Load Akeeba Strapper
if (!defined('AKEEBASUBSMEDIATAG')) {
$staticFilesVersioningTag = md5(AKEEBASUBS_VERSION . AKEEBASUBS_DATE);
define('AKEEBASUBSMEDIATAG', $staticFilesVersioningTag);
}
include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
AkeebaStrapper::$tag = AKEEBASUBSMEDIATAG;
AkeebaStrapper::bootstrap();
AkeebaStrapper::jQueryUI();
AkeebaStrapper::addCSSfile('media://com_akeebasubs/css/frontend.css', AKEEBASUBS_VERSIONHASH);
// Load helpers
require_once JPATH_ADMINISTRATOR . '/components/com_akeebasubs/helpers/cparams.php';
// Default to the "levels" view
$view = $this->input->getCmd('view', $this->defaultView);
if (empty($view) || $view == 'cpanel') {
$view = 'levels';
}
// Set the view, if it's allowed
$this->input->set('view', $view);
if (!in_array(F0FInflector::pluralize($view), $this->allowedViews)) {
$result = false;
}
// Handle the submitted form from the tax country module
$taxCountry = JFactory::getApplication()->input->getCmd('mod_aktaxcountry_country', null);
if (!is_null($taxCountry)) {
JFactory::getSession()->set('country', $taxCountry, 'mod_aktaxcountry');
}
}
return $result;
}
示例9: setpublic
/**
* Sets the visibility status of a customfields
*
* @param int $state 0 = not require, 1 = require
*/
protected final function setpublic($state = 0)
{
$model = $this->getThisModel();
if (!$model->getId()) {
$model->setIDsFromRequest();
}
$status = $model->visible($state);
// redirect
if ($customURL = $this->input->getString('returnurl', '')) {
$customURL = base64_decode($customURL);
}
$url = !empty($customURL) ? $customURL : 'index.php?option=' . $this->component . '&view=' . F0FInflector::pluralize($this->view);
if (!$status) {
$this->setRedirect($url, $model->getError(), 'error');
} else {
$this->setRedirect($url);
}
$this->redirect();
}
示例10: import
/**
* import.
*
* @return void
*/
public function import()
{
// CSRF prevention
if ($this->csrfProtection) {
$this->_csrfProtection();
}
$cid = $this->input->get('cid', array(), 'ARRAY');
if (empty($cid)) {
$id = $this->input->getInt('id', 0);
if ($id) {
$cid = array($id);
}
}
$helper = FeedLoaderHelper::getInstance();
$helper->importFeeds($cid);
// Redirect
if ($customURL = $this->input->get('returnurl', '', 'string')) {
$customURL = base64_decode($customURL);
}
$url = !empty($customURL) ? $customURL : 'index.php?option=' . $this->component . '&view=' . F0FInflector::pluralize($this->view);
$this->setRedirect($url);
ELog::showMessage('COM_AUTOTWEET_VIEW_FEEDS_IMPORT_SUCCESS', JLog::INFO);
}
示例11: save
//.........这里部分代码省略.........
$fields = array(&$field);
if (isset($field->field_namekey)) {
$namekey = $field->field_namekey;
}
$field->field_namekey = 'field_default';
if ($this->_checkOneInput($fields, $formData['field'], $data, '', $oldData)) {
if (isset($formData['field']['field_default']) && is_array($formData['field']['field_default'])) {
$defaultValue = '';
foreach ($formData['field']['field_default'] as $value) {
if (empty($defaultValue)) {
$defaultValue .= $value;
} else {
$defaultValue .= "," . $value;
}
}
$field->field_default = strip_tags($defaultValue);
} else {
$field->field_default = @strip_tags($formData['field']['field_default']);
}
}
unset($field->field_namekey);
if (isset($namekey)) {
$field->field_namekey = $namekey;
}
$fieldOptions = $app->input->get('field_options', array(), 'array');
foreach ($fieldOptions as $column => $value) {
if (is_array($value)) {
foreach ($value as $id => $val) {
j2storeSelectableHelper::secureField($val);
$fieldOptions[$column][$id] = strip_tags($val);
}
} else {
$fieldOptions[$column] = strip_tags($value);
}
}
if ($field->field_type == "customtext") {
$fieldOptions['customtext'] = $app->input->getHtml('fieldcustomtext', '');
if (empty($field->field_id)) {
$field->field_namekey = 'customtext_' . date('z_G_i_s');
} else {
$oldField = $this->get($field->field_id);
if ($oldField->field_core) {
$field->field_type = $oldField->field_type;
}
}
}
$field->field_options = serialize($fieldOptions);
$fieldValues = $app->input->get('field_values', array(), 'array');
if (!empty($fieldValues)) {
$field->field_value = array();
foreach ($fieldValues['title'] as $i => $title) {
if (strlen($title) < 1 and strlen($fieldValues['value'][$i]) < 1) {
continue;
}
$value = strlen($fieldValues['value'][$i]) < 1 ? $title : $fieldValues['value'][$i];
$disabled = strlen($fieldValues['disabled'][$i]) < 1 ? '0' : $fieldValues['disabled'][$i];
$field->field_value[] = strip_tags($title) . '::' . strip_tags($value) . '::' . strip_tags($disabled);
}
$field->field_value = implode("\n", $field->field_value);
}
if (empty($field->field_id) && $field->field_type != 'customtext') {
if (empty($field->field_namekey)) {
$field->field_namekey = $field->field_name;
}
$field->field_namekey = preg_replace('#[^a-z0-9_]#i', '', strtolower($field->field_namekey));
if (empty($field->field_namekey)) {
$this->errors[] = 'Please specify a namekey';
return false;
}
if ($field->field_namekey > 50) {
$this->errors[] = 'Please specify a shorter column name';
return false;
}
if (in_array(strtoupper($field->field_namekey), array('ACCESSIBLE', 'ADD', 'ALL', 'ALTER', 'ANALYZE', 'AND', 'AS', 'ASC', 'ASENSITIVE', 'BEFORE', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOTH', 'BY', 'CALL', 'CASCADE', 'CASE', 'CHANGE', 'CHAR', 'CHARACTER', 'CHECK', 'COLLATE', 'COLUMN', 'CONDITION', 'CONSTRAINT', 'CONTINUE', 'CONVERT', 'CREATE', 'CROSS', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'DATABASE', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELAYED', 'DELETE', 'DESC', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DOUBLE', 'DROP', 'DUAL', 'EACH', 'ELSE', 'ELSEIF', 'ENCLOSED', 'ESCAPED', 'EXISTS', 'EXIT', 'EXPLAIN', 'FALSE', 'FETCH', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOR', 'FORCE', 'FOREIGN', 'FROM', 'FULLTEXT', 'GRANT', 'GROUP', 'HAVING', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IF', 'IGNORE', 'IN', 'INDEX', 'INFILE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTERVAL', 'INTO', 'IS', 'ITERATE', 'JOIN', 'KEY', 'KEYS', 'KILL', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LIMIT', 'LINEAR', 'LINES', 'LOAD', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MATCH', 'MAXVALUE', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NOT', 'NO_WRITE_TO_BINLOG', 'NULL', 'NUMERIC', 'ON', 'OPTIMIZE', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTFILE', 'PRECISION', 'PRIMARY', 'PROCEDURE', 'PURGE', 'RANGE', 'READ', 'READS', 'READ_WRITE', 'REAL', 'REFERENCES', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RESIGNAL', 'RESTRICT', 'RETURN', 'REVOKE', 'RIGHT', 'RLIKE', 'SCHEMA', 'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SET', 'SHOW', 'SIGNAL', 'SMALLINT', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STRAIGHT_JOIN', 'TABLE', 'TERMINATED', 'THEN', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TRAILING', 'TRIGGER', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', 'USAGE', 'USE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', 'WHEN', 'WHERE', 'WHILE', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL', 'GENERAL', 'IGNORE_SERVER_IDS', 'MASTER_HEARTBEAT_PERIOD', 'MAXVALUE', 'RESIGNAL', 'SIGNAL', 'SLOW', 'ALIAS', 'OPTIONS', 'RELATED', 'IMAGES', 'FILES', 'CATEGORIES', 'PRICES', 'VARIANTS', 'CHARACTERISTICS'))) {
$this->errors[] = 'The column name "' . $field->field_namekey . '" is reserved. Please use another one.';
return false;
}
$tables = array($field->field_table);
foreach ($tables as $table_name) {
if ($table_name == 'address') {
$table_name = F0FInflector::pluralize($table_name);
}
$columns = $this->database->getTableColumns($this->fieldTable($table_name));
if (isset($columns[$field->field_namekey])) {
$this->errors[] = 'The field "' . $field->field_namekey . '" already exists in the table "' . $table_name . '"';
return false;
}
}
foreach ($tables as $table_name) {
if ($table_name == 'address') {
$table_name = F0FInflector::pluralize($table_name);
}
$query = 'ALTER TABLE ' . $this->fieldTable($table_name) . ' ADD `' . $field->field_namekey . '` TEXT NULL';
$this->database->setQuery($query);
$this->database->query();
}
}
$this->fielddata = $field;
return true;
}
示例12: recurringunpublish
public function recurringunpublish($cacheable = false)
{
$url = 'index.php?option=' . $this->component . '&view=' . F0FInflector::pluralize($this->view);
$this->setRedirect($url);
return true;
}
示例13: getViewTemplatePaths
/**
* Return a list of the view template paths for this component.
*
* @param string $component The name of the component. For Joomla! this
* is something like "com_example"
* @param string $view The name of the view you're looking a
* template for
* @param string $layout The layout name to load, e.g. 'default'
* @param string $tpl The sub-template name to load (null by default)
* @param boolean $strict If true, only the specified layout will be searched for.
* Otherwise we'll fall back to the 'default' layout if the
* specified layout is not found.
*
* @see F0FPlatformInterface::getViewTemplateDirs()
*
* @return array
*/
public function getViewTemplatePaths($component, $view, $layout = 'default', $tpl = null, $strict = false)
{
$isAdmin = $this->isBackend();
$basePath = $isAdmin ? 'admin:' : 'site:';
$basePath .= $component . '/';
$altBasePath = $basePath;
$basePath .= $view . '/';
$altBasePath .= (F0FInflector::isSingular($view) ? F0FInflector::pluralize($view) : F0FInflector::singularize($view)) . '/';
if ($strict) {
$paths = array($basePath . $layout . ($tpl ? "_{$tpl}" : ''), $altBasePath . $layout . ($tpl ? "_{$tpl}" : ''));
} else {
$paths = array($basePath . $layout . ($tpl ? "_{$tpl}" : ''), $basePath . $layout, $basePath . 'default' . ($tpl ? "_{$tpl}" : ''), $basePath . 'default', $altBasePath . $layout . ($tpl ? "_{$tpl}" : ''), $altBasePath . $layout, $altBasePath . 'default' . ($tpl ? "_{$tpl}" : ''), $altBasePath . 'default');
$paths = array_unique($paths);
}
return $paths;
}
示例14: getMyViews
/**
* Automatically detects all views of the component
*
* @return array A list of all views, in the order to be displayed in the toolbar submenu
*/
protected function getMyViews()
{
$views = array();
$t_views = array();
$using_meta = false;
$componentPaths = F0FPlatform::getInstance()->getComponentBaseDirs($this->component);
$searchPath = $componentPaths['main'] . '/views';
$filesystem = F0FPlatform::getInstance()->getIntegrationObject('filesystem');
$allFolders = $filesystem->folderFolders($searchPath);
if (!empty($allFolders)) {
foreach ($allFolders as $folder) {
$view = $folder;
// View already added
if (in_array(F0FInflector::pluralize($view), $t_views)) {
continue;
}
// Do we have a 'skip.xml' file in there?
$files = $filesystem->folderFiles($searchPath . '/' . $view, '^skip\\.xml$');
if (!empty($files)) {
continue;
}
// Do we have extra information about this view? (ie. ordering)
$meta = $filesystem->folderFiles($searchPath . '/' . $view, '^metadata\\.xml$');
// Not found, do we have it inside the plural one?
if (!$meta) {
$plural = F0FInflector::pluralize($view);
if (in_array($plural, $allFolders)) {
$view = $plural;
$meta = $filesystem->folderFiles($searchPath . '/' . $view, '^metadata\\.xml$');
}
}
if (!empty($meta)) {
$using_meta = true;
$xml = simplexml_load_file($searchPath . '/' . $view . '/' . $meta[0]);
$order = (int) $xml->foflib->ordering;
} else {
// Next place. It's ok since the index are 0-based and count is 1-based
if (!isset($to_order)) {
$to_order = array();
}
$order = count($to_order);
}
$view = F0FInflector::pluralize($view);
$t_view = new stdClass();
$t_view->ordering = $order;
$t_view->view = $view;
$to_order[] = $t_view;
$t_views[] = $view;
}
}
F0FUtilsArray::sortObjects($to_order, 'ordering');
$views = F0FUtilsArray::getColumn($to_order, 'view');
// If not using the metadata file, let's put the cpanel view on top
if (!$using_meta) {
$cpanel = array_search('cpanels', $views);
if ($cpanel !== false) {
unset($views[$cpanel]);
array_unshift($views, 'cpanels');
}
}
return $views;
}
示例15: getLabel
/**
* Method to get the field label.
*
* @return string The field label.
*
* @since 2.0
*/
protected function getLabel()
{
// Get the label text from the XML element, defaulting to the element name.
$title = $this->element['label'] ? (string) $this->element['label'] : '';
if (empty($title)) {
$view = $this->form->getView();
$params = $view->getViewOptionAndName();
$title = $params['option'] . '_' . F0FInflector::pluralize($params['view']) . '_FIELD_' . (string) $this->element['name'];
$title = strtoupper($title);
$result = JText::_($title);
if ($result === $title) {
$title = ucfirst((string) $this->element['name']);
}
}
return $title;
}