Development

Changeset 26477

You must first sign up to be able to contribute.

Changeset 26477

Show
Ignore:
Timestamp:
01/11/10 16:39:55 (3 years ago)
Author:
thaberkern
Message:

[sfAmfPlugin] Added first version of a Service-Browser. Set version to 1.5.0

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAmfPlugin/README

    r26472 r26477  
    111111      } 
    112112 
     113AMF-Service Browser 
     114------------------- 
     115 
     116You can call a AMF-Service-Browser to test your Service-Classes. The Plugin contains a Service-Browser to do so.  
     117For that just enable the module in the settings.yml of your application: 
     118 
     119    [yaml] 
     120      enabled_modules:  [default, amfbrowser] 
     121     
     122Please keep in mind that you should activate this module only for the DEV-Environment. Otherwise you will create 
     123a big security issue for your application.  
     124After you have added the browser to your enabled_modules run the following symfony commands: 
     125 
     126    $ symfony cc 
     127  $ symfony plugin:publish-assets sfAmfPlugin 
     128 
     129Now you can call the Service-Browser via calling http://host/amfbrowser 
     130     
    113131ORM-Support 
    114132----------- 
     
    207225  * Task for creating VO ActionScript classes from Doctrine or Propel classes 
    208226  * Support for Doctrine nested sets 
     227  * Caching 
    209228  
    210229I like to hear from you! Maybe you have an idea how to enhance the plugin. Just send me an email!  
     
    216235    * Added Support for Symfony 1.3 and 1.4 
    217236  * Updated to most current development version of SabreAMF 
    218    
     237  * Added first version of an AMF service browser (thanks to Beno�Gouchet) 
    219238  * 1.4.2 (08-05-2009) 
    220239    * Changed error_handler behaviour 
  • plugins/sfAmfPlugin/lib/sfAmfGateway.class.php

    r20807 r26477  
    114114            } 
    115115            else if(file_exists($lib_dir.$service_class_path.'.php')) { 
    116                     $service_path = $lib_dir.$service_class_path.'.php'; 
    117                     break; 
    118                
     116                $service_path = $lib_dir.$service_class_path.'.php'; 
     117                break; 
     118           
    119119        } 
    120120 
     
    139139 
    140140        $result = call_user_func_array( 
    141             array($instance, 'run'), 
    142             array($method_name, $arguments) 
     141                array($instance, 'run'), 
     142                array($method_name, $arguments) 
    143143        ); 
    144144 
     
    161161    } 
    162162 
     163    /** 
     164     * 
     165     * @return array of ReflectionClass : Services 
     166     */ 
     167    public function parseAllServices() { 
     168        $files_paths = array(); 
     169 
     170        foreach($this->getProjectLibDirectories() as $dir) { 
     171            $files_paths = array_merge($files_paths, $this->servicesRecursiveSearch($dir.DIRECTORY_SEPARATOR.'services')); 
     172        } 
     173 
     174        $reflection_classes = array(); 
     175 
     176        foreach ($files_paths as $path) { 
     177            $class_name = $this->getClassName($path); 
     178            $full_package_name = $this->getPackageName($path); 
     179 
     180            require_once $path; 
     181            $reflection_classes[$full_package_name] = new ReflectionClass($class_name); 
     182        } 
     183 
     184        return $reflection_classes; 
     185    } 
     186 
     187    protected function getClassName($path) { 
     188        $class_name = basename($path, ".php"); 
     189        $class_name = basename($class_name, ".class"); 
     190 
     191        return $class_name; 
     192    } 
     193 
     194    protected function getPackageName($path) { 
     195        $result = $path; 
     196 
     197        foreach($this->getProjectLibDirectories() as $dir) { 
     198            $result = str_replace($dir.DIRECTORY_SEPARATOR.'services', '', $result); 
     199        } 
     200 
     201        if ($result[0] == DIRECTORY_SEPARATOR) { 
     202            // Remove leading slashes 
     203            $result = substr($result, 1); 
     204        } 
     205 
     206        $class_name = $this->getClassName($path); 
     207 
     208        $parts = explode(DIRECTORY_SEPARATOR, $result); 
     209        array_pop($parts); 
     210        $package_name = implode('.', $parts).'.'.$class_name; 
     211        return $package_name; 
     212    } 
     213     
     214    protected function servicesRecursiveSearch($dir) { 
     215        $files_paths = array_merge(glob($dir.DIRECTORY_SEPARATOR.'*Service.php'), 
     216                glob($dir.DIRECTORY_SEPARATOR.'*Service.class.php')); 
     217 
     218        $children_dirs = glob($dir.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR); 
     219 
     220        foreach ($children_dirs as $child_dir) 
     221            $files_paths = array_merge($files_paths, $this->servicesRecursiveSearch($child_dir)); 
     222 
     223        return $files_paths; 
     224    } 
     225 
    163226 
    164227    /** 
     
    173236     */ 
    174237    protected function getProjectLibDirectories() { 
    175     // get the application lib directories 
     238        // get the application lib directories 
    176239        $lib_dirs = sfContext::getInstance()->getConfiguration()->getLibDirs(sfConfig::get('sf_app')); 
    177240 
     
    184247        // get the plugin lib dirs 
    185248        $lib_dirs = array_merge($lib_dirs, 
    186             sfContext::getInstance()-> 
    187             getConfiguration()-> 
    188             getPluginSubPaths('/lib')); 
     249                sfContext::getInstance()-> 
     250                getConfiguration()-> 
     251                getPluginSubPaths('/lib')); 
    189252 
    190253        return $lib_dirs; 
  • plugins/sfAmfPlugin/package.xml

    r26472 r26477  
    1111  <active>yes</active> 
    1212 </lead> 
    13  <date>2009-08-05</date> 
     13 <date>2010-01-11</date> 
    1414 <version> 
    15   <release>1.4.2</release> 
     15  <release>1.5.0</release> 
    1616  <api>1.0.0</api> 
    1717 </version> 
     
    7979   <file name="lib/sfAmfGateway.class.php" role="data"/> 
    8080   <file name="lib/sfAmfService.php" role="data"/> 
     81   <file name="lib/sfAmfTreeViewer.php" role="data"/> 
     82   <file name="modules/amfbrowser/actions/actions.class.php" role="data"/> 
     83   <file name="modules/amfbrowser/templates/indexSuccess.php" role="data"/> 
     84   <file name="modules/amfgateway/actions/actions.class.php" role="data"/> 
     85   <file name="modules/amfgateway/config/security.yml" role="data"/> 
    8186   <file name="config/autoload.yml" role="data"/> 
    82    <file name="config/config.php" role="data"/> 
     87   <file name="config/sfAmfPluginConfiguration.class.php" role="data"/> 
     88   <file name="web/css/sfAmfPluginBrowser.css" role="data"/> 
     89   <file name="web/js/sfAmfPluginBrowser.js" role="data"/> 
     90   <file name="web/js/mootools-core.js" role="data"/> 
     91   <file name="web/js/mootools-more.js" role="data"/> 
    8392   <file name="LICENSE" role="data"/> 
    8493   <file name="README" role="data"/> 
     
    97106    <channel>pear.symfony-project.com</channel> 
    98107    <min>1.1.0</min> 
    99     <max>1.3.0</max> 
    100     <exclude>1.3.0</exclude> 
     108    <max>2.0.0</max> 
     109    <exclude>2.0.0</exclude> 
    101110   </package> 
    102111  </required> 
     
    104113 <phprelease/> 
    105114 <changelog> 
     115  <release> 
     116    <version> 
     117     <release>1.5.0</release> 
     118     <api>1.0.0</api> 
     119    </version> 
     120    <stability> 
     121     <release>stable</release> 
     122     <api>stable</api> 
     123    </stability> 
     124   <date>2010-01-11</date> 
     125   <license>MIT License</license> 
     126   <notes>* Released for Symfony 1.3 and 1.4 
     127 * Added first version of an AMF Service Browser (thanks to Benoit Gouchet) 
     128 * Updated SabreAmf to current version</notes> 
     129  </release> 
    106130  <release> 
    107131    <version>