Changeset 2593
- Timestamp:
- 04/28/08 16:04:22 (3 months ago)
- Files:
-
- trunk/application/controllers/examples.php (modified) (5 diffs)
- trunk/application/controllers/welcome.php (modified) (1 diff)
- trunk/modules/auth/controllers/auth_demo.php (modified) (1 diff)
- trunk/modules/auth/libraries/Auth.php (modified) (2 diffs)
- trunk/modules/auth/models/user.php (modified) (1 diff)
- trunk/modules/forge/libraries/Forge.php (modified) (5 diffs)
- trunk/modules/forge/libraries/Form_Checklist.php (modified) (3 diffs)
- trunk/modules/forge/libraries/Form_Dateselect.php (modified) (1 diff)
- trunk/modules/forge/libraries/Form_Input.php (modified) (8 diffs)
- trunk/modules/forge/libraries/Form_Phonenumber.php (modified) (1 diff)
- trunk/modules/forge/models/user_edit.php (modified) (5 diffs)
- trunk/modules/forge/views/forge_template.php (modified) (2 diffs)
- trunk/modules/kodoc/controllers/kodoc.php (modified) (1 diff)
- trunk/modules/kodoc/libraries/Kodoc.php (modified) (10 diffs)
- trunk/modules/kodoc/views/kodoc/class.php (modified) (1 diff)
- trunk/modules/kodoc/views/kodoc/documentation.php (modified) (2 diffs)
- trunk/modules/kodoc/views/kodoc/file_config.php (modified) (1 diff)
- trunk/modules/kodoc/views/kodoc/menu.php (modified) (3 diffs)
- trunk/modules/kodoc/views/kodoc/method.php (modified) (2 diffs)
- trunk/modules/user_guide/controllers/user_guide.php (modified) (1 diff)
- trunk/modules/user_guide/views/user_guide/template.php (modified) (2 diffs)
- trunk/system/config/session.php (modified) (1 diff)
- trunk/system/core/Benchmark.php (modified) (1 diff)
- trunk/system/core/Config.php (modified) (3 diffs)
- trunk/system/core/Event.php (modified) (2 diffs)
- trunk/system/core/Kohana.php (modified) (15 diffs)
- trunk/system/core/Log.php (modified) (1 diff)
- trunk/system/core/utf8.php (modified) (1 diff)
- trunk/system/core/utf8/from_unicode.php (modified) (1 diff)
- trunk/system/core/utf8/to_unicode.php (modified) (1 diff)
- trunk/system/helpers/arr.php (modified) (3 diffs)
- trunk/system/helpers/date.php (modified) (1 diff)
- trunk/system/helpers/form.php (modified) (2 diffs)
- trunk/system/helpers/html.php (modified) (4 diffs)
- trunk/system/helpers/url.php (modified) (1 diff)
- trunk/system/libraries/Cache.php (modified) (1 diff)
- trunk/system/libraries/Calendar.php (modified) (1 diff)
- trunk/system/libraries/Database.php (modified) (2 diffs)
- trunk/system/libraries/Image.php (modified) (1 diff)
- trunk/system/libraries/ORM.php (modified) (12 diffs)
- trunk/system/libraries/Router.php (modified) (2 diffs)
- trunk/system/libraries/Session.php (modified) (5 diffs)
- trunk/system/libraries/View.php (modified) (1 diff)
- trunk/system/libraries/drivers/Cache/File.php (modified) (4 diffs)
- trunk/system/libraries/drivers/Cache/Xcache.php (modified) (1 diff)
- trunk/system/libraries/drivers/Database.php (modified) (3 diffs)
- trunk/system/libraries/drivers/Database/Mssql.php (modified) (2 diffs)
- trunk/system/libraries/drivers/Database/Mysql.php (modified) (6 diffs)
- trunk/system/libraries/drivers/Database/Pdosqlite.php (modified) (4 diffs)
- trunk/system/libraries/drivers/Database/Pgsql.php (modified) (2 diffs)
- trunk/system/libraries/drivers/Image.php (modified) (3 diffs)
- trunk/system/libraries/drivers/Image/ImageMagick.php (modified) (1 diff)
- trunk/system/libraries/drivers/Payment/Authorize.php (modified) (4 diffs)
- trunk/system/libraries/drivers/Payment/Paypal.php (modified) (7 diffs)
- trunk/system/libraries/drivers/Payment/Paypalpro.php (modified) (2 diffs)
- trunk/system/libraries/drivers/Payment/Trident.php (modified) (2 diffs)
- trunk/system/libraries/drivers/Payment/Trustcommerce.php (modified) (1 diff)
- trunk/system/libraries/drivers/Payment/Yourpay.php (modified) (1 diff)
- trunk/system/views/kohana_profiler.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/application/controllers/examples.php
r2581 r2593 35 35 echo "<ul>\n"; 36 36 37 foreach ($examples as $method)37 foreach ($examples as $method) 38 38 { 39 39 if ($method == __FUNCTION__) … … 202 202 echo $db->last_query(); 203 203 echo '<h3>Iterate through the result:</h3>'; 204 foreach ($query as $item)204 foreach ($query as $item) 205 205 { 206 206 echo '<p>'.$item->title.'</p>'; … … 214 214 echo '<p>'.$db->last_query().'</p>'; 215 215 $query->result(TRUE); 216 foreach ($query as $item)216 foreach ($query as $item) 217 217 { 218 218 echo '<pre>'.print_r($item, true).'</pre>'; … … 224 224 echo '<p>'.$db->last_query().'</p>'; 225 225 $query->result(FALSE, MYSQL_BOTH); 226 foreach ($query as $item)226 foreach ($query as $item) 227 227 { 228 228 echo '<pre>'.print_r($item, true).'</pre>'; … … 297 297 function user_agent() 298 298 { 299 foreach (array('agent', 'browser', 'version') as $key)299 foreach (array('agent', 'browser', 'version') as $key) 300 300 { 301 301 echo $key.': '.Kohana::user_agent($key).'<br/>'."\n"; trunk/application/controllers/welcome.php
r2440 r2593 13 13 // Disable this controller when Kohana is set to production mode. 14 14 // See http://doc.kohanaphp.com/installation/deployment for more details. 15 const ALLOW_PRODUCTION = FALSE;15 // const ALLOW_PRODUCTION = FALSE; 16 16 17 public function index()17 public function __construct() 18 18 { 19 // In Kohana, all views are loaded and treated as objects. 20 $welcome = new View('welcome'); 19 parent::__construct(); 20 new Profiler; 21 /* 22 $pdo = pdomo::registry('default', new PDO(Config::item('pdodb'))); 23 echo Kohana::debug($pdo); 21 24 22 // You can assign anything variable to a view by using standard OOP23 // methods. In my welcome view, the $title variable will be assigned24 // the value I give it here.25 $ welcome->title = 'Welcome to Kohana!';25 $query = $pdo->prepare('SELECT * FROM :table'); 26 $query->bindValue(':table', 'users'); 27 $query->setFetchMode(PDO::FETCH_NUM); 28 $x = $query->fetch(PDO::FETCH_OBJ); 26 29 27 // An array of links to display. Assiging variables to views is completely 28 // asyncronous. Variables can be set in any order, and can be any type 29 // of data, including objects. 30 $welcome->links = array 31 ( 32 'Home Page' => 'http://kohanaphp.com/', 33 'Documentation' => 'http://doc.kohanaphp.com/', 34 'Forum' => 'http://forum.kohanaphp.com/', 35 'License' => 'Kohana License.html', 36 'Donate' => 'http://kohanaphp.com/donate.html', 37 ); 30 echo Kohana::debug($x); 38 31 39 // Using views inside of views is completely transparent. In the welcome 40 // view, printing the $content variable will render the welcome_content view. 41 $welcome->content = new View('welcome_content'); 42 43 // Using render(TRUE) forces the view to display now, instead of 44 // returning an HTML string. 45 $welcome->render(TRUE); 32 foreach ($query as $row) 33 { 34 echo $row[0], ', ', $row[1], '<br />'; 35 } 36 */ 46 37 } 47 38 48 39 public function _default() 49 40 { 50 // By defining a method called _default, all pages routed to this controller 51 // that result in 404 errors will be handled by this method, instead of 52 // being displayed as "Page Not Found" errors. 53 echo 'This is a _default handler. If you expected the index page, you need to use: welcome/index/'.substr(Router::$current_uri, 8); 41 echo html::email('geertdd@gmail.com'); 42 echo html::mailto('geert@link.com'); 54 43 } 55 44 45 public function pdo() 46 { 47 $dbh = new PDO('mysql:host=localhost;dbname=kohana', 'root', 'html123'); 48 /* 49 echo Kohana::debug($dbh); 50 51 $query = $dbh->query('SELECT * FROM users LIMIT 3'); 52 $query = $dbh->query('SELECT COUNT(*) FROM users ORDER BY id DESC LIMIT 3'); 53 echo Kohana::debug($query); 54 echo Kohana::debug($query->queryString); 55 // $query = $query->fetchAll(PDO::FETCH_OBJ); 56 echo Kohana::debug($query); 57 foreach ($query as $row) 58 { 59 echo Kohana::debug($row); 60 } 61 62 $query = $dbh->exec('DELETE FROM users WHERE id = 2'); 63 echo Kohana::debug($query); 64 65 $query = $dbh->prepare('INSERT INTO users (email, username) VALUES (?, ?)'); 66 $query->bindParam(1, $email); 67 $query->bindParam(2, $username); 68 $email = 'joske3@host.com'; 69 $username = 'josse3'; 70 $execute = $query->execute(array($email, $username)); 71 echo Kohana::debug($execute); 72 73 $id = $dbh->lastInsertId(); 74 echo Kohana::debug($id); 75 */ 76 $query = $dbh->prepare('SELECT ? FROM users WHERE id = ?'); 77 echo Kohana::debug($query); 78 $query->bindValue(1, 'username'); 79 $query->bindValue(2, 3); 80 81 $query->execute(); 82 $result = $query->fetchAll(PDO::FETCH_OBJ); 83 echo Kohana::debug($result); 84 foreach ($result as $row) 85 { 86 echo $row->username; 87 } 88 echo Kohana::debug($query->rowCount()); 89 } 56 90 } trunk/modules/auth/controllers/auth_demo.php
r2578 r2593 46 46 if ( ! $user->username_exists($this->input->post('username'))) 47 47 { 48 foreach ($form->as_array() as $key => $val)48 foreach ($form->as_array() as $key => $val) 49 49 { 50 50 // Set user data trunk/modules/auth/libraries/Auth.php
r2471 r2593 175 175 $last_offset = 0; 176 176 177 foreach ($this->config['salt_pattern'] as $offset)177 foreach ($this->config['salt_pattern'] as $offset) 178 178 { 179 179 // Split a new part of the hash off … … 215 215 $salt = ''; 216 216 217 foreach ($this->config['salt_pattern'] as $i => $offset)217 foreach ($this->config['salt_pattern'] as $i => $offset) 218 218 { 219 219 // Find salt characters... take a good long look.. trunk/modules/auth/models/user.php
r2452 r2593 53 53 if ($this->id > 0) 54 54 { 55 foreach ($this->find_related_roles() as $r)55 foreach ($this->find_related_roles() as $r) 56 56 { 57 57 // Load all the user roles trunk/modules/forge/libraries/Forge.php
r2460 r2593 88 88 89 89 // Create the input 90 switch (count($args))90 switch (count($args)) 91 91 { 92 92 case 1: … … 155 155 { 156 156 $status = TRUE; 157 foreach ($this->inputs as $input)157 foreach ($this->inputs as $input) 158 158 { 159 159 if ($input->validate() == FALSE) … … 174 174 { 175 175 $data = array(); 176 foreach (array_merge($this->hidden, $this->inputs) as $input)176 foreach (array_merge($this->hidden, $this->inputs) as $input) 177 177 { 178 178 if (is_object($input->name)) // It's a Forge_Group object (hopefully) … … 251 251 if (is_array($errors) AND ! empty($errors)) 252 252 { 253 foreach ($errors as $error)253 foreach ($errors as $error) 254 254 { 255 255 // Replace the message with the error in the html error string … … 271 271 if ( ! empty($this->hidden)) 272 272 { 273 foreach ($this->hidden as $input)273 foreach ($this->hidden as $input) 274 274 { 275 275 $hidden[$input->name] = $input->value; trunk/modules/forge/libraries/Form_Checklist.php
r2022 r2593 33 33 // Return the currently checked values 34 34 $array = array(); 35 foreach ($this->data['options'] as $id => $opt)35 foreach ($this->data['options'] as $id => $opt) 36 36 { 37 37 // Return the options that are checked … … 56 56 57 57 $checklist = '<ul class="'.arr::remove('class', $base_data).'">'.$nl; 58 foreach (arr::remove('options', $base_data) as $val => $opt)58 foreach (arr::remove('options', $base_data) as $val => $opt) 59 59 { 60 60 // New set of input data … … 77 77 protected function load_value() 78 78 { 79 foreach ($this->data['options'] as $val => $checked)79 foreach ($this->data['options'] as $val => $checked) 80 80 { 81 81 if ($input = $this->input_value($this->data['name'])) trunk/modules/forge/libraries/Form_Dateselect.php
r1923 r2593 66 66 67 67 $input = ''; 68 foreach ($this->parts as $type => $val)68 foreach ($this->parts as $type => $val) 69 69 { 70 70 if (is_int($type)) trunk/modules/forge/libraries/Form_Input.php
r2362 r2593 221 221 } 222 222 223 foreach ($rules as $rule)223 foreach ($rules as $rule) 224 224 { 225 225 if ($action === '-') … … 306 306 307 307 $messages = array(); 308 foreach ($this->errors as $func => $args)308 foreach ($this->errors as $func => $args) 309 309 { 310 310 if (is_string($args)) … … 328 328 { 329 329 // Get the proper i18n entry, very hacky but it works 330 switch ($func)330 switch ($func) 331 331 { 332 332 case 'valid_url': … … 428 428 if ( ! empty($this->rules)) 429 429 { 430 foreach ($this->rules as $rule)430 foreach ($this->rules as $rule) 431 431 { 432 432 if (($offset = strpos($rule, '[')) !== FALSE) … … 456 456 { 457 457 // Manually call up to 2 args for speed 458 switch (count($args))458 switch (count($args)) 459 459 { 460 460 case 1: … … 491 491 if ( ! empty($this->matches)) 492 492 { 493 foreach ($this->matches as $input)493 foreach ($this->matches as $input) 494 494 { 495 495 if ($this->value != $input->value) … … 504 504 if ( ! empty($this->callbacks)) 505 505 { 506 foreach ($this->callbacks as $callback)506 foreach ($this->callbacks as $callback) 507 507 { 508 508 call_user_func($callback, $this); … … 551 551 $this->errors['min_length'] = array($min); 552 552 } 553 elseif ($length > $max)553 elseif ($length > $max) 554 554 { 555 555 $this->errors['max_length'] = array($max); trunk/modules/forge/libraries/Form_Phonenumber.php
r2222 r2593 52 52 53 53 $input = ''; 54 foreach ($this->parts as $type => $val)54 foreach ($this->parts as $type => $val) 55 55 { 56 56 isset($data['value']) OR $data['value'] = ''; trunk/modules/forge/models/user_edit.php
r2580 r2593 36 36 // 37 37 // $options = array(); 38 // foreach ($roles as $role)38 // foreach ($roles as $role) 39 39 // { 40 40 // // Add each role to the options … … 79 79 isset($data['roles']) and $roles = arr::remove('roles', $data); 80 80 81 foreach ($data as $field => $val)81 foreach ($data as $field => $val) 82 82 { 83 83 // Set object data from the form … … 89 89 // if ($new_user) 90 90 // { 91 // foreach ($roles as $role)91 // foreach ($roles as $role) 92 92 // { 93 93 // // Add the user roles … … 97 97 // else 98 98 // { 99 // foreach (array_diff($this->roles, $roles) as $role)99 // foreach (array_diff($this->roles, $roles) as $role) 100 100 // { 101 101 // // Remove roles that were deactivated … … 103 103 // } 104 104 // 105 // foreach (array_diff($roles, $this->roles) as $role)105 // foreach (array_diff($roles, $this->roles) as $role) 106 106 // { 107 107 // // Add new roles trunk/modules/forge/views/forge_template.php
r2027 r2593 5 5 <?php endif ?> 6 6 <?php 7 foreach ($inputs as $input):7 foreach ($inputs as $input): 8 8 9 9 $sub_inputs = array(); … … 31 31 endif; 32 32 33 foreach ($sub_inputs as $input):33 foreach ($sub_inputs as $input): 34 34 35 35 ?> trunk/modules/kodoc/controllers/kodoc.php
r2229 r2593 77 77 else 78 78 { 79 foreach (array_reverse(Config::include_paths()) as $path)79 foreach (array_reverse(Config::include_paths()) as $path) 80 80 { 81 81 if (is_file($path.$type.'/'.$file.EXT)) trunk/modules/kodoc/libraries/Kodoc.php
r1364 r2593 35 35 36 36 $files = array(); 37 foreach (self::$types as $type)37 foreach (self::$types as $type) 38 38 { 39 39 $files[$type] = array(); 40 foreach (Kohana::list_files($type, TRUE) as $file)40 foreach (Kohana::list_files($type, TRUE) as $file) 41 41 { 42 42 // Not a source file … … 169 169 $data = file($filename); 170 170 171 foreach ($data as $line)171 foreach ($data as $line) 172 172 { 173 173 if (strpos($line, 'class') !== FALSE AND preg_match('/(?:class|interface)\s+([a-z0-9_]+).+{$/i', $line, $matches)) … … 186 186 $source = NULL; 187 187 188 foreach ($data as $line)189 { 190 switch (substr(trim($line), 0, 2))188 foreach ($data as $line) 189 { 190 switch (substr(trim($line), 0, 2)) 191 191 { 192 192 case '/*': … … 284 284 $about = ''; 285 285 286 foreach ($comment['about'] as $line)286 foreach ($comment['about'] as $line) 287 287 { 288 288 if (strpos($line, '`') !== FALSE) … … 377 377 if ($implements = $reflection->getInterfaces()) 378 378 { 379 foreach ($implements as $interface)379 foreach ($implements as $interface) 380 380 { 381 381 // Get implemented interfaces … … 392 392 if ($methods = $reflection->getMethods()) 393 393 { 394 foreach ($methods as $method)394 foreach ($methods as $method) 395 395 { 396 396 // Don't try to document internal methods … … 426 426 if ($parameters = $method->getParameters()) 427 427 { 428 foreach ($parameters as $param)428 foreach ($parameters as $param) 429 429 { 430 430 // Parameter data … … 523 523 } 524 524 525 foreach ($this->files as $type => $files)526 { 527 foreach (Kohana::list_files($type) as $filepath)525 foreach ($this->files as $type => $files) 526 { 527 foreach (Kohana::list_files($type) as $filepath) 528 528 { 529 529 // Get the filename with no extension … … 547 547 public function get_docs($format = 'html') 548 548 { 549 switch ($format)549 switch ($format) 550 550 { 551 551 default: … … 635 635 else 636 636 { 637 switch (substr(trim($line), 0, 2))637 switch (substr(trim($line), 0, 2)) 638 638 { 639 639 case '//': trunk/modules/kodoc/views/kodoc/class.php
r1522 r2593 32 32 <?php 33 33 34 foreach ($methods as $method):34 foreach ($methods as $method): 35 35 36 36 echo new View('kodoc/method', $method); trunk/modules/kodoc/views/kodoc/documentation.php
r1330 r2593 18 18 if ( ! empty($docs['comments'])): 19 19 20 foreach ($docs['comments'] as $comment):20 foreach ($docs['comments'] as $comment): 21 21 if ($docs['type'] === 'config'): 22 22 … … 32 32 if ( ! empty($docs['classes'])): 33 33 34 foreach ($docs['classes'] as $class):34 foreach ($docs['classes'] as $class): 35 35 36 36 echo new View('kodoc/class', $class); trunk/modules/kodoc/views/kodoc/file_config.php
r1522 r2593 16 16 17 17 if ( ! empty($note)): 18 foreach ($note as $n):18 foreach ($note as $n): 19 19 20 20 ?> trunk/modules/kodoc/views/kodoc/menu.php
r1330 r2593 3 3 <?php 4 4 5 foreach (Kodoc::get_files() as $group => $files):5 foreach (Kodoc::get_files() as $group => $files): 6 6 7 7 ?> … … 9 9 <?php 10 10 11 foreach ($files as $name => $drivers):11 foreach ($files as $name => $drivers): 12 12 13 13 ?> … … 21 21 <?php 22 22 23 foreach ($drivers as $driver):23 foreach ($drivers as $driver): 24 24 25 25 $file = ($name === $driver) ? $driver : $name.'_'.$driver; trunk/modules/kodoc/views/kodoc/method.php
r1522 r2593 31 31 <?php 32 32 33 foreach ($parameters as $i => $param):33 foreach ($parameters as $i => $param): 34 34 35 35 if ( ! empty($comment['param'][$i])): … … 80 80 endif; 81 81 if ( ! empty($comment)): 82 foreach ($comment as $tag => $vals):82 foreach ($comment as $tag => $vals): 83 83 84 switch ($tag):84 switch ($tag): 85 85 case 'throws': 86 86 case 'return': 87 foreach ($vals as $i => $val):87 foreach ($vals as $i => $val): 88 88 if (strpos($val, ' ') !== FALSE): 89 89 trunk/modules/user_guide/controllers/user_guide.php
r2229 r2593 102 102 $tag = $tag[1]; 103 103 104 switch ($tag)104 switch ($tag) 105 105 { 106 106 case 'benchmark': trunk/modules/user_guide/views/user_guide/template.php
r1525 r2593 42 42 <?php 43 43 44 foreach (Kohana::lang('user_guide_menu') as $cat => $menu):44 foreach (Kohana::lang('user_guide_menu') as $cat => $menu): 45 45 46 46 $active = (strtolower($cat) == $category) ? ' active' : ''; … … 50 50 <?php 51 51 52 foreach ($menu as $sec):52 foreach ($menu as $sec): 53 53 54 54 $active = (strtolower($sec) == $section) ? 'lite' : ''; trunk/system/config/session.php
r2013 r2593 28 28 * Note: the cookie driver always encrypts session data. Set to TRUE for stronger encryption. 29 29 */ 30 $config['encryption'] = FALSE;30 $config['encryption'] = TRUE; 31 31 32 32 /** trunk/system/core/Benchmark.php
r1767 r2593 63 63 $times = array(); 64 64 65 foreach (array_keys(self::$marks) as $name)65 foreach (array_keys(self::$marks) as $name) 66 66 { 67 67 // Get each mark recursively trunk/system/core/Config.php
r2080 r2593 109 109 $last = count($keys) - 1; 110 110 111 foreach ($keys as $i => $k)111 foreach ($keys as $i => $k) 112 112 { 113 113 if ($i === $last) … … 144 144 145 145 // Normalize all paths to be absolute and have a trailing slash 146 foreach (self::item('core.modules') as $path)146 foreach (self::item('core.modules') as $path) 147 147 { 148 148 if (($path = str_replace('\\', '/', realpath($path))) == '') … … 171 171 172 172
