function _show_header()
 {
     $pheader = t("Shop");
     $subheader = _ucwords(str_replace("_", " ", $_GET["action"]));
     $cases = ["show" => "Products", "add" => "Add product"];
     if (isset($cases[$_GET["action"]])) {
         $subheader = $cases[$_GET["action"]];
     }
     return ["header" => $pheader, "subheader" => $subheader ? _prepare_html($subheader) : ""];
 }
Beispiel #2
0
 public function test_cases()
 {
     $sentence = 'пользователь должен быть у Вас в друзьях а Вы у него';
     $this->assertEquals('ПОЛЬЗОВАТЕЛЬ ДОЛЖЕН БЫТЬ У ВАС В ДРУЗЬЯХ А ВЫ У НЕГО', trim(_strtoupper($sentence)));
     $this->assertEquals('пользователь должен быть у вас в друзьях а вы у него', trim(_strtolower($sentence)));
     $this->assertNotEquals(strtoupper($sentence), _strtoupper($sentence));
     $this->assertNotEquals(strtolower($sentence), _strtolower($sentence));
     $this->assertNotEquals(ucfirst($sentence), _ucfirst($sentence));
     $this->assertNotEquals(ucwords($sentence), _ucwords($sentence));
 }
Beispiel #3
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  * @see http://php.net/ucwords
  *
  * @author  Harry Fuecks <*****@*****.**>
  *
  * @param   string   mixed case string
  * @return  string
  */
 public static function ucwords($str)
 {
     if (!isset(self::$called[__FUNCTION__])) {
         require SYSPATH . 'core/utf8/' . __FUNCTION__ . EXT;
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _ucwords($str);
 }
Beispiel #4
0
 /**
  */
 function _show_header()
 {
     $pheader = t('Static pages');
     $subheader = _ucwords(str_replace('_', ' ', $_GET['action']));
     $cases = ['show' => '', 'edit' => ''];
     if (isset($cases[$_GET['action']])) {
         $subheader = $cases[$_GET['action']];
     }
     return ['header' => $pheader, 'subheader' => $subheader ? _prepare_html($subheader) : ''];
 }
Beispiel #5
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  * This is a UTF8-aware version of [ucwords](http://php.net/ucwords).
  *
  *     $str = UTF8::ucwords($str);
  *
  * @author  Harry Fuecks <*****@*****.**>
  * @param   string   mixed case string
  * @return  string
  * @uses    UTF8::$server_utf8
  */
 public static function ucwords($str)
 {
     if (!isset(self::$called[__FUNCTION__])) {
         require SYSPATH . 'utf8' . DIRECTORY_SEPARATOR . __FUNCTION__ . EXT;
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _ucwords($str);
 }
 public static function ucwords($str)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require JsonApiApplication::find_file("utf8", __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _ucwords($str);
 }
Beispiel #7
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  * @see http://php.net/ucwords
  *
  * @author  Harry Fuecks <*****@*****.**>
  *
  * @param   string   mixed case string
  * @return  string
  */
 public static function ucwords($str)
 {
     require_once dirname(__FILE__) . '/' . __FUNCTION__ . '.php';
     return _ucwords($str);
 }
Beispiel #8
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  * This is a UTF8-aware version of [ucwords](http://php.net/ucwords).
  *
  *     $str = UTF8::ucwords($str);
  *
  * @author  Harry Fuecks <*****@*****.**>
  * @param   string  $str mixed case string
  * @return  string
  */
 public static function ucwords($str)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require Kohana::find_file('utf8', __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = TRUE;
     }
     return _ucwords($str);
 }
Beispiel #9
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase
  *
  * This is a UTF8-aware version of [ucwords](http://php.net/ucwords).
  *
  * Example:
  * ~~~
  * $str = UTF8::ucwords($str);
  * ~~~
  *
  * @author  Harry Fuecks <*****@*****.**>
  *
  * @param   string  $str  Mixed case string
  *
  * @return  string
  *
  * @uses    UTF8::$server_utf8
  * @uses    Kohana::find_file
  */
 public static function ucwords($str)
 {
     UTF8::_load(__FUNCTION__);
     return _ucwords($str);
 }
Beispiel #10
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  *
  * @see     http://php.net/ucwords
  * @author  Harry Fuecks <*****@*****.**>
  *
  * @param   string   mixed case string
  * @return  string
  */
 public static function ucwords($str)
 {
     if (UTF8::$server_utf8) {
         return mb_convert_case($str, MB_CASE_TITLE, Kohana::$charset);
     }
     if (!isset(self::$called[__FUNCTION__])) {
         require SYSPATH . 'utf8/' . __FUNCTION__ . EXT;
         // Function has been called
         self::$called[__FUNCTION__] = TRUE;
     }
     return _ucwords($str);
 }
Beispiel #11
0
 /**
  * Makes the first character of every word in a UTF-8 string uppercase.
  * This is a UTF8-aware version of [ucwords](http://php.net/ucwords).
  *
  *     $str = UTF8::ucwords($str);
  *
  * @author  Harry Fuecks <*****@*****.**>
  * @param   string  $str mixed case string
  * @return  string
  */
 public static function ucwords($str)
 {
     if (!isset(UTF8::$called[__FUNCTION__])) {
         require Phalcana::$di->get('fs')->findFile('utf8', __FUNCTION__);
         // Function has been called
         UTF8::$called[__FUNCTION__] = true;
     }
     return _ucwords($str);
 }
Beispiel #12
0
 /**
  * Display header content (hook)
  */
 function _show_header()
 {
     if (conf('no_page_header')) {
         return false;
     }
     $page_header = '';
     $page_subheader = '';
     // Display hook contents
     // TODO: need to check permissions at first
     #		$obj = module($_GET['object']);
     if (method_exists($obj, '_show_header')) {
         $result = $obj->_show_header();
         if (is_array($result)) {
             $page_header = $result['header'];
             $page_subheader = $result['subheader'];
         } else {
             return strval($result);
         }
     }
     // Show default header
     if (!isset($page_header)) {
         $page_header = _ucwords(str_replace('_', ' ', $_GET['object']));
     }
     if (!isset($page_subheader)) {
         if ($_GET['action'] != 'show') {
             $page_subheader = _ucwords(str_replace('_', ' ', $_GET['action']));
         }
     }
     $replace = ['header' => $page_header ? t($page_header) : '', 'subheader' => $page_subheader ? t($page_subheader) : ''];
     return tpl()->parse('system/page_header', $replace);
 }