Exemple #1
0
 /**
  * Create the admin theme instance
  *
  * @param string $page The admin page requested
  * @param string $type The content type included in the request
  */
 public function setup_admin_theme($page, $type = '')
 {
     if (!isset($this->theme)) {
         $theme_dir = Plugins::filter('admin_theme_dir', Site::get_dir('admin_theme', true));
         $this->theme = Themes::create('_admin', 'RawPHPEngine', $theme_dir);
         // Add some default template variables
         $this->set_admin_template_vars($this->theme);
         $this->theme->admin_type = $type;
         $this->theme->admin_page = $page;
         $this->theme->admin_page_url = $page == 'dashboard' ? URL::get('admin', 'page=') : URL::get('admin', 'page=' . $page);
         $this->theme->page = $page;
         $this->theme->admin_title = MultiByte::ucwords($page) . ($type != '' ? ' ' . MultiByte::ucwords($type) : '');
         $this->theme->admin_title = isset($this->theme->mainmenu[$this->theme->admin_page]['text']) ? $this->theme->mainmenu[$this->theme->admin_page]['text'] : MultiByte::ucwords($page) . ($type != '' ? ' ' . MultiByte::ucwords($type) : '');
     }
 }
Exemple #2
0
 public function test_ucwords()
 {
     $this->assert_equal(MultiByte::ucwords($this->test_strings['lowercase_sentence']), $this->test_strings['ucwords_sentence']);
 }
Exemple #3
0
	public function testUcwords ( ) {
		
		$this->assertEquals( MultiByte::ucwords( $this->test_strings['lowercase_sentence'] ), $this->test_strings['ucwords_sentence'] );
		
		// perform a single test with an ascii string for code coverage
		$this->assertEquals( MultiByte::ucwords( 'cows go moo', 'ascii' ), 'Cows Go Moo' );
		
	}
 private function generate_title($min = 2, $max = 8)
 {
     // get a fake paragraph of text that's 1 line long
     $text = $this->generate_paragraph(1, 1);
     $text = MultiByte::strtolower($text);
     // remove commas and periods
     $text = MultiByte::str_replace(array('.', ','), '', $text);
     $words = explode(' ', $text);
     // randomize the words list
     shuffle($words);
     // we can only get the max number of words the paragraph generated
     if ($min > count($words)) {
         $min = count($words);
     }
     if ($max > count($words)) {
         $max = count($words);
     }
     // decide how many words we want
     $how_many_words = mt_rand($min, $max);
     $title = array();
     for ($i = 0; $i < $how_many_words; $i++) {
         // snag a random word
         $title[] = array_pop($words);
     }
     $title = implode(' ', $title);
     // capitalize the first letter of each word
     $title = MultiByte::ucwords($title);
     return $title;
 }
Exemple #5
0
	/**
	 * Create the admin theme instance
	 *
	 * @param string $page The admin page requested
	 * @param string $type The content type included in the request
	 */
	public function setup_admin_theme( $page, $type = '' )
	{
		if ( !isset( $this->theme ) ) {
			$theme_dir = Plugins::filter( 'admin_theme_dir', Site::get_dir( 'admin_theme', true ) );
			$this->theme = Themes::create( 'admin', 'RawPHPEngine', $theme_dir );

			// Add some default stylesheets
			Stack::add( 'admin_stylesheet', array( Site::get_url( 'admin_theme' ) . '/css/admin.css', 'screen' ), 'admin' );
			Stack::add( 'admin_stylesheet', array( Site::get_url( 'admin_theme' ) . '/css/jqueryui.css', 'screen' ), 'jqueryui' );

			// Add some default template variables
			$this->set_admin_template_vars( $this->theme );
			$this->theme->admin_type = $type;
			$this->theme->admin_page = $page;
			$this->theme->admin_page_url = ( $page == 'dashboard' ) ? URL::get( 'admin', 'page=' ) : URL::get( 'admin', 'page=' . $page );
			$this->theme->page = $page;
			$this->theme->admin_title = MultiByte::ucwords( $page ) . ( $type != '' ? ' ' . MultiByte::ucwords( $type ) : '' );
			$this->theme->admin_title =
				isset( $this->theme->mainmenu[$this->theme->admin_page]['text'] )
					? $this->theme->mainmenu[$this->theme->admin_page]['text']
					: MultiByte::ucwords( $page ) . ( $type != '' ? ' ' . MultiByte::ucwords( $type ) : '' );
		}
	}