本文整理汇总了PHP中rc__函数的典型用法代码示例。如果您正苦于以下问题:PHP rc__函数的具体用法?PHP rc__怎么用?PHP rc__使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rc__函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOptions
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*
* @since 11.4
*/
protected function getOptions()
{
// Initialise variables
$folder = $this->element['folder'];
if (!empty($folder)) {
// Get list of plugins
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('element AS value, name AS text');
$query->from('#__extensions');
$query->where('folder = "' . $folder . '"');
$query->where('enabled = 1');
$query->order('ordering, name');
$db->setQuery($query);
$options = $db->loadObjectList();
$lang = JFactory::getLanguage();
foreach ($options as $i => $item) {
$source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value;
$extension = 'plg_' . $folder . '_' . $item->value;
$lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, false) || $lang->load($extension . '.sys', $source, null, false, false) || $lang->load($extension . '.sys', JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load($extension . '.sys', $source, $lang->getDefault(), false, false);
$options[$i]->text = rc__($item->text);
}
if ($db->getErrorMsg()) {
JError::raiseWarning(500, rc__('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
return '';
}
} else {
JError::raiseWarning(500, rc__('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'));
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例2: getLabel
/**
* Method to get the field label markup for a spacer.
* Use the label text or name from the XML element as the spacer or
* Use a hr="true" to automatically generate plain hr markup
*
* @return string The field label markup.
*
* @since 11.1
*/
public function getLabel()
{
$html = array();
$class = $this->element['class'] ? (string) $this->element['class'] : '';
$html[] = '<span class="spacer">';
$html[] = '<span class="before"></span>';
$html[] = '<span class="' . $class . '">';
if ((string) $this->element['hr'] == 'true') {
$html[] = '<hr class="' . $class . '" />';
} else {
$label = '';
// Get the label text from the XML element, defaulting to the element name.
$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
$text = $this->translateLabel ? rc__($text) : $text;
// Build the class for the label.
$class = !empty($this->description) ? 'hasTip' : '';
$class = $this->required == true ? $class . ' required' : $class;
// Add the opening label tag and main attributes attributes.
$label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"';
// If a description is specified, use it to build a tooltip.
if (!empty($this->description)) {
$label .= ' title="' . htmlspecialchars(trim($text, ':') . '::' . ($this->translateDescription ? rc__($this->description) : $this->description), ENT_COMPAT, 'UTF-8') . '"';
}
// Add the label text and closing tag.
$label .= '>' . $text . '</label>';
$html[] = $label;
}
$html[] = '</span>';
$html[] = '<span class="after"></span>';
$html[] = '</span>';
return implode('', $html);
}
示例3: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
public function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="radio ' . (string) $this->element['class'] . '"' : ' class="radio"';
// Start the radio field output.
$html[] = '<fieldset id="' . $this->id . '"' . $class . '>';
// Get the field options.
$options = $this->getOptions();
// Build the radio field output.
foreach ($options as $i => $option) {
// Initialize some option attributes.
$checked = (string) $option->value == (string) $this->value ? ' checked="checked"' : '';
$class = !empty($option->class) ? ' class="' . $option->class . '"' : '';
$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
// Initialize some JavaScript option attributes.
$onclick = !empty($option->onclick) ? ' onclick="' . $option->onclick . '"' : '';
$html[] = '<input type="radio" id="' . $this->id . $i . '" name="' . $this->name . '"' . ' value="' . htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') . '"' . $checked . $class . $onclick . $disabled . '/>';
$html[] = '<label for="' . $this->id . $i . '"' . $class . '>' . rc__($option->text) . '</label>';
}
// End the radio field output.
$html[] = '</fieldset>';
return implode($html);
}
示例4: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
JLog::add('RokCommon_Form_Field_Editors is deprecated. Use RokCommon_Form_Field_Plugins instead (with folder="editors").', JLog::WARNING, 'deprecated');
// Get the database object and a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Build the query.
$query->select('element AS value, name AS text');
$query->from('#__extensions');
$query->where('folder = ' . $db->quote('editors'));
$query->where('enabled = 1');
$query->order('ordering, name');
// Set the query and load the options.
$db->setQuery($query);
$options = $db->loadObjectList();
$lang = JFactory::getLanguage();
foreach ($options as $i => $option) {
$lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, null, false, false) || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, null, false, false) || $lang->load('plg_editors_' . $option->value, JPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load('plg_editors_' . $option->value, JPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
$options[$i]->text = rc__($option->text);
}
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseWarning(500, $db->getErrorMsg());
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例5: display
function display($tpl = null)
{
JHTML::_('behavior.mootools');
JHTML::_('behavior.keepalive');
$app =& JFactory::getApplication();
$document =& JFactory::getDocument();
$id = (int) JRequest::getVar('id');
$force_fixed_size = JRequest::getVar('fixed', 0);
$name = JRequest::getVar('name');
$galleries = RokGallery_Model_GalleryTable::getAll();
$current_gallery = false;
if (null != $id) {
$current_gallery = RokGallery_Model_GalleryTable::getSingle($id);
}
if (null != $name) {
$default_name = $name . rc__('ROKGALLERY_GALLERY_CREATE_DEFAULT_EXTENSION');
}
$this->assign('default_name', $default_name);
$this->assign('current_gallery_id', $id);
$this->assign('force_fixed_size', $force_fixed_size);
$this->assignRef('galleries', $galleries);
$this->assignRef('current_gallery', $current_gallery);
$this->assign('context', 'com_rokgallery.gallerymanager');
$this->setLayout('default');
parent::display($tpl);
}
示例6: getOptions
/**
* Method to get the custom field options.
* Use the query attribute to supply a query to generate the list.
*
* @return array The field option objects.
*
* @since 11.1
*/
protected function getOptions()
{
// Initialize variables.
$options = array();
// Initialize some field attributes.
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
$query = (string) $this->element['query'];
// Get the database object.
$db = JFactory::getDBO();
// Set the query and get the result list.
$db->setQuery($query);
$items = $db->loadObjectlist();
// Check for an error.
if ($db->getErrorNum()) {
JError::raiseWarning(500, $db->getErrorMsg());
return $options;
}
// Build the field options.
if (!empty($items)) {
foreach ($items as $item) {
if ($translate == true) {
$options[] = RokCommon_HTML_SelectList::option($item->{$key}, rc__($item->{$value}));
} else {
$options[] = RokCommon_HTML_SelectList::option($item->{$key}, $item->{$value});
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例7: getOptions
/**
* Method to get the field options for the list of installed editors.
*
* @return array The field option objects.
* @since 11.1
*/
protected function getOptions()
{
$container = RokCommon_Service::getContainer();
/** @var $model RokSprocket_Model_Widgets */
$model = $container->getService('roksprocket.widgets.model');
$widgets = $model->getAvailableInstances();
$fieldname = $this->element['name'];
$options = array();
$options[] = RokCommon_HTML_SelectList::option('', rc__('- Select RokSprocket Widget -'));
foreach ($widgets as $info) {
if ($this->value == $info['id']) {
$selected = ' selected="selected"';
} else {
$selected = "";
}
$tmp = RokCommon_HTML_SelectList::option($info['id'], $info['title']);
$options[] = $tmp;
}
$options = array_merge(parent::getOptions(), $options);
foreach ($options as &$option) {
// Set some option attributes.
$option->attr = array('class' => $option->value, 'rel' => $fieldname . '_' . $option->value);
}
reset($options);
return $options;
}
示例8: update
/**
* Get the full list of jobs
* <code>
* {
* 'ids': [1,2,3],
* 'settings': {'pubished':true}
* }
* </code>
* @param $params
* @return RokCommon_Ajax_Result
*/
public function update($params)
{
$result = new RokCommon_Ajax_Result();
try {
try {
RokGallery_Doctrine::getConnection()->beginTransaction();
if (count($params->settings) <= 0) {
throw new RokCommon_Ajax_Exception(rc__('ROKGALLERY_NO_SETTINGS_PASSED_TO_UPDATE'));
}
$q = Doctrine_Query::create()->update('RokGallery_Model_File');
foreach ($params->settings as $column => $value) {
$q->set($column, '?', $value);
}
$q->whereIn('id', $params->ids);
$q->execute();
RokGallery_Doctrine::getConnection()->commit();
} catch (Exception $e) {
RokGallery_Doctrine::getConnection()->rollback();
throw $e;
}
} catch (Exception $e) {
throw $e;
}
return $result;
}
示例9: reset
/**
*
*/
public function reset()
{
$this->xml = new RokCommon_XMLElement('<config/>');
foreach ($this->sections as $identifier => &$section) {
$this->logger->debug(rc__('Resetting options section %s.', $identifier));
$section->reset();
}
}
示例10: RokGallery_Manipulation_Exception
/**
* Apply the manipulation with the setup options to the passed in image.
* This does not do any memory manipulation
*
* @param WideImage_Image $image
* @return WideImage_Image
*/
public function &apply(WideImage_Image &$image)
{
if (!$this->isSetup()) {
throw new RokGallery_Manipulation_Exception(rc__('ROKGALLERY_MANIPULATION_WAS_NOT_SETUP_PRIOR_TO_APPLYING'));
}
$return_image = $image->resize($this->width, $this->height);
return $return_image;
}
示例11: rc_alt
function rc_alt($string, $alt)
{
$out = rc__($string . '_' . $alt);
if ($out == $string . '_' . $alt) {
$out = rc__($string);
}
return $out;
}
示例12: display
/**
* Display the view
*/
public function display($tpl = null)
{
JHTML::_('behavior.mootools');
JHTML::_('behavior.keepalive');
$this->container = RokCommon_Service::getContainer();
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->articles = $this->getModel()->getArticles($this->item->id, $this->item->params);
$this->layout = isset($this->item->params['layout']) ? $this->item->params['layout'] : $this->form->getFieldAttribute('layout', 'default', 'text', 'params');
$this->provider = isset($this->item->params['provider']) ? $this->item->params['provider'] : $this->form->getFieldAttribute('provider', 'default', 'text', 'params');
if (!isset($this->container[sprintf('roksprocket.layouts.%s', $this->layout)])) {
JError::raiseWarning(500, rc__(ROKSPROCKET_UNABLE_TO_FIND_LAYOUT_ERROR, $this->layout));
$app = JFactory::getApplication();
$app->redirect(JRoute::_(sprintf('index.php?option=%s&view=modules', RokSprocket_Helper::getRedirectionOption()), false));
return false;
}
$this->perItemForm = $this->getModel()->getPerItemsForm($this->layout);
/** @var $i18n RokCommon_I18N */
$i18n = $this->container->i18n;
foreach ($this->container['roksprocket.layouts'] as $layout_type => $layoutinfo) {
$layout_lang_paths = $this->container[sprintf('roksprocket.layouts.%s.paths', $layout_type)];
foreach ($layout_lang_paths as $lang_path) {
@$i18n->loadLanguageFiles('roksprocket_layout_' . $layout_type, $lang_path);
}
}
$load_more_total = count($this->articles);
$module_params = new RokCommon_Registry($this->item->params);
$limit = 10;
if ($load_more_total > $limit) {
$this->articles = $this->articles->trim($limit);
$load_more = 'true';
} else {
$load_more = 'false';
}
$load_more_script = sprintf('RokSprocket.Paging = {more: %s, page: 1, next_page: 2, amount: %d};', $load_more, $load_more_total);
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Read cookie for showing/hide per-article items
if (!isset($_COOKIE['roksprocket-showitems'])) {
$showitems_cookie = 1;
setcookie("roksprocket-showitems", $showitems_cookie, time() + 60 * 60 * 24 * 365, '/');
} else {
$showitems_cookie = $_COOKIE['roksprocket-showitems'];
}
$this->showitems = (bool) $showitems_cookie;
$siteURL = JURI::root(true);
$adminURL = JURI::base(true);
$this->addToolbar();
$this->compileLess();
$this->compileJS();
RokCommon_Header::addInlineScript("RokSprocket.params = 'jform_params';RokSprocket.SiteURL = '" . $siteURL . "'; RokSprocket.AdminURL = '" . $adminURL . "'; RokSprocket.URL = RokSprocket.AdminURL + '/index.php?option=" . JRequest::getString('option') . "&task=ajax&format=raw';" . $load_more_script);
RokCommon_Header::addStyle($siteURL . '/components/com_roksprocket/fields/filters/css/datepicker.css');
parent::display($tpl);
}
示例13: ucfirst
/**
* @param RokGallery_Model_Job $job
* @return RokGallery_Job_Processor
* @throws RokGallery_Job_Exception
*/
public static function &factory(RokGallery_Job &$job)
{
$classname = 'RokGallery_Job_Processor_' . ucfirst(str_replace(' ', '', $job->getType()));
if (!class_exists($classname, true)) {
throw new RokGallery_Job_Exception(rc__('ROKGALLERY_UNABLE_TO_FIND_PROCESS_FOR_JOB_TYPE_N', $job->getType()));
}
$ret = new $classname($job);
return $ret;
}
示例14: cleanItemParams
/**
*
*/
protected function cleanItemParams()
{
foreach ($this->items as $item_id => &$item) {
$item->setPrimaryImage($this->setupImage($item, 'mosaic_image_default', 'mosaic_image_default_custom', 'mosaic_item_image'));
$item->setPrimaryLink($this->setupLink($item, 'mosaic_link_default', 'mosaic_link_default_custom', 'mosaic_item_link'));
$item->setTitle($this->setupText($item, 'mosaic_title_default', 'mosaic_title_default_custom', 'mosaic_item_title'));
$item->setText($this->setupText($item, 'mosaic_description_default', 'mosaic_description_default_custom', 'mosaic_item_description'));
$item->setTags($this->filterTags($this->setupTags($item, 'mosaic_item_tags')));
// clean from tags and limit words amount
$desc = $item->getText();
if ($this->parameters->get('mosaic_strip_html_tags', true)) {
$desc = strip_tags($desc);
}
$words_amount = $this->parameters->get('mosaic_previews_length', 20);
if ($words_amount === '∞' || $words_amount == '0') {
$words_amount = false;
}
$htmlmanip = new RokSprocket_Util_HTMLManipulator();
$preview = $htmlmanip->truncateHTML($desc, $words_amount);
$append = strlen($desc) != strlen($preview) ? '<span class="roksprocket-ellipsis">…</span>' : "";
$item->setText($preview . $append);
// resizing images if needed
if ($item->getPrimaryImage()) {
if ($this->parameters->get('mosaic_resize_enable', false)) {
$width = $this->parameters->get('mosaic_resize_width', 0);
$height = $this->parameters->get('mosaic_resize_height', 0);
$item->getPrimaryImage()->resize($width, $height);
}
/** @var RokCommon_PlatformInfo $platforminfo */
$platforminfo = $this->container->platforminfo;
$urlbase = $platforminfo->getUrlBase() ? $platforminfo->getUrlBase() : '/';
if (!$platforminfo->isLinkexternal($item->getPrimaryImage()->getSource()) && strpos($item->getPrimaryImage()->getSource(), '/') !== 0 && strpos($item->getPrimaryImage()->getSource(), $urlbase) !== 0) {
$source = rtrim($urlbase, '/') . '/' . $item->getPrimaryImage()->getSource();
$item->getPrimaryImage()->setSource($source);
}
}
// ordering
$item->custom_ordering_items = '<div style="display: none;" data-mosaic-order-title="' . $item->getTitle() . '" data-mosaic-order-date="' . $item->getDate() . '"></div>';
// tagging
$item->custom_tags = "";
$item->custom_tags_list = array();
foreach ($this->filterTags($item->getTags()) as $key => $name) {
$item->custom_tags .= " sprocket-tags-" . $key;
$item->custom_tags_list[$key] = $name;
if (!array_key_exists($key, $this->tagging)) {
$this->tagging[$key] = $name;
}
}
$item->custom_tags = trim($item->custom_tags);
natcasesort($item->custom_tags_list);
}
// sort the tags for display
natcasesort($this->tagging);
// add the all
$this->tagging = array('all' => rc__('ALL')) + $this->tagging;
}
示例15: getInput
public function getInput()
{
$fieldname = $this->element['name'];
$js = "RokSprocket.dynamicfields.add('" . $this->id . "', '" . $fieldname . "');";
// Initialize variables.
$html = array();
$attr = '';
$css_classes = explode(' ', (string) $this->element['class']);
$css_classes = array_merge($css_classes, $this->getProviderClasses());
$css_classes[] = strtolower($this->type);
$css_classes[] = 'chzn-done';
$css_classes = array_unique($css_classes);
$attr .= ' class="' . implode(' ', $css_classes) . '"';
// Initialize some field attributes.
// $this->element['class'] = $this->element['class'] ? (string)$this->element['class'] . " " . strtolower($this->type) : strtolower($this->type);
// $attr .= $this->element['class'] ? ' class="' . (string)$this->element['class'] . ' chzn-done"' : ' class="chzn-done"';
// To avoid user's confusion, readonly="true" should imply disabled="true".
if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
$attr .= ' disabled="disabled"';
}
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
$attr .= $this->element['refresher'] ? ' data-refresher="true" ' : "";
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
if ($this->element['attrs']) {
$additional_attrs = explode(',', (string) $this->element['attrs']);
foreach ($additional_attrs as $additional_attr) {
$additional_attr = strtolower(trim($additional_attr));
$attr .= $this->element[$additional_attr] ? sprintf(' %s="', $additional_attr) . (string) $this->element[$additional_attr] . '"' : '';
}
}
// Get the field options.
$options = (array) $this->getOptions();
RokCommon_Header::addInlineScript($js);
if ((string) $this->element['readonly'] == 'true') {
$html[] = rc__('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
} else {
if (count($options) == 1) {
$icon = isset($options[0]->icon) ? $options[0]->icon : "";
if (strlen($icon)) {
$icon_html = '<i data-dynamic="false" class="icon ' . $this->element['name'] . " " . $options[0]->value . '"></i>';
} else {
$icon_html = "";
}
$html[] = '<div class="single-layout">' . $icon_html . ' ' . $options[0]->text . "</div>\n";
$attr .= ' style="display: none;" ';
}
$listattr = array('list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'option.text' => 'text', 'option.value' => 'value', 'option.attr' => 'attr');
$list = RokCommon_HTML_SelectList::genericlist($options, $this->name, $listattr);
$html[] = $list;
}
return implode('', $html);
}