public function display($tpl = null) { $user = JFactory::getUser(); JToolbarHelper::title(JString::ucwords(implode(' ', JStringNormalise::fromCamelCase($this->view, true)))); if ($user->authorise('core.admin', 'com_fileuploadform')) { JToolbarHelper::preferences('com_fileuploadform'); } parent::display($tpl); }
/** * Split a string in camel case format * * "FooBarABCDef" becomes array("Foo", "Bar", "ABC", "Def"); * "JFooBar" becomes array("J", "Foo", "Bar"); * "J001FooBar002" becomes array("J001", "Foo", "Bar002"); * "abcDef" becomes array("abc", "Def"); * "abc_defGhi_Jkl" becomes array("abc_def", "Ghi_Jkl"); * "ThisIsA_NASAAstronaut" becomes array("This", "Is", "A_NASA", "Astronaut")), * "JohnFitzgerald_Kennedy" becomes array("John", "Fitzgerald_Kennedy")), * * @param string $string The source string. * * @return array The splitted string. * * @deprecated 12.3 * @since 11.3 */ public static function splitCamelCase($string) { JLog::add('JString::splitCamelCase has been deprecated. Use JStringNormalise::fromCamelCase.', JLog::WARNING, 'deprecated'); return JStringNormalise::fromCamelCase($string, true); }
/** * Method to instantiate the form field object. * * @param JForm $form The form to attach to the form field object. * * @since 11.1 */ public function __construct($form = null) { // If there is a form passed into the constructor set the form and form control properties. if ($form instanceof JForm) { $this->form = $form; $this->formControl = $form->getFormControl(); } // Detect the field type if not set if (!isset($this->type)) { $parts = JStringNormalise::fromCamelCase(get_called_class(), true); if ($parts[0] == 'J') { $this->type = JString::ucfirst($parts[count($parts) - 1], '_'); } else { $this->type = JString::ucfirst($parts[0], '_') . JString::ucfirst($parts[count($parts) - 1], '_'); } } }
/** * Method to get the view name * * The model name by default parsed using the classname, or it can be set * by passing a $config['name'] in the class constructor * * @return string The name of the model * * @since 3.2 * @throws Exception */ public function getName() { if (empty($this->_name)) { $classname = get_class($this); $viewpos = strpos($classname, 'View'); if ($viewpos === false) { throw new Exception(JText::_('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500); } $lastPart = substr($classname, $viewpos + 4); $pathParts = explode(' ', JStringNormalise::fromCamelCase($lastPart)); if (!empty($pathParts[1])) { $this->_name = strtolower($pathParts[0]); } else { $this->_name = strtolower($lastPart); } } return $this->_name; }
/** * Helper wrapper method for fromCamelCase * * @param string $input The string input (ASCII only). * @param boolean $grouped Optionally allows splitting on groups of uppercase characters. * * @return mixed The space separated string or an array of substrings if grouped is true. * * @see JUserHelper::fromCamelCase() * @since 3.4 */ public function fromCamelCase($input, $grouped = false) { return JStringNormalise::fromCamelCase($input, $grouped); }