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


PHP F0FInflector::singularize方法代码示例

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


在下文中一共展示了F0FInflector::singularize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: accessAllowed

 /**
  * Checks if the user should be granted access to the current view,
  * based on his Master Password setting.
  *
  * @param string view Optional. The string to check. Leave null to use the current view.
  *
  * @return bool
  */
 public function accessAllowed($view = null)
 {
     if (interface_exists('JModel')) {
         $params = JModelLegacy::getInstance('Storage', 'AdmintoolsModel');
     } else {
         $params = JModel::getInstance('Storage', 'AdmintoolsModel');
     }
     if (empty($view)) {
         $view = $this->input->get('view', 'cpanel');
     }
     $altView = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
     if (!in_array($view, $this->views) && !in_array($altView, $this->views)) {
         return true;
     }
     $masterHash = $params->getValue('masterpassword', '');
     if (!empty($masterHash)) {
         $masterHash = md5($masterHash);
         // Compare the master pw with the one the user entered
         $session = JFactory::getSession();
         $userHash = $session->get('userpwhash', '', 'admintools');
         if ($userHash != $masterHash) {
             // The login is invalid. If the view is locked I'll have to kick the user out.
             $lockedviews_raw = $params->getValue('lockedviews', '');
             if (!empty($lockedviews_raw)) {
                 $lockedViews = explode(",", $lockedviews_raw);
                 if (in_array($view, $lockedViews) || in_array($altView, $lockedViews)) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:41,代码来源:masterpw.php

示例2: getRepeatable

 public function getRepeatable()
 {
     $html = '';
     // Find which is the relation to use
     if ($this->item instanceof F0FTable) {
         // Pluralize the name to match that of the relation
         $relation_name = F0FInflector::pluralize($this->name);
         // Get the relation
         $iterator = $this->item->getRelations()->getMultiple($relation_name);
         $results = array();
         // Decide which class name use in tag markup
         $class = !empty($this->element['class']) ? $this->element['class'] : F0FInflector::singularize($this->name);
         foreach ($iterator as $item) {
             $markup = '<span class="%s">%s</span>';
             // Add link if show_link parameter is set
             if (!empty($this->element['url']) && !empty($this->element['show_link']) && $this->element['show_link']) {
                 // Parse URL
                 $url = $this->getReplacedPlaceholders($this->element['url'], $item);
                 // Set new link markup
                 $markup = '<a class="%s" href="' . JRoute::_($url) . '">%s</a>';
             }
             array_push($results, sprintf($markup, $class, $item->get($item->getColumnAlias('title'))));
         }
         // Join all html segments
         $html .= implode(', ', $results);
     }
     // Parse field parameters
     if (empty($html) && !empty($this->element['empty_replacement'])) {
         $html = JText::_($this->element['empty_replacement']);
     }
     return $html;
 }
开发者ID:fede91it,项目名称:fof-nnrelation,代码行数:32,代码来源:nnrelation.php

示例3: addSubmenuLink

 private function addSubmenuLink($view, $parent = null, $icon = null)
 {
     static $activeView = null;
     if (empty($activeView)) {
         $activeView = $this->input->getCmd('view', 'cpanel');
     }
     if ($activeView == 'cpanels') {
         $activeView = 'cpanel';
     }
     $key = strtoupper($this->component) . '_TITLE_' . strtoupper($view);
     if (strtoupper(JText::_($key)) == $key) {
         $altview = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
         $key2 = strtoupper($this->component) . '_TITLE_' . strtoupper($altview);
         if (strtoupper(JText::_($key2)) == $key2) {
             $name = ucfirst($view);
         } else {
             $name = JText::_($key2);
         }
     } else {
         $name = JText::_($key);
     }
     $link = 'index.php?option=' . $this->component . '&view=' . $view;
     $active = $view == $activeView;
     $this->appendLink($name, $link, $active, $icon, $parent);
 }
开发者ID:davetheapple,项目名称:oakencraft,代码行数:25,代码来源:toolbar.php

示例4: onBeforeDispatch

 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Load Akeeba Strapper
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = AKEEBAMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addJSfile('media://com_akeeba/js/gui-helpers.js');
         AkeebaStrapper::addJSfile('media://com_akeeba/js/akeebaui.js');
         AkeebaStrapper::addJSfile('media://com_akeeba/js/piecon.min.js');
         jimport('joomla.filesystem.file');
         if (JFile::exists(F0FTemplateUtils::parsePath('media://com_akeeba/js/akeebauipro.js', true))) {
             AkeebaStrapper::addJSfile('media://com_akeeba/js/akeebauipro.js');
         }
         AkeebaStrapper::addCSSfile('media://com_akeeba/theme/akeebaui.css');
         // Control Check
         $view = F0FInflector::singularize($this->input->getCmd('view', $this->defaultView));
         if ($view == 'liveupdate') {
             $url = JUri::base() . 'index.php?option=com_akeeba';
             JFactory::getApplication()->redirect($url);
             return;
         }
     }
     return $result;
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:27,代码来源:dispatcher.php

示例5: onBeforeDispatch

 public function onBeforeDispatch()
 {
     $result = parent::onBeforeDispatch();
     if ($result) {
         // Clear com_modules and com_plugins cache (needed when we alter module/plugin state)
         $core_components = array('com_modules', 'com_plugins');
         foreach ($core_components as $component) {
             try {
                 $cache = JFactory::getCache($component);
                 $cache->clean();
             } catch (Exception $e) {
                 // suck it up
             }
         }
         // Merge the language overrides
         $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
         $jlang = JFactory::getLanguage();
         $jlang->load($this->component, $paths[0], 'en-GB', true);
         $jlang->load($this->component, $paths[0], null, true);
         $jlang->load($this->component, $paths[1], 'en-GB', true);
         $jlang->load($this->component, $paths[1], null, true);
         $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[0], null, true);
         $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
         $jlang->load($this->component . '.override', $paths[1], null, true);
         // Load Akeeba Strapper
         if (!defined('ADMINTOOLSMEDIATAG')) {
             $staticFilesVersioningTag = md5(ADMINTOOLS_VERSION . ADMINTOOLS_DATE);
             define('ADMINTOOLSMEDIATAG', $staticFilesVersioningTag);
         }
         include_once JPATH_ROOT . '/media/akeeba_strapper/strapper.php';
         AkeebaStrapper::$tag = ADMINTOOLSMEDIATAG;
         AkeebaStrapper::bootstrap();
         AkeebaStrapper::jQueryUI();
         AkeebaStrapper::addCSSfile('admin://components/com_admintools/media/css/backend.css');
         // Work around non-transparent proxy and reverse proxy IP issues
         if (class_exists('F0FUtilsIp', true)) {
             F0FUtilsIp::workaroundIPIssues();
         }
         // Control Check
         $view = F0FInflector::singularize($this->input->getCmd('view', $this->defaultView));
         if ($view == 'liveupdate') {
             $url = JUri::base() . 'index.php?option=com_admintools';
             JFactory::getApplication()->redirect($url);
             return;
         }
         // ========== Master PW check ==========
         /** @var AdmintoolsModelMasterpw $model */
         $model = F0FModel::getAnInstance('Masterpw', 'AdmintoolsModel');
         if (!$model->accessAllowed($view)) {
             $url = $view == 'cpanel' ? 'index.php' : 'index.php?option=com_admintools&view=cpanel';
             JFactory::getApplication()->redirect($url, JText::_('ATOOLS_ERR_NOTAUTHORIZED'), 'error');
             return;
         }
     }
     return $result;
 }
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:57,代码来源:dispatcher.php

示例6: dispatch

 public function dispatch()
 {
     // Look for controllers in the plugins folder
     $option = $this->input->get('option', 'com_foobar', 'cmd');
     $view = $this->input->get('view', $this->defaultView, 'cmd');
     $c = F0FInflector::singularize($view);
     $alt_path = JPATH_SITE . '/components/' . $option . '/plugins/controllers/' . $c . '.php';
     JLoader::import('joomla.filesystem.file');
     if (JFile::exists($alt_path)) {
         // The requested controller exists and there you load it...
         require_once $alt_path;
     }
     $this->input->set('view', $this->view);
     parent::dispatch();
 }
开发者ID:esorone,项目名称:efcpw,代码行数:15,代码来源:dispatcher.php

示例7: dispatch

 public function dispatch()
 {
     if (!class_exists('AkeebaControllerDefault')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/controllers/default.php';
     }
     // Merge the language overrides
     $paths = array(JPATH_ROOT, JPATH_ADMINISTRATOR);
     $jlang = JFactory::getLanguage();
     $jlang->load($this->component, $paths[0], 'en-GB', true);
     $jlang->load($this->component, $paths[0], null, true);
     $jlang->load($this->component, $paths[1], 'en-GB', true);
     $jlang->load($this->component, $paths[1], null, true);
     $jlang->load($this->component . '.override', $paths[0], 'en-GB', true);
     $jlang->load($this->component . '.override', $paths[0], null, true);
     $jlang->load($this->component . '.override', $paths[1], 'en-GB', true);
     $jlang->load($this->component . '.override', $paths[1], null, true);
     F0FInflector::addWord('alice', 'alices');
     // Timezone fix; avoids errors printed out by PHP 5.3.3+ (thanks Yannick!)
     if (function_exists('date_default_timezone_get') && function_exists('date_default_timezone_set')) {
         if (function_exists('error_reporting')) {
             $oldLevel = error_reporting(0);
         }
         $serverTimezone = @date_default_timezone_get();
         if (empty($serverTimezone) || !is_string($serverTimezone)) {
             $serverTimezone = 'UTC';
         }
         if (function_exists('error_reporting')) {
             error_reporting($oldLevel);
         }
         @date_default_timezone_set($serverTimezone);
     }
     // Necessary defines for Akeeba Engine
     if (!defined('AKEEBAENGINE')) {
         define('AKEEBAENGINE', 1);
         // Required for accessing Akeeba Engine's factory class
         define('AKEEBAROOT', dirname(__FILE__) . '/akeeba');
         define('ALICEROOT', dirname(__FILE__) . '/alice');
     }
     // Setup Akeeba's ACLs, honoring laxed permissions in component's parameters, if set
     // Access check, Joomla! 1.6 style.
     $user = JFactory::getUser();
     if (!$user->authorise('core.manage', 'com_akeeba')) {
         return JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // Make sure we have a profile set throughout the component's lifetime
     $session = JFactory::getSession();
     $profile_id = $session->get('profile', null, 'akeeba');
     if (is_null($profile_id)) {
         // No profile is set in the session; use default profile
         $session->set('profile', 1, 'akeeba');
     }
     // Load the factory
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/factory.php';
     @(include_once JPATH_COMPONENT_ADMINISTRATOR . '/alice/factory.php');
     // Load the Akeeba Backup configuration and check user access permission
     $aeconfig = AEFactory::getConfiguration();
     AEPlatform::getInstance()->load_configuration();
     $jDbo = JFactory::getDbo();
     if ($jDbo->name == 'pdomysql') {
         // Prevents the "SQLSTATE[HY000]: General error: 2014" due to resource sharing with Akeeba Engine
         @JFactory::getDbo()->disconnect();
     }
     unset($aeconfig);
     // Preload helpers
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/includes.php';
     require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/escape.php';
     // Load the utils helper library
     AEPlatform::getInstance()->load_version_defines();
     // Create a versioning tag for our static files
     $staticFilesVersioningTag = md5(AKEEBA_VERSION . AKEEBA_DATE);
     define('AKEEBAMEDIATAG', $staticFilesVersioningTag);
     // If JSON functions don't exist, load our compatibility layer
     if (!function_exists('json_encode') || !function_exists('json_decode')) {
         require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/jsonlib.php';
     }
     // Look for controllers in the plugins folder
     $option = $this->input->get('option', 'com_foobar', 'cmd');
     $view = $this->input->get('view', $this->defaultView, 'cmd');
     $c = F0FInflector::singularize($view);
     $alt_path = JPATH_ADMINISTRATOR . '/components/' . $option . '/plugins/controllers/' . $c . '.php';
     JLoader::import('joomla.filesystem.file');
     if (JFile::exists($alt_path)) {
         // The requested controller exists and there you load it...
         require_once $alt_path;
     }
     $this->input->set('view', $this->view);
     parent::dispatch();
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:88,代码来源:dispatcher.php

示例8: 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 F0F 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 = F0FPlatform::getInstance()->getComponentBaseDirs($option);
     $file_root = $componentPaths['main'];
     $alt_file_root = $componentPaths['alt'];
     $template_root = F0FPlatform::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 . '/' . F0FInflector::singularize($view), $template_root . '/' . F0FInflector::pluralize($view), $file_root . '/views/' . $view . '/tmpl', $file_root . '/views/' . F0FInflector::singularize($view) . '/tmpl', $file_root . '/views/' . F0FInflector::pluralize($view) . '/tmpl', $alt_file_root . '/views/' . $view . '/tmpl', $alt_file_root . '/views/' . F0FInflector::singularize($view) . '/tmpl', $alt_file_root . '/views/' . F0FInflector::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 = F0FPlatform::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 = F0FPlatform::getInstance()->getIntegrationObject('filesystem');
     foreach ($paths as $path) {
         foreach ($suffixes as $suffix) {
             $filename = $path . '/' . $source . $suffix;
             if ($filesystem->fileExists($filename)) {
                 $result = $filename;
                 break;
             }
         }
         if ($result) {
             break;
         }
     }
     return $result;
 }
开发者ID:01J,项目名称:topm,代码行数:52,代码来源:model.php

示例9: getViewTemplatePaths

 /**
  * Return a list of the view template paths for this component.
  *
  * @param   string   $component  The name of the component. For Joomla! this
  *                               is something like "com_example"
  * @param   string   $view       The name of the view you're looking a
  *                               template for
  * @param   string   $layout     The layout name to load, e.g. 'default'
  * @param   string   $tpl        The sub-template name to load (null by default)
  * @param   boolean  $strict     If true, only the specified layout will be searched for.
  *                               Otherwise we'll fall back to the 'default' layout if the
  *                               specified layout is not found.
  *
  * @see F0FPlatformInterface::getViewTemplateDirs()
  *
  * @return  array
  */
 public function getViewTemplatePaths($component, $view, $layout = 'default', $tpl = null, $strict = false)
 {
     $isAdmin = $this->isBackend();
     $basePath = $isAdmin ? 'admin:' : 'site:';
     $basePath .= $component . '/';
     $altBasePath = $basePath;
     $basePath .= $view . '/';
     $altBasePath .= (F0FInflector::isSingular($view) ? F0FInflector::pluralize($view) : F0FInflector::singularize($view)) . '/';
     if ($strict) {
         $paths = array($basePath . $layout . ($tpl ? "_{$tpl}" : ''), $altBasePath . $layout . ($tpl ? "_{$tpl}" : ''));
     } else {
         $paths = array($basePath . $layout . ($tpl ? "_{$tpl}" : ''), $basePath . $layout, $basePath . 'default' . ($tpl ? "_{$tpl}" : ''), $basePath . 'default', $altBasePath . $layout . ($tpl ? "_{$tpl}" : ''), $altBasePath . $layout, $altBasePath . 'default' . ($tpl ? "_{$tpl}" : ''), $altBasePath . 'default');
         $paths = array_unique($paths);
     }
     return $paths;
 }
开发者ID:01J,项目名称:topm,代码行数:33,代码来源:platform.php

示例10: renderSubmenu

 /**
  * Renders the submenu (toolbar links) for all detected views of this component
  *
  * @return  void
  */
 public function renderSubmenu()
 {
     $views = $this->getMyViews();
     if (empty($views)) {
         return;
     }
     $activeView = $this->input->getCmd('view', 'cpanel');
     foreach ($views as $view) {
         // Get the view name
         $key = strtoupper($this->component) . '_TITLE_' . strtoupper($view);
         //Do we have a translation for this key?
         if (strtoupper(JText::_($key)) == $key) {
             $altview = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
             $key2 = strtoupper($this->component) . '_TITLE_' . strtoupper($altview);
             // Maybe we have for the alternative view?
             if (strtoupper(JText::_($key2)) == $key2) {
                 // Nope, let's use the raw name
                 $name = ucfirst($view);
             } else {
                 $name = JText::_($key2);
             }
         } else {
             $name = JText::_($key);
         }
         $link = 'index.php?option=' . $this->component . '&view=' . $view;
         $active = $view == $activeView;
         $this->appendLink($name, $link, $active);
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:34,代码来源:toolbar.php

示例11: dispatch

 /**
  * The main code of the Dispatcher. It spawns the necessary controller and
  * runs it.
  *
  * @throws Exception
  *
  * @return  void|Exception
  */
 public function dispatch()
 {
     $platform = F0FPlatform::getInstance();
     if (!$platform->authorizeAdmin($this->input->getCmd('option', 'com_foobar'))) {
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     $this->transparentAuthentication();
     // Merge English and local translations
     $platform->loadTranslations($this->component);
     $canDispatch = true;
     if ($platform->isCli()) {
         $canDispatch = $canDispatch && $this->onBeforeDispatchCLI();
     }
     $canDispatch = $canDispatch && $this->onBeforeDispatch();
     if (!$canDispatch) {
         // We can set header only if we're not in CLI
         if (!$platform->isCli()) {
             $platform->setHeader('Status', '403 Forbidden', true);
         }
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     // Get and execute the controller
     $option = $this->input->getCmd('option', 'com_foobar');
     $view = $this->input->getCmd('view', $this->defaultView);
     $task = $this->input->getCmd('task', null);
     if (empty($task)) {
         $task = $this->getTask($view);
     }
     // Pluralise/sungularise the view name for typical tasks
     if (in_array($task, array('edit', 'add', 'read'))) {
         $view = F0FInflector::singularize($view);
     } elseif (in_array($task, array('browse'))) {
         $view = F0FInflector::pluralize($view);
     }
     $this->input->set('view', $view);
     $this->input->set('task', $task);
     $config = $this->config;
     $config['input'] = $this->input;
     $controller = F0FController::getTmpInstance($option, $view, $config);
     $status = $controller->execute($task);
     if (!$this->onAfterDispatch()) {
         // We can set header only if we're not in CLI
         if (!$platform->isCli()) {
             $platform->setHeader('Status', '403 Forbidden', true);
         }
         return $platform->raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
     }
     $format = $this->input->get('format', 'html', 'cmd');
     $format = empty($format) ? 'html' : $format;
     if ($controller->hasRedirect()) {
         $controller->redirect();
     }
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:61,代码来源:dispatcher.php

示例12: autoload_fof_helper

 /**
  * Autoload Helpers
  *
  * @param   string  $class_name  The name of the class to load
  *
  * @return  void
  */
 public function autoload_fof_helper($class_name)
 {
     F0FPlatform::getInstance()->logDebug(__METHOD__ . "() autoloading {$class_name}");
     static $isCli = null, $isAdmin = null;
     if (is_null($isCli) && is_null($isAdmin)) {
         list($isCli, $isAdmin) = F0FDispatcher::isCliAdmin();
     }
     if (strpos($class_name, 'Helper') === 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 three parts in the name
     if (count($parts) != 3) {
         return;
     }
     // We need the second part to be "model"
     if ($parts[1] != 'helper') {
         return;
     }
     // Get the information about this class
     $component_raw = $parts[0];
     $component = 'com_' . $parts[0];
     $view = $parts[2];
     // Is this an F0F 2.1 or later component?
     if (!$this->isF0FComponent($component)) {
         return;
     }
     // Get the alternate view and class name (opposite singular/plural name)
     $alt_view = F0FInflector::isSingular($view) ? F0FInflector::pluralize($view) : F0FInflector::singularize($view);
     $alt_class = F0FInflector::camelize($component_raw . '_helper_' . $alt_view);
     // Get the proper and alternate paths and file names
     $componentPaths = F0FPlatform::getInstance()->getComponentBaseDirs($component);
     $file = "/helpers/{$view}.php";
     $altFile = "/helpers/{$alt_view}.php";
     $path = $componentPaths['main'];
     $altPath = $componentPaths['alt'];
     // Try to find the proper class in the proper path
     if (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);
     }
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:67,代码来源:component.php

示例13: normaliseItemName

 /**
  * Normalises the format of a relation name
  *
  * @param   string   $itemName   The raw relation name
  * @param   boolean  $pluralise  Should I pluralise the name? If not, I will singularise it
  *
  * @return  string  The normalised relation key name
  */
 protected function normaliseItemName($itemName, $pluralise = false)
 {
     // Explode the item name
     $itemNameParts = explode('_', $itemName);
     // If we have multiple parts the first part is considered to be the component name
     if (count($itemNameParts) > 1) {
         $prefix = array_shift($itemNameParts);
     } else {
         $prefix = null;
     }
     // If we still have multiple parts we need to pluralise/singularise the last part and join everything in
     // CamelCase format
     if (count($itemNameParts) > 1) {
         $name = array_pop($itemNameParts);
         $name = $pluralise ? F0FInflector::pluralize($name) : F0FInflector::singularize($name);
         $itemNameParts[] = $name;
         $itemName = F0FInflector::implode($itemNameParts);
     } else {
         $name = array_pop($itemNameParts);
         $itemName = $pluralise ? F0FInflector::pluralize($name) : F0FInflector::singularize($name);
     }
     if (!empty($prefix)) {
         $itemName = $prefix . '_' . $itemName;
     }
     return $itemName;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:34,代码来源:relations.php

示例14: addSubmenuLink

 /**
  * addSubmenuLink
  *
  * @param   object  $view    Param
  * @param   object  $parent  Param
  *
  * @return  void
  */
 private function addSubmenuLink($view, $parent = null)
 {
     static $activeView = null;
     if (empty($activeView)) {
         $activeView = $this->input->getCmd('view', 'cpanel');
     }
     if ($activeView == 'cpanels') {
         $activeView = 'cpanel';
     }
     $icon_key = strtoupper($this->component) . '_ICON_' . strtoupper($view);
     $icon = JText::_($icon_key);
     $key = strtoupper($this->component) . '_TITLE_' . strtoupper($view);
     if (strtoupper(JText::_($key)) == $key) {
         $altview = F0FInflector::isPlural($view) ? F0FInflector::singularize($view) : F0FInflector::pluralize($view);
         $key2 = strtoupper($this->component) . '_TITLE_' . strtoupper($altview);
         if (strtoupper(JText::_($key2)) == $key2) {
             $name = ucfirst($view);
         } else {
             $name = JText::_($key2);
         }
     } else {
         $name = JText::_($key);
     }
     if ($view == 'usermanual') {
         $link = 'http://documentation.extly.com/';
     } elseif ($view == 'options') {
         $component = urlencode($this->component);
         $uri = (string) JUri::getInstance();
         $return = urlencode(base64_encode($uri));
         $link = 'index.php?option=com_config&amp;view=component&amp;component=' . $component . '&amp;path=&amp;return=' . $return;
     } else {
         $link = 'index.php?option=' . $this->component . '&view=' . $view;
     }
     $active = $view == $activeView;
     $this->appendLink($icon . ' ' . $name, $link, $active, null, $parent);
 }
开发者ID:johngrange,项目名称:wookeyholeweb,代码行数:44,代码来源:toolbar.php

示例15: __construct

 /**
  * Public constructor. Instantiates a F0FView object.
  *
  * @param   array  $config  The configuration data array
  */
 public function __construct($config = array())
 {
     // Make sure $config is an array
     if (is_object($config)) {
         $config = (array) $config;
     } elseif (!is_array($config)) {
         $config = array();
     }
     // Get the input
     if (array_key_exists('input', $config)) {
         if ($config['input'] instanceof F0FInput) {
             $this->input = $config['input'];
         } else {
             $this->input = new F0FInput($config['input']);
         }
     } else {
         $this->input = new F0FInput();
     }
     parent::__construct($config);
     $component = 'com_foobar';
     // Get the component name
     if (array_key_exists('input', $config)) {
         if ($config['input'] instanceof F0FInput) {
             $tmpInput = $config['input'];
         } else {
             $tmpInput = new F0FInput($config['input']);
         }
         $component = $tmpInput->getCmd('option', '');
     } else {
         $tmpInput = $this->input;
     }
     if (array_key_exists('option', $config)) {
         if ($config['option']) {
             $component = $config['option'];
         }
     }
     $config['option'] = $component;
     // Get the view name
     $view = null;
     if (array_key_exists('input', $config)) {
         $view = $tmpInput->getCmd('view', '');
     }
     if (array_key_exists('view', $config)) {
         if ($config['view']) {
             $view = $config['view'];
         }
     }
     $config['view'] = $view;
     // Set the component and the view to the input array
     if (array_key_exists('input', $config)) {
         $tmpInput->set('option', $config['option']);
         $tmpInput->set('view', $config['view']);
     }
     // Set the view name
     if (array_key_exists('name', $config)) {
         $this->_name = $config['name'];
     } else {
         $this->_name = $config['view'];
     }
     $tmpInput->set('view', $this->_name);
     $config['input'] = $tmpInput;
     $config['name'] = $this->_name;
     $config['view'] = $this->_name;
     // Get the component directories
     $componentPaths = F0FPlatform::getInstance()->getComponentBaseDirs($config['option']);
     // Set the charset (used by the variable escaping functions)
     if (array_key_exists('charset', $config)) {
         F0FPlatform::getInstance()->logDeprecated('Setting a custom charset for escaping in F0FView\'s constructor is deprecated. Override F0FView::escape() instead.');
         $this->_charset = $config['charset'];
     }
     // User-defined escaping callback
     if (array_key_exists('escape', $config)) {
         $this->setEscape($config['escape']);
     }
     // Set a base path for use by the view
     if (array_key_exists('base_path', $config)) {
         $this->_basePath = $config['base_path'];
     } else {
         $this->_basePath = $componentPaths['main'];
     }
     // Set the default template search path
     if (array_key_exists('template_path', $config)) {
         // User-defined dirs
         $this->_setPath('template', $config['template_path']);
     } else {
         $altView = F0FInflector::isSingular($this->getName()) ? F0FInflector::pluralize($this->getName()) : F0FInflector::singularize($this->getName());
         $this->_setPath('template', $this->_basePath . '/views/' . $altView . '/tmpl');
         $this->_addPath('template', $this->_basePath . '/views/' . $this->getName() . '/tmpl');
     }
     // Set the default helper search path
     if (array_key_exists('helper_path', $config)) {
         // User-defined dirs
         $this->_setPath('helper', $config['helper_path']);
     } else {
         $this->_setPath('helper', $this->_basePath . '/helpers');
//.........这里部分代码省略.........
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:101,代码来源:view.php


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