예제 #1
0
 /**
  * Returns a shared instance of the eZShopAccountHandler class
  * as defined in shopaccount.ini[HandlerSettings]Repositories
  * and ExtensionRepositories.
  *
  * @return eZDefaultShopAccountHandler Or similar clases.
  */
 static function instance()
 {
     $accountHandler = null;
     if ( eZExtension::findExtensionType( array( 'ini-name' => 'shopaccount.ini',
                                                 'repository-group' => 'HandlerSettings',
                                                 'repository-variable' => 'Repositories',
                                                 'extension-group' => 'HandlerSettings',
                                                 'extension-variable' => 'ExtensionRepositories',
                                                 'type-group' => 'AccountSettings',
                                                 'type-variable' => 'Handler',
                                                 'alias-group' => 'AccountSettings',
                                                 'alias-variable' => 'Alias',
                                                 'subdir' => 'shopaccounthandlers',
                                                 'type-directory' => false,
                                                 'extension-subdir' => 'shopaccounthandlers',
                                                 'suffix-name' => 'shopaccounthandler.php' ),
                                          $out ) )
     {
         $filePath = $out['found-file-path'];
         include_once( $filePath );
         $class = $out['type'] . 'ShopAccountHandler';
         $accountHandler = new $class( );
     }
     else
     {
         $accountHandler = new eZDefaultShopAccountHandler();
     }
     return $accountHandler;
 }
예제 #2
0
 static function create( $analyzerName )
 {
     $analyzerData = eZImageAnalyzer::analyzerData();
     if ( !isset( $analyzerData['handlers'][$analyzerName] ) )
     {
         if ( eZExtension::findExtensionType( array( 'ini-name' => 'image.ini',
                                                     'repository-group' => 'AnalyzerSettings',
                                                     'repository-variable' => 'RepositoryList',
                                                     'extension-group' => 'AnalyzerSettings',
                                                     'extension-variable' => 'ExtensionList',
                                                     'extension-subdir' => 'imageanalyzer',
                                                     'alias-group' => 'AnalyzerSettings',
                                                     'alias-variable' => 'ImageAnalyzerAlias',
                                                     'suffix-name' => 'imageanalyzer.php',
                                                     'type-directory' => false,
                                                     'type' => $analyzerName ),
                                              $result ) )
         {
             $filepath = $result['found-file-path'];
             include_once( $filepath );
             $className = $result['type'] . 'imageanalyzer';
             $analyzerData['handlers'][$analyzerName] = array( 'classname' => $className,
                                                               'filepath' => $filepath );
         }
         else
         {
             eZDebug::writeWarning( "Could not locate Image Analyzer for $analyzerName", __METHOD__ );
         }
     }
     if ( isset( $analyzerData['handlers'][$analyzerName] ) )
     {
         $analyzer = $analyzerData['handlers'][$analyzerName];
         $className = $analyzer['classname'];
         if ( class_exists( $className ) )
         {
             return new $className();
         }
         else
         {
             eZDebug::writeWarning( "The Image Analyzer class $className was not found, cannot create analyzer", __METHOD__ );
         }
     }
     return false;
 }
예제 #3
0
    function metaData()
    {
        $metaData = "";
        $binaryINI = eZINI::instance( 'binaryfile.ini' );

        $handlerSettings = $binaryINI->variable( 'HandlerSettings', 'MetaDataExtractor' );

        if ( isset( $handlerSettings[$this->MimeType] ) )
        {
            // Check if plugin exists
            if ( eZExtension::findExtensionType( array( 'ini-name' => 'binaryfile.ini',
                                                    'repository-group' => 'HandlerSettings',
                                                    'repository-variable' => 'Repositories',
                                                    'extension-group' => 'HandlerSettings',
                                                    'extension-variable' => 'ExtensionRepositories',
                                                    'type-directory' => false,
                                                    'type' => $handlerSettings[$this->MimeType],
                                                    'subdir' => 'plugins',
                                                    'extension-subdir' => 'plugins',
                                                    'suffix-name' => 'parser.php' ),
                                             $out ) )
            {
                $filePath = $out['found-file-path'];
                include_once( $filePath );
                $class = $handlerSettings[$this->MimeType] . 'Parser';

                $parserObject = new $class( );
                $fileInfo = $this->storedFileInfo();

                $file = eZClusterFileHandler::instance( $fileInfo['filepath'] );
                if ( $file->exists() )
                {
                    $fetchedFilePath = $file->fetchUnique();
                    $metaData = $parserObject->parseFile( $fetchedFilePath );
                    $file->fileDeleteLocal( $fetchedFilePath );
                }
            }
            else
            {
                eZDebug::writeWarning( "Plugin for $this->MimeType was not found", 'eZBinaryFile' );
            }
        }
        else
        {
            eZDebug::writeWarning( "Mimetype $this->MimeType not supported for indexing", 'eZBinaryFile' );
        }

        return $metaData;
    }