library/core/class.form.php
public static function LabelCode($Item) {
      if (is_array($Item)) {
         if (isset($Item['LabelCode']))
            return $Item['LabelCode'];

         $LabelCode = $Item['Name'];
      } else {
         $LabelCode = $Item;
      }
      
      
      if (strpos($LabelCode, '.') !== FALSE)
         $LabelCode = trim(strrchr($LabelCode, '.'), '.');

      // Split camel case labels into seperate words.
      $LabelCode = preg_replace('`(?<![A-Z0-9])([A-Z0-9])`', ' $1', $LabelCode);
      $LabelCode = preg_replace('`([A-Z0-9])(?=[a-z])`', ' $1', $LabelCode);
      $LabelCode = trim($LabelCode);

      return $LabelCode;
   }
public static function LabelCode($Item) {
      if (is_array($Item)) {
         if (isset($Item['LabelCode']))
            return $Item['LabelCode'];

         $LabelCode = $Item['Name'];
      } else {
         $LabelCode = $Item;
      }
      
      
      if (strpos($LabelCode, '.') !== FALSE)
         $LabelCode = trim(strrchr($LabelCode, '.'), '.');

      // Split camel case labels into seperate words.
      $LabelCode = preg_replace('`(?<![A-Z0-9])([A-Z0-9])`', ' $1', $LabelCode);
      $LabelCode = preg_replace('`([A-Z0-9])(?=[a-z])`', ' $1', $LabelCode);
      $LabelCode = trim($LabelCode);

      return $LabelCode;
   }
public static function LabelCode ( $ Item ) { if ( is_array ( $ Item ) ) { if ( isset ( $ Item [ 'LabelCode' ] ) ) return $ Item [ 'LabelCode' ] ; $ LabelCode = $ Item [ 'Name' ] ; } else { $ LabelCode = $ Item ; } if ( strpos ( $ LabelCode , '.' ) !== FALSE ) $ LabelCode = trim ( strrchr ( $ LabelCode , '.' ) , '.' ) ; // Split camel case labels into seperate words. $ LabelCode = preg_replace ( '`(?<![A-Z0-9])([A-Z0-9])`' , ' $1' , $ LabelCode ) ; $ LabelCode = preg_replace ( '`([A-Z0-9])(?=[a-z])`' , ' $1' , $ LabelCode ) ; $ LabelCode = trim ( $ LabelCode ) ; return $ LabelCode ; }
Generate a friendly looking label translation code from a camel case variable name
@param string|array $Item The item to generate the label from.
- string: Generate the label directly from the item.
- array: Generate the label from the item as if it is a schema row passed to Gdn_Form::Simple().
@return string
Generate a friendly looking label translation code from a camel case variable name