Changeset 610
- Timestamp:
- 09/28/2007 07:39:20 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
- 1 copied
-
application/controllers/welcome.php (modified) (2 diffs)
-
system/libraries/Ftp.php (modified) (7 diffs)
-
system/libraries/User_agent.php (copied) (copied from trunk/ported_libs/User_agent.php) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/application/controllers/welcome.php
r605 r610 5 5 function index() 6 6 { 7 print_r(date::hours(1, TRUE)); die; 8 7 //print_r(date::hours(1, TRUE)); die 9 8 10 9 foreach(get_class_methods(__CLASS__) as $method) 11 10 { 12 11 if ( ! preg_match('/_example$/', $method)) continue; 13 14 echo html::anchor('welcome/'.$method, $method)."<br/>\n"; 12 echo html::anchor('welcome/'.$method, $method)."<br/>\n"; 15 13 } 16 14 } … … 105 103 echo "done in {execution_time} seconds"; 106 104 } 105 function user_agent_example() { 106 $this->load->library('user_agent'); 107 echo $this->user_agent; 108 } 107 109 108 110 } -
trunk/system/libraries/Ftp.php
r606 r610 34 34 class FTP_Core { 35 35 36 pr otected$hostname = '';37 pr otected$username = '';38 pr otected$password = '';39 pr otected$port = 21;40 pr otected$passive = TRUE;41 pr otected$debug = FALSE;42 pr otected$conn_id = FALSE;36 private $hostname = ''; 37 private $username = ''; 38 private $password = ''; 39 private $port = 21; 40 private $passive = TRUE; 41 private $debug = FALSE; 42 private $conn_id = FALSE; 43 43 44 44 /** … … 128 128 * FTP Login 129 129 * 130 * @access pr otected131 * @return bool 132 */ 133 pr otectedfunction login()130 * @access private 131 * @return bool 132 */ 133 private function login() 134 134 { 135 135 return @ftp_login($this->conn_id, $this->username, $this->password); … … 141 141 * Validates the connection ID 142 142 * 143 * @access pr otected144 * @return bool 145 */ 146 pr otectedfunction is_conn()143 * @access private 144 * @return bool 145 */ 146 private function is_conn() 147 147 { 148 148 if ( ! is_resource($this->conn_id)) … … 540 540 * Extract the file extension 541 541 * 542 * @access pr otected542 * @access private 543 543 * @param string 544 544 * @return string 545 545 */ 546 pr otectedfunction get_extension($filename)546 private function get_extension($filename) 547 547 { 548 548 if (strpos($filename, '.') === FALSE) … … 561 561 * Set the upload type 562 562 * 563 * @access pr otected563 * @access private 564 564 * @param string 565 565 * @return string 566 566 */ 567 pr otectedfunction set_type($ext)567 private function set_type($ext) 568 568 { 569 569 $text_types = array( … … 613 613 * Display error message 614 614 * 615 * @access pr otected616 * @param string 617 * @return bool 618 */ 619 pr otectedfunction error($msg)615 * @access private 616 * @param string 617 * @return bool 618 */ 619 private function error($msg) 620 620 { 621 621 throw new Kohana_Exception('ftp.'.$msg); … … 623 623 624 624 625 } 626 // END FTP Class 627 ?> 625 } // End FTP Class -
trunk/system/libraries/User_agent.php
r607 r610 31 31 * @subpackage Libraries 32 32 * @category User Agent 33 * @author Rick Ellis 33 * @author Rick Ellis, Kohana Team 34 34 * @link http://kohanaphp.com/user_guide/libraries/user_agent.html 35 35 */ 36 36 class User_Agent_Core { 37 37 38 var $agent = NULL; 39 40 var $is_browser = FALSE; 41 var $is_robot = FALSE; 42 var $is_mobile = FALSE; 43 44 var $languages = array(); 45 var $charsets = array(); 46 47 var $platforms = array(); 48 var $browsers = array(); 49 var $mobiles = array(); 50 var $robots = array(); 51 52 var $platform = ''; 53 var $browser = ''; 54 var $version = ''; 55 var $mobile = ''; 56 var $robot = ''; 38 private $agent = NULL; 39 40 private $is_browser = FALSE; 41 private $is_robot = FALSE; 42 private $is_mobile = FALSE; 43 44 private $languages = array(); 45 private $charsets = array(); 46 47 private $platforms = array(); 48 private $browsers = array(); 49 private $mobiles = array(); 50 private $robots = array(); 51 52 private $platform = ''; 53 private $browser = ''; 54 private $version = ''; 55 private $mobile = ''; 56 private $robot = ''; 57 57 58 58 59 /** … … 73 74 if ( ! is_null($this->agent)) 74 75 { 75 if ($this-> _load_agent_file())76 if ($this->load_agent_file()) 76 77 { 77 $this-> _compile_data();78 $this->compile_data(); 78 79 } 79 80 } … … 90 91 * @return bool 91 92 */ 92 private function _load_agent_file()93 private function load_agent_file() 93 94 { 94 95 $config = Config::item('user_agents'); … … 139 140 * @return bool 140 141 */ 141 private function _compile_data()142 { 143 $this-> _set_platform();144 145 foreach (array(' _set_browser', '_set_robot', '_set_mobile') as $function)142 private function compile_data() 143 { 144 $this->set_platform(); 145 146 foreach (array('set_browser', 'set_robot', 'set_mobile') as $function) 146 147 { 147 148 if ($this->$function() === TRUE) … … 160 161 * @return mixed 161 162 */ 162 private function _set_platform()163 private function set_platform() 163 164 { 164 165 if (is_array($this->platforms) AND count($this->platforms) > 0) … … 184 185 * @return bool 185 186 */ 186 private function _set_browser()187 private function set_browser() 187 188 { 188 189 if (is_array($this->browsers) AND count($this->browsers) > 0) … … 195 196 $this->version = $match[1]; 196 197 $this->browser = $val; 197 $this-> _set_mobile();198 $this->set_mobile(); 198 199 return TRUE; 199 200 } … … 211 212 * @return bool 212 213 */ 213 private function _set_robot()214 private function set_robot() 214 215 { 215 216 if (is_array($this->robots) AND count($this->robots) > 0) … … 236 237 * @return bool 237 238 */ 238 private function _set_mobile()239 private function set_mobile() 239 240 { 240 241 if (is_array($this->mobiles) AND count($this->mobiles) > 0) … … 261 262 * @return void 262 263 */ 263 private function _set_languages()264 private function set_languages() 264 265 { 265 266 if ((count($this->languages) == 0) AND isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) AND $_SERVER['HTTP_ACCEPT_LANGUAGE'] != '') … … 284 285 * @return void 285 286 */ 286 private function _set_charsets()287 private function set_charsets() 287 288 { 288 289 if ((count($this->charsets) == 0) AND isset($_SERVER['HTTP_ACCEPT_CHARSET']) AND $_SERVER['HTTP_ACCEPT_CHARSET'] != '') … … 453 454 if (count($this->languages) == 0) 454 455 { 455 $this-> _set_languages();456 $this->set_languages(); 456 457 } 457 458 … … 471 472 if (count($this->charsets) == 0) 472 473 { 473 $this-> _set_charsets();474 $this->set_charsets(); 474 475 } 475 476 … … 502 503 return (in_array(strtolower($charset), $this->charsets(), TRUE)) ? TRUE : FALSE; 503 504 } 504 505 506 } 507 508 ?> 505 506 // -------------------------------------------------------------------- 507 508 /** 509 * Returns the full user agent string when the object is turned into a string. 510 * 511 * @access public 512 * @return string 513 */ 514 public function __toString() { 515 return $this->agent; 516 } 517 518 } //End User_agent class
