本文整理汇总了PHP中FOFInput类的典型用法代码示例。如果您正苦于以下问题:PHP FOFInput类的具体用法?PHP FOFInput怎么用?PHP FOFInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FOFInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: array
/**
*
* @staticvar array $instances
* @param type $option
* @param type $view
* @param type $config
* @return FOFToolbar
*/
public static function &getAnInstance($option = null, $config = array())
{
static $instances = array();
// Make sure $config is an array
if (is_object($config)) {
$config = (array) $config;
} elseif (!is_array($config)) {
$config = array();
}
$hash = $option;
if (!array_key_exists($hash, $instances)) {
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$input->set('option', $config['option']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Toolbar';
if (!class_exists($className)) {
list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
if ($isAdmin) {
$basePath = JPATH_ADMINISTRATOR;
} elseif ($isCli) {
$basePath = JPATH_ROOT;
} else {
$basePath = JPATH_SITE;
}
$searchPaths = array($basePath . '/components/' . $config['option'], $basePath . '/components/' . $config['option'] . '/toolbars', JPATH_ADMINISTRATOR . '/components/' . $config['option'], JPATH_ADMINISTRATOR . '/components/' . $config['option'] . '/toolbars');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
JLoader::import('joomla.filesystem.path');
$path = JPath::find($searchPaths, 'toolbar.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFToolbar';
}
$instance = new $className($config);
$instances[$hash] = $instance;
}
return $instances[$hash];
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:59,代码来源:toolbar.php
示例2: preRender
/**
* Echoes any HTML to show before the view template
*
* @param string $view The current view
* @param string $task The current task
* @param FOFInput $input The input array (request parameters)
* @param array $config The view configuration array
*
* @return void
*/
public function preRender($view, $task, $input, $config = array())
{
$format = $input->getCmd('format', 'html');
if (empty($format)) {
$format = 'html';
}
if ($format != 'html') {
return;
}
// Render the submenu and toolbar
if ($input->getBool('render_toolbar', true)) {
$this->renderButtons($view, $task, $input, $config);
$this->renderLinkbar($view, $task, $input, $config);
}
}
开发者ID:Tommar,项目名称:vino2,代码行数:25,代码来源:joomla3.php
示例3: postRender
/**
* Echoes any HTML to show after the view template
*
* @param string $view The current view
* @param string $task The current task
* @param FOFInput $input The input array (request parameters)
* @param array $config The view configuration array
*
* @return void
*/
public function postRender($view, $task, $input, $config = array())
{
$format = $input->getCmd('format', 'html');
if (empty($format)) {
$format = 'html';
}
if ($format != 'html') {
return;
}
// Closing tag only if we're not in CLI
if (FOFPlatform::getInstance()->isCli()) {
return;
}
echo "</div>\n";
// Closes akeeba-renderjoomla div
}
开发者ID:deenison,项目名称:joomla-cms,代码行数:26,代码来源:joomla3.php
示例4: array
/**
* Gets an instance of a component's toolbar
*
* @param string $option The name of the component
* @param array $config The configuration array for the component
*
* @return FOFToolbar The toolbar instance for the component
*/
public static function &getAnInstance($option = null, $config = array())
{
static $instances = array();
// Make sure $config is an array
if (is_object($config)) {
$config = (array) $config;
} elseif (!is_array($config)) {
$config = array();
}
$hash = $option;
if (!array_key_exists($hash, $instances)) {
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$input->set('option', $config['option']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Toolbar';
if (!class_exists($className)) {
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
$searchPaths = array($componentPaths['main'], $componentPaths['main'] . '/toolbars', $componentPaths['alt'], $componentPaths['alt'] . '/toolbars');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$path = $filesystem->pathFind($searchPaths, 'toolbar.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFToolbar';
}
$instance = new $className($config);
$instances[$hash] = $instance;
}
return $instances[$hash];
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:52,代码来源:toolbar.php
示例5: setToolbarTitle
private function setToolbarTitle()
{
$subtitle_key = FOFInput::getCmd('option', 'com_overload', $this->input).
'_TITLE_'.strtoupper(FOFInput::getCmd('view', '', $this->input));
JToolBarHelper::title(
JText::_( FOFInput::getCmd('option', 'com_overload', $this->input)).
' – <small>'.JText::_($subtitle_key).'</small>',
'generic.png');
}
开发者ID:nikosdion,项目名称:com_overload,代码行数:10,代码来源:toolbar.php
示例6: import
/**
* Imports an exported profile .json file
*/
public function import()
{
$this->_csrfProtection();
$user = JFactory::getUser();
if (!$user->authorise('akeeba.configure', 'com_akeeba')) {
return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
}
// Get the user
$user = JFactory::getUser();
// Get some data from the request
$file = FOFInput::getVar('importfile', '', $_FILES, 'array');
if (isset($file['name'])) {
// Load the file data
$data = JFile::read($file['tmp_name']);
@unlink($file['tmp_name']);
// JSON decode
$data = json_decode($data, true);
// Check for data validity
$isValid = is_array($data) && !empty($data);
if ($isValid) {
$isValid = $isValid && array_key_exists('description', $data);
}
if ($isValid) {
$isValid = $isValid && array_key_exists('configuration', $data);
}
if ($isValid) {
$isValid = $isValid && array_key_exists('filters', $data);
}
if (!$isValid) {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_INVALID'), 'error');
return false;
}
// Unset the id, if it exists
if (array_key_exists('id', $data)) {
unset($data['id']);
}
// Try saving the profile
$result = $this->getThisModel()->getTable()->save($data);
if ($result) {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_MSG_IMPORT_COMPLETE'));
} else {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('COM_AKEEBA_PROFILES_ERR_IMPORT_FAILED'), 'error');
}
} else {
$this->setRedirect('index.php?option=com_akeeba&view=profiles', JText::_('MSG_UPLOAD_INVALID_REQUEST'), 'error');
return false;
}
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:51,代码来源:profiles.php
示例7: renderToolbar
/**
* Renders the toolbar for the current view and task
*
* @param string $view The view of the component
* @param string $task The exact task of the view
* @param FOFInput $input An optional input object used to determine the defaults
*
* @return void
*/
public function renderToolbar($view = null, $task = null, $input = null)
{
if (!empty($input)) {
$saveInput = $this->input;
$this->input = $input;
}
// If tmpl=component the default behaviour is to not render the toolbar
if ($this->input->getCmd('tmpl', '') == 'component') {
$render_toolbar = false;
} else {
$render_toolbar = true;
}
// If there is a render_toolbar=0 in the URL, do not render a toolbar
$render_toolbar = $this->input->getBool('render_toolbar', $render_toolbar);
if (!$render_toolbar) {
return;
}
// Get the view and task
if (empty($view)) {
$view = $this->input->getCmd('view', 'cpanel');
}
if (empty($task)) {
$task = $this->input->getCmd('task', 'default');
}
$this->view = $view;
$this->task = $task;
$view = FOFInflector::pluralize($view);
$component = $input->get('option', 'com_foobar', 'cmd');
$configProvider = new FOFConfigProvider();
$toolbar = $configProvider->get($component . '.views.' . '.toolbar');
// If we have a toolbar config specified
if (!empty($toolbar)) {
return $this->renderFromConfig($toolbar);
}
// Check for an onViewTask method
$methodName = 'on' . ucfirst($view) . ucfirst($task);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
// Check for an onView method
$methodName = 'on' . ucfirst($view);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
// Check for an onTask method
$methodName = 'on' . ucfirst($task);
if (method_exists($this, $methodName)) {
return $this->{$methodName}();
}
if (!empty($input)) {
$this->input = $saveInput;
}
}
开发者ID:Tommar,项目名称:vino2,代码行数:62,代码来源:toolbar.php
示例8: getUserStateFromRequest
/**
* This method will try retrieving a variable from the request (input) data.
*
* @param string $key The user state key for the variable
* @param string $request The request variable name for the variable
* @param FOFInput $input The FOFInput object with the request (input) data
* @param mixed $default The default value. Default: null
* @param string $type The filter type for the variable data. Default: none (no filtering)
* @param boolean $setUserState Should I set the user state with the fetched value?
*
* @see FOFPlatformInterface::getUserStateFromRequest()
*
* @return mixed The value of the variable
*/
public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
{
return $input->get($request, $default, $type);
}
开发者ID:naka211,项目名称:studiekorrektur,代码行数:18,代码来源:platform.php
示例9: renderButtons
/**
* Renders the toolbar buttons
*
* @param string $view The active view name
* @param string $task The current task
* @param FOFInput $input The input object
* @param array $config Extra configuration variables for the toolbar
*
* @return void
*/
protected function renderButtons($view, $task, $input, $config = array())
{
// On command line don't do anything
if (FOFPlatform::getInstance()->isCli()) {
return;
}
// Do not render buttons unless we are in the the frontend area and we are asked to do so
$toolbar = FOFToolbar::getAnInstance($input->getCmd('option', 'com_foobar'), $config);
$renderFrontendButtons = $toolbar->getRenderFrontendButtons();
if (FOFPlatform::getInstance()->isBackend() || !$renderFrontendButtons) {
return;
}
// Load main backend language, in order to display toolbar strings
// (JTOOLBAR_BACK, JTOOLBAR_PUBLISH etc etc)
FOFPlatform::getInstance()->loadTranslations('joomla');
$title = JFactory::getApplication()->get('JComponentTitle');
$bar = JToolBar::getInstance('toolbar');
// Delete faux links, since if SEF is on, Joomla will follow the link instead of submitting the form
$bar_content = str_replace('href="#"', '', $bar->render());
echo '<div id="FOFHeaderHolder">', $bar_content, $title, '<div style="clear:both"></div>', '</div>';
}
开发者ID:01J,项目名称:skazkipronebo,代码行数:31,代码来源:joomla.php
示例10: array
/**
* Gets a temporary instance of a Dispatcher
*
* @param string $option The component name
* @param string $view The View name
* @param array $config Configuration data
*
* @return FOFDispatcher
*/
public static function &getTmpInstance($option = null, $view = null, $config = array())
{
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
if (!is_array($config['input'])) {
$config['input'] = (array) $config['input'];
}
$config['input'] = array_merge($_REQUEST, $config['input']);
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$config['view'] = !is_null($view) ? $view : $input->getCmd('view', '');
$input->set('option', $config['option']);
$input->set('view', $config['view']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Dispatcher';
if (!class_exists($className)) {
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
$searchPaths = array($componentPaths['main'], $componentPaths['main'] . '/dispatchers', $componentPaths['admin'], $componentPaths['admin'] . '/dispatchers');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
$path = $filesystem->pathFind($searchPaths, 'dispatcher.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFDispatcher';
}
$instance = new $className($config);
return $instance;
}
开发者ID:01J,项目名称:skazkipronebo,代码行数:48,代码来源:dispatcher.php
示例11: getUserStateFromRequest
/**
* This method will try retrieving a variable from the request (input) data.
*
* @param string $key The user state key for the variable
* @param string $request The request variable name for the variable
* @param FOFInput $input The FOFInput object with the request (input) data
* @param mixed $default The default value. Default: null
* @param string $type The filter type for the variable data. Default: none (no filtering)
* @param boolean $setUserState Should I set the user state with the fetched value?
*
* @see FOFPlatformInterface::getUserStateFromRequest()
*
* @return mixed The value of the variable
*/
public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
{
list($isCLI, $isAdmin) = $this->isCliAdmin();
if ($isCLI) {
return $input->get($request, $default, $type);
}
$app = JFactory::getApplication();
if (method_exists($app, 'getUserState')) {
$old_state = $app->getUserState($key, $default);
} else {
$old_state = null;
}
$cur_state = !is_null($old_state) ? $old_state : $default;
$new_state = $input->get($request, null, $type);
// Save the new value only if it was set in this request
if ($setUserState) {
if ($new_state !== null) {
$app->setUserState($key, $new_state);
} else {
$new_state = $cur_state;
}
} elseif (is_null($new_state)) {
$new_state = $cur_state;
}
return $new_state;
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:40,代码来源:platform.php
示例12: renderFormEdit
/**
* Renders a FOFForm for a Browse view and returns the corresponding HTML
*
* @param FOFForm $form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
*
* @return string The HTML rendering of the form
*/
protected function renderFormEdit(FOFForm &$form, FOFModel $model, FOFInput $input)
{
// Get the key for this model's table
$key = $model->getTable()->getKeyName();
$keyValue = $model->getId();
$html = '';
if ($validate = $form->getAttribute('validate')) {
JHTML::_('behavior.formvalidation');
$class = ' form-validate';
$this->loadValidationScript($form);
} else {
$class = '';
}
// Check form enctype. Use enctype="multipart/form-data" to upload binary files in your form.
$template_form_enctype = $form->getAttribute('enctype');
if (!empty($template_form_enctype)) {
$enctype = ' enctype="' . $form->getAttribute('enctype') . '" ';
} else {
$enctype = '';
}
// Check form name. Use name="yourformname" to modify the name of your form.
$formname = $form->getAttribute('name');
if (empty($formname)) {
$formname = 'adminForm';
}
// Check form ID. Use id="yourformname" to modify the id of your form.
$formid = $form->getAttribute('name');
if (empty($formname)) {
$formid = 'adminForm';
}
$html .= '<form action="index.php" method="post" name="' . $formname . '" id="' . $formid . '"' . $enctype . ' class="form-horizontal' . $class . '">' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="option" value="' . $input->getCmd('option') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="view" value="' . $input->getCmd('view', 'edit') . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="task" value="" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . $key . '" value="' . $keyValue . '" />' . PHP_EOL;
$html .= "\t" . '<input type="hidden" name="' . JFactory::getSession()->getFormToken() . '" value="1" />' . PHP_EOL;
foreach ($form->getFieldsets() as $fieldset) {
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$title = $field->title;
$required = $field->required;
$labelClass = $field->labelClass;
$description = $field->description;
$input = $field->input;
if (!is_null($title)) {
$html .= "\t\t\t" . '<div class="control-group">' . PHP_EOL;
$html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
$html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
if ($required) {
$html .= ' *';
}
$html .= "\t\t\t\t" . '</label>' . PHP_EOL;
$html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
$html .= "\t\t\t\t" . $input . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t\t" . '</div>' . PHP_EOL;
$html .= "\t\t\t" . '</div>' . PHP_EOL;
} else {
$html .= "\t\t\t\t" . $input . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
$html .= '</form>';
return $html;
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:87,代码来源:strapper.php
示例13: renderFormRaw
/**
* Renders a raw FOFForm and returns the corresponding HTML
*
* @param FOFForm &$form The form to render
* @param FOFModel $model The model providing our data
* @param FOFInput $input The input object
* @param string $formType The form type e.g. 'edit' or 'read'
*
* @return string The HTML rendering of the form
*/
protected function renderFormRaw(FOFForm &$form, FOFModel $model, FOFInput $input, $formType)
{
$html = '';
foreach ($form->getFieldsets() as $fieldset) {
$fields = $form->getFieldset($fieldset->name);
if (isset($fieldset->class)) {
$class = 'class="' . $fieldset->class . '"';
} else {
$class = '';
}
$html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
if (isset($fieldset->label) && !empty($fieldset->label)) {
$html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
}
foreach ($fields as $field) {
$required = $field->required;
$labelClass = $field->labelClass;
$groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
// Auto-generate label and description if needed
// Field label
$title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
$emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
if (empty($title) && !$emptylabel) {
$model->getName();
$title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
}
// Field description
$description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
/**
* The following code is backwards incompatible. Most forms don't require a description in their form
* fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
*/
/*
$emptydescription = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
if (empty($description) && !$emptydescription)
{
$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
}
*/
if ($formType == 'read') {
$inputField = $field->static;
} elseif ($formType == 'edit') {
$inputField = $field->input;
}
if (empty($title)) {
$html .= "\t\t\t" . $inputField . PHP_EOL;
if (!empty($description) && $formType == 'edit') {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
} else {
$html .= "\t\t\t" . '<div class="control-group ' . $groupClass . '">' . PHP_EOL;
$html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
$html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
if ($required) {
$html .= ' *';
}
$html .= "\t\t\t\t" . '</label>' . PHP_EOL;
$html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
$html .= "\t\t\t\t" . $inputField . PHP_EOL;
if (!empty($description)) {
$html .= "\t\t\t\t" . '<span class="help-block">';
$html .= JText::_($description) . '</span>' . PHP_EOL;
}
$html .= "\t\t\t\t" . '</div>' . PHP_EOL;
$html .= "\t\t\t" . '</div>' . PHP_EOL;
}
}
$html .= "\t" . '</div>' . PHP_EOL;
}
return $html;
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:82,代码来源:strapper.php
示例14: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
$options = array();
$this->value = array();
$value_field = $this->element['value_field'] ? (string) $this->element['value_field'] : 'title';
$input = new FOFInput();
$component = ucfirst(str_replace('com_', '', $input->getString('option')));
$view = ucfirst($input->getString('view'));
$relation = FOFInflector::pluralize((string) $this->element['name']);
$model = FOFModel::getTmpInstance(ucfirst($relation), $component . 'Model');
$table = $model->getTable();
$key = $table->getKeyName();
$value = $table->getColumnAlias($value_field);
foreach ($model->getItemList(true) as $option) {
$options[] = JHtml::_('select.option', $option->{$key}, $option->{$value});
}
if ($id = FOFModel::getAnInstance($view)->getId()) {
$table = FOFTable::getInstance($view, $component . 'Table');
$table->load($id);
$relations = $table->getRelations()->getMultiple($relation);
foreach ($relations as $item) {
$this->value[] = $item->getId();
}
}
return $options;
}
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:31,代码来源:relation.php
示例15: defined
<?php
/**
* @package AkeebaBackup
* @copyright Copyright (c)2009-2013 Nicholas K. Dionysopoulos
* @license GNU General Public License version 3, or later
* @since 1.3
*/
defined('_JEXEC') or die;
$data = $this->item->getData();
if (substr($data['configuration'], 0, 12) == '###AES128###') {
// Load the server key file if necessary
jimport('joomla.filesystem.file');
if (!defined('AKEEBA_SERVERKEY')) {
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php';
include_once $filename;
}
$key = AEUtilSecuresettings::getKey();
$data['configuration'] = AEUtilSecuresettings::decryptSettings($data['configuration'], $key);
}
$defaultName = FOFInput::getCmd('view', 'joomla', $this->input);
$filename = FOFInput::getCmd('basename', $defaultName, $this->input);
$document = JFactory::getDocument();
$document->setName($filename);
echo json_encode($data);
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:25,代码来源:default_json.php
示例16: __callStatic
/**
* Old static methods are now deprecated. This magic method makes sure there
* is a continuity in our approach. The downside is that it's only compatible
* with PHP 5.3.0. Sorry!
*
* @param string $name Name of the method we're calling
* @param array $arguments The arguments passed to the method
*
* @return mixed
*/
public static function __callStatic($name, $arguments)
{
FOFPlatform::getInstance()->logDeprecated('FOFInput: static getXXX() methods are deprecated. Use the input object\'s methods instead.');
if (substr($name, 0, 3) == 'get') {
// Initialise arguments
$key = array_shift($arguments);
$default = array_shift($arguments);
$input = array_shift($arguments);
$type = 'none';
$mask = 0;
$type = strtolower(substr($name, 3));
if ($type == 'var') {
$type = array_shift($arguments);
$mask = array_shift($arguments);
}
if (is_null($type)) {
$type = 'none';
}
if (is_null($mask)) {
$mask = 0;
}
if (!$input instanceof FOFInput && !$input instanceof JInput) {
$input = new FOFInput($input);
}
return $input->get($key, $default, $type, $mask);
}
return false;
}
开发者ID:deenison,项目名称:joomla-cms,代码行数:38,代码来源:input.php
示例17: autoload_fof_view
/**
* Autoload Views
*
* @param string $class_name The name of the class to load
*
* @return void
*/
public function autoload_fof_view($class_name)
{
JLog::add(__METHOD__ . "() autoloading {$class_name}", JLog::DEBUG, 'fof');
static $isCli = null, $isAdmin = null;
if (is_null($isCli) && is_null($isAdmin)) {
list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
}
if (strpos($class_name, 'View') === false) {
return;
}
// Change from camel cased into a lowercase array
$class_modified = preg_replace('/(\\s)+/', '_', $class_name);
$class_modified = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $class_modified));
$parts = explode('_', $class_modified);
// We need at least three parts in the name
if (count($parts) < 3) {
return;
}
// We need the second part to be "view"
if ($parts[1] != 'view') {
return;
}
// Get the information about this class
$component_raw = $parts[0];
$component = 'com_' . $parts[0];
$view = $parts[2];
if (count($parts) > 3) {
$format = $parts[3];
} else {
$input = new FOFInput();
$format = $input->getCmd('format', 'html', 'cmd');
}
// Is this an FOF 2.1 or later component?
if (!$this->isFOFComponent($component)) {
return;
}
// Get the alternate view and class name (opposite singular/plural name)
$alt_view = FOFInflector::isSingular($view) ? FOFInflector::pluralize($view) : FOFInflector::singularize($view);
$alt_class = FOFInflector::camelize($component_raw . '_view_' . $alt_view);
// Get the proper and alternate paths and file names
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($component);
$protoFile = "/models/{$view}";
$protoAltFile = "/models/{$alt_view}";
$path = $componentPaths['main'];
$altPath = $componentPaths['alt'];
$formats = array($format);
if ($format != 'html') {
$formats[] = 'raw';
}
foreach ($formats as $currentFormat) {
$file = $protoFile . '.' . $currentFormat . '.php';
$altFile = $protoAltFile . '.' . $currentFormat . '.php';
// Try to find the proper class in the proper path
if (!class_exists($class_name) && file_exists($path . $file)) {
@(include_once $path . $file);
}
// Try to find the proper class in the alternate path
if (!class_exists($class_name) && file_exists($altPath . $file)) {
@(include_once $altPath . $file);
}
// Try to find the alternate class in the proper path
if (!class_exists($alt_class) && file_exists($path . $altFile)) {
@(include_once $path . $altFile);
}
// Try to find the alternate class in the alternate path
if (!class_exists($alt_class) && file_exists($altPath . $altFile)) {
@(include_once $altPath . $altFile);
}
}
// If the alternate class exists just map the class to the alternate
if (!class_exists($class_name) && class_exists($alt_class)) {
$this->class_alias($alt_class, $class_name);
} elseif (!class_exists($class_name)) {
if ($view != 'default') {
$defaultClass = FOFInflector::camelize($component_raw . '_view_default');
$this->class_alias($defaultClass, $class_name);
} else {
if (!file_exists(self::$fofPath . '/view/' . $format . '.php')) {
$default_class = 'FOFView';
} else {
$default_class = 'FOFView' . ucfirst($format);
}
$this->class_alias($default_class, $class_name, true);
}
}
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:93,代码来源:component.php
示例18: array
/**
* Gets a temporary instance of a Dispatcher
*
* @param string $option The component name
* @param string $view The View name
* @param array $config Configuration data
*
* @return FOFDispatcher
*/
public static function &getTmpInstance($option = null, $view = null, $config = array())
{
if (array_key_exists('input', $config)) {
if ($config['input'] instanceof FOFInput) {
$input = $config['input'];
} else {
if (!is_array($config['input'])) {
$config['input'] = (array) $config['input'];
}
$config['input'] = array_merge($_REQUEST, $config['input']);
$input = new FOFInput($config['input']);
}
} else {
$input = new FOFInput();
}
$config['option'] = !is_null($option) ? $option : $input->getCmd('option', 'com_foobar');
$config['view'] = !is_null($view) ? $view : $input->getCmd('view', '');
$input->set('option', $config['option']);
$input->set('view', $config['view']);
$config['input'] = $input;
$className = ucfirst(str_replace('com_', '', $config['option'])) . 'Dispatcher';
if (!class_exists($className)) {
list($isCli, $isAdmin) = self::isCliAdmin();
if ($isAdmin) {
$basePath = JPATH_ADMINISTRATOR;
} elseif ($isCli) {
$basePath = JPATH_ROOT;
} else {
$basePath = JPATH_SITE;
}
$searchPaths = array($basePath . '/components/' . $config['option'], $basePath . '/components/' . $config['option'] . '/dispatchers', JPATH_ADMINISTRATOR . '/components/' . $config['option'], JPATH_ADMINISTRATOR . '/components/' . $config['option'] . '/dispatchers');
if (array_key_exists('searchpath', $config)) {
array_unshift($searchPaths, $config['searchpath']);
}
JLoader::import('joomla.filesystem.path');
$path = JPath::find($searchPaths, 'dispatcher.php');
if ($path) {
require_once $path;
}
}
if (!class_exists($className)) {
$className = 'FOFDispatcher';
}
$instance = new $className($config);
return $instance;
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:55,代码来源:dispatcher.php
示例19: findFormFilename
/**
* Guesses the best candidate for the path to use for a particular form.
*
* @param string $source The name of the form file to load, without the .xml extension.
* @param array $paths The paths to look into. You can declare this to override the default FOF paths.
*
* @return mixed A string if the path and filename of the form to load is found, false otherwise.
*
* @since 2.0
*/
public function findFormFilename($source, $paths = array())
{
// TODO Should we read from internal variables instead of the input? With a temp instance we have no input
$option = $this->input->getCmd('option', 'com_foobar');
$view = $this->name;
$componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($option);
$file_root = $componentPaths['main'];
$alt_file_root = $componentPaths['alt'];
$template_root = FOFPlatform::getInstance()->getTemplateOverridePath($option);
if (empty($paths)) {
// Set up the paths to look into
// PLEASE NOTE: If you ever change this, please update Model Unit tests, too, since we have to
// copy these default folders (we have to add the protocol for the virtual filesystem)
$paths = array($template_root . '/' . $view, $template_root . '/' . FOFInflector::singularize($view), $template_root . '/' . FOFInflector::pluralize($view), $file_root . '/views/' . $view . '/tmpl', $file_root . '/views/' . FOFInflector::singularize($view) . '/tmpl', $file_root . '/views/' . FOFInflector::pluralize($view) . '/tmpl', $alt_file_root . '/views/' . $view . '/tmpl', $alt_file_root . '/views/' . FOFInflector::singularize($view) . '/tmpl', $alt_file_root . '/views/' . FOFInflector::pluralize($view) . '/tmpl', $file_root . '/models/forms', $alt_file_root . '/models/forms');
}
$paths = array_unique($paths);
// Set up the suffixes to look into
$suffixes = array();
$temp_suffixes = FOFPlatform::getInstance()->getTemplateSuffixes();
if (!empty($temp_suffixes)) {
foreach ($temp_suffixes as $suffix) {
$suffixes[] = $suffix . '.xml';
}
}
$suffixes[] = '.xml';
// Look for all suffixes in all paths
$result = false;
$filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
foreach ($paths as $path) {
foreach ($suffixes as $suffix) {
$filename = $path . '/' . $source . $suffix;
if ($filesystem->fileExists($filename)) {
|
请发表评论