repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
ezsystems/ezpublish-legacy
kernel/classes/ezvatrule.php
eZVatRule.productCategoriesNames
function productCategoriesNames() { $catNames = array(); $categories = $this->attribute( 'product_categories' ); if ( $categories ) { foreach ( $categories as $cat ) $catNames[] = $cat['name']; } return $catNames; }
php
function productCategoriesNames() { $catNames = array(); $categories = $this->attribute( 'product_categories' ); if ( $categories ) { foreach ( $categories as $cat ) $catNames[] = $cat['name']; } return $catNames; }
[ "function", "productCategoriesNames", "(", ")", "{", "$", "catNames", "=", "array", "(", ")", ";", "$", "categories", "=", "$", "this", "->", "attribute", "(", "'product_categories'", ")", ";", "if", "(", "$", "categories", ")", "{", "foreach", "(", "$",...
Return names of product categories associated with the rule. \private
[ "Return", "names", "of", "product", "categories", "associated", "with", "the", "rule", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezvatrule.php#L267-L279
train
ezsystems/ezpublish-legacy
kernel/classes/ezvatrule.php
eZVatRule.removeProductCategories
function removeProductCategories( $ruleID = false ) { if ( $ruleID === false ) $ruleID = $this->ID; $ruleID =(int) $ruleID; $db = eZDB::instance(); $db->query( "DELETE FROM ezvatrule_product_category WHERE vatrule_id = $ruleID" ); }
php
function removeProductCategories( $ruleID = false ) { if ( $ruleID === false ) $ruleID = $this->ID; $ruleID =(int) $ruleID; $db = eZDB::instance(); $db->query( "DELETE FROM ezvatrule_product_category WHERE vatrule_id = $ruleID" ); }
[ "function", "removeProductCategories", "(", "$", "ruleID", "=", "false", ")", "{", "if", "(", "$", "ruleID", "===", "false", ")", "$", "ruleID", "=", "$", "this", "->", "ID", ";", "$", "ruleID", "=", "(", "int", ")", "$", "ruleID", ";", "$", "db", ...
Remove product categories with the rule from DB. \private \note Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
[ "Remove", "product", "categories", "with", "the", "rule", "from", "DB", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezvatrule.php#L323-L330
train
ezsystems/ezpublish-legacy
kernel/classes/ezvatrule.php
eZVatRule.removeReferencesToProductCategory
static function removeReferencesToProductCategory( $cartegoryID ) { $db = eZDB::instance(); $query = "DELETE FROM ezvatrule_product_category WHERE product_category_id=" . (int) $cartegoryID; $db->query( $query ); }
php
static function removeReferencesToProductCategory( $cartegoryID ) { $db = eZDB::instance(); $query = "DELETE FROM ezvatrule_product_category WHERE product_category_id=" . (int) $cartegoryID; $db->query( $query ); }
[ "static", "function", "removeReferencesToProductCategory", "(", "$", "cartegoryID", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "query", "=", "\"DELETE FROM ezvatrule_product_category WHERE product_category_id=\"", ".", "(", "int", ")", "...
Remove references to the given product category. \public \static \note Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
[ "Remove", "references", "to", "the", "given", "product", "category", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezvatrule.php#L340-L345
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/clear_routes.php
ezpRestRoutesCacheClear.clearCache
public static function clearCache() { $expiryHandler = eZExpiryHandler::instance(); if( $expiryHandler->hasTimestamp( ezpRestRouter::ROUTE_CACHE_KEY ) ) { $expiryHandler->setTimestamp( ezpRestRouter::ROUTE_CACHE_KEY, 0 ); $expiryHandler->store(); } }
php
public static function clearCache() { $expiryHandler = eZExpiryHandler::instance(); if( $expiryHandler->hasTimestamp( ezpRestRouter::ROUTE_CACHE_KEY ) ) { $expiryHandler->setTimestamp( ezpRestRouter::ROUTE_CACHE_KEY, 0 ); $expiryHandler->store(); } }
[ "public", "static", "function", "clearCache", "(", ")", "{", "$", "expiryHandler", "=", "eZExpiryHandler", "::", "instance", "(", ")", ";", "if", "(", "$", "expiryHandler", "->", "hasTimestamp", "(", "ezpRestRouter", "::", "ROUTE_CACHE_KEY", ")", ")", "{", "...
Force Route cache expiration, so that APC cache will be flushed and regenerated next REST call
[ "Force", "Route", "cache", "expiration", "so", "that", "APC", "cache", "will", "be", "flushed", "and", "regenerated", "next", "REST", "call" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/clear_routes.php#L20-L28
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/cluster.php
ezpRestCacheStorageCluster.restore
public function restore( $id, $attributes = array(), $search = false ) { // If cache is explicitely disabled, we don't try to process it if( $this->isCacheEnabled === false ) { return false; } $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); $result = $this->clusterCacheFile->processCache( array( $this, 'clusterRetrieve' ), null, // We won't call any generate callback as we're using ezcCache mechanism, so it's up to the cache caller to generate $this->properties['options']['ttl'], null, compact( 'id', 'attributes', 'fileName' ) ); if ( !$result instanceof eZClusterFileFailure ) { return $result; } return false; }
php
public function restore( $id, $attributes = array(), $search = false ) { // If cache is explicitely disabled, we don't try to process it if( $this->isCacheEnabled === false ) { return false; } $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); $result = $this->clusterCacheFile->processCache( array( $this, 'clusterRetrieve' ), null, // We won't call any generate callback as we're using ezcCache mechanism, so it's up to the cache caller to generate $this->properties['options']['ttl'], null, compact( 'id', 'attributes', 'fileName' ) ); if ( !$result instanceof eZClusterFileFailure ) { return $result; } return false; }
[ "public", "function", "restore", "(", "$", "id", ",", "$", "attributes", "=", "array", "(", ")", ",", "$", "search", "=", "false", ")", "{", "// If cache is explicitely disabled, we don't try to process it", "if", "(", "$", "this", "->", "isCacheEnabled", "===",...
Restore data from the cache. Restores the data associated with the given cache and returns it. Please see {@link ezcCacheStorage::store()} for more detailed information of cachable datatypes. During access to cached data the caches are automatically expired. This means, that the ezcCacheStorage object checks before returning the data if it's still actual. If the cache has expired, data will be deleted and false is returned. You should always provide the attributes you assigned, although the cache storages must be able to find a cache ID even without them. BEWARE: Finding cache data only by ID can be much slower than finding it by ID and attributes. @param string $id The item ID. @param array(string=>string) $attributes Attributes that describe the cached data. @param bool $search Whether to search for items if not found directly. Default is false. @return mixed The cached data on success, otherwise false.
[ "Restore", "data", "from", "the", "cache", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/cluster.php#L105-L130
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/cluster.php
ezpRestCacheStorageCluster.delete
public function delete( $id = null, $attributes = array(), $search = false ) { if ( !isset( $this->clusterCacheFile ) ) { $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); } $this->clusterCacheFile->purge(); return $id; }
php
public function delete( $id = null, $attributes = array(), $search = false ) { if ( !isset( $this->clusterCacheFile ) ) { $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); } $this->clusterCacheFile->purge(); return $id; }
[ "public", "function", "delete", "(", "$", "id", "=", "null", ",", "$", "attributes", "=", "array", "(", ")", ",", "$", "search", "=", "false", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "clusterCacheFile", ")", ")", "{", "$", "thi...
Delete data from the cache. Purges the cached data for a given ID and or attributes. Using an ID purges only the cache data for just this ID. Additional attributes provided will matched additionally. This can give you an immense speed improvement against just searching for ID ( see {@link ezcCacheStorage::restore()} ). If you only provide attributes for deletion of cache data, all cache data matching these attributes will be purged. @param string $id The item ID. @param array(string=>string) $attributes Attributes that describe the cached data. @param bool $search Whether to search for items if not found directly. Default is false.
[ "Delete", "data", "from", "the", "cache", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/cluster.php#L166-L178
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/cluster.php
ezpRestCacheStorageCluster.countDataItems
public function countDataItems( $id = null, $attributes = array() ) { if ( !isset( $this->clusterCacheFile ) ) { $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); } return $this->clusterCacheFile->exists() ? 1 : 0; }
php
public function countDataItems( $id = null, $attributes = array() ) { if ( !isset( $this->clusterCacheFile ) ) { $this->clusterCacheFile = eZClusterFileHandler::instance( $this->properties['location'] . $this->generateIdentifier( $id, $attributes ) ); } return $this->clusterCacheFile->exists() ? 1 : 0; }
[ "public", "function", "countDataItems", "(", "$", "id", "=", "null", ",", "$", "attributes", "=", "array", "(", ")", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "clusterCacheFile", ")", ")", "{", "$", "this", "->", "clusterCacheFile", ...
Return the number of items in the cache matching a certain criteria. This method determines if cache data described by the given ID and/or attributes exists. It returns the number of cache data items found. @param string $id The item ID. @param array(string=>string) $attributes Attributes that describe the item @return int The number of cache data items found matching the criteria
[ "Return", "the", "number", "of", "items", "in", "the", "cache", "matching", "a", "certain", "criteria", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/cluster.php#L191-L201
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpmobiledevicedetect.php
ezpMobileDeviceDetect.isEnabled
public static function isEnabled() { if ( eZINI::instance()->variable( 'SiteAccessSettings', 'DetectMobileDevice' ) === 'enabled' ) { $mobileSaList = eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessList' ); if ( !empty( $mobileSaList ) ) { return true; } else { eZDebug::writeError( "DetectMobileDevice is enabled and MobileSiteAccessList is empty, please check your site.ini configuration", __METHOD__ ); } } return false; }
php
public static function isEnabled() { if ( eZINI::instance()->variable( 'SiteAccessSettings', 'DetectMobileDevice' ) === 'enabled' ) { $mobileSaList = eZINI::instance()->variable( 'SiteAccessSettings', 'MobileSiteAccessList' ); if ( !empty( $mobileSaList ) ) { return true; } else { eZDebug::writeError( "DetectMobileDevice is enabled and MobileSiteAccessList is empty, please check your site.ini configuration", __METHOD__ ); } } return false; }
[ "public", "static", "function", "isEnabled", "(", ")", "{", "if", "(", "eZINI", "::", "instance", "(", ")", "->", "variable", "(", "'SiteAccessSettings'", ",", "'DetectMobileDevice'", ")", "===", "'enabled'", ")", "{", "$", "mobileSaList", "=", "eZINI", "::"...
Checks whether mobile device detection is enabled or not @static @return bool
[ "Checks", "whether", "mobile", "device", "detection", "is", "enabled", "or", "not" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpmobiledevicedetect.php#L37-L57
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.fetchById
public static function fetchById( $id ) { $stateGroups = self::fetchByConditions( array( "ezcobj_state_group.id=$id" ), 1, 0 ); $stateGroup = count( $stateGroups ) > 0 ? $stateGroups[0] : false; return $stateGroup; }
php
public static function fetchById( $id ) { $stateGroups = self::fetchByConditions( array( "ezcobj_state_group.id=$id" ), 1, 0 ); $stateGroup = count( $stateGroups ) > 0 ? $stateGroups[0] : false; return $stateGroup; }
[ "public", "static", "function", "fetchById", "(", "$", "id", ")", "{", "$", "stateGroups", "=", "self", "::", "fetchByConditions", "(", "array", "(", "\"ezcobj_state_group.id=$id\"", ")", ",", "1", ",", "0", ")", ";", "$", "stateGroup", "=", "count", "(", ...
Fetches a content object state group by its numerical ID @param integer $id @return eZContentObjectStateGroup|boolean
[ "Fetches", "a", "content", "object", "state", "group", "by", "its", "numerical", "ID" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L66-L71
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.fetchByIdentifier
public static function fetchByIdentifier( $identifier ) { $db = eZDB::instance(); $identifier = $db->escapeString( $identifier ); $stateGroups = self::fetchByConditions( array( "ezcobj_state_group.identifier='$identifier'" ), 1, 0 ); $stateGroup = count( $stateGroups ) > 0 ? $stateGroups[0] : false; return $stateGroup; }
php
public static function fetchByIdentifier( $identifier ) { $db = eZDB::instance(); $identifier = $db->escapeString( $identifier ); $stateGroups = self::fetchByConditions( array( "ezcobj_state_group.identifier='$identifier'" ), 1, 0 ); $stateGroup = count( $stateGroups ) > 0 ? $stateGroups[0] : false; return $stateGroup; }
[ "public", "static", "function", "fetchByIdentifier", "(", "$", "identifier", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "identifier", "=", "$", "db", "->", "escapeString", "(", "$", "identifier", ")", ";", "$", "stateGroups",...
Fetches a content object state group by its identifier @param string $identifier @return eZContentObjectStateGroup|boolean
[ "Fetches", "a", "content", "object", "state", "group", "by", "its", "identifier" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L79-L86
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.fetchByConditions
private static function fetchByConditions( $conditions, $limit, $offset ) { $db = eZDB::instance(); $defaultConditions = array( 'ezcobj_state_group_language.contentobject_state_group_id=ezcobj_state_group.id', eZContentLanguage::languagesSQLFilter( 'ezcobj_state_group' ), eZContentLanguage::sqlFilter( 'ezcobj_state_group_language', 'ezcobj_state_group' ) ); $conditions = array_merge( $conditions, $defaultConditions ); $conditionsSQL = implode( ' AND ', $conditions ); $sql = "SELECT * " . "FROM ezcobj_state_group, ezcobj_state_group_language ". "WHERE $conditionsSQL"; $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) ); $stateGroups = array(); foreach ( $rows as $row ) { $stateGroup = new eZContentObjectStateGroup( $row ); $stateGroupLanguage = new eZContentObjectStateGroupLanguage( $row ); $stateGroup->setLanguageObject( $stateGroupLanguage ); $stateGroups[] = $stateGroup; } return $stateGroups; }
php
private static function fetchByConditions( $conditions, $limit, $offset ) { $db = eZDB::instance(); $defaultConditions = array( 'ezcobj_state_group_language.contentobject_state_group_id=ezcobj_state_group.id', eZContentLanguage::languagesSQLFilter( 'ezcobj_state_group' ), eZContentLanguage::sqlFilter( 'ezcobj_state_group_language', 'ezcobj_state_group' ) ); $conditions = array_merge( $conditions, $defaultConditions ); $conditionsSQL = implode( ' AND ', $conditions ); $sql = "SELECT * " . "FROM ezcobj_state_group, ezcobj_state_group_language ". "WHERE $conditionsSQL"; $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) ); $stateGroups = array(); foreach ( $rows as $row ) { $stateGroup = new eZContentObjectStateGroup( $row ); $stateGroupLanguage = new eZContentObjectStateGroupLanguage( $row ); $stateGroup->setLanguageObject( $stateGroupLanguage ); $stateGroups[] = $stateGroup; } return $stateGroups; }
[ "private", "static", "function", "fetchByConditions", "(", "$", "conditions", ",", "$", "limit", ",", "$", "offset", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "defaultConditions", "=", "array", "(", "'ezcobj_state_group_language...
Fetches content object state groups by certain conditions @param array $conditions @param integer $limit @param integer $offset @return array
[ "Fetches", "content", "object", "state", "groups", "by", "certain", "conditions" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L96-L126
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.availableLanguages
public function availableLanguages() { $languages = array(); $languageObjects = $this->languages(); foreach ( $languageObjects as $languageObject ) { $languages[] = $languageObject->attribute( 'locale' ); } return $languages; }
php
public function availableLanguages() { $languages = array(); $languageObjects = $this->languages(); foreach ( $languageObjects as $languageObject ) { $languages[] = $languageObject->attribute( 'locale' ); } return $languages; }
[ "public", "function", "availableLanguages", "(", ")", "{", "$", "languages", "=", "array", "(", ")", ";", "$", "languageObjects", "=", "$", "this", "->", "languages", "(", ")", ";", "foreach", "(", "$", "languageObjects", "as", "$", "languageObject", ")", ...
Get the languages the state group exists in. @return array an array of language code strings.
[ "Get", "the", "languages", "the", "state", "group", "exists", "in", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L272-L283
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.store
public function store( $fieldFilters = null ) { $db = eZDB::instance(); $db->begin(); $languageMask = 1; // set language mask and always available bits foreach ( $this->AllTranslations as $translation ) { if ( $translation->hasData() ) { $languageID = $translation->attribute( 'real_language_id' ); if ( empty( $this->DefaultLanguageID ) ) { $this->DefaultLanguageID = $languageID & ~1; } // if default language, set always available flag if ( $languageID & $this->DefaultLanguageID ) { $translation->setAttribute( 'language_id', $languageID | 1 ); } // otherwise, remove always available flag if it's set else { $translation->setAttribute( 'language_id', $languageID & ~1 ); } $languageMask = $languageMask | $languageID; } } $this->setAttribute( 'language_mask', $languageMask ); // store state group eZPersistentObject::storeObject( $this, $fieldFilters ); // store or remove translations foreach ( $this->AllTranslations as $translation ) { if ( !$translation->hasData() ) { // the name and description are empty // so the translation needs to be removed if it was stored before if ( $translation->attribute( 'contentobject_state_group_id' ) !== null ) { $translation->remove(); } } else { if ( $translation->attribute( 'contentobject_state_group_id' ) != $this->ID ) { $translation->setAttribute( 'contentobject_state_group_id', $this->ID ); } $translation->store(); } } $handler = eZExpiryHandler::instance(); $handler->setTimestamp( 'state-limitations', time() ); $db->commit(); }
php
public function store( $fieldFilters = null ) { $db = eZDB::instance(); $db->begin(); $languageMask = 1; // set language mask and always available bits foreach ( $this->AllTranslations as $translation ) { if ( $translation->hasData() ) { $languageID = $translation->attribute( 'real_language_id' ); if ( empty( $this->DefaultLanguageID ) ) { $this->DefaultLanguageID = $languageID & ~1; } // if default language, set always available flag if ( $languageID & $this->DefaultLanguageID ) { $translation->setAttribute( 'language_id', $languageID | 1 ); } // otherwise, remove always available flag if it's set else { $translation->setAttribute( 'language_id', $languageID & ~1 ); } $languageMask = $languageMask | $languageID; } } $this->setAttribute( 'language_mask', $languageMask ); // store state group eZPersistentObject::storeObject( $this, $fieldFilters ); // store or remove translations foreach ( $this->AllTranslations as $translation ) { if ( !$translation->hasData() ) { // the name and description are empty // so the translation needs to be removed if it was stored before if ( $translation->attribute( 'contentobject_state_group_id' ) !== null ) { $translation->remove(); } } else { if ( $translation->attribute( 'contentobject_state_group_id' ) != $this->ID ) { $translation->setAttribute( 'contentobject_state_group_id', $this->ID ); } $translation->store(); } } $handler = eZExpiryHandler::instance(); $handler->setTimestamp( 'state-limitations', time() ); $db->commit(); }
[ "public", "function", "store", "(", "$", "fieldFilters", "=", "null", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "db", "->", "begin", "(", ")", ";", "$", "languageMask", "=", "1", ";", "// set language mask and always availab...
Stores the content object state group and its translations. Before storing a content object state group, you should use {@link eZContentObjectStateGroup::isValid()} to check its validness. @param array $fieldFilters
[ "Stores", "the", "content", "object", "state", "group", "and", "its", "translations", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L293-L356
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.fetchHTTPPersistentVariables
public function fetchHTTPPersistentVariables() { $translations = $this->allTranslations(); $http = eZHTTPTool::instance(); eZHTTPPersistence::fetch( 'ContentObjectStateGroup' , eZContentObjectStateGroup::definition(), $this, $http, false ); eZHTTPPersistence::fetch( 'ContentObjectStateGroup' , eZContentObjectStateGroupLanguage::definition(), $translations, $http, true ); }
php
public function fetchHTTPPersistentVariables() { $translations = $this->allTranslations(); $http = eZHTTPTool::instance(); eZHTTPPersistence::fetch( 'ContentObjectStateGroup' , eZContentObjectStateGroup::definition(), $this, $http, false ); eZHTTPPersistence::fetch( 'ContentObjectStateGroup' , eZContentObjectStateGroupLanguage::definition(), $translations, $http, true ); }
[ "public", "function", "fetchHTTPPersistentVariables", "(", ")", "{", "$", "translations", "=", "$", "this", "->", "allTranslations", "(", ")", ";", "$", "http", "=", "eZHTTPTool", "::", "instance", "(", ")", ";", "eZHTTPPersistence", "::", "fetch", "(", "'Co...
Fetches the HTTP persistent variables for this content object state group and its localizations. "ContentObjectStateGroup" is used as base name for the persistent variables. @see eZHTTPPersistence
[ "Fetches", "the", "HTTP", "persistent", "variables", "for", "this", "content", "object", "state", "group", "and", "its", "localizations", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L478-L485
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.limitations
public static function limitations() { static $limitations; if ( $limitations === null ) { $db = eZDB::instance(); $dbName = md5( $db->DB ); $cacheDir = eZSys::cacheDirectory(); $phpCache = new eZPHPCreator( $cacheDir, 'statelimitations_' . $dbName . '.php', '', array( 'clustering' => 'statelimitations' ) ); $handler = eZExpiryHandler::instance(); $storedTimeStamp = $handler->hasTimestamp( 'state-limitations' ) ? $handler->timestamp( 'state-limitations' ) : false; $expiryTime = $storedTimeStamp !== false ? $storedTimeStamp : 0; if ( $phpCache->canRestore( $expiryTime ) ) { $var = $phpCache->restore( array( 'state_limitations' => 'state_limitations' ) ); $limitations = $var['state_limitations']; } else { $limitations = array(); $groups = self::fetchByConditions( array( "identifier NOT LIKE 'ez%'" ), false, false ); foreach ( $groups as $group ) { $name = 'StateGroup_' . $group->attribute( 'identifier' ); $limitations[$name] = array( 'name' => $name, 'values' => array(), 'class' => __CLASS__, 'function' => 'limitationValues', 'parameter' => array( $group->attribute( 'id' ) ) ); } $phpCache->addVariable( 'state_limitations', $limitations ); $phpCache->store(); } if ( $storedTimeStamp === false ) { $handler->setTimestamp( 'state-limitations', time() ); } } return $limitations; }
php
public static function limitations() { static $limitations; if ( $limitations === null ) { $db = eZDB::instance(); $dbName = md5( $db->DB ); $cacheDir = eZSys::cacheDirectory(); $phpCache = new eZPHPCreator( $cacheDir, 'statelimitations_' . $dbName . '.php', '', array( 'clustering' => 'statelimitations' ) ); $handler = eZExpiryHandler::instance(); $storedTimeStamp = $handler->hasTimestamp( 'state-limitations' ) ? $handler->timestamp( 'state-limitations' ) : false; $expiryTime = $storedTimeStamp !== false ? $storedTimeStamp : 0; if ( $phpCache->canRestore( $expiryTime ) ) { $var = $phpCache->restore( array( 'state_limitations' => 'state_limitations' ) ); $limitations = $var['state_limitations']; } else { $limitations = array(); $groups = self::fetchByConditions( array( "identifier NOT LIKE 'ez%'" ), false, false ); foreach ( $groups as $group ) { $name = 'StateGroup_' . $group->attribute( 'identifier' ); $limitations[$name] = array( 'name' => $name, 'values' => array(), 'class' => __CLASS__, 'function' => 'limitationValues', 'parameter' => array( $group->attribute( 'id' ) ) ); } $phpCache->addVariable( 'state_limitations', $limitations ); $phpCache->store(); } if ( $storedTimeStamp === false ) { $handler->setTimestamp( 'state-limitations', time() ); } } return $limitations; }
[ "public", "static", "function", "limitations", "(", ")", "{", "static", "$", "limitations", ";", "if", "(", "$", "limitations", "===", "null", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "dbName", "=", "md5", "(", "$", "...
Returns an array of limitations useable by the policy system @return array
[ "Returns", "an", "array", "of", "limitations", "useable", "by", "the", "policy", "system" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L640-L693
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstategroup.php
eZContentObjectStateGroup.limitationValues
public static function limitationValues( $groupID ) { $group = self::fetchById( $groupID ); $states = array(); if ( $group !== false ) $states = $group->attribute( 'states' ); $limitationValues = array(); foreach ( $states as $state ) { $limitationValues[] = array( 'name' => $state->attribute( 'current_translation' )->attribute( 'name' ), 'id' => $state->attribute( 'id' ) ); } return $limitationValues; }
php
public static function limitationValues( $groupID ) { $group = self::fetchById( $groupID ); $states = array(); if ( $group !== false ) $states = $group->attribute( 'states' ); $limitationValues = array(); foreach ( $states as $state ) { $limitationValues[] = array( 'name' => $state->attribute( 'current_translation' )->attribute( 'name' ), 'id' => $state->attribute( 'id' ) ); } return $limitationValues; }
[ "public", "static", "function", "limitationValues", "(", "$", "groupID", ")", "{", "$", "group", "=", "self", "::", "fetchById", "(", "$", "groupID", ")", ";", "$", "states", "=", "array", "(", ")", ";", "if", "(", "$", "group", "!==", "false", ")", ...
Returns an array of limitation values useable by the policy system @param integer $groupID @return array
[ "Returns", "an", "array", "of", "limitation", "values", "useable", "by", "the", "policy", "system" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstategroup.php#L701-L717
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.buildAutoloadArrays
public function buildAutoloadArrays() { $phpFiles = $this->fetchFiles(); $phpClasses = array(); foreach ( $phpFiles as $mode => $fileList ) { $phpClasses[$mode] = $this->getClassFileList( $fileList, $mode ); } $maxClassNameLength = $this->checkMaxClassLength( $phpClasses ); $this->autoloadArrays = $this->dumpArray( $phpClasses, $maxClassNameLength ); if ( $this->options->writeFiles ) { $this->writeAutoloadFiles(); } }
php
public function buildAutoloadArrays() { $phpFiles = $this->fetchFiles(); $phpClasses = array(); foreach ( $phpFiles as $mode => $fileList ) { $phpClasses[$mode] = $this->getClassFileList( $fileList, $mode ); } $maxClassNameLength = $this->checkMaxClassLength( $phpClasses ); $this->autoloadArrays = $this->dumpArray( $phpClasses, $maxClassNameLength ); if ( $this->options->writeFiles ) { $this->writeAutoloadFiles(); } }
[ "public", "function", "buildAutoloadArrays", "(", ")", "{", "$", "phpFiles", "=", "$", "this", "->", "fetchFiles", "(", ")", ";", "$", "phpClasses", "=", "array", "(", ")", ";", "foreach", "(", "$", "phpFiles", "as", "$", "mode", "=>", "$", "fileList",...
Searches specified directories for classes, and build autoload arrays. @throws Exception if desired output directory is not a directory, or if the autoload arrays are not writeable by the script. @return void
[ "Searches", "specified", "directories", "for", "classes", "and", "build", "autoload", "arrays", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L185-L202
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.handleDefaultExcludeFile
protected function handleDefaultExcludeFile() { $defaultExcludeFile = $this->options->basePath . DIRECTORY_SEPARATOR . self::DEFAULT_EXCLUDE_FILE; if ( !file_exists( $defaultExcludeFile ) ) { return $this->options->excludeDirs; } $defaultExcludeArray = explode( "\n", trim( file_get_contents( $defaultExcludeFile ) ) ); return array_merge( $defaultExcludeArray, $this->options->excludeDirs ); }
php
protected function handleDefaultExcludeFile() { $defaultExcludeFile = $this->options->basePath . DIRECTORY_SEPARATOR . self::DEFAULT_EXCLUDE_FILE; if ( !file_exists( $defaultExcludeFile ) ) { return $this->options->excludeDirs; } $defaultExcludeArray = explode( "\n", trim( file_get_contents( $defaultExcludeFile ) ) ); return array_merge( $defaultExcludeArray, $this->options->excludeDirs ); }
[ "protected", "function", "handleDefaultExcludeFile", "(", ")", "{", "$", "defaultExcludeFile", "=", "$", "this", "->", "options", "->", "basePath", ".", "DIRECTORY_SEPARATOR", ".", "self", "::", "DEFAULT_EXCLUDE_FILE", ";", "if", "(", "!", "file_exists", "(", "$...
Adds exclude directories specified in the default excludes files, to the exclude array. If the default exclude file '.autoloadignore' does not exist, the function will just return the user specified exclude directories. This function relies on the options object being available in the instance. @return array The exclude directories
[ "Adds", "exclude", "directories", "specified", "in", "the", "default", "excludes", "files", "to", "the", "exclude", "array", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L283-L293
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.fetchFiles
protected function fetchFiles() { $path = $this->options->basePath; $excludeDirs = $this->handleDefaultExcludeFile(); // make sure ezcBaseFile::findRecursive and the exclusion filters we pass to it // work correctly on systems with another file seperator than the forward slash $sanitisedBasePath = DIRECTORY_SEPARATOR == '/' ? $path : strtr( $path, DIRECTORY_SEPARATOR, '/' ); $dirSep = preg_quote( DIRECTORY_SEPARATOR ); $extraExcludeDirs = array(); if ( $excludeDirs !== false and is_array( $excludeDirs ) ) { foreach ( $excludeDirs as $dir ) { $extraExcludeDirs[] = "@^{$sanitisedBasePath}{$dirSep}{$dir}@"; } } $retFiles = array(); $activeModes = $this->checkMode(); foreach( $activeModes as $modusOperandi ) { switch( $modusOperandi ) { case self::MODE_KERNEL: $extraExcludeKernelDirs = $extraExcludeDirs; $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension@"; $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}tests@"; $retFiles[$modusOperandi] = $this->buildFileList( $sanitisedBasePath, $extraExcludeKernelDirs ); break; case self::MODE_EXTENSION: case self::MODE_KERNEL_OVERRIDE: $extraExcludeExtensionDirs = $extraExcludeDirs; $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}tests@"; $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/extension", $extraExcludeExtensionDirs ); break; case self::MODE_TESTS: $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/tests", $extraExcludeDirs ); $extraExcludeExtensionDirs = $extraExcludeDirs; $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}(?!tests)@"; $extensionTestFiles = $this->buildFileList("$sanitisedBasePath/extension", $extraExcludeExtensionDirs ); $retFiles[$modusOperandi] = array_merge( $retFiles[$modusOperandi], $extensionTestFiles ); break; case self::MODE_SINGLE_EXTENSION: $retFiles = array( $modusOperandi => $this->buildFileList( "$sanitisedBasePath", $extraExcludeDirs ) ); break; } } //Make all the paths relative to $path foreach ( $retFiles as &$fileBundle ) { foreach ( $fileBundle as $key => &$file ) { // ezcBaseFile::calculateRelativePath only works correctly with paths where DIRECTORY_SEPARATOR is used // so we need to correct the results of ezcBaseFile::findRecursive again if ( DIRECTORY_SEPARATOR != '/' ) { $file = strtr( $file, '/', DIRECTORY_SEPARATOR ); } $fileBundle[$key] = ezcBaseFile::calculateRelativePath( $file, $path ); } } unset( $file, $fileBundle ); return $retFiles; }
php
protected function fetchFiles() { $path = $this->options->basePath; $excludeDirs = $this->handleDefaultExcludeFile(); // make sure ezcBaseFile::findRecursive and the exclusion filters we pass to it // work correctly on systems with another file seperator than the forward slash $sanitisedBasePath = DIRECTORY_SEPARATOR == '/' ? $path : strtr( $path, DIRECTORY_SEPARATOR, '/' ); $dirSep = preg_quote( DIRECTORY_SEPARATOR ); $extraExcludeDirs = array(); if ( $excludeDirs !== false and is_array( $excludeDirs ) ) { foreach ( $excludeDirs as $dir ) { $extraExcludeDirs[] = "@^{$sanitisedBasePath}{$dirSep}{$dir}@"; } } $retFiles = array(); $activeModes = $this->checkMode(); foreach( $activeModes as $modusOperandi ) { switch( $modusOperandi ) { case self::MODE_KERNEL: $extraExcludeKernelDirs = $extraExcludeDirs; $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension@"; $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}tests@"; $retFiles[$modusOperandi] = $this->buildFileList( $sanitisedBasePath, $extraExcludeKernelDirs ); break; case self::MODE_EXTENSION: case self::MODE_KERNEL_OVERRIDE: $extraExcludeExtensionDirs = $extraExcludeDirs; $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}tests@"; $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/extension", $extraExcludeExtensionDirs ); break; case self::MODE_TESTS: $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/tests", $extraExcludeDirs ); $extraExcludeExtensionDirs = $extraExcludeDirs; $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}(?!tests)@"; $extensionTestFiles = $this->buildFileList("$sanitisedBasePath/extension", $extraExcludeExtensionDirs ); $retFiles[$modusOperandi] = array_merge( $retFiles[$modusOperandi], $extensionTestFiles ); break; case self::MODE_SINGLE_EXTENSION: $retFiles = array( $modusOperandi => $this->buildFileList( "$sanitisedBasePath", $extraExcludeDirs ) ); break; } } //Make all the paths relative to $path foreach ( $retFiles as &$fileBundle ) { foreach ( $fileBundle as $key => &$file ) { // ezcBaseFile::calculateRelativePath only works correctly with paths where DIRECTORY_SEPARATOR is used // so we need to correct the results of ezcBaseFile::findRecursive again if ( DIRECTORY_SEPARATOR != '/' ) { $file = strtr( $file, '/', DIRECTORY_SEPARATOR ); } $fileBundle[$key] = ezcBaseFile::calculateRelativePath( $file, $path ); } } unset( $file, $fileBundle ); return $retFiles; }
[ "protected", "function", "fetchFiles", "(", ")", "{", "$", "path", "=", "$", "this", "->", "options", "->", "basePath", ";", "$", "excludeDirs", "=", "$", "this", "->", "handleDefaultExcludeFile", "(", ")", ";", "// make sure ezcBaseFile::findRecursive and the exc...
Returns an array indexed by location for classes and their filenames. @param string $path The base path to start the search from. @param string $mask A binary mask which instructs the function whether to fetch kernel-related or extension-related files. @return array
[ "Returns", "an", "array", "indexed", "by", "location", "for", "classes", "and", "their", "filenames", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L302-L373
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.findRecursive
public static function findRecursive( $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), eZAutoloadGenerator $gen ) { $gen->log( "Scanning for PHP-files." ); $gen->startProgressOutput( self::OUTPUT_PROGRESS_PHASE1 ); // create the context, and then start walking over the array $context = new ezpAutoloadFileFindContext(); $context->generator = $gen; self::walkRecursive( $sourceDir, $includeFilters, $excludeFilters, array( 'eZAutoloadGenerator', 'findRecursiveCallback' ), $context ); // return the found and pattern-matched files sort( $context->elements ); $gen->stopProgressOutput( self::OUTPUT_PROGRESS_PHASE1 ); $gen->log( "Scan complete. Found {$context->count} PHP files." ); return $context->elements; }
php
public static function findRecursive( $sourceDir, array $includeFilters = array(), array $excludeFilters = array(), eZAutoloadGenerator $gen ) { $gen->log( "Scanning for PHP-files." ); $gen->startProgressOutput( self::OUTPUT_PROGRESS_PHASE1 ); // create the context, and then start walking over the array $context = new ezpAutoloadFileFindContext(); $context->generator = $gen; self::walkRecursive( $sourceDir, $includeFilters, $excludeFilters, array( 'eZAutoloadGenerator', 'findRecursiveCallback' ), $context ); // return the found and pattern-matched files sort( $context->elements ); $gen->stopProgressOutput( self::OUTPUT_PROGRESS_PHASE1 ); $gen->log( "Scan complete. Found {$context->count} PHP files." ); return $context->elements; }
[ "public", "static", "function", "findRecursive", "(", "$", "sourceDir", ",", "array", "$", "includeFilters", "=", "array", "(", ")", ",", "array", "$", "excludeFilters", "=", "array", "(", ")", ",", "eZAutoloadGenerator", "$", "gen", ")", "{", "$", "gen", ...
Uses the walker in ezcBaseFile to find files. This also uses the callback to get progress information about the file search. @param string $sourceDir @param array $includeFilters @param array $excludeFilters @param eZAutoloadGenerator $gen @return array
[ "Uses", "the", "walker", "in", "ezcBaseFile", "to", "find", "files", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L413-L432
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.findRecursiveCallback
public static function findRecursiveCallback( ezpAutoloadFileFindContext $context, $sourceDir, $fileName, $fileInfo ) { if ( $fileInfo['mode'] & 0x4000 ) { return; } // update the statistics $context->elements[] = $sourceDir . DIRECTORY_SEPARATOR . $fileName; $context->count++; $context->generator->updateProgressOutput( eZAutoloadGenerator::OUTPUT_PROGRESS_PHASE1 ); }
php
public static function findRecursiveCallback( ezpAutoloadFileFindContext $context, $sourceDir, $fileName, $fileInfo ) { if ( $fileInfo['mode'] & 0x4000 ) { return; } // update the statistics $context->elements[] = $sourceDir . DIRECTORY_SEPARATOR . $fileName; $context->count++; $context->generator->updateProgressOutput( eZAutoloadGenerator::OUTPUT_PROGRESS_PHASE1 ); }
[ "public", "static", "function", "findRecursiveCallback", "(", "ezpAutoloadFileFindContext", "$", "context", ",", "$", "sourceDir", ",", "$", "fileName", ",", "$", "fileInfo", ")", "{", "if", "(", "$", "fileInfo", "[", "'mode'", "]", "&", "0x4000", ")", "{", ...
Callback used ezcBaseFile @param string $ezpAutoloadFileFindContext @param string $sourceDir @param string $fileName @param string $fileInfo @return void
[ "Callback", "used", "ezcBaseFile" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L554-L566
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.dumpArray
protected function dumpArray( $sortedArray, $length ) { $retArray = array(); foreach ( $sortedArray as $location => $sorted ) { $ret = ''; $offset = $length[$location] + 2; foreach( $sorted as $class => $path ) { $ret .= sprintf( " %-{$offset}s => '%s'," . PHP_EOL, "'{$class}'", $path ); } $retArray[$location] = $ret; } return $retArray; }
php
protected function dumpArray( $sortedArray, $length ) { $retArray = array(); foreach ( $sortedArray as $location => $sorted ) { $ret = ''; $offset = $length[$location] + 2; foreach( $sorted as $class => $path ) { $ret .= sprintf( " %-{$offset}s => '%s'," . PHP_EOL, "'{$class}'", $path ); } $retArray[$location] = $ret; } return $retArray; }
[ "protected", "function", "dumpArray", "(", "$", "sortedArray", ",", "$", "length", ")", "{", "$", "retArray", "=", "array", "(", ")", ";", "foreach", "(", "$", "sortedArray", "as", "$", "location", "=>", "$", "sorted", ")", "{", "$", "ret", "=", "''"...
Build string version of the autoload array with correct indenting. @param array $sortedArray @param int $length @return string
[ "Build", "string", "version", "of", "the", "autoload", "array", "with", "correct", "indenting", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L734-L748
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.runMode
protected function runMode() { $mode = self::MODE_NONE; // If an extension is given as an argument, that will override other // mode options if ( $this->options->basePath !== getcwd() ) { $mode |= self::MODE_SINGLE_EXTENSION; return $mode; } if ( $this->options->searchKernelOverride ) { $mode |= self::MODE_KERNEL_OVERRIDE; return $mode; } // If no file selectors are chosen we will default to extension files. if ( !$this->options->searchKernelFiles and !$this->options->searchExtensionFiles and !$this->options->searchTestFiles ) { $mode |= self::MODE_EXTENSION; } if ( $this->options->searchKernelFiles ) { $mode |= self::MODE_KERNEL; } if ( $this->options->searchExtensionFiles ) { $mode |= self::MODE_EXTENSION; } if ( $this->options->searchTestFiles ) { $mode |= self::MODE_TESTS; } return $mode; }
php
protected function runMode() { $mode = self::MODE_NONE; // If an extension is given as an argument, that will override other // mode options if ( $this->options->basePath !== getcwd() ) { $mode |= self::MODE_SINGLE_EXTENSION; return $mode; } if ( $this->options->searchKernelOverride ) { $mode |= self::MODE_KERNEL_OVERRIDE; return $mode; } // If no file selectors are chosen we will default to extension files. if ( !$this->options->searchKernelFiles and !$this->options->searchExtensionFiles and !$this->options->searchTestFiles ) { $mode |= self::MODE_EXTENSION; } if ( $this->options->searchKernelFiles ) { $mode |= self::MODE_KERNEL; } if ( $this->options->searchExtensionFiles ) { $mode |= self::MODE_EXTENSION; } if ( $this->options->searchTestFiles ) { $mode |= self::MODE_TESTS; } return $mode; }
[ "protected", "function", "runMode", "(", ")", "{", "$", "mode", "=", "self", "::", "MODE_NONE", ";", "// If an extension is given as an argument, that will override other", "// mode options", "if", "(", "$", "this", "->", "options", "->", "basePath", "!==", "getcwd", ...
Generates the active bitmask for this instance of the autoload generation script depending on the parameters it sets the corresponding flags. @return int
[ "Generates", "the", "active", "bitmask", "for", "this", "instance", "of", "the", "autoload", "generation", "script", "depending", "on", "the", "parameters", "it", "sets", "the", "corresponding", "flags", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L779-L819
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.nameTable
protected function nameTable( $lookup ) { $names = array( self::MODE_EXTENSION => "ezp_extension.php", self::MODE_SINGLE_EXTENSION => basename( $this->options->basePath ) . '_autoload.php', self::MODE_KERNEL => "ezp_kernel.php", self::MODE_TESTS => "ezp_tests.php", self::MODE_KERNEL_OVERRIDE => "ezp_override.php", ); if ( array_key_exists( $lookup, $names ) ) { return $names[$lookup]; } return false; }
php
protected function nameTable( $lookup ) { $names = array( self::MODE_EXTENSION => "ezp_extension.php", self::MODE_SINGLE_EXTENSION => basename( $this->options->basePath ) . '_autoload.php', self::MODE_KERNEL => "ezp_kernel.php", self::MODE_TESTS => "ezp_tests.php", self::MODE_KERNEL_OVERRIDE => "ezp_override.php", ); if ( array_key_exists( $lookup, $names ) ) { return $names[$lookup]; } return false; }
[ "protected", "function", "nameTable", "(", "$", "lookup", ")", "{", "$", "names", "=", "array", "(", "self", "::", "MODE_EXTENSION", "=>", "\"ezp_extension.php\"", ",", "self", "::", "MODE_SINGLE_EXTENSION", "=>", "basename", "(", "$", "this", "->", "options",...
Table to look up file names to use for different run modes. @param string $lookup Mode to look up, can be extension, or kernel. @return string
[ "Table", "to", "look", "up", "file", "names", "to", "use", "for", "different", "run", "modes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L850-L864
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.targetTable
protected function targetTable( $lookup ) { $targets = array( self::MODE_EXTENSION => "var/autoload", self::MODE_TESTS => "var/autoload", self::MODE_KERNEL => "autoload", self::MODE_SINGLE_EXTENSION => $this->options->basePath . DIRECTORY_SEPARATOR . 'autoload', self::MODE_KERNEL_OVERRIDE => "var/autoload", ); if ( array_key_exists( $lookup, $targets ) ) { return $targets[$lookup]; } return false; }
php
protected function targetTable( $lookup ) { $targets = array( self::MODE_EXTENSION => "var/autoload", self::MODE_TESTS => "var/autoload", self::MODE_KERNEL => "autoload", self::MODE_SINGLE_EXTENSION => $this->options->basePath . DIRECTORY_SEPARATOR . 'autoload', self::MODE_KERNEL_OVERRIDE => "var/autoload", ); if ( array_key_exists( $lookup, $targets ) ) { return $targets[$lookup]; } return false; }
[ "protected", "function", "targetTable", "(", "$", "lookup", ")", "{", "$", "targets", "=", "array", "(", "self", "::", "MODE_EXTENSION", "=>", "\"var/autoload\"", ",", "self", "::", "MODE_TESTS", "=>", "\"var/autoload\"", ",", "self", "::", "MODE_KERNEL", "=>"...
Provides a look-up for which base directory to use depending on mode. @param int $lookup @return string
[ "Provides", "a", "look", "-", "up", "for", "which", "base", "directory", "to", "use", "depending", "on", "mode", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L872-L887
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.dumpArrayStart
protected function dumpArrayStart( $part ) { $description = ""; switch( $part ) { case self::MODE_SINGLE_EXTENSION: $description = basename( $this->options->basePath ) . ' extension'; break; case self::MODE_EXTENSION: case self::MODE_KERNEL: case self::MODE_TESTS: case self::MODE_KERNEL_OVERRIDE: $description = $this->modeName[$part]; break; } return <<<ENDL <?php /** * Autoloader definition for eZ Publish $description files. * * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. * @version //autogentag// * @package kernel * */ return array( ENDL; }
php
protected function dumpArrayStart( $part ) { $description = ""; switch( $part ) { case self::MODE_SINGLE_EXTENSION: $description = basename( $this->options->basePath ) . ' extension'; break; case self::MODE_EXTENSION: case self::MODE_KERNEL: case self::MODE_TESTS: case self::MODE_KERNEL_OVERRIDE: $description = $this->modeName[$part]; break; } return <<<ENDL <?php /** * Autoloader definition for eZ Publish $description files. * * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. * @version //autogentag// * @package kernel * */ return array( ENDL; }
[ "protected", "function", "dumpArrayStart", "(", "$", "part", ")", "{", "$", "description", "=", "\"\"", ";", "switch", "(", "$", "part", ")", "{", "case", "self", "::", "MODE_SINGLE_EXTENSION", ":", "$", "description", "=", "basename", "(", "$", "this", ...
Prints generated code used for the autoload files @param string $part @return string
[ "Prints", "generated", "code", "used", "for", "the", "autoload", "files" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L895-L926
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.classCanBeAdded
protected function classCanBeAdded( $class, $file, $mode, $inProgressAutoloadArray ) { $addClass = true; $sameRepositoryConflict = false; $kernelRepositoryConflict = false; if ( empty( $this->existingAutoloadArrays[self::MODE_KERNEL] ) ) { $this->logWarning( "No existing kernel override found. Please generate kernel autoloads first." ); } switch( $mode ) { case self::MODE_KERNEL: $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( $sameRepositoryConflict ) { $addClass = false; } break; case self::MODE_EXTENSION: case self::MODE_TESTS: case self::MODE_SINGLE_EXTENSION: $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, null, $mode ); $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( $kernelRepositoryConflict or $sameRepositoryConflict ) { $addClass = false; } break; case self::MODE_KERNEL_OVERRIDE: // For kernel overrides we only want class name collisions in // the kernel array to trigger a addClass hit. However we // like to emit warnings about duplicateses found in the current // generated array. Only one class may be overriding a kernel // at a time. $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, $inProgressAutoloadArray, $mode ); $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( ( $sameRepositoryConflict and !$kernelRepositoryConflict ) or ( $sameRepositoryConflict and $kernelRepositoryConflict ) or ( !$kernelRepositoryConflict and !$sameRepositoryConflict ) ) { $addClass = false; } break; } return $addClass; }
php
protected function classCanBeAdded( $class, $file, $mode, $inProgressAutoloadArray ) { $addClass = true; $sameRepositoryConflict = false; $kernelRepositoryConflict = false; if ( empty( $this->existingAutoloadArrays[self::MODE_KERNEL] ) ) { $this->logWarning( "No existing kernel override found. Please generate kernel autoloads first." ); } switch( $mode ) { case self::MODE_KERNEL: $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( $sameRepositoryConflict ) { $addClass = false; } break; case self::MODE_EXTENSION: case self::MODE_TESTS: case self::MODE_SINGLE_EXTENSION: $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, null, $mode ); $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( $kernelRepositoryConflict or $sameRepositoryConflict ) { $addClass = false; } break; case self::MODE_KERNEL_OVERRIDE: // For kernel overrides we only want class name collisions in // the kernel array to trigger a addClass hit. However we // like to emit warnings about duplicateses found in the current // generated array. Only one class may be overriding a kernel // at a time. $kernelRepositoryConflict = $this->classExistsInArray( $class, self::MODE_KERNEL, $file, $inProgressAutoloadArray, $mode ); $sameRepositoryConflict = $this->classExistsInArray( $class, $mode, $file, $inProgressAutoloadArray, $mode ); if ( ( $sameRepositoryConflict and !$kernelRepositoryConflict ) or ( $sameRepositoryConflict and $kernelRepositoryConflict ) or ( !$kernelRepositoryConflict and !$sameRepositoryConflict ) ) { $addClass = false; } break; } return $addClass; }
[ "protected", "function", "classCanBeAdded", "(", "$", "class", ",", "$", "file", ",", "$", "mode", ",", "$", "inProgressAutoloadArray", ")", "{", "$", "addClass", "=", "true", ";", "$", "sameRepositoryConflict", "=", "false", ";", "$", "kernelRepositoryConflic...
Determines if a class can be added to the autoload array. 1. When regenerating array for MODE, do not check for existance of class duplicates in the existing array for the same mode. 2. When adding a new class to the in-progress autoload array, check for matching keys, before adding. If match is found then add a warning message to the warnings stack, and mark the class not to be added. 3. If kernel array is not present, issue warning that class name collisions cannot be checked until kernel array is generated. 4. Class collisions with kernel classes is only allowed for MODE_KERNEL_OVERRIDE @param string $class The name of the class being checked. @param string $file The filename where the class is found. @param int $mode The mode representing the current run mode. @param array $inProgressAutoloadArray Array of the already detected classes for the current mode. @return boolean
[ "Determines", "if", "a", "class", "can", "be", "added", "to", "the", "autoload", "array", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L967-L1021
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.classExistsInArray
protected function classExistsInArray( $class, $checkMode, $file, $inProgressAutoloadArray = null, $generatingMode = null ) { if ( ( $checkMode === $generatingMode ) and $inProgressAutoloadArray !== null ) { $classCollision = array_key_exists( $class, $inProgressAutoloadArray ); } else { $classCollision = array_key_exists( $class, $this->existingAutoloadArrays[$checkMode] ); } if ( $classCollision ) { // If there is a class collisions we want to give feedback to the user. $this->logIssue( $class, $checkMode, $file, $inProgressAutoloadArray, $generatingMode ); return true; } return false; }
php
protected function classExistsInArray( $class, $checkMode, $file, $inProgressAutoloadArray = null, $generatingMode = null ) { if ( ( $checkMode === $generatingMode ) and $inProgressAutoloadArray !== null ) { $classCollision = array_key_exists( $class, $inProgressAutoloadArray ); } else { $classCollision = array_key_exists( $class, $this->existingAutoloadArrays[$checkMode] ); } if ( $classCollision ) { // If there is a class collisions we want to give feedback to the user. $this->logIssue( $class, $checkMode, $file, $inProgressAutoloadArray, $generatingMode ); return true; } return false; }
[ "protected", "function", "classExistsInArray", "(", "$", "class", ",", "$", "checkMode", ",", "$", "file", ",", "$", "inProgressAutoloadArray", "=", "null", ",", "$", "generatingMode", "=", "null", ")", "{", "if", "(", "(", "$", "checkMode", "===", "$", ...
Internal method used to check if an class exist autoload arrays. @param string $class The name of the class being checked. @param int $checkMode The mode whose autoload arrays will be checked. @param string $file Filename containing the class. @param array $inProgressAutoloadArray The autoload array generated so far. @param int $generatingMode The mode we are generating for autoloads for. @return boolean
[ "Internal", "method", "used", "to", "check", "if", "an", "class", "exist", "autoload", "arrays", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1033-L1051
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.logIssue
protected function logIssue( $class, $checkMode, $file, $inProgressAutoloadArray, $generatingMode ) { $conflictFile = ($checkMode === $generatingMode) ? $inProgressAutoloadArray[$class] : $this->existingAutoloadArrays[$checkMode][$class]; if ( $generatingMode === self::MODE_KERNEL_OVERRIDE and $checkMode === self::MODE_KERNEL ) { if ( $inProgressAutoloadArray !== null and array_key_exists( $class, $inProgressAutoloadArray ) ) { return; } $message = "Class {$class}"; $message .= " in file {$file}"; $message .= " will override:\n"; $message .= "{$conflictFile} ({$this->targetTable($checkMode)}/{$this->nameTable($checkMode)})"; $this->log( $message ); } else { $message = "Class {$class}"; $message .= " in file {$file}"; $message .= " is already defined in:\n"; $message .= "{$conflictFile} ({$this->targetTable($checkMode)}/{$this->nameTable($checkMode)})"; $message .= "\nThis class was not added to the autoload array."; $this->logWarning( $message ); } }
php
protected function logIssue( $class, $checkMode, $file, $inProgressAutoloadArray, $generatingMode ) { $conflictFile = ($checkMode === $generatingMode) ? $inProgressAutoloadArray[$class] : $this->existingAutoloadArrays[$checkMode][$class]; if ( $generatingMode === self::MODE_KERNEL_OVERRIDE and $checkMode === self::MODE_KERNEL ) { if ( $inProgressAutoloadArray !== null and array_key_exists( $class, $inProgressAutoloadArray ) ) { return; } $message = "Class {$class}"; $message .= " in file {$file}"; $message .= " will override:\n"; $message .= "{$conflictFile} ({$this->targetTable($checkMode)}/{$this->nameTable($checkMode)})"; $this->log( $message ); } else { $message = "Class {$class}"; $message .= " in file {$file}"; $message .= " is already defined in:\n"; $message .= "{$conflictFile} ({$this->targetTable($checkMode)}/{$this->nameTable($checkMode)})"; $message .= "\nThis class was not added to the autoload array."; $this->logWarning( $message ); } }
[ "protected", "function", "logIssue", "(", "$", "class", ",", "$", "checkMode", ",", "$", "file", ",", "$", "inProgressAutoloadArray", ",", "$", "generatingMode", ")", "{", "$", "conflictFile", "=", "(", "$", "checkMode", "===", "$", "generatingMode", ")", ...
Helper method for giving user feedback when check for class collisions. The params are the same as for classExistsInArray(). @return void
[ "Helper", "method", "for", "giving", "user", "feedback", "when", "check", "for", "class", "collisions", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1060-L1088
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.emit
protected function emit( $message, $messageType ) { if ( $this->outputCallback === null ) { return; } call_user_func( $this->outputCallback , $message, $messageType ); }
php
protected function emit( $message, $messageType ) { if ( $this->outputCallback === null ) { return; } call_user_func( $this->outputCallback , $message, $messageType ); }
[ "protected", "function", "emit", "(", "$", "message", ",", "$", "messageType", ")", "{", "if", "(", "$", "this", "->", "outputCallback", "===", "null", ")", "{", "return", ";", "}", "call_user_func", "(", "$", "this", "->", "outputCallback", ",", "$", ...
Will call output callback if defined. The purpose of this function is to directly emit messages, for instance when the class is being used from shell scripts. If a valid callback has been setup with @see setOutputCallback(), that method will be called with <var>$message</var> and <var>$messageType</var> @param string $message @param string $messageType @return void
[ "Will", "call", "output", "callback", "if", "defined", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1148-L1155
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.printAutoloadArray
public function printAutoloadArray( $printForMode = null ) { if ( $printForMode !== null ) { if ( array_key_exists( $printForMode, $this->autoloadArrays ) ) { $this->log( $this->dumpArrayStart( $printForMode ) . $this->autoloadArrays[$printForMode] . $this->dumpArrayEnd() ); } return; } foreach( $this->autoloadArrays as $location => $data ) { $this->log( $this->dumpArrayStart( $location ) . $data . $this->dumpArrayEnd() ); } }
php
public function printAutoloadArray( $printForMode = null ) { if ( $printForMode !== null ) { if ( array_key_exists( $printForMode, $this->autoloadArrays ) ) { $this->log( $this->dumpArrayStart( $printForMode ) . $this->autoloadArrays[$printForMode] . $this->dumpArrayEnd() ); } return; } foreach( $this->autoloadArrays as $location => $data ) { $this->log( $this->dumpArrayStart( $location ) . $data . $this->dumpArrayEnd() ); } }
[ "public", "function", "printAutoloadArray", "(", "$", "printForMode", "=", "null", ")", "{", "if", "(", "$", "printForMode", "!==", "null", ")", "{", "if", "(", "array_key_exists", "(", "$", "printForMode", ",", "$", "this", "->", "autoloadArrays", ")", ")...
Prints out the generated autoload arrays. Meant to provide a user-viewable output of the defined autoload arrays. If <var>$printForMode</var> is provided, only the array for that mode will be printed. @param string $printForMode Run mode specified by the MODE_* constants. @return mixed
[ "Prints", "out", "the", "generated", "autoload", "arrays", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1187-L1202
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.updateProgressOutput
protected function updateProgressOutput( $phase ) { if ( !$this->options->displayProgress || $this->output === null ) { return; } $this->output->updateProgress( $phase ); }
php
protected function updateProgressOutput( $phase ) { if ( !$this->options->displayProgress || $this->output === null ) { return; } $this->output->updateProgress( $phase ); }
[ "protected", "function", "updateProgressOutput", "(", "$", "phase", ")", "{", "if", "(", "!", "$", "this", "->", "options", "->", "displayProgress", "||", "$", "this", "->", "output", "===", "null", ")", "{", "return", ";", "}", "$", "this", "->", "out...
Calls updateProgress on the output object. If progress output is not enabled or the output object is not set, this method will not do anything. @param int $phase @param string $array @return void
[ "Calls", "updateProgress", "on", "the", "output", "object", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1220-L1227
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezautoloadgenerator.php
eZAutoloadGenerator.incrementProgressStat
protected function incrementProgressStat( $phase, $stat ) { if ( $this->output === null ) { return; } $statArray = $this->output->getData( $phase ); $statArray[$stat]++; $this->output->updateData( $phase, $statArray ); }
php
protected function incrementProgressStat( $phase, $stat ) { if ( $this->output === null ) { return; } $statArray = $this->output->getData( $phase ); $statArray[$stat]++; $this->output->updateData( $phase, $statArray ); }
[ "protected", "function", "incrementProgressStat", "(", "$", "phase", ",", "$", "stat", ")", "{", "if", "(", "$", "this", "->", "output", "===", "null", ")", "{", "return", ";", "}", "$", "statArray", "=", "$", "this", "->", "output", "->", "getData", ...
Increment counters used for statistics in the progress output. If the output object is not set, the method will not do anything. @param int $phase @param array $stat @return void
[ "Increment", "counters", "used", "for", "statistics", "in", "the", "progress", "output", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezautoloadgenerator.php#L1238-L1247
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/prefix_filter.php
ezpRestPrefixFilterInterface.filterRequestUri
public function filterRequestUri() { if ( !empty( $this->versionToken ) ) { // Remove the first occurrence of version token $versionSearch = '/' . $this->versionToken; $versionPos = strpos( $this->request->uri, $versionSearch ); if ( $versionPos !== false ) { $this->request->uri = substr_replace( $this->request->uri, '', $versionPos, strlen( $versionSearch ) ); } } if ( !empty( $this->apiProviderToken ) ) { // Remove the first occurrence of API provider token $providerSearch = '/' . $this->apiProviderToken; $providerPos = strpos( $this->request->uri, $providerSearch ); if ( $providerPos !== false ) { $this->request->uri = substr_replace( $this->request->uri, '', $providerPos, strlen( $providerSearch ) ); } } }
php
public function filterRequestUri() { if ( !empty( $this->versionToken ) ) { // Remove the first occurrence of version token $versionSearch = '/' . $this->versionToken; $versionPos = strpos( $this->request->uri, $versionSearch ); if ( $versionPos !== false ) { $this->request->uri = substr_replace( $this->request->uri, '', $versionPos, strlen( $versionSearch ) ); } } if ( !empty( $this->apiProviderToken ) ) { // Remove the first occurrence of API provider token $providerSearch = '/' . $this->apiProviderToken; $providerPos = strpos( $this->request->uri, $providerSearch ); if ( $providerPos !== false ) { $this->request->uri = substr_replace( $this->request->uri, '', $providerPos, strlen( $providerSearch ) ); } } }
[ "public", "function", "filterRequestUri", "(", ")", "{", "if", "(", "!", "empty", "(", "$", "this", "->", "versionToken", ")", ")", "{", "// Remove the first occurrence of version token", "$", "versionSearch", "=", "'/'", ".", "$", "this", "->", "versionToken", ...
Filters the URI property of the given ezcMvcRequest object, removing any version token from it. @return void
[ "Filters", "the", "URI", "property", "of", "the", "given", "ezcMvcRequest", "object", "removing", "any", "version", "token", "from", "it", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/prefix_filter.php#L127-L149
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.fetchById
public static function fetchById( $id ) { $states = self::fetchByConditions( array( "ezcobj_state.id=$id" ), 1, 0 ); $state = count( $states ) > 0 ? $states[0] : false; return $state; }
php
public static function fetchById( $id ) { $states = self::fetchByConditions( array( "ezcobj_state.id=$id" ), 1, 0 ); $state = count( $states ) > 0 ? $states[0] : false; return $state; }
[ "public", "static", "function", "fetchById", "(", "$", "id", ")", "{", "$", "states", "=", "self", "::", "fetchByConditions", "(", "array", "(", "\"ezcobj_state.id=$id\"", ")", ",", "1", ",", "0", ")", ";", "$", "state", "=", "count", "(", "$", "states...
Fetches a content object state by its numerical ID. @param integer $id the numerical ID of the content object state @return eZContentObjectState|boolean an instance of eZContentObjectState, or false if the requested state does not exist
[ "Fetches", "a", "content", "object", "state", "by", "its", "numerical", "ID", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L68-L73
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.fetchByIdentifier
public static function fetchByIdentifier( $identifier, $groupID ) { $db = eZDB::instance(); $identifier = $db->escapeString( $identifier ); $states = self::fetchByConditions( array( "ezcobj_state.identifier='$identifier'", "ezcobj_state_group.id=$groupID" ), 1, 0 ); $state = count( $states ) > 0 ? $states[0] : false; return $state; }
php
public static function fetchByIdentifier( $identifier, $groupID ) { $db = eZDB::instance(); $identifier = $db->escapeString( $identifier ); $states = self::fetchByConditions( array( "ezcobj_state.identifier='$identifier'", "ezcobj_state_group.id=$groupID" ), 1, 0 ); $state = count( $states ) > 0 ? $states[0] : false; return $state; }
[ "public", "static", "function", "fetchByIdentifier", "(", "$", "identifier", ",", "$", "groupID", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "identifier", "=", "$", "db", "->", "escapeString", "(", "$", "identifier", ")", "...
Fetches a content object state by its identifier and group ID @param string $identifier the identifier of the content object state, which is unique per content object state group @param integer $groupID the numerical ID of the content object state group @return eZContentObjectState|boolean an instance of eZContentObjectState, or false if the requested state does not exist
[ "Fetches", "a", "content", "object", "state", "by", "its", "identifier", "and", "group", "ID" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L83-L90
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.fetchByConditions
private static function fetchByConditions( $conditions, $limit, $offset ) { $db = eZDB::instance(); $defaultConditions = array( 'ezcobj_state.group_id=ezcobj_state_group.id', 'ezcobj_state_language.contentobject_state_id=ezcobj_state.id', eZContentLanguage::languagesSQLFilter( 'ezcobj_state' ), eZContentLanguage::sqlFilter( 'ezcobj_state_language', 'ezcobj_state' ) ); $conditions = array_merge( $conditions, $defaultConditions ); $conditionsSQL = implode( ' AND ', $conditions ); $sql = "SELECT ezcobj_state.*, ezcobj_state_language.* " . "FROM ezcobj_state, ezcobj_state_group, ezcobj_state_language " . "WHERE $conditionsSQL " . "ORDER BY ezcobj_state.priority"; $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) ); $states = array(); foreach ( $rows as $row ) { $state = new eZContentObjectState( $row ); $stateLanguage = new eZContentObjectStateLanguage( $row ); $state->setLanguageObject( $stateLanguage ); $states[] = $state; } return $states; }
php
private static function fetchByConditions( $conditions, $limit, $offset ) { $db = eZDB::instance(); $defaultConditions = array( 'ezcobj_state.group_id=ezcobj_state_group.id', 'ezcobj_state_language.contentobject_state_id=ezcobj_state.id', eZContentLanguage::languagesSQLFilter( 'ezcobj_state' ), eZContentLanguage::sqlFilter( 'ezcobj_state_language', 'ezcobj_state' ) ); $conditions = array_merge( $conditions, $defaultConditions ); $conditionsSQL = implode( ' AND ', $conditions ); $sql = "SELECT ezcobj_state.*, ezcobj_state_language.* " . "FROM ezcobj_state, ezcobj_state_group, ezcobj_state_language " . "WHERE $conditionsSQL " . "ORDER BY ezcobj_state.priority"; $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) ); $states = array(); foreach ( $rows as $row ) { $state = new eZContentObjectState( $row ); $stateLanguage = new eZContentObjectStateLanguage( $row ); $state->setLanguageObject( $stateLanguage ); $states[] = $state; } return $states; }
[ "private", "static", "function", "fetchByConditions", "(", "$", "conditions", ",", "$", "limit", ",", "$", "offset", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "defaultConditions", "=", "array", "(", "'ezcobj_state.group_id=ezcob...
Fetches content object states by conditions. The content object states are fetched in the right language, depending on the list of prioritized languages of the site access. @param $conditions @param $limit @param $offset @return array
[ "Fetches", "content", "object", "states", "by", "conditions", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L103-L135
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.fetchByGroup
public static function fetchByGroup( $groupID, $limit = false, $offset = false ) { return self::fetchByConditions( array( "ezcobj_state_group.id=$groupID" ), $limit, $offset ); }
php
public static function fetchByGroup( $groupID, $limit = false, $offset = false ) { return self::fetchByConditions( array( "ezcobj_state_group.id=$groupID" ), $limit, $offset ); }
[ "public", "static", "function", "fetchByGroup", "(", "$", "groupID", ",", "$", "limit", "=", "false", ",", "$", "offset", "=", "false", ")", "{", "return", "self", "::", "fetchByConditions", "(", "array", "(", "\"ezcobj_state_group.id=$groupID\"", ")", ",", ...
Fetches all content object states of a content object state group @param integer $groupID @param integer $limit @param integer $ofset @return array
[ "Fetches", "all", "content", "object", "states", "of", "a", "content", "object", "state", "group" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L146-L149
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.store
public function store( $fieldFilters = null ) { if ( $fieldFilters === null ) { $db = eZDB::instance(); $db->begin(); $languageMask = 1; // set language mask and always available bits foreach ( $this->AllTranslations() as $translation ) { if ( $translation->hasData() ) { $languageID = $translation->attribute( 'language_id' ); if ( empty( $this->DefaultLanguageID ) ) { $this->DefaultLanguageID = $languageID & ~1; } // if default language, set always available flag if ( $languageID & $this->DefaultLanguageID ) { $translation->setAttribute( 'language_id', $languageID | 1 ); } // otherwise, remove always available flag if it's set else if ( $languageID & 1 ) { $translation->setAttribute( 'language_id', $languageID & ~1 ); } $languageMask = $languageMask | $languageID; } } $assignToObjects = false; if ( !isset( $this->ID ) ) { $rows = $db->arrayQuery( "SELECT MAX(priority) AS max_priority FROM ezcobj_state WHERE group_id=" . $this->GroupID ); if ( count( $rows ) > 0 && $rows[0]['max_priority'] !== null ) { $this->setAttribute( 'priority', $rows[0]['max_priority'] + 1 ); } else { // this is the first state created in the state group // make all content objects use this state $assignToObjects = true; } } $this->setAttribute( 'language_mask', $languageMask ); // store state eZPersistentObject::storeObject( $this, $fieldFilters ); // store or remove translations foreach ( $this->AllTranslations as $translation ) { if ( !$translation->hasData() ) { // the name and description are empty // so the translation needs to be removed if it was stored before if ( $translation->attribute( 'contentobject_state_id' ) !== null ) { $translation->remove(); } } else { if ( $translation->attribute( 'contentobject_state_id' ) != $this->ID ) { $translation->setAttribute( 'contentobject_state_id', $this->ID ); } $translation->store(); } } if ( $assignToObjects ) { $stateID = $this->ID; $db->query( "INSERT INTO ezcobj_state_link (contentobject_id, contentobject_state_id) SELECT id, $stateID FROM ezcontentobject" ); } $db->commit(); } else { parent::store( $fieldFilters ); } }
php
public function store( $fieldFilters = null ) { if ( $fieldFilters === null ) { $db = eZDB::instance(); $db->begin(); $languageMask = 1; // set language mask and always available bits foreach ( $this->AllTranslations() as $translation ) { if ( $translation->hasData() ) { $languageID = $translation->attribute( 'language_id' ); if ( empty( $this->DefaultLanguageID ) ) { $this->DefaultLanguageID = $languageID & ~1; } // if default language, set always available flag if ( $languageID & $this->DefaultLanguageID ) { $translation->setAttribute( 'language_id', $languageID | 1 ); } // otherwise, remove always available flag if it's set else if ( $languageID & 1 ) { $translation->setAttribute( 'language_id', $languageID & ~1 ); } $languageMask = $languageMask | $languageID; } } $assignToObjects = false; if ( !isset( $this->ID ) ) { $rows = $db->arrayQuery( "SELECT MAX(priority) AS max_priority FROM ezcobj_state WHERE group_id=" . $this->GroupID ); if ( count( $rows ) > 0 && $rows[0]['max_priority'] !== null ) { $this->setAttribute( 'priority', $rows[0]['max_priority'] + 1 ); } else { // this is the first state created in the state group // make all content objects use this state $assignToObjects = true; } } $this->setAttribute( 'language_mask', $languageMask ); // store state eZPersistentObject::storeObject( $this, $fieldFilters ); // store or remove translations foreach ( $this->AllTranslations as $translation ) { if ( !$translation->hasData() ) { // the name and description are empty // so the translation needs to be removed if it was stored before if ( $translation->attribute( 'contentobject_state_id' ) !== null ) { $translation->remove(); } } else { if ( $translation->attribute( 'contentobject_state_id' ) != $this->ID ) { $translation->setAttribute( 'contentobject_state_id', $this->ID ); } $translation->store(); } } if ( $assignToObjects ) { $stateID = $this->ID; $db->query( "INSERT INTO ezcobj_state_link (contentobject_id, contentobject_state_id) SELECT id, $stateID FROM ezcontentobject" ); } $db->commit(); } else { parent::store( $fieldFilters ); } }
[ "public", "function", "store", "(", "$", "fieldFilters", "=", "null", ")", "{", "if", "(", "$", "fieldFilters", "===", "null", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "db", "->", "begin", "(", ")", ";", "$", "langu...
Stores the content object state and its translations. Before storing a content object state, you should use {@link eZContentObjectState::isValid()} to check its validness. @param array $fieldFilters
[ "Stores", "the", "content", "object", "state", "and", "its", "translations", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L300-L391
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.isValid
public function isValid( &$messages = array() ) { $isValid = true; // missing identifier if ( !isset( $this->Identifier ) || $this->Identifier == '' ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: input required' ); $isValid = false; } else { // make sure the identifier contains only valid characters $trans = eZCharTransform::instance(); $validIdentifier = $trans->transformByGroup( $this->Identifier, 'identifier' ); if ( strcmp( $validIdentifier, $this->Identifier ) != 0 ) { // invalid identifier $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: invalid, it can only consist of characters in the range a-z, 0-9 and underscore.' ); $isValid = false; } else if ( strlen( $this->Identifier ) > self::MAX_IDENTIFIER_LENGTH ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: invalid, maximum %max characters allowed.', null, array( '%max' => self::MAX_IDENTIFIER_LENGTH ) ); $isValid = false; } else if ( isset( $this->GroupID ) ) { // check for existing identifier $existingState = self::fetchByIdentifier( $this->Identifier, $this->GroupID ); if ( $existingState && ( !isset( $this->ID ) || $existingState->attribute( 'id' ) !== $this->ID ) ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: a content object state group with this identifier already exists, please give another identifier' ); $isValid = false; } } } $translationsWithData = 0; foreach ( $this->AllTranslations as $translation ) { if ( $translation->hasData() ) { $translationsWithData++; if ( !$translation->isValid( $messages ) ) { $isValid = false; } } else if ( ( $translation->attribute( 'language_id' ) & ~1 ) == $this->DefaultLanguageID ) { // if name nor description are set but translation is specified as main language $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', '%language_name: this language is the default but neither name or description were provided for this language', null, array( '%language_name' => $translation->attribute( 'language' )->attribute( 'locale_object' )->attribute( 'intl_language_name' ) ) ); } } if ( $translationsWithData == 0 ) { $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Translations: you need to add at least one localization' ); } else if ( empty( $this->DefaultLanguageID ) && $translationsWithData > 1 ) { $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Translations: there are multiple localizations but you did not specify which is the default one' ); } return $isValid; }
php
public function isValid( &$messages = array() ) { $isValid = true; // missing identifier if ( !isset( $this->Identifier ) || $this->Identifier == '' ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: input required' ); $isValid = false; } else { // make sure the identifier contains only valid characters $trans = eZCharTransform::instance(); $validIdentifier = $trans->transformByGroup( $this->Identifier, 'identifier' ); if ( strcmp( $validIdentifier, $this->Identifier ) != 0 ) { // invalid identifier $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: invalid, it can only consist of characters in the range a-z, 0-9 and underscore.' ); $isValid = false; } else if ( strlen( $this->Identifier ) > self::MAX_IDENTIFIER_LENGTH ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: invalid, maximum %max characters allowed.', null, array( '%max' => self::MAX_IDENTIFIER_LENGTH ) ); $isValid = false; } else if ( isset( $this->GroupID ) ) { // check for existing identifier $existingState = self::fetchByIdentifier( $this->Identifier, $this->GroupID ); if ( $existingState && ( !isset( $this->ID ) || $existingState->attribute( 'id' ) !== $this->ID ) ) { $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Identifier: a content object state group with this identifier already exists, please give another identifier' ); $isValid = false; } } } $translationsWithData = 0; foreach ( $this->AllTranslations as $translation ) { if ( $translation->hasData() ) { $translationsWithData++; if ( !$translation->isValid( $messages ) ) { $isValid = false; } } else if ( ( $translation->attribute( 'language_id' ) & ~1 ) == $this->DefaultLanguageID ) { // if name nor description are set but translation is specified as main language $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', '%language_name: this language is the default but neither name or description were provided for this language', null, array( '%language_name' => $translation->attribute( 'language' )->attribute( 'locale_object' )->attribute( 'intl_language_name' ) ) ); } } if ( $translationsWithData == 0 ) { $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Translations: you need to add at least one localization' ); } else if ( empty( $this->DefaultLanguageID ) && $translationsWithData > 1 ) { $isValid = false; $messages[] = ezpI18n::tr( 'kernel/state/edit', 'Translations: there are multiple localizations but you did not specify which is the default one' ); } return $isValid; }
[ "public", "function", "isValid", "(", "&", "$", "messages", "=", "array", "(", ")", ")", "{", "$", "isValid", "=", "true", ";", "// missing identifier", "if", "(", "!", "isset", "(", "$", "this", "->", "Identifier", ")", "||", "$", "this", "->", "Ide...
Checks if all data is valid and can be stored to the database. @param array &$messages @return boolean true when valid, false when not valid @see eZContentObjectState::store()
[ "Checks", "if", "all", "data", "is", "valid", "and", "can", "be", "stored", "to", "the", "database", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L409-L478
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.fetchHTTPPersistentVariables
public function fetchHTTPPersistentVariables() { $translations = $this->allTranslations(); $http = eZHTTPTool::instance(); eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectState::definition(), $this, $http, false ); eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectStateLanguage::definition(), $translations, $http, true ); }
php
public function fetchHTTPPersistentVariables() { $translations = $this->allTranslations(); $http = eZHTTPTool::instance(); eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectState::definition(), $this, $http, false ); eZHTTPPersistence::fetch( 'ContentObjectState' , eZContentObjectStateLanguage::definition(), $translations, $http, true ); }
[ "public", "function", "fetchHTTPPersistentVariables", "(", ")", "{", "$", "translations", "=", "$", "this", "->", "allTranslations", "(", ")", ";", "$", "http", "=", "eZHTTPTool", "::", "instance", "(", ")", ";", "eZHTTPPersistence", "::", "fetch", "(", "'Co...
Fetches the HTTP persistent variables for this content object state and its localizations. "ContentObjectState" is used as base name for the persistent variables. @see eZHTTPPersistence
[ "Fetches", "the", "HTTP", "persistent", "variables", "for", "this", "content", "object", "state", "and", "its", "localizations", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L539-L546
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezcontentobjectstate.php
eZContentObjectState.removeByID
public static function removeByID( $id ) { $db = eZDB::instance(); $db->begin(); $db->query( "DELETE FROM ezcobj_state_link WHERE contentobject_state_id=$id" ); eZPersistentObject::removeObject( eZContentObjectStateLanguage::definition(), array( 'contentobject_state_id' => $id ) ); eZPersistentObject::removeObject( eZContentObjectState::definition(), array( 'id' => $id ) ); $db->commit(); }
php
public static function removeByID( $id ) { $db = eZDB::instance(); $db->begin(); $db->query( "DELETE FROM ezcobj_state_link WHERE contentobject_state_id=$id" ); eZPersistentObject::removeObject( eZContentObjectStateLanguage::definition(), array( 'contentobject_state_id' => $id ) ); eZPersistentObject::removeObject( eZContentObjectState::definition(), array( 'id' => $id ) ); $db->commit(); }
[ "public", "static", "function", "removeByID", "(", "$", "id", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "db", "->", "begin", "(", ")", ";", "$", "db", "->", "query", "(", "\"DELETE FROM ezcobj_state_link WHERE contentobject_st...
Removes a content object state by its numerical ID This method should not be used directly, instead use {@link eZContentObjectStateGroup::removeStatesByID()}. @param integer $id the numerical ID of the content object state
[ "Removes", "a", "content", "object", "state", "by", "its", "numerical", "ID" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezcontentobjectstate.php#L555-L563
train
ezsystems/ezpublish-legacy
kernel/section/ezsectionfunctioncollection.php
eZSectionFunctionCollection.fetchSectionObject
function fetchSectionObject( $sectionID = false, $sectionIdentifier = false ) { if( $sectionID !== false ) { if( $sectionIdentifier !== false ) { $sectionObject = null; } else { $sectionObject = eZSection::fetch( $sectionID ); } } else { if( $sectionIdentifier === false ) { $sectionObject = null; } else { $sectionObject = eZSection::fetchByIdentifier( $sectionIdentifier ); } } if ( $sectionObject === null ) return array( 'error' => array( 'error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND ) ); return array( 'result' => $sectionObject ); }
php
function fetchSectionObject( $sectionID = false, $sectionIdentifier = false ) { if( $sectionID !== false ) { if( $sectionIdentifier !== false ) { $sectionObject = null; } else { $sectionObject = eZSection::fetch( $sectionID ); } } else { if( $sectionIdentifier === false ) { $sectionObject = null; } else { $sectionObject = eZSection::fetchByIdentifier( $sectionIdentifier ); } } if ( $sectionObject === null ) return array( 'error' => array( 'error_type' => 'kernel', 'error_code' => eZError::KERNEL_NOT_FOUND ) ); return array( 'result' => $sectionObject ); }
[ "function", "fetchSectionObject", "(", "$", "sectionID", "=", "false", ",", "$", "sectionIdentifier", "=", "false", ")", "{", "if", "(", "$", "sectionID", "!==", "false", ")", "{", "if", "(", "$", "sectionIdentifier", "!==", "false", ")", "{", "$", "sect...
Fetch section object given either section id or section identifier. There should be one and only one parameter. @param integer $sectionID @param string $sectionIdentifier @return object
[ "Fetch", "section", "object", "given", "either", "section", "id", "or", "section", "identifier", ".", "There", "should", "be", "one", "and", "only", "one", "parameter", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/section/ezsectionfunctioncollection.php#L25-L53
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezplanguageswitcher.php
ezpLanguageSwitcher.getSiteAccessIni
protected function getSiteAccessIni() { if ( $this->destinationSiteAccessIni === null ) { $this->destinationSiteAccessIni = eZSiteAccess::getIni( $this->destinationSiteAccess, 'site.ini' ); } return $this->destinationSiteAccessIni; }
php
protected function getSiteAccessIni() { if ( $this->destinationSiteAccessIni === null ) { $this->destinationSiteAccessIni = eZSiteAccess::getIni( $this->destinationSiteAccess, 'site.ini' ); } return $this->destinationSiteAccessIni; }
[ "protected", "function", "getSiteAccessIni", "(", ")", "{", "if", "(", "$", "this", "->", "destinationSiteAccessIni", "===", "null", ")", "{", "$", "this", "->", "destinationSiteAccessIni", "=", "eZSiteAccess", "::", "getIni", "(", "$", "this", "->", "destinat...
Get instance siteaccess specific site.ini @return void
[ "Get", "instance", "siteaccess", "specific", "site", ".", "ini" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezplanguageswitcher.php#L56-L63
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezplanguageswitcher.php
ezpLanguageSwitcher.isLocaleAvailableAsFallback
protected function isLocaleAvailableAsFallback() { $currentContentObjectLocale = eZINI::instance()->variable( 'RegionalSettings', 'ContentObjectLocale' ); $saIni = $this->getSiteAccessIni(); $siteLanguageList = $saIni->variable( 'RegionalSettings', 'SiteLanguageList' ); return in_array( $currentContentObjectLocale, $siteLanguageList, true ); }
php
protected function isLocaleAvailableAsFallback() { $currentContentObjectLocale = eZINI::instance()->variable( 'RegionalSettings', 'ContentObjectLocale' ); $saIni = $this->getSiteAccessIni(); $siteLanguageList = $saIni->variable( 'RegionalSettings', 'SiteLanguageList' ); return in_array( $currentContentObjectLocale, $siteLanguageList, true ); }
[ "protected", "function", "isLocaleAvailableAsFallback", "(", ")", "{", "$", "currentContentObjectLocale", "=", "eZINI", "::", "instance", "(", ")", "->", "variable", "(", "'RegionalSettings'", ",", "'ContentObjectLocale'", ")", ";", "$", "saIni", "=", "$", "this",...
Checks if the current content object locale is available in destination siteaccess. This is used to check whether we should pass on the original URL to the destination translation siteaccess, when no translation of an object exists in the destination locale. If the current content object locale exists as a fallback in the destination siteaccess, the original URL should be available there as well. @return bool
[ "Checks", "if", "the", "current", "content", "object", "locale", "is", "available", "in", "destination", "siteaccess", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezplanguageswitcher.php#L99-L105
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezplanguageswitcher.php
ezpLanguageSwitcher.addPathPrefixIfNeeded
protected static function addPathPrefixIfNeeded( $url ) { $siteINI = eZINI::instance( 'site.ini' ); if ( $siteINI->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) ) { $pathPrefix = $siteINI->variable( 'SiteAccessSettings', 'PathPrefix' ); if ( !empty( $pathPrefix ) ) { $url = $pathPrefix . '/' . $url; } } return $url; }
php
protected static function addPathPrefixIfNeeded( $url ) { $siteINI = eZINI::instance( 'site.ini' ); if ( $siteINI->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) ) { $pathPrefix = $siteINI->variable( 'SiteAccessSettings', 'PathPrefix' ); if ( !empty( $pathPrefix ) ) { $url = $pathPrefix . '/' . $url; } } return $url; }
[ "protected", "static", "function", "addPathPrefixIfNeeded", "(", "$", "url", ")", "{", "$", "siteINI", "=", "eZINI", "::", "instance", "(", "'site.ini'", ")", ";", "if", "(", "$", "siteINI", "->", "hasVariable", "(", "'SiteAccessSettings'", ",", "'PathPrefix'"...
Prepend PathPrefix from the current SA to url, if applicable @param string $url @return string The url with pathprefix prepended
[ "Prepend", "PathPrefix", "from", "the", "current", "SA", "to", "url", "if", "applicable" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezplanguageswitcher.php#L115-L127
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezplanguageswitcher.php
ezpLanguageSwitcher.process
public function process() { $saIni = $this->getSiteAccessIni(); $this->destinationLocale = $saIni->variable( 'RegionalSettings', 'ContentObjectLocale' ); // Detect the type of siteaccess we are dealing with. Initially URI and Host are supported. // We don't want the siteaccess part here, since we are inserting our siteaccess name. $indexFile = trim( eZSys::indexFile( false ), '/' ); switch ( $GLOBALS['eZCurrentAccess']['type'] ) { case eZSiteAccess::TYPE_URI: eZURI::transformURI( $host, true, 'full' ); break; default: $host = $saIni->variable( 'SiteSettings', 'SiteURL' ); $host = eZSys::serverProtocol()."://".$host; break; } $this->baseDestinationUrl = "{$host}{$indexFile}"; }
php
public function process() { $saIni = $this->getSiteAccessIni(); $this->destinationLocale = $saIni->variable( 'RegionalSettings', 'ContentObjectLocale' ); // Detect the type of siteaccess we are dealing with. Initially URI and Host are supported. // We don't want the siteaccess part here, since we are inserting our siteaccess name. $indexFile = trim( eZSys::indexFile( false ), '/' ); switch ( $GLOBALS['eZCurrentAccess']['type'] ) { case eZSiteAccess::TYPE_URI: eZURI::transformURI( $host, true, 'full' ); break; default: $host = $saIni->variable( 'SiteSettings', 'SiteURL' ); $host = eZSys::serverProtocol()."://".$host; break; } $this->baseDestinationUrl = "{$host}{$indexFile}"; }
[ "public", "function", "process", "(", ")", "{", "$", "saIni", "=", "$", "this", "->", "getSiteAccessIni", "(", ")", ";", "$", "this", "->", "destinationLocale", "=", "$", "saIni", "->", "variable", "(", "'RegionalSettings'", ",", "'ContentObjectLocale'", ")"...
This is a hook which is called by the language switcher module on implementation classes. In this implementation it is doing initialisation as an example. @return void
[ "This", "is", "a", "hook", "which", "is", "called", "by", "the", "language", "switcher", "module", "on", "implementation", "classes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezplanguageswitcher.php#L267-L287
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezplanguageswitcher.php
ezpLanguageSwitcher.setupTranslationSAList
public static function setupTranslationSAList( $url = null ) { $ini = eZINI::instance(); if ( !$ini->hasVariable( 'RegionalSettings', 'TranslationSA' ) ) { return array(); } $ret = array(); $translationSiteAccesses = $ini->variable( 'RegionalSettings', 'TranslationSA' ); foreach ( $translationSiteAccesses as $siteAccessName => $translationName ) { $switchLanguageLink = "/switchlanguage/to/{$siteAccessName}/"; if ( $url !== null && ( is_string( $url ) || is_numeric( $url ) ) ) { $switchLanguageLink .= $url; } $ret[$siteAccessName] = array( 'url' => $switchLanguageLink, 'text' => $translationName, 'locale' => eZSiteAccess::getIni( $siteAccessName )->variable( 'RegionalSettings', 'ContentObjectLocale' ) ); } return $ret; }
php
public static function setupTranslationSAList( $url = null ) { $ini = eZINI::instance(); if ( !$ini->hasVariable( 'RegionalSettings', 'TranslationSA' ) ) { return array(); } $ret = array(); $translationSiteAccesses = $ini->variable( 'RegionalSettings', 'TranslationSA' ); foreach ( $translationSiteAccesses as $siteAccessName => $translationName ) { $switchLanguageLink = "/switchlanguage/to/{$siteAccessName}/"; if ( $url !== null && ( is_string( $url ) || is_numeric( $url ) ) ) { $switchLanguageLink .= $url; } $ret[$siteAccessName] = array( 'url' => $switchLanguageLink, 'text' => $translationName, 'locale' => eZSiteAccess::getIni( $siteAccessName )->variable( 'RegionalSettings', 'ContentObjectLocale' ) ); } return $ret; }
[ "public", "static", "function", "setupTranslationSAList", "(", "$", "url", "=", "null", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "if", "(", "!", "$", "ini", "->", "hasVariable", "(", "'RegionalSettings'", ",", "'TranslationSA'",...
Creates an array of corresponding language switcher links and logical names. This mapping is set up in site.ini.[RegionalSettings].TranslationSA. The purpose of this method is to assist creation of language switcher links into the available translation siteaccesses on the system. This is used by the language_switcher template operator. @param string $url @return void
[ "Creates", "an", "array", "of", "corresponding", "language", "switcher", "links", "and", "logical", "names", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezplanguageswitcher.php#L301-L325
train
ezsystems/ezpublish-legacy
kernel/classes/ezproductcategory.php
eZProductCategory.fetchProductCountByCategory
static function fetchProductCountByCategory( $categoryID ) { $ini = eZINI::instance( 'shop.ini' ); if ( !$ini->hasVariable( 'VATSettings', 'ProductCategoryAttribute' ) || !$categoryAttrName = $ini->variable( 'VATSettings', 'ProductCategoryAttribute' ) ) return 0; $db = eZDB::instance(); $categoryID =(int) $categoryID; $categoryAttrName = $db->escapeString( $categoryAttrName ); $query = "SELECT COUNT(*) AS count " . " FROM ezcontentobject_attribute coa, ezcontentclass_attribute cca, ezcontentobject co " . "WHERE " . " cca.id=coa.contentclassattribute_id " . " AND coa.contentobject_id=co.id " . " AND cca.data_type_string='ezproductcategory' " . " AND cca.identifier='$categoryAttrName' " . " AND coa.version=co.current_version " . " AND coa.data_int=$categoryID"; $rows = $db->arrayQuery( $query ); return $rows[0]['count']; }
php
static function fetchProductCountByCategory( $categoryID ) { $ini = eZINI::instance( 'shop.ini' ); if ( !$ini->hasVariable( 'VATSettings', 'ProductCategoryAttribute' ) || !$categoryAttrName = $ini->variable( 'VATSettings', 'ProductCategoryAttribute' ) ) return 0; $db = eZDB::instance(); $categoryID =(int) $categoryID; $categoryAttrName = $db->escapeString( $categoryAttrName ); $query = "SELECT COUNT(*) AS count " . " FROM ezcontentobject_attribute coa, ezcontentclass_attribute cca, ezcontentobject co " . "WHERE " . " cca.id=coa.contentclassattribute_id " . " AND coa.contentobject_id=co.id " . " AND cca.data_type_string='ezproductcategory' " . " AND cca.identifier='$categoryAttrName' " . " AND coa.version=co.current_version " . " AND coa.data_int=$categoryID"; $rows = $db->arrayQuery( $query ); return $rows[0]['count']; }
[ "static", "function", "fetchProductCountByCategory", "(", "$", "categoryID", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", "'shop.ini'", ")", ";", "if", "(", "!", "$", "ini", "->", "hasVariable", "(", "'VATSettings'", ",", "'ProductCategoryAttribu...
Returns number of products belonging to the given category. \public \static
[ "Returns", "number", "of", "products", "belonging", "to", "the", "given", "category", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezproductcategory.php#L64-L85
train
ezsystems/ezpublish-legacy
kernel/classes/ezproductcategory.php
eZProductCategory.removeByID
static function removeByID( $id ) { $id = (int) $id; $db = eZDB::instance(); $db->begin(); // Delete references to the category from VAT charging rules. eZVatRule::removeReferencesToProductCategory( $id ); // Reset product category attribute for all products // that have been referencing the category. $ini = eZINI::instance( 'shop.ini' ); if ( $ini->hasVariable( 'VATSettings', 'ProductCategoryAttribute' ) && $categoryAttrName = $ini->variable( 'VATSettings', 'ProductCategoryAttribute' ) ) { $categoryAttrName = $db->escapeString( $categoryAttrName ); $query = "SELECT coa.id FROM ezcontentobject_attribute coa, ezcontentclass_attribute cca, ezcontentobject co " . "WHERE " . " cca.id=coa.contentclassattribute_id " . " AND coa.contentobject_id=co.id " . " AND cca.data_type_string='ezproductcategory' " . " AND cca.identifier='$categoryAttrName' " . " AND coa.version=co.current_version " . " AND coa.data_int=$id"; $rows = $db->arrayQuery( $query ); foreach ( $rows as $row ) { $query = "UPDATE ezcontentobject_attribute SET data_int=0, sort_key_int=0 WHERE id=" . (int) $row['id']; $db->query( $query ); } } // Remove the category itself. eZPersistentObject::removeObject( eZProductCategory::definition(), array( "id" => $id ) ); $db->commit(); }
php
static function removeByID( $id ) { $id = (int) $id; $db = eZDB::instance(); $db->begin(); // Delete references to the category from VAT charging rules. eZVatRule::removeReferencesToProductCategory( $id ); // Reset product category attribute for all products // that have been referencing the category. $ini = eZINI::instance( 'shop.ini' ); if ( $ini->hasVariable( 'VATSettings', 'ProductCategoryAttribute' ) && $categoryAttrName = $ini->variable( 'VATSettings', 'ProductCategoryAttribute' ) ) { $categoryAttrName = $db->escapeString( $categoryAttrName ); $query = "SELECT coa.id FROM ezcontentobject_attribute coa, ezcontentclass_attribute cca, ezcontentobject co " . "WHERE " . " cca.id=coa.contentclassattribute_id " . " AND coa.contentobject_id=co.id " . " AND cca.data_type_string='ezproductcategory' " . " AND cca.identifier='$categoryAttrName' " . " AND coa.version=co.current_version " . " AND coa.data_int=$id"; $rows = $db->arrayQuery( $query ); foreach ( $rows as $row ) { $query = "UPDATE ezcontentobject_attribute SET data_int=0, sort_key_int=0 WHERE id=" . (int) $row['id']; $db->query( $query ); } } // Remove the category itself. eZPersistentObject::removeObject( eZProductCategory::definition(), array( "id" => $id ) ); $db->commit(); }
[ "static", "function", "removeByID", "(", "$", "id", ")", "{", "$", "id", "=", "(", "int", ")", "$", "id", ";", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "db", "->", "begin", "(", ")", ";", "// Delete references to the category fro...
Remove the given category and all references to it. \public \static
[ "Remove", "the", "given", "category", "and", "all", "references", "to", "it", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezproductcategory.php#L101-L141
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentclassedithandler.php
eZContentClassEditHandler.store
public function store( eZContentClass $class, array $attributes, array &$unorderedParameters ) { $oldClassAttributes = $class->fetchAttributes( $class->attribute( 'id' ), true, eZContentClass::VERSION_STATUS_DEFINED ); // Delete object attributes which have been removed. foreach ( $oldClassAttributes as $oldClassAttribute ) { /** @var eZContentClassAttribute $oldClassAttribute */ $attributeExists = false; $oldClassAttributeID = $oldClassAttribute->attribute( 'id' ); foreach ( $class->fetchAttributes( ) as $newClassAttribute ) { if ( $oldClassAttributeID == $newClassAttribute->attribute( 'id' ) ) { $attributeExists = true; break; } } if ( !$attributeExists ) { foreach ( eZContentObjectAttribute::fetchSameClassAttributeIDList( $oldClassAttributeID ) as $objectAttribute ) { $objectAttribute->removeThis( $objectAttribute->attribute( 'id' ) ); } $oldClassAttribute->datatype()->deleteNotVersionedStoredClassAttribute( $oldClassAttribute ); } } $class->storeDefined( $attributes ); // Add object attributes which have been added. foreach ( $attributes as $newClassAttribute ) { $attributeExists = false; $newClassAttributeID = $newClassAttribute->attribute( 'id' ); foreach ( $oldClassAttributes as $oldClassAttribute ) { if ( $newClassAttributeID == $oldClassAttribute->attribute( 'id' ) ) { $attributeExists = true; break; } } if ( !$attributeExists ) { $newClassAttribute->initializeObjectAttributes( $objects ); } } }
php
public function store( eZContentClass $class, array $attributes, array &$unorderedParameters ) { $oldClassAttributes = $class->fetchAttributes( $class->attribute( 'id' ), true, eZContentClass::VERSION_STATUS_DEFINED ); // Delete object attributes which have been removed. foreach ( $oldClassAttributes as $oldClassAttribute ) { /** @var eZContentClassAttribute $oldClassAttribute */ $attributeExists = false; $oldClassAttributeID = $oldClassAttribute->attribute( 'id' ); foreach ( $class->fetchAttributes( ) as $newClassAttribute ) { if ( $oldClassAttributeID == $newClassAttribute->attribute( 'id' ) ) { $attributeExists = true; break; } } if ( !$attributeExists ) { foreach ( eZContentObjectAttribute::fetchSameClassAttributeIDList( $oldClassAttributeID ) as $objectAttribute ) { $objectAttribute->removeThis( $objectAttribute->attribute( 'id' ) ); } $oldClassAttribute->datatype()->deleteNotVersionedStoredClassAttribute( $oldClassAttribute ); } } $class->storeDefined( $attributes ); // Add object attributes which have been added. foreach ( $attributes as $newClassAttribute ) { $attributeExists = false; $newClassAttributeID = $newClassAttribute->attribute( 'id' ); foreach ( $oldClassAttributes as $oldClassAttribute ) { if ( $newClassAttributeID == $oldClassAttribute->attribute( 'id' ) ) { $attributeExists = true; break; } } if ( !$attributeExists ) { $newClassAttribute->initializeObjectAttributes( $objects ); } } }
[ "public", "function", "store", "(", "eZContentClass", "$", "class", ",", "array", "$", "attributes", ",", "array", "&", "$", "unorderedParameters", ")", "{", "$", "oldClassAttributes", "=", "$", "class", "->", "fetchAttributes", "(", "$", "class", "->", "att...
Store the modification made to an eZContentClass. @param eZContentClass Content class to be stored. @param array[eZContentClassAttribute] Attributes of the new content class. @param array Unordered view parameters
[ "Store", "the", "modification", "made", "to", "an", "eZContentClass", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentclassedithandler.php#L24-L71
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.xOffset
function xOffset() { $xOffset = $this->ez['xOffset']; if ( $xOffset == 0 || $this->leftMargin() > $this->ez['xOffset'] ) { $xOffset = $this->leftMargin(); } return $xOffset; }
php
function xOffset() { $xOffset = $this->ez['xOffset']; if ( $xOffset == 0 || $this->leftMargin() > $this->ez['xOffset'] ) { $xOffset = $this->leftMargin(); } return $xOffset; }
[ "function", "xOffset", "(", ")", "{", "$", "xOffset", "=", "$", "this", "->", "ez", "[", "'xOffset'", "]", ";", "if", "(", "$", "xOffset", "==", "0", "||", "$", "this", "->", "leftMargin", "(", ")", ">", "$", "this", "->", "ez", "[", "'xOffset'",...
Get the current X offset
[ "Get", "the", "current", "X", "offset" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L95-L104
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callAnchor
function callAnchor( $info ) { $paramArray = explode( ':', $info['p'] ); $this->addDestination( $paramArray[0], $paramArray[1], $this->yOffset() + $this->getFontHeight( $this->fontSize ) ); }
php
function callAnchor( $info ) { $paramArray = explode( ':', $info['p'] ); $this->addDestination( $paramArray[0], $paramArray[1], $this->yOffset() + $this->getFontHeight( $this->fontSize ) ); }
[ "function", "callAnchor", "(", "$", "info", ")", "{", "$", "paramArray", "=", "explode", "(", "':'", ",", "$", "info", "[", "'p'", "]", ")", ";", "$", "this", "->", "addDestination", "(", "$", "paramArray", "[", "0", "]", ",", "$", "paramArray", "[...
Callback function to set anchor
[ "Callback", "function", "to", "set", "anchor" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1104-L1109
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callHeader
function callHeader( $params ) { $options = array(); if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } if ( isset( $params['fontName'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['fontName']; } $this->addToPreStack( $options ); $label = $params['label']; $level = $params['level']; return '<C:callInsertTOC:'. $label .','. $level .'>'; }
php
function callHeader( $params ) { $options = array(); if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } if ( isset( $params['fontName'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['fontName']; } $this->addToPreStack( $options ); $label = $params['label']; $level = $params['level']; return '<C:callInsertTOC:'. $label .','. $level .'>'; }
[ "function", "callHeader", "(", "$", "params", ")", "{", "$", "options", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "params", "[", "'size'", "]", ")", ")", "{", "$", "options", "[", "'fontSize'", "]", "=", "$", "params", "[", "'siz...
Callback function to set header
[ "Callback", "function", "to", "set", "header" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1114-L1139
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callKeyword
function callKeyword( $info ) { $keyWord = $this->fixWhitespace( rawurldecode( $info['p'] ) ); $page = $this->ezWhatPageNumber($this->ezGetCurrentPageNumber()); if ( !isset( $this->KeywordArray[$keyWord] ) ) { $this->KeywordArray[$keyWord] = array(); } if ( !isset( $this->KeywordArray[$keyWord][(string)$page] ) ) { $label = $info['p'] .':'. $page; $this->KeywordArray[$keyWord][(string)$page] = array( 'label' => $label ); $this->addDestination( 'keyword:'.$label, 'FitH', $this->yOffset() ); } }
php
function callKeyword( $info ) { $keyWord = $this->fixWhitespace( rawurldecode( $info['p'] ) ); $page = $this->ezWhatPageNumber($this->ezGetCurrentPageNumber()); if ( !isset( $this->KeywordArray[$keyWord] ) ) { $this->KeywordArray[$keyWord] = array(); } if ( !isset( $this->KeywordArray[$keyWord][(string)$page] ) ) { $label = $info['p'] .':'. $page; $this->KeywordArray[$keyWord][(string)$page] = array( 'label' => $label ); $this->addDestination( 'keyword:'.$label, 'FitH', $this->yOffset() ); } }
[ "function", "callKeyword", "(", "$", "info", ")", "{", "$", "keyWord", "=", "$", "this", "->", "fixWhitespace", "(", "rawurldecode", "(", "$", "info", "[", "'p'", "]", ")", ")", ";", "$", "page", "=", "$", "this", "->", "ezWhatPageNumber", "(", "$", ...
function for inserting keyword
[ "function", "for", "inserting", "keyword" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1325-L1344
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callInsertTOC
function callInsertTOC( $info ) { $params = explode( ',', $info['p'] ); $label = $params[0]; $level = $params[1]; $tocCount = count( $this->TOC ); $this->TOC[] = array( 'label' => $this->fixWhitespace( rawurldecode( $label ) ), 'localPageNumber' => $this->ezWhatPageNumber( $this->ezGetCurrentPageNumber() ), 'level' => $level, 'pageNumber' => $this->ezGetCurrentPageNumber() ); $this->addDestination( 'toc'. $tocCount, 'FitH', $this->yOffset() + $this->getFontHeight( $this->fontSize() ) ); }
php
function callInsertTOC( $info ) { $params = explode( ',', $info['p'] ); $label = $params[0]; $level = $params[1]; $tocCount = count( $this->TOC ); $this->TOC[] = array( 'label' => $this->fixWhitespace( rawurldecode( $label ) ), 'localPageNumber' => $this->ezWhatPageNumber( $this->ezGetCurrentPageNumber() ), 'level' => $level, 'pageNumber' => $this->ezGetCurrentPageNumber() ); $this->addDestination( 'toc'. $tocCount, 'FitH', $this->yOffset() + $this->getFontHeight( $this->fontSize() ) ); }
[ "function", "callInsertTOC", "(", "$", "info", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$", "info", "[", "'p'", "]", ")", ";", "$", "label", "=", "$", "params", "[", "0", "]", ";", "$", "level", "=", "$", "params", "[", "1", ...
function for inserting TOC
[ "function", "for", "inserting", "TOC" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1349-L1364
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callTOC
function callTOC( $info ) { $params = array(); eZPDFTable::extractParameters( $info['p'], 0, $params, true ); $sizes = isset( $params['size'] ) ? explode( ',', $params['size'] ) : ''; $indents = isset( $params['indent'] ) ? explode( ',', $params['indent'] ) : ''; $dots = isset( $params['dots'] ) ? $params['dots'] : ''; $contentText = isset( $params['contentText'] ) ? $params['contentText'] : ezpI18n::tr( 'lib/ezpdf/classes', 'Contents', 'Table of contents' ); $this->insertTOC( $sizes, $indents, $dots, $contentText ); }
php
function callTOC( $info ) { $params = array(); eZPDFTable::extractParameters( $info['p'], 0, $params, true ); $sizes = isset( $params['size'] ) ? explode( ',', $params['size'] ) : ''; $indents = isset( $params['indent'] ) ? explode( ',', $params['indent'] ) : ''; $dots = isset( $params['dots'] ) ? $params['dots'] : ''; $contentText = isset( $params['contentText'] ) ? $params['contentText'] : ezpI18n::tr( 'lib/ezpdf/classes', 'Contents', 'Table of contents' ); $this->insertTOC( $sizes, $indents, $dots, $contentText ); }
[ "function", "callTOC", "(", "$", "info", ")", "{", "$", "params", "=", "array", "(", ")", ";", "eZPDFTable", "::", "extractParameters", "(", "$", "info", "[", "'p'", "]", ",", "0", ",", "$", "params", ",", "true", ")", ";", "$", "sizes", "=", "is...
Callback function for inserting TOC
[ "Callback", "function", "for", "inserting", "TOC" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1369-L1381
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callFont
function callFont( $params ) { $options = array(); $keyArray = array ( 'c', 'm', 'y', 'k' ); if ( isset( $params['cmyk'] ) ) { $params['cmyk'] = explode( ',', $params['cmyk'] ); foreach ( array_keys( $params['cmyk'] ) as $key ) { $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key]; } $this->setStrokeColor( $params['cmyk'] ); } if ( isset( $params['name'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['name']; } if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } $this->addToPreStack( $options ); return ''; }
php
function callFont( $params ) { $options = array(); $keyArray = array ( 'c', 'm', 'y', 'k' ); if ( isset( $params['cmyk'] ) ) { $params['cmyk'] = explode( ',', $params['cmyk'] ); foreach ( array_keys( $params['cmyk'] ) as $key ) { $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key]; } $this->setStrokeColor( $params['cmyk'] ); } if ( isset( $params['name'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['name']; } if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } $this->addToPreStack( $options ); return ''; }
[ "function", "callFont", "(", "$", "params", ")", "{", "$", "options", "=", "array", "(", ")", ";", "$", "keyArray", "=", "array", "(", "'c'", ",", "'m'", ",", "'y'", ",", "'k'", ")", ";", "if", "(", "isset", "(", "$", "params", "[", "'cmyk'", "...
Callback function to set font
[ "Callback", "function", "to", "set", "font" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L1494-L1527
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.extractFunction
function extractFunction( &$text, $offSet, &$functionName, &$parameters, $type='ezCall' ) { $offSet++; $offSet += strlen( $type.':' ); $funcEnd = strpos( $text, ':', $offSet ); if ( $funcEnd === false || strpos( $text, '>', $offSet ) < $funcEnd ) { $funcEnd = strpos( $text, '>', $offSet ); } $functionName = substr( $text, $offSet, $funcEnd - $offSet ); return eZPDFTable::extractParameters( $text, $funcEnd, $parameters ); }
php
function extractFunction( &$text, $offSet, &$functionName, &$parameters, $type='ezCall' ) { $offSet++; $offSet += strlen( $type.':' ); $funcEnd = strpos( $text, ':', $offSet ); if ( $funcEnd === false || strpos( $text, '>', $offSet ) < $funcEnd ) { $funcEnd = strpos( $text, '>', $offSet ); } $functionName = substr( $text, $offSet, $funcEnd - $offSet ); return eZPDFTable::extractParameters( $text, $funcEnd, $parameters ); }
[ "function", "extractFunction", "(", "&", "$", "text", ",", "$", "offSet", ",", "&", "$", "functionName", ",", "&", "$", "parameters", ",", "$", "type", "=", "'ezCall'", ")", "{", "$", "offSet", "++", ";", "$", "offSet", "+=", "strlen", "(", "$", "t...
Function for extracting function name and parameters from text. \param text \param offset \param function name (reference) \param parameters array (reference) \return end offset of function
[ "Function", "for", "extracting", "function", "name", "and", "parameters", "from", "text", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2433-L2445
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.outputDocSpecification
function outputDocSpecification() { foreach( array_keys( $this->DocSpecification ) as $key ) { $outputElement =& $this->DocSpecification[$key]; $documentSpec =& $outputElement['docSpec']; if ( isset( $documentSpec['fontName'] ) ) { $this->selectFont( $documentSpec['fontName'] ); } if ( isset( $documentSpec['fontSize'] ) ) { $size = $documentSpec['fontSize']; } else { $size = $this->fontSize(); } if ( isset( $documentSpec['cmyk'] ) ) { $this->setColor( $documentSpec['cmyk'] ); } if ( isset( $outputElement['isFunction'] ) && $outputElement['isFunction'] === true ) { $return = call_user_func_array( array( &$this, $outputElement['functionName'] ), $outputElement['parameters'] ); } else { $return = Cezpdf::ezText( $outputElement['text'], $size, array( 'justification' => $documentSpec['justification'] ) ); } } return $return; }
php
function outputDocSpecification() { foreach( array_keys( $this->DocSpecification ) as $key ) { $outputElement =& $this->DocSpecification[$key]; $documentSpec =& $outputElement['docSpec']; if ( isset( $documentSpec['fontName'] ) ) { $this->selectFont( $documentSpec['fontName'] ); } if ( isset( $documentSpec['fontSize'] ) ) { $size = $documentSpec['fontSize']; } else { $size = $this->fontSize(); } if ( isset( $documentSpec['cmyk'] ) ) { $this->setColor( $documentSpec['cmyk'] ); } if ( isset( $outputElement['isFunction'] ) && $outputElement['isFunction'] === true ) { $return = call_user_func_array( array( &$this, $outputElement['functionName'] ), $outputElement['parameters'] ); } else { $return = Cezpdf::ezText( $outputElement['text'], $size, array( 'justification' => $documentSpec['justification'] ) ); } } return $return; }
[ "function", "outputDocSpecification", "(", ")", "{", "foreach", "(", "array_keys", "(", "$", "this", "->", "DocSpecification", ")", "as", "$", "key", ")", "{", "$", "outputElement", "=", "&", "$", "this", "->", "DocSpecification", "[", "$", "key", "]", "...
Loop through all document specification settings and print specified text \return new Y offset
[ "Loop", "through", "all", "document", "specification", "settings", "and", "print", "specified", "text" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2489-L2528
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.callText
function callText( $params ) { $options = array(); if ( isset( $params['font'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['font']; } if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } if ( isset( $params['cmyk'] ) ) { $keyArray = array ( 'c', 'm', 'y', 'k' ); $options['cmyk'] = array(); $params['cmyk'] = explode( ',', $params['cmyk'] ); foreach ( array_keys( $params['cmyk'] ) as $key ) { $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key]; } } $this->addToPreStack( $options ); return ''; }
php
function callText( $params ) { $options = array(); if ( isset( $params['font'] ) ) { $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['font']; } if ( isset( $params['size'] ) ) { $options['fontSize'] = $params['size']; } if ( isset( $params['justification'] ) ) { $options['justification'] = $params['justification']; } if ( isset( $params['cmyk'] ) ) { $keyArray = array ( 'c', 'm', 'y', 'k' ); $options['cmyk'] = array(); $params['cmyk'] = explode( ',', $params['cmyk'] ); foreach ( array_keys( $params['cmyk'] ) as $key ) { $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key]; } } $this->addToPreStack( $options ); return ''; }
[ "function", "callText", "(", "$", "params", ")", "{", "$", "options", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "params", "[", "'font'", "]", ")", ")", "{", "$", "options", "[", "'fontName'", "]", "=", "'lib/ezpdf/classes/fonts/'", "...
Callback function for adding text
[ "Callback", "function", "for", "adding", "text" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2688-L2721
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.addDocSpecification
function addDocSpecification( $text ) { $docSpec = array_pop( $this->PreStack ); $this->DocSpecification[] = array ( 'docSpec' => $docSpec, 'text' => $text ); $this->PreStack[] = $docSpec; }
php
function addDocSpecification( $text ) { $docSpec = array_pop( $this->PreStack ); $this->DocSpecification[] = array ( 'docSpec' => $docSpec, 'text' => $text ); $this->PreStack[] = $docSpec; }
[ "function", "addDocSpecification", "(", "$", "text", ")", "{", "$", "docSpec", "=", "array_pop", "(", "$", "this", "->", "PreStack", ")", ";", "$", "this", "->", "DocSpecification", "[", "]", "=", "array", "(", "'docSpec'", "=>", "$", "docSpec", ",", "...
Function for adding text to doc specification param - text to add
[ "Function", "for", "adding", "text", "to", "doc", "specification" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2787-L2793
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.addDocSpecFunction
function addDocSpecFunction( $functionName, $parameters ) { $docSpec = array_pop( $this->PreStack ); $this->DocSpecification[] = array ( 'docSpec' => $docSpec, 'isFunction' => true, 'functionName' => $functionName, 'parameters' => $parameters ); $this->PreStack[] = $docSpec; }
php
function addDocSpecFunction( $functionName, $parameters ) { $docSpec = array_pop( $this->PreStack ); $this->DocSpecification[] = array ( 'docSpec' => $docSpec, 'isFunction' => true, 'functionName' => $functionName, 'parameters' => $parameters ); $this->PreStack[] = $docSpec; }
[ "function", "addDocSpecFunction", "(", "$", "functionName", ",", "$", "parameters", ")", "{", "$", "docSpec", "=", "array_pop", "(", "$", "this", "->", "PreStack", ")", ";", "$", "this", "->", "DocSpecification", "[", "]", "=", "array", "(", "'docSpec'", ...
Function for adding function to doc specification param - text to add
[ "Function", "for", "adding", "function", "to", "doc", "specification" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2800-L2808
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.ezpdftable.php
eZPDFTable.addToPreStack
function addToPreStack( $options=array() ) { $currentElement = array(); $prevElement = array_pop( $this->PreStack ); if ( isset( $options['justification'] ) ) { $currentElement['justification'] = $options['justification']; } else { $currentElement['justification'] = $prevElement['justification']; } if ( isset( $options['fontSize'] ) ) { $currentElement['fontSize'] = $options['fontSize']; } else { $currentElement['fontSize'] = $prevElement['fontSize']; } if ( isset( $options['fontName'] ) ) { $currentElement['fontName'] = $options['fontName']; } else { $currentElement['fontName'] = $prevElement['fontName']; } if ( isset( $options['cmyk'] ) ) { $currentElement['cmyk'] = $options['cmyk']; } else { $currentElement['cmyk'] = $prevElement['cmyk']; } $this->PreStack[] = $prevElement; $this->PreStack[] = $currentElement; }
php
function addToPreStack( $options=array() ) { $currentElement = array(); $prevElement = array_pop( $this->PreStack ); if ( isset( $options['justification'] ) ) { $currentElement['justification'] = $options['justification']; } else { $currentElement['justification'] = $prevElement['justification']; } if ( isset( $options['fontSize'] ) ) { $currentElement['fontSize'] = $options['fontSize']; } else { $currentElement['fontSize'] = $prevElement['fontSize']; } if ( isset( $options['fontName'] ) ) { $currentElement['fontName'] = $options['fontName']; } else { $currentElement['fontName'] = $prevElement['fontName']; } if ( isset( $options['cmyk'] ) ) { $currentElement['cmyk'] = $options['cmyk']; } else { $currentElement['cmyk'] = $prevElement['cmyk']; } $this->PreStack[] = $prevElement; $this->PreStack[] = $currentElement; }
[ "function", "addToPreStack", "(", "$", "options", "=", "array", "(", ")", ")", "{", "$", "currentElement", "=", "array", "(", ")", ";", "$", "prevElement", "=", "array_pop", "(", "$", "this", "->", "PreStack", ")", ";", "if", "(", "isset", "(", "$", ...
function for adding font specification to PreStack array Possible $options setting: - justification - fontSize - fontName
[ "function", "for", "adding", "font", "specification", "to", "PreStack", "array" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.ezpdftable.php#L2819-L2863
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjectattribute.php
eZContentObjectAttribute.initialize
function initialize( $currentVersion = null, $originalContentObjectAttribute = null ) { if ( $originalContentObjectAttribute === null ) $originalContentObjectAttribute = $this; $classAttribute = $this->contentClassAttribute(); $dataType = $classAttribute->dataType(); if ( $dataType ) $dataType->initializeObjectAttribute( $this, $currentVersion, $originalContentObjectAttribute ); }
php
function initialize( $currentVersion = null, $originalContentObjectAttribute = null ) { if ( $originalContentObjectAttribute === null ) $originalContentObjectAttribute = $this; $classAttribute = $this->contentClassAttribute(); $dataType = $classAttribute->dataType(); if ( $dataType ) $dataType->initializeObjectAttribute( $this, $currentVersion, $originalContentObjectAttribute ); }
[ "function", "initialize", "(", "$", "currentVersion", "=", "null", ",", "$", "originalContentObjectAttribute", "=", "null", ")", "{", "if", "(", "$", "originalContentObjectAttribute", "===", "null", ")", "$", "originalContentObjectAttribute", "=", "$", "this", ";"...
Initializes the attribute by using the datatype @param int $currentVersion Current version number @param eZContentObjectAttribute $originalContentObjectAttribute Optional eZContentObjectAttribute the content will be initialized from @return void
[ "Initializes", "the", "attribute", "by", "using", "the", "datatype" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjectattribute.php#L869-L877
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjectattribute.php
eZContentObjectAttribute.cloneContentObjectAttribute
function cloneContentObjectAttribute( $newVersionNumber, $currentVersionNumber, $contentObjectID = false, $newLanguageCode = false ) { $tmp = clone $this; $tmp->setAttribute( "version", $newVersionNumber ); if ( $contentObjectID != false ) { // if copying the whole object if ( $contentObjectID != $tmp->attribute( 'contentobject_id' ) ) { $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), null, array( 'contentobject_id' => $contentObjectID, 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 'language_code' => $tmp->attribute( 'language_code' ) ), true ); // if the new object already contains the same attribute with another version if ( is_object( $exAttr ) ) // we take attribute id from it $id = $exAttr->attribute( 'id' ); else // otherwise new attribute id will be generated $id = null; $tmp->setAttribute( 'id', $id ); } $tmp->setAttribute( 'contentobject_id', $contentObjectID ); } else { // if not copying, we will remove the information on which language has to be always shown $tmp->setAttribute( 'language_id', $tmp->attribute( 'language_id' ) & ~1 ); } if ( $newLanguageCode != false && $tmp->attribute( 'language_code' ) != $newLanguageCode ) { $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), null, array( 'contentobject_id' => $contentObjectID? $contentObjectID: $tmp->attribute( 'contentobject_id' ), 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 'language_code' => $newLanguageCode ), true ); // if the new object already contains the same attribute with another version if ( is_object( $exAttr ) ) { $id = $exAttr->attribute( 'id' ); } else { $id = null; } $tmp->setAttribute( 'id', $id ); $tmp->setAttribute( 'language_code', $newLanguageCode ); $tmp->setAttribute( 'language_id', eZContentLanguage::idByLocale( $newLanguageCode ) ); } $db = eZDB::instance(); $db->begin(); $tmp->sync(); $tmp->initialize( $currentVersionNumber, $this ); $tmp->sync(); $tmp->postInitialize( $currentVersionNumber, $this ); $db->commit(); return $tmp; }
php
function cloneContentObjectAttribute( $newVersionNumber, $currentVersionNumber, $contentObjectID = false, $newLanguageCode = false ) { $tmp = clone $this; $tmp->setAttribute( "version", $newVersionNumber ); if ( $contentObjectID != false ) { // if copying the whole object if ( $contentObjectID != $tmp->attribute( 'contentobject_id' ) ) { $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), null, array( 'contentobject_id' => $contentObjectID, 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 'language_code' => $tmp->attribute( 'language_code' ) ), true ); // if the new object already contains the same attribute with another version if ( is_object( $exAttr ) ) // we take attribute id from it $id = $exAttr->attribute( 'id' ); else // otherwise new attribute id will be generated $id = null; $tmp->setAttribute( 'id', $id ); } $tmp->setAttribute( 'contentobject_id', $contentObjectID ); } else { // if not copying, we will remove the information on which language has to be always shown $tmp->setAttribute( 'language_id', $tmp->attribute( 'language_id' ) & ~1 ); } if ( $newLanguageCode != false && $tmp->attribute( 'language_code' ) != $newLanguageCode ) { $exAttr = eZPersistentObject::fetchObject( eZContentObjectAttribute::definition(), null, array( 'contentobject_id' => $contentObjectID? $contentObjectID: $tmp->attribute( 'contentobject_id' ), 'contentclassattribute_id' => $tmp->attribute( 'contentclassattribute_id' ), 'language_code' => $newLanguageCode ), true ); // if the new object already contains the same attribute with another version if ( is_object( $exAttr ) ) { $id = $exAttr->attribute( 'id' ); } else { $id = null; } $tmp->setAttribute( 'id', $id ); $tmp->setAttribute( 'language_code', $newLanguageCode ); $tmp->setAttribute( 'language_id', eZContentLanguage::idByLocale( $newLanguageCode ) ); } $db = eZDB::instance(); $db->begin(); $tmp->sync(); $tmp->initialize( $currentVersionNumber, $this ); $tmp->sync(); $tmp->postInitialize( $currentVersionNumber, $this ); $db->commit(); return $tmp; }
[ "function", "cloneContentObjectAttribute", "(", "$", "newVersionNumber", ",", "$", "currentVersionNumber", ",", "$", "contentObjectID", "=", "false", ",", "$", "newLanguageCode", "=", "false", ")", "{", "$", "tmp", "=", "clone", "$", "this", ";", "$", "tmp", ...
Clones the attribute to a new version @param int $newVersionNumber Target version number @param int $currentVersionNumnber Source version number @param int $contentObjectID @param string $newLanguageCode @note The cloned attribute isn't stored automatically @return eZContentObjectAttribute The cloned attribute @todo Deprecate this in favor of a real __clone
[ "Clones", "the", "attribute", "to", "a", "new", "version" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjectattribute.php#L930-L995
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjectattribute.php
eZContentObjectAttribute.dataType
function dataType() { $dataType = null; if( $this->DataTypeString !== null ) $dataType = eZDataType::create( $this->DataTypeString ); return $dataType; }
php
function dataType() { $dataType = null; if( $this->DataTypeString !== null ) $dataType = eZDataType::create( $this->DataTypeString ); return $dataType; }
[ "function", "dataType", "(", ")", "{", "$", "dataType", "=", "null", ";", "if", "(", "$", "this", "->", "DataTypeString", "!==", "null", ")", "$", "dataType", "=", "eZDataType", "::", "create", "(", "$", "this", "->", "DataTypeString", ")", ";", "retur...
Returns the data type class for the current attribute. @return eZDataType
[ "Returns", "the", "data", "type", "class", "for", "the", "current", "attribute", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjectattribute.php#L1038-L1045
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjectattribute.php
eZContentObjectAttribute.removeRelationsByContentClassAttributeId
public static function removeRelationsByContentClassAttributeId( $attributeId ) { $id = (int)$attributeId; $db = eZDB::instance(); $db->query( "DELETE FROM ezcontentobject_link WHERE contentclassattribute_id=$id" ); }
php
public static function removeRelationsByContentClassAttributeId( $attributeId ) { $id = (int)$attributeId; $db = eZDB::instance(); $db->query( "DELETE FROM ezcontentobject_link WHERE contentclassattribute_id=$id" ); }
[ "public", "static", "function", "removeRelationsByContentClassAttributeId", "(", "$", "attributeId", ")", "{", "$", "id", "=", "(", "int", ")", "$", "attributeId", ";", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "db", "->", "query", "(...
Removes all links for a given Class Attribute Id. @param int $attributeId
[ "Removes", "all", "links", "for", "a", "given", "Class", "Attribute", "Id", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjectattribute.php#L1467-L1472
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.appendLineParagraph
function appendLineParagraph( $element, $newParent ) { eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext', $newParent, 'eZSimplifiedXMLInputParser::appendLineParagraph new parent' ); $ret = array(); $parent = $element->parentNode; if ( !$parent instanceof DOMElement ) { return $ret; } $parentName = $parent->nodeName; $newParentName = $newParent != null ? $newParent->nodeName : ''; // Correct structure by adding <line> and <paragraph> tags. if ( $parentName == 'line' || $this->XMLSchema->isInline( $parent ) ) { return $ret; } if ( $newParentName == 'line' ) { $element = $parent->removeChild( $element ); $newParent->appendChild( $element ); $newLine = $newParent; $ret['result'] = $newParent; } else if ( $parentName === 'header' && ( $parent->getElementsByTagName( 'line' )->length || $parent->getElementsByTagName( 'br' )->length ) ) { // by default the header element does not need a line element // unless it contains a <br> or a previously created <line> $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->replaceChild( $newLine, $element ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $parentName == 'paragraph' ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->replaceChild( $newLine, $element ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $newParentName == 'paragraph' ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->removeChild( $element ); $newParent->appendChild( $newLine ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $this->XMLSchema->check( $parent, 'paragraph' ) ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $newPara = $this->createAndPublishElement( 'paragraph', $ret ); $element = $parent->replaceChild( $newPara, $element ); $newPara->appendChild( $newLine ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } return $ret; }
php
function appendLineParagraph( $element, $newParent ) { eZDebugSetting::writeDebug( 'kernel-datatype-ezxmltext', $newParent, 'eZSimplifiedXMLInputParser::appendLineParagraph new parent' ); $ret = array(); $parent = $element->parentNode; if ( !$parent instanceof DOMElement ) { return $ret; } $parentName = $parent->nodeName; $newParentName = $newParent != null ? $newParent->nodeName : ''; // Correct structure by adding <line> and <paragraph> tags. if ( $parentName == 'line' || $this->XMLSchema->isInline( $parent ) ) { return $ret; } if ( $newParentName == 'line' ) { $element = $parent->removeChild( $element ); $newParent->appendChild( $element ); $newLine = $newParent; $ret['result'] = $newParent; } else if ( $parentName === 'header' && ( $parent->getElementsByTagName( 'line' )->length || $parent->getElementsByTagName( 'br' )->length ) ) { // by default the header element does not need a line element // unless it contains a <br> or a previously created <line> $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->replaceChild( $newLine, $element ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $parentName == 'paragraph' ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->replaceChild( $newLine, $element ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $newParentName == 'paragraph' ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $element = $parent->removeChild( $element ); $newParent->appendChild( $newLine ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } elseif ( $this->XMLSchema->check( $parent, 'paragraph' ) ) { $newLine = $this->createAndPublishElement( 'line', $ret ); $newPara = $this->createAndPublishElement( 'paragraph', $ret ); $element = $parent->replaceChild( $newPara, $element ); $newPara->appendChild( $newLine ); $newLine->appendChild( $element ); $ret['result'] = $newLine; } return $ret; }
[ "function", "appendLineParagraph", "(", "$", "element", ",", "$", "newParent", ")", "{", "eZDebugSetting", "::", "writeDebug", "(", "'kernel-datatype-ezxmltext'", ",", "$", "newParent", ",", "'eZSimplifiedXMLInputParser::appendLineParagraph new parent'", ")", ";", "$", ...
Structure handler for inline nodes.
[ "Structure", "handler", "for", "inline", "nodes", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L254-L321
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.structHandlerCustom
function structHandlerCustom( $element, &$params ) { $ret = null; if ( $this->XMLSchema->isInline( $element ) ) { $ret = $this->appendLineParagraph( $element, $params ); } else { $ret = $this->appendParagraph( $element, $params ); } return $ret; }
php
function structHandlerCustom( $element, &$params ) { $ret = null; if ( $this->XMLSchema->isInline( $element ) ) { $ret = $this->appendLineParagraph( $element, $params ); } else { $ret = $this->appendParagraph( $element, $params ); } return $ret; }
[ "function", "structHandlerCustom", "(", "$", "element", ",", "&", "$", "params", ")", "{", "$", "ret", "=", "null", ";", "if", "(", "$", "this", "->", "XMLSchema", "->", "isInline", "(", "$", "element", ")", ")", "{", "$", "ret", "=", "$", "this", ...
Structure handler for 'custom' tag.
[ "Structure", "handler", "for", "custom", "tag", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L564-L576
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.structHandlerLists
function structHandlerLists( $element, &$params ) { $ret = array(); $parent = $element->parentNode; $parentName = $parent->nodeName; if ( $parentName == 'paragraph' ) { return $ret; } // If we are inside a list if ( $parentName == 'ol' || $parentName == 'ul' ) { // If previous 'li' doesn't exist, create it, // else append to the previous 'li' element. $prev = $element->previousSibling; if ( !$prev ) { $li = $this->Document->createElement( 'li' ); $li = $parent->insertBefore( $li, $element ); $element = $parent->removeChild( $element ); $li->appendChild( $element ); } else { $lastChild = $prev->lastChild; if ( $lastChild->nodeName != 'paragraph' ) { $para = $this->Document->createElement( 'paragraph' ); $element = $parent->removeChild( $element ); $prev->appendChild( $element ); $ret['result'] = $para; } else { $element = $parent->removeChild( $element ); $lastChild->appendChild( $element ); $ret['result'] = $lastChild; } return $ret; } } if ( $parentName == 'li' ) { $prev = $element->previousSibling; if ( $prev ) { $element = $parent->removeChild( $element ); $prev->appendChild( $element ); $ret['result'] = $prev; return $ret; } } $ret = $this->appendParagraph( $element, $params ); return $ret; }
php
function structHandlerLists( $element, &$params ) { $ret = array(); $parent = $element->parentNode; $parentName = $parent->nodeName; if ( $parentName == 'paragraph' ) { return $ret; } // If we are inside a list if ( $parentName == 'ol' || $parentName == 'ul' ) { // If previous 'li' doesn't exist, create it, // else append to the previous 'li' element. $prev = $element->previousSibling; if ( !$prev ) { $li = $this->Document->createElement( 'li' ); $li = $parent->insertBefore( $li, $element ); $element = $parent->removeChild( $element ); $li->appendChild( $element ); } else { $lastChild = $prev->lastChild; if ( $lastChild->nodeName != 'paragraph' ) { $para = $this->Document->createElement( 'paragraph' ); $element = $parent->removeChild( $element ); $prev->appendChild( $element ); $ret['result'] = $para; } else { $element = $parent->removeChild( $element ); $lastChild->appendChild( $element ); $ret['result'] = $lastChild; } return $ret; } } if ( $parentName == 'li' ) { $prev = $element->previousSibling; if ( $prev ) { $element = $parent->removeChild( $element ); $prev->appendChild( $element ); $ret['result'] = $prev; return $ret; } } $ret = $this->appendParagraph( $element, $params ); return $ret; }
[ "function", "structHandlerLists", "(", "$", "element", ",", "&", "$", "params", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "$", "parent", "=", "$", "element", "->", "parentNode", ";", "$", "parentName", "=", "$", "parent", "->", "nodeName", "...
Structure handler for 'ul' and 'ol' tags.
[ "Structure", "handler", "for", "ul", "and", "ol", "tags", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L579-L636
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.publishHandlerParagraph
function publishHandlerParagraph( $element, &$params ) { $ret = null; // Removes single line tag $line = $element->lastChild; if ( $element->childNodes->length == 1 && $line->nodeName == 'line' ) { $lineChildren = array(); $lineChildNodes = $line->childNodes; foreach ( $lineChildNodes as $lineChildNode ) { $lineChildren[] = $lineChildNode; } $line = $element->removeChild( $line ); foreach ( $lineChildren as $lineChild ) { $element->appendChild( $lineChild ); } } return $ret; }
php
function publishHandlerParagraph( $element, &$params ) { $ret = null; // Removes single line tag $line = $element->lastChild; if ( $element->childNodes->length == 1 && $line->nodeName == 'line' ) { $lineChildren = array(); $lineChildNodes = $line->childNodes; foreach ( $lineChildNodes as $lineChildNode ) { $lineChildren[] = $lineChildNode; } $line = $element->removeChild( $line ); foreach ( $lineChildren as $lineChild ) { $element->appendChild( $lineChild ); } } return $ret; }
[ "function", "publishHandlerParagraph", "(", "$", "element", ",", "&", "$", "params", ")", "{", "$", "ret", "=", "null", ";", "// Removes single line tag", "$", "line", "=", "$", "element", "->", "lastChild", ";", "if", "(", "$", "element", "->", "childNode...
Publish handler for 'paragraph' element.
[ "Publish", "handler", "for", "paragraph", "element", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L708-L730
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.publishHandlerObject
function publishHandlerObject( $element, &$params ) { $ret = null; $objectID = $element->getAttribute( 'id' ); // protection from self-embedding if ( $objectID == $this->contentObjectID ) { $this->isInputValid = false; $this->Messages[] = ezpI18n::tr( 'kernel/classes/datatypes', 'Object %1 can not be embeded to itself.', false, array( $objectID ) ); return $ret; } if ( !in_array( $objectID, $this->relatedObjectIDArray ) ) { $this->relatedObjectIDArray[] = $objectID; } // If there are any image object with links. $href = $element->getAttributeNS( $this->Namespaces['image'], 'ezurl_href' ); //washing href. single and double quotes inside url replaced with their urlencoded form $href = str_replace( array('\'','"'), array('%27','%22'), $href ); $urlID = $element->getAttributeNS( $this->Namespaces['image'], 'ezurl_id' ); if ( $href != null ) { $urlID = eZURL::registerURL( $href ); $element->setAttributeNS( $this->Namespaces['image'], 'image:ezurl_id', $urlID ); $element->removeAttributeNS( $this->Namespaces['image'], 'ezurl_href' ); } if ( $urlID != null ) { $this->urlIDArray[] = $urlID; } $this->convertCustomAttributes( $element ); return $ret; }
php
function publishHandlerObject( $element, &$params ) { $ret = null; $objectID = $element->getAttribute( 'id' ); // protection from self-embedding if ( $objectID == $this->contentObjectID ) { $this->isInputValid = false; $this->Messages[] = ezpI18n::tr( 'kernel/classes/datatypes', 'Object %1 can not be embeded to itself.', false, array( $objectID ) ); return $ret; } if ( !in_array( $objectID, $this->relatedObjectIDArray ) ) { $this->relatedObjectIDArray[] = $objectID; } // If there are any image object with links. $href = $element->getAttributeNS( $this->Namespaces['image'], 'ezurl_href' ); //washing href. single and double quotes inside url replaced with their urlencoded form $href = str_replace( array('\'','"'), array('%27','%22'), $href ); $urlID = $element->getAttributeNS( $this->Namespaces['image'], 'ezurl_id' ); if ( $href != null ) { $urlID = eZURL::registerURL( $href ); $element->setAttributeNS( $this->Namespaces['image'], 'image:ezurl_id', $urlID ); $element->removeAttributeNS( $this->Namespaces['image'], 'ezurl_href' ); } if ( $urlID != null ) { $this->urlIDArray[] = $urlID; } $this->convertCustomAttributes( $element ); return $ret; }
[ "function", "publishHandlerObject", "(", "$", "element", ",", "&", "$", "params", ")", "{", "$", "ret", "=", "null", ";", "$", "objectID", "=", "$", "element", "->", "getAttribute", "(", "'id'", ")", ";", "// protection from self-embedding", "if", "(", "$"...
Publish handler for 'object' element.
[ "Publish", "handler", "for", "object", "element", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L966-L1007
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php
eZSimplifiedXMLInputParser.publishHandlerCustom
function publishHandlerCustom( $element, &$params ) { $ret = null; $element->removeAttribute( 'inline' ); $this->convertCustomAttributes( $element ); return $ret; }
php
function publishHandlerCustom( $element, &$params ) { $ret = null; $element->removeAttribute( 'inline' ); $this->convertCustomAttributes( $element ); return $ret; }
[ "function", "publishHandlerCustom", "(", "$", "element", ",", "&", "$", "params", ")", "{", "$", "ret", "=", "null", ";", "$", "element", "->", "removeAttribute", "(", "'inline'", ")", ";", "$", "this", "->", "convertCustomAttributes", "(", "$", "element",...
Publish handler for 'custom' element.
[ "Publish", "handler", "for", "custom", "element", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmlinputparser.php#L1010-L1018
train
ezsystems/ezpublish-legacy
kernel/classes/notification/eznotificationtransport.php
eZNotificationTransport.instance
static function instance( $transport = false, $forceNewInstance = false ) { $ini = eZINI::instance( 'notification.ini' ); if ( $transport == false ) { $transport = $ini->variable( 'TransportSettings', 'DefaultTransport' ); } $transportImpl =& $GLOBALS['eZNotificationTransportGlobalInstance_' . $transport ]; $class = $transportImpl !== null ? strtolower( get_class( $transportImpl ) ) : ''; $fetchInstance = false; if ( !preg_match( '/.*?transport/', $class ) ) $fetchInstance = true; if ( $forceNewInstance ) { $fetchInstance = true; } if ( $fetchInstance ) { $extraPluginPathArray = $ini->variable( 'TransportSettings', 'TransportPluginPath' ); $pluginPathArray = array_merge( array( 'kernel/classes/notification/' ), $extraPluginPathArray ); foreach( $pluginPathArray as $pluginPath ) { $transportFile = $pluginPath . $transport . 'notificationtransport.php'; if ( file_exists( $transportFile ) ) { include_once( $transportFile ); $className = $transport . 'notificationtransport'; $impl = new $className( ); break; } } } if ( !isset( $impl ) ) { $impl = new eZNotificationTransport(); eZDebug::writeError( 'Transport implementation not supported: ' . $transport, __METHOD__ ); } return $impl; }
php
static function instance( $transport = false, $forceNewInstance = false ) { $ini = eZINI::instance( 'notification.ini' ); if ( $transport == false ) { $transport = $ini->variable( 'TransportSettings', 'DefaultTransport' ); } $transportImpl =& $GLOBALS['eZNotificationTransportGlobalInstance_' . $transport ]; $class = $transportImpl !== null ? strtolower( get_class( $transportImpl ) ) : ''; $fetchInstance = false; if ( !preg_match( '/.*?transport/', $class ) ) $fetchInstance = true; if ( $forceNewInstance ) { $fetchInstance = true; } if ( $fetchInstance ) { $extraPluginPathArray = $ini->variable( 'TransportSettings', 'TransportPluginPath' ); $pluginPathArray = array_merge( array( 'kernel/classes/notification/' ), $extraPluginPathArray ); foreach( $pluginPathArray as $pluginPath ) { $transportFile = $pluginPath . $transport . 'notificationtransport.php'; if ( file_exists( $transportFile ) ) { include_once( $transportFile ); $className = $transport . 'notificationtransport'; $impl = new $className( ); break; } } } if ( !isset( $impl ) ) { $impl = new eZNotificationTransport(); eZDebug::writeError( 'Transport implementation not supported: ' . $transport, __METHOD__ ); } return $impl; }
[ "static", "function", "instance", "(", "$", "transport", "=", "false", ",", "$", "forceNewInstance", "=", "false", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", "'notification.ini'", ")", ";", "if", "(", "$", "transport", "==", "false", ")",...
Returns a shared instance of the eZNotificationTransport class. @param string|false $transport Uses notification.ini[TransportSettings]DefaultTransport if false @param bool $forceNewInstance @return eZNotificationTransport
[ "Returns", "a", "shared", "instance", "of", "the", "eZNotificationTransport", "class", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/notification/eznotificationtransport.php#L26-L68
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.isShellExecution
public static function isShellExecution() { $sapiType = php_sapi_name(); if ( $sapiType == 'cli' ) return true; // For CGI we have to check, if the script has been executed over shell. // Currently it looks like the HTTP_HOST variable is the most reasonable to check. if ( substr( $sapiType, 0, 3 ) == 'cgi' ) { if ( !self::serverVariable( 'HTTP_HOST', true ) ) return true; else return false; } return false; }
php
public static function isShellExecution() { $sapiType = php_sapi_name(); if ( $sapiType == 'cli' ) return true; // For CGI we have to check, if the script has been executed over shell. // Currently it looks like the HTTP_HOST variable is the most reasonable to check. if ( substr( $sapiType, 0, 3 ) == 'cgi' ) { if ( !self::serverVariable( 'HTTP_HOST', true ) ) return true; else return false; } return false; }
[ "public", "static", "function", "isShellExecution", "(", ")", "{", "$", "sapiType", "=", "php_sapi_name", "(", ")", ";", "if", "(", "$", "sapiType", "==", "'cli'", ")", "return", "true", ";", "// For CGI we have to check, if the script has been executed over shell.", ...
Determines if the current process has been started from the web or the shell @return bool
[ "Determines", "if", "the", "current", "process", "has", "been", "started", "from", "the", "web", "or", "the", "shell" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L261-L278
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.escapeShellArgument
public static function escapeShellArgument( $argument ) { $escapeChar = self::instance()->ShellEscapeCharacter; if ( $escapeChar == "'" ) { $argument = str_replace( "'", "'\\''", $argument ); } else { $argument = str_replace( $escapeChar, "\\" . $escapeChar, addcslashes( $argument, '\\' ) ); } return $escapeChar . $argument . $escapeChar; }
php
public static function escapeShellArgument( $argument ) { $escapeChar = self::instance()->ShellEscapeCharacter; if ( $escapeChar == "'" ) { $argument = str_replace( "'", "'\\''", $argument ); } else { $argument = str_replace( $escapeChar, "\\" . $escapeChar, addcslashes( $argument, '\\' ) ); } return $escapeChar . $argument . $escapeChar; }
[ "public", "static", "function", "escapeShellArgument", "(", "$", "argument", ")", "{", "$", "escapeChar", "=", "self", "::", "instance", "(", ")", "->", "ShellEscapeCharacter", ";", "if", "(", "$", "escapeChar", "==", "\"'\"", ")", "{", "$", "argument", "=...
Returns an escaped string to be used as a shell argument @param string $argument @return string
[ "Returns", "an", "escaped", "string", "to", "be", "used", "as", "a", "shell", "argument" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L286-L298
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.storageDirectory
public static function storageDirectory() { $ini = eZINI::instance(); $varDir = self::varDirectory(); $storageDir = $ini->variable( 'FileSettings', 'StorageDir' ); return eZDir::path( array( $varDir, $storageDir ) ); }
php
public static function storageDirectory() { $ini = eZINI::instance(); $varDir = self::varDirectory(); $storageDir = $ini->variable( 'FileSettings', 'StorageDir' ); return eZDir::path( array( $varDir, $storageDir ) ); }
[ "public", "static", "function", "storageDirectory", "(", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "$", "varDir", "=", "self", "::", "varDirectory", "(", ")", ";", "$", "storageDir", "=", "$", "ini", "->", "variable", "(", ...
Returns the current storage directory @return string
[ "Returns", "the", "current", "storage", "directory" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L510-L516
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.cacheDirectory
public static function cacheDirectory() { $ini = eZINI::instance(); $cacheDir = $ini->variable( 'FileSettings', 'CacheDir' ); if ( $cacheDir[0] == "/" ) { return eZDir::path( array( $cacheDir ) ); } else { return eZDir::path( array( self::varDirectory(), $cacheDir ) ); } }
php
public static function cacheDirectory() { $ini = eZINI::instance(); $cacheDir = $ini->variable( 'FileSettings', 'CacheDir' ); if ( $cacheDir[0] == "/" ) { return eZDir::path( array( $cacheDir ) ); } else { return eZDir::path( array( self::varDirectory(), $cacheDir ) ); } }
[ "public", "static", "function", "cacheDirectory", "(", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "$", "cacheDir", "=", "$", "ini", "->", "variable", "(", "'FileSettings'", ",", "'CacheDir'", ")", ";", "if", "(", "$", "cacheDi...
Returns the current cache directory. @return string
[ "Returns", "the", "current", "cache", "directory", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L523-L536
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.rootDir
public static function rootDir() { $instance = self::instance(); if ( !$instance->RootDir ) { $cwd = getcwd(); $self = $instance->serverVariable( 'PHP_SELF' ); if ( file_exists( $cwd . $instance->FileSeparator . $self ) or file_exists( $cwd . $instance->FileSeparator . $instance->IndexFile ) ) { $instance->RootDir = $cwd; } else { $instance->RootDir = null; } } return $instance->RootDir; }
php
public static function rootDir() { $instance = self::instance(); if ( !$instance->RootDir ) { $cwd = getcwd(); $self = $instance->serverVariable( 'PHP_SELF' ); if ( file_exists( $cwd . $instance->FileSeparator . $self ) or file_exists( $cwd . $instance->FileSeparator . $instance->IndexFile ) ) { $instance->RootDir = $cwd; } else { $instance->RootDir = null; } } return $instance->RootDir; }
[ "public", "static", "function", "rootDir", "(", ")", "{", "$", "instance", "=", "self", "::", "instance", "(", ")", ";", "if", "(", "!", "$", "instance", "->", "RootDir", ")", "{", "$", "cwd", "=", "getcwd", "(", ")", ";", "$", "self", "=", "$", ...
Returns the absolute path to the eZ Publish root directory @return string|null
[ "Returns", "the", "absolute", "path", "to", "the", "eZ", "Publish", "root", "directory" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L543-L561
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.indexFile
public static function indexFile( $withAccessPath = true ) { $sys = self::instance(); $text = $sys->IndexFile; if ( $withAccessPath && ( isset( $sys->AccessPath['siteaccess']['url'][0] ) || isset( $sys->AccessPath['path']['url'][0] ) ) ) { $ini = eZINI::instance(); if ( isset( $sys->AccessPath['siteaccess']['url'][0] ) && $ini->variable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess' ) === 'enabled' ) { $defaultAccess = $ini->variable( 'SiteSettings', 'DefaultAccess' ); // 1st is proper match where code has used updated api as of 4.4, do not use siteaccess if ( $sys->AccessPath['siteaccess']['name'] === $defaultAccess ) $accessPath = implode( '/', $sys->AccessPath['path']['url'] ); // 2nd is for compatability with older code that used eZSys api withouth defining scopes, shift default siteaccess path elseif ( $sys->AccessPath['siteaccess']['name'] === 'undefined' && $sys->AccessPath['siteaccess']['url'][0] === $defaultAccess ) { $accessPathArray = $sys->AccessPath; array_shift( $accessPathArray['siteaccess']['url'] ); //remove default siteaccess $accessPath = implode( '/', array_merge( $accessPathArray['siteaccess']['url'], $accessPathArray['path']['url'] ) ); } // In case there is no default siteaccess match use full url else $accessPath = implode( '/', array_merge( $sys->AccessPath['siteaccess']['url'], $sys->AccessPath['path']['url'] ) ); } else { $accessPath = implode( '/', array_merge( $sys->AccessPath['siteaccess']['url'], $sys->AccessPath['path']['url'] ) ); } $text .= '/' . $accessPath; // Make sure we never return just a single '/' in case where siteaccess was shifted if ( $text === '/' ) $text = ''; } return $text; }
php
public static function indexFile( $withAccessPath = true ) { $sys = self::instance(); $text = $sys->IndexFile; if ( $withAccessPath && ( isset( $sys->AccessPath['siteaccess']['url'][0] ) || isset( $sys->AccessPath['path']['url'][0] ) ) ) { $ini = eZINI::instance(); if ( isset( $sys->AccessPath['siteaccess']['url'][0] ) && $ini->variable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess' ) === 'enabled' ) { $defaultAccess = $ini->variable( 'SiteSettings', 'DefaultAccess' ); // 1st is proper match where code has used updated api as of 4.4, do not use siteaccess if ( $sys->AccessPath['siteaccess']['name'] === $defaultAccess ) $accessPath = implode( '/', $sys->AccessPath['path']['url'] ); // 2nd is for compatability with older code that used eZSys api withouth defining scopes, shift default siteaccess path elseif ( $sys->AccessPath['siteaccess']['name'] === 'undefined' && $sys->AccessPath['siteaccess']['url'][0] === $defaultAccess ) { $accessPathArray = $sys->AccessPath; array_shift( $accessPathArray['siteaccess']['url'] ); //remove default siteaccess $accessPath = implode( '/', array_merge( $accessPathArray['siteaccess']['url'], $accessPathArray['path']['url'] ) ); } // In case there is no default siteaccess match use full url else $accessPath = implode( '/', array_merge( $sys->AccessPath['siteaccess']['url'], $sys->AccessPath['path']['url'] ) ); } else { $accessPath = implode( '/', array_merge( $sys->AccessPath['siteaccess']['url'], $sys->AccessPath['path']['url'] ) ); } $text .= '/' . $accessPath; // Make sure we never return just a single '/' in case where siteaccess was shifted if ( $text === '/' ) $text = ''; } return $text; }
[ "public", "static", "function", "indexFile", "(", "$", "withAccessPath", "=", "true", ")", "{", "$", "sys", "=", "self", "::", "instance", "(", ")", ";", "$", "text", "=", "$", "sys", "->", "IndexFile", ";", "if", "(", "$", "withAccessPath", "&&", "(...
Returns the filepath for the index file with the access path appended @param bool $withAccessPath @return string
[ "Returns", "the", "filepath", "for", "the", "index", "file", "with", "the", "access", "path", "appended" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L614-L652
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.hostname
public static function hostname() { $hostName = null; $forwardedHostsString = self::serverVariable( 'HTTP_X_FORWARDED_HOST', true ); if ( $forwardedHostsString ) { $forwardedHosts = explode( ',', $forwardedHostsString ); $hostName = trim( $forwardedHosts[0] ); } if ( !$hostName && self::serverVariable( 'HTTP_HOST', true ) ) { $hostName = self::serverVariable( 'HTTP_HOST' ); } if ( !$hostName ) { $siteUrl = eZINI::instance()->variable( 'SiteSettings', 'SiteURL' ); $hostName = parse_url( "http://{$siteUrl}", PHP_URL_HOST ); } return $hostName; }
php
public static function hostname() { $hostName = null; $forwardedHostsString = self::serverVariable( 'HTTP_X_FORWARDED_HOST', true ); if ( $forwardedHostsString ) { $forwardedHosts = explode( ',', $forwardedHostsString ); $hostName = trim( $forwardedHosts[0] ); } if ( !$hostName && self::serverVariable( 'HTTP_HOST', true ) ) { $hostName = self::serverVariable( 'HTTP_HOST' ); } if ( !$hostName ) { $siteUrl = eZINI::instance()->variable( 'SiteSettings', 'SiteURL' ); $hostName = parse_url( "http://{$siteUrl}", PHP_URL_HOST ); } return $hostName; }
[ "public", "static", "function", "hostname", "(", ")", "{", "$", "hostName", "=", "null", ";", "$", "forwardedHostsString", "=", "self", "::", "serverVariable", "(", "'HTTP_X_FORWARDED_HOST'", ",", "true", ")", ";", "if", "(", "$", "forwardedHostsString", ")", ...
Returns the current hostname. First tries to use X-Forward-Host before it goes on to use host in header, if none of them exists fallback to use host part of site.ini\[SiteSettings]|SiteURL setting. @return string
[ "Returns", "the", "current", "hostname", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L672-L694
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.clientIP
public static function clientIP() { $customHTTPHeader = eZINI::instance()->variable( 'HTTPHeaderSettings', 'ClientIpByCustomHTTPHeader' ); if( $customHTTPHeader && $customHTTPHeader != 'false' ) { // Transforms for instance, X-Forwarded-For into X_FORWARDED_FOR $phpHeader = 'HTTP_' . str_replace( '-', '_', strtoupper( $customHTTPHeader ) ); $forwardedClientsString = eZSys::serverVariable( $phpHeader, true ); if ( $forwardedClientsString ) { // $forwardedClientsString (usually) contains a comma+space separated list of IPs // where the left-most being the farthest downstream client. All the others are proxy servers. // As X-Forwarded-For is not a standard header yet, we prefer to use a simple comma as the explode delimiter $forwardedClients = explode( ',', $forwardedClientsString ); if( !empty( $forwardedClients ) ) { return trim( $forwardedClients[0] ); } } } return self::serverVariable( 'REMOTE_ADDR', true ); }
php
public static function clientIP() { $customHTTPHeader = eZINI::instance()->variable( 'HTTPHeaderSettings', 'ClientIpByCustomHTTPHeader' ); if( $customHTTPHeader && $customHTTPHeader != 'false' ) { // Transforms for instance, X-Forwarded-For into X_FORWARDED_FOR $phpHeader = 'HTTP_' . str_replace( '-', '_', strtoupper( $customHTTPHeader ) ); $forwardedClientsString = eZSys::serverVariable( $phpHeader, true ); if ( $forwardedClientsString ) { // $forwardedClientsString (usually) contains a comma+space separated list of IPs // where the left-most being the farthest downstream client. All the others are proxy servers. // As X-Forwarded-For is not a standard header yet, we prefer to use a simple comma as the explode delimiter $forwardedClients = explode( ',', $forwardedClientsString ); if( !empty( $forwardedClients ) ) { return trim( $forwardedClients[0] ); } } } return self::serverVariable( 'REMOTE_ADDR', true ); }
[ "public", "static", "function", "clientIP", "(", ")", "{", "$", "customHTTPHeader", "=", "eZINI", "::", "instance", "(", ")", "->", "variable", "(", "'HTTPHeaderSettings'", ",", "'ClientIpByCustomHTTPHeader'", ")", ";", "if", "(", "$", "customHTTPHeader", "&&", ...
Returns the client IP whether he's behind a proxy or not Use [HTTPHeaderSettings].ClientIpByCustomHTTPHeader in site.ini if you want to use a custom http header such as X-Forwarded-For Note: X-Forwarded-For is transformed by PHP into $_SERVER['HTTP_X_FORWARDED_FOR] eZDebug calls in this method should be avoided as there is a risk of infinite recurstion due to IP check (http://issues.ez.no/19045 @return string
[ "Returns", "the", "client", "IP", "whether", "he", "s", "behind", "a", "proxy", "or", "not" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L710-L733
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.isSSLNow
public static function isSSLNow() { $ini = eZINI::instance(); $sslPort = $ini->variable( 'SiteSettings', 'SSLPort' ); if ( !$sslPort ) $sslPort = eZSSLZone::DEFAULT_SSL_PORT; // $nowSSl is true if current access mode is HTTPS. $nowSSL = ( self::serverPort() == $sslPort ); if ( !$nowSSL ) { // Check if this request might be driven through a ssl proxy if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { $nowSSL = ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ); } else if ( isset( $_SERVER['HTTP_X_FORWARDED_PORT'] ) ) { $sslPort = $ini->variable( 'SiteSettings', 'SSLPort' ); $nowSSL = ( $_SERVER['HTTP_X_FORWARDED_PORT'] == $sslPort ); } else if ( isset( $_SERVER['HTTP_X_FORWARDED_SERVER'] ) ) { $sslProxyServerName = $ini->variable( 'SiteSettings', 'SSLProxyServerName' ); $nowSSL = ( $sslProxyServerName == $_SERVER['HTTP_X_FORWARDED_SERVER'] ); } } return $nowSSL; }
php
public static function isSSLNow() { $ini = eZINI::instance(); $sslPort = $ini->variable( 'SiteSettings', 'SSLPort' ); if ( !$sslPort ) $sslPort = eZSSLZone::DEFAULT_SSL_PORT; // $nowSSl is true if current access mode is HTTPS. $nowSSL = ( self::serverPort() == $sslPort ); if ( !$nowSSL ) { // Check if this request might be driven through a ssl proxy if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) ) { $nowSSL = ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ); } else if ( isset( $_SERVER['HTTP_X_FORWARDED_PORT'] ) ) { $sslPort = $ini->variable( 'SiteSettings', 'SSLPort' ); $nowSSL = ( $_SERVER['HTTP_X_FORWARDED_PORT'] == $sslPort ); } else if ( isset( $_SERVER['HTTP_X_FORWARDED_SERVER'] ) ) { $sslProxyServerName = $ini->variable( 'SiteSettings', 'SSLProxyServerName' ); $nowSSL = ( $sslProxyServerName == $_SERVER['HTTP_X_FORWARDED_SERVER'] ); } } return $nowSSL; }
[ "public", "static", "function", "isSSLNow", "(", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "$", "sslPort", "=", "$", "ini", "->", "variable", "(", "'SiteSettings'", ",", "'SSLPort'", ")", ";", "if", "(", "!", "$", "sslPort"...
Determines if SSL is enabled and protocol HTTPS is used. @return bool
[ "Determines", "if", "SSL", "is", "enabled", "and", "protocol", "HTTPS", "is", "used", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L740-L768
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.serverPort
public static function serverPort() { if ( empty( $GLOBALS['eZSysServerPort'] ) ) { $hostname = self::hostname(); if ( preg_match( "/.*:([0-9]+)/", $hostname, $regs ) ) { $port = (int) $regs[1]; } else { $port = (int) self::serverVariable( 'SERVER_PORT', true ); } if ( !$port ) { $port = 80; } $GLOBALS['eZSysServerPort'] = $port; } return $GLOBALS['eZSysServerPort']; }
php
public static function serverPort() { if ( empty( $GLOBALS['eZSysServerPort'] ) ) { $hostname = self::hostname(); if ( preg_match( "/.*:([0-9]+)/", $hostname, $regs ) ) { $port = (int) $regs[1]; } else { $port = (int) self::serverVariable( 'SERVER_PORT', true ); } if ( !$port ) { $port = 80; } $GLOBALS['eZSysServerPort'] = $port; } return $GLOBALS['eZSysServerPort']; }
[ "public", "static", "function", "serverPort", "(", ")", "{", "if", "(", "empty", "(", "$", "GLOBALS", "[", "'eZSysServerPort'", "]", ")", ")", "{", "$", "hostname", "=", "self", "::", "hostname", "(", ")", ";", "if", "(", "preg_match", "(", "\"/.*:([0-...
Returns the server port or 80 as default if the server port can not be retrieved from the hostname or the server variable 'SERVER_PORT' @return int
[ "Returns", "the", "server", "port", "or", "80", "as", "default", "if", "the", "server", "port", "can", "not", "be", "retrieved", "from", "the", "hostname", "or", "the", "server", "variable", "SERVER_PORT" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L819-L841
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.environmentVariable
public static function environmentVariable( $variableName, $quiet = false ) { if ( getenv($variableName) === false ) { if ( !$quiet ) { eZDebug::writeError( "Environment variable '$variableName' does not exist", __METHOD__ ); } return null; } return getenv($variableName); }
php
public static function environmentVariable( $variableName, $quiet = false ) { if ( getenv($variableName) === false ) { if ( !$quiet ) { eZDebug::writeError( "Environment variable '$variableName' does not exist", __METHOD__ ); } return null; } return getenv($variableName); }
[ "public", "static", "function", "environmentVariable", "(", "$", "variableName", ",", "$", "quiet", "=", "false", ")", "{", "if", "(", "getenv", "(", "$", "variableName", ")", "===", "false", ")", "{", "if", "(", "!", "$", "quiet", ")", "{", "eZDebug",...
Returns an environment variable or null if it is not available If the variable is not available, trigger an error message @param string $variableName @param bool $quiet @return null|string
[ "Returns", "an", "environment", "variable", "or", "null", "if", "it", "is", "not", "available" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L899-L910
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.getValidwwwDir
protected static function getValidwwwDir( $phpSelf, $scriptFileName, $index ) { if ( !isset( $phpSelf[1] ) || empty($index) || strpos( $phpSelf, $index ) === false ) return false; // validate $index straight away if ( strpos( $scriptFileName, $index ) === false ) return null; // optimize '/index.php' pattern if ( $phpSelf === "/{$index}" ) return ''; $phpSelfParts = explode( $index, $phpSelf ); $validateDir = $phpSelfParts[0]; // remove first path if home dir if ( $phpSelf[1] === '~' ) { $uri = explode( '/', ltrim( $validateDir, '/' ) ); $userName = ltrim( array_shift( $uri ), "~" ); // validating that we have user/ in path if ( !strpos( $scriptFileName, $userName ."/" ) ) { return null; } $validateDir = '/' . implode( '/', $uri ); } if ( !empty( $validateDir ) ) { // validate directly with phpself part if ( strpos( $scriptFileName, $validateDir ) !== false ) return trim( $phpSelfParts[0], '/' ); // validate with windows path if ( strpos( $scriptFileName, str_replace( '/', '\\', $validateDir ) ) !== false ) return trim( $phpSelfParts[0], '/' ); } return null; }
php
protected static function getValidwwwDir( $phpSelf, $scriptFileName, $index ) { if ( !isset( $phpSelf[1] ) || empty($index) || strpos( $phpSelf, $index ) === false ) return false; // validate $index straight away if ( strpos( $scriptFileName, $index ) === false ) return null; // optimize '/index.php' pattern if ( $phpSelf === "/{$index}" ) return ''; $phpSelfParts = explode( $index, $phpSelf ); $validateDir = $phpSelfParts[0]; // remove first path if home dir if ( $phpSelf[1] === '~' ) { $uri = explode( '/', ltrim( $validateDir, '/' ) ); $userName = ltrim( array_shift( $uri ), "~" ); // validating that we have user/ in path if ( !strpos( $scriptFileName, $userName ."/" ) ) { return null; } $validateDir = '/' . implode( '/', $uri ); } if ( !empty( $validateDir ) ) { // validate directly with phpself part if ( strpos( $scriptFileName, $validateDir ) !== false ) return trim( $phpSelfParts[0], '/' ); // validate with windows path if ( strpos( $scriptFileName, str_replace( '/', '\\', $validateDir ) ) !== false ) return trim( $phpSelfParts[0], '/' ); } return null; }
[ "protected", "static", "function", "getValidwwwDir", "(", "$", "phpSelf", ",", "$", "scriptFileName", ",", "$", "index", ")", "{", "if", "(", "!", "isset", "(", "$", "phpSelf", "[", "1", "]", ")", "||", "empty", "(", "$", "index", ")", "||", "strpos"...
Generate wwwdir from phpSelf if valid accoring to scriptFileName and return null if invalid and false if there is no index in phpSelf @param string $phpSelf @param string $scriptFileName @param string $index @return string|null|false String in form 'path/path2' if valid, null if not and false if $index is not part of phpself
[ "Generate", "wwwdir", "from", "phpSelf", "if", "valid", "accoring", "to", "scriptFileName", "and", "return", "null", "if", "invalid", "and", "false", "if", "there", "is", "no", "index", "in", "phpSelf" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L1207-L1249
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.ezcrc32
public static function ezcrc32( $string ) { $ini = eZINI::instance(); if ( $ini->variable( 'SiteSettings', '64bitCompatibilityMode' ) === 'enabled' ) $checksum = sprintf( '%u', crc32( $string ) ); else $checksum = crc32( $string ); return $checksum; }
php
public static function ezcrc32( $string ) { $ini = eZINI::instance(); if ( $ini->variable( 'SiteSettings', '64bitCompatibilityMode' ) === 'enabled' ) $checksum = sprintf( '%u', crc32( $string ) ); else $checksum = crc32( $string ); return $checksum; }
[ "public", "static", "function", "ezcrc32", "(", "$", "string", ")", "{", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "if", "(", "$", "ini", "->", "variable", "(", "'SiteSettings'", ",", "'64bitCompatibilityMode'", ")", "===", "'enabled'", ...
A wrapper for PHP's crc32 function. Returns the crc32 polynomial as unsigned int @param $string @return int|string
[ "A", "wrapper", "for", "PHP", "s", "crc32", "function", ".", "Returns", "the", "crc32", "polynomial", "as", "unsigned", "int" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L1293-L1303
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.protocolSchema
public static function protocolSchema() { $schema = ''; if( preg_match( "#^([a-zA-Z]+)/.*$#", self::serverVariable( 'SERVER_PROTOCOL' ), $schemaMatches ) ) { $schema = strtolower( $schemaMatches[1] ) . '://'; } return $schema; }
php
public static function protocolSchema() { $schema = ''; if( preg_match( "#^([a-zA-Z]+)/.*$#", self::serverVariable( 'SERVER_PROTOCOL' ), $schemaMatches ) ) { $schema = strtolower( $schemaMatches[1] ) . '://'; } return $schema; }
[ "public", "static", "function", "protocolSchema", "(", ")", "{", "$", "schema", "=", "''", ";", "if", "(", "preg_match", "(", "\"#^([a-zA-Z]+)/.*$#\"", ",", "self", "::", "serverVariable", "(", "'SERVER_PROTOCOL'", ")", ",", "$", "schemaMatches", ")", ")", "...
Returns the schema of the request. @return string
[ "Returns", "the", "schema", "of", "the", "request", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L1310-L1319
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezsys.php
eZSys.simulateGlobBrace
protected static function simulateGlobBrace( $filenames ) { $result = array(); foreach ( $filenames as $filename ) { if ( strpos( $filename, '{' ) === false ) { $result[] = $filename; continue; } if ( preg_match( '/^(.*)\{(.*?)(?<!\\\\)\}(.*)$/', $filename, $match ) ) { $variants = preg_split( '/(?<!\\\\),/', $match[2] ); $newFilenames = array(); foreach ( $variants as $variant ) { $newFilenames[] = $match[1] . $variant . $match[3]; } $newFilenames = self::simulateGlobBrace( $newFilenames ); $result = array_merge( $result, $newFilenames ); } else { $result[] = $filename; } } return $result; }
php
protected static function simulateGlobBrace( $filenames ) { $result = array(); foreach ( $filenames as $filename ) { if ( strpos( $filename, '{' ) === false ) { $result[] = $filename; continue; } if ( preg_match( '/^(.*)\{(.*?)(?<!\\\\)\}(.*)$/', $filename, $match ) ) { $variants = preg_split( '/(?<!\\\\),/', $match[2] ); $newFilenames = array(); foreach ( $variants as $variant ) { $newFilenames[] = $match[1] . $variant . $match[3]; } $newFilenames = self::simulateGlobBrace( $newFilenames ); $result = array_merge( $result, $newFilenames ); } else { $result[] = $filename; } } return $result; }
[ "protected", "static", "function", "simulateGlobBrace", "(", "$", "filenames", ")", "{", "$", "result", "=", "array", "(", ")", ";", "foreach", "(", "$", "filenames", "as", "$", "filename", ")", "{", "if", "(", "strpos", "(", "$", "filename", ",", "'{'...
Expands a list of filenames like GLOB_BRACE does. GLOB_BRACE is non POSIX and only available in GNU glibc. This is needed to support operating systems like Solars. @param $filenames @return array
[ "Expands", "a", "list", "of", "filenames", "like", "GLOB_BRACE", "does", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezsys.php#L1361-L1393
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/cache/options/storage_cluster.php
ezpCacheStorageClusterOptions.__isset
public function __isset( $key ) { // Delegate return ( array_key_exists( $key, $this->properties ) || isset( $this->storageOptions->$key ) ); }
php
public function __isset( $key ) { // Delegate return ( array_key_exists( $key, $this->properties ) || isset( $this->storageOptions->$key ) ); }
[ "public", "function", "__isset", "(", "$", "key", ")", "{", "// Delegate", "return", "(", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "properties", ")", "||", "isset", "(", "$", "this", "->", "storageOptions", "->", "$", "key", ")", ")...
Returns if a option exists. @param string $key Option name to check for. @return void @ignore
[ "Returns", "if", "a", "option", "exists", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/cache/options/storage_cluster.php#L86-L90
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpautoloadclioutput.php
ezpAutoloadCliOutput.finishPhase2
public function finishPhase2() { $this->tokenizerProgress->finish(); $this->output->outputLine(); $this->output->outputLine(); }
php
public function finishPhase2() { $this->tokenizerProgress->finish(); $this->output->outputLine(); $this->output->outputLine(); }
[ "public", "function", "finishPhase2", "(", ")", "{", "$", "this", "->", "tokenizerProgress", "->", "finish", "(", ")", ";", "$", "this", "->", "output", "->", "outputLine", "(", ")", ";", "$", "this", "->", "output", "->", "outputLine", "(", ")", ";", ...
Finishes progress output for class search phase. Also inserts some extra newlines to make the output clearer. @return void
[ "Finishes", "progress", "output", "for", "class", "search", "phase", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpautoloadclioutput.php#L163-L168
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php
ezjscServerFunctionsAjaxUploader.getHandler
private static function getHandler( array $args ) { if ( !isset( $args[0] ) ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to find the identifier of ajax upload handler' ) ); } $http = eZHTTPTool::instance(); $handlerData = $http->postVariable( 'AjaxUploadHandlerData', array() ); $handlerOptions = new ezpExtensionOptions(); $handlerOptions->iniFile = 'ezjscore.ini'; $handlerOptions->iniSection = 'AjaxUploader'; $handlerOptions->iniVariable = 'AjaxUploadHandler'; $handlerOptions->handlerIndex = $args[0]; $handlerOptions->handlerParams = $handlerData; $handler = eZExtension::getHandlerClass( $handlerOptions ); if ( !$handler instanceof ezpAjaxUploaderHandlerInterface ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to load the ajax upload handler' ) ); } return $handler; }
php
private static function getHandler( array $args ) { if ( !isset( $args[0] ) ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to find the identifier of ajax upload handler' ) ); } $http = eZHTTPTool::instance(); $handlerData = $http->postVariable( 'AjaxUploadHandlerData', array() ); $handlerOptions = new ezpExtensionOptions(); $handlerOptions->iniFile = 'ezjscore.ini'; $handlerOptions->iniSection = 'AjaxUploader'; $handlerOptions->iniVariable = 'AjaxUploadHandler'; $handlerOptions->handlerIndex = $args[0]; $handlerOptions->handlerParams = $handlerData; $handler = eZExtension::getHandlerClass( $handlerOptions ); if ( !$handler instanceof ezpAjaxUploaderHandlerInterface ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to load the ajax upload handler' ) ); } return $handler; }
[ "private", "static", "function", "getHandler", "(", "array", "$", "args", ")", "{", "if", "(", "!", "isset", "(", "$", "args", "[", "0", "]", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "ezpI18n", "::", "tr", "(", "'extension/ezjscore...
Returns an ajaxuploader handler instance from the ezjscore function arguments. @param array $args the arguments of the ezjscore ajax function @return ezpAjaxUploaderHandlerInterface @throws InvalidArgumentException if the handler cannot be instanciated
[ "Returns", "an", "ajaxuploader", "handler", "instance", "from", "the", "ezjscore", "function", "arguments", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php#L29-L63
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php
ezjscServerFunctionsAjaxUploader.uploadForm
static function uploadForm( $args ) { $handler = self::getHandler( $args ); if ( !$handler->canUpload() ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'You are not allowed to upload a file.' ) ); } $tpl = eZTemplate::factory(); return array( 'meta_data' => false, 'html' => $tpl->fetch( 'design:ajaxuploader/upload.tpl' ) ); }
php
static function uploadForm( $args ) { $handler = self::getHandler( $args ); if ( !$handler->canUpload() ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'You are not allowed to upload a file.' ) ); } $tpl = eZTemplate::factory(); return array( 'meta_data' => false, 'html' => $tpl->fetch( 'design:ajaxuploader/upload.tpl' ) ); }
[ "static", "function", "uploadForm", "(", "$", "args", ")", "{", "$", "handler", "=", "self", "::", "getHandler", "(", "$", "args", ")", ";", "if", "(", "!", "$", "handler", "->", "canUpload", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(...
Returns the upload form @param array $args ezjscore function arguments, the first element is the AJAX upload handler identifier ({@link ezjscServerFunctionsAjaxUploader::getHandler}) @return array( 'meta_data' => false, 'html' => string) @throw RuntimeException if the user is not allowed to upload a file
[ "Returns", "the", "upload", "form" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php#L75-L92
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php
ezjscServerFunctionsAjaxUploader.upload
static function upload( $args ) { try { $handler = self::getHandler( $args ); $fileInfo = $handler->getFileinfo(); $mimeData = $fileInfo['mime']; $file = $fileInfo['file']; $class = $handler->getContentClass( $mimeData ); if ( $file->store( false, $mimeData['suffix'] ) === false ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to store the uploaded file.' ) ); } else { $fileHandler = eZClusterFileHandler::instance(); $fileHandler->fileStore( $file->attribute( 'filename' ), 'tmp', true, $file->attribute( 'mime_type' ) ); } $start = $handler->getDefaultParentNodeId( $class ); $defaultParentNode = eZContentObjectTreeNode::fetch( $start ); if ( !$defaultParentNode instanceof eZContentObjectTreeNode ) { throw new RuntimeException( ezpI18n::tr( "extension/ezjscore/ajaxuploader", "The default parent location for uploads cannot be retrieved! Check user permissions and correctness of settings." ) ); } } catch ( Exception $e ) { // manually catch exception to force json encode // because most browsers cannot upload // wit a json HTTP Accept header... // see JavaScript code in eZAjaxUploader::delegateWindowEvents(); return json_encode( array( 'error_text' => $e->getMessage(), 'content' => '' ) ); } $browseItems = self::getBrowseItems( $defaultParentNode->attribute( 'parent' ), $class ); $http = eZHTTPTool::instance(); $tpl = eZTemplate::factory(); $tpl->setVariable( 'file', $file ); $tpl->setVariable( 'name', $http->postVariable( 'UploadName', $file->attribute( 'original_filename' ) ) ); $tpl->setVariable( 'mime_data', $mimeData ); $tpl->setVariable( 'class', $class ); $tpl->setVariable( 'browse_start', $defaultParentNode->attribute( 'parent' ) ); $tpl->setVariable( 'default_parent_node', $defaultParentNode ); $tpl->setVariable( 'browse', $browseItems ); // json_encode and url encode the HTML to be able to get it in the // JavaScript code. see eZAjaxUploader::delegateWindowEvents() return json_encode( array( 'meta_data' => false, 'html' => rawurlencode( $tpl->fetch( 'design:ajaxuploader/location.tpl' ) ) ) ); }
php
static function upload( $args ) { try { $handler = self::getHandler( $args ); $fileInfo = $handler->getFileinfo(); $mimeData = $fileInfo['mime']; $file = $fileInfo['file']; $class = $handler->getContentClass( $mimeData ); if ( $file->store( false, $mimeData['suffix'] ) === false ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to store the uploaded file.' ) ); } else { $fileHandler = eZClusterFileHandler::instance(); $fileHandler->fileStore( $file->attribute( 'filename' ), 'tmp', true, $file->attribute( 'mime_type' ) ); } $start = $handler->getDefaultParentNodeId( $class ); $defaultParentNode = eZContentObjectTreeNode::fetch( $start ); if ( !$defaultParentNode instanceof eZContentObjectTreeNode ) { throw new RuntimeException( ezpI18n::tr( "extension/ezjscore/ajaxuploader", "The default parent location for uploads cannot be retrieved! Check user permissions and correctness of settings." ) ); } } catch ( Exception $e ) { // manually catch exception to force json encode // because most browsers cannot upload // wit a json HTTP Accept header... // see JavaScript code in eZAjaxUploader::delegateWindowEvents(); return json_encode( array( 'error_text' => $e->getMessage(), 'content' => '' ) ); } $browseItems = self::getBrowseItems( $defaultParentNode->attribute( 'parent' ), $class ); $http = eZHTTPTool::instance(); $tpl = eZTemplate::factory(); $tpl->setVariable( 'file', $file ); $tpl->setVariable( 'name', $http->postVariable( 'UploadName', $file->attribute( 'original_filename' ) ) ); $tpl->setVariable( 'mime_data', $mimeData ); $tpl->setVariable( 'class', $class ); $tpl->setVariable( 'browse_start', $defaultParentNode->attribute( 'parent' ) ); $tpl->setVariable( 'default_parent_node', $defaultParentNode ); $tpl->setVariable( 'browse', $browseItems ); // json_encode and url encode the HTML to be able to get it in the // JavaScript code. see eZAjaxUploader::delegateWindowEvents() return json_encode( array( 'meta_data' => false, 'html' => rawurlencode( $tpl->fetch( 'design:ajaxuploader/location.tpl' ) ) ) ); }
[ "static", "function", "upload", "(", "$", "args", ")", "{", "try", "{", "$", "handler", "=", "self", "::", "getHandler", "(", "$", "args", ")", ";", "$", "fileInfo", "=", "$", "handler", "->", "getFileinfo", "(", ")", ";", "$", "mimeData", "=", "$"...
Stores the uploaded file and returns the location form. The result of this method is always json encoded. @param array $args @return string a json encoded array
[ "Stores", "the", "uploaded", "file", "and", "returns", "the", "location", "form", ".", "The", "result", "of", "this", "method", "is", "always", "json", "encoded", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php#L101-L173
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php
ezjscServerFunctionsAjaxUploader.browse
static function browse( $args ) { if ( count( $args ) < 2 ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } list( $nodeID, $classId ) = $args; $offset = 0; if ( isset( $args[2] ) ) { $offset = (int) $args[2]; } $node = eZContentObjectTreeNode::fetch( $nodeID ); $class = eZContentClass::fetch( $classId ); if ( !$node instanceof eZContentObjectTreeNode || !$class instanceof eZContentClass ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } else if ( !$node->canRead() ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } $browseItems = self::getBrowseItems( $node, $class, $offset ); $tpl = eZTemplate::factory(); $tpl->setVariable( 'browse', $browseItems ); $tpl->setVariable( 'browse_start', $node ); $tpl->setVariable( 'default_parent_node', array( 'node_id' => 0 ) ); $tpl->setVariable( 'class', $class ); return array( 'meta_data' => false, 'html' => $tpl->fetch( 'design:ajaxuploader/browse.tpl' ) ); }
php
static function browse( $args ) { if ( count( $args ) < 2 ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } list( $nodeID, $classId ) = $args; $offset = 0; if ( isset( $args[2] ) ) { $offset = (int) $args[2]; } $node = eZContentObjectTreeNode::fetch( $nodeID ); $class = eZContentClass::fetch( $classId ); if ( !$node instanceof eZContentObjectTreeNode || !$class instanceof eZContentClass ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } else if ( !$node->canRead() ) { throw new InvalidArgumentException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Arguments error.' ) ); } $browseItems = self::getBrowseItems( $node, $class, $offset ); $tpl = eZTemplate::factory(); $tpl->setVariable( 'browse', $browseItems ); $tpl->setVariable( 'browse_start', $node ); $tpl->setVariable( 'default_parent_node', array( 'node_id' => 0 ) ); $tpl->setVariable( 'class', $class ); return array( 'meta_data' => false, 'html' => $tpl->fetch( 'design:ajaxuploader/browse.tpl' ) ); }
[ "static", "function", "browse", "(", "$", "args", ")", "{", "if", "(", "count", "(", "$", "args", ")", "<", "2", ")", "{", "throw", "new", "InvalidArgumentException", "(", "ezpI18n", "::", "tr", "(", "'extension/ezjscore/ajaxuploader'", ",", "'Arguments erro...
Browse AJAX action @param array $args containing the following values: - 0 the parent node id of the elements to display - 1 the class id of the element that is going to be created - 2 [optional] the offset @return array @throws InvalidArgumentException if the node or the class cannot be loaded
[ "Browse", "AJAX", "action" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php#L272-L319
train
ezsystems/ezpublish-legacy
extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php
ezjscServerFunctionsAjaxUploader.preview
static function preview( $args ) { $http = eZHTTPTool::instance(); $handler = self::getHandler( $args ); if ( !$handler->canUpload() ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'You are not allowed to upload a file.' ) ); } $file = $http->postVariable( 'UploadFile', false ); $fileHandler = eZClusterFileHandler::instance(); if ( $file === false || !$fileHandler->fileExists( $file ) || !$fileHandler->fileFetch( $file ) ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to retrieve the uploaded file.' ) ); } else { $tmpFile = eZSys::cacheDirectory() . '/' . eZINI::instance()->variable( 'FileSettings', 'TemporaryDir' ) . '/' . str_replace( array( '/', '\\' ), '_', $http->postVariable( 'UploadOriginalFilename' ) ); eZFile::rename( $file, $tmpFile, true ); $fileHandler->fileDelete( $file ); $fileHandler->fileDeleteLocal( $file ); } $contentObject = $handler->createObject( $tmpFile, $http->postVariable( 'UploadLocation', false ), $http->postVariable( 'UploadName', '' ) ); unlink( $tmpFile ); $tpl = eZTemplate::factory(); $tpl->setVariable( 'object', $contentObject ); return array( 'meta_data' => $handler->serializeObject( $contentObject ), 'html' => $tpl->fetch( 'design:ajaxuploader/preview.tpl' ) ); }
php
static function preview( $args ) { $http = eZHTTPTool::instance(); $handler = self::getHandler( $args ); if ( !$handler->canUpload() ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'You are not allowed to upload a file.' ) ); } $file = $http->postVariable( 'UploadFile', false ); $fileHandler = eZClusterFileHandler::instance(); if ( $file === false || !$fileHandler->fileExists( $file ) || !$fileHandler->fileFetch( $file ) ) { throw new RuntimeException( ezpI18n::tr( 'extension/ezjscore/ajaxuploader', 'Unable to retrieve the uploaded file.' ) ); } else { $tmpFile = eZSys::cacheDirectory() . '/' . eZINI::instance()->variable( 'FileSettings', 'TemporaryDir' ) . '/' . str_replace( array( '/', '\\' ), '_', $http->postVariable( 'UploadOriginalFilename' ) ); eZFile::rename( $file, $tmpFile, true ); $fileHandler->fileDelete( $file ); $fileHandler->fileDeleteLocal( $file ); } $contentObject = $handler->createObject( $tmpFile, $http->postVariable( 'UploadLocation', false ), $http->postVariable( 'UploadName', '' ) ); unlink( $tmpFile ); $tpl = eZTemplate::factory(); $tpl->setVariable( 'object', $contentObject ); return array( 'meta_data' => $handler->serializeObject( $contentObject ), 'html' => $tpl->fetch( 'design:ajaxuploader/preview.tpl' ) ); }
[ "static", "function", "preview", "(", "$", "args", ")", "{", "$", "http", "=", "eZHTTPTool", "::", "instance", "(", ")", ";", "$", "handler", "=", "self", "::", "getHandler", "(", "$", "args", ")", ";", "if", "(", "!", "$", "handler", "->", "canUpl...
Creates the object from the uploaded file and displays the preview of it @param array $args @return array @throw RuntimeException if the previously uploaded file cannot be fetched
[ "Creates", "the", "object", "from", "the", "uploaded", "file", "and", "displays", "the", "preview", "of", "it" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/classes/ezjscserverfunctionsajaxuploader.php#L329-L381
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezurl/ezurl.php
eZURL.registerURL
static function registerURL( $url ) { $urlID = null; $urlObject = self::fetchByUrl( $url ); if ( !$urlObject instanceof eZURL ) { // store URL $urlObject = self::create( $url ); $urlObject->store(); $urlID = $urlObject->attribute( 'id' ); } else { // Mismatch => most likely case sensitivity difference, so update the url if ( $urlObject->attribute( 'url' ) !== $url ) { $urlObject->setAttribute( 'url', $url ); $urlObject->setAttribute( 'original_url_md5', md5( $url ) ); $urlObject->setAttribute( 'modified', time() ); $urlObject->store( array( 'url', 'original_url_md5', 'modified' ) ); } $urlID = $urlObject->attribute( 'id' ); } return $urlID; }
php
static function registerURL( $url ) { $urlID = null; $urlObject = self::fetchByUrl( $url ); if ( !$urlObject instanceof eZURL ) { // store URL $urlObject = self::create( $url ); $urlObject->store(); $urlID = $urlObject->attribute( 'id' ); } else { // Mismatch => most likely case sensitivity difference, so update the url if ( $urlObject->attribute( 'url' ) !== $url ) { $urlObject->setAttribute( 'url', $url ); $urlObject->setAttribute( 'original_url_md5', md5( $url ) ); $urlObject->setAttribute( 'modified', time() ); $urlObject->store( array( 'url', 'original_url_md5', 'modified' ) ); } $urlID = $urlObject->attribute( 'id' ); } return $urlID; }
[ "static", "function", "registerURL", "(", "$", "url", ")", "{", "$", "urlID", "=", "null", ";", "$", "urlObject", "=", "self", "::", "fetchByUrl", "(", "$", "url", ")", ";", "if", "(", "!", "$", "urlObject", "instanceof", "eZURL", ")", "{", "// store...
Registers an URL to the URL database and returns the URL id. If URL is already present, the method will check the checksum and update the URL if needed @param string $url @return int
[ "Registers", "an", "URL", "to", "the", "URL", "database", "and", "returns", "the", "URL", "id", ".", "If", "URL", "is", "already", "present", "the", "method", "will", "check", "the", "checksum", "and", "update", "the", "URL", "if", "needed" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezurl/ezurl.php#L91-L118
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezurl/ezurl.php
eZURL.fetchByUrl
public static function fetchByUrl( $url, $asObject = true ) { return parent::fetchObject( self::definition(), null, array( 'url' => $url ), $asObject ); }
php
public static function fetchByUrl( $url, $asObject = true ) { return parent::fetchObject( self::definition(), null, array( 'url' => $url ), $asObject ); }
[ "public", "static", "function", "fetchByUrl", "(", "$", "url", ",", "$", "asObject", "=", "true", ")", "{", "return", "parent", "::", "fetchObject", "(", "self", "::", "definition", "(", ")", ",", "null", ",", "array", "(", "'url'", "=>", "$", "url", ...
Fetches an URL object from an url string @param string $url @param bool $asObject @return eZURL|null
[ "Fetches", "an", "URL", "object", "from", "an", "url", "string" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezurl/ezurl.php#L235-L240
train
ezsystems/ezpublish-legacy
extension/ezformtoken/event/ezxformtoken.php
ezxFormToken.getToken
static public function getToken() { if ( self::$token === null ) { self::$token = sha1( self::getSecret() . self::getIntention() . session_id() ); } return self::$token; }
php
static public function getToken() { if ( self::$token === null ) { self::$token = sha1( self::getSecret() . self::getIntention() . session_id() ); } return self::$token; }
[ "static", "public", "function", "getToken", "(", ")", "{", "if", "(", "self", "::", "$", "token", "===", "null", ")", "{", "self", "::", "$", "token", "=", "sha1", "(", "self", "::", "getSecret", "(", ")", ".", "self", "::", "getIntention", "(", ")...
Gets the user token from session if it exists or create+store it in session. @return string|null
[ "Gets", "the", "user", "token", "from", "session", "if", "it", "exists", "or", "create", "+", "store", "it", "in", "session", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezformtoken/event/ezxformtoken.php#L245-L253
train