Changeset 91 in ExiteCMS8
- Timestamp:
- 09/14/11 15:21:14 (8 months ago)
- Location:
- trunk/fuel
- Files:
-
- 1 added
- 33 edited
-
core/classes/agent.php (modified) (1 diff)
-
core/classes/arr.php (modified) (1 diff)
-
core/classes/cache.php (modified) (3 diffs)
-
core/classes/cache/handler/driver.php (modified) (2 diffs)
-
core/classes/cache/storage/apc.php (added)
-
core/classes/cache/storage/driver.php (modified) (19 diffs)
-
core/classes/cache/storage/file.php (modified) (15 diffs)
-
core/classes/cache/storage/memcached.php (modified) (13 diffs)
-
core/classes/cache/storage/redis.php (modified) (19 diffs)
-
core/classes/controller/template.php (modified) (1 diff)
-
core/classes/database/mysqli/connection.php (modified) (1 diff)
-
core/classes/fieldset/field.php (modified) (1 diff)
-
core/classes/format.php (modified) (2 diffs)
-
core/classes/fuel.php (modified) (1 diff)
-
core/classes/image.php (modified) (18 diffs)
-
core/classes/image/driver.php (modified) (34 diffs)
-
core/classes/image/gd.php (modified) (11 diffs)
-
core/classes/image/imagemagick.php (modified) (12 diffs)
-
core/classes/image/imagick.php (modified) (13 diffs)
-
core/classes/input.php (modified) (1 diff)
-
core/classes/request.php (modified) (1 diff)
-
core/classes/security.php (modified) (3 diffs)
-
core/classes/str.php (modified) (1 diff)
-
core/classes/upload.php (modified) (1 diff)
-
core/classes/validation.php (modified) (2 diffs)
-
core/config/cache.php (modified) (1 diff)
-
core/tests/arr.php (modified) (1 diff)
-
packages/auth/classes/auth/login/simpleauth.php (modified) (11 diffs)
-
packages/auth/config/simpleauth.php (modified) (2 diffs)
-
packages/oil/classes/command.php (modified) (1 diff)
-
packages/oil/views/default/scaffold/ar_model.php (modified) (1 diff)
-
packages/oil/views/default/scaffold/controller.php (modified) (1 diff)
-
packages/orm/classes/observer/validation.php (modified) (1 diff)
-
packages/orm/classes/query.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fuel/core/classes/agent.php
r78 r91 451 451 452 452 // normalize keys 453 $properties = \Arr::replace_key s($properties, array_flip(static::$keys));453 $properties = \Arr::replace_key($properties, array_flip(static::$keys)); 454 454 455 455 // merge it with the defaults to add missing values -
trunk/fuel/core/classes/arr.php
r85 r91 100 100 101 101 $array[array_shift($keys)] = $value; 102 } 103 104 /** 105 * Array_key_exists with a dot-notated key from an array. 106 * 107 * @param array $array The search array 108 * @param mixed $key The dot-notated key or array of keys 109 * @return mixed 110 */ 111 public static function key_exists($array, $key) 112 { 113 foreach (explode('.', $key) as $key_part) 114 { 115 if ( ! is_array($array) or ! array_key_exists($key_part, $array)) 116 { 117 return false; 118 } 119 120 $array = $array[$key_part]; 121 } 122 123 return true; 102 124 } 103 125 -
trunk/fuel/core/classes/cache.php
r78 r91 34 34 * Creates a new cache instance. 35 35 * 36 * @access public37 36 * @param mixed The identifier of the cache, can be anything but empty 38 37 * @param array|string Either an array of settings or the storage driver to be used … … 49 48 * Creates a new cache instance. 50 49 * 51 * @access public52 50 * @param mixed The identifier of the cache, can be anything but empty 53 51 * @param array|string Either an array of settings or the storage driver to be used … … 95 93 { 96 94 $contents = \Fuel::value($contents); 97 95 98 96 $cache = static::forge($identifier); 99 97 return $cache->set($contents, $expiration, $dependencies); -
trunk/fuel/core/classes/cache/handler/driver.php
r64 r91 20 20 * Should make the contents readable 21 21 * 22 * @access public 23 * @param mixed 24 * @return mixed 22 * @param mixed 23 * @return mixed 25 24 */ 26 25 public function readable($contents); … … 29 28 * Should make the contents writable 30 29 * 31 * @access public 32 * @param mixed 33 * @return mixed 30 * @param mixed 31 * @return mixed 34 32 */ 35 33 public function writable($contents); -
trunk/fuel/core/classes/cache/storage/driver.php
r87 r91 66 66 protected $driver = null; 67 67 68 // ---------------------------------------------------------------------69 70 68 /** 71 69 * Abstract method that should take care of the storage engine specific reading. Needs to set the object properties: … … 80 78 abstract protected function _get(); 81 79 82 // ---------------------------------------------------------------------83 84 80 /** 85 81 * Abstract method that should take care of the storage engine specific writing. Needs to write the object properties: … … 92 88 abstract protected function _set(); 93 89 94 // ---------------------------------------------------------------------95 96 90 /** 97 91 * Should delete this cache instance, should also run reset() afterwards 98 92 */ 99 93 abstract public function delete(); 100 101 // ---------------------------------------------------------------------102 94 103 95 /** … … 108 100 */ 109 101 abstract public function delete_all($section); 110 111 // ---------------------------------------------------------------------112 102 113 103 /** … … 120 110 abstract public function check_dependencies(array $dependencies); 121 111 122 // ---------------------------------------------------------------------123 124 112 /** 125 113 * Default constructor, any extension should either load this first or act similar … … 133 121 134 122 // fetch options from config and set them 135 $this->expiration = array_key_exists('expiration', $config) ? $config['expiration'] : \Config::get('cache.expiration', null); 136 $this->dependencies = array_key_exists('dependencies', $config) ? $config['dependencies'] : array(); 137 $this->content_handler = array_key_exists('content_handler', $config) ? new $config['content_handler']() : null; 138 $this->driver = array_key_exists('driver', $config) ? $config['driver'] : 'file'; 139 } 140 141 // --------------------------------------------------------------------- 123 $this->expiration = array_key_exists('expiration', $config) ? $config['expiration'] : \Config::get('cache.expiration', null); 124 $this->dependencies = array_key_exists('dependencies', $config) ? $config['dependencies'] : array(); 125 $this->content_handler = array_key_exists('content_handler', $config) ? new $config['content_handler']() : null; 126 $this->driver = array_key_exists('driver', $config) ? $config['driver'] : 'file'; 127 } 142 128 143 129 /** … … 183 169 } 184 170 185 // ---------------------------------------------------------------------186 187 171 /** 188 172 * Converts the identifier to a string when necessary: … … 217 201 } 218 202 } 219 220 // ---------------------------------------------------------------------221 203 222 204 /** … … 233 215 } 234 216 235 // --------------------------------------------------------------------- 236 237 /** 238 * Front for writing the cache, ensures interchangebility of storage engines. Actual writing 217 /** 218 * Front for writing the cache, ensures interchangeability of storage engines. Actual writing 239 219 * is being done by the _set() method which needs to be extended. 240 220 * … … 284 264 } 285 265 286 // --------------------------------------------------------------------- 287 288 /** 289 * Front for reading the cache, ensures interchangebility of storage engines. Actual reading 266 /** 267 * Front for reading the cache, ensures interchangeability of storage engines. Actual reading 290 268 * is being done by the _get() method which needs to be extended. 291 269 * … … 319 297 } 320 298 321 // --------------------------------------------------------------------- 322 323 /** 324 * Does get() & set() in one call that takes a callback and it's arguements to generate the contents 299 /** 300 * Does get() & set() in one call that takes a callback and it's arguments to generate the contents 325 301 * 326 302 * @param string|array Valid PHP callback 327 * @param array Argu ements for the above function/method303 * @param array Arguments for the above function/method 328 304 * @param int|null Cache expiration in seconds 329 305 * @param array Contains the identifiers of caches this one will depend on … … 346 322 return $this->get_contents(); 347 323 } 348 349 // ---------------------------------------------------------------------350 324 351 325 /** … … 364 338 } 365 339 366 // ---------------------------------------------------------------------367 368 340 /** 369 341 * Fetches contents … … 375 347 return $this->handle_reading($this->contents); 376 348 } 377 378 // ---------------------------------------------------------------------379 349 380 350 /** … … 391 361 } 392 362 393 // ---------------------------------------------------------------------394 395 363 /** 396 364 * Gets a specific content handler … … 406 374 } 407 375 408 // When not yet set, use $handler or detect the prefer ed handler (string = string, otherwise serialize)376 // When not yet set, use $handler or detect the preferred handler (string = string, otherwise serialize) 409 377 if (empty($this->content_handler) && empty($handler)) 410 378 { … … 430 398 } 431 399 432 // ---------------------------------------------------------------------433 434 400 /** 435 401 * Converts the contents the cachable format … … 442 408 } 443 409 444 // ---------------------------------------------------------------------445 446 410 /** 447 411 * Converts the cachable format to the original value … … 454 418 } 455 419 } 456 -
trunk/fuel/core/classes/cache/storage/file.php
r67 r91 18 18 19 19 /** 20 * @const stringTag used for opening & closing cache properties20 * @const string Tag used for opening & closing cache properties 21 21 */ 22 22 const PROPS_TAG = 'Fuel_Cache_Properties'; 23 23 24 24 /** 25 * @var stringFile caching basepath25 * @var string File caching basepath 26 26 */ 27 27 protected static $path = ''; 28 28 29 29 /** 30 * @var driver specific configuration30 * @var array driver specific configuration 31 31 */ 32 32 protected $config = array(); 33 33 34 // ---------------------------------------------------------------------35 36 34 public function __construct($identifier, $config) 37 35 { … … 41 39 42 40 // check for an expiration override 43 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) ? $this->config['expiration'] : $this->expiration); 41 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) 42 ? $this->config['expiration'] : $this->expiration); 44 43 45 44 // determine the file cache path 46 static::$path = !empty($this->config['path']) ? $this->config['path'] : \Config::get('cache_dir', APPPATH.'cache'.DS); 45 static::$path = !empty($this->config['path']) 46 ? $this->config['path'] : \Config::get('cache_dir', APPPATH.'cache'.DS); 47 47 48 if ( ! is_dir(static::$path) || ! is_writable(static::$path)) 48 49 { … … 51 52 } 52 53 53 // ---------------------------------------------------------------------54 55 54 /** 56 55 * Translates a given identifier to a valid path 57 56 * 58 * @param string59 * @return string60 */ 61 protected function identifier_to_path( $identifier)57 * @param string 58 * @return string 59 */ 60 protected function identifier_to_path($identifier) 62 61 { 63 62 // replace dots with dashes … … 67 66 } 68 67 69 // ---------------------------------------------------------------------70 71 68 /** 72 69 * Prepend the cache properties 73 70 * 74 * @return string71 * @return string 75 72 */ 76 73 protected function prep_contents() 77 74 { 78 75 $properties = array( 79 'created' => $this->created,80 'expiration' => $this->expiration,81 'dependencies' => $this->dependencies,82 'content_handler' => $this->content_handler76 'created' => $this->created, 77 'expiration' => $this->expiration, 78 'dependencies' => $this->dependencies, 79 'content_handler' => $this->content_handler 83 80 ); 84 81 $properties = '{{'.self::PROPS_TAG.'}}'.json_encode($properties).'{{/'.self::PROPS_TAG.'}}'; 85 82 86 return $properties . $this->contents; 87 } 88 89 // --------------------------------------------------------------------- 83 return $properties.$this->contents; 84 } 90 85 91 86 /** … … 111 106 } 112 107 113 $this->created = $props['created']; 114 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 115 $this->dependencies = $props['dependencies']; 116 $this->content_handler = $props['content_handler']; 117 } 118 119 // --------------------------------------------------------------------- 108 $this->created = $props['created']; 109 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 110 $this->dependencies = $props['dependencies']; 111 $this->content_handler = $props['content_handler']; 112 } 120 113 121 114 /** 122 115 * Check if other caches or files have been changed since cache creation 123 116 * 124 * @param array125 * @return bool117 * @param array 118 * @return bool 126 119 */ 127 120 public function check_dependencies(array $dependencies) … … 133 126 $filemtime = filemtime($file); 134 127 if ($filemtime === false || $filemtime > $this->created) 128 { 135 129 return false; 130 } 136 131 } 137 132 elseif (file_exists($dep)) … … 139 134 $filemtime = filemtime($file); 140 135 if ($filemtime === false || $filemtime > $this->created) 136 { 141 137 return false; 138 } 142 139 } 143 140 else … … 148 145 return true; 149 146 } 150 151 // ---------------------------------------------------------------------152 147 153 148 /** … … 166 161 * Purge all caches 167 162 * 168 * @param limit purge to subsection169 * @return bool163 * @param limit purge to subsection 164 * @return bool 170 165 */ 171 166 public function delete_all($section) … … 177 172 } 178 173 179 // ---------------------------------------------------------------------180 181 174 /** 182 175 * Save a cache, this does the generic pre-processing 183 176 * 184 * @return bool177 * @return bool success 185 178 */ 186 179 protected function _set() … … 200 193 { 201 194 // create non existing dir 202 if ( ! @mkdir($test_path, 0755, true)) return false; 195 if ( ! @mkdir($test_path, 0755, true)) 196 { 197 return false; 198 } 203 199 } 204 200 } … … 208 204 $handle = fopen($file, 'c'); 209 205 210 if ($handle) 211 { 212 // wait for a lock 213 while ( ! flock($handle, LOCK_EX)); 214 215 // write the session data 216 fwrite($handle, $payload); 217 218 //release the lock 219 flock($handle, LOCK_UN); 220 221 // close the file 222 fclose($handle); 223 } 224 } 225 226 // --------------------------------------------------------------------- 206 if ( ! $handle) 207 { 208 return false; 209 } 210 211 // wait for a lock 212 while ( ! flock($handle, LOCK_EX)); 213 214 // write the session data 215 fwrite($handle, $payload); 216 217 //release the lock 218 flock($handle, LOCK_UN); 219 220 // close the file 221 fclose($handle); 222 223 return true; 224 } 227 225 228 226 /** 229 227 * Load a cache, this does the generic post-processing 230 228 * 231 * @return bool229 * @return bool success 232 230 */ 233 231 protected function _get() … … 236 234 $file = static::$path.$id_path.'.cache'; 237 235 if ( ! file_exists($file)) 238 return false; 236 { 237 return false; 238 } 239 239 240 240 $handle = fopen($file, 'r'); 241 241 if ( ! $handle) 242 return false; 242 { 243 return false; 244 } 243 245 244 246 // wait for a lock … … 266 268 } 267 269 268 // ---------------------------------------------------------------------269 270 270 /** 271 271 * validate a driver config value 272 272 * 273 * @param string name of the config variable to validate 274 * @param mixed value 275 * @access private 273 * @param string name of the config variable to validate 274 * @param mixed value 276 275 * @return mixed 277 276 */ … … 297 296 return $value; 298 297 } 299 300 298 } 301 302 -
trunk/fuel/core/classes/cache/storage/memcached.php
r87 r91 18 18 19 19 /** 20 * @const stringTag used for opening & closing cache properties20 * @const string Tag used for opening & closing cache properties 21 21 */ 22 22 const PROPS_TAG = 'Fuel_Cache_Properties'; 23 23 24 24 /** 25 * @var driver specific configuration25 * @var array driver specific configuration 26 26 */ 27 27 protected $config = array(); 28 28 29 29 /* 30 * @var storage for the memcached object30 * @var Memcached storage for the memcached object 31 31 */ 32 32 protected $memcached = false; 33 33 34 // ---------------------------------------------------------------------35 36 34 public function __construct($identifier, $config) 37 35 { … … 41 39 42 40 // make sure we have a memcache id 43 $this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id']) ? $this->config['cache_id'] : 'fuel'); 41 $this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id']) 42 ? $this->config['cache_id'] : 'fuel'); 44 43 45 44 // check for an expiration override 46 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) ? $this->config['expiration'] : $this->expiration); 45 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) 46 ? $this->config['expiration'] : $this->expiration); 47 47 48 48 if ($this->memcached === false) … … 71 71 } 72 72 73 // ---------------------------------------------------------------------74 75 73 /** 76 74 * Prepend the cache properties 77 75 * 78 * @return string76 * @return string 79 77 */ 80 78 protected function prep_contents() 81 79 { 82 80 $properties = array( 83 'created' => $this->created,84 'expiration' => $this->expiration,85 'dependencies' => $this->dependencies,86 'content_handler' => $this->content_handler81 'created' => $this->created, 82 'expiration' => $this->expiration, 83 'dependencies' => $this->dependencies, 84 'content_handler' => $this->content_handler 87 85 ); 88 86 $properties = '{{'.static::PROPS_TAG.'}}'.json_encode($properties).'{{/'.static::PROPS_TAG.'}}'; 89 87 90 return $properties . $this->contents; 91 } 92 93 // --------------------------------------------------------------------- 88 return $properties.$this->contents; 89 } 94 90 95 91 /** … … 115 111 } 116 112 117 $this->created = $props['created']; 118 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 119 $this->dependencies = $props['dependencies']; 120 $this->content_handler = $props['content_handler']; 121 } 122 123 // --------------------------------------------------------------------- 113 $this->created = $props['created']; 114 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 115 $this->dependencies = $props['dependencies']; 116 $this->content_handler = $props['content_handler']; 117 } 124 118 125 119 /** 126 120 * Check if other caches or files have been changed since cache creation 127 121 * 128 * @param array129 * @return bool122 * @param array 123 * @return bool 130 124 */ 131 125 public function check_dependencies(array $dependencies) … … 162 156 } 163 157 164 // ---------------------------------------------------------------------165 166 158 /** 167 159 * Delete Cache … … 184 176 } 185 177 186 // ---------------------------------------------------------------------187 188 178 /** 189 179 * Purge all caches 190 180 * 191 * @param limit purge to subsection192 * @return bool181 * @param limit purge to subsection 182 * @return bool 193 183 */ 194 184 public function delete_all($section) … … 229 219 } 230 220 231 // ---------------------------------------------------------------------232 233 221 /** 234 222 * Save a cache, this does the generic pre-processing 235 223 * 236 * @return bool224 * @return bool success 237 225 */ 238 226 protected function _set() … … 248 236 throw new \Fuel_Exception('Memcached returned error code "'.$this->memcached->getResultCode().'" on write. Check your configuration.'); 249 237 } 250 } 251 252 // ---------------------------------------------------------------------238 239 return true; 240 } 253 241 254 242 /** 255 243 * Load a cache, this does the generic post-processing 256 244 * 257 * @return bool245 * @return bool success 258 246 */ 259 247 protected function _get() … … 271 259 catch (\UnexpectedValueException $e) 272 260 { 273 274 261 return false; 275 262 } … … 278 265 } 279 266 280 // ---------------------------------------------------------------------281 282 267 /** 283 268 * validate a driver config value 284 269 * 285 * @param string name of the config variable to validate 286 * @param mixed value 287 * @access private 270 * @param string name of the config variable to validate 271 * @param mixed value 288 272 * @return mixed 289 273 */ … … 342 326 } 343 327 344 // --------------------------------------------------------------------- 345 346 /** 347 * get's the memcached key belonging to the cache identifier 348 * 349 * @access private 350 * @param bool if true, remove the key retrieved from the index 328 /** 329 * Get's the memcached key belonging to the cache identifier 330 * 331 * @param bool if true, remove the key retrieved from the index 351 332 * @return string 352 333 */ … … 414 395 } 415 396 416 // --------------------------------------------------------------------- 417 418 /** 419 * generate a new unique key for the current identifier 420 * 421 * @access private 397 /** 398 * Generate a new unique key for the current identifier 399 * 422 400 * @return string 423 401 */ … … 431 409 return md5($this->config['cache_id'].'_'.uniqid($key, TRUE)); 432 410 } 433 434 411 } 435 436 -
trunk/fuel/core/classes/cache/storage/redis.php
r87 r91 18 18 19 19 /** 20 * @const stringTag used for opening & closing cache properties20 * @const string Tag used for opening & closing cache properties 21 21 */ 22 22 const PROPS_TAG = 'Fuel_Cache_Properties'; 23 23 24 24 /** 25 * @var driver specific configuration25 * @var array driver specific configuration 26 26 */ 27 27 protected $config = array(); 28 28 29 29 /* 30 * @var storage for the redis object30 * @var Redis storage for the redis object 31 31 */ 32 32 protected $redis = false; 33 33 34 // ---------------------------------------------------------------------35 36 34 public function __construct($identifier, $config) 37 35 { … … 41 39 42 40 // make sure we have a redis id 43 $this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id']) ? $this->config['cache_id'] : 'fuel'); 41 $this->config['cache_id'] = $this->_validate_config('cache_id', isset($this->config['cache_id']) 42 ? $this->config['cache_id'] : 'fuel'); 44 43 45 44 // check for an expiration override 46 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) ? $this->config['expiration'] : $this->expiration); 45 $this->expiration = $this->_validate_config('expiration', isset($this->config['expiration']) 46 ? $this->config['expiration'] : $this->expiration); 47 47 48 48 // make sure we have a redis database configured 49 $this->config['database'] = $this->_validate_config('database', isset($this->config['database']) ? $this->config['database'] : 'default'); 49 $this->config['database'] = $this->_validate_config('database', isset($this->config['database']) 50 ? $this->config['database'] : 'default'); 50 51 51 52 if ($this->redis === false) … … 70 71 } 71 72 72 // ---------------------------------------------------------------------73 74 73 /** 75 74 * Translates a given identifier to a valid redis key 76 75 * 77 * @param string78 * @return string76 * @param string 77 * @return string 79 78 */ 80 79 protected function identifier_to_key( $identifier ) … … 83 82 } 84 83 85 // ---------------------------------------------------------------------86 87 84 /** 88 85 * Prepend the cache properties … … 93 90 { 94 91 $properties = array( 95 'created' => $this->created,96 'expiration' => $this->expiration,97 'dependencies' => $this->dependencies,98 'content_handler' => $this->content_handler92 'created' => $this->created, 93 'expiration' => $this->expiration, 94 'dependencies' => $this->dependencies, 95 'content_handler' => $this->content_handler 99 96 ); 100 97 $properties = '{{'.static::PROPS_TAG.'}}'.json_encode($properties).'{{/'.static::PROPS_TAG.'}}'; 101 98 102 return $properties . $this->contents; 103 } 104 105 // --------------------------------------------------------------------- 99 return $properties.$this->contents; 100 } 106 101 107 102 /** … … 127 122 } 128 123 129 $this->created = $props['created']; 130 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 131 $this->dependencies = $props['dependencies']; 132 $this->content_handler = $props['content_handler']; 133 } 134 135 // --------------------------------------------------------------------- 124 $this->created = $props['created']; 125 $this->expiration = is_null($props['expiration']) ? null : (int) ($props['expiration'] - time()); 126 $this->dependencies = $props['dependencies']; 127 $this->content_handler = $props['content_handler']; 128 } 136 129 137 130 /** 138 131 * Check if other caches or files have been changed since cache creation 139 132 * 140 * @param array141 * @return bool133 * @param array 134 * @return bool 142 135 */ 143 136 public function check_dependencies(array $dependencies) … … 175 168 } 176 169 177 // ---------------------------------------------------------------------178 179 170 /** 180 171 * Delete Cache … … 194 185 } 195 186 196 // ---------------------------------------------------------------------197 198 187 /** 199 188 * Purge all caches 200 189 * 201 * @param limit purge to subsection202 * @return bool190 * @param limit purge to subsection 191 * @return bool 203 192 */ 204 193 public function delete_all($section) … … 260 249 } 261 250 262 // ---------------------------------------------------------------------263 264 251 /** 265 252 * Save a cache, this does the generic pre-processing 266 253 * 267 * @return bool254 * @return bool success 268 255 */ 269 256 protected function _set() … … 278 265 $this->redis->expireat($key, $this->expiration); 279 266 } 280 } 281 282 // ---------------------------------------------------------------------267 268 return true; 269 } 283 270 284 271 /** 285 272 * Load a cache, this does the generic post-processing 286 273 * 287 * @return bool274 * @return bool success 288 275 */ 289 276 protected function _get() … … 300 287 catch (\UnexpectedValueException $e) 301 288 { 302 303 289 return false; 304 290 } … … 307 293 } 308 294 309 // ---------------------------------------------------------------------310 311 295 /** 312 296 * get's the memcached key belonging to the cache identifier 313 297 * 314 * @access private 315 * @param bool if true, remove the key retrieved from the index 298 * @param bool if true, remove the key retrieved from the index 316 299 * @return string 317 300 */ … … 389 372 } 390 373 391 // ---------------------------------------------------------------------392 393 374 /** 394 375 * generate a new unique key for the current identifier 395 376 * 396 * @access private397 377 * @return string 398 378 */ … … 407 387 } 408 388 409 // ---------------------------------------------------------------------410 411 389 /** 412 390 * validate a driver config value 413 391 * 414 * @param string name of the config variable to validate 415 * @param mixed value 416 * @access private 392 * @param string name of the config variable to validate 393 * @param mixed value 417 394 * @return mixed 418 395 */ … … 450 427 } 451 428 452 // --------------------------------------------------------------------453 454 429 /** 455 430 * Serialize an array … … 458 433 * marker, so when it gets unserialized the slashes will be preserved 459 434 * 460 * @access private 461 * @param array 462 * @return string 435 * @param array 436 * @return string 463 437 */ 464 438 protected function _serialize($data) … … 484 458 return serialize($data); 485 459 } 486 487 // --------------------------------------------------------------------488 460 489 461 /** … … 493 465 * temporary slash markers back to actual slashes 494 466 * 495 * @access private 496 * @param array 497 * @return string 467 * @param array 468 * @return string 498 469 */ 499 470 protected function _unserialize($data) … … 516 487 return (is_string($data)) ? str_replace('{{slash}}', '\\', $data) : $data; 517 488 } 518 519 489 } 520 521 -
trunk/fuel/core/classes/controller/template.php
r78 r91 46 46 } 47 47 48 // After cont orller method has run output the template48 // After controller method has run output the template 49 49 public function after($response) 50 50 { -
trunk/fuel/core/classes/database/mysqli/connection.php
r88 r91 81 81 { 82 82 // Create a persistent connection 83 $this->_connection = new \ mysqli('p:'.$hostname, $username, $password, $database, $port, $socket);83 $this->_connection = new \MySQLi('p:'.$hostname, $username, $password, $database, $port, $socket); 84 84 } 85 85 else 86 86 { 87 87 // Create a connection and force it to be a new link 88 $this->_connection = new \ mysqli($hostname, $username, $password, $database, $port, $socket);88 $this->_connection = new \MySQLi($hostname, $username, $password, $database, $port, $socket); 89 89 } 90 90 if ($this->_connection->error) -
trunk/fuel/core/classes/fieldset/field.php
r86 r91 340 340 public function error() 341 341 { 342 return $this->fieldset()->validation()->error s($this->name);342 return $this->fieldset()->validation()->error($this->name); 343 343 } 344 344 } -
trunk/fuel/core/classes/format.php
r78 r91 33 33 /** 34 34 * This method is deprecated...use forge() instead. 35 * 35 * 36 36 * @deprecated until 1.2 37 37 */ … … 96 96 97 97 $array = array(); 98 99 if (is_object($data) and ! $data instanceof \Iterator) 100 { 101 $data = get_object_vars($data); 102 } 98 103 99 104 foreach ($data as $key => $value) -
trunk/fuel/core/classes/fuel.php
r88 r91 187 187 { 188 188 is_string($package) and $path = array($package => $path); 189 static::add_package($path);189 \Package::load($path); 190 190 } 191 191 -
trunk/fuel/core/classes/image.php
r78 r91 42 42 /** 43 43 * This method is deprecated...use forge() instead. 44 * 44 * 45 45 * @deprecated until 1.2 46 46 */ … … 54 54 * Creates a new instance of the image driver 55 55 * 56 * @param array$config57 * @return Image_Driver56 * @param array $config 57 * @return Image_Driver 58 58 */ 59 59 public static function forge($config = array(), $filename = null) … … 86 86 * factory(). 87 87 * 88 * @param array $config An array of configuration settings.89 * @return Image_Driver88 * @param array $config An array of configuration settings. 89 * @return Image_Driver 90 90 */ 91 91 public static function config($index = array(), $value = null) … … 107 107 * Loads the image and checks if its compatable. 108 108 * 109 * @param string $filename The file to load110 * @return Image_Driver109 * @param string $filename The file to load 110 * @return Image_Driver 111 111 */ 112 112 public static function load($filename) … … 120 120 * Absolute integer or percentages accepted for all 4. 121 121 * 122 * @param integer $x1 X-Coordinate based from the top-left corner.123 * @param integer $y1 Y-Coordinate based from the top-left corner.124 * @param integer $x2 X-Coordinate based from the bottom-right corner.125 * @param integer $y2 Y-Coordinate based from the bottom-right corner.126 * @return Image_Driver122 * @param integer $x1 X-Coordinate based from the top-left corner. 123 * @param integer $y1 Y-Coordinate based from the top-left corner. 124 * @param integer $x2 X-Coordinate based from the bottom-right corner. 125 * @param integer $y2 Y-Coordinate based from the bottom-right corner. 126 * @return Image_Driver 127 127 */ 128 128 public static function crop($x1, $y1, $x2, $y2) … … 134 134 * Resizes the image. If the width or height is null, it will resize retaining the original aspect ratio. 135 135 * 136 * @param integer $width The new width of the image.137 * @param integer $height The new height of the image.138 * @param boolean $keepar Defaults to true. If false, allows resizing without keeping AR.139 * @param boolean $pad If set to true and $keepar is true, it will pad the image with the configured bgcolor140 * @return Image_Driver136 * @param integer $width The new width of the image. 137 * @param integer $height The new height of the image. 138 * @param boolean $keepar Defaults to true. If false, allows resizing without keeping AR. 139 * @param boolean $pad If set to true and $keepar is true, it will pad the image with the configured bgcolor 140 * @return Image_Driver 141 141 */ 142 142 public static function resize($width, $height, $keepar = true, $pad = false) … … 148 148 * Resizes the image. If the width or height is null, it will resize retaining the original aspect ratio. 149 149 * 150 * @param integer $width The new width of the image.151 * @param integer $height The new height of the image.152 * @return Image_Driver150 * @param integer $width The new width of the image. 151 * @param integer $height The new height of the image. 152 * @return Image_Driver 153 153 */ 154 154 public static function crop_resize($width, $height) … … 160 160 * Rotates the image 161 161 * 162 * @param integer $degrees The degrees to rotate, negatives integers allowed.163 * @return Image_Driver162 * @param integer $degrees The degrees to rotate, negatives integers allowed. 163 * @return Image_Driver 164 164 */ 165 165 public static function rotate($degrees) … … 171 171 * Adds a watermark to the image. 172 172 * 173 * @param string $filename The filename of the watermark file to use.174 * @param string $position The position of the watermark, ex: "bottom right", "center center", "top left"175 * @param integer $padding The spacing between the edge of the image.176 * @return Image_Driver173 * @param string $filename The filename of the watermark file to use. 174 * @param string $position The position of the watermark, ex: "bottom right", "center center", "top left" 175 * @param integer $padding The spacing between the edge of the image. 176 * @return Image_Driver 177 177 */ 178 178 public static function watermark($filename, $position, $padding = 5) … … 184 184 * Adds a border to the image. 185 185 * 186 * @param integer $size The side of the border, in pixels.187 * @param string $color A hexidecimal color.188 * @ paramImage_Driver186 * @param integer $size The side of the border, in pixels. 187 * @param string $color A hexidecimal color. 188 * @return Image_Driver 189 189 */ 190 190 public static function border($size, $color = null) … … 196 196 * Masks the image using the alpha channel of the image input. 197 197 * 198 * @param string $maskimage The location of the image to use as the mask199 * @return Image_Driver198 * @param string $maskimage The location of the image to use as the mask 199 * @return Image_Driver 200 200 */ 201 201 public static function mask($maskimage) … … 207 207 * Adds rounded corners to the image. 208 208 * 209 * @param integer $radius210 * @param integer $sides Accepts any combination of "tl tr bl br" seperated by spaces, or null for all sides211 * @param integer $antialias Sets the antialias range.212 * @return Image_Driver209 * @param integer $radius 210 * @param integer $sides Accepts any combination of "tl tr bl br" seperated by spaces, or null for all sides 211 * @param integer $antialias Sets the antialias range. 212 * @return Image_Driver 213 213 */ 214 214 public static function rounded($radius, $sides = null, $antialias = null) … … 216 216 return static::instance()->rounded($radius, $sides, $antialias); 217 217 } 218 218 219 219 /** 220 220 * Turns the image into a grayscale version 221 * 222 * @return Image_Driver221 * 222 * @return Image_Driver 223 223 */ 224 224 public static function grayscale() … … 230 230 * Saves the image, and optionally attempts to set permissions 231 231 * 232 * @param string $filename The location where to save the image.233 * @param string $permissions Allows unix style permissions234 * @return Image_Driver232 * @param string $filename The location where to save the image. 233 * @param string $permissions Allows unix style permissions 234 * @return Image_Driver 235 235 */ 236 236 public static function save($filename, $permissions = null) … … 242 242 * Saves the image, and optionally attempts to set permissions 243 243 * 244 * @param string $prepend The text to add to the beginning of the filename.245 * @param string $append The text to add to the end of the filename.246 * @param string $permissions Allows unix style permissions247 * @return Image_Driver244 * @param string $prepend The text to add to the beginning of the filename. 245 * @param string $append The text to add to the end of the filename. 246 * @param string $permissions Allows unix style permissions 247 * @return Image_Driver 248 248 */ 249 249 public static function save_pa($prepend, $append = null, $permissions = null) … … 255 255 * Outputs the file directly to the user. 256 256 * 257 * @param string $filetype The extension type to use. Ex: png, jpg, bmp, gif258 * @return Image_Driver257 * @param string $filetype The extension type to use. Ex: png, jpg, bmp, gif 258 * @return Image_Driver 259 259 */ 260 260 public static function output($filetype = null) … … 264 264 265 265 /** 266 * Returns sizes for the currently loaded image, or the image given in the $filename.267 * 268 * @param string $filenameThe location of the file to get sizes for.269 * @return objectAn object containing width and height variables.266 * Returns sizes for the currently loaded image, or the image given in the $filename. 267 * 268 * @param string The location of the file to get sizes for. 269 * @return object An object containing width and height variables. 270 270 */ 271 271 public static function sizes($filename = null) … … 278 278 return static::instance()->reload(); 279 279 } 280 281 280 } 282 -
trunk/fuel/core/classes/image/driver.php
r78 r91 30 30 Config::load('image', 'image'); 31 31 if (is_array($config)) 32 { 32 33 $this->config = array_merge(Config::get('image'), $config); 34 } 33 35 else 36 { 34 37 $this->config = Config::get('image'); 35 $this->debug("Image Class was initalized using the " . $this->config['driver'] . " driver."); 38 } 39 $this->debug("Image Class was initialized using the " . $this->config['driver'] . " driver."); 36 40 } 37 41 /** 38 42 * Accepts configuration in either an array (as $index) or a pairing using $index and $value 39 43 * 40 * @param string $index The index to be set, or an array of configuration options. 41 * @param mixed $value The value to be set if $index is not an array. 44 * @param string $index The index to be set, or an array of configuration options. 45 * @param mixed $value The value to be set if $index is not an array. 46 * @return Image_Driver 42 47 */ 43 48 public function config($index = null, $value = null) … … 46 51 { 47 52 if (isset($index['driver'])) 48 throw new \Fuel_Exception("The driver cannot be changed after initalization!"); 53 { 54 throw new \RuntimeException("The driver cannot be changed after initialization!"); 55 } 49 56 $this->config = array_merge($this->config, $index); 50 57 } … … 52 59 { 53 60 if ($index == 'driver') 54 throw new \Fuel_Exception("The driver cannot be changed after initalization!"); 61 { 62 throw new \RuntimeException("The driver cannot be changed after initialization!"); 63 } 55 64 $this->config[$index] = $value; 56 65 } 66 57 67 return $this; 58 68 } … … 61 71 * Exectues the presets set in the config. Additional parameters replace the $1, $2, ect. 62 72 * 63 * @param string $name The name of the preset. 73 * @param string $name The name of the preset. 74 * @return Image_Driver 64 75 */ 65 76 public function preset($name) … … 87 98 else 88 99 { 89 throw new \ Fuel_Exception("Could not load preset $name, you sure it exists?");90 } 91 return $this; 92 } 93 94 /** 95 * Loads the image and checks if its compat able.100 throw new \InvalidArgumentException("Could not load preset $name, you sure it exists?"); 101 } 102 return $this; 103 } 104 105 /** 106 * Loads the image and checks if its compatible. 96 107 * 97 108 * @param string $filename The file to load … … 129 140 else 130 141 { 131 throw new \ Fuel_Exception("The library does not support this filetype for <i>$filename</i>.");142 throw new \RuntimeException("The library does not support this filetype for $filename."); 132 143 } 133 144 } 134 145 else 135 146 { 136 throw new \ Fuel_Exception("Image file <i>$filename</i>does not exist.");147 throw new \OutOfBoundsException("Image file $filename does not exist."); 137 148 } 138 149 return $return; … … 239 250 else 240 251 { 241 throw new \Fuel_Exception("Width and height cannot be null."); 242 } 243 } 244 } 252 throw new \InvalidArgumentException("Width and height cannot be null."); 253 } 254 } 255 } 256 245 257 $origwidth = $this->convert_number($width, true); 246 258 $origheight = $this->convert_number($height, false); … … 285 297 } 286 298 } 299 287 300 if ($pad) 288 301 { 289 302 $x = floor(($origwidth - $width) / 2); 290 303 $y = floor(($origheight - $height) / 2); 291 } else { 304 } 305 else 306 { 292 307 $origwidth = $width; 293 308 $origheight = $height; 294 309 } 310 295 311 return array( 296 312 'width' => $width, … … 316 332 $height = $this->convert_number($height, false); 317 333 $x = $y = 0; 334 318 335 if (function_exists('bcdiv')) 319 336 { … … 338 355 } 339 356 } 357 340 358 $sizes = $this->sizes(); 341 359 $y = floor(($sizes->height - $height) / 2); … … 347 365 * Rotates the image 348 366 * 349 * @param integer $degreesThe degrees to rotate, negatives integers allowed.350 * @ paramImage_Driver367 * @param integer $degrees The degrees to rotate, negatives integers allowed. 368 * @return Image_Driver 351 369 */ 352 370 public function rotate($degrees) … … 361 379 * Formats the rotate method input for use with driver specific methods 362 380 * 363 * @param integer $degreesThe degrees to rotate, negatives integers allowed.364 * @return ArrayAn array of variables for the specific driver.381 * @param integer $degrees The degrees to rotate, negatives integers allowed. 382 * @return array An array of variables for the specific driver. 365 383 */ 366 384 protected function _rotate($degrees) … … 379 397 * Adds a watermark to the image. 380 398 * 381 * @param string $filenameThe filename of the watermark file to use.382 * @param string $positionThe position of the watermark, ex: "bottom right", "center center", "top left"383 * @param integer $paddingThe amount of padding (in pixels) from the position.384 * @ paramImage_Driver399 * @param string $filename The filename of the watermark file to use. 400 * @param string $position The position of the watermark, ex: "bottom right", "center center", "top left" 401 * @param integer $padding The amount of padding (in pixels) from the position. 402 * @return Image_Driver 385 403 */ 386 404 public function watermark($filename, $position, $padding = 5) … … 395 413 * Formats the watermark method input for use with driver specific methods 396 414 * 397 * @param string $filenameThe filename of the watermark file to use.398 * @param string $positionThe position of the watermark, ex: "bottom right", "center center", "top left"399 * @param integer $paddingThe amount of padding (in pixels) from the position.400 * @return ArrayAn array of variables for the specific driver.415 * @param string $filename The filename of the watermark file to use. 416 * @param string $position The position of the watermark, ex: "bottom right", "center center", "top left" 417 * @param integer $padding The amount of padding (in pixels) from the position. 418 * @return array An array of variables for the specific driver. 401 419 */ 402 420 protected function _watermark($filename, $position, $padding = 5) … … 452 470 * Adds a border to the image. 453 471 * 454 * @param integer $sizeThe side of the border, in pixels.455 * @param string $color A hexidecimal color.456 * @ paramImage_Driver472 * @param integer $size The side of the border, in pixels. 473 * @param string $color A hexadecimal color. 474 * @return Image_Driver 457 475 */ 458 476 public function border($size, $color = null) … … 467 485 * Formats the border method input for use with driver specific methods 468 486 * 469 * @param integer $sizeThe side of the border, in pixels.470 * @param string $color A hexidecimal color.471 * @return ArrayAn array of variables for the specific driver.487 * @param integer $size The side of the border, in pixels. 488 * @param string $color A hexadecimal color. 489 * @return array An array of variables for the specific driver. 472 490 */ 473 491 protected function _border($size, $color = null) … … 484 502 * Masks the image using the alpha channel of the image input. 485 503 * 486 * @param string $maskimageThe location of the image to use as the mask487 * @return Image_Driver504 * @param string $maskimage The location of the image to use as the mask 505 * @return Image_Driver 488 506 */ 489 507 public function mask($maskimage) … … 498 516 * Formats the mask method input for use with driver specific methods 499 517 * 500 * @param string $maskimageThe location of the image to use as the mask501 * @return ArrayAn array of variables for the specific driver.518 * @param string $maskimage The location of the image to use as the mask 519 * @return array An array of variables for the specific driver. 502 520 */ 503 521 protected function _mask($maskimage) … … 511 529 * Adds rounded corners to the image. 512 530 * 513 * @param integer$radius514 * @param integer $sides Accepts any combination of "tl tr bl br" seperated by spaces, or null for all sides515 * @param integer $antialiasSets the antialias range.516 * @return Image_Driver531 * @param integer $radius 532 * @param integer $sides Accepts any combination of "tl tr bl br" separated by spaces, or null for all sides 533 * @param integer $antialias Sets the antialias range. 534 * @return Image_Driver 517 535 */ 518 536 public function rounded($radius, $sides = null, $antialias = null) … … 527 545 * Formats the rounded method input for use with driver specific methods 528 546 * 529 * @param integer$radius530 * @param integer $sides Accepts any combination of "tl tr bl br" seperated by spaces, or null for all sides531 * @param integer $antialiasSets the antialias range.532 * @return ArrayAn array of variables for the specific driver.547 * @param integer $radius 548 * @param integer $sides Accepts any combination of "tl tr bl br" separated by spaces, or null for all sides 549 * @param integer $antialias Sets the antialias range. 550 * @return array An array of variables for the specific driver. 533 551 */ 534 552 protected function _rounded($radius, $sides, $antialias) … … 559 577 ); 560 578 } 561 579 562 580 /** 563 581 * Turns the image into a grayscale version 564 * 565 * @return Image_Driver582 * 583 * @return Image_Driver 566 584 */ 567 585 public function grayscale() … … 570 588 return $this; 571 589 } 572 590 573 591 /** 574 592 * Executes the grayscale event when the queue is ran. 575 593 */ 576 protected function _grayscale() 577 { 578 579 } 594 abstract protected function _grayscale(); 580 595 581 596 /** 582 597 * Saves the image, and optionally attempts to set permissions 583 598 * 584 * @param string $filename The location where to save the image. 585 * @param string $permissions Allows unix style permissions 599 * @param string $filename The location where to save the image. 600 * @param string $permissions Allows unix style permissions 601 * @return array 586 602 */ 587 603 public function save($filename, $permissions = null) … … 590 606 if ( ! is_dir($directory)) 591 607 { 592 throw new \ Fuel_Exception("Could not find directory \"$directory\"");608 throw new \OutOfBoundsException("Could not find directory \"$directory\""); 593 609 } 594 610 … … 600 616 if ( ! touch($filename)) 601 617 { 602 throw new \ Fuel_Exception("Do not have permission to write to \"$filename\"");618 throw new \RuntimeException("Do not have permission to write to \"$filename\""); 603 619 } 604 620 … … 606 622 if ($permissions != null and ! chmod($filename, $permissions)) 607 623 { 608 throw new \ Fuel_Exception("Could not set permissions on the file.");624 throw new \RuntimeException("Could not set permissions on the file."); 609 625 } 610 626 … … 618 634 * Saves the file in the original location, adding the append and prepend to the filename. 619 635 * 620 * @param string $append The string to append to the filename 621 * @param string $prepend The string to prepend to the filename 622 * @param string $extension The extension to save the image as, null defaults to the loaded images extension. 623 * @param integer $permissions The permissions to attempt to set on the file. 636 * @param string $append The string to append to the filename 637 * @param string $prepend The string to prepend to the filename 638 * @param string $extension The extension to save the image as, null defaults to the loaded images extension. 639 * @param integer $permissions The permissions to attempt to set on the file. 640 * @return Image_Driver 624 641 */ 625 642 public function save_pa($append, $prepend = null, $extension = null, $permissions = null) 626 643 { 627 644 $filename = substr($this->image_filename, 0, -(strlen($this->image_extension) + 1)); 628 $fullpath = $this->image_directory.'/'.$append.$filename.$prepend.'.'.($extension !== null ? $extension : $this->image_extension); 645 $fullpath = $this->image_directory.'/'.$append.$filename.$prepend.'.'. 646 ($extension !== null ? $extension : $this->image_extension); 629 647 $this->save($fullpath, $permissions); 630 648 return $this; … … 634 652 * Outputs the file directly to the user. 635 653 * 636 * @param string $filetype The extension type to use. Ex: png, jpg, gif 654 * @param string $filetype The extension type to use. Ex: png, jpg, gif 655 * @return array 637 656 */ 638 657 public function output($filetype = null) … … 665 684 * Returns sizes for the currently loaded image, or the image given in the $filename. 666 685 * 667 * @param string $filenameThe location of the file to get sizes for.668 * @return objectAn object containing width and height variables.686 * @param string $filename The location of the file to get sizes for. 687 * @return object An object containing width and height variables. 669 688 */ 670 689 abstract public function sizes($filename = null); … … 678 697 * Checks if the extension is accepted by this library, and if its valid sets the $this->image_extension variable. 679 698 * 680 * @param string$filename681 * @param boolean $writevarDecides if the extension should be written to $this->image_extension682 * @return boolean699 * @param string $filename 700 * @param boolean $writevar Decides if the extension should be written to $this->image_extension 701 * @return boolean 683 702 */ 684 703 protected function check_extension($filename, $writevar = true) … … 699 718 * Converts percentages, negatives, and other values to absolute integers. 700 719 * 701 * @param string$input702 * @param boolean $xDetermines if the number relates to the x-axis or y-axis.703 * @return integer The converted number, useable with the image being edited.720 * @param string $input 721 * @param boolean $x Determines if the number relates to the x-axis or y-axis. 722 * @return integer The converted number, usable with the image being edited. 704 723 */ 705 724 protected function convert_number($input, $x = null) 706 725 { 707 // San atize double negatives726 // Sanitize double negatives 708 727 $input = str_replace('--', '', $input); 709 728 … … 727 746 * Queues a function to run at a later time. 728 747 * 729 * @param string $functionThe name of the function to be ran, without the leading _748 * @param string $function The name of the function to be ran, without the leading _ 730 749 */ 731 750 protected function queue($function) … … 745 764 * Runs all queued actions on the loaded image. 746 765 * 747 * @param boolean $clearDecides if the queue should be cleared once completed.766 * @param boolean $clear Decides if the queue should be cleared once completed. 748 767 */ 749 768 public function run_queue($clear = null) … … 767 786 /** 768 787 * Reloads the image. 788 * 789 * @return Image_Driver 769 790 */ 770 791 public function reload() … … 778 799 * Used for debugging image output. 779 800 * 780 * @param string$message801 * @param string $message 781 802 */ 782 803 protected function debug() -
trunk/fuel/core/classes/image/gd.php
r64 r91 27 27 $image_extension == 'jpg' and $image_extension = 'jpeg'; 28 28 29 if ( ! $return_data) { 29 if ( ! $return_data) 30 { 30 31 $this->image_data !== null and imagedestroy($this->image_data); 31 32 $this->image_data = null; 32 33 } 33 34 34 35 // Check if the function exists 35 36 if (function_exists('imagecreatefrom'.$image_extension)) … … 52 53 else 53 54 { 54 throw new \ Fuel_Exception("Function imagecreatefrom".$image_extension."() does not exist (Missing GD?)");55 throw new \RuntimeException("Function imagecreatefrom".$image_extension."() does not exist (Missing GD?)"); 55 56 } 56 57 return $return_data ? $return : $this; … … 96 97 if ($values == false) 97 98 { 98 throw new \ Fuel_Exception("Watermark image not found or invalid filetype.");99 throw new \InvalidArgumentException("Watermark image not found or invalid filetype."); 99 100 } 100 101 else … … 224 225 $br and $this->round_corner($this->image_data, $radius, $antialias, false, false); 225 226 } 226 227 227 228 protected function _grayscale() 228 229 { 229 230 $sizes = $this->sizes(); 230 231 231 232 // Create the 256 color palette 232 233 $bwpalette = array(); 233 234 for ($i = 0; $i < 256; $i++) 235 { 234 236 $bwpalette[$i] = imagecolorallocate($this->image_data, $i, $i, $i); 235 237 } 238 236 239 for ($x = 0; $x < $sizes->width; $x++) 237 240 { … … 242 245 $green = ($color >> 8) & 0xFF; 243 246 $blue = $color & 0xFF; 244 247 245 248 // If its black or white, theres no use in setting the pixel 246 249 if (($red == 0 && $green == 0 && $blue == 0) || ($red == 255 && $green == 255 && $blue == 255)) 250 { 247 251 continue; 248 252 } 253 249 254 // Now set the color 250 255 $shade = (($red*0.299)+($green*0.587)+($blue*0.114)); … … 299 304 call_user_func_array('image'.$filetype, $vars); 300 305 if ($this->config['persistence'] === false) 306 { 301 307 $this->reload(); 308 } 309 302 310 return $this; 303 311 } … … 324 332 325 333 call_user_func_array('image'.$filetype, $vars); 326 334 327 335 if ($this->config['persistence'] === false) 336 { 328 337 $this->reload(); 338 } 329 339 330 340 return $this; … … 334 344 * Creates a new color usable by GD. 335 345 * 336 * @param resource $image The image to create the color from337 * @param string $hex The hex code of the color338 * @param integer $alpha The alpha of the color, 0 (trans) to 100 (opaque)339 * @return integer The color346 * @param resource $image The image to create the color from 347 * @param string $hex The hex code of the color 348 * @param integer $alpha The alpha of the color, 0 (trans) to 100 (opaque) 349 * @return integer The color 340 350 */ 341 351 protected function create_color(&$image, $hex, $alpha) … … 371 381 $alpha = 127 - floor($alpha * 1.27); 372 382 } 383 373 384 // Check if the transparency is allowed 374 385 return imagecolorallocatealpha($image, $red, $green, $blue, $alpha); … … 408 419 $transcolor = imagecolortransparent($image); 409 420 if ($transcolor > 0) 421 { 410 422 $color = $transcolor; 423 } 411 424 imagecolortransparent($image, $color); 412 425 } … … 511 524 imagealphablending($image, true); 512 525 } 513 514 526 } 515 -
trunk/fuel/core/classes/image/imagemagick.php
r78 r91 35 35 while (file_exists($this->image_temp)); 36 36 } 37 else if (file_exists($this->image_temp))37 elseif (file_exists($this->image_temp)) 38 38 { 39 39 $this->debug('Removing previous temporary image.'); … … 43 43 if (!file_exists($this->config['temp_dir']) || !is_dir($this->config['temp_dir'])) 44 44 { 45 throw new \ Fuel_Exception("The temp directory that was given does not exist.");46 } 47 else if (!touch($this->config['temp_dir'] . $this->config['temp_append'] . '_touch'))48 { 49 throw new \ Fuel_Exception("Could not write in the temp directory.");45 throw new \RuntimeException("The temp directory that was given does not exist."); 46 } 47 elseif (!touch($this->config['temp_dir'] . $this->config['temp_append'] . '_touch')) 48 { 49 throw new \RuntimeException("Could not write in the temp directory."); 50 50 } 51 51 $this->exec('convert', '"'.$image_fullpath.'"[0] "'.$this->image_temp.'"'); … … 68 68 $image = '"'.$this->image_temp.'"'; 69 69 $this->exec('convert', "-define png:size=".$cwidth."x".$cheight." ".$image." ". 70 "-background none ".71 "-resize \"".($pad ? $width : $cwidth)."x".($pad ? $height : $cheight)."!\" ".72 "-gravity center ".73 "-extent ".$cwidth."x".$cheight." ".$image);70 "-background none ". 71 "-resize \"".($pad ? $width : $cwidth)."x".($pad ? $height : $cheight)."!\" ". 72 "-gravity center ". 73 "-extent ".$cwidth."x".$cheight." ".$image); 74 74 $this->clear_sizes(); 75 75 } … … 145 145 $this->exec('convert', $command); 146 146 } 147 147 148 148 protected function _grayscale() 149 149 { … … 182 182 $return = $this->sizes_cache; 183 183 } 184 184 185 return $return; 185 186 } … … 191 192 $this->run_queue(); 192 193 $this->add_background(); 193 194 194 195 $old = '"'.$this->image_temp.'"'; 195 196 $new = '"'.$filename.'"'; … … 197 198 198 199 if ($this->config['persistence'] === false) 200 { 199 201 $this->reload(); 202 } 200 203 201 204 return $this; … … 224 227 } 225 228 } 229 226 230 if ($this->config['persistence'] === false) 231 { 227 232 $this->reload(); 233 } 234 228 235 return $this; 229 236 } … … 254 261 * Executes the specified imagemagick executable and returns the output. 255 262 * 256 * @param string $program The name of the executable.257 * @param string $params The parameters of the executable.258 * @param boolean $passthru Returns the output if false or pass it to browser.259 * @return mixed Either returns the output or returns nothing.263 * @param string $program The name of the executable. 264 * @param string $params The parameters of the executable. 265 * @param boolean $passthru Returns the output if false or pass it to browser. 266 * @return mixed Either returns the output or returns nothing. 260 267 */ 261 268 private function exec($program, $params, $passthru = false) … … 264 271 $this->im_path = realpath($this->config['imagemagick_dir'].$program); 265 272 if ( ! $this->im_path) 273 { 266 274 $this->im_path = realpath($this->config['imagemagick_dir'].$program); 275 } 267 276 if ( ! $this->im_path) 277 { 268 278 $this->im_path = realpath($this->config['imagemagick_dir'].$program.'.exe'); 279 } 269 280 if ( ! $this->im_path) 270 throw new \Fuel_Exception("imagemagick executables not found in ".$this->config['imagemagick_dir']); 281 { 282 throw new \RuntimeException("imagemagick executables not found in ".$this->config['imagemagick_dir']); 283 } 284 271 285 $command = $this->im_path." ".$params; 272 286 $this->debug("Running command: <code>$command</code>"); … … 281 295 throw new \Fuel_Exception("imagemagick failed to edit the image. Returned with $code.<br /><br />Command:\n <code>$command</code>"); 282 296 } 297 283 298 return $output; 284 299 } … … 287 302 * Creates a new color usable by ImageMagick. 288 303 * 289 * @param string $hex The hex code of the color290 * @param integer $alpha The alpha of the color, 0 (trans) to 100 (opaque)291 * @return string rgba representation of the hex and alpha values.304 * @param string $hex The hex code of the color 305 * @param integer $alpha The alpha of the color, 0 (trans) to 100 (opaque) 306 * @return string rgba representation of the hex and alpha values. 292 307 */ 293 308 protected function create_color($hex, $alpha) -
trunk/fuel/core/classes/image/imagick.php
r78 r91 23 23 { 24 24 extract(parent::load($filename)); 25 25 26 26 if ($this->imagick == null) 27 { 27 28 $this->imagick = new \Imagick(); 28 29 } 30 29 31 $this->imagick->readImage($filename); 30 32 31 33 return $this; 32 34 } … … 48 50 { 49 51 extract(parent::_resize($width, $height, $keepar, $pad)); 50 52 51 53 $this->imagick->scaleImage($width, $height, $keepar); 52 54 53 55 if ($pad) 54 56 { … … 63 65 { 64 66 extract(parent::_rotate($degrees)); 65 67 66 68 $this->imagick->rotateImage($this->create_color('#000', 0), $degrees); 67 69 } … … 79 81 { 80 82 extract(parent::_border($size, $color)); 81 83 82 84 $this->imagick->borderImage($this->create_color($color, 100), $size, $size); 83 85 } … … 91 93 $this->imagick->compositeImage($wmimage, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); 92 94 } 93 95 94 96 protected function _rounded($radius, $sides, $antialias = 0) 95 97 { 96 98 extract(parent::_rounded($radius, $sides, null)); 97 99 98 100 $sizes = $this->sizes(); 99 101 $sizes->width_half = $sizes->width / 2; 100 102 $sizes->height_half = $sizes->height / 2; 101 103 102 104 if ( ! $tl) 103 105 { … … 105 107 $tlimage->cropImage($sizes->width_half, $sizes->height_half, 0, 0); 106 108 } 107 109 108 110 if ( ! $tr) 109 111 { … … 111 113 $trimage->cropImage($sizes->width_half, $sizes->height_half, $sizes->width_half, 0); 112 114 } 113 115 114 116 if ( ! $bl) 115 117 { … … 117 119 $blimage->cropImage($sizes->width_half, $sizes->height_half, 0, $sizes->height_half); 118 120 } 119 121 120 122 if ( ! $br) 121 123 { … … 123 125 $brimage->cropImage($sizes->width_half, $sizes->height_half, $sizes->width_half, $sizes->height_half); 124 126 } 125 127 126 128 $this->imagick->roundCorners($radius, $radius); 127 129 128 130 if ( ! $tl) 131 { 129 132 $this->imagick->compositeImage($tlimage, \Imagick::COMPOSITE_DEFAULT, 0, 0); 130 133 } 134 131 135 if ( ! $tr) 136 { 132 137 $this->imagick->compositeImage($trimage, \Imagick::COMPOSITE_DEFAULT, $sizes->width_half, 0); 133 138 } 139 134 140 if ( ! $bl) 141 { 135 142 $this->imagick->compositeImage($blimage, \Imagick::COMPOSITE_DEFAULT, 0, $sizes->height_half); 136 143 } 144 137 145 if ( ! $br) 146 { 138 147 $this->imagick->compositeImage($brimage, \Imagick::COMPOSITE_DEFAULT, $sizes->width_half, $sizes->height_half); 139 } 140 148 } 149 } 150 141 151 protected function _grayscale() 142 152 { … … 147 157 { 148 158 if ($filename === null) 159 { 149 160 return (object) array( 150 161 'width' => $this->imagick->getImageWidth(), 151 162 'height' => $this->imagick->getImageHeight() 152 163 ); 153 else 154 { 155 $tmpimage = new \Imagick(); 156 $tmpimage->readImage($filename); 157 return (object) array( 158 'width' => $tmpimage->getImageWidth(), 159 'height' => $tmpimage->getImageHeight() 160 ); 161 } 164 } 165 166 $tmpimage = new \Imagick(); 167 $tmpimage->readImage($filename); 168 return (object) array( 169 'width' => $tmpimage->getImageWidth(), 170 'height' => $tmpimage->getImageHeight() 171 ); 162 172 } 163 173 … … 165 175 { 166 176 extract(parent::save($filename, $permissions)); 167 177 168 178 $this->run_queue(); 169 179 $this->add_background(); 170 180 171 181 $filetype = $this->image_extension; 172 182 173 183 if ($this->imagick->getImageFormat() != $filetype) 184 { 174 185 $this->imagick->setImageFormat($filetype); 175 186 } 187 176 188 file_put_contents($filename, $this->imagick->getImageBlob()); 177 189 178 190 if ($this->config['persistence'] === false) 191 { 179 192 $this->reload(); 180 193 } 194 181 195 return $this; 182 196 } … … 185 199 { 186 200 extract(parent::output($filetype)); 187 201 188 202 $this->run_queue(); 189 203 $this->add_background(); 190 204 191 205 if ($this->imagick->getImageFormat() != $filetype) 206 { 192 207 $this->imagick->setImageFormat($filetype); 193 208 } 209 194 210 if ( ! $this->config['debug']) 211 { 195 212 echo $this->imagick->getImageBlob(); 196 213 } 214 197 215 return $this; 198 216 } … … 247 265 } 248 266 } 249 -
trunk/fuel/core/classes/input.php
r88 r91 130 130 131 131 // Do some final clean up of the uri 132 static::$detected_uri = \Security::clean_uri( str_replace(array('//', '../'), '/', $uri));132 static::$detected_uri = \Security::clean_uri($uri, true); 133 133 134 134 return static::$detected_uri; -
trunk/fuel/core/classes/request.php
r88 r91 133 133 134 134 /** 135 * Returns the current request is an HMVC request 136 * 137 * Usage: 138 * 139 * if (Request::is_hmvc()) 140 * { 141 * // Do something special... 142 * return; 143 * } 144 * 145 * @return bool 146 */ 147 public static function is_hmvc() 148 { 149 return static::active() !== static::main(); 150 } 151 152 /** 135 153 * Shows a 404. Checks to see if a 404_override route is set, if not show 136 154 * a default 404. -
trunk/fuel/core/classes/security.php
r87 r91 56 56 /** 57 57 * Cleans the request URI 58 */ 59 public static function clean_uri($uri) 58 * 59 * @param string $uri uri to clean 60 * @param bool $strict whether to remove relative directories 61 */ 62 public static function clean_uri($uri, $strict = false) 60 63 { 61 64 $filters = \Config::get('security.uri_filter', array()); 62 65 $filters = is_array($filters) ? $filters : array($filters); 66 67 $strict and $uri = preg_replace(array("/\.+\//", '/\/+/'), '/', $uri); 63 68 64 69 return static::clean($uri, $filters); … … 177 182 $value = htmlentities($value, ENT_COMPAT, \Fuel::$encoding, false); 178 183 } 179 elseif (is_array($value) || $value instanceof \Iterator || get_class($value) == 'stdClass')184 elseif (is_array($value) or ($value instanceof \Iterator and $value instanceof \ArrayAccess)) 180 185 { 181 186 // Add to $already_cleaned variable when object … … 185 190 { 186 191 $value[$k] = static::htmlentities($v); 192 } 193 } 194 elseif ($value instanceof \Iterator or get_class($value) == 'stdClass') 195 { 196 // Add to $already_cleaned variable 197 $already_cleaned[] = $value; 198 199 foreach ($value as $k => $v) 200 { 201 $value->{$k} = static::htmlentities($v); 187 202 } 188 203 } -
trunk/fuel/core/classes/str.php
r78 r91 157 157 ? mb_strtolower(mb_substr($str, 0, 1, $encoding), $encoding). 158 158 mb_substr($str, 1, mb_strlen($str, $encoding), $encoding) 159 : ucfirst($str);159 : lcfirst($str); 160 160 } 161 161 -
trunk/fuel/core/classes/upload.php
r90 r91 365 365 366 366 // determine the validate status 367 $valid = true;367 $valid = false; 368 368 foreach(static::$files as $key => $value) 369 369 { 370 if ($value['error'] !== 0)371 { 372 $valid = false;370 if ($value['error'] == 0) 371 { 372 $valid = true; 373 373 break; 374 374 } -
trunk/fuel/core/classes/validation.php
r87 r91 320 320 { 321 321 $value = $this->input($field->name); 322 if ($allow_partial && $value === null) 322 if (($allow_partial === true and $value === null) 323 or (is_array($allow_partial) and ! in_array($field->name, $allow_partial))) 323 324 { 324 325 continue; … … 393 394 ? get_class(@$callback[0]).'->'.@$callback[1] 394 395 : @$callback[0].'::'.@$callback[1]); 395 Error::notice('Invalid rule "'.$string.'" passed to Validation, not used.');396 \Error::notice('Invalid rule "'.$string.'" passed to Validation, not used.'); 396 397 return false; 397 398 } -
trunk/fuel/core/config/cache.php
r64 r91 62 62 ), 63 63 64 // specific configuration settings for the apc driver 65 'apc' => array( 66 'cache_id' => 'fuel', // unique id to distinquish fuel cache items from others stored on the same server(s) 67 ), 68 64 69 // specific configuration settings for the redis driver 65 70 'redis' => array( -
trunk/fuel/core/tests/arr.php
r64 r91 72 72 $this->assertEquals($expected, $output); 73 73 } 74 75 /** 76 * Tests Arr::key_exists() 77 * 78 * @test 79 * @dataProvider person_provider 80 */ 81 public function test_key_exists_with_key_found($person) 82 { 83 $expected = true; 84 $output = Arr::key_exists($person, "name"); 85 $this->assertEquals($expected, $output); 86 } 87 88 /** 89 * Tests Arr::key_exists() 90 * 91 * @test 92 * @dataProvider person_provider 93 */ 94 public function test_key_exists_with_key_not_found($person) 95 { 96 $expected = false; 97 $output = Arr::key_exists($person, "unknown"); 98 $this->assertEquals($expected, $output); 99 } 100 101 /** 102 * Tests Arr::key_exists() 103 * 104 * @test 105 * @dataProvider person_provider 106 */ 107 public function test_key_exists_with_dot_separated_key($person) 108 { 109 $expected = true; 110 $output = Arr::key_exists($person, "location.city"); 111 $this->assertEquals($expected, $output); 112 } 74 113 75 114 /** -
trunk/fuel/packages/auth/classes/auth/login/simpleauth.php
r88 r91 67 67 if (is_null($this->user) or ($this->user['username'] != $username and $this->user != static::$guest_login)) 68 68 { 69 $this->user = \DB::select ()69 $this->user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 70 70 ->where('username', '=', $username) 71 71 ->from(\Config::get('simpleauth.table_name')) 72 ->execute( )->current();72 ->execute(\Config::get('simpleauth.db_connection'))->current(); 73 73 } 74 74 … … 103 103 104 104 $password = $this->hash_password($password); 105 $this->user = \DB::select ()105 $this->user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 106 106 ->where_open() 107 107 ->where('username', '=', $username_or_email) … … 110 110 ->where('password', '=', $password) 111 111 ->from(\Config::get('simpleauth.table_name')) 112 ->execute( )->current();112 ->execute(\Config::get('simpleauth.db_connection'))->current(); 113 113 114 114 if ($this->user == false) … … 141 141 } 142 142 143 $this->user = \DB::select ()143 $this->user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 144 144 ->where_open() 145 145 ->where('username', '=', $username_or_email) … … 147 147 ->where_close() 148 148 ->from(\Config::get('simpleauth.table_name')) 149 ->execute( )149 ->execute(\Config::get('simpleauth.db_connection')) 150 150 ->current(); 151 151 … … 195 195 } 196 196 197 $same_users = \DB::select ()197 $same_users = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 198 198 ->where('username', '=', $username) 199 199 ->or_where('email', '=', $email) 200 200 ->from(\Config::get('simpleauth.table_name')) 201 ->execute( );201 ->execute(\Config::get('simpleauth.db_connection')); 202 202 203 203 if ($same_users->count() > 0) … … 222 222 $result = \DB::insert(\Config::get('simpleauth.table_name')) 223 223 ->set($user) 224 ->execute( );224 ->execute(\Config::get('simpleauth.db_connection')); 225 225 226 226 return ($result[1] > 0) ? $result[0] : false; … … 238 238 { 239 239 $username = $username ?: $this->user['username']; 240 $current_values = \DB::select ()240 $current_values = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 241 241 ->where('username', '=', $username) 242 ->from(\Config::get('simpleauth.table_name'))->execute(); 242 ->from(\Config::get('simpleauth.table_name')) 243 ->execute(\Config::get('simpleauth.db_connection')); 243 244 244 245 if (empty($current_values)) … … 307 308 ->set($update) 308 309 ->where('username', '=', $username) 309 ->execute( );310 ->execute(\Config::get('simpleauth.db_connection')); 310 311 311 312 // Refresh user 312 313 if ($this->user['username'] == $username) 313 314 { 314 $this->user = \DB::select ()315 $this->user = \DB::select_array(\Config::get('simpleauth.table_columns', array('*'))) 315 316 ->where('username', '=', $username) 316 317 ->from(\Config::get('simpleauth.table_name')) 317 ->execute( )->current();318 ->execute(\Config::get('simpleauth.db_connection'))->current(); 318 319 } 319 320 … … 357 358 $affected_rows = \DB::delete(\Config::get('simpleauth.table_name')) 358 359 ->where('username', '=', $username) 359 ->execute( );360 ->execute(\Config::get('simpleauth.db_connection')); 360 361 361 362 return $affected_rows > 0; … … 379 380 \DB::update(\Config::get('simpleauth.table_name')) 380 381 ->set(array('last_login' => $last_login, 'login_hash' => $login_hash)) 381 ->where('username', '=', $this->user['username'])->execute(); 382 ->where('username', '=', $this->user['username']) 383 ->execute(\Config::get('simpleauth.db_connection')); 382 384 383 385 $this->user['login_hash'] = $login_hash; -
trunk/fuel/packages/auth/config/simpleauth.php
r88 r91 23 23 24 24 /** 25 * DB connection, leave null to use default 26 */ 27 'db_connection' => null, 28 29 /** 25 30 * DB table name for the user table 26 31 */ 27 32 'table_name' => 'users', 33 34 /** 35 * Choose which columns are selected, must include: username, password, email, last_login, 36 * login_hash, group & profile_fields 37 */ 38 'table_columns' => array('*'), 28 39 29 40 /** … … 62 73 */ 63 74 'login_hash_salt' => 'put_some_salt_in_here', 64 75 65 76 /** 66 77 * $_POST key for login username 67 78 */ 68 79 'username_post_key' => 'username', 69 80 70 81 /** 71 82 * $_POST key for login password -
trunk/fuel/packages/oil/classes/command.php
r51 r91 140 140 \Cli::option('coverage-html') and $command .= ' --coverage-html '.\Cli::option('coverage-html'); 141 141 142 passthru($command); 142 foreach(explode(';', $command) as $c) 143 { 144 passthru($c); 145 } 143 146 144 147 break; -
trunk/fuel/packages/oil/views/default/scaffold/ar_model.php
r51 r91 13 13 14 14 } 15 16 /* End of file <?php echo Str::lower($name); ?>.php */ -
trunk/fuel/packages/oil/views/default/scaffold/controller.php
r59 r91 12 12 13 13 } 14 15 /* End of file <?php echo $controller_uri; ?>.php */ -
trunk/fuel/packages/orm/classes/observer/validation.php
r87 r91 103 103 $val = static::set_fields($obj)->validation(); 104 104 105 // only allow partial validation on updates, specify the fields for updates to allow null 106 $allow_partial = $obj->is_new() ? false : array(); 107 105 108 $input = array(); 106 109 foreach (array_keys($obj->properties()) as $p) 107 110 { 108 ! in_array($p, $obj->primary_key()) and $obj->is_changed($p) and $input[$p] = $obj->{$p}; 111 if ( ! in_array($p, $obj->primary_key()) and $obj->is_changed($p)) 112 { 113 $input[$p] = $obj->{$p}; 114 is_array($allow_partial) and $allow_partial[] = $p; 115 } 109 116 } 110 117 111 if ( ! empty($input) and $val->run($input, true, array($obj)) === false)118 if ( ! empty($input) and $val->run($input, $allow_partial, array($obj)) === false) 112 119 { 113 120 throw new ValidationFailed($val->show_errors()); -
trunk/fuel/packages/orm/classes/query.php
r88 r91 62 62 63 63 /** 64 * @var int max number of returned rows64 * @var int max number of returned base model instances 65 65 */ 66 66 protected $limit; 67 67 68 68 /** 69 * @var int offset 69 * @var int offset of base model table 70 70 */ 71 71 protected $offset; 72 73 /** 74 * @var int max number of requested rows 75 */ 76 protected $rows_limit; 77 78 /** 79 * @var int offset of requested rows 80 */ 81 protected $rows_offset; 72 82 73 83 /** … … 146 156 $this->offset($val); 147 157 break; 158 case 'rows_limit': 159 $this->rows_limit($val); 160 break; 161 case 'rows_offset': 162 $this->rows_offset($val); 163 break; 148 164 } 149 165 } … … 225 241 { 226 242 $this->offset = intval($offset); 243 244 return $this; 245 } 246 247 /** 248 * Set the limit of rows requested 249 * 250 * @param int 251 */ 252 public function rows_limit($limit) 253 { 254 $this->rows_limit = intval($limit); 255 256 return $this; 257 } 258 259 /** 260 * Set the offset of rows requested 261 * 262 * @param int 263 */ 264 public function rows_offset($offset) 265 { 266 $this->rows_offset = intval($offset); 227 267 228 268 return $this; … … 701 741 } 702 742 743 // Set the row limit and offset, these are applied to the outer query when a subquery 744 // is used or overwrite limit/offset when it's a normal query 745 ! is_null($this->rows_limit) and $query->limit($this->rows_limit); 746 ! is_null($this->rows_offset) and $query->offset($this->rows_offset); 747 703 748 return array('query' => $query, 'models' => $models); 704 749 }
Note: See TracChangeset
for help on using the changeset viewer.
