Пример #1
0
 /**
  *
  * @see XenForo_ControllerAdmin_Option::_getGroupAddEditResponse()
  */
 protected function _getGroupAddEditResponse(array $group)
 {
     $response = parent::_getGroupAddEditResponse($group);
     if ($response instanceof XenForo_ControllerResponse_View) {
         $addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
         if (!empty($GLOBALS['XenForo_Route_PrefixAdmin_Options']) && !$addOnId) {
             $addOnId = XenForo_Helper_Cookie::getCookie('edit_addon_id');
         }
         if ($addOnId && empty($group['addon_id'])) {
             $template['addon_id'] = $addOnId;
             $response->params['addOnSelected'] = $addOnId;
             if (empty($group['group_id'])) {
                 $groupId = str_replace(' ', '_', lcwords(str_replace('_', ' ', $addOnId)));
                 $info = $this->_getOptionModel()->getOptionGroupById($groupId);
                 if (!$info) {
                     $addOn = $this->_getAddOnModel()->getAddOnById($addOnId);
                     $group['new_group_id'] = $groupId;
                     $response->params['masterTitle'] = new XenForo_Phrase('th_default_option_group_title_for_x_options', array('title' => $addOn['title']));
                     $response->params['masterDescription'] = new XenForo_Phrase('th_default_option_group_description_for_x_options', array('title' => $addOn['title']));
                     $group['display_order'] = 2000;
                     $response->params['group'] = $group;
                 }
             }
         }
     }
     return $response;
 }
Пример #2
0
 /** 
  * Get string in lowercase.  
  * @param string full string 
  * @return string in lowercase 
  */
 public static function lowercase($string = false, $selector = false)
 {
     if ($string) {
         switch ($selector) {
             case 'first':
                 return lcfirst($string);
             case 'words':
                 return lcwords($string);
             default:
                 return strtolower($string);
         }
     }
     return false;
 }