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


PHP FOFInput::set方法代码示例

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


在下文中一共展示了FOFInput::set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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']);
             }
             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:Tommar,项目名称:vino2,代码行数:52,代码来源:toolbar.php

示例3: __construct

 /**
  * Class Constructor.
  *
  * @param   string           $table   Name of the database table to model.
  * @param   string           $key     Name of the primary key field in the table.
  * @param   JDatabaseDriver  &$db     Database driver
  * @param   array            $config  The configuration parameters array
  */
 public function __construct($table, $key, &$db, $config = array())
 {
     $this->_tbl = $table;
     $this->_tbl_key = $key;
     $this->_db = $db;
     // Make sure the use FOF cache information is in the config
     if (!array_key_exists('use_table_cache', $config)) {
         $config['use_table_cache'] = FOFPlatform::getInstance()->isGlobalFOFCacheEnabled();
     }
     $this->config = $config;
     // Load the configuration provider
     $this->configProvider = new FOFConfigProvider();
     // Load the behavior dispatcher
     $this->tableDispatcher = new FOFTableDispatcherBehavior();
     // Initialise the table properties.
     if ($fields = $this->getTableFields()) {
         // Do I have anything joined?
         $j_fields = $this->getQueryJoinFields();
         if ($j_fields) {
             $fields = array_merge($fields, $j_fields);
         }
         $this->setKnownFields(array_keys($fields), true);
         $this->reset();
     } else {
         $this->_tableExists = false;
     }
     // Get the input
     if (array_key_exists('input', $config)) {
         if ($config['input'] instanceof FOFInput) {
             $this->input = $config['input'];
         } else {
             $this->input = new FOFInput($config['input']);
         }
     } else {
         $this->input = new FOFInput();
     }
     // Set the $name/$_name variable
     $component = $this->input->getCmd('option', 'com_foobar');
     if (array_key_exists('option', $config)) {
         $component = $config['option'];
     }
     $this->input->set('option', $component);
     // Apply table behaviors
     $type = explode("_", $this->_tbl);
     $type = $type[count($type) - 1];
     $this->_configProviderKey = $component . '.tables.' . FOFInflector::singularize($type);
     $configKey = $this->_configProviderKey . '.behaviors';
     if (isset($config['behaviors'])) {
         $behaviors = (array) $config['behaviors'];
     } elseif ($behaviors = $this->configProvider->get($configKey, null)) {
         $behaviors = explode(',', $behaviors);
     } else {
         $behaviors = $this->default_behaviors;
     }
     if (is_array($behaviors) && count($behaviors)) {
         foreach ($behaviors as $behavior) {
             $this->addBehavior($behavior);
         }
     }
     // If we are tracking assets, make sure an access field exists and initially set the default.
     $asset_id_field = $this->getColumnAlias('asset_id');
     $access_field = $this->getColumnAlias('access');
     if (in_array($asset_id_field, $this->getKnownFields())) {
         JLoader::import('joomla.access.rules');
         $this->_trackAssets = true;
     }
     // If the access property exists, set the default.
     if (in_array($access_field, $this->getKnownFields())) {
         $this->{$access_field} = (int) FOFPlatform::getInstance()->getConfig()->get('access');
     }
     $this->config = $config;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:80,代码来源:table.php

示例4: 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

示例5: createView

 /**
  * Creates a View object instance and returns it
  *
  * @param   string  $name    The name of the view, e.g. Items
  * @param   string  $prefix  The prefix of the view, e.g. FoobarView
  * @param   string  $type    The type of the view, usually one of Html, Raw, Json or Csv
  * @param   array   $config  The configuration variables to use for creating the view
  *
  * @return  FOFView
  */
 protected function createView($name, $prefix = '', $type = '', $config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     $result = null;
     // Clean the view name
     $viewName = preg_replace('/[^A-Z0-9_]/i', '', $name);
     $classPrefix = preg_replace('/[^A-Z0-9_]/i', '', $prefix);
     $viewType = preg_replace('/[^A-Z0-9_]/i', '', $type);
     if (!isset($config['input'])) {
         $config['input'] = $this->input;
     }
     if ($config['input'] instanceof FOFInput) {
         $tmpInput = $config['input'];
     } else {
         $tmpInput = new FOFInput($config['input']);
     }
     // Guess the component name and view
     if (!empty($prefix)) {
         preg_match('/(.*)View$/', $prefix, $m);
         $component = 'com_' . strtolower($m[1]);
     } else {
         $component = '';
     }
     if (empty($component) && array_key_exists('input', $config)) {
         $component = $tmpInput->get('option', $component, 'cmd');
     }
     if (array_key_exists('option', $config)) {
         if ($config['option']) {
             $component = $config['option'];
         }
     }
     $config['option'] = $component;
     $view = strtolower($viewName);
     if (empty($view) && array_key_exists('input', $config)) {
         $view = $tmpInput->get('view', $view, 'cmd');
     }
     if (array_key_exists('view', $config)) {
         if ($config['view']) {
             $view = $config['view'];
         }
     }
     $config['view'] = $view;
     if (array_key_exists('input', $config)) {
         $tmpInput->set('option', $config['option']);
         $tmpInput->set('view', $config['view']);
         $config['input'] = $tmpInput;
     }
     // Get the component directories
     $componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
     // Get the base paths where the view class files are expected to live
     $basePaths = array($componentPaths['main'], $componentPaths['alt']);
     $basePaths = array_merge($this->paths['view']);
     // Get the alternate (singular/plural) view name
     $altViewName = FOFInflector::isPlural($viewName) ? FOFInflector::singularize($viewName) : FOFInflector::pluralize($viewName);
     $suffixes = array($viewName, $altViewName, 'default');
     $filesystem = FOFPlatform::getInstance()->getFilesystem();
     foreach ($suffixes as $suffix) {
         // Build the view class name
         $viewClass = $classPrefix . ucfirst($suffix);
         if (class_exists($viewClass)) {
             // The class is already loaded
             break;
         }
         // The class is not loaded. Let's load it!
         $viewPath = $this->createFileName('view', array('name' => $suffix, 'type' => $viewType));
         $path = $filesystem->pathFind($basePaths, $viewPath);
         if ($path) {
             require_once $path;
         }
         if (class_exists($viewClass)) {
             // The class was loaded successfully
             break;
         }
     }
     if (!class_exists($viewClass)) {
         $viewClass = 'FOFView' . ucfirst($type);
     }
     $templateOverridePath = FOFPlatform::getInstance()->getTemplateOverridePath($config['option']);
     // Setup View configuration options
     if (!array_key_exists('template_path', $config)) {
         $config['template_path'][] = $componentPaths['main'] . '/views/' . FOFInflector::pluralize($config['view']) . '/tmpl';
         if ($templateOverridePath) {
             $config['template_path'][] = $templateOverridePath . '/' . FOFInflector::pluralize($config['view']);
         }
         $config['template_path'][] = $componentPaths['main'] . '/views/' . FOFInflector::singularize($config['view']) . '/tmpl';
//.........这里部分代码省略.........
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:101,代码来源:controller.php

示例6: createView

 /**
  * Creates a View object instance and returns it
  *
  * @param   string  $name    The name of the view, e.g. Items
  * @param   string  $prefix  The prefix of the view, e.g. FoobarView
  * @param   string  $type    The type of the view, usually one of Html, Raw, Json or Csv
  * @param   array   $config  The configuration variables to use for creating the view
  *
  * @return  FOFView
  */
 protected function createView($name, $prefix = '', $type = '', $config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     $result = null;
     // Clean the view name
     $viewName = preg_replace('/[^A-Z0-9_]/i', '', $name);
     $classPrefix = preg_replace('/[^A-Z0-9_]/i', '', $prefix);
     $viewType = preg_replace('/[^A-Z0-9_]/i', '', $type);
     if (!isset($config['input'])) {
         $config['input'] = $this->input;
     }
     if ($config['input'] instanceof FOFInput) {
         $tmpInput = $config['input'];
     } else {
         $tmpInput = new FOFInput($config['input']);
     }
     // Guess the component name and view
     if (!empty($prefix)) {
         preg_match('/(.*)View$/', $prefix, $m);
         $component = 'com_' . strtolower($m[1]);
     } else {
         $component = '';
     }
     if (empty($component) && array_key_exists('input', $config)) {
         $component = $tmpInput->get('option', $component, 'cmd');
     }
     if (array_key_exists('option', $config)) {
         if ($config['option']) {
             $component = $config['option'];
         }
     }
     $config['option'] = $component;
     $view = strtolower($viewName);
     if (empty($view) && array_key_exists('input', $config)) {
         $view = $tmpInput->get('view', $view, 'cmd');
     }
     if (array_key_exists('view', $config)) {
         if ($config['view']) {
             $view = $config['view'];
         }
     }
     $config['view'] = $view;
     if (array_key_exists('input', $config)) {
         $tmpInput->set('option', $config['option']);
         $tmpInput->set('view', $config['view']);
         $config['input'] = $tmpInput;
     }
     // Get the component directories
     $componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($config['option']);
     // Get the base paths where the view class files are expected to live
     $basePaths = array($componentPaths['main'], $componentPaths['alt']);
     $basePaths = array_merge($this->paths['view']);
     // Get the alternate (singular/plural) view name
     $altViewName = FOFInflector::isPlural($viewName) ? FOFInflector::singularize($viewName) : FOFInflector::pluralize($viewName);
     $suffixes = array($viewName, $altViewName, 'default');
     $filesystem = FOFPlatform::getInstance()->getIntegrationObject('filesystem');
     foreach ($suffixes as $suffix) {
         // Build the view class name
         $viewClass = $classPrefix . ucfirst($suffix);
         if (class_exists($viewClass)) {
             // The class is already loaded
             break;
         }
         // The class is not loaded. Let's load it!
         $viewPath = $this->createFileName('view', array('name' => $suffix, 'type' => $viewType));
         $path = $filesystem->pathFind($basePaths, $viewPath);
         if ($path) {
             require_once $path;
         }
         if (class_exists($viewClass)) {
             // The class was loaded successfully
             break;
         }
     }
     if (!class_exists($viewClass)) {
         $viewClass = 'FOFView' . ucfirst($type);
     }
     $templateOverridePath = FOFPlatform::getInstance()->getTemplateOverridePath($config['option']);
     // Setup View configuration options
     if (!array_key_exists('template_path', $config)) {
         $config['template_path'][] = $componentPaths['main'] . '/views/' . FOFInflector::pluralize($config['view']) . '/tmpl';
         if ($templateOverridePath) {
             $config['template_path'][] = $templateOverridePath . '/' . FOFInflector::pluralize($config['view']);
         }
         $config['template_path'][] = $componentPaths['main'] . '/views/' . FOFInflector::singularize($config['view']) . '/tmpl';
//.........这里部分代码省略.........
开发者ID:educakanchay,项目名称:kanchay,代码行数:101,代码来源:controller.php

示例7: __construct

 /**
  * Public class constructor
  *
  * @param array $config The configuration 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();
     }
     // Get the input
     if (array_key_exists('input', $config)) {
         if ($config['input'] instanceof FOFInput) {
             $this->input = $config['input'];
         } else {
             $this->input = new FOFInput($config['input']);
         }
     } else {
         $this->input = new FOFInput();
     }
     // Load the configuration provider
     $this->configProvider = new FOFConfigProvider();
     // Load the behavior dispatcher
     $this->modelDispatcher = new FOFModelDispatcherBehavior();
     // Set the $name/$_name variable
     $component = $this->input->getCmd('option', 'com_foobar');
     if (array_key_exists('option', $config)) {
         $component = $config['option'];
     }
     // Set the $name variable
     $this->input->set('option', $component);
     $component = $this->input->getCmd('option', 'com_foobar');
     if (array_key_exists('option', $config)) {
         $component = $config['option'];
     }
     $this->input->set('option', $component);
     $bareComponent = str_replace('com_', '', strtolower($component));
     // Get the view name
     $className = get_class($this);
     if ($className == 'FOFModel') {
         if (array_key_exists('view', $config)) {
             $view = $config['view'];
         }
         if (empty($view)) {
             $view = $this->input->getCmd('view', 'cpanel');
         }
     } else {
         if (array_key_exists('view', $config)) {
             $view = $config['view'];
         }
         if (empty($view)) {
             $eliminatePart = ucfirst($bareComponent) . 'Model';
             $view = strtolower(str_replace($eliminatePart, '', $className));
         }
     }
     if (array_key_exists('name', $config)) {
         $name = $config['name'];
     } else {
         $name = $view;
     }
     $this->name = $name;
     $this->option = $component;
     // Set the model state
     if (array_key_exists('state', $config)) {
         $this->state = $config['state'];
     } else {
         $this->state = new FOFUtilsObject();
     }
     // Set the model dbo
     if (array_key_exists('dbo', $config)) {
         $this->_db = $config['dbo'];
     } else {
         $this->_db = FOFPlatform::getInstance()->getDbo();
     }
     // Set the default view search path
     if (array_key_exists('table_path', $config)) {
         $this->addTablePath($config['table_path']);
     } else {
         $componentPaths = FOFPlatform::getInstance()->getComponentBaseDirs($this->option);
         $path = $componentPaths['admin'] . '/tables';
         $altPath = $this->configProvider->get($this->option . '.views.' . FOFInflector::singularize($this->name) . '.config.table_path', null);
         if ($altPath) {
             $path = $componentPaths['main'] . '/' . $altPath;
         }
         $this->addTablePath($path);
     }
     // Assign the correct table
     if (array_key_exists('table', $config)) {
         $this->table = $config['table'];
     } else {
         $table = $this->configProvider->get($this->option . '.views.' . FOFInflector::singularize($this->name) . '.config.table', FOFInflector::singularize($view));
         $this->table = $table;
     }
     // Set the internal state marker - used to ignore setting state from the request
     if (!empty($config['ignore_request']) || !is_null($this->configProvider->get($this->option . '.views.' . FOFInflector::singularize($this->name) . '.config.ignore_request', null))) {
         $this->__state_set = true;
     }
//.........这里部分代码省略.........
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:101,代码来源:model.php

示例8: array

 /**
  * Returns a static object instance of a particular table type
  *
  * @param   string  $type    The table name
  * @param   string  $prefix  The prefix of the table class
  * @param   array   $config  Optional configuration variables
  *
  * @return FOFTable
  */
 public static function &getAnInstance($type = null, $prefix = 'JTable', $config = array())
 {
     static $instances = array();
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     // Guess the component name
     if (!array_key_exists('input', $config)) {
         $config['input'] = new FOFInput();
     }
     if ($config['input'] instanceof FOFInput) {
         $tmpInput = $config['input'];
     } else {
         $tmpInput = new FOFInput($config['input']);
     }
     $option = $tmpInput->getCmd('option', '');
     $tmpInput->set('option', $option);
     $config['input'] = $tmpInput;
     if (!in_array($prefix, array('Table', 'JTable'))) {
         preg_match('/(.*)Table$/', $prefix, $m);
         $option = 'com_' . strtolower($m[1]);
     }
     if (array_key_exists('option', $config)) {
         $option = $config['option'];
     }
     $config['option'] = $option;
     if (!array_key_exists('view', $config)) {
         $config['view'] = $config['input']->getCmd('view', 'cpanel');
     }
     if (is_null($type)) {
         if ($prefix == 'JTable') {
             $prefix = 'Table';
         }
         $type = $config['view'];
     }
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $tableClass = $prefix . ucfirst($type);
     $configProvider = new FOFConfigProvider();
     $configProviderKey = $option . '.views.' . FOFInflector::singularize($type) . '.config.';
     if (!array_key_exists($tableClass, $instances)) {
         if (!class_exists($tableClass)) {
             list($isCLI, $isAdmin) = FOFDispatcher::isCliAdmin();
             if (!$isAdmin) {
                 $basePath = JPATH_SITE;
             } else {
                 $basePath = JPATH_ADMINISTRATOR;
             }
             $searchPaths = array($basePath . '/components/' . $config['option'] . '/tables', JPATH_ADMINISTRATOR . '/components/' . $config['option'] . '/tables');
             if (array_key_exists('tablepath', $config)) {
                 array_unshift($searchPaths, $config['tablepath']);
             }
             $altPath = $configProvider->get($configProviderKey . 'table_path', null);
             if ($altPath) {
                 array_unshift($searchPaths, JPATH_ADMINISTRATOR . '/components/' . $option . '/' . $altPath);
             }
             JLoader::import('joomla.filesystem.path');
             $path = JPath::find($searchPaths, strtolower($type) . '.php');
             if ($path) {
                 require_once $path;
             }
         }
         if (!class_exists($tableClass)) {
             $tableClass = 'FOFTable';
         }
         $tbl_common = str_replace('com_', '', $config['option']) . '_';
         if (!array_key_exists('tbl', $config)) {
             $config['tbl'] = strtolower('#__' . $tbl_common . strtolower(FOFInflector::pluralize($type)));
         }
         $altTbl = $configProvider->get($configProviderKey . 'tbl', null);
         if ($altTbl) {
             $config['tbl'] = $altTbl;
         }
         if (!array_key_exists('tbl_key', $config)) {
             $keyName = FOFInflector::singularize($type);
             $config['tbl_key'] = strtolower($tbl_common . $keyName . '_id');
         }
         $altTblKey = $configProvider->get($configProviderKey . 'tbl_key', null);
         if ($altTblKey) {
             $config['tbl_key'] = $altTblKey;
         }
         if (!array_key_exists('db', $config)) {
             $config['db'] = JFactory::getDBO();
         }
         $instance = new $tableClass($config['tbl'], $config['tbl_key'], $config['db']);
         $instance->setInput($tmpInput);
         if (array_key_exists('trigger_events', $config)) {
             $instance->setTriggerEvents($config['trigger_events']);
         }
//.........这里部分代码省略.........
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:table.php

示例9: createView

 /**
  * Creates a View object instance and returns it
  *
  * @param   string  $name    The name of the view, e.g. Items
  * @param   string  $prefix  The prefix of the view, e.g. FoobarView
  * @param   string  $type    The type of the view, usually one of Html, Raw, Json or Csv
  * @param   array   $config  The configuration variables to use for creating the view
  *
  * @return  FOFView
  */
 protected function createView($name, $prefix = '', $type = '', $config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     $result = null;
     // Clean the view name
     $viewName = preg_replace('/[^A-Z0-9_]/i', '', $name);
     $classPrefix = preg_replace('/[^A-Z0-9_]/i', '', $prefix);
     $viewType = preg_replace('/[^A-Z0-9_]/i', '', $type);
     if (!isset($config['input'])) {
         $config['input'] = $this->input;
     }
     if ($config['input'] instanceof FOFInput) {
         $tmpInput = $config['input'];
     } else {
         $tmpInput = new FOFInput($config['input']);
     }
     // Guess the component name and view
     if (!empty($prefix)) {
         preg_match('/(.*)View$/', $prefix, $m);
         $component = 'com_' . strtolower($m[1]);
     } else {
         $component = '';
     }
     if (empty($component) && array_key_exists('input', $config)) {
         $component = $tmpInput->get('option', $component, 'cmd');
     }
     if (array_key_exists('option', $config)) {
         if ($config['option']) {
             $component = $config['option'];
         }
     }
     $config['option'] = $component;
     $view = strtolower($viewName);
     if (empty($view) && array_key_exists('input', $config)) {
         $view = $tmpInput->get('view', $view, 'cmd');
     }
     if (array_key_exists('view', $config)) {
         if ($config['view']) {
             $view = $config['view'];
         }
     }
     $config['view'] = $view;
     if (array_key_exists('input', $config)) {
         $tmpInput->set('option', $config['option']);
         $tmpInput->set('view', $config['view']);
         $config['input'] = $tmpInput;
     }
     // Get the base paths where the view class files are expected to live
     list($isCli, $isAdmin) = FOFDispatcher::isCliAdmin();
     $basePaths = array(JPATH_SITE . '/components/' . $config['option'] . '/views', JPATH_ADMINISTRATOR . '/components/' . $config['option'] . '/views');
     if ($isAdmin || $isCli) {
         $basePaths = array_reverse($basePaths);
         $basePaths = array_merge($basePaths, $this->paths['view'], $basePaths);
     } else {
         $basePaths = array_merge($this->paths['view']);
     }
     // Get the alternate (singular/plural) view name
     $altViewName = FOFInflector::isPlural($viewName) ? FOFInflector::singularize($viewName) : FOFInflector::pluralize($viewName);
     $suffixes = array($viewName, $altViewName, 'default');
     JLoader::import('joomla.filesystem.path');
     foreach ($suffixes as $suffix) {
         // Build the view class name
         $viewClass = $classPrefix . ucfirst($suffix);
         if (class_exists($viewClass)) {
             // The class is already loaded
             break;
         }
         // The class is not loaded. Let's load it!
         $viewPath = $this->createFileName('view', array('name' => $suffix, 'type' => $viewType));
         $path = JPath::find($basePaths, $viewPath);
         if ($path) {
             require_once $path;
         }
         if (class_exists($viewClass)) {
             // The class was loaded successfully
             break;
         }
     }
     if (!class_exists($viewClass)) {
         $viewClass = 'FOFView' . ucfirst($type);
     }
     // Setup View configuration options
     if ($isAdmin) {
         $basePath = JPATH_ADMINISTRATOR;
     } elseif ($isCli) {
//.........这里部分代码省略.........
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:controller.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)) {
         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


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