Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezpackageoperator.php
Go to the documentation of this file.
1 <?php
17 class eZPackageOperator
18 {
24 public function __construct( $name = 'ezpackage' )
25 {
26 $this->Operators = array( $name );
27 }
28
32 function operatorList()
33 {
34 return $this->Operators;
35 }
36
40 function namedParameterList()
41 {
42 return array( 'class' => array( 'type' => 'string',
43 'required' => true,
44 'default' => false ),
45 'data' => array( 'type' => 'string',
46 'required' => false,
47 'default' => false ) );
48 }
49
50 function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
51 {
52 $package = $operatorValue;
53 $class = $namedParameters['class'];
54 switch ( $class )
55 {
56 case 'thumbnail':
57 {
58 if ( $operatorValue instanceof eZPackage )
59 {
60 if ( !is_array( $fileList = $operatorValue->fileList( 'default' ) ) )
61 $fileList = array();
62 foreach ( $fileList as $file )
63 {
64 $fileType = $file["type"];
65 if ( $fileType == 'thumbnail' )
66 {
67 $operatorValue = $operatorValue->fileItemPath( $file, 'default' );
68 return;
69 }
70 }
71 $operatorValue = false;
72 }
73 } break;
74
75 case 'filepath':
76 {
77 if ( $operatorValue instanceof eZPackage )
78 {
79 $variableName = $namedParameters['data'];
80 $fileList = $operatorValue->fileList( 'default' );
81 foreach ( $fileList as $file )
82 {
83 $fileIdentifier = $file["variable-name"];
84 if ( $fileIdentifier == $variableName )
85 {
86 $operatorValue = $operatorValue->fileItemPath( $file, 'default' );
87 return;
88 }
89 }
90 $tpl->error( $operatorName,
91 "No filepath found for variable $variableName in package " . $package->attribute( 'name' ) );
92 $operatorValue = false;
93 }
94 } break;
95
96 case 'fileitempath':
97 {
98 if ( $operatorValue instanceof eZPackage )
99 {
100 $fileItem = $namedParameters['data'];
101 $operatorValue = $operatorValue->fileItemPath( $fileItem, 'default' );
102 }
103 } break;
104
105 case 'documentpath':
106 {
107 if ( $package instanceof eZPackage )
108 {
109 $documentName = $namedParameters['data'];
110 $documentList = $package->attribute( 'documents' );
111 foreach ( array_keys( $documentList ) as $key )
112 {
113 $document =& $documentList[$key];
114 $name = $document["name"];
115 if ( $name == $documentName )
116 {
117 $documentFilePath = $package->path() . '/' . eZPackage::documentDirectory() . '/' . $document['name'];
118 $operatorValue = $documentFilePath;
119 return;
120 }
121 }
122 $tpl->error( $operatorName,
123 "No documentpath found for document $documentName in package " . $package->attribute( 'name' ) );
124 $operatorValue = false;
125 }
126 } break;
127
128 case 'dirpath':
129 {
130 $dirPath = $operatorValue->currentRepositoryPath() . "/" . $operatorValue->attribute( 'name' );
131 $operatorValue = $dirPath;
132 } break;
133
134 default:
135 $tpl->error( $operatorName, "Unknown package operator name: '$class'" );
136 break;
137 }
138 }
140 public $Operators;
141 }
142
143 ?>
eZPackageOperator
The class eZPackageOperator does.
Definition: ezpackageoperator.php:18
eZPackageOperator\__construct
__construct( $name='ezpackage')
Definition: ezpackageoperator.php:24
eZPackageOperator\$Operators
$Operators
Definition: ezpackageoperator.php:140
eZPackageOperator\modify
modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
Definition: ezpackageoperator.php:50
eZPackageOperator\operatorList
operatorList()
Definition: ezpackageoperator.php:32
eZPackageOperator\namedParameterList
namedParameterList()
Definition: ezpackageoperator.php:40
eZPackage
Maintains eZ Publish packages.
Definition: ezpackage.php:20
eZPackage\documentDirectory
static documentDirectory()
Definition: ezpackage.php:1536
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.