Changeset 174

Show
Ignore:
Timestamp:
04/09/07 16:12:38 (2 years ago)
Author:
bermiferrer
Message:

Avoiding pathinfo usage in favor of simpler substr+strrchr. Closes #40

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/AkImage.php

    r41 r174  
    3131     { 
    3232         $this->Transform =& Image_Transform::factory($tranform_using); 
     33         if (PEAR::isError($this->Transform)){ 
     34             trigger_error($this->Transform->getMessage(), E_USER_ERROR); 
     35         } 
    3336         if(!empty($image_path)){ 
    3437             $this->load($image_path); 
     
    4952          
    5053         $path = empty($path) ? $this->image_path : $path; 
    51          $this->Transform->save($tmp_image_name, array_pop(pathinfo($path)), $quality);          
     54         $this->Transform->save($tmp_image_name, $this->getExtension($path), $quality);          
    5255         Ak::file_put_contents($path, file_get_contents($tmp_image_name), $options); 
    5356         @unlink($tmp_image_name); 
     
    7174     } 
    7275 
    73      function getExtension(
     76     function getExtension($path = null
    7477     { 
    75          return array_pop(pathinfo($this->image_path)); 
     78         return substr(strrchr(empty($path) ? $this->image_path : $path, '.'), 1); 
    7679     } 
    7780 
  • trunk/script/generators/controller/templates/fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'controllers'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'controllers'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/script/generators/controller/templates/helper_fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'helpers'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'helpers'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/script/generators/model/templates/installer_fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'installers'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'installers'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/script/generators/model/templates/model_fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'models'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'models'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/script/generators/scaffold/templates/installer_fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'installers'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'installers'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/script/generators/scaffold/templates/model_fixture.tpl

    r155 r174  
    11<?php  echo '<?php'?> 
    22 
    3 require_once(AK_BASE_DIR.DS.'app'.DS.'models'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     3require_once(AK_BASE_DIR.DS.'app'.DS.'models'.DS.substr(strrchr(__FILE__, DS), 1)); 
    44 
    55?> 
  • trunk/test/fixtures/app/shared_model.php

    r48 r174  
    11<?php 
    2 require_once(AK_BASE_DIR.DS.'app'.DS.array_shift(array_slice(pathinfo(__FILE__),1,1))); 
     2require_once(AK_BASE_DIR.DS.'app'.DS.substr(strrchr(__FILE__, DS), 1)); 
    33 
    44?>