idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
40,700 | function sectionLevel ( & $ sectionLevel , $ headerLevel , & $ TagStack , & $ currentNode , & $ domDocument ) { if ( $ sectionLevel < $ headerLevel ) { if ( $ this -> IsStrictHeader ) { $ sectionLevel += 1 ; } else { if ( ( $ sectionLevel + 1 ) == $ headerLevel ) { $ sectionLevel += 1 ; } else { for ( $ i = 1 ; $ i <= ( $ headerLevel - $ sectionLevel - 1 ) ; $ i ++ ) { unset ( $ subNode ) ; $ subNode = new DOMElemenetNode ( 'section' ) ; $ currentNode -> appendChild ( $ subNode ) ; $ childTag = $ this -> SectionArray ; $ TagStack [ ] = array ( 'TagName' => 'section' , 'ParentNodeObject' => & $ currentNode , 'ChildTag' => $ childTag ) ; $ currentNode = $ subNode ; } $ sectionLevel = $ headerLevel ; } } } elseif ( $ sectionLevel == $ headerLevel ) { $ lastNodeArray = array_pop ( $ TagStack ) ; $ lastNode = $ lastNodeArray [ 'ParentNodeObject' ] ; $ currentNode = $ lastNode ; $ sectionLevel = $ headerLevel ; } else { for ( $ i = 1 ; $ i <= ( $ sectionLevel - $ headerLevel + 1 ) ; $ i ++ ) { $ lastNodeArray = array_pop ( $ TagStack ) ; $ lastTag = $ lastNodeArray [ 'TagName' ] ; $ lastNode = $ lastNodeArray [ 'ParentNodeObject' ] ; $ lastChildTag = $ lastNodeArray [ 'ChildTag' ] ; $ currentNode = $ lastNode ; } $ sectionLevel = $ headerLevel ; } return $ currentNode ; } | Get section level and reset curent xml node according to input header . |
40,701 | public static function customTagIsInline ( $ name ) { $ ini = eZINI :: instance ( 'content.ini' ) ; $ customInlineTagList = $ ini -> variable ( 'CustomTagSettings' , 'IsInline' ) ; $ customInlineIconPath = array ( ) ; if ( $ ini -> hasVariable ( 'CustomTagSettings' , 'InlineImageIconPath' ) ) { $ customInlineIconPath = $ ini -> variable ( 'CustomTagSettings' , 'InlineImageIconPath' ) ; } if ( isset ( $ customInlineTagList [ $ name ] ) ) { if ( $ customInlineTagList [ $ name ] === 'true' ) { return true ; } else if ( $ customInlineTagList [ $ name ] === 'image' ) { if ( isset ( $ customInlineIconPath [ $ name ] ) ) return $ customInlineIconPath [ $ name ] ; else return 'images/tango/image-x-generic22.png' ; } } return false ; } | Figgure out if a custom tag is inline or not based on content . ini settings |
40,702 | private function shallAuthenticate ( ) { $ shallAuthenticate = true ; if ( eZINI :: instance ( 'rest.ini' ) -> variable ( 'Authentication' , 'RequireAuthentication' ) !== 'enabled' ) { $ shallAuthenticate = false ; } else { $ routeFilter = ezpRestRouteFilterInterface :: getRouteFilter ( ) ; $ shallAuthenticate = $ routeFilter -> shallDoActionWithRoute ( $ this -> info ) ; } return $ shallAuthenticate ; } | Checks if authentication should be requested or not |
40,703 | private function isDeletingFile ( eZHTTPTool $ http , eZContentObjectAttribute $ contentObjectAttribute ) { $ isDeletingFile = false ; if ( $ http -> hasPostVariable ( 'CustomActionButton' ) ) { $ customActionArray = $ http -> postVariable ( 'CustomActionButton' ) ; $ attributeID = $ contentObjectAttribute -> attribute ( 'id' ) ; if ( isset ( $ customActionArray [ $ attributeID . '_delete_binary' ] ) ) { $ isDeletingFile = true ; } } return $ isDeletingFile ; } | Checks if current HTTP request is asking for current binary file deletion |
40,704 | public function store ( $ fieldFilters = null ) { $ this -> Email = trim ( $ this -> Email ) ; $ userID = $ this -> attribute ( 'contentobject_id' ) ; unset ( $ GLOBALS [ 'eZUserObject_' . $ userID ] ) ; $ GLOBALS [ 'eZUserObject_' . $ userID ] = $ this ; self :: purgeUserCacheByUserId ( $ userID ) ; if ( $ this -> Login ) { parent :: store ( $ fieldFilters ) ; } } | Only stores the entry if it has a Login value |
40,705 | static public function fetchUnactivated ( $ sort = false , $ limit = 10 , $ offset = 0 ) { $ accountDef = eZUserAccountKey :: definition ( ) ; $ settingsDef = eZUserSetting :: definition ( ) ; return eZPersistentObject :: fetchObjectList ( eZUser :: definition ( ) , null , null , $ sort , array ( 'limit' => $ limit , 'offset' => $ offset ) , true , false , null , array ( $ accountDef [ 'name' ] , $ settingsDef [ 'name' ] ) , " WHERE contentobject_id = {$accountDef['name']}.user_id" . " AND {$settingsDef['name']}.user_id = contentobject_id" . " AND is_enabled = 0" ) ; } | Return an array of unactivated eZUser object |
40,706 | static function fetchAnonymousCount ( ) { if ( isset ( $ GLOBALS [ 'eZSiteBasics' ] [ 'no-cache-adviced' ] ) and ! $ GLOBALS [ 'eZSiteBasics' ] [ 'no-cache-adviced' ] and isset ( $ GLOBALS [ 'eZUserAnonymousCount' ] ) ) return $ GLOBALS [ 'eZUserAnonymousCount' ] ; $ db = eZDB :: instance ( ) ; $ time = time ( ) ; $ ini = eZINI :: instance ( ) ; $ activityTimeout = $ ini -> variable ( 'Session' , 'ActivityTimeout' ) ; $ sessionTimeout = $ ini -> variable ( 'Session' , 'SessionTimeout' ) ; $ time = $ time + $ sessionTimeout - $ activityTimeout ; $ sql = "SELECT count( session_key ) as countFROM ezsessionWHERE user_id = '" . self :: anonymousId ( ) . "' AND expiration_time > '$time'" ; $ rows = $ db -> arrayQuery ( $ sql ) ; $ count = isset ( $ rows [ 0 ] ) ? $ rows [ 0 ] [ 'count' ] : 0 ; $ GLOBALS [ 'eZUserAnonymousCount' ] = $ count ; return $ count ; } | Return the number of anonymous users in the system . |
40,707 | public static function loginUser ( $ login , $ password , $ authenticationMatch = false ) { $ user = self :: _loginUser ( $ login , $ password , $ authenticationMatch ) ; if ( is_object ( $ user ) ) { self :: loginSucceeded ( $ user ) ; return $ user ; } else { self :: loginFailed ( $ user , $ login ) ; return false ; } } | Logs in the user if applied username and password is valid . |
40,708 | protected static function loginSucceeded ( $ user ) { $ userID = $ user -> attribute ( 'contentobject_id' ) ; eZAudit :: writeAudit ( 'user-login' , array ( 'User id' => $ userID , 'User login' => $ user -> attribute ( 'login' ) ) ) ; eZUser :: updateLastVisit ( $ userID , true ) ; eZUser :: setCurrentlyLoggedInUser ( $ user , $ userID ) ; eZUser :: setFailedLoginAttempts ( $ userID , 0 ) ; } | Does some house keeping work once a log in has succeeded . |
40,709 | protected static function loginFailed ( $ userID = false , $ login ) { $ loginEscaped = eZDB :: instance ( ) -> escapeString ( $ login ) ; eZAudit :: writeAudit ( 'user-failed-login' , array ( 'User login' => $ loginEscaped , 'Comment' => 'Failed login attempt: eZUser::loginUser()' ) ) ; if ( $ userID ) eZUser :: setFailedLoginAttempts ( $ userID ) ; } | Does some house keeping work when a log in has failed . |
40,710 | public function getUserCache ( ) { if ( $ this -> UserCache === null ) { $ this -> setUserCache ( self :: getUserCacheByUserId ( $ this -> ContentObjectID ) ) ; } return $ this -> UserCache ; } | Get User cache from cache file |
40,711 | static public function purgeUserCacheByUserId ( $ userId ) { if ( eZINI :: instance ( ) -> variable ( 'RoleSettings' , 'EnableCaching' ) === 'true' ) { $ cacheFilePath = eZUser :: getCacheDir ( $ userId ) . "/user-data-{$userId}.cache.php" ; eZClusterFileHandler :: instance ( ) -> fileDelete ( $ cacheFilePath ) ; } } | Delete User cache pr user |
40,712 | static function retrieveUserCacheFromFile ( $ filePath , $ mtime , $ userId ) { $ userCache = include ( $ filePath ) ; if ( is_array ( $ userCache ) && isset ( $ userCache [ 'info' ] ) && isset ( $ userCache [ 'info' ] [ $ userId ] ) && is_numeric ( $ userCache [ 'info' ] [ $ userId ] [ 'contentobject_id' ] ) && isset ( $ userCache [ 'groups' ] ) && isset ( $ userCache [ 'roles' ] ) && isset ( $ userCache [ 'role_limitations' ] ) && isset ( $ userCache [ 'access_array' ] ) && isset ( $ userCache [ 'discount_rules' ] ) ) { return $ userCache ; } eZDebug :: writeError ( 'Cache file ' . $ filePath . ' is corrupted, forcing generation.' , __METHOD__ ) ; return new eZClusterFileFailure ( 1 , 'Cache file ' . $ filePath . ' is corrupted, forcing generation.' ) ; } | Callback which fetches user cache from local file . |
40,713 | private static function generateUserCacheData ( $ userId ) { $ user = eZUser :: fetch ( $ userId ) ; if ( ! $ user instanceof eZUser ) { return null ; } $ data [ 'info' ] [ $ userId ] = array ( 'contentobject_id' => $ user -> attribute ( 'contentobject_id' ) , 'login' => $ user -> attribute ( 'login' ) , 'email' => $ user -> attribute ( 'email' ) , 'is_enabled' => $ user -> isEnabled ( false ) , 'password_hash' => $ user -> attribute ( 'password_hash' ) , 'password_hash_type' => $ user -> attribute ( 'password_hash_type' ) ) ; $ previousCachingState = $ user -> setCachingEnabled ( false ) ; $ groups = $ user -> groups ( ) ; $ data [ 'groups' ] = $ groups ; $ groups [ ] = $ userId ; $ data [ 'roles' ] = eZRole :: fetchIDListByUser ( $ groups ) ; $ limitList = $ user -> limitList ( ) ; foreach ( $ limitList as $ limit ) { $ data [ 'role_limitations' ] [ ] = $ limit [ 'limit_value' ] ; } $ data [ 'access_array' ] = $ user -> generateAccessArray ( ) ; $ data [ 'discount_rules' ] = eZUserDiscountRule :: generateIDListByUserID ( $ userId ) ; $ user -> setCachingEnabled ( $ previousCachingState ) ; return $ data ; } | Generate cache content |
40,714 | static function generateUserCacheForFile ( $ filePath , $ userId ) { $ cacheData = self :: generateUserCacheData ( $ userId ) ; if ( $ cacheData !== null ) { $ cacheData = array ( 'content' => $ cacheData , 'scope' => 'user-info-cache' , 'datatype' => 'php' , 'store' => true ) ; } return $ cacheData ; } | Callback which generates user cache for user returns null on invalid user |
40,715 | function loginCount ( ) { $ db = eZDB :: instance ( ) ; $ userVisitArray = $ db -> arrayQuery ( "SELECT login_count FROM ezuservisit WHERE user_id=$this->ContentObjectID" ) ; if ( isset ( $ userVisitArray [ 0 ] ) ) { return $ userVisitArray [ 0 ] [ 'login_count' ] ; } else { return 0 ; } } | Returns the login count for the current user . |
40,716 | protected function generateGroupIdList ( ) { $ db = eZDB :: instance ( ) ; $ userID = $ this -> ContentObjectID ; $ userGroups = $ db -> arrayQuery ( "SELECT c.contentobject_id as id,c.path_string FROM ezcontentobject_tree b, ezcontentobject_tree c WHERE b.contentobject_id='$userID' AND b.parent_node_id = c.node_id ORDER BY c.contentobject_id " ) ; $ pathArray = array ( ) ; $ userGroupArray = array ( ) ; foreach ( $ userGroups as $ group ) { $ pathItems = explode ( '/' , $ group [ "path_string" ] ) ; array_pop ( $ pathItems ) ; array_pop ( $ pathItems ) ; foreach ( $ pathItems as $ pathItem ) { if ( $ pathItem != '' && $ pathItem > 1 ) $ pathArray [ ] = $ pathItem ; } $ userGroupArray [ ] = $ group [ 'id' ] ; } if ( ! empty ( $ pathArray ) ) { $ pathArray = array_unique ( $ pathArray ) ; $ extraGroups = $ db -> arrayQuery ( "SELECT c.contentobject_id as id FROM ezcontentobject_tree c, ezcontentobject d WHERE c.node_id in ( " . implode ( ', ' , $ pathArray ) . " ) AND d.id = c.contentobject_id ORDER BY c.contentobject_id " ) ; foreach ( $ extraGroups as $ group ) { $ userGroupArray [ ] = $ group [ 'id' ] ; } } return $ userGroupArray ; } | Generate list of group id s |
40,717 | public static function anonymousId ( ) { if ( self :: $ anonymousId === null ) { $ ini = eZINI :: instance ( ) ; self :: $ anonymousId = ( int ) $ ini -> variable ( 'UserSettings' , 'AnonymousUserID' ) ; $ GLOBALS [ 'eZUserBuiltins' ] = array ( self :: $ anonymousId ) ; } return self :: $ anonymousId ; } | Gets the id of the anonymous user . |
40,718 | protected function fetchUserCacheIfNeeded ( ) { if ( null === $ this -> UserCache && true === $ this -> CachingEnabled && 'true' === eZINI :: instance ( ) -> variable ( 'RoleSettings' , 'EnableCaching' ) ) { $ this -> UserCache = $ this -> getUserCache ( ) ; } } | Fetches user cache when given preconditions are met |
40,719 | static private function & sessionArray ( ) { if ( self :: $ namespace !== null ) { if ( ! isset ( $ _SESSION [ self :: $ namespace ] ) ) $ _SESSION [ self :: $ namespace ] = array ( ) ; return $ _SESSION [ self :: $ namespace ] ; } return $ _SESSION ; } | Returns the session array to use taking into account the namespace that might have been injected . |
40,720 | static public function stop ( ) { if ( ! self :: $ hasStarted ) { return false ; } session_write_close ( ) ; self :: $ hasStarted = false ; self :: $ handlerInstance = null ; return true ; } | Writes session data and stops the session if not already stopped . |
40,721 | static public function getHandlerInstance ( ezpSessionHandler $ handler = null ) { if ( self :: $ handlerInstance === null ) { if ( $ handler === null ) { $ ini = eZINI :: instance ( ) ; if ( $ ini -> variable ( 'Session' , 'Handler' ) !== '' ) { $ optionArray = array ( 'iniFile' => 'site.ini' , 'iniSection' => 'Session' , 'iniVariable' => 'Handler' , 'handlerParams' => array ( self :: $ hasSessionCookie ) ) ; $ options = new ezpExtensionOptions ( $ optionArray ) ; self :: $ handlerInstance = eZExtension :: getHandlerClass ( $ options ) ; } } else { self :: $ handlerInstance = $ handler ; } if ( ! self :: $ handlerInstance instanceof ezpSessionHandler ) { self :: $ handlerInstance = new ezpSessionHandlerPHP ( self :: $ hasSessionCookie ) ; } } return self :: $ handlerInstance ; } | Get curren session handler |
40,722 | public static function getHttpAccept ( $ default = 'xhtml' , $ aliasList = array ( 'html' => 'xhtml' , 'json' => 'json' , 'javascript' => 'json' , 'xml' => 'xml' , 'text' => 'text' ) ) { $ acceptList = array ( ) ; if ( isset ( $ _POST [ 'http_accept' ] ) ) $ acceptList = explode ( ',' , $ _POST [ 'http_accept' ] ) ; else if ( isset ( $ _POST [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _POST [ 'HTTP_ACCEPT' ] ) ; else if ( isset ( $ _GET [ 'http_accept' ] ) ) $ acceptList = explode ( ',' , $ _GET [ 'http_accept' ] ) ; else if ( isset ( $ _GET [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _GET [ 'HTTP_ACCEPT' ] ) ; else if ( isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) ) $ acceptList = explode ( ',' , $ _SERVER [ 'HTTP_ACCEPT' ] ) ; foreach ( $ acceptList as $ accept ) { foreach ( $ aliasList as $ alias => $ returnType ) { if ( strpos ( $ accept , $ alias ) !== false ) { $ default = $ returnType ; break 2 ; } } } return $ default ; } | Gets the first most prefered response type as defined by http_accept uses post and get parameter if present if not falls back to the one defined in http header . First parameter lets you define fallback value if none of the alternatives in second parameter is found . Second parameter lets you limit the allowes types with a alias hash . xhtml json xml and text are default allowed types . |
40,723 | public static function autoEncode ( $ ret , $ type = null ) { if ( $ type === null ) $ type = self :: getHttpAccept ( ) ; if ( $ type === 'xml' ) return self :: xmlEncode ( $ ret ) ; else if ( $ type === 'json' ) return json_encode ( $ ret ) ; else return self :: textEncode ( $ ret ) ; } | Encodes the content based on http accept values more on this on the getHttpAccept function . Will simply implode the return value if array and not xml or json is prefered return type . |
40,724 | public static function textEncode ( $ mix ) { if ( is_array ( $ mix ) ) return implode ( ',' , array_map ( array ( 'ezjscAjaxContent' , 'textEncode' ) , array_filter ( $ mix ) ) ) ; return htmlspecialchars ( $ mix ) ; } | Encodes mixed value to string or comma seperated list of strings |
40,725 | public static function xmlEncode ( $ hash , $ childName = 'child' ) { $ xml = new XmlWriter ( ) ; $ xml -> openMemory ( ) ; $ xml -> startDocument ( '1.0' , 'UTF-8' ) ; $ xml -> startElement ( 'root' ) ; self :: xmlWrite ( $ xml , $ hash , $ childName ) ; $ xml -> endElement ( ) ; return $ xml -> outputMemory ( true ) ; } | Encodes simple multilevel array and hash values to valid xml string |
40,726 | protected static function xmlWrite ( XMLWriter $ xml , $ hash , $ childName = 'child' ) { foreach ( $ hash as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( is_numeric ( $ key ) ) $ xml -> startElement ( $ childName ) ; else $ xml -> startElement ( $ key ) ; self :: xmlWrite ( $ xml , $ value ) ; $ xml -> endElement ( ) ; continue ; } if ( is_numeric ( $ key ) ) { $ xml -> writeElement ( $ childName , $ value ) ; } else { $ xml -> writeElement ( $ key , $ value ) ; } } } | Recursive xmlWriter function called by xmlEncode |
40,727 | static function & fetchByUserIDArray ( $ idArray ) { $ db = eZDB :: instance ( ) ; $ inString = $ db -> generateSQLINStatement ( $ idArray , 'ezuser_discountrule.contentobject_id' , false , false , 'int' ) ; $ query = "SELECT DISTINCT ezdiscountrule.id, ezdiscountrule.name FROM ezdiscountrule, ezuser_discountrule WHERE $inString AND ezuser_discountrule.discountrule_id = ezdiscountrule.id" ; $ ruleArray = $ db -> arrayQuery ( $ query ) ; $ rules = array ( ) ; foreach ( $ ruleArray as $ ruleRow ) { $ rules [ ] = new eZDiscountRule ( $ ruleRow ) ; } return $ rules ; } | Fetches the eZDiscountRules matching an array of eZUserID |
40,728 | public static function removeByIDs ( $ idList ) { if ( ! is_array ( $ idList ) ) return ; while ( count ( $ idList ) > 0 ) { $ ids = array_splice ( $ idList , 0 , 100 ) ; $ conditions = array ( 'id' => array ( $ ids ) ) ; eZPersistentObject :: removeObject ( self :: definition ( ) , $ conditions ) ; } } | Removes wildcards based on an ID list |
40,729 | public static function fetchBySourceURL ( $ url , $ asObject = true ) { return eZPersistentObject :: fetchObject ( self :: definition ( ) , null , array ( "source_url" => $ url ) , $ asObject ) ; } | Fetches a wildcard by source url |
40,730 | public static function fetchList ( $ offset = false , $ limit = false , $ asObject = true ) { return eZPersistentObject :: fetchObjectList ( self :: definition ( ) , null , null , null , array ( 'offset' => $ offset , 'length' => $ limit ) , $ asObject ) ; } | Fetches the list of URL wildcards . By defaults fetches all the wildcards |
40,731 | public static function fetchListCount ( ) { $ rows = eZPersistentObject :: fetchObjectList ( self :: definition ( ) , array ( ) , null , false , null , false , false , array ( array ( 'operation' => 'count( * )' , 'name' => 'count' ) ) ) ; return $ rows [ 0 ] [ 'count' ] ; } | Returns the number of wildcards in the database without any filtering |
40,732 | public static function translate ( & $ uri ) { $ result = false ; $ uriString = ( $ uri instanceof eZURI ) ? $ uri -> elements ( ) : $ uri ; $ uriString = eZURLAliasML :: cleanURL ( $ uriString ) ; eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "input uriString: '$uriString'" , __METHOD__ ) ; if ( ! $ wildcards = self :: wildcardsIndex ( ) ) { eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "no match callbacks" , __METHOD__ ) ; return false ; } $ ini = eZINI :: instance ( ) ; $ iteration = $ ini -> variable ( 'URLTranslator' , 'MaximumWildcardIterations' ) ; eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "MaximumWildcardIterations: '$iteration'" , __METHOD__ ) ; $ urlTranslated = false ; while ( ! $ urlTranslated && $ iteration >= 0 ) { foreach ( $ wildcards as $ wildcardNum => $ wildcard ) { if ( preg_match ( $ wildcard , $ uriString ) ) { eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "matched with: '$wildcard'" , __METHOD__ ) ; self :: translateWithCache ( $ wildcardNum , $ uriString , $ wildcardInfo , $ wildcard ) ; eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "new uri string: '$uriString'" , __METHOD__ ) ; if ( $ wildcardInfo [ 'type' ] == self :: TYPE_FORWARD ) { $ urlTranslated = true ; break ; } if ( $ urlTranslated = eZURLAliasML :: translate ( $ uriString ) ) { eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "uri is translated to '$uriString' with result '$urlTranslated'" , __METHOD__ ) ; break ; } eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "uri is not translated, trying another wildcard" , __METHOD__ ) ; -- $ iteration ; continue 2 ; } } break ; } if ( $ urlTranslated ) { $ wildcardType = $ wildcardInfo [ 'type' ] ; eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "wildcard type: $wildcardType" , __METHOD__ ) ; switch ( $ wildcardType ) { case self :: TYPE_FORWARD : { $ result = $ uriString ; $ uriString = 'error/301' ; } break ; default : { eZDebug :: writeError ( 'Invalid wildcard type.' , __METHOD__ ) ; } case self :: TYPE_DIRECT : { $ result = $ urlTranslated ; break ; } } } else { eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "wildcard is not translated" , __METHOD__ ) ; $ result = false ; } if ( $ uri instanceof eZURI ) { $ uri -> setURIString ( $ uriString , false ) ; } else { $ uri = $ uriString ; } eZDebugSetting :: writeDebug ( 'kernel-urltranslator' , "finished with url '$uriString' and result '$result'" , __METHOD__ ) ; return $ result ; } | Transforms the URI if there exists an alias for it . |
40,733 | protected static function cacheInfoDirectories ( & $ wildcardCacheDir , & $ wildcardCacheFile , & $ wildcardCachePath , & $ wildcardKeys ) { $ info = self :: cacheInfo ( ) ; $ wildcardCacheDir = $ info [ 'dir' ] ; $ wildcardCacheFile = $ info [ 'file' ] ; $ wildcardCachePath = $ info [ 'path' ] ; $ wildcardKeys = $ info [ 'keys' ] ; } | Sets the various cache information to the parameters . |
40,734 | public static function expireCache ( ) { $ handler = eZExpiryHandler :: instance ( ) ; $ handler -> setTimestamp ( self :: CACHE_SIGNATURE , time ( ) ) ; $ handler -> store ( ) ; self :: $ wildcardsIndex = null ; } | Expires the wildcard cache . This causes the wildcard cache to be regenerated on the next page load . |
40,735 | protected static function expiryTimestamp ( ) { $ handler = eZExpiryHandler :: instance ( ) ; if ( $ handler -> hasTimestamp ( self :: CACHE_SIGNATURE ) ) { $ ret = $ handler -> timestamp ( self :: CACHE_SIGNATURE ) ; } else { $ ret = false ; } return $ ret ; } | Returns the expiry timestamp for wildcard cache from eZExpiryHandler |
40,736 | protected static function wildcardsIndex ( ) { if ( self :: $ wildcardsIndex === null ) { $ cacheIndexFile = self :: loadCacheFile ( ) ; self :: $ wildcardsIndex = $ cacheIndexFile -> processFile ( array ( __CLASS__ , 'fetchCacheFile' ) , self :: expiryTimestamp ( ) ) ; if ( self :: $ wildcardsIndex === null ) { self :: $ wildcardsIndex = self :: createWildcardsIndex ( ) ; } } return self :: $ wildcardsIndex ; } | Assign function names to input variables . Generates the wildcard cache if expired . |
40,737 | protected static function createWildcardsIndex ( ) { self :: cacheInfoDirectories ( $ wildcardCacheDir , $ wildcardCacheFile , $ wildcardCachePath , $ wildcardKeys ) ; if ( ! file_exists ( $ wildcardCacheDir ) ) { eZDir :: mkdir ( $ wildcardCacheDir , false , true ) ; } $ wildcardsIndex = array ( ) ; $ limit = self :: WILDCARDS_PER_CACHE_FILE ; $ offset = 0 ; $ cacheFilesCount = 0 ; $ wildcardNum = 0 ; while ( 1 ) { $ wildcards = self :: fetchList ( $ offset , $ limit , false ) ; if ( count ( $ wildcards ) === 0 ) { break ; } $ wildcardDetails = array ( ) ; $ currentSubCacheFile = self :: loadCacheFile ( $ cacheFilesCount ) ; foreach ( $ wildcards as $ wildcard ) { $ wildcardsIndex [ ] = self :: matchRegexpCode ( $ wildcard ) ; $ wildcardDetails [ $ wildcardNum ] = self :: matchReplaceCode ( $ wildcard ) ; ++ $ wildcardNum ; } $ binaryData = "<" . "?php\nreturn " . var_export ( $ wildcardDetails , true ) . ";\n?" . ">\n" ; $ currentSubCacheFile -> storeContents ( $ binaryData , "wildcard-cache-$cacheFilesCount" , 'php' , true ) ; $ offset += $ limit ; ++ $ cacheFilesCount ; } $ indexCacheFile = self :: loadCacheFile ( ) ; $ indexBinaryData = "<" . "?php\nreturn " . var_export ( $ wildcardsIndex , true ) . ";\n?" . ">\n" ; $ indexCacheFile -> storeContents ( $ indexBinaryData , "wildcard-cache-index" , 'php' , true ) ; return $ wildcardsIndex ; } | Create the wildcard cache |
40,738 | protected static function loadCacheFile ( $ cacheID = 'index' ) { if ( isset ( self :: $ cacheFiles [ $ cacheID ] ) ) { return self :: $ cacheFiles [ $ cacheID ] ; } $ info = self :: cacheInfo ( ) ; $ cacheFileName = $ info [ 'path' ] . '_' . $ cacheID . '.php' ; self :: $ cacheFiles [ $ cacheID ] = eZClusterFileHandler :: instance ( $ cacheFileName ) ; return self :: $ cacheFiles [ $ cacheID ] ; } | Loads and returns the cluster handler instance for the requested cache file . The instance will be returned even if the file doesn t exist |
40,739 | static function moduleOperationInfo ( $ moduleName , $ useTriggers = true ) { if ( ! isset ( $ GLOBALS [ 'eZGlobalModuleOperationList' ] ) ) { $ GLOBALS [ 'eZGlobalModuleOperationList' ] = array ( ) ; } if ( isset ( $ GLOBALS [ 'eZGlobalModuleOperationList' ] [ $ moduleName ] ) ) { return $ GLOBALS [ 'eZGlobalModuleOperationList' ] [ $ moduleName ] ; } $ moduleOperationInfo = new eZModuleOperationInfo ( $ moduleName , $ useTriggers ) ; $ moduleOperationInfo -> loadDefinition ( ) ; return $ GLOBALS [ 'eZGlobalModuleOperationList' ] [ $ moduleName ] = $ moduleOperationInfo ; } | Factory for modules moduleOperationInfo objects . |
40,740 | public function version ( ) { if ( $ this -> versionObject === null ) $ this -> versionObject = eZContentObjectVersion :: fetch ( $ this -> attribute ( 'ezcontentobject_version_id' ) ) ; return $ this -> versionObject ; } | Returns the version object the process is linked to |
40,741 | public static function fetchByContentObjectVersion ( $ contentObjectId , $ version ) { $ contentObjectVersion = eZContentObjectVersion :: fetchVersion ( $ version , $ contentObjectId ) ; if ( $ contentObjectVersion instanceof eZContentObjectVersion ) { $ return = self :: fetchByContentVersionId ( $ contentObjectVersion -> attribute ( 'id' ) ) ; return $ return ; } else { return false ; } } | Fetches a process by its content object ID + version |
40,742 | public static function isProcessing ( eZContentObjectVersion $ versionObject ) { $ count = parent :: count ( self :: definition ( ) , array ( 'ezcontentobject_version_id' => $ versionObject -> attribute ( 'id' ) , ) ) ; return ( $ count != 0 ) ; } | Checks if an object is already being processed |
40,743 | public static function queue ( eZContentObjectVersion $ version ) { $ row = array ( 'ezcontentobject_version_id' => $ version -> attribute ( 'id' ) , 'created' => time ( ) , 'status' => self :: STATUS_PENDING , ) ; $ processObject = new self ( $ row ) ; $ processObject -> store ( ) ; return $ processObject ; } | Adds a version to the publishing queue |
40,744 | public static function fetchProcesses ( $ status ) { if ( ! in_array ( $ status , array ( self :: STATUS_FINISHED , self :: STATUS_PENDING , self :: STATUS_WORKING ) ) ) throw new ezcBaseValueException ( '$status' , $ status , array ( self :: STATUS_FINISHED , self :: STATUS_PENDING , self :: STATUS_WORKING ) , 'parameter' ) ; return parent :: fetchObjectList ( self :: definition ( ) , false , array ( 'status' => $ status ) , array ( 'created' => 'asc' ) ) ; } | Fetches processes filtered by status |
40,745 | public function isAlive ( ) { if ( $ this -> attribute ( 'status' ) != self :: STATUS_WORKING ) throw new Exception ( 'The process\'s status isn\'t \'working\'' ) ; $ return = ( posix_kill ( $ this -> attribute ( 'pid' ) , 0 ) === true ) ; return $ return ; } | Checks if the system process is running |
40,746 | public function reset ( $ message ) { $ this -> setStatus ( self :: STATUS_PENDING , false , "::reset() with message '$message'" ) ; $ this -> setAttribute ( 'pid' , 0 ) ; $ this -> store ( array ( 'status' , 'pid' ) ) ; } | Resets the current process to the PENDING state |
40,747 | private function logStatusChange ( $ status , $ reason = null ) { $ contentObjectId = $ this -> version ( ) -> attribute ( 'contentobject_id' ) ; $ versionNumber = $ this -> version ( ) -> attribute ( 'version' ) ; eZDebugSetting :: writeDebug ( 'kernel-content-publish' , sprintf ( "process #%d, content %d.%d, status changed to %s (reason: %s)" , $ this -> attribute ( 'ezcontentobject_version_id' ) , $ contentObjectId , $ versionNumber , $ this -> getStatusString ( $ status ) , $ reason ? : "none given" ) , 'Asynchronous publishing process status changed' ) ; } | Logs a debug message when the process status is updated |
40,748 | static function getVAT ( $ object , $ country ) { if ( ! is_object ( $ handler = eZVATManager :: loadVATHandler ( ) ) ) { if ( $ handler === true ) { eZDebug :: writeWarning ( "No VAT handler specified but dynamic VAT charging is used." ) ; } return null ; } $ requireUserCountry = eZVATManager :: isUserCountryRequired ( ) ; if ( $ country === false ) $ country = eZVATManager :: getUserCountry ( ) ; if ( ! $ country && $ requireUserCountry ) { eZDebug :: writeNotice ( "User country is not specified." ) ; } return $ handler -> getVatPercent ( $ object , $ country ) ; } | Get percentage of VAT type corresponding to the given product and country the user is from . |
40,749 | static function isUserCountryRequired ( ) { $ requireUserCountry = true ; $ shopINI = eZINI :: instance ( 'shop.ini' ) ; if ( $ shopINI -> hasVariable ( 'VATSettings' , 'RequireUserCountry' ) ) $ requireUserCountry = ( $ shopINI -> variable ( 'VATSettings' , 'RequireUserCountry' ) == 'true' ) ; return $ requireUserCountry ; } | Check if users must have country specified . |
40,750 | static function getUserCountryAttributeName ( $ requireUserCountry ) { $ ini = eZINI :: instance ( 'shop.ini' ) ; if ( ! $ ini -> hasVariable ( 'VATSettings' , 'UserCountryAttribute' ) ) { if ( $ requireUserCountry ) { eZDebug :: writeError ( "Cannot find user country: please specify its attribute identifier " . "in the following setting: shop.ini.[VATSettings].UserCountryAttribute" , __METHOD__ ) ; } return null ; } $ countryAttributeName = $ ini -> variable ( 'VATSettings' , 'UserCountryAttribute' ) ; if ( ! $ countryAttributeName ) { if ( $ requireUserCountry ) { eZDebug :: writeError ( "Cannot find user country: empty attribute name specified " . "in the following setting: shop.ini.[VATSettings].UserCountryAttribute" , __METHOD__ ) ; } return null ; } return $ countryAttributeName ; } | Determine name of content attribute that contains user s country . |
40,751 | static function getUserCountry ( $ user = false , $ considerPreferedCountry = true ) { $ requireUserCountry = eZVATManager :: isUserCountryRequired ( ) ; if ( $ considerPreferedCountry ) { $ country = eZShopFunctions :: getPreferredUserCountry ( ) ; if ( $ country ) { eZDebug :: writeDebug ( "Applying user's preferred country <$country> while charging VAT" ) ; return $ country ; } } if ( $ user === false ) { $ user = eZUser :: currentUser ( ) ; } $ userObject = $ user -> attribute ( 'contentobject' ) ; $ countryAttributeName = eZVATManager :: getUserCountryAttributeName ( $ requireUserCountry ) ; if ( $ countryAttributeName === null ) return null ; $ userDataMap = $ userObject -> attribute ( 'data_map' ) ; if ( ! isset ( $ userDataMap [ $ countryAttributeName ] ) ) { if ( $ requireUserCountry ) { eZDebug :: writeError ( "Cannot find user country: there is no attribute '$countryAttributeName' in object '" . $ userObject -> attribute ( 'name' ) . "' of class '" . $ userObject -> attribute ( 'class_name' ) . "'." , __METHOD__ ) ; } return null ; } $ countryAttribute = $ userDataMap [ $ countryAttributeName ] ; $ countryContent = $ countryAttribute -> attribute ( 'content' ) ; if ( $ countryContent === null ) { if ( $ requireUserCountry ) { eZDebug :: writeError ( "User country is not specified in object '" . $ userObject -> attribute ( 'name' ) . "' of class '" . $ userObject -> attribute ( 'class_name' ) . "'." , __METHOD__ ) ; } return null ; } if ( is_object ( $ countryContent ) ) $ country = $ countryContent -> attribute ( 'value' ) ; elseif ( is_array ( $ countryContent ) ) { if ( is_array ( $ countryContent [ 'value' ] ) ) { foreach ( $ countryContent [ 'value' ] as $ item ) { $ country = $ item [ 'Alpha2' ] ; break ; } } else { $ country = $ countryContent [ 'value' ] ; } } else { if ( $ requireUserCountry ) { eZDebug :: writeError ( "User country is not specified or specified incorrectly in object '" . $ userObject -> attribute ( 'name' ) . "' of class '" . $ userObject -> attribute ( 'class_name' ) . "'." , __METHOD__ ) ; } return null ; } return $ country ; } | Determine user s country . |
40,752 | static function setUserCountry ( $ user , $ country ) { $ userObject = $ user -> attribute ( 'contentobject' ) ; $ requireUserCountry = eZVATManager :: isUserCountryRequired ( ) ; $ countryAttributeName = eZVATManager :: getUserCountryAttributeName ( $ requireUserCountry ) ; if ( $ countryAttributeName === null ) { return false ; } $ userDataMap = $ userObject -> attribute ( 'data_map' ) ; if ( ! isset ( $ userDataMap [ $ countryAttributeName ] ) ) { if ( $ requireUserCountry ) { eZDebug :: writeError ( "Cannot set user country: there is no attribute '$countryAttributeName' in object '" . $ userObject -> attribute ( 'name' ) . "' of class '" . $ userObject -> attribute ( 'class_name' ) . "'." , __METHOD__ ) ; } return false ; } eZDebug :: writeNotice ( sprintf ( "Saving country '%s' for user '%s'" , $ country , $ user -> attribute ( 'login' ) ) ) ; $ countryAttribute = $ userDataMap [ $ countryAttributeName ] ; $ countryAttributeContent = $ countryAttribute -> content ( ) ; if ( is_array ( $ countryAttributeContent ) ) $ countryAttributeContent [ 'value' ] = $ country ; elseif ( is_object ( $ countryAttributeContent ) ) $ countryAttributeContent -> setAttribute ( 'value' , $ country ) ; $ countryAttribute -> setContent ( $ countryAttributeContent ) ; $ countryAttribute -> store ( ) ; return true ; } | Set user s country . |
40,753 | public function increase ( $ count = 1 ) { $ this -> setAttribute ( 'count' , $ this -> attribute ( 'count' ) + $ count ) ; eZDB :: instance ( ) -> query ( "UPDATE ezview_counter " . "SET count = count + " . ( int ) $ count . " " . "WHERE node_id=" . $ this -> attribute ( "node_id" ) ) ; } | Increase the counter . |
40,754 | function productItems ( $ asObject = true , array $ sorts = null ) { $ productItems = eZPersistentObject :: fetchObjectList ( eZProductCollectionItem :: definition ( ) , null , array ( 'productcollection_id' => $ this -> ProductCollectionID ) , $ sorts , null , $ asObject ) ; $ addedProducts = array ( ) ; foreach ( $ productItems as $ productItem ) { $ contentObject = $ productItem -> attribute ( 'contentobject' ) ; if ( $ this -> IgnoreVAT == true ) { $ vatValue = 0 ; } else { $ vatValue = $ productItem -> attribute ( 'vat_value' ) ; } if ( $ contentObject ) { $ nodeID = $ contentObject -> attribute ( 'main_node_id' ) ; $ objectName = $ contentObject -> attribute ( 'name' ) ; } else { $ nodeID = false ; $ objectName = $ productItem -> attribute ( 'name' ) ; } $ price = $ productItem -> attribute ( 'price' ) ; if ( $ productItem -> attribute ( 'is_vat_inc' ) ) { $ priceExVAT = $ price / ( 100 + $ vatValue ) * 100 ; $ priceIncVAT = $ price ; } else { $ priceExVAT = $ price ; $ priceIncVAT = $ price * ( 100 + $ vatValue ) / 100 ; } $ count = $ productItem -> attribute ( 'item_count' ) ; $ discountPercent = $ productItem -> attribute ( 'discount' ) ; $ realPricePercent = ( 100 - $ discountPercent ) / 100 ; $ addedProducts [ ] = array ( "id" => $ productItem -> attribute ( 'id' ) , "vat_value" => $ vatValue , "item_count" => $ count , "node_id" => $ nodeID , "object_name" => $ objectName , "price_ex_vat" => $ priceExVAT , "price_inc_vat" => $ priceIncVAT , "discount_percent" => $ discountPercent , "total_price_ex_vat" => round ( $ count * $ priceExVAT * $ realPricePercent , 2 ) , "total_price_inc_vat" => round ( $ count * $ priceIncVAT * $ realPricePercent , 2 ) , 'item_object' => $ productItem ) ; } return $ addedProducts ; } | Fetch product items that bellongs ot the order |
40,755 | function getNewID ( ) { $ db = eZDB :: instance ( ) ; if ( $ db -> supportsDefaultValuesInsertion ( ) ) { $ db -> query ( 'INSERT INTO ezorder_nr_incr DEFAULT VALUES' ) ; } else { $ db -> query ( 'INSERT INTO ezorder_nr_incr(id) VALUES(DEFAULT)' ) ; } return $ db -> lastSerialID ( 'ezorder_nr_incr' , 'id' ) ; } | Get a new auto_increment id from a separate table ezorder_nr_incr . |
40,756 | static function fetchByIdentifier ( $ sectionIdentifier , $ asObject = true ) { global $ eZContentSectionObjectCache ; if ( ! isset ( $ eZContentSectionObjectCache [ $ sectionIdentifier ] ) || $ asObject === false ) { $ sectionFetched = eZPersistentObject :: fetchObject ( eZSection :: definition ( ) , null , array ( "identifier" => $ sectionIdentifier ) , $ asObject ) ; if ( ! $ sectionFetched ) { return null ; } if ( $ asObject ) { $ sectionID = $ sectionFetched -> attribute ( 'id' ) ; if ( ! isset ( $ eZContentSectionObjectCache [ $ sectionID ] ) ) { $ eZContentSectionObjectCache [ $ sectionID ] = $ sectionFetched ; } $ eZContentSectionObjectCache [ $ sectionIdentifier ] = $ eZContentSectionObjectCache [ $ sectionID ] ; } else { return $ sectionFetched ; } } $ section = $ eZContentSectionObjectCache [ $ sectionIdentifier ] ; return $ section ; } | fetch object by section identifier |
40,757 | public function canUpload ( ) { $ access = eZUser :: instance ( ) -> hasAccessTo ( 'content' , 'create' ) ; if ( $ access [ 'accessWord' ] === 'no' ) { return false ; } $ ini = eZINI :: instance ( 'upload.ini' ) ; $ uploadableClassList = $ ini -> variable ( 'CreateSettings' , 'MimeClassMap' ) ; $ uploadableClassList [ ] = $ ini -> variable ( 'CreateSettings' , 'DefaultClass' ) ; $ classContent = $ this -> attribute -> attribute ( 'class_content' ) ; $ intersect = array_intersect ( $ classContent [ 'class_constraint_list' ] , $ uploadableClassList ) ; if ( ! empty ( $ classContent [ 'class_constraint_list' ] ) && empty ( $ intersect ) ) { return false ; } return true ; } | Checks if a file can be uploaded |
40,758 | public function getFileInfo ( ) { $ upload = new eZContentUpload ( ) ; $ errors = array ( ) ; $ mimeData = $ file = '' ; $ result = $ upload -> fetchHTTPFile ( 'UploadFile' , $ errors , $ file , $ mimeData ) ; if ( $ result === false ) { throw new RuntimeException ( ezpI18n :: tr ( 'extension/ezjscore/ajaxuploader' , 'Unable to retrieve the uploaded file: %message' , null , array ( '%message' => $ errors [ 0 ] [ 'description' ] ) ) ) ; } return array ( 'file' => $ file , 'mime' => $ mimeData ) ; } | Returns infos on the uploaded file |
40,759 | public function getContentClass ( array $ mimeData ) { $ upload = new eZContentUpload ( ) ; $ classIdentifier = $ upload -> detectClassIdentifier ( $ mimeData [ 'name' ] ) ; $ class = eZContentClass :: fetchByIdentifier ( $ classIdentifier ) ; if ( ! $ class instanceof eZContentClass ) { throw new RuntimeException ( ezpI18n :: tr ( 'extension/ezjscore/ajaxuploader' , 'Unable to load the class which identifier is "%class",' . ' this is probably a configuration issue in upload.ini.' , null , array ( '%class' => $ classIdentifier ) ) ) ; } $ classContent = $ this -> attribute -> attribute ( 'class_content' ) ; if ( ! empty ( $ classContent [ 'class_constraint_list' ] ) && ! in_array ( $ classIdentifier , $ classContent [ 'class_constraint_list' ] ) ) { throw new DomainException ( ezpI18n :: tr ( 'extension/ezjscore/ajaxuploader' , 'The file cannot be processed because' . ' it would result in a \'%class\' object and this relation' . ' does not accept this type of object.' , null , array ( '%class' => $ class -> attribute ( 'name' ) ) ) ) ; } return $ class ; } | Returns the content class to use when creating the content object from the file |
40,760 | public function getDefaultParentNodeId ( eZContentClass $ class ) { $ parentNodes = array ( ) ; $ parentMainNode = null ; $ upload = new eZContentUpload ( ) ; $ upload -> detectLocations ( $ class -> attribute ( 'identifier' ) , $ class , 'auto' , $ parentNodes , $ parentMainNode ) ; return $ parentMainNode ; } | Returns the node id of the default location of the future object |
40,761 | public function createObject ( $ file , $ parentNodeId , $ name = '' ) { $ result = array ( ) ; $ parentNode = eZContentObjectTreeNode :: fetch ( $ parentNodeId ) ; if ( ! $ parentNode instanceof eZContentObjectTreeNode ) { throw new InvalidArgumentException ( ezpI18n :: tr ( 'extension/ezjscore/ajaxuploader' , 'Location not found.' ) ) ; } $ upload = new eZContentUpload ( ) ; $ r = $ upload -> handleLocalFile ( $ result , $ file , $ parentNodeId , null , $ name , $ this -> attribute -> attribute ( 'language_code' ) ) ; if ( ! $ r || ! $ result [ 'contentobject' ] instanceof eZContentObject ) { throw new RuntimeException ( ezpI18n :: tr ( 'extension/ezjscore/ajaxuploader' , 'Unable to create the content object to add to the relation: %detail' , null , array ( '%detail' => $ result [ 'errors' ] [ 0 ] [ 'description' ] ) ) ) ; } return $ result [ 'contentobject' ] ; } | Creates the eZContentObject from the uploaded file |
40,762 | public function serializeObject ( eZContentObject $ contentObject ) { $ section = eZSection :: fetch ( $ contentObject -> attribute ( 'section_id' ) ) ; return array ( 'object_info' => array ( 'id' => $ contentObject -> attribute ( 'id' ) , 'name' => $ contentObject -> attribute ( 'name' ) , 'class_name' => $ contentObject -> attribute ( 'class_name' ) , 'section_name' => $ section -> attribute ( 'name' ) , 'published' => ezpI18n :: tr ( 'design/standard/content/datatype' , 'Yes' ) , ) ) ; } | Serialize the eZContentObject to be used to build the result in JavaScript |
40,763 | function storeVersioned ( $ version ) { $ dataType = $ this -> dataType ( ) ; if ( ! $ dataType ) { return false ; } self :: expireCache ( $ this -> ID , $ this -> attribute ( 'contentclass_id' ) ) ; $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; $ dataType -> preStoreVersionedClassAttribute ( $ this , $ version ) ; $ this -> setAttribute ( 'serialized_name_list' , $ this -> NameList -> serializeNames ( ) ) ; $ this -> setAttribute ( 'serialized_description_list' , $ this -> DescriptionList -> serializeNames ( ) ) ; $ this -> setAttribute ( 'serialized_data_text' , $ this -> DataTextI18nList -> serializeNames ( ) ) ; parent :: store ( ) ; $ dataType -> storeVersionedClassAttribute ( $ this , $ version ) ; $ db -> commit ( ) ; } | Store the content class in the specified version status . |
40,764 | public static function expireCache ( $ contentClassAttributeID = false , $ contentClassID = false ) { unset ( $ GLOBALS [ 'eZContentClassAttributeCacheListFull' ] ) ; if ( $ contentClassID !== false ) { if ( isset ( $ GLOBALS [ 'eZContentClassAttributeCacheList' ] [ $ contentClassID ] ) ) { unset ( $ GLOBALS [ 'eZContentClassAttributeCacheList' ] [ $ contentClassID ] ) ; } } else { unset ( $ GLOBALS [ 'eZContentClassAttributeCacheList' ] ) ; } if ( $ contentClassAttributeID !== false ) { if ( isset ( $ GLOBALS [ 'eZContentClassAttributeCache' ] [ $ contentClassAttributeID ] ) ) { unset ( $ GLOBALS [ 'eZContentClassAttributeCache' ] [ $ contentClassAttributeID ] ) ; } } else { unset ( $ GLOBALS [ 'eZContentClassAttributeCache' ] ) ; } $ handler = eZExpiryHandler :: instance ( ) ; $ handler -> setTimestamp ( 'class-identifier-cache' , time ( ) + 1 ) ; $ handler -> store ( ) ; self :: $ identifierHash = null ; } | Clears all content class attribute related caches |
40,765 | static function cleanupList ( $ productCollectionIDList ) { $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; $ inText = $ db -> generateSQLINStatement ( $ productCollectionIDList , 'productcollection_id' , false , false , 'int' ) ; $ rows = $ db -> arrayQuery ( "SELECT id FROM ezproductcollection_item WHERE $inText" ) ; if ( count ( $ rows ) > 0 ) { $ itemIDList = array ( ) ; foreach ( $ rows as $ row ) { $ itemIDList [ ] = $ row [ 'id' ] ; } eZProductCollectionItemOption :: cleanupList ( $ itemIDList ) ; } $ db -> query ( "DELETE FROM ezproductcollection_item WHERE $inText" ) ; $ db -> commit ( ) ; } | Removes all product collection items which related to the product collections specified in the parameter array |
40,766 | protected function doCreateRoutes ( ) { $ providerRoutes = ezpRestProvider :: getProvider ( ezpRestPrefixFilterInterface :: getApiProviderName ( ) ) -> getRoutes ( ) ; $ providerRoutes [ 'fatal' ] = new ezpMvcRailsRoute ( '/fatal' , 'ezpRestErrorController' , 'show' ) ; return ezcMvcRouter :: prefix ( eZINI :: instance ( 'rest.ini' ) -> variable ( 'System' , 'ApiPrefix' ) , $ providerRoutes ) ; } | Do create the REST routes |
40,767 | protected function getCachedRoutes ( ) { $ ttl = ( int ) eZINI :: instance ( 'rest.ini' ) -> variable ( 'CacheSettings' , 'RouteApcCacheTTL' ) ; if ( self :: $ isRouteCacheCreated === false ) { $ options = array ( 'ttl' => $ ttl ) ; ezcCacheManager :: createCache ( self :: ROUTE_CACHE_ID , self :: ROUTE_CACHE_PATH , 'ezpRestCacheStorageApcCluster' , $ options ) ; self :: $ isRouteCacheCreated = true ; } $ cache = ezcCacheManager :: getCache ( self :: ROUTE_CACHE_ID ) ; $ cacheKey = self :: ROUTE_CACHE_KEY . '_' . ezpRestPrefixFilterInterface :: getApiProviderName ( ) ; if ( ( $ prefixedRoutes = $ cache -> restore ( $ cacheKey ) ) === false ) { try { $ prefixedRoutes = $ this -> doCreateRoutes ( ) ; $ cache -> store ( $ cacheKey , $ prefixedRoutes ) ; } catch ( Exception $ e ) { ezpRestDebug :: getInstance ( ) -> log ( $ e -> getMessage ( ) , ezcLog :: ERROR ) ; } } return $ prefixedRoutes ; } | Extract REST routes from APC cache . Cache is generated if needed |
40,768 | public function attribute ( $ attributeName ) { if ( property_exists ( $ this , $ attributeName ) ) return $ this -> $ attributeName ; elseif ( $ this -> __isset ( $ attributeName ) ) return $ this -> __get ( $ attributeName ) ; else eZDebug :: writeError ( "Attribute '$attributeName' does not exist" , __METHOD__ ) ; } | eZPersistentObject wrapper method |
40,769 | protected function _owner ( ) { static $ owner = false ; if ( $ owner === false ) { $ owner = eZUser :: fetch ( $ this -> owner_id ) ; } return $ owner ; } | Returns the eZUser who owns the object |
40,770 | public static function authorizeApplication ( $ clientId , $ endPointUri , $ clientSecret = null ) { $ client = self :: fetchByClientId ( $ clientId ) ; if ( $ client === false ) return false ; if ( $ clientSecret !== null && ( $ clientSecret !== $ client -> client_secret ) ) return false ; if ( ( $ client -> endpoint_uri !== '' ) && ( $ endPointUri !== $ client -> endpoint_uri ) ) return false ; return true ; } | Validates an authorization request by an application using the ID redirection URI and secret if provided . |
40,771 | public static function fetchByClientId ( $ clientId ) { $ session = ezcPersistentSessionInstance :: get ( ) ; $ q = $ session -> createFindQuery ( __CLASS__ ) ; $ q -> where ( $ q -> expr -> eq ( 'client_id' , $ q -> bindValue ( $ clientId ) ) ) ; $ results = $ session -> find ( $ q , __CLASS__ ) ; if ( count ( $ results ) != 1 ) return false ; else return array_shift ( $ results ) ; } | Fetches a rest application using a client Id |
40,772 | public function isAuthorizedByUser ( $ scope , $ user = null ) { if ( $ user === null ) $ user = eZUser :: currentUser ( ) ; if ( ! $ user -> isRegistered ( ) ) throw new Exception ( "Anonymous user can not authorize an application" ) ; $ authorized = ezpRestAuthorizedClient :: fetchForClientUser ( $ this , $ user ) ; return ( $ authorized instanceof ezpRestAuthorizedClient ) ; } | Checks if this application has been authorized by the current user |
40,773 | public function authorizeFor ( $ user = null ) { $ authorization = new ezpRestAuthorizedClient ( ) ; $ authorization -> rest_client_id = $ this -> id ; $ authorization -> user_id = $ user -> attribute ( 'contentobject_id' ) ; $ session = ezcPersistentSessionInstance :: get ( ) ; $ session -> save ( $ authorization ) ; } | Authorizes this application for a user |
40,774 | static function dynamicVatTypeName ( ) { if ( ! isset ( $ GLOBALS [ 'eZVatType_dynamicVatTypeName' ] ) ) { $ shopINI = eZINI :: instance ( 'shop.ini' ) ; $ desc = $ shopINI -> variable ( 'VATSettings' , 'DynamicVatTypeName' ) ; $ GLOBALS [ 'eZVatType_dynamicVatTypeName' ] = $ desc ; } return $ GLOBALS [ 'eZVatType_dynamicVatTypeName' ] ; } | Return name of the fake dynamic VAT type . |
40,775 | static function fetchDependentProductsCount ( $ vatID ) { $ vatID = ( int ) $ vatID ; $ query = "SELECT COUNT(DISTINCT coa.contentobject_id) AS count " . "FROM ezcontentobject_attribute coa, ezcontentobject co " . "WHERE " . "coa.contentobject_id=co.id AND " . "coa.version=co.current_version AND " . "data_type_string IN ('ezprice', 'ezmultiprice') " . "AND data_text LIKE '$vatID,%'" ; $ db = eZDB :: instance ( ) ; $ rslt = $ db -> arrayQuery ( $ query ) ; $ nProducts = $ rslt [ 0 ] [ 'count' ] ; return $ nProducts ; } | Fetches number of products using given VAT type . |
40,776 | static function fetchDependentClassesCount ( $ vatID ) { $ vatID = ( int ) $ vatID ; $ query = "SELECT COUNT(DISTINCT cc.id) AS count " . "FROM ezcontentclass cc, ezcontentclass_attribute cca " . "WHERE cc.id=cca.contentclass_id AND " . "cca.data_type_string IN ('ezprice', 'ezmultiprice') AND data_float1=$vatID" ; $ db = eZDB :: instance ( ) ; $ rslt = $ db -> arrayQuery ( $ query ) ; $ nClasses = $ rslt [ 0 ] [ 'count' ] ; return $ nClasses ; } | Fetches number of product classes having given VAT type set as default . |
40,777 | function removeThis ( ) { $ vatID = $ this -> ID ; $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; $ dependentRules = eZVatRule :: fetchByVatType ( $ vatID ) ; foreach ( $ dependentRules as $ rule ) { eZVatRule :: removeVatRule ( $ rule -> attribute ( 'id' ) ) ; } eZVatType :: resetToDefaultInProducts ( $ vatID ) ; eZPersistentObject :: removeObject ( eZVatType :: definition ( ) , array ( "id" => $ vatID ) ) ; $ db -> commit ( ) ; } | Remove given VAT type and all references to it . |
40,778 | public function prefix ( $ prefix ) { $ patternDelim = $ this -> pattern [ 0 ] ; $ prefix = $ patternDelim . $ prefix . $ patternDelim ; parent :: prefix ( $ prefix ) ; } | Little fix to allow mixed regexp and rails routes in the router |
40,779 | public function matches ( ezcMvcRequest $ request ) { if ( $ this -> pregMatch ( $ request , $ matches ) ) { foreach ( $ matches as $ key => $ match ) { if ( is_numeric ( $ key ) ) { unset ( $ matches [ $ key ] ) ; } } if ( ! isset ( $ this -> protocolActionMap [ $ request -> protocol ] ) ) { throw new ezpRouteMethodNotAllowedException ( $ this -> getSupportedHTTPMethods ( ) ) ; } $ request -> variables = array_merge ( $ this -> defaultValues , $ request -> variables , $ matches ) ; if ( $ request -> protocol === 'http-options' ) { $ request -> variables [ 'supported_http_methods' ] = $ this -> getSupportedHTTPMethods ( ) ; } return new ezcMvcRoutingInformation ( $ this -> pattern , $ this -> controllerClassName , $ this -> protocolActionMap [ $ request -> protocol ] ) ; } return null ; } | Evaluates the URI against this route and allowed protocols |
40,780 | function addAuthor ( $ id , $ name , $ email ) { if ( $ id == - 1 ) { if ( isset ( $ this -> Authors [ $ this -> AuthorCount - 1 ] ) ) $ id = $ this -> Authors [ $ this -> AuthorCount - 1 ] [ 'id' ] + 1 ; else $ id = 1 ; } $ this -> Authors [ ] = array ( "id" => $ id , "name" => $ name , "email" => $ email , "is_default" => false ) ; $ this -> AuthorCount ++ ; } | Add an author |
40,781 | static public function fetchLinkObjectList ( $ contentObjectAttributeID , $ contentObjectAttributeVersion , $ asObject = true ) { $ conditions = array ( 'contentobject_attribute_id' => $ contentObjectAttributeID ) ; if ( $ contentObjectAttributeVersion !== false ) { $ conditions [ 'contentobject_attribute_version' ] = $ contentObjectAttributeVersion ; } return eZPersistentObject :: fetchObjectList ( eZURLObjectLink :: definition ( ) , null , $ conditions , null , null , $ asObject ) ; } | Fetches an array of eZURLObjectLink |
40,782 | public function storeVersioned ( $ attributes , $ version ) { $ previousVersion = $ this -> attribute ( 'version' ) ; $ db = eZDB :: instance ( ) ; $ db -> begin ( ) ; foreach ( $ attributes as $ attribute ) { $ attribute -> content ( ) ; } $ this -> removeAttributes ( false , $ version ) ; $ this -> removeAttributes ( false , $ previousVersion ) ; $ this -> remove ( false ) ; $ this -> setVersion ( $ version , $ attributes ) ; $ this -> setAttribute ( "modifier_id" , eZUser :: currentUser ( ) -> attribute ( "contentobject_id" ) ) ; $ this -> setAttribute ( "modified" , time ( ) ) ; $ this -> adjustAttributePlacements ( $ attributes ) ; foreach ( $ attributes as $ attribute ) { $ attribute -> storeVersioned ( $ version ) ; } if ( count ( $ attributes ) > 0 && trim ( $ this -> attribute ( 'contentobject_name' ) ) == '' ) { $ this -> setAttribute ( 'contentobject_name' , '<' . $ attributes [ 0 ] -> attribute ( 'identifier' ) . '>' ) ; } eZContentClassClassGroup :: removeClassMembers ( $ this -> ID , $ version ) ; foreach ( eZContentClassClassGroup :: fetchGroupList ( $ this -> ID , $ previousVersion ) as $ classgroup ) { $ classgroup -> setAttribute ( 'contentclass_version' , $ version ) ; $ classgroup -> store ( ) ; } eZContentClassClassGroup :: removeClassMembers ( $ this -> ID , $ previousVersion ) ; $ handler = eZExpiryHandler :: instance ( ) ; $ time = time ( ) ; $ handler -> setTimestamp ( 'user-class-cache' , $ time ) ; $ handler -> setTimestamp ( 'class-identifier-cache' , $ time ) ; $ handler -> setTimestamp ( 'sort-key-cache' , $ time ) ; $ handler -> store ( ) ; $ this -> setAttribute ( 'serialized_name_list' , $ this -> NameList -> serializeNames ( ) ) ; $ this -> setAttribute ( 'serialized_description_list' , $ this -> DescriptionList -> serializeNames ( ) ) ; parent :: store ( ) ; $ this -> NameList -> store ( $ this ) ; $ db -> commit ( ) ; eZContentCacheManager :: clearAllContentCache ( ) ; } | Stores the current class as a modified version updates the contentobject_name attribute and recreates the class group entries . |
40,783 | public static function versionHistoryLimit ( $ class ) { $ contentINI = eZINI :: instance ( 'content.ini' ) ; $ versionLimit = $ contentINI -> variable ( 'VersionManagement' , 'DefaultVersionHistoryLimit' ) ; if ( $ versionLimit < 2 ) { eZDebug :: writeWarning ( "Global version history limit must be equal to or higher than 2" , __METHOD__ ) ; $ versionLimit = 2 ; } if ( is_numeric ( $ class ) ) { if ( ! eZContentClass :: classIdentifierByID ( $ class ) ) { eZDebug :: writeWarning ( "class integer parameter doesn't match any content class ID" , __METHOD__ ) ; return $ versionLimit ; } $ classID = ( int ) $ class ; } elseif ( is_string ( $ class ) ) { $ classID = eZContentClass :: classIDByIdentifier ( $ class ) ; if ( ! $ classID ) { eZDebug :: writeWarning ( "class string parameter doesn't match any content class identifier" , __METHOD__ ) ; return $ versionLimit ; } } elseif ( is_object ( $ class ) ) { if ( ! $ class instanceof eZContentClass ) { eZDebug :: writeWarning ( "class object parameter is not an eZContentClass" , __METHOD__ ) ; return $ versionLimit ; } else { $ classID = $ class -> attribute ( 'id' ) ; } } $ classLimitSetting = $ contentINI -> variable ( 'VersionManagement' , 'VersionHistoryClass' ) ; $ classArray = array_keys ( $ classLimitSetting ) ; $ limitsArray = array_values ( $ classLimitSetting ) ; $ classArray = eZContentClass :: classIDByIdentifier ( $ classArray ) ; foreach ( $ classArray as $ index => $ id ) { if ( $ id == $ classID ) { $ limit = $ limitsArray [ $ index ] ; if ( $ limit < 2 ) { $ classIdentifier = eZContentClass :: classIdentifierByID ( $ classID ) ; eZDebug :: writeWarning ( "Version history limit for class {$classIdentifier} must be equal to or higher than 2" , __METHOD__ ) ; $ limit = 2 ; } $ versionLimit = $ limit ; } } return $ versionLimit ; } | Computes the version history limit for a content class |
40,784 | public function getHostURI ( ) { $ protIndex = strpos ( $ this -> protocol , '-' ) ; $ protocol = substr ( $ this -> protocol , 0 , $ protIndex ) ; $ hostUri = $ protocol . '://' . $ this -> host ; return $ hostUri ; } | Returns the host with the protocol |
40,785 | public function getParsedBody ( ) { if ( $ this -> originalProtocol === 'http-post' ) { if ( strpos ( $ this -> raw [ 'CONTENT_TYPE' ] , 'application/json' ) === 0 ) { return json_decode ( $ this -> body , true ) ; } return $ this -> post ; } if ( ! isset ( $ this -> raw [ 'CONTENT_TYPE' ] ) ) return null ; if ( empty ( $ this -> body ) ) return array ( ) ; if ( strpos ( $ this -> raw [ 'CONTENT_TYPE' ] , 'application/x-www-form-urlencoded' ) === 0 ) { parse_str ( $ this -> body , $ parsedBody ) ; return $ parsedBody ; } else if ( strpos ( $ this -> raw [ 'CONTENT_TYPE' ] , 'application/json' ) === 0 ) { return json_decode ( $ this -> body , true ) ; } return null ; } | Get parsed request body based on content type as a php hash . |
40,786 | public static function downloadHeaders ( $ file , $ isAttachedDownload = true , $ overrideFilename = false , $ startOffset = 0 , $ length = false , $ fileSize = false ) { if ( $ fileSize === false ) { if ( ! file_exists ( $ file ) ) { eZDebug :: writeError ( "\$fileSize not given, and file not found" , __METHOD__ ) ; return false ; } $ fileSize = filesize ( $ file ) ; } header ( 'X-Powered-By: eZ Publish' ) ; $ mimeinfo = eZMimeType :: findByURL ( $ file ) ; header ( "Content-Type: {$mimeinfo['name']}" ) ; header ( "Pragma: " ) ; header ( "Cache-Control: " ) ; header ( "Last-Modified: " ) ; header ( "Expires: " . gmdate ( 'D, d M Y H:i:s' , time ( ) + 600 ) . ' GMT' ) ; header ( "Content-Disposition: " . ( $ isAttachedDownload ? 'attachment' : 'inline' ) . ( $ overrideFilename !== false ? "; filename={$overrideFilename}" : '' ) ) ; if ( $ startOffset !== 0 ) { $ endOffset = ( $ length !== false ) ? ( $ length + $ startOffset - 1 ) : $ fileSize - 1 ; header ( "Content-Length: " . ( $ endOffset - $ startOffset + 1 ) ) ; header ( "Content-Range: bytes {$startOffset}-{$endOffset}/{$fileSize}" ) ; header ( "HTTP/1.1 206 Partial Content" ) ; } else { header ( "Content-Length: $fileSize" ) ; } header ( 'Content-Transfer-Encoding: binary' ) ; header ( 'Accept-Ranges: bytes' ) ; } | Handles the header part of a file transfer to the client |
40,787 | public static function downloadContent ( $ file , $ startOffset = 0 , $ length = false ) { if ( ! file_exists ( $ file ) ) { eZDebug :: writeError ( "'$file' does not exist" , __METHOD__ ) ; return false ; } if ( ( $ fp = fopen ( $ file , 'rb' ) ) === false ) { eZDebug :: writeError ( "An error occured opening '$file' for reading" , __METHOD__ ) ; return false ; } $ fileSize = filesize ( $ file ) ; if ( $ startOffset !== false && $ startOffset <= $ fileSize && fseek ( $ fp , $ startOffset ) === - 1 ) { eZDebug :: writeError ( "Error while setting offset on '{$file}'" , __METHOD__ ) ; return false ; } $ transferred = $ startOffset ; $ packetSize = self :: READ_PACKET_SIZE ; $ endOffset = ( $ length === false ) ? $ fileSize - 1 : $ length + $ startOffset - 1 ; while ( ! feof ( $ fp ) && $ transferred < $ endOffset + 1 ) { if ( $ transferred + $ packetSize > $ endOffset + 1 ) { $ packetSize = $ endOffset + 1 - $ transferred ; } echo fread ( $ fp , $ packetSize ) ; $ transferred += $ packetSize ; } fclose ( $ fp ) ; return true ; } | Handles the data part of a file transfer to the client |
40,788 | static function instance ( $ filename = false ) { if ( self :: $ isShutdownFunctionRegistered !== true ) { eZExecution :: addCleanupHandler ( array ( __CLASS__ , 'cleanupGeneratingFiles' ) ) ; self :: $ isShutdownFunctionRegistered = true ; } if ( $ filename !== false ) { $ optionArray = array ( 'iniFile' => 'file.ini' , 'iniSection' => 'ClusteringSettings' , 'iniVariable' => 'FileHandler' , 'handlerParams' => array ( $ filename ) ) ; $ options = new ezpExtensionOptions ( $ optionArray ) ; $ handler = eZExtension :: getHandlerClass ( $ options ) ; return $ handler ; } else { if ( self :: $ globalHandler === null ) { $ optionArray = array ( 'iniFile' => 'file.ini' , 'iniSection' => 'ClusteringSettings' , 'iniVariable' => 'FileHandler' ) ; $ options = new ezpExtensionOptions ( $ optionArray ) ; $ handler = eZExtension :: getHandlerClass ( $ options ) ; self :: $ globalHandler = $ handler ; } else $ handler = self :: $ globalHandler ; return $ handler ; } } | Returns the configured instance of an eZClusterFileHandlerInterface See ClusteringSettings . FileHandler in file . ini |
40,789 | static function cleanupGeneratingFiles ( ) { if ( count ( self :: $ generatingFiles ) === 0 ) { return false ; } else { eZDebug :: writeWarning ( "Execution was stopped while one or more files were generating. This should not happen." , __METHOD__ ) ; foreach ( self :: $ generatingFiles as $ generatingFile ) { $ generatingFile -> abortCacheGeneration ( ) ; self :: removeGeneratingFile ( $ generatingFile ) ; } return true ; } } | Cluster shutdown handler . Terminates generation for unterminated files . This situation doesn t happen by default but may with custom code that doesn t follow recommendations . |
40,790 | public static function cleanupEmptyDirectories ( $ path ) { $ dirpath = eZDir :: dirpath ( $ path ) ; eZDebugSetting :: writeDebug ( 'kernel-clustering' , "eZClusterFileHandler::cleanupEmptyDirectories( '{$dirpath}' )" ) ; if ( is_dir ( $ dirpath ) ) { eZDir :: cleanupEmptyDirectories ( $ dirpath ) ; } } | Goes trough the directory path and removes empty directories starting at the leaf and deleting down until a non empty directory is reached . If the path is not a directory nothing will happen . |
40,791 | public static function addGeneratingFile ( $ file ) { if ( ! ( $ file instanceof eZDFSFileHandler ) ) return false ; self :: $ generatingFiles [ $ file -> filePath ] = $ file ; } | Adds a file to the generating list |
40,792 | public static function preFork ( ) { $ clusterHandler = self :: instance ( ) ; if ( $ clusterHandler instanceof ezpDatabaseBasedClusterFileHandler ) { $ clusterHandler -> disconnect ( ) ; self :: $ globalHandler = null ; } } | Performs required operations before forking a process |
40,793 | public static function optimize ( $ css , $ packLevel = 2 ) { $ css = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ css ) ; $ css = preg_replace ( '!(?:\n|\s|^)/\*[^*]*\*+([^/][^*]*\*+)*/!' , '' , $ css ) ; $ css = preg_replace ( '!(?:;)/\*[^*]*\*+([^/][^*]*\*+)*/!' , ';' , $ css ) ; $ css = preg_replace ( array ( '/\n\s+/' , '/\s+\n/' , '/\n+/' ) , "\n" , $ css ) ; if ( $ packLevel > 2 ) { $ css = preg_replace ( array ( '/:\s+/' , '/\s+:/' ) , ':' , $ css ) ; $ css = preg_replace ( array ( '/,\s+/' , '/\s+,/' ) , ',' , $ css ) ; $ css = str_replace ( array ( ";\n" , '; ' ) , ';' , $ css ) ; $ css = str_replace ( array ( "}\n" , "\n}" , ';}' ) , '}' , $ css ) ; $ css = str_replace ( array ( "{\n" , "\n{" , '{;' ) , '{' , $ css ) ; $ css = str_replace ( array ( '\s{\s' , '\s{' , '{\s' ) , '{' , $ css ) ; $ css = str_replace ( array ( '\s}\s' , '\s}' , '}\s' ) , '}' , $ css ) ; $ css = str_replace ( array ( ' 0em' , ' 0px' , ' 0pt' , ' 0pc' ) , ' 0' , $ css ) ; $ css = str_replace ( array ( ':0em' , ':0px' , ':0pt' , ':0pc' ) , ':0' , $ css ) ; $ css = str_replace ( ' 0 0 0 0;' , ' 0;' , $ css ) ; $ css = str_replace ( ':0 0 0 0;' , ':0;' , $ css ) ; $ css = preg_replace ( "/color:#([0-9a-fA-F])\\1([0-9a-fA-F])\\2([0-9a-fA-F])\\3/" , "color:#\\1\\2\\3" , $ css ) ; } return $ css ; } | compress css code by removing whitespace |
40,794 | static public function getEngine ( ) { $ instanceName = "eZSearchPlugin_" . $ GLOBALS [ "eZCurrentAccess" ] [ "name" ] ; if ( isset ( $ GLOBALS [ $ instanceName ] ) ) { return $ GLOBALS [ $ instanceName ] ; } $ ini = eZINI :: instance ( ) ; $ searchEngineString = 'ezsearch' ; if ( $ ini -> hasVariable ( 'SearchSettings' , 'SearchEngine' ) == true ) { $ searchEngineString = $ ini -> variable ( 'SearchSettings' , 'SearchEngine' ) ; } $ directoryList = array ( ) ; if ( $ ini -> hasVariable ( 'SearchSettings' , 'ExtensionDirectories' ) ) { $ extensionDirectories = $ ini -> variable ( 'SearchSettings' , 'ExtensionDirectories' ) ; if ( is_array ( $ extensionDirectories ) ) { $ directoryList = eZExtension :: expandedPathList ( $ extensionDirectories , 'search/plugins' ) ; } } $ kernelDir = array ( 'kernel/search/plugins' ) ; $ directoryList = array_merge ( $ kernelDir , $ directoryList ) ; foreach ( $ directoryList as $ directory ) { $ searchEngineFile = implode ( '/' , array ( $ directory , strtolower ( $ searchEngineString ) , strtolower ( $ searchEngineString ) ) ) . '.php' ; if ( file_exists ( $ searchEngineFile ) ) { eZDebugSetting :: writeDebug ( 'kernel-search-ezsearch' , 'Loading search engine from ' . $ searchEngineFile , 'eZSearch::getEngine' ) ; include_once ( $ searchEngineFile ) ; $ GLOBALS [ $ instanceName ] = new $ searchEngineString ( ) ; return $ GLOBALS [ $ instanceName ] ; } } eZDebug :: writeDebug ( 'Unable to find the search engine:' . $ searchEngineString , 'eZSearch' ) ; eZDebug :: writeDebug ( 'Tried paths: ' . implode ( ', ' , $ directoryList ) , 'eZSearch' ) ; return false ; } | Get object instance of eZSearch engine to use . |
40,795 | public static function updateObjectsSection ( array $ objectIDs , $ sectionID ) { $ searchEngine = eZSearch :: getEngine ( ) ; if ( $ searchEngine instanceof ezpSearchEngine && method_exists ( $ searchEngine , 'updateObjectsSection' ) ) { return $ searchEngine -> updateObjectsSection ( $ objectIDs , $ sectionID ) ; } return false ; } | Notifies search engine about the change of section of a set of objects |
40,796 | public static function updateNodeSection ( $ nodeID , $ sectionID ) { $ searchEngine = eZSearch :: getEngine ( ) ; if ( $ searchEngine instanceof ezpSearchEngine && method_exists ( $ searchEngine , 'updateNodeSection' ) ) { return $ searchEngine -> updateNodeSection ( $ nodeID , $ sectionID ) ; } return false ; } | Notifies search engine about section changes |
40,797 | public static function updateNodeVisibility ( $ nodeID , $ action ) { $ searchEngine = eZSearch :: getEngine ( ) ; if ( $ searchEngine instanceof ezpSearchEngine && method_exists ( $ searchEngine , 'updateNodeVisibility' ) ) { return $ searchEngine -> updateNodeVisibility ( $ nodeID , $ action ) ; } return false ; } | Notifies search engine about node visibility changes |
40,798 | public static function addNodeAssignment ( $ mainNodeID , $ objectID , $ nodeAssignmentIDList , $ isMoved = false ) { $ searchEngine = eZSearch :: getEngine ( ) ; if ( $ searchEngine instanceof ezpSearchEngine && method_exists ( $ searchEngine , 'addNodeAssignment' ) ) { return $ searchEngine -> addNodeAssignment ( $ mainNodeID , $ objectID , $ nodeAssignmentIDList , $ isMoved ) ; } return false ; } | Notifies search engine about new node assignments added |
40,799 | public static function removeNodes ( array $ nodeIdList ) { $ searchEngine = self :: getEngine ( ) ; if ( $ searchEngine instanceof ezpSearchEngine && method_exists ( $ searchEngine , 'removeNodes' ) ) { return $ searchEngine -> removeNodes ( $ nodeIdList ) ; } return false ; } | Notifies search engine about nodes being removed |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.