本文整理汇总了PHP中AMP_pluralize函数的典型用法代码示例。如果您正苦于以下问题:PHP AMP_pluralize函数的具体用法?PHP AMP_pluralize怎么用?PHP AMP_pluralize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AMP_pluralize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _formFooter
function _formFooter()
{
$renderer =& AMP_get_renderer();
$current_section_edit_link = false;
$current_class_edit_link = false;
$base_footer = ' <a href="' . AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('nosearch=1')) . '" class="standout">' . sprintf(AMP_TEXT_VIEW_ALL, AMP_pluralize(ucfirst(AMP_TEXT_ARTICLE))) . '</a>';
//sectional edit link
$current_section = isset($_REQUEST['section']) && $_REQUEST['section'] ? $_REQUEST['section'] : false;
if (!$current_section) {
$current_section = isset($_REQUEST['type']) && $_REQUEST['type'] ? $_REQUEST['type'] : false;
}
if ($current_section) {
$section_names = AMPContent_Lookup::instance('sections');
$section_name = isset($section_names[$current_section]) ? $section_names[$current_section] : false;
$current_section_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_SECTION, array('id=' . $current_section)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_SECTION . $renderer->space() . AMP_trimText($section_name, 20, false));
}
//class edit link
$current_class = isset($_REQUEST['class']) && $_REQUEST['class'] ? $_REQUEST['class'] : false;
if ($current_class) {
$class_names = AMPContent_Lookup::instance('classes');
$class_name = isset($class_names[$current_class]) ? $class_names[$current_class] : false;
$current_class_edit_link = $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_SYSTEM_URL_CLASS, array('id=' . $current_class)), $renderer->image(AMP_SYSTEM_ICON_EDIT, array('width' => '16', 'height' => '16', 'border' => 0)) . $renderer->space() . AMP_TEXT_EDIT . $renderer->space() . AMP_TEXT_CLASS . $renderer->space() . AMP_trimText($class_name, 20, false));
}
return $base_footer . $current_section_edit_link . $current_class_edit_link . $renderer->newline();
}
示例2: make_fields
function make_fields($values, $prefix = '')
{
$renderer = AMP_get_renderer();
$fields = array();
foreach ($values as $label => $value) {
$current_label = $prefix ? $prefix . '_' . $label : $label;
$current_label = str_replace(' ', '_', $current_label);
if (is_array($value)) {
$fields[$current_label] = $this->field_header;
$fields[$current_label]['label'] = AMP_pluralize(ucwords(str_replace('_', ' ', $current_label)));
$sub_fields = $this->make_fields($value, $current_label);
$fields = $fields + $sub_fields;
continue;
}
$base_field = $this->field_standard;
if (is_numeric($value) and !is_bool($value)) {
$base_field = $this->field_numeric;
}
if (is_bool($value)) {
$base_field = $this->field_boolean;
}
if (isset($this->_config_text[$label])) {
$fields[$current_label . '__comment'] = array('type' => 'static', 'default' => $renderer->div($this->_config_text[$label], array('class' => 'config_comment')));
}
$fields[$current_label] = $base_field;
$fields[$current_label]['label'] = ucwords(str_replace('_', ' ', $label)) . $renderer->newline() . $renderer->span('amp_' . $current_label, array('class' => 'photocaption'));
$fields[$current_label]['default'] = $value;
}
return $fields;
}
示例3: setScaffoldItem
function setScaffoldItem($scaffold_item)
{
if (!$scaffold_item) {
return false;
}
$this->_scaffold_item = $scaffold_item;
$this->setDataTable(strtolower(AMP_pluralize($scaffold_item)));
}
示例4: init_controller_by_route
function init_controller_by_route($route)
{
$resource_class = ucfirst($route['target_type']);
$controller_class = "AMP_Controller_" . AMP_pluralize($resource_class);
$controller_path = str_replace('_', '/', $controller_class) . ".php";
require_once $controller_path;
$controller = new $controller_class(AMP_dbcon(), $route['target_id']);
$controller->set_action('show');
$controller->set_params(array('id' => $route['target_id']));
return $controller;
}
示例5: _HTML_commentLink
function _HTML_commentLink(&$commentSet)
{
$commentSet->execute();
$renderer = AMP_get_renderer();
$text = $commentSet->RecordCount() ? $commentSet->RecordCount() . ' ' . AMP_pluralize(AMP_TEXT_COMMENT) : AMP_TEXT_NO_COMMENTS;
$comments = $renderer->link(AMP_Url_AddAnchor($this->_article->getURL(), 'comments'), $text);
$sections_output = '';
$sections = $this->render_sections();
if ($sections) {
$sections_output = AMP_TEXT_POSTED_IN . $renderer->space() . $sections;
}
return $renderer->div($sections_output . $renderer->separator() . $comments, array('align' => 'right')) . $renderer->newline() . $renderer->hr() . $renderer->newline();
}
示例6: _register_fields_dynamic
function _register_fields_dynamic()
{
$available_tags = AMPSystem_Lookup::instance('tags');
if (!$available_tags) {
return false;
}
$options = $this->getOptions();
$public_setting = isset($options['public']) && $options['public'];
$this->_active = $public_setting || $this->udm->admin;
$fields = array('tag_add' => array('type' => 'multiselect', 'size' => 12, 'label' => 'Select ' . ucfirst(AMP_pluralize(AMP_TEXT_TAG)), 'enabled' => true, 'public' => $public_setting, 'values' => $available_tags), 'tag_add_text' => array('type' => 'text', 'size' => 30, 'label' => 'Add ' . ucfirst(AMP_pluralize(AMP_TEXT_TAG)) . ' ( comma-separated )', 'enabled' => true, 'public' => $public_setting));
$this->fields =& $fields;
$this->insertAfterFieldOrder(array('tag_list', 'tag_add', 'tag_add_text'));
}
示例7: format
function format($dataset = null, $quot = '"')
{
if (!(isset($dataset) && $dataset && is_array($dataset))) {
trigger_error(sprintf(AMP_TEXT_ERROR_NO_SELECTION, AMP_pluralize(AMP_TEXT_ITEM_NAME)));
return false;
}
$str = '';
$escape_function = "escapeforcsv";
foreach ($dataset as $row) {
array_walk($row, array($this, $escape_function, $this->delimiter));
$str .= implode($this->delimiter, $row) . "\n";
}
return $str;
}
示例8: pagetitle
function pagetitle($item = null, $verb = null)
{
if (!isset($verb)) {
$verb = $this->page->action;
}
if (!isset($item)) {
$item = $this->itemtype;
}
$plural_actions = array('View');
if (array_search($verb, $plural_actions) !== FALSE) {
$item = AMP_pluralize($item);
}
return "<div class = \"banner\">{$verb} {$item}</div>";
}
示例9: _listLink
function _listLink($options = array())
{
if (!isset($options['_linked_uid'])) {
return false;
}
$comment_count_lookup = FormLookup::instance('commentCounts');
$comment_count = isset($comment_count_lookup[$options['_linked_uid']]) ? $comment_count_lookup[$options['_linked_uid']] : 0;
$link_text = ($comment_count ? $comment_count : AMP_TEXT_NO) . ' ' . AMP_pluralize(AMP_TEXT_COMMENT);
$renderer =& $this->_get_renderer();
//current comment count
$comments = $renderer->link(AMP_Url_AddAnchor(AMP_Url_AddVars(PHP_SELF_QUERY(), array('uid=' . $options['_linked_uid'])), 'comments'), $link_text);
//add comment link
$comments .= $renderer->separator() . $renderer->link(AMP_Url_AddVars(AMP_CONTENT_URL_COMMENT_ADD, array('userdata_id=' . $options['_linked_uid'])), AMP_TEXT_ADD);
return $comments . $renderer->newline(2);
}
示例10: getItemCategory
function getItemCategory()
{
$item_type = $this->getItemtype();
$name_value = false;
if ($item_type == AMP_TEXT_SYSTEM_ITEM_TYPE_FORM) {
$form_id = $this->_tagged_item->getModin();
if (!$form_id) {
return false;
}
$form_names = AMPSystem_Lookup::instance('formsPublic');
if (isset($form_names[$form_id])) {
return $form_names[$form_id];
}
}
return AMP_pluralize(ucfirst($item_type));
}
示例11: commit_view
function commit_view()
{
$status_display =& $this->_map->getComponent('status');
$this->_display->add($status_display, 'status');
$search =& $this->_map->getComponent('search', 'AMP_Content_Search');
$this->add_component_header(AMP_TEXT_SEARCH, AMP_pluralize($this->_map->getHeading()));
$this->_display->add($search, 'search');
$search->Build(true);
//if ( !$search->submitted( ))
$search->applyDefaults();
$menu_display =& $this->_map->getComponent('menu');
$class_display =& $this->_map->getComponent('classlinks');
$this->add_component_header(AMP_TEXT_CONTENT_MAP_HEADING, "");
$this->_display->add($menu_display, 'menu');
$this->add_component_header(AMP_TEXT_VIEW, AMP_TEXT_BY . " " . ucfirst(AMP_TEXT_CLASS));
$this->_display->add($class_display, 'class');
$this->_clear_list_location();
}
示例12: execute
function execute($options = array())
{
$options = array_merge($this->getOptions(), $options);
require_once 'AMP/UserData/Lookups.inc.php';
$index_title = AMP_pluralize($this->udm->name) . " By " . $options['index_name'];
$index_set =& FormLookup_Variant::instance($options['index_field'], $this->udm->instance);
#$index['state']['sql'].="SELECT count(userdata.id) as qty, userdata.State as item_key, states.statename as item_name from userdata, states WHERE userdata.State=states.state and modin=".$_REQUEST['modin']." GROUP BY userdata.State ";
$translated_values = isset($this->_region_lookups[$options['index_field']]) ? AMPSystem_Lookup::locate($this->_region_lookups[$options['index_field']]) : AMPSystem_Lookup::locate(array('instance' => AMP_pluralize($options['index_field'])));
require_once 'AMP/Content/Display/HTML.inc.php';
$renderer = new AMPDisplay_HTML();
$output = $renderer->bold($index_title) . $renderer->newline();
foreach ($index_set as $index_value => $index_count) {
$display_value = $translated_values && isset($translated_values[$index_value]) ? $translated_values[$index_value] : $index_value;
$display_value .= ' (' . $index_count . ')';
$link_value = AMP_URL_AddVars($_SERVER['PHP_SELF'], array($options['index_field'] => strtolower($options['index_field']) . '=' . $index_value, 'modin' => 'modin=' . $this->udm->instance));
$output .= $renderer->link($link_value, $display_value) . $renderer->newline();
#$output .= '<a href="'.$_SERVER['PHP_SELF'].'?'.$options['index_field'].'='.$index_value.'&modin='.$_REQUEST['modin'].'">'.$index_item['item_name'].'</a> ('.$index_item['qty'].')<BR>';
}
return $output;
}
示例13: set_banner
function set_banner($action = null, $heading)
{
$text = ucfirst(isset($action) ? $action : join("", $this->get_actions()));
$plural_headings = array(AMP_TEXT_LIST, AMP_TEXT_SEARCH, AMP_TEXT_VIEW);
if (array_search($text, $plural_headings) !== FALSE) {
$heading = AMP_pluralize($heading);
}
$this->add_component_header($text, ucwords($heading), 'banner', AMP_CONTENT_DISPLAY_KEY_INTRO);
$header_text = $text . ' ' . $heading;
$header =& AMP_getHeader();
$header->setPageAction($header_text);
}
示例14: makeCriteriaTag
function makeCriteriaTag($tag_value)
{
if (!isset($this->_item_type)) {
trigger_error(sprintf(AMP_TEXT_ERROR_NOT_DEFINED, get_class($this), '_item_type'));
trigger_error(sprintf(AMP_TEXT_ERROR_CREATE_FAILED, get_class($this), 'tag criteria ' . $tag_value));
return false;
}
$lookup_type = AMP_pluralize($this->_item_type) . 'ByTag';
$id_set = AMPSystem_Lookup::instance($lookup_type, $tag_value);
if (!$id_set || empty($id_set)) {
return 'FALSE';
}
return $this->id_field . ' IN ( ' . join(',', array_keys($id_set)) . ')';
}
示例15: _HTML_searchForm
function _HTML_searchForm()
{
if (!isset($this->_search_form)) {
return false;
}
$renderer = $this->_getRenderer();
return $renderer->inSpan(AMP_TEXT_SEARCH . ' ' . AMP_pluralize($this->_map->getHeading()), array('class' => 'intitle')) . "\n" . $this->_search_form->execute();
}