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
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.rollback
function rollback() { if ( is_array( $this->TransactionStackTree ) ) { // All transactions were rollbacked, reset the tree. $this->TransactionStackTree = array(); } $ini = eZINI::instance(); if ($ini->variable( "DatabaseSettings", "Transactions" ) == "enabled") { if ( $this->TransactionCounter <= 0 ) { eZDebug::writeError( 'No transaction in progress, cannot rollback', __METHOD__ ); return false; } // Reset the transaction counter $this->TransactionCounter = 0; if ( $this->isConnected() ) { $oldRecordError = $this->RecordError; // Turn off error handling while we rollback $this->RecordError = false; $this->rollbackQuery(); $this->RecordError = $oldRecordError; } } return true; }
php
function rollback() { if ( is_array( $this->TransactionStackTree ) ) { // All transactions were rollbacked, reset the tree. $this->TransactionStackTree = array(); } $ini = eZINI::instance(); if ($ini->variable( "DatabaseSettings", "Transactions" ) == "enabled") { if ( $this->TransactionCounter <= 0 ) { eZDebug::writeError( 'No transaction in progress, cannot rollback', __METHOD__ ); return false; } // Reset the transaction counter $this->TransactionCounter = 0; if ( $this->isConnected() ) { $oldRecordError = $this->RecordError; // Turn off error handling while we rollback $this->RecordError = false; $this->rollbackQuery(); $this->RecordError = $oldRecordError; } } return true; }
[ "function", "rollback", "(", ")", "{", "if", "(", "is_array", "(", "$", "this", "->", "TransactionStackTree", ")", ")", "{", "// All transactions were rollbacked, reset the tree.", "$", "this", "->", "TransactionStackTree", "=", "array", "(", ")", ";", "}", "$",...
Cancels the transaction. @return bool
[ "Cancels", "the", "transaction", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L864-L891
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.generateFailedTransactionStackEntry
function generateFailedTransactionStackEntry( $stack, $indentCount ) { $stackText = ''; $indent = ''; if ( $indentCount > 0 ) { $indent = str_repeat( " ", $indentCount*4 ); } $stackText .= $indent . "Level " . $stack['level'] . "\n" . $indent . "{" . $indent . "\n"; $stackText .= $indent . " Began at:\n"; for ( $i = 0; $i < 2 && $i < count( $stack['trace'] ); ++$i ) { $indent2 = str_repeat( " ", $i + 1 ); if ( $i > 0 ) { $indent2 .= "->"; } $stackText .= $indent . $indent2 . $this->generateTraceEntry( $stack['trace'][$i] ); $stackText .= "\n"; } foreach ( $stack['sub_levels'] as $subStack ) { $stackText .= $this->generateFailedTransactionStackEntry( $subStack, $indentCount + 1 ); } if ( isset( $stack['commit_trace'] ) ) { $stackText .= $indent . " And commited at:\n"; for ( $i = 0; $i < 2 && $i < count( $stack['commit_trace'] ); ++$i ) { $indent2 = str_repeat( " ", $i + 1 ); if ( $i > 0 ) { $indent2 .= "->"; } $stackText .= $indent . $indent2 . $this->generateTraceEntry( $stack['commit_trace'][$i] ); $stackText .= "\n"; } } $stackText .= $indent . "}" . "\n"; return $stackText; }
php
function generateFailedTransactionStackEntry( $stack, $indentCount ) { $stackText = ''; $indent = ''; if ( $indentCount > 0 ) { $indent = str_repeat( " ", $indentCount*4 ); } $stackText .= $indent . "Level " . $stack['level'] . "\n" . $indent . "{" . $indent . "\n"; $stackText .= $indent . " Began at:\n"; for ( $i = 0; $i < 2 && $i < count( $stack['trace'] ); ++$i ) { $indent2 = str_repeat( " ", $i + 1 ); if ( $i > 0 ) { $indent2 .= "->"; } $stackText .= $indent . $indent2 . $this->generateTraceEntry( $stack['trace'][$i] ); $stackText .= "\n"; } foreach ( $stack['sub_levels'] as $subStack ) { $stackText .= $this->generateFailedTransactionStackEntry( $subStack, $indentCount + 1 ); } if ( isset( $stack['commit_trace'] ) ) { $stackText .= $indent . " And commited at:\n"; for ( $i = 0; $i < 2 && $i < count( $stack['commit_trace'] ); ++$i ) { $indent2 = str_repeat( " ", $i + 1 ); if ( $i > 0 ) { $indent2 .= "->"; } $stackText .= $indent . $indent2 . $this->generateTraceEntry( $stack['commit_trace'][$i] ); $stackText .= "\n"; } } $stackText .= $indent . "}" . "\n"; return $stackText; }
[ "function", "generateFailedTransactionStackEntry", "(", "$", "stack", ",", "$", "indentCount", ")", "{", "$", "stackText", "=", "''", ";", "$", "indent", "=", "''", ";", "if", "(", "$", "indentCount", ">", "0", ")", "{", "$", "indent", "=", "str_repeat",...
Recursive helper function for generating stack tree output. @access private @param array $stack @param int $indentCount @return string The generated string
[ "Recursive", "helper", "function", "for", "generating", "stack", "tree", "output", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L919-L959
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.generateTraceEntry
function generateTraceEntry( $entry ) { if ( isset( $entry['file'] ) ) { $stackText = $entry['file']; } else { $stackText = "???"; } $stackText .= ":"; if ( isset( $entry['line'] ) ) { $stackText .= $entry['line']; } else { $stackText .= "???"; } $stackText .= " "; if ( isset( $entry['class'] ) ) { $stackText .= $entry['class']; } else { $stackText .= "???"; } $stackText .= "::"; if ( isset( $entry['function'] ) ) { $stackText .= $entry['function']; } else { $stackText .= "???"; } return $stackText; }
php
function generateTraceEntry( $entry ) { if ( isset( $entry['file'] ) ) { $stackText = $entry['file']; } else { $stackText = "???"; } $stackText .= ":"; if ( isset( $entry['line'] ) ) { $stackText .= $entry['line']; } else { $stackText .= "???"; } $stackText .= " "; if ( isset( $entry['class'] ) ) { $stackText .= $entry['class']; } else { $stackText .= "???"; } $stackText .= "::"; if ( isset( $entry['function'] ) ) { $stackText .= $entry['function']; } else { $stackText .= "???"; } return $stackText; }
[ "function", "generateTraceEntry", "(", "$", "entry", ")", "{", "if", "(", "isset", "(", "$", "entry", "[", "'file'", "]", ")", ")", "{", "$", "stackText", "=", "$", "entry", "[", "'file'", "]", ";", "}", "else", "{", "$", "stackText", "=", "\"???\"...
Helper function for generating output for one stack-trace entry. @access private @param array $entry @return string The generated string
[ "Helper", "function", "for", "generating", "output", "for", "one", "stack", "-", "trace", "entry", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L968-L1006
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.reportError
function reportError() { // If we have a running transaction we must mark as invalid // in which case a call to commit() will perform a rollback if ( $this->TransactionCounter > 0 ) { $this->invalidateTransaction(); // This is the unique ID for this incidence which will also be placed in the error logs. $transID = 'TRANSID-' . md5( time() . mt_rand() ); eZDebug::writeError( 'Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID ); $this->rollback(); if ( $this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS ) { throw new eZDBException( $this->ErrorMessage, $this->ErrorNumber ); } else { // Stop execution immediately while allowing other systems (session etc.) to cleanup eZExecution::cleanup(); eZExecution::setCleanExit(); // Give some feedback, and also possibly show the debug output eZDebug::setHandleType( eZDebug::HANDLE_NONE ); $ini = eZINI::instance(); $adminEmail = $ini->variable( 'MailSettings', 'AdminEmail' ); if ( !eZSys::isShellExecution() ) { if ( !headers_sent() ) { header("HTTP/1.1 500 Internal Server Error"); } $site = htmlentities(eZSys::serverVariable( 'HTTP_HOST' ), ENT_QUOTES); $uri = htmlentities(eZSys::serverVariable( 'REQUEST_URI' ), ENT_QUOTES); print( "<div class=\"fatal-error\" style=\"" ); print( 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >' ); print( "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>" ); print( "<p>" ); print( "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:$adminEmail?subject=Transaction failed on $site and URI $uri with ID $transID\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>$transID</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n" ); print( "</p>" ); print( "</div>" ); $templateResult = null; if ( function_exists( 'eZDisplayResult' ) ) { eZDisplayResult( $templateResult ); } } else { fputs( STDERR,"Fatal error: A database transaction in eZ Publish failed.\n" ); fputs( STDERR, "\n" ); fputs( STDERR, "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ($adminEmail) of this site.\n" . "The current transaction ID is $transID and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n" ); fputs( STDERR, "\n" ); fputs( STDERR, eZDebug::printReport( false, false, true ) ); } // PHP execution stops here exit( 1 ); } } }
php
function reportError() { // If we have a running transaction we must mark as invalid // in which case a call to commit() will perform a rollback if ( $this->TransactionCounter > 0 ) { $this->invalidateTransaction(); // This is the unique ID for this incidence which will also be placed in the error logs. $transID = 'TRANSID-' . md5( time() . mt_rand() ); eZDebug::writeError( 'Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID ); $this->rollback(); if ( $this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS ) { throw new eZDBException( $this->ErrorMessage, $this->ErrorNumber ); } else { // Stop execution immediately while allowing other systems (session etc.) to cleanup eZExecution::cleanup(); eZExecution::setCleanExit(); // Give some feedback, and also possibly show the debug output eZDebug::setHandleType( eZDebug::HANDLE_NONE ); $ini = eZINI::instance(); $adminEmail = $ini->variable( 'MailSettings', 'AdminEmail' ); if ( !eZSys::isShellExecution() ) { if ( !headers_sent() ) { header("HTTP/1.1 500 Internal Server Error"); } $site = htmlentities(eZSys::serverVariable( 'HTTP_HOST' ), ENT_QUOTES); $uri = htmlentities(eZSys::serverVariable( 'REQUEST_URI' ), ENT_QUOTES); print( "<div class=\"fatal-error\" style=\"" ); print( 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >' ); print( "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>" ); print( "<p>" ); print( "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:$adminEmail?subject=Transaction failed on $site and URI $uri with ID $transID\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>$transID</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n" ); print( "</p>" ); print( "</div>" ); $templateResult = null; if ( function_exists( 'eZDisplayResult' ) ) { eZDisplayResult( $templateResult ); } } else { fputs( STDERR,"Fatal error: A database transaction in eZ Publish failed.\n" ); fputs( STDERR, "\n" ); fputs( STDERR, "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ($adminEmail) of this site.\n" . "The current transaction ID is $transID and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n" ); fputs( STDERR, "\n" ); fputs( STDERR, eZDebug::printReport( false, false, true ) ); } // PHP execution stops here exit( 1 ); } } }
[ "function", "reportError", "(", ")", "{", "// If we have a running transaction we must mark as invalid", "// in which case a call to commit() will perform a rollback", "if", "(", "$", "this", "->", "TransactionCounter", ">", "0", ")", "{", "$", "this", "->", "invalidateTransa...
This is called whenever an error occurs in one of the database handlers. If a transaction is active it will be invalidated as well. @access protected @throws eZDBException
[ "This", "is", "called", "whenever", "an", "error", "occurs", "in", "one", "of", "the", "database", "handlers", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L1042-L1119
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.relationName
function relationName( $relationType ) { $names = array( eZDBInterface::RELATION_TABLE => 'TABLE', eZDBInterface::RELATION_SEQUENCE => 'SEQUENCE', eZDBInterface::RELATION_TRIGGER => 'TRIGGER', eZDBInterface::RELATION_VIEW => 'VIEW', eZDBInterface::RELATION_INDEX => 'INDEX' ); if ( !isset( $names[$relationType] ) ) return false; return $names[$relationType]; }
php
function relationName( $relationType ) { $names = array( eZDBInterface::RELATION_TABLE => 'TABLE', eZDBInterface::RELATION_SEQUENCE => 'SEQUENCE', eZDBInterface::RELATION_TRIGGER => 'TRIGGER', eZDBInterface::RELATION_VIEW => 'VIEW', eZDBInterface::RELATION_INDEX => 'INDEX' ); if ( !isset( $names[$relationType] ) ) return false; return $names[$relationType]; }
[ "function", "relationName", "(", "$", "relationType", ")", "{", "$", "names", "=", "array", "(", "eZDBInterface", "::", "RELATION_TABLE", "=>", "'TABLE'", ",", "eZDBInterface", "::", "RELATION_SEQUENCE", "=>", "'SEQUENCE'", ",", "eZDBInterface", "::", "RELATION_TR...
Returns the name of the relation type which is usable in SQL or false if unknown type. This function can be used by some database handlers which can operate on relation types using SQL. @access protected @param int $relationType @return bool
[ "Returns", "the", "name", "of", "the", "relation", "type", "which", "is", "usable", "in", "SQL", "or", "false", "if", "unknown", "type", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L1206-L1216
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.dropTempTableList
function dropTempTableList( $tableList, $server = self::SERVER_SLAVE ) { foreach( $tableList as $tableName ) $this->dropTempTable( "DROP TABLE $tableName", $server ); }
php
function dropTempTableList( $tableList, $server = self::SERVER_SLAVE ) { foreach( $tableList as $tableName ) $this->dropTempTable( "DROP TABLE $tableName", $server ); }
[ "function", "dropTempTableList", "(", "$", "tableList", ",", "$", "server", "=", "self", "::", "SERVER_SLAVE", ")", "{", "foreach", "(", "$", "tableList", "as", "$", "tableName", ")", "$", "this", "->", "dropTempTable", "(", "\"DROP TABLE $tableName\"", ",", ...
Drop temporary table list @param array $tableList @param int $server
[ "Drop", "temporary", "table", "list" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L1358-L1362
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.generateUniqueTempTableName
function generateUniqueTempTableName( $pattern, $randomizeIndex = false, $server = self::SERVER_SLAVE ) { $tableList = array_keys( $this->eZTableList( $server ) ); if ( $randomizeIndex === false ) { $randomizeIndex = mt_rand( 10, 1000 ); } do { $uniqueTempTableName = str_replace( '%', $randomizeIndex, $pattern ); $randomizeIndex++; } while ( in_array( $uniqueTempTableName, $tableList ) ); return $uniqueTempTableName; }
php
function generateUniqueTempTableName( $pattern, $randomizeIndex = false, $server = self::SERVER_SLAVE ) { $tableList = array_keys( $this->eZTableList( $server ) ); if ( $randomizeIndex === false ) { $randomizeIndex = mt_rand( 10, 1000 ); } do { $uniqueTempTableName = str_replace( '%', $randomizeIndex, $pattern ); $randomizeIndex++; } while ( in_array( $uniqueTempTableName, $tableList ) ); return $uniqueTempTableName; }
[ "function", "generateUniqueTempTableName", "(", "$", "pattern", ",", "$", "randomizeIndex", "=", "false", ",", "$", "server", "=", "self", "::", "SERVER_SLAVE", ")", "{", "$", "tableList", "=", "array_keys", "(", "$", "this", "->", "eZTableList", "(", "$", ...
Generate unique table name basing on the given pattern. If the pattern contains a (%) character then the character is replaced with a part providing uniqueness (e.g. random number). @param string $pattern @param bool $randomizeIndex @param int $server @return string
[ "Generate", "unique", "table", "name", "basing", "on", "the", "given", "pattern", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L1420-L1434
train
ezsystems/ezpublish-legacy
lib/ezdb/classes/ezdbinterface.php
eZDBInterface.setErrorHandling
public function setErrorHandling( $errorHandling ) { if ( $errorHandling != eZDB::ERROR_HANDLING_EXCEPTIONS && $errorHandling != eZDB::ERROR_HANDLING_STANDARD ) throw new RuntimeException( "Unknown eZDB error handling mode $errorHandling" ); $this->errorHandling = $errorHandling; }
php
public function setErrorHandling( $errorHandling ) { if ( $errorHandling != eZDB::ERROR_HANDLING_EXCEPTIONS && $errorHandling != eZDB::ERROR_HANDLING_STANDARD ) throw new RuntimeException( "Unknown eZDB error handling mode $errorHandling" ); $this->errorHandling = $errorHandling; }
[ "public", "function", "setErrorHandling", "(", "$", "errorHandling", ")", "{", "if", "(", "$", "errorHandling", "!=", "eZDB", "::", "ERROR_HANDLING_EXCEPTIONS", "&&", "$", "errorHandling", "!=", "eZDB", "::", "ERROR_HANDLING_STANDARD", ")", "throw", "new", "Runtim...
Sets the eZDB error handling mode @param int $errorHandling Possible values are:pm - eZDB::ERROR_HANDLING_STANDARD: backward compatible error handling, using reportError - eZDB::ERROR_HANDLING_EXCEPTION: using exceptions @since 4.5
[ "Sets", "the", "eZDB", "error", "handling", "mode" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdb/classes/ezdbinterface.php#L1515-L1522
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.create
static function create( $parentNodeID = null, $contentObjectID = null, $contentObjectVersion = 0, $sortField = 0, $sortOrder = true ) { $row = array( 'node_id' => null, 'main_node_id' => null, 'parent_node_id' => $parentNodeID, 'contentobject_id' => $contentObjectID, 'contentobject_version' => $contentObjectVersion, 'contentobject_is_published' => false, 'depth' => 1, 'path_string' => null, 'path_identification_string' => null, 'is_hidden' => false, 'is_invisible' => false, 'sort_field' => $sortField, 'sort_order' => $sortOrder, 'modified_subnode' => 0, 'remote_id' => eZRemoteIdUtility::generate( 'node' ), 'priority' => 0 ); $node = new eZContentObjectTreeNode( $row ); return $node; }
php
static function create( $parentNodeID = null, $contentObjectID = null, $contentObjectVersion = 0, $sortField = 0, $sortOrder = true ) { $row = array( 'node_id' => null, 'main_node_id' => null, 'parent_node_id' => $parentNodeID, 'contentobject_id' => $contentObjectID, 'contentobject_version' => $contentObjectVersion, 'contentobject_is_published' => false, 'depth' => 1, 'path_string' => null, 'path_identification_string' => null, 'is_hidden' => false, 'is_invisible' => false, 'sort_field' => $sortField, 'sort_order' => $sortOrder, 'modified_subnode' => 0, 'remote_id' => eZRemoteIdUtility::generate( 'node' ), 'priority' => 0 ); $node = new eZContentObjectTreeNode( $row ); return $node; }
[ "static", "function", "create", "(", "$", "parentNodeID", "=", "null", ",", "$", "contentObjectID", "=", "null", ",", "$", "contentObjectVersion", "=", "0", ",", "$", "sortField", "=", "0", ",", "$", "sortOrder", "=", "true", ")", "{", "$", "row", "=",...
Creates a new tree node and returns it. The attribute remote_id will get an automatic and unique value. @param int $parentNodeID The ID of the parent or null if the node is not known yet. @param int $contentObjectID The ID of the object it points to or null if it is not known yet. @param int $contentObjectVersion The version of the object or 0 if not known yet. @param int $sortField Number describing the field to sort by, or 0 if not known yet. @param bool $sortOrder Which way to sort, true means ascending while false is descending. @return eZContentObjectTreeNode
[ "Creates", "a", "new", "tree", "node", "and", "returns", "it", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L177-L198
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.dataMap
function dataMap() { $object = $this->object(); if ( self::$useCurrentUserDraft ) { $draft = eZContentObjectVersion::fetchLatestUserDraft( $object->attribute( 'id' ), eZUser::currentUserID(), $object->currentLanguageObject()->attribute( 'id' ), $object->attribute( 'modified' ) ); if ( $draft instanceof eZContentObjectVersion ) return $object->fetchDataMap( $draft->attribute( 'version' ) ); } return $object->fetchDataMap( $this->attribute( 'contentobject_version' ) ); }
php
function dataMap() { $object = $this->object(); if ( self::$useCurrentUserDraft ) { $draft = eZContentObjectVersion::fetchLatestUserDraft( $object->attribute( 'id' ), eZUser::currentUserID(), $object->currentLanguageObject()->attribute( 'id' ), $object->attribute( 'modified' ) ); if ( $draft instanceof eZContentObjectVersion ) return $object->fetchDataMap( $draft->attribute( 'version' ) ); } return $object->fetchDataMap( $this->attribute( 'contentobject_version' ) ); }
[ "function", "dataMap", "(", ")", "{", "$", "object", "=", "$", "this", "->", "object", "(", ")", ";", "if", "(", "self", "::", "$", "useCurrentUserDraft", ")", "{", "$", "draft", "=", "eZContentObjectVersion", "::", "fetchLatestUserDraft", "(", "$", "obj...
Returns an array with all the content object attributes where the keys are the attribute identifiers. @see eZContentObject::fetchDataMap() @return eZContentObjectAttribute[]
[ "Returns", "an", "array", "with", "all", "the", "content", "object", "attributes", "where", "the", "keys", "are", "the", "attribute", "identifiers", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L226-L242
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.remoteID
function remoteID() { $remoteID = $this->attribute( 'remote_id', true ); if ( !$remoteID ) { $this->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'node' ) ); $this->sync( array( 'remote_id' ) ); $remoteID = $this->attribute( 'remote_id', true ); } return $remoteID; }
php
function remoteID() { $remoteID = $this->attribute( 'remote_id', true ); if ( !$remoteID ) { $this->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'node' ) ); $this->sync( array( 'remote_id' ) ); $remoteID = $this->attribute( 'remote_id', true ); } return $remoteID; }
[ "function", "remoteID", "(", ")", "{", "$", "remoteID", "=", "$", "this", "->", "attribute", "(", "'remote_id'", ",", "true", ")", ";", "if", "(", "!", "$", "remoteID", ")", "{", "$", "this", "->", "setAttribute", "(", "'remote_id'", ",", "eZRemoteIdUt...
Get the remote id of content node If there is no remote ID a new unique one will be generated. The remote ID is often used to synchronise imports and exports. @return string
[ "Get", "the", "remote", "id", "of", "content", "node" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L253-L264
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canRead
function canRead( ) { if ( !isset( $this->Permissions["can_read"] ) ) { $this->Permissions["can_read"] = $this->checkAccess( 'read' ); } return ( $this->Permissions["can_read"] == 1 ); }
php
function canRead( ) { if ( !isset( $this->Permissions["can_read"] ) ) { $this->Permissions["can_read"] = $this->checkAccess( 'read' ); } return ( $this->Permissions["can_read"] == 1 ); }
[ "function", "canRead", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_read\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_read\"", "]", "=", "$", "this", "->", "checkAccess", "(", "'r...
Returns true if the node can be read by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "read", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L305-L312
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canPdf
function canPdf( ) { if ( !isset( $this->Permissions["can_pdf"] ) ) { $this->Permissions["can_pdf"] = $this->checkAccess( 'pdf' ); } return ( $this->Permissions["can_pdf"] == 1 ); }
php
function canPdf( ) { if ( !isset( $this->Permissions["can_pdf"] ) ) { $this->Permissions["can_pdf"] = $this->checkAccess( 'pdf' ); } return ( $this->Permissions["can_pdf"] == 1 ); }
[ "function", "canPdf", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_pdf\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_pdf\"", "]", "=", "$", "this", "->", "checkAccess", "(", "'pdf'...
Returns true if the current user can create a pdf of this content object. @return bool
[ "Returns", "true", "if", "the", "current", "user", "can", "create", "a", "pdf", "of", "this", "content", "object", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L319-L326
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canViewEmbed
function canViewEmbed( ) { if ( !isset( $this->Permissions["can_view_embed"] ) ) { $this->Permissions["can_view_embed"] = $this->checkAccess( 'view_embed' ); } return ( $this->Permissions["can_view_embed"] == 1 ); }
php
function canViewEmbed( ) { if ( !isset( $this->Permissions["can_view_embed"] ) ) { $this->Permissions["can_view_embed"] = $this->checkAccess( 'view_embed' ); } return ( $this->Permissions["can_view_embed"] == 1 ); }
[ "function", "canViewEmbed", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_view_embed\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_view_embed\"", "]", "=", "$", "this", "->", "checkAcce...
Returns true if the node can be viewed as embeded object by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "viewed", "as", "embeded", "object", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L333-L340
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canEdit
function canEdit( ) { if ( !isset( $this->Permissions["can_edit"] ) ) { $this->Permissions["can_edit"] = $this->checkAccess( 'edit' ); if ( $this->Permissions["can_edit"] != 1 ) { $user = eZUser::currentUser(); if ( $user->id() == $this->ContentObject->attribute( 'id' ) ) { $access = $user->hasAccessTo( 'user', 'selfedit' ); if ( $access['accessWord'] == 'yes' ) { $this->Permissions["can_edit"] = 1; } } } } return ( $this->Permissions["can_edit"] == 1 ); }
php
function canEdit( ) { if ( !isset( $this->Permissions["can_edit"] ) ) { $this->Permissions["can_edit"] = $this->checkAccess( 'edit' ); if ( $this->Permissions["can_edit"] != 1 ) { $user = eZUser::currentUser(); if ( $user->id() == $this->ContentObject->attribute( 'id' ) ) { $access = $user->hasAccessTo( 'user', 'selfedit' ); if ( $access['accessWord'] == 'yes' ) { $this->Permissions["can_edit"] = 1; } } } } return ( $this->Permissions["can_edit"] == 1 ); }
[ "function", "canEdit", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_edit\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_edit\"", "]", "=", "$", "this", "->", "checkAccess", "(", "'e...
Returns true if the node can be edited by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "edited", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L347-L366
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canHide
function canHide( ) { if ( !isset( $this->Permissions["can_hide"] ) ) { $this->Permissions["can_hide"] = $this->checkAccess( 'hide' ); } return ( $this->Permissions["can_hide"] == 1 ); }
php
function canHide( ) { if ( !isset( $this->Permissions["can_hide"] ) ) { $this->Permissions["can_hide"] = $this->checkAccess( 'hide' ); } return ( $this->Permissions["can_hide"] == 1 ); }
[ "function", "canHide", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_hide\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_hide\"", "]", "=", "$", "this", "->", "checkAccess", "(", "'h...
Returns true if the node can be hidden by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "hidden", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L373-L380
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canCreate
function canCreate( ) { if ( !isset( $this->Permissions["can_create"] ) ) { $this->Permissions["can_create"] = $this->checkAccess( 'create' ); } return ( $this->Permissions["can_create"] == 1 ); }
php
function canCreate( ) { if ( !isset( $this->Permissions["can_create"] ) ) { $this->Permissions["can_create"] = $this->checkAccess( 'create' ); } return ( $this->Permissions["can_create"] == 1 ); }
[ "function", "canCreate", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_create\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_create\"", "]", "=", "$", "this", "->", "checkAccess", "(",...
Returns true if the current user can create a new node as child of this node. @return bool
[ "Returns", "true", "if", "the", "current", "user", "can", "create", "a", "new", "node", "as", "child", "of", "this", "node", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L387-L394
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canRemove
function canRemove( ) { if ( !isset( $this->Permissions["can_remove"] ) ) { $this->Permissions["can_remove"] = $this->checkAccess( 'remove' ); } return ( $this->Permissions["can_remove"] == 1 ); }
php
function canRemove( ) { if ( !isset( $this->Permissions["can_remove"] ) ) { $this->Permissions["can_remove"] = $this->checkAccess( 'remove' ); } return ( $this->Permissions["can_remove"] == 1 ); }
[ "function", "canRemove", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "\"can_remove\"", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "\"can_remove\"", "]", "=", "$", "this", "->", "checkAccess", "(",...
Returns true if the node can be removed by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "removed", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L401-L408
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canMoveFrom
function canMoveFrom( ) { if ( !isset( $this->Permissions['can_move_from'] ) ) { $this->Permissions['can_move_from'] = $this->checkAccess( 'edit' ) && $this->checkAccess( 'remove' ); } return ( $this->Permissions['can_move_from'] == 1 ); }
php
function canMoveFrom( ) { if ( !isset( $this->Permissions['can_move_from'] ) ) { $this->Permissions['can_move_from'] = $this->checkAccess( 'edit' ) && $this->checkAccess( 'remove' ); } return ( $this->Permissions['can_move_from'] == 1 ); }
[ "function", "canMoveFrom", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "'can_move_from'", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "'can_move_from'", "]", "=", "$", "this", "->", "checkAccess", ...
Returns true if the node can be moved by the current user. @return bool
[ "Returns", "true", "if", "the", "node", "can", "be", "moved", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L415-L422
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.canSwap
function canSwap() { if ( !isset( $this->Permissions['can_swap'] ) ) { $this->Permissions['can_swap'] = $this->checkAccess( 'edit' ); } return ( $this->Permissions['can_swap'] == 1 ); }
php
function canSwap() { if ( !isset( $this->Permissions['can_swap'] ) ) { $this->Permissions['can_swap'] = $this->checkAccess( 'edit' ); } return ( $this->Permissions['can_swap'] == 1 ); }
[ "function", "canSwap", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Permissions", "[", "'can_swap'", "]", ")", ")", "{", "$", "this", "->", "Permissions", "[", "'can_swap'", "]", "=", "$", "this", "->", "checkAccess", "(", "'edit'...
Returns true if a node can be swaped by the current user. @return bool
[ "Returns", "true", "if", "a", "node", "can", "be", "swaped", "by", "the", "current", "user", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L444-L451
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.fetchListCount
static function fetchListCount() { $sql = "SELECT count( node_id ) as count FROM ezcontentobject_tree"; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql ); return $rows[0]['count']; }
php
static function fetchListCount() { $sql = "SELECT count( node_id ) as count FROM ezcontentobject_tree"; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql ); return $rows[0]['count']; }
[ "static", "function", "fetchListCount", "(", ")", "{", "$", "sql", "=", "\"SELECT count( node_id ) as count FROM ezcontentobject_tree\"", ";", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "rows", "=", "$", "db", "->", "arrayQuery", "(", "$", ...
Fetches the number of nodes which exists in the system. @return int
[ "Fetches", "the", "number", "of", "nodes", "which", "exists", "in", "the", "system", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L508-L514
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.fetchList
static function fetchList( $asObject = true, $offset = false, $limit = false ) { $sql = "SELECT * FROM ezcontentobject_tree"; $parameters = array(); if ( $offset !== false ) $parameters['offset'] = $offset; if ( $limit !== false ) $parameters['limit'] = $limit; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql, $parameters ); $nodes = array(); if ( $asObject ) { foreach ( $rows as $row ) { $nodes[] = new eZContentObjectTreeNode( $row ); } return $nodes; } else return $rows; }
php
static function fetchList( $asObject = true, $offset = false, $limit = false ) { $sql = "SELECT * FROM ezcontentobject_tree"; $parameters = array(); if ( $offset !== false ) $parameters['offset'] = $offset; if ( $limit !== false ) $parameters['limit'] = $limit; $db = eZDB::instance(); $rows = $db->arrayQuery( $sql, $parameters ); $nodes = array(); if ( $asObject ) { foreach ( $rows as $row ) { $nodes[] = new eZContentObjectTreeNode( $row ); } return $nodes; } else return $rows; }
[ "static", "function", "fetchList", "(", "$", "asObject", "=", "true", ",", "$", "offset", "=", "false", ",", "$", "limit", "=", "false", ")", "{", "$", "sql", "=", "\"SELECT * FROM ezcontentobject_tree\"", ";", "$", "parameters", "=", "array", "(", ")", ...
Fetches a list of nodes and returns it. Offset and limitation can be set if needed. @param bool $asObject @param int|bool $offset @param int|bool $limit @return eZContentObjectTreeNode[]
[ "Fetches", "a", "list", "of", "nodes", "and", "returns", "it", ".", "Offset", "and", "limitation", "can", "be", "set", "if", "needed", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L524-L545
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.createClassFilteringSQLString
static function createClassFilteringSQLString( $classFilterType, &$classFilterArray ) { // Check for class filtering $classCondition = ''; if ( isset( $classFilterType ) && ( $classFilterType == 'include' || $classFilterType == 'exclude' ) && count( $classFilterArray ) > 0 ) { $classCondition = ' '; $i = 0; $classCount = count( $classFilterArray ); $classIDArray = array(); foreach ( $classFilterArray as $classID ) { $originalClassID = $classID; // Check if classes are recerenced by identifier if ( is_string( $classID ) && !is_numeric( $classID ) ) { $classID = eZContentClass::classIDByIdentifier( $classID ); } if ( is_numeric( $classID ) ) { $classIDArray[] = $classID; } else { eZDebugSetting::writeWarning( 'kernel-content-class', "Invalid class identifier in subTree() classfilterarray, classID : " . $originalClassID ); } } if ( count( $classIDArray ) > 0 ) { $classCondition .= " ezcontentobject.contentclass_id "; if ( $classFilterType == 'include' ) $classCondition .= " IN "; else $classCondition .= " NOT IN "; $classIDString = implode( ', ', $classIDArray ); $classCondition .= ' ( ' . $classIDString . ' ) AND'; } else { if ( count( $classIDArray ) == 0 and count( $classFilterArray ) > 0 and $classFilterType == 'include' ) { $classCondition = false; } } } return $classCondition; }
php
static function createClassFilteringSQLString( $classFilterType, &$classFilterArray ) { // Check for class filtering $classCondition = ''; if ( isset( $classFilterType ) && ( $classFilterType == 'include' || $classFilterType == 'exclude' ) && count( $classFilterArray ) > 0 ) { $classCondition = ' '; $i = 0; $classCount = count( $classFilterArray ); $classIDArray = array(); foreach ( $classFilterArray as $classID ) { $originalClassID = $classID; // Check if classes are recerenced by identifier if ( is_string( $classID ) && !is_numeric( $classID ) ) { $classID = eZContentClass::classIDByIdentifier( $classID ); } if ( is_numeric( $classID ) ) { $classIDArray[] = $classID; } else { eZDebugSetting::writeWarning( 'kernel-content-class', "Invalid class identifier in subTree() classfilterarray, classID : " . $originalClassID ); } } if ( count( $classIDArray ) > 0 ) { $classCondition .= " ezcontentobject.contentclass_id "; if ( $classFilterType == 'include' ) $classCondition .= " IN "; else $classCondition .= " NOT IN "; $classIDString = implode( ', ', $classIDArray ); $classCondition .= ' ( ' . $classIDString . ' ) AND'; } else { if ( count( $classIDArray ) == 0 and count( $classFilterArray ) > 0 and $classFilterType == 'include' ) { $classCondition = false; } } } return $classCondition; }
[ "static", "function", "createClassFilteringSQLString", "(", "$", "classFilterType", ",", "&", "$", "classFilterArray", ")", "{", "// Check for class filtering", "$", "classCondition", "=", "''", ";", "if", "(", "isset", "(", "$", "classFilterType", ")", "&&", "(",...
Returns an SQL string to filter query results by classes @param string|bool $classFilterType @param array $classFilterArray @return string|bool
[ "Returns", "an", "SQL", "string", "to", "filter", "query", "results", "by", "classes" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L777-L829
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.createExtendedAttributeFilterSQLStrings
static function createExtendedAttributeFilterSQLStrings( &$extendedAttributeFilter ) { $filter = array( 'tables' => '', 'joins' => '', 'columns' => '', 'group_by' => '' ); if ( $extendedAttributeFilter and count( $extendedAttributeFilter ) > 1 ) { $extendedAttributeFilterID = $extendedAttributeFilter['id']; $extendedAttributeFilterParams = $extendedAttributeFilter['params']; $filterINI = eZINI::instance( 'extendedattributefilter.ini' ); if ( !$filterINI->hasGroup( $extendedAttributeFilterID ) ) { eZDebug::writeError( "Unable to find configuration for the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored", __METHOD__ ); return $filter; } $filterClassName = $filterINI->variable( $extendedAttributeFilterID, 'ClassName' ); $filterMethodName = $filterINI->variable( $extendedAttributeFilterID, 'MethodName' ); if ( $filterINI->hasVariable( $extendedAttributeFilterID, 'FileName' ) ) { $filterFile = $filterINI->variable( $extendedAttributeFilterID, 'FileName' ); if ( $filterINI->hasVariable( $extendedAttributeFilterID, 'ExtensionName' ) ) { $extensionName = $filterINI->variable( $extendedAttributeFilterID, 'ExtensionName' ); include_once( eZExtension::baseDirectory() . "/$extensionName/$filterFile" ); } else { include_once( $filterFile ); } } if ( !class_exists( $filterClassName, true ) ) { eZDebug::writeError( "Unable to find the PHP class '$filterClassName' associated with the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored", __METHOD__ ); return $filter; } $classObject = new $filterClassName(); $parameterArray = array( $extendedAttributeFilterParams ); $sqlResult = call_user_func_array( array( $classObject, $filterMethodName ), $parameterArray ); $filter['tables'] = $sqlResult['tables']; $filter['joins'] = $sqlResult['joins']; $filter['columns'] = isset( $sqlResult['columns'] ) ? $sqlResult['columns'] : ''; if( isset( $sqlResult['group_by'] ) ) $filter['group_by'] = $sqlResult['group_by']; } return $filter; }
php
static function createExtendedAttributeFilterSQLStrings( &$extendedAttributeFilter ) { $filter = array( 'tables' => '', 'joins' => '', 'columns' => '', 'group_by' => '' ); if ( $extendedAttributeFilter and count( $extendedAttributeFilter ) > 1 ) { $extendedAttributeFilterID = $extendedAttributeFilter['id']; $extendedAttributeFilterParams = $extendedAttributeFilter['params']; $filterINI = eZINI::instance( 'extendedattributefilter.ini' ); if ( !$filterINI->hasGroup( $extendedAttributeFilterID ) ) { eZDebug::writeError( "Unable to find configuration for the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored", __METHOD__ ); return $filter; } $filterClassName = $filterINI->variable( $extendedAttributeFilterID, 'ClassName' ); $filterMethodName = $filterINI->variable( $extendedAttributeFilterID, 'MethodName' ); if ( $filterINI->hasVariable( $extendedAttributeFilterID, 'FileName' ) ) { $filterFile = $filterINI->variable( $extendedAttributeFilterID, 'FileName' ); if ( $filterINI->hasVariable( $extendedAttributeFilterID, 'ExtensionName' ) ) { $extensionName = $filterINI->variable( $extendedAttributeFilterID, 'ExtensionName' ); include_once( eZExtension::baseDirectory() . "/$extensionName/$filterFile" ); } else { include_once( $filterFile ); } } if ( !class_exists( $filterClassName, true ) ) { eZDebug::writeError( "Unable to find the PHP class '$filterClassName' associated with the extended attribute filter '$extendedAttributeFilterID', the filter will be ignored", __METHOD__ ); return $filter; } $classObject = new $filterClassName(); $parameterArray = array( $extendedAttributeFilterParams ); $sqlResult = call_user_func_array( array( $classObject, $filterMethodName ), $parameterArray ); $filter['tables'] = $sqlResult['tables']; $filter['joins'] = $sqlResult['joins']; $filter['columns'] = isset( $sqlResult['columns'] ) ? $sqlResult['columns'] : ''; if( isset( $sqlResult['group_by'] ) ) $filter['group_by'] = $sqlResult['group_by']; } return $filter; }
[ "static", "function", "createExtendedAttributeFilterSQLStrings", "(", "&", "$", "extendedAttributeFilter", ")", "{", "$", "filter", "=", "array", "(", "'tables'", "=>", "''", ",", "'joins'", "=>", "''", ",", "'columns'", "=>", "''", ",", "'group_by'", "=>", "'...
Creates a filter array from extended attribute filters The filter array includes tables, joins, columns and grouping information @param array $extendedAttributeFilter @return array
[ "Creates", "a", "filter", "array", "from", "extended", "attribute", "filters" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L839-L896
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.fetchAliasesFromNodeList
static function fetchAliasesFromNodeList( $nodeList ) { if ( !is_array( $nodeList ) || count( $nodeList ) < 1 ) return array(); $db = eZDB::instance(); $where = $db->generateSQLINStatement( $nodeList, 'node_id', false, false, 'int' ); $query = "SELECT node_id, path_identification_string FROM ezcontentobject_tree WHERE $where"; $pathListArray = $db->arrayQuery( $query ); return $pathListArray; }
php
static function fetchAliasesFromNodeList( $nodeList ) { if ( !is_array( $nodeList ) || count( $nodeList ) < 1 ) return array(); $db = eZDB::instance(); $where = $db->generateSQLINStatement( $nodeList, 'node_id', false, false, 'int' ); $query = "SELECT node_id, path_identification_string FROM ezcontentobject_tree WHERE $where"; $pathListArray = $db->arrayQuery( $query ); return $pathListArray; }
[ "static", "function", "fetchAliasesFromNodeList", "(", "$", "nodeList", ")", "{", "if", "(", "!", "is_array", "(", "$", "nodeList", ")", "||", "count", "(", "$", "nodeList", ")", "<", "1", ")", "return", "array", "(", ")", ";", "$", "db", "=", "eZDB"...
Fetches path_identification_string for a list of nodes @param array(int) $nodeList @return array Associative array
[ "Fetches", "path_identification_string", "for", "a", "list", "of", "nodes" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L2941-L2951
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.findMainNodeArray
static function findMainNodeArray( $objectIDArray, $asObject = true ) { if ( empty( $objectIDArray ) ) return null; $db = eZDB::instance(); $nodeListArray = $db->arrayQuery( "SELECT " . "ezcontentobject.contentclass_id, ezcontentobject.current_version, ezcontentobject.id, ezcontentobject.initial_language_id, ezcontentobject.language_mask, " . "ezcontentobject.modified, ezcontentobject.name, ezcontentobject.owner_id, ezcontentobject.published, ezcontentobject.remote_id AS object_remote_id, ezcontentobject.section_id, " . "ezcontentobject.status, ezcontentobject_tree.contentobject_is_published, ezcontentobject_tree.contentobject_version, ezcontentobject_tree.depth, ezcontentobject_tree.is_hidden, " . "ezcontentobject_tree.is_invisible, ezcontentobject_tree.main_node_id, ezcontentobject_tree.modified_subnode, ezcontentobject_tree.node_id, ezcontentobject_tree.parent_node_id, " . "ezcontentobject_tree.path_identification_string, ezcontentobject_tree.path_string, ezcontentobject_tree.priority, ezcontentobject_tree.remote_id, ezcontentobject_tree.sort_field, " . "ezcontentobject_tree.sort_order, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentclass.identifier as class_identifier, ezcontentclass.is_container " . "FROM ezcontentobject_tree " . "INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id) " . "INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) " . "WHERE " . $db->generateSQLINStatement( $objectIDArray, 'ezcontentobject_tree.contentobject_id', false, false, 'int' ) . " AND " . "ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id AND " . "ezcontentclass.version = 0" ); if ( $asObject ) { return eZContentObjectTreeNode::makeObjectsArray( $nodeListArray ); } return $nodeListArray; }
php
static function findMainNodeArray( $objectIDArray, $asObject = true ) { if ( empty( $objectIDArray ) ) return null; $db = eZDB::instance(); $nodeListArray = $db->arrayQuery( "SELECT " . "ezcontentobject.contentclass_id, ezcontentobject.current_version, ezcontentobject.id, ezcontentobject.initial_language_id, ezcontentobject.language_mask, " . "ezcontentobject.modified, ezcontentobject.name, ezcontentobject.owner_id, ezcontentobject.published, ezcontentobject.remote_id AS object_remote_id, ezcontentobject.section_id, " . "ezcontentobject.status, ezcontentobject_tree.contentobject_is_published, ezcontentobject_tree.contentobject_version, ezcontentobject_tree.depth, ezcontentobject_tree.is_hidden, " . "ezcontentobject_tree.is_invisible, ezcontentobject_tree.main_node_id, ezcontentobject_tree.modified_subnode, ezcontentobject_tree.node_id, ezcontentobject_tree.parent_node_id, " . "ezcontentobject_tree.path_identification_string, ezcontentobject_tree.path_string, ezcontentobject_tree.priority, ezcontentobject_tree.remote_id, ezcontentobject_tree.sort_field, " . "ezcontentobject_tree.sort_order, ezcontentclass.serialized_name_list as class_serialized_name_list, ezcontentclass.identifier as class_identifier, ezcontentclass.is_container " . "FROM ezcontentobject_tree " . "INNER JOIN ezcontentobject ON (ezcontentobject.id = ezcontentobject_tree.contentobject_id) " . "INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) " . "WHERE " . $db->generateSQLINStatement( $objectIDArray, 'ezcontentobject_tree.contentobject_id', false, false, 'int' ) . " AND " . "ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id AND " . "ezcontentclass.version = 0" ); if ( $asObject ) { return eZContentObjectTreeNode::makeObjectsArray( $nodeListArray ); } return $nodeListArray; }
[ "static", "function", "findMainNodeArray", "(", "$", "objectIDArray", ",", "$", "asObject", "=", "true", ")", "{", "if", "(", "empty", "(", "$", "objectIDArray", ")", ")", "return", "null", ";", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", ...
Fetches the main nodes for an array of object id's @param array(int) $objectIDArray an array of object IDs @param bool $asObject Wether to return the result as an array of eZContentObjectTreeNode (true) or as an array of associative arrays (false) @return array(array|eZContentObjectTreeNode)
[ "Fetches", "the", "main", "nodes", "for", "an", "array", "of", "object", "id", "s" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L2998-L3026
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.subtreeSoleNodeCount
function subtreeSoleNodeCount( $params = array() ) { $nodeID = $this->attribute( 'node_id' ); $node = $this; $depth = false; if ( isset( $params['Depth'] ) && is_numeric( $params['Depth'] ) ) { $depth = $params['Depth']; } $fromNode = $nodeID; $nodePath = null; $nodeDepth = 0; if ( count( $node ) != 0 ) { $nodePath = $node->attribute( 'path_string' ); $nodeDepth = $node->attribute( 'depth' ); } $childPath = $nodePath; $db = eZDB::instance(); $pathString = " ezcot.path_string like '$childPath%' and "; $notEqParentString = "ezcot.node_id != $fromNode"; $depthCond = ''; if ( $depth ) { $nodeDepth += $depth; if ( isset( $params[ 'DepthOperator' ] ) && $params[ 'DepthOperator' ] == 'eq' ) { $depthCond = ' ezcot.depth = ' . $nodeDepth . ''; $notEqParentString = ''; } else $depthCond = ' ezcot.depth <= ' . $nodeDepth . ' and '; } $tmpTableName = $db->generateUniqueTempTableName( 'eznode_count_%' ); $db->createTempTable( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" ); $query = "INSERT INTO $tmpTableName SELECT count( ezcot.main_node_id ) AS count FROM ezcontentobject_tree ezcot, ezcontentobject_tree ezcot_all WHERE $pathString $depthCond $notEqParentString and ezcot.contentobject_id = ezcot_all.contentobject_id GROUP BY ezcot_all.main_node_id HAVING count( ezcot.main_node_id ) <= 1"; $db->query( $query, eZDBInterface::SERVER_SLAVE ); $query = "SELECT count( * ) AS count FROM $tmpTableName"; $rows = $db->arrayQuery( $query, array(), eZDBInterface::SERVER_SLAVE ); $db->dropTempTable( "DROP TABLE $tmpTableName" ); return $rows[0]['count']; }
php
function subtreeSoleNodeCount( $params = array() ) { $nodeID = $this->attribute( 'node_id' ); $node = $this; $depth = false; if ( isset( $params['Depth'] ) && is_numeric( $params['Depth'] ) ) { $depth = $params['Depth']; } $fromNode = $nodeID; $nodePath = null; $nodeDepth = 0; if ( count( $node ) != 0 ) { $nodePath = $node->attribute( 'path_string' ); $nodeDepth = $node->attribute( 'depth' ); } $childPath = $nodePath; $db = eZDB::instance(); $pathString = " ezcot.path_string like '$childPath%' and "; $notEqParentString = "ezcot.node_id != $fromNode"; $depthCond = ''; if ( $depth ) { $nodeDepth += $depth; if ( isset( $params[ 'DepthOperator' ] ) && $params[ 'DepthOperator' ] == 'eq' ) { $depthCond = ' ezcot.depth = ' . $nodeDepth . ''; $notEqParentString = ''; } else $depthCond = ' ezcot.depth <= ' . $nodeDepth . ' and '; } $tmpTableName = $db->generateUniqueTempTableName( 'eznode_count_%' ); $db->createTempTable( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" ); $query = "INSERT INTO $tmpTableName SELECT count( ezcot.main_node_id ) AS count FROM ezcontentobject_tree ezcot, ezcontentobject_tree ezcot_all WHERE $pathString $depthCond $notEqParentString and ezcot.contentobject_id = ezcot_all.contentobject_id GROUP BY ezcot_all.main_node_id HAVING count( ezcot.main_node_id ) <= 1"; $db->query( $query, eZDBInterface::SERVER_SLAVE ); $query = "SELECT count( * ) AS count FROM $tmpTableName"; $rows = $db->arrayQuery( $query, array(), eZDBInterface::SERVER_SLAVE ); $db->dropTempTable( "DROP TABLE $tmpTableName" ); return $rows[0]['count']; }
[ "function", "subtreeSoleNodeCount", "(", "$", "params", "=", "array", "(", ")", ")", "{", "$", "nodeID", "=", "$", "this", "->", "attribute", "(", "'node_id'", ")", ";", "$", "node", "=", "$", "this", ";", "$", "depth", "=", "false", ";", "if", "("...
Returns the number of nodes in the current subtree that have no other placements. @param array $params @return int
[ "Returns", "the", "number", "of", "nodes", "in", "the", "current", "subtree", "that", "have", "no", "other", "placements", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L4146-L4211
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.hasCurrentSubtreeLimitation
protected function hasCurrentSubtreeLimitation( array $policy ) { // No Subtree nor Node limitation, so we consider that it is potentially OK to create content under current subtree if ( !isset( $policy['Subtree'] ) && !isset( $policy['Node'] ) ) { return true; } // First check subtree limitations if ( isset( $policy['Subtree'] ) ) { foreach ( $policy['Subtree'] as $subtreeString ) { if ( strpos( $this->attribute( 'path_string' ), $subtreeString ) !== false ) { return true; } } } // Then check node limitations if ( isset( $policy['Node'] ) ) { foreach ( $policy['Node'] as $subtreeString ) { if ( strpos( $this->attribute( 'path_string' ), $subtreeString ) !== false ) { return true; } } } return false; }
php
protected function hasCurrentSubtreeLimitation( array $policy ) { // No Subtree nor Node limitation, so we consider that it is potentially OK to create content under current subtree if ( !isset( $policy['Subtree'] ) && !isset( $policy['Node'] ) ) { return true; } // First check subtree limitations if ( isset( $policy['Subtree'] ) ) { foreach ( $policy['Subtree'] as $subtreeString ) { if ( strpos( $this->attribute( 'path_string' ), $subtreeString ) !== false ) { return true; } } } // Then check node limitations if ( isset( $policy['Node'] ) ) { foreach ( $policy['Node'] as $subtreeString ) { if ( strpos( $this->attribute( 'path_string' ), $subtreeString ) !== false ) { return true; } } } return false; }
[ "protected", "function", "hasCurrentSubtreeLimitation", "(", "array", "$", "policy", ")", "{", "// No Subtree nor Node limitation, so we consider that it is potentially OK to create content under current subtree", "if", "(", "!", "isset", "(", "$", "policy", "[", "'Subtree'", "...
Checks if provided policy array has a limitation on current subtree @param array $policy @return bool
[ "Checks", "if", "provided", "policy", "array", "has", "a", "limitation", "on", "current", "subtree" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5007-L5040
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.getParentNodeIdListByContentObjectID
static function getParentNodeIdListByContentObjectID( $objectIDs, $groupByObjectId = false, $onlyMainNode = false ) { if ( !$objectIDs ) return null; if ( !is_array( $objectIDs ) ) $objectIDs = array( $objectIDs ); $db = eZDB::instance(); $query = 'SELECT parent_node_id, contentobject_id FROM ezcontentobject_tree WHERE ' . $db->generateSQLINStatement( $objectIDs, 'contentobject_id', false, false, 'int' ); if ( $onlyMainNode ) { $query .= ' AND node_id = main_node_id'; } $list = $db->arrayQuery( $query ); $parentNodeIDs = array(); if ( $groupByObjectId ) { foreach( $list as $item ) { $objectID = $item['contentobject_id']; if ( !isset( $parentNodeIDs[$objectID] ) ) { $parentNodeIDs[$objectID] = array(); } $parentNodeIDs[$objectID][] = $item['parent_node_id']; } } else { foreach( $list as $item ) { $parentNodeIDs[] = $item['parent_node_id']; } } return $parentNodeIDs; }
php
static function getParentNodeIdListByContentObjectID( $objectIDs, $groupByObjectId = false, $onlyMainNode = false ) { if ( !$objectIDs ) return null; if ( !is_array( $objectIDs ) ) $objectIDs = array( $objectIDs ); $db = eZDB::instance(); $query = 'SELECT parent_node_id, contentobject_id FROM ezcontentobject_tree WHERE ' . $db->generateSQLINStatement( $objectIDs, 'contentobject_id', false, false, 'int' ); if ( $onlyMainNode ) { $query .= ' AND node_id = main_node_id'; } $list = $db->arrayQuery( $query ); $parentNodeIDs = array(); if ( $groupByObjectId ) { foreach( $list as $item ) { $objectID = $item['contentobject_id']; if ( !isset( $parentNodeIDs[$objectID] ) ) { $parentNodeIDs[$objectID] = array(); } $parentNodeIDs[$objectID][] = $item['parent_node_id']; } } else { foreach( $list as $item ) { $parentNodeIDs[] = $item['parent_node_id']; } } return $parentNodeIDs; }
[ "static", "function", "getParentNodeIdListByContentObjectID", "(", "$", "objectIDs", ",", "$", "groupByObjectId", "=", "false", ",", "$", "onlyMainNode", "=", "false", ")", "{", "if", "(", "!", "$", "objectIDs", ")", "return", "null", ";", "if", "(", "!", ...
Get parent node id's by content object id's. @static @since Version 4.1 @param int|array $objectIDs @param bool $groupByObjectId groups parent node ids by object id they belong to. @param bool $onlyMainNode limits result to parent node id of main node. @return array Returns array of parent node id's
[ "Get", "parent", "node", "id", "s", "by", "content", "object", "id", "s", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5346-L5387
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.object
function object() { if ( $this->hasContentObject() ) { return $this->ContentObject; } $contentobject_id = $this->attribute( 'contentobject_id' ); $obj = eZContentObject::fetch( $contentobject_id ); if ( $this->CurrentLanguage ) { $obj->setCurrentLanguage( $this->CurrentLanguage ); } $this->ContentObject = $obj; return $obj; }
php
function object() { if ( $this->hasContentObject() ) { return $this->ContentObject; } $contentobject_id = $this->attribute( 'contentobject_id' ); $obj = eZContentObject::fetch( $contentobject_id ); if ( $this->CurrentLanguage ) { $obj->setCurrentLanguage( $this->CurrentLanguage ); } $this->ContentObject = $obj; return $obj; }
[ "function", "object", "(", ")", "{", "if", "(", "$", "this", "->", "hasContentObject", "(", ")", ")", "{", "return", "$", "this", "->", "ContentObject", ";", "}", "$", "contentobject_id", "=", "$", "this", "->", "attribute", "(", "'contentobject_id'", ")...
Returns the eZContentObject associated to this node @return eZContentObject
[ "Returns", "the", "eZContentObject", "associated", "to", "this", "node" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5730-L5744
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.creator
function creator() { $db = eZDB::instance(); $query = "SELECT creator_id FROM ezcontentobject_version WHERE contentobject_id = '$this->ContentObjectID' AND version = '$this->ContentObjectVersion' "; $creatorArray = $db->arrayQuery( $query ); return eZContentObject::fetch( $creatorArray[0]['creator_id'] ); }
php
function creator() { $db = eZDB::instance(); $query = "SELECT creator_id FROM ezcontentobject_version WHERE contentobject_id = '$this->ContentObjectID' AND version = '$this->ContentObjectVersion' "; $creatorArray = $db->arrayQuery( $query ); return eZContentObject::fetch( $creatorArray[0]['creator_id'] ); }
[ "function", "creator", "(", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "query", "=", "\"SELECT creator_id\n FROM ezcontentobject_version\n WHERE\n contentobject_id = '$this->ContentObjectID' AND\n...
Returns the creator of the version published in the node. @return eZContentObject
[ "Returns", "the", "creator", "of", "the", "version", "published", "in", "the", "node", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5774-L5785
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.contentObjectVersionObject
function contentObjectVersionObject( $asObject = true ) { $version = eZContentObjectVersion::fetchVersion( $this->ContentObjectVersion, $this->ContentObjectID, $asObject ); if ( $this->CurrentLanguage != false ) { $version->CurrentLanguage = $this->CurrentLanguage; } return $version; }
php
function contentObjectVersionObject( $asObject = true ) { $version = eZContentObjectVersion::fetchVersion( $this->ContentObjectVersion, $this->ContentObjectID, $asObject ); if ( $this->CurrentLanguage != false ) { $version->CurrentLanguage = $this->CurrentLanguage; } return $version; }
[ "function", "contentObjectVersionObject", "(", "$", "asObject", "=", "true", ")", "{", "$", "version", "=", "eZContentObjectVersion", "::", "fetchVersion", "(", "$", "this", "->", "ContentObjectVersion", ",", "$", "this", "->", "ContentObjectID", ",", "$", "asOb...
Returns the eZContentObjectVersionObject of the current node @param bool $asObject @return eZContentObjectVersion|array|bool
[ "Returns", "the", "eZContentObjectVersionObject", "of", "the", "current", "node" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5793-L5801
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.urlAlias
function urlAlias() { $useURLAlias =& $GLOBALS['eZContentObjectTreeNodeUseURLAlias']; $ini = eZINI::instance(); $cleanURL = ''; if ( !isset( $useURLAlias ) ) { $useURLAlias = $ini->variable( 'URLTranslator', 'Translation' ) == 'enabled'; } if ( $useURLAlias ) { $path = $this->pathWithNames(); if ( $ini->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) && $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) != '' ) { $prepend = $ini->variable( 'SiteAccessSettings', 'PathPrefix' ); $pathIdenStr = substr( $prepend, strlen( $prepend ) -1 ) == '/' ? $path . '/' : $path; if ( strncasecmp( $pathIdenStr, $prepend, strlen( $prepend ) ) == 0 ) $cleanURL = eZURLAliasML::cleanURL( substr( $path, strlen( $prepend ) ) ); else $cleanURL = eZURLAliasML::cleanURL( $path ); } else { $cleanURL = eZURLAliasML::cleanURL( $path ); } } else { $cleanURL = eZURLAliasML::cleanURL( 'content/view/full/' . $this->NodeID ); } return $cleanURL; }
php
function urlAlias() { $useURLAlias =& $GLOBALS['eZContentObjectTreeNodeUseURLAlias']; $ini = eZINI::instance(); $cleanURL = ''; if ( !isset( $useURLAlias ) ) { $useURLAlias = $ini->variable( 'URLTranslator', 'Translation' ) == 'enabled'; } if ( $useURLAlias ) { $path = $this->pathWithNames(); if ( $ini->hasVariable( 'SiteAccessSettings', 'PathPrefix' ) && $ini->variable( 'SiteAccessSettings', 'PathPrefix' ) != '' ) { $prepend = $ini->variable( 'SiteAccessSettings', 'PathPrefix' ); $pathIdenStr = substr( $prepend, strlen( $prepend ) -1 ) == '/' ? $path . '/' : $path; if ( strncasecmp( $pathIdenStr, $prepend, strlen( $prepend ) ) == 0 ) $cleanURL = eZURLAliasML::cleanURL( substr( $path, strlen( $prepend ) ) ); else $cleanURL = eZURLAliasML::cleanURL( $path ); } else { $cleanURL = eZURLAliasML::cleanURL( $path ); } } else { $cleanURL = eZURLAliasML::cleanURL( 'content/view/full/' . $this->NodeID ); } return $cleanURL; }
[ "function", "urlAlias", "(", ")", "{", "$", "useURLAlias", "=", "&", "$", "GLOBALS", "[", "'eZContentObjectTreeNodeUseURLAlias'", "]", ";", "$", "ini", "=", "eZINI", "::", "instance", "(", ")", ";", "$", "cleanURL", "=", "''", ";", "if", "(", "!", "iss...
Returns the node's url alias @return string
[ "Returns", "the", "node", "s", "url", "alias" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5808-L5843
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.classIdentifier
public function classIdentifier() { if ( $this->ClassIdentifier === null ) { $object = $this->object(); $this->ClassIdentifier = $object->contentClassIdentifier(); } return $this->ClassIdentifier; }
php
public function classIdentifier() { if ( $this->ClassIdentifier === null ) { $object = $this->object(); $this->ClassIdentifier = $object->contentClassIdentifier(); } return $this->ClassIdentifier; }
[ "public", "function", "classIdentifier", "(", ")", "{", "if", "(", "$", "this", "->", "ClassIdentifier", "===", "null", ")", "{", "$", "object", "=", "$", "this", "->", "object", "(", ")", ";", "$", "this", "->", "ClassIdentifier", "=", "$", "object", ...
Returns the node's class identifier @return string|bool|string|null
[ "Returns", "the", "node", "s", "class", "identifier" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5865-L5874
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.className
public function className() { if ( $this->ClassName === null ) { $object = $this->object(); $class = $object->contentClass(); $this->ClassName = $class->attribute( 'name' ); } return $this->ClassName; }
php
public function className() { if ( $this->ClassName === null ) { $object = $this->object(); $class = $object->contentClass(); $this->ClassName = $class->attribute( 'name' ); } return $this->ClassName; }
[ "public", "function", "className", "(", ")", "{", "if", "(", "$", "this", "->", "ClassName", "===", "null", ")", "{", "$", "object", "=", "$", "this", "->", "object", "(", ")", ";", "$", "class", "=", "$", "object", "->", "contentClass", "(", ")", ...
Returns the node's class name @return string|null
[ "Returns", "the", "node", "s", "class", "name" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5881-L5891
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.classIsContainer
public function classIsContainer() { if ( $this->ClassIsContainer === null ) { $object = $this->object(); $class = $object->contentClass(); $this->ClassIsContainer = $class->attribute( 'is_container' ); } return $this->ClassIsContainer; }
php
public function classIsContainer() { if ( $this->ClassIsContainer === null ) { $object = $this->object(); $class = $object->contentClass(); $this->ClassIsContainer = $class->attribute( 'is_container' ); } return $this->ClassIsContainer; }
[ "public", "function", "classIsContainer", "(", ")", "{", "if", "(", "$", "this", "->", "ClassIsContainer", "===", "null", ")", "{", "$", "object", "=", "$", "this", "->", "object", "(", ")", ";", "$", "class", "=", "$", "object", "->", "contentClass", ...
Returns 1 if the node's class is a container class, 0 otherwise @return int|null
[ "Returns", "1", "if", "the", "node", "s", "class", "is", "a", "container", "class", "0", "otherwise" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5898-L5907
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.hiddenStatusString
function hiddenStatusString() { if( $this->IsHidden ) { return ezpI18n::tr( 'kernel/content', 'Hidden' ); } else if( $this->IsInvisible ) { return ezpI18n::tr( 'kernel/content', 'Hidden by superior' ); } return ezpI18n::tr( 'kernel/content', 'Visible' ); }
php
function hiddenStatusString() { if( $this->IsHidden ) { return ezpI18n::tr( 'kernel/content', 'Hidden' ); } else if( $this->IsInvisible ) { return ezpI18n::tr( 'kernel/content', 'Hidden by superior' ); } return ezpI18n::tr( 'kernel/content', 'Visible' ); }
[ "function", "hiddenStatusString", "(", ")", "{", "if", "(", "$", "this", "->", "IsHidden", ")", "{", "return", "ezpI18n", "::", "tr", "(", "'kernel/content'", ",", "'Hidden'", ")", ";", "}", "else", "if", "(", "$", "this", "->", "IsInvisible", ")", "{"...
Returns combined string representation of both "is_hidden" and "is_invisible" attributes Used in the limitation handling templates. @return string
[ "Returns", "combined", "string", "representation", "of", "both", "is_hidden", "and", "is_invisible", "attributes", "Used", "in", "the", "limitation", "handling", "templates", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5926-L5937
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.hideSubTree
static function hideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true ) { $nodeID = $node->attribute( 'node_id' ); $time = time(); $db = eZDB::instance(); if ( eZAudit::isAuditEnabled() ) { // Set audit params. $objectID = $node->attribute( 'contentobject_id' ); $objectName = $node->attribute( 'name' ); eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Time' => $time, 'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) ); } $db->begin(); if ( !$node->attribute( 'is_invisible' ) ) // if root node is visible { // 1) Mark root node as hidden and invisible. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" ); // 2) Recursively mark child nodes as invisible, except for ones which have been previously marked as invisible. $nodePath = $node->attribute( 'path_string' ); $db->query( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" ); } else { // Mark root node as hidden if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" ); } $node->updateAndStoreModified(); $db->commit(); eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode ); }
php
static function hideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true ) { $nodeID = $node->attribute( 'node_id' ); $time = time(); $db = eZDB::instance(); if ( eZAudit::isAuditEnabled() ) { // Set audit params. $objectID = $node->attribute( 'contentobject_id' ); $objectName = $node->attribute( 'name' ); eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Time' => $time, 'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) ); } $db->begin(); if ( !$node->attribute( 'is_invisible' ) ) // if root node is visible { // 1) Mark root node as hidden and invisible. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" ); // 2) Recursively mark child nodes as invisible, except for ones which have been previously marked as invisible. $nodePath = $node->attribute( 'path_string' ); $db->query( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" ); } else { // Mark root node as hidden if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" ); } $node->updateAndStoreModified(); $db->commit(); eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode ); }
[ "static", "function", "hideSubTree", "(", "eZContentObjectTreeNode", "$", "node", ",", "$", "modifyRootNode", "=", "true", ")", "{", "$", "nodeID", "=", "$", "node", "->", "attribute", "(", "'node_id'", ")", ";", "$", "time", "=", "time", "(", ")", ";", ...
Hide a subtree Hide algorithm: if ( root node of the subtree is visible ) { 1) Mark root node as hidden and invisible 2) Recursively mark child nodes as invisible except for ones which have been previously marked as invisible } else { Mark root node as hidden } In some cases we don't want to touch the root node when (un)hiding a subtree, for example after content/move or content/copy. That's why $modifyRootNode argument is used. 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. @param eZContentObjectTreeNode $node Root node of the subtree @param bool $modifyRootNode Whether to modify the root node (true/false)
[ "Hide", "a", "subtree" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L5963-L6005
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.unhideSubTree
static function unhideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true ) { $nodeID = $node->attribute( 'node_id' ); $nodePath = $node->attribute( 'path_string' ); $nodeInvisible = $node->attribute( 'is_invisible' ); $parentNode = $node->attribute( 'parent' ); if ( !$parentNode instanceof eZContentObjectTreeNode ) { eZDebug::writeError( "Parent of Node #$nodeID doesn't exist or inaccesible.", __METHOD__ ); return; } $time = time(); if ( eZAudit::isAuditEnabled() ) { // Set audit params. $objectID = $node->attribute( 'contentobject_id' ); $objectName = $node->attribute( 'name' ); eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Time' => $time, 'Comment' => 'Node has been unhidden: eZContentObjectTreeNode::unhideSubTree()' ) ); } $db = eZDB::instance(); $db->begin(); if ( ! $parentNode->attribute( 'is_invisible' ) ) // if parent node is visible { // 1) Mark root node as not hidden and visible. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_invisible=0, is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ); // 2) Recursively mark child nodes as visible (except for nodes previosly marked as hidden, and all their children). // 2.1) $hiddenChildren = Fetch all hidden children for the root node $hiddenChildren = $db->arrayQuery( "SELECT path_string FROM ezcontentobject_tree " . "WHERE node_id <> $nodeID AND is_hidden=1 AND path_string LIKE '$nodePath%'" ); $skipSubtreesString = ''; foreach ( $hiddenChildren as $i ) $skipSubtreesString .= " AND path_string NOT LIKE '" . $i['path_string'] . "%'"; // 2.2) Mark those children as visible which are not under nodes in $hiddenChildren $db->query( "UPDATE ezcontentobject_tree SET is_invisible=0, modified_subnode=$time WHERE path_string LIKE '$nodePath%' $skipSubtreesString" ); } else { // Mark root node as not hidden. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ); } $node->updateAndStoreModified(); $db->commit(); eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode ); }
php
static function unhideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true ) { $nodeID = $node->attribute( 'node_id' ); $nodePath = $node->attribute( 'path_string' ); $nodeInvisible = $node->attribute( 'is_invisible' ); $parentNode = $node->attribute( 'parent' ); if ( !$parentNode instanceof eZContentObjectTreeNode ) { eZDebug::writeError( "Parent of Node #$nodeID doesn't exist or inaccesible.", __METHOD__ ); return; } $time = time(); if ( eZAudit::isAuditEnabled() ) { // Set audit params. $objectID = $node->attribute( 'contentobject_id' ); $objectName = $node->attribute( 'name' ); eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID, 'Object ID' => $objectID, 'Content Name' => $objectName, 'Time' => $time, 'Comment' => 'Node has been unhidden: eZContentObjectTreeNode::unhideSubTree()' ) ); } $db = eZDB::instance(); $db->begin(); if ( ! $parentNode->attribute( 'is_invisible' ) ) // if parent node is visible { // 1) Mark root node as not hidden and visible. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_invisible=0, is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ); // 2) Recursively mark child nodes as visible (except for nodes previosly marked as hidden, and all their children). // 2.1) $hiddenChildren = Fetch all hidden children for the root node $hiddenChildren = $db->arrayQuery( "SELECT path_string FROM ezcontentobject_tree " . "WHERE node_id <> $nodeID AND is_hidden=1 AND path_string LIKE '$nodePath%'" ); $skipSubtreesString = ''; foreach ( $hiddenChildren as $i ) $skipSubtreesString .= " AND path_string NOT LIKE '" . $i['path_string'] . "%'"; // 2.2) Mark those children as visible which are not under nodes in $hiddenChildren $db->query( "UPDATE ezcontentobject_tree SET is_invisible=0, modified_subnode=$time WHERE path_string LIKE '$nodePath%' $skipSubtreesString" ); } else { // Mark root node as not hidden. if ( $modifyRootNode ) $db->query( "UPDATE ezcontentobject_tree SET is_hidden=0, modified_subnode=$time WHERE node_id=$nodeID" ); } $node->updateAndStoreModified(); $db->commit(); eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode ); }
[ "static", "function", "unhideSubTree", "(", "eZContentObjectTreeNode", "$", "node", ",", "$", "modifyRootNode", "=", "true", ")", "{", "$", "nodeID", "=", "$", "node", "->", "attribute", "(", "'node_id'", ")", ";", "$", "nodePath", "=", "$", "node", "->", ...
Unhide a subtree Unhide algorithm: if ( parent node is visible ) { 1) Mark root node as not hidden and visible. 2) Recursively mark child nodes as visible (except for nodes previosly marked as hidden, and all their children). } else { Mark root node as not hidden. } 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. @param eZContentObjectTreeNode $node Root node of the subtree @param bool $modifyRootNode Whether to modify the root node (true/false)
[ "Unhide", "a", "subtree" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L6027-L6088
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.clearViewCacheForSubtree
static function clearViewCacheForSubtree( eZContentObjectTreeNode $node, $clearForRootNode = true ) { // Max nodes to fetch at a time static $limit = 200; if ( $clearForRootNode ) { $objectID = $node->attribute( 'contentobject_id' ); eZContentCacheManager::clearContentCacheIfNeeded( $objectID ); } $offset = 0; $params = array( 'AsObject' => false, 'Depth' => false, 'Limitation' => array() ); // Empty array means no permission checking $subtreeCount = $node->subTreeCount( $params ); while ( $offset < $subtreeCount ) { $params['Offset'] = $offset; $params['Limit'] = $limit; $subtreeChunk = $node->subTree( $params ); $nNodesInChunk = count( $subtreeChunk ); $offset += $nNodesInChunk; if ( $nNodesInChunk == 0 ) break; $objectIDList = array(); foreach ( $subtreeChunk as $curNode ) $objectIDList[] = $curNode['id']; unset( $subtreeChunk ); eZContentCacheManager::clearContentCacheIfNeeded( array_unique( $objectIDList ) ); } return true; }
php
static function clearViewCacheForSubtree( eZContentObjectTreeNode $node, $clearForRootNode = true ) { // Max nodes to fetch at a time static $limit = 200; if ( $clearForRootNode ) { $objectID = $node->attribute( 'contentobject_id' ); eZContentCacheManager::clearContentCacheIfNeeded( $objectID ); } $offset = 0; $params = array( 'AsObject' => false, 'Depth' => false, 'Limitation' => array() ); // Empty array means no permission checking $subtreeCount = $node->subTreeCount( $params ); while ( $offset < $subtreeCount ) { $params['Offset'] = $offset; $params['Limit'] = $limit; $subtreeChunk = $node->subTree( $params ); $nNodesInChunk = count( $subtreeChunk ); $offset += $nNodesInChunk; if ( $nNodesInChunk == 0 ) break; $objectIDList = array(); foreach ( $subtreeChunk as $curNode ) $objectIDList[] = $curNode['id']; unset( $subtreeChunk ); eZContentCacheManager::clearContentCacheIfNeeded( array_unique( $objectIDList ) ); } return true; }
[ "static", "function", "clearViewCacheForSubtree", "(", "eZContentObjectTreeNode", "$", "node", ",", "$", "clearForRootNode", "=", "true", ")", "{", "// Max nodes to fetch at a time", "static", "$", "limit", "=", "200", ";", "if", "(", "$", "clearForRootNode", ")", ...
Clears the view cache for a subtree @param eZContentObjectTreeNode $node @param bool $clearForRootNode @return bool
[ "Clears", "the", "view", "cache", "for", "a", "subtree" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L6140-L6176
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.availableClassListJsArray
static function availableClassListJsArray( $parameters = false ) { $iniMenu = eZINI::instance( 'contentstructuremenu.ini' ); $falseValue = "''"; if ( $iniMenu->hasVariable( 'TreeMenu', 'CreateHereMenu' ) ) { $createHereMenu = $iniMenu->variable( 'TreeMenu', 'CreateHereMenu' ); } else { $createHereMenu = 'simplified'; } if ( $createHereMenu != 'simplified' and $createHereMenu != 'full' ) return $falseValue; $ini = eZINI::instance( 'content.ini' ); list( $usersClassGroupID, $setupClassGroupID ) = $ini->variableMulti( 'ClassGroupIDs', array( 'Users', 'Setup' ) ); $userRootNode = $ini->variable( 'NodeSettings', 'UserRootNode' ); $groupIDs = false; $filterType = 'include'; if ( !is_array( $parameters ) ) return $falseValue; $node = isset( $parameters['node'] ) ? $parameters['node'] : false; if ( is_object( $node ) ) { if ( $createHereMenu == 'full' and !$node->canCreate() ) return $falseValue; $obj = $node->object(); $contentClass = $obj->attribute( 'content_class' ); if ( !$contentClass->attribute( 'is_container' ) ) { return $falseValue; } $pathArray = $node->pathArray(); } else { // If current object is not container we should not return class list, should not display "create here" menu. if ( isset( $parameters['is_container'] ) and !$parameters['is_container'] ) return $falseValue; // Check if current user can create under this node if ( $createHereMenu == 'full' and isset( $parameters['node_id'] ) ) { $node = eZContentObjectTreeNode::fetch( $parameters['node_id'] ); if ( is_object( $node ) and !$node->canCreate() ) return $falseValue; } $pathString = isset( $parameters['path_string'] ) ? $parameters['path_string'] : false; if ( !$pathString ) return $falseValue; $pathItems = explode( '/', $pathString ); $pathArray = array(); foreach ( $pathItems as $pathItem ) { if ( $pathItem != '' ) $pathArray[] = (int) $pathItem; } } if ( in_array( $userRootNode, $pathArray ) ) { $groupIDs = array( $usersClassGroupID ); } else { $groupIDs = array( $usersClassGroupID, $setupClassGroupID ); $filterType = 'exclude'; } if ( $createHereMenu == 'simplified' ) { $classes = eZContentClass::fetchAllClasses( false, $filterType == 'include', $groupIDs ); return eZContentObjectTreeNode::getClassesJsArray( false, $filterType == 'include', $groupIDs, false, $classes ); } return eZContentObjectTreeNode::getClassesJsArray( $node, $filterType == 'include', $groupIDs ); }
php
static function availableClassListJsArray( $parameters = false ) { $iniMenu = eZINI::instance( 'contentstructuremenu.ini' ); $falseValue = "''"; if ( $iniMenu->hasVariable( 'TreeMenu', 'CreateHereMenu' ) ) { $createHereMenu = $iniMenu->variable( 'TreeMenu', 'CreateHereMenu' ); } else { $createHereMenu = 'simplified'; } if ( $createHereMenu != 'simplified' and $createHereMenu != 'full' ) return $falseValue; $ini = eZINI::instance( 'content.ini' ); list( $usersClassGroupID, $setupClassGroupID ) = $ini->variableMulti( 'ClassGroupIDs', array( 'Users', 'Setup' ) ); $userRootNode = $ini->variable( 'NodeSettings', 'UserRootNode' ); $groupIDs = false; $filterType = 'include'; if ( !is_array( $parameters ) ) return $falseValue; $node = isset( $parameters['node'] ) ? $parameters['node'] : false; if ( is_object( $node ) ) { if ( $createHereMenu == 'full' and !$node->canCreate() ) return $falseValue; $obj = $node->object(); $contentClass = $obj->attribute( 'content_class' ); if ( !$contentClass->attribute( 'is_container' ) ) { return $falseValue; } $pathArray = $node->pathArray(); } else { // If current object is not container we should not return class list, should not display "create here" menu. if ( isset( $parameters['is_container'] ) and !$parameters['is_container'] ) return $falseValue; // Check if current user can create under this node if ( $createHereMenu == 'full' and isset( $parameters['node_id'] ) ) { $node = eZContentObjectTreeNode::fetch( $parameters['node_id'] ); if ( is_object( $node ) and !$node->canCreate() ) return $falseValue; } $pathString = isset( $parameters['path_string'] ) ? $parameters['path_string'] : false; if ( !$pathString ) return $falseValue; $pathItems = explode( '/', $pathString ); $pathArray = array(); foreach ( $pathItems as $pathItem ) { if ( $pathItem != '' ) $pathArray[] = (int) $pathItem; } } if ( in_array( $userRootNode, $pathArray ) ) { $groupIDs = array( $usersClassGroupID ); } else { $groupIDs = array( $usersClassGroupID, $setupClassGroupID ); $filterType = 'exclude'; } if ( $createHereMenu == 'simplified' ) { $classes = eZContentClass::fetchAllClasses( false, $filterType == 'include', $groupIDs ); return eZContentObjectTreeNode::getClassesJsArray( false, $filterType == 'include', $groupIDs, false, $classes ); } return eZContentObjectTreeNode::getClassesJsArray( $node, $filterType == 'include', $groupIDs ); }
[ "static", "function", "availableClassListJsArray", "(", "$", "parameters", "=", "false", ")", "{", "$", "iniMenu", "=", "eZINI", "::", "instance", "(", "'contentstructuremenu.ini'", ")", ";", "$", "falseValue", "=", "\"''\"", ";", "if", "(", "$", "iniMenu", ...
Returns available classes as Js array. Checks for ini settings. @param array|bool $parameters @return string
[ "Returns", "available", "classes", "as", "Js", "array", ".", "Checks", "for", "ini", "settings", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L6252-L6336
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.isNodeTrashAllowed
public function isNodeTrashAllowed() { $userClassIDArray = eZUser::contentClassIDs(); $class = $this->attribute( 'object' )->attribute( 'content_class' ); // If current object has ezuser attributes, it can't be sent to trash if ( in_array( $class->attribute( 'id' ), $userClassIDArray ) ) { return false; } // Checking for children using classes with ezuser attribute. Using == because subTreecount returns strings return $this->subTreeCount( array( 'Limitation' => array(), 'SortBy' => array( 'path' , false ), 'IgnoreVisibility' => true, 'ClassFilterType' => 'include', 'ClassFilterArray' => $userClassIDArray, 'AsObject' => false ) ) == 0 ; }
php
public function isNodeTrashAllowed() { $userClassIDArray = eZUser::contentClassIDs(); $class = $this->attribute( 'object' )->attribute( 'content_class' ); // If current object has ezuser attributes, it can't be sent to trash if ( in_array( $class->attribute( 'id' ), $userClassIDArray ) ) { return false; } // Checking for children using classes with ezuser attribute. Using == because subTreecount returns strings return $this->subTreeCount( array( 'Limitation' => array(), 'SortBy' => array( 'path' , false ), 'IgnoreVisibility' => true, 'ClassFilterType' => 'include', 'ClassFilterArray' => $userClassIDArray, 'AsObject' => false ) ) == 0 ; }
[ "public", "function", "isNodeTrashAllowed", "(", ")", "{", "$", "userClassIDArray", "=", "eZUser", "::", "contentClassIDs", "(", ")", ";", "$", "class", "=", "$", "this", "->", "attribute", "(", "'object'", ")", "->", "attribute", "(", "'content_class'", ")"...
Figure out if a node can be sent to trash or if it should be directly deleted as objects containing ezuser attributes can not be sent to trash. @return bool true if it can go to trash, false if it should be deleted
[ "Figure", "out", "if", "a", "node", "can", "be", "sent", "to", "trash", "or", "if", "it", "should", "be", "directly", "deleted", "as", "objects", "containing", "ezuser", "attributes", "can", "not", "be", "sent", "to", "trash", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L6395-L6418
train
ezsystems/ezpublish-legacy
kernel/classes/ezcontentobjecttreenode.php
eZContentObjectTreeNode.getObjectIdsInNodeSubTree
static function getObjectIdsInNodeSubTree($node) { $db = eZDB::instance(); $nodePath = $node->attribute( 'path_string' ); $pathString = " path_string like '$nodePath%' AND "; $objectIDArray = $db->arrayQuery( "SELECT ezcontentobject.id FROM ezcontentobject_tree, ezcontentobject WHERE $pathString ezcontentobject_tree.contentobject_id=ezcontentobject.id AND ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id" ); if ( count( $objectIDArray ) == 0 ) return null; $objectSimpleIDArray = array(); foreach ( $objectIDArray as $objectID ) { $objectSimpleIDArray[] = $objectID['id']; } return $objectSimpleIDArray; }
php
static function getObjectIdsInNodeSubTree($node) { $db = eZDB::instance(); $nodePath = $node->attribute( 'path_string' ); $pathString = " path_string like '$nodePath%' AND "; $objectIDArray = $db->arrayQuery( "SELECT ezcontentobject.id FROM ezcontentobject_tree, ezcontentobject WHERE $pathString ezcontentobject_tree.contentobject_id=ezcontentobject.id AND ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id" ); if ( count( $objectIDArray ) == 0 ) return null; $objectSimpleIDArray = array(); foreach ( $objectIDArray as $objectID ) { $objectSimpleIDArray[] = $objectID['id']; } return $objectSimpleIDArray; }
[ "static", "function", "getObjectIdsInNodeSubTree", "(", "$", "node", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "nodePath", "=", "$", "node", "->", "attribute", "(", "'path_string'", ")", ";", "$", "pathString", "=", "\" path...
Returns an array of Object IDs inside node subtree or null when empty. @param $node @return array|null
[ "Returns", "an", "array", "of", "Object", "IDs", "inside", "node", "subtree", "or", "null", "when", "empty", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcontentobjecttreenode.php#L6425-L6451
train
ezsystems/ezpublish-legacy
kernel/private/api/content/repository.php
ezpContentRepository.query
public static function query( ezpContentCriteria $criteria ) { $fetchParams = self::translateFetchParams( $criteria ); $nodes = eZContentObjectTreeNode::subTreeByNodeID( $fetchParams->params, $fetchParams->rootNodeId ); $return = array(); foreach( $nodes as $node ) { $return[] = ezpContent::fromNode( $node ); } return $return; }
php
public static function query( ezpContentCriteria $criteria ) { $fetchParams = self::translateFetchParams( $criteria ); $nodes = eZContentObjectTreeNode::subTreeByNodeID( $fetchParams->params, $fetchParams->rootNodeId ); $return = array(); foreach( $nodes as $node ) { $return[] = ezpContent::fromNode( $node ); } return $return; }
[ "public", "static", "function", "query", "(", "ezpContentCriteria", "$", "criteria", ")", "{", "$", "fetchParams", "=", "self", "::", "translateFetchParams", "(", "$", "criteria", ")", ";", "$", "nodes", "=", "eZContentObjectTreeNode", "::", "subTreeByNodeID", "...
Runs a content repository query using a given set of criteria @param ezpContentCriteria $criteria @return ezpContentList
[ "Runs", "a", "content", "repository", "query", "using", "a", "given", "set", "of", "criteria" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/api/content/repository.php#L23-L33
train
ezsystems/ezpublish-legacy
kernel/private/api/content/repository.php
ezpContentRepository.queryCount
public static function queryCount( ezpContentCriteria $criteria ) { $fetchParams = self::translateFetchParams( $criteria ); $count = eZContentObjectTreeNode::subTreeCountByNodeID( $fetchParams->params, $fetchParams->rootNodeId ); return $count; }
php
public static function queryCount( ezpContentCriteria $criteria ) { $fetchParams = self::translateFetchParams( $criteria ); $count = eZContentObjectTreeNode::subTreeCountByNodeID( $fetchParams->params, $fetchParams->rootNodeId ); return $count; }
[ "public", "static", "function", "queryCount", "(", "ezpContentCriteria", "$", "criteria", ")", "{", "$", "fetchParams", "=", "self", "::", "translateFetchParams", "(", "$", "criteria", ")", ";", "$", "count", "=", "eZContentObjectTreeNode", "::", "subTreeCountByNo...
Returns node count using a given set of criteria @param ezpContentCriteria $criteria @return int
[ "Returns", "node", "count", "using", "a", "given", "set", "of", "criteria" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/api/content/repository.php#L40-L45
train
ezsystems/ezpublish-legacy
extension/ezoe/ezxmltext/handlers/input/ezoeinputparser.php
eZOEInputParser.process
public function process( $text, $createRootNode = true ) { $text = preg_replace( '#<!--.*?-->#s', '', $text ); // remove HTML comments $text = str_replace( array( '&nbsp;', '&#160;', '&#xa0;' ), "\xC2\xA0", $text ); return parent::process( $text, $createRootNode ); }
php
public function process( $text, $createRootNode = true ) { $text = preg_replace( '#<!--.*?-->#s', '', $text ); // remove HTML comments $text = str_replace( array( '&nbsp;', '&#160;', '&#xa0;' ), "\xC2\xA0", $text ); return parent::process( $text, $createRootNode ); }
[ "public", "function", "process", "(", "$", "text", ",", "$", "createRootNode", "=", "true", ")", "{", "$", "text", "=", "preg_replace", "(", "'#<!--.*?-->#s'", ",", "''", ",", "$", "text", ")", ";", "// remove HTML comments", "$", "text", "=", "str_replace...
Process html text and transform it to xml. @param string $text @param bool $createRootNode @return false|DOMDocument
[ "Process", "html", "text", "and", "transform", "it", "to", "xml", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezoe/ezxmltext/handlers/input/ezoeinputparser.php#L203-L208
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezdebug.php
eZDebug.packedToBin
private static function packedToBin( $packedIPAddress ) { $binaryIPAddress = ''; // In PHP v5.5 (and up) the unpack function's returned value formats behavior differs if ( version_compare( PHP_VERSION, '5.5.0-dev', '>=' ) ) { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.5 format 'a' retains trailing null bytes $unpackedIPAddress = unpack( 'a16', $packedIPAddress ); } else { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.4 <= format 'A' retains trailing null bytes $unpackedIPAddress = unpack( 'A16', $packedIPAddress ); } $unpackedIPAddressArray = str_split( $unpackedIPAddress[1] ); // Get each characters ascii number, then turn that number into a binary // and pad it with 0's to the left if it isn't 8 digits long foreach( $unpackedIPAddressArray as $character ) { $binaryIPAddress .= str_pad( decbin( ord( $character ) ), 8, '0', STR_PAD_LEFT ); } return $binaryIPAddress; }
php
private static function packedToBin( $packedIPAddress ) { $binaryIPAddress = ''; // In PHP v5.5 (and up) the unpack function's returned value formats behavior differs if ( version_compare( PHP_VERSION, '5.5.0-dev', '>=' ) ) { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.5 format 'a' retains trailing null bytes $unpackedIPAddress = unpack( 'a16', $packedIPAddress ); } else { // Turns the space padded string into an array of the unpacked in_addr representation // In PHP v5.4 <= format 'A' retains trailing null bytes $unpackedIPAddress = unpack( 'A16', $packedIPAddress ); } $unpackedIPAddressArray = str_split( $unpackedIPAddress[1] ); // Get each characters ascii number, then turn that number into a binary // and pad it with 0's to the left if it isn't 8 digits long foreach( $unpackedIPAddressArray as $character ) { $binaryIPAddress .= str_pad( decbin( ord( $character ) ), 8, '0', STR_PAD_LEFT ); } return $binaryIPAddress; }
[ "private", "static", "function", "packedToBin", "(", "$", "packedIPAddress", ")", "{", "$", "binaryIPAddress", "=", "''", ";", "// In PHP v5.5 (and up) the unpack function's returned value formats behavior differs", "if", "(", "version_compare", "(", "PHP_VERSION", ",", "'5...
Turns the 'packed' output of inet_pton into a full binary representation @param string $packedIPAddress Packed ip address in binary string form @return string Returns binary string representation
[ "Turns", "the", "packed", "output", "of", "inet_pton", "into", "a", "full", "binary", "representation" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezdebug.php#L1091-L1118
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezdebug.php
eZDebug.isAllowedByCurrentIP
private static function isAllowedByCurrentIP( $allowedIpList ) { $ipAddresIPV4Pattern = "/^(([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+))(\/([0-9]+)$|$)/"; $ipAddressIPV6Pattern = "/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(\/([0-9]+)$|$)$/"; $ipAddress = eZSys::clientIP(); if ( $ipAddress ) { foreach( $allowedIpList as $itemToMatch ) { // Test for IPv6 Addresses first instead of IPv4 addresses as IPv6 // addresses can contain dot separators within them if ( preg_match( "/:/", $ipAddress ) ) { if ( preg_match( $ipAddressIPV6Pattern, $itemToMatch, $matches ) ) { if ( $matches[69] ) { if ( self::isIPInNetIPv6( $ipAddress, $itemToMatch ) ) { return true; } } else { if ( $matches[1] == $itemToMatch ) { return true; } } } } elseif ( preg_match( "/\./", $ipAddress) ) { if ( preg_match( $ipAddresIPV4Pattern, $itemToMatch, $matches ) ) { if ( $matches[6] ) { if ( self::isIPInNet( $ipAddress, $matches[1], $matches[7] ) ) { return true; } } else { if ( $matches[1] == $ipAddress ) { return true; } } } } } return false; } else { return eZSys::isShellExecution() && in_array( 'commandline', $allowedIpList ); } }
php
private static function isAllowedByCurrentIP( $allowedIpList ) { $ipAddresIPV4Pattern = "/^(([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+))(\/([0-9]+)$|$)/"; $ipAddressIPV6Pattern = "/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(\/([0-9]+)$|$)$/"; $ipAddress = eZSys::clientIP(); if ( $ipAddress ) { foreach( $allowedIpList as $itemToMatch ) { // Test for IPv6 Addresses first instead of IPv4 addresses as IPv6 // addresses can contain dot separators within them if ( preg_match( "/:/", $ipAddress ) ) { if ( preg_match( $ipAddressIPV6Pattern, $itemToMatch, $matches ) ) { if ( $matches[69] ) { if ( self::isIPInNetIPv6( $ipAddress, $itemToMatch ) ) { return true; } } else { if ( $matches[1] == $itemToMatch ) { return true; } } } } elseif ( preg_match( "/\./", $ipAddress) ) { if ( preg_match( $ipAddresIPV4Pattern, $itemToMatch, $matches ) ) { if ( $matches[6] ) { if ( self::isIPInNet( $ipAddress, $matches[1], $matches[7] ) ) { return true; } } else { if ( $matches[1] == $ipAddress ) { return true; } } } } } return false; } else { return eZSys::isShellExecution() && in_array( 'commandline', $allowedIpList ); } }
[ "private", "static", "function", "isAllowedByCurrentIP", "(", "$", "allowedIpList", ")", "{", "$", "ipAddresIPV4Pattern", "=", "\"/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)$|$)/\"", ";", "$", "ipAddressIPV6Pattern", "=", "\"/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})...
If debugging is allowed for the current IP address. @param array $allowedIpList @return bool
[ "If", "debugging", "is", "allowed", "for", "the", "current", "IP", "address", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezdebug.php#L1901-L1962
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.baseDirectory
static function baseDirectory( eZINI $siteINI = null ) { if ( $siteINI === null ) $siteINI = eZINI::instance(); $extensionDirectory = $siteINI->variable( 'ExtensionSettings', 'ExtensionDirectory' ); return $extensionDirectory; }
php
static function baseDirectory( eZINI $siteINI = null ) { if ( $siteINI === null ) $siteINI = eZINI::instance(); $extensionDirectory = $siteINI->variable( 'ExtensionSettings', 'ExtensionDirectory' ); return $extensionDirectory; }
[ "static", "function", "baseDirectory", "(", "eZINI", "$", "siteINI", "=", "null", ")", "{", "if", "(", "$", "siteINI", "===", "null", ")", "$", "siteINI", "=", "eZINI", "::", "instance", "(", ")", ";", "$", "extensionDirectory", "=", "$", "siteINI", "-...
return the base directory for extensions @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini @return string
[ "return", "the", "base", "directory", "for", "extensions" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L39-L45
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.activeExtensions
public static function activeExtensions( $extensionType = false, eZINI $siteINI = null ) { if ( $siteINI === null ) { $siteINI = eZINI::instance(); } $activeExtensions = array(); if ( !$extensionType || $extensionType === 'default' ) { $activeExtensions = $siteINI->variable( 'ExtensionSettings', 'ActiveExtensions' ); } if ( !$extensionType || $extensionType === 'access' ) { $activeExtensions = array_merge( $activeExtensions, $siteINI->variable( 'ExtensionSettings', 'ActiveAccessExtensions' ) ); } if ( isset( $GLOBALS['eZActiveExtensions'] ) ) { $activeExtensions = array_merge( $activeExtensions, $GLOBALS['eZActiveExtensions'] ); } // return empty array as is to avoid further unneeded overhead if ( !isset( $activeExtensions[0] ) ) { return $activeExtensions; } // return array as is if ordering is disabled to avoid cache overhead $activeExtensions = array_unique( $activeExtensions ); if ( $siteINI->variable( 'ExtensionSettings', 'ExtensionOrdering' ) !== 'enabled' ) { // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists return $activeExtensions; } $cacheIdentifier = md5( serialize( $activeExtensions ) ); if ( isset ( self::$activeExtensionsCache[$cacheIdentifier] ) ) { return self::$activeExtensionsCache[$cacheIdentifier]; } // cache has to be stored by siteaccess + $extensionType $extensionDirectory = self::baseDirectory(); $expiryHandler = eZExpiryHandler::instance(); $phpCache = new eZPHPCreator( self::CACHE_DIR, "active_extensions_{$cacheIdentifier}.php" ); $expiryTime = $expiryHandler->hasTimestamp( 'active-extensions-cache' ) ? $expiryHandler->timestamp( 'active-extensions-cache' ) : 0; if ( !$phpCache->canRestore( $expiryTime ) ) { self::$activeExtensionsCache[$cacheIdentifier] = self::extensionOrdering( $activeExtensions ); // Check that all extensions defined actually exists before storing cache foreach ( self::$activeExtensionsCache[$cacheIdentifier] as $activeExtension ) { if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) ) { eZDebug::writeError( "Extension '$activeExtension' does not exist, looked for directory '" . $extensionDirectory . '/' . $activeExtension . "'", __METHOD__ ); } } $phpCache->addVariable( 'activeExtensions', self::$activeExtensionsCache[$cacheIdentifier] ); $phpCache->store( true ); } else { $data = $phpCache->restore( array( 'activeExtensions' => 'activeExtensions' ) ); self::$activeExtensionsCache[$cacheIdentifier] = $data['activeExtensions']; } return self::$activeExtensionsCache[$cacheIdentifier]; }
php
public static function activeExtensions( $extensionType = false, eZINI $siteINI = null ) { if ( $siteINI === null ) { $siteINI = eZINI::instance(); } $activeExtensions = array(); if ( !$extensionType || $extensionType === 'default' ) { $activeExtensions = $siteINI->variable( 'ExtensionSettings', 'ActiveExtensions' ); } if ( !$extensionType || $extensionType === 'access' ) { $activeExtensions = array_merge( $activeExtensions, $siteINI->variable( 'ExtensionSettings', 'ActiveAccessExtensions' ) ); } if ( isset( $GLOBALS['eZActiveExtensions'] ) ) { $activeExtensions = array_merge( $activeExtensions, $GLOBALS['eZActiveExtensions'] ); } // return empty array as is to avoid further unneeded overhead if ( !isset( $activeExtensions[0] ) ) { return $activeExtensions; } // return array as is if ordering is disabled to avoid cache overhead $activeExtensions = array_unique( $activeExtensions ); if ( $siteINI->variable( 'ExtensionSettings', 'ExtensionOrdering' ) !== 'enabled' ) { // @todo Introduce a debug setting or re use existing dev mods to check that all extensions exists return $activeExtensions; } $cacheIdentifier = md5( serialize( $activeExtensions ) ); if ( isset ( self::$activeExtensionsCache[$cacheIdentifier] ) ) { return self::$activeExtensionsCache[$cacheIdentifier]; } // cache has to be stored by siteaccess + $extensionType $extensionDirectory = self::baseDirectory(); $expiryHandler = eZExpiryHandler::instance(); $phpCache = new eZPHPCreator( self::CACHE_DIR, "active_extensions_{$cacheIdentifier}.php" ); $expiryTime = $expiryHandler->hasTimestamp( 'active-extensions-cache' ) ? $expiryHandler->timestamp( 'active-extensions-cache' ) : 0; if ( !$phpCache->canRestore( $expiryTime ) ) { self::$activeExtensionsCache[$cacheIdentifier] = self::extensionOrdering( $activeExtensions ); // Check that all extensions defined actually exists before storing cache foreach ( self::$activeExtensionsCache[$cacheIdentifier] as $activeExtension ) { if ( !file_exists( $extensionDirectory . '/' . $activeExtension ) ) { eZDebug::writeError( "Extension '$activeExtension' does not exist, looked for directory '" . $extensionDirectory . '/' . $activeExtension . "'", __METHOD__ ); } } $phpCache->addVariable( 'activeExtensions', self::$activeExtensionsCache[$cacheIdentifier] ); $phpCache->store( true ); } else { $data = $phpCache->restore( array( 'activeExtensions' => 'activeExtensions' ) ); self::$activeExtensionsCache[$cacheIdentifier] = $data['activeExtensions']; } return self::$activeExtensionsCache[$cacheIdentifier]; }
[ "public", "static", "function", "activeExtensions", "(", "$", "extensionType", "=", "false", ",", "eZINI", "$", "siteINI", "=", "null", ")", "{", "if", "(", "$", "siteINI", "===", "null", ")", "{", "$", "siteINI", "=", "eZINI", "::", "instance", "(", "...
Return an array with activated extensions. @note Default extensions are those who are loaded before a siteaccess are determined while access extensions are loaded after siteaccess is set. @param bool|string $extensionType Decides which extension to include in the list, the follow values are possible: - false - Means add both default and access extensions - 'default' - Add only default extensions - 'access' - Add only access extensions @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini @return array
[ "Return", "an", "array", "with", "activated", "extensions", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L60-L134
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.extensionOrdering
public static function extensionOrdering( array $activeExtensions ) { $activeExtensionsSet = array_flip( $activeExtensions ); $dependencies = array(); foreach ( $activeExtensions as $extension ) { $loadingOrderData = ezpExtension::getInstance( $extension )->getLoadingOrder(); // The extension should appear even without dependencies to be taken into account if ( ! isset( $dependencies[$extension] ) ) $dependencies[$extension] = array(); if ( isset( $loadingOrderData['after'] ) ) { foreach ( $loadingOrderData['after'] as $dependency ) { if ( isset( $activeExtensionsSet[$dependency] ) ) $dependencies[$extension][] = $dependency; } } if ( isset( $loadingOrderData['before'] ) ) { foreach ( $loadingOrderData['before'] as $dependency ) { if ( isset( $activeExtensionsSet[$dependency] ) ) $dependencies[$dependency][] = $extension; } } } $topologySort = new ezpTopologicalSort( $dependencies ); $activeExtensionsSorted = $topologySort->sort(); return $activeExtensionsSorted !== false ? $activeExtensionsSorted : $activeExtensions; }
php
public static function extensionOrdering( array $activeExtensions ) { $activeExtensionsSet = array_flip( $activeExtensions ); $dependencies = array(); foreach ( $activeExtensions as $extension ) { $loadingOrderData = ezpExtension::getInstance( $extension )->getLoadingOrder(); // The extension should appear even without dependencies to be taken into account if ( ! isset( $dependencies[$extension] ) ) $dependencies[$extension] = array(); if ( isset( $loadingOrderData['after'] ) ) { foreach ( $loadingOrderData['after'] as $dependency ) { if ( isset( $activeExtensionsSet[$dependency] ) ) $dependencies[$extension][] = $dependency; } } if ( isset( $loadingOrderData['before'] ) ) { foreach ( $loadingOrderData['before'] as $dependency ) { if ( isset( $activeExtensionsSet[$dependency] ) ) $dependencies[$dependency][] = $extension; } } } $topologySort = new ezpTopologicalSort( $dependencies ); $activeExtensionsSorted = $topologySort->sort(); return $activeExtensionsSorted !== false ? $activeExtensionsSorted : $activeExtensions; }
[ "public", "static", "function", "extensionOrdering", "(", "array", "$", "activeExtensions", ")", "{", "$", "activeExtensionsSet", "=", "array_flip", "(", "$", "activeExtensions", ")", ";", "$", "dependencies", "=", "array", "(", ")", ";", "foreach", "(", "$", ...
Returns the provided array reordered with loading order information taken into account. @see activeExtensions @param array $activeExtensions Array of extensions.
[ "Returns", "the", "provided", "array", "reordered", "with", "loading", "order", "information", "taken", "into", "account", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L143-L178
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.activateExtensions
static function activateExtensions( $extensionType = 'default', eZINI $siteINI = null ) { if ( $siteINI === null ) { $siteINI = eZINI::instance(); } if ( $extensionType === false ) { eZDebug::writeStrict( "Setting parameter \$extensionType to false is deprecated as of 4.4, see doc/bc/4.4!", __METHOD__ ); } $extensionDirectory = self::baseDirectory(); $activeExtensions = self::activeExtensions( $extensionType, $siteINI ); $hasExtensions = false; foreach ( $activeExtensions as $activeExtension ) { $extensionSettingsPath = $extensionDirectory . '/' . $activeExtension . '/settings'; if ( $extensionType === 'access' ) $siteINI->prependOverrideDir( $extensionSettingsPath, true, 'extension:' . $activeExtension, 'sa-extension' ); else $siteINI->prependOverrideDir( $extensionSettingsPath, true, 'extension:' . $activeExtension, 'extension' ); if ( isset( $GLOBALS['eZCurrentAccess'] ) ) self::prependSiteAccess( $activeExtension, $GLOBALS['eZCurrentAccess']['name'], $siteINI ); $hasExtensions = true; } if ( $hasExtensions ) $siteINI->load(); }
php
static function activateExtensions( $extensionType = 'default', eZINI $siteINI = null ) { if ( $siteINI === null ) { $siteINI = eZINI::instance(); } if ( $extensionType === false ) { eZDebug::writeStrict( "Setting parameter \$extensionType to false is deprecated as of 4.4, see doc/bc/4.4!", __METHOD__ ); } $extensionDirectory = self::baseDirectory(); $activeExtensions = self::activeExtensions( $extensionType, $siteINI ); $hasExtensions = false; foreach ( $activeExtensions as $activeExtension ) { $extensionSettingsPath = $extensionDirectory . '/' . $activeExtension . '/settings'; if ( $extensionType === 'access' ) $siteINI->prependOverrideDir( $extensionSettingsPath, true, 'extension:' . $activeExtension, 'sa-extension' ); else $siteINI->prependOverrideDir( $extensionSettingsPath, true, 'extension:' . $activeExtension, 'extension' ); if ( isset( $GLOBALS['eZCurrentAccess'] ) ) self::prependSiteAccess( $activeExtension, $GLOBALS['eZCurrentAccess']['name'], $siteINI ); $hasExtensions = true; } if ( $hasExtensions ) $siteINI->load(); }
[ "static", "function", "activateExtensions", "(", "$", "extensionType", "=", "'default'", ",", "eZINI", "$", "siteINI", "=", "null", ")", "{", "if", "(", "$", "siteINI", "===", "null", ")", "{", "$", "siteINI", "=", "eZINI", "::", "instance", "(", ")", ...
Will make sure that all extensions that has settings directories are added to the eZINI override list. @param string $extensionType See {@link eZExtension::activeExtensions()}, value of false is deprecated as of 4.4 @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini
[ "Will", "make", "sure", "that", "all", "extensions", "that", "has", "settings", "directories", "are", "added", "to", "the", "eZINI", "override", "list", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L187-L218
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.prependExtensionSiteAccesses
static function prependExtensionSiteAccesses( $accessName = false, $ini = false, $globalDir = true, $identifier = null, $order = true ) { $extensionList = eZExtension::activeExtensions( 'default' ); if ( !$order ) { $extensionList = array_reverse( $extensionList ); } foreach( $extensionList as $extension ) { self::prependSiteAccess( $extension, $accessName, $ini, $globalDir, $identifier ); } }
php
static function prependExtensionSiteAccesses( $accessName = false, $ini = false, $globalDir = true, $identifier = null, $order = true ) { $extensionList = eZExtension::activeExtensions( 'default' ); if ( !$order ) { $extensionList = array_reverse( $extensionList ); } foreach( $extensionList as $extension ) { self::prependSiteAccess( $extension, $accessName, $ini, $globalDir, $identifier ); } }
[ "static", "function", "prependExtensionSiteAccesses", "(", "$", "accessName", "=", "false", ",", "$", "ini", "=", "false", ",", "$", "globalDir", "=", "true", ",", "$", "identifier", "=", "null", ",", "$", "order", "=", "true", ")", "{", "$", "extensionL...
Prepend extension siteaccesses @param string|false $accessName Optional access name, will use global if false @param eZINI|false|null $ini @param true $globalDir @param string|false|null See {@link eZExtension::prependSiteAccess()} @param bool $order Prepend extensions in reverse order by setting this to false
[ "Prepend", "extension", "siteaccesses" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L229-L242
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezextension.php
eZExtension.prependSiteAccess
static function prependSiteAccess( $extension, $accessName = false, $ini = false, $globalDir = true, $identifier = null ) { if ( !$accessName ) { $accessName = $GLOBALS['eZCurrentAccess']['name']; } $extensionSettingsPath = eZExtension::baseDirectory() . '/' . $extension; if ( $identifier === null ) { $identifier = "ext-siteaccess:$extension"; } if ( !$ini instanceof eZINI ) { $ini = eZINI::instance(); } $ini->prependOverrideDir( $extensionSettingsPath . '/settings/siteaccess/' . $accessName, $globalDir, $identifier, 'siteaccess' ); }
php
static function prependSiteAccess( $extension, $accessName = false, $ini = false, $globalDir = true, $identifier = null ) { if ( !$accessName ) { $accessName = $GLOBALS['eZCurrentAccess']['name']; } $extensionSettingsPath = eZExtension::baseDirectory() . '/' . $extension; if ( $identifier === null ) { $identifier = "ext-siteaccess:$extension"; } if ( !$ini instanceof eZINI ) { $ini = eZINI::instance(); } $ini->prependOverrideDir( $extensionSettingsPath . '/settings/siteaccess/' . $accessName, $globalDir, $identifier, 'siteaccess' ); }
[ "static", "function", "prependSiteAccess", "(", "$", "extension", ",", "$", "accessName", "=", "false", ",", "$", "ini", "=", "false", ",", "$", "globalDir", "=", "true", ",", "$", "identifier", "=", "null", ")", "{", "if", "(", "!", "$", "accessName",...
Prepend siteaccess for specified extension @param string $extension Name of extension (folder name) @param string|false $accessName Optional access name, will use global if false @param eZINI|false|null $ini @param true $globalDir @param string|false|null $identifier By setting to string "siteaccess" only one location is supported (identifier makes eZINI overwrite earlier prepends with same key) null(default) means "ext-siteaccess:$extension" is used to only have one pr extension
[ "Prepend", "siteaccess", "for", "specified", "extension" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezextension.php#L255-L274
train
ezsystems/ezpublish-legacy
kernel/private/eztemplate/ezpattributeoperatormanager.php
ezpAttributeOperatorManager.createFormatter
protected static function createFormatter( $format ) { $formatterOptions = new ezpExtensionOptions(); $formatterOptions->iniFile = 'template.ini'; $formatterOptions->iniSection = 'AttributeOperator'; $formatterOptions->iniVariable = 'OutputFormatter'; $formatterOptions->handlerIndex = $format; $formatterInstance = eZExtension::getHandlerClass( $formatterOptions ); if ( !( $formatterInstance instanceof ezpAttributeOperatorFormatterInterface ) ) eZDebug::writeError( "Undefined output formatter for '{$format}'", __METHOD__ ); return $formatterInstance; }
php
protected static function createFormatter( $format ) { $formatterOptions = new ezpExtensionOptions(); $formatterOptions->iniFile = 'template.ini'; $formatterOptions->iniSection = 'AttributeOperator'; $formatterOptions->iniVariable = 'OutputFormatter'; $formatterOptions->handlerIndex = $format; $formatterInstance = eZExtension::getHandlerClass( $formatterOptions ); if ( !( $formatterInstance instanceof ezpAttributeOperatorFormatterInterface ) ) eZDebug::writeError( "Undefined output formatter for '{$format}'", __METHOD__ ); return $formatterInstance; }
[ "protected", "static", "function", "createFormatter", "(", "$", "format", ")", "{", "$", "formatterOptions", "=", "new", "ezpExtensionOptions", "(", ")", ";", "$", "formatterOptions", "->", "iniFile", "=", "'template.ini'", ";", "$", "formatterOptions", "->", "i...
Searches for the output formatter handler class for a given format @static @param string $format @return ezpAttributeOperatorFormatterInterface
[ "Searches", "for", "the", "output", "formatter", "handler", "class", "for", "a", "given", "format" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/eztemplate/ezpattributeoperatormanager.php#L26-L40
train
ezsystems/ezpublish-legacy
kernel/private/eztemplate/ezpattributeoperatormanager.php
ezpAttributeOperatorManager.getOutputFormatter
public static function getOutputFormatter( $format ) { if ( !self::isRegisteredFormatter( $format ) ) { $format = eZINI::instance( 'template.ini' )->variable( 'AttributeOperator', 'DefaultFormatter' ); } if ( !( self::$formatter instanceof ezpAttributeOperatorFormatterInterface ) || $format != self::$format ) { self::$formatter = self::createFormatter( $format ); self::$format = $format; } return self::$formatter; }
php
public static function getOutputFormatter( $format ) { if ( !self::isRegisteredFormatter( $format ) ) { $format = eZINI::instance( 'template.ini' )->variable( 'AttributeOperator', 'DefaultFormatter' ); } if ( !( self::$formatter instanceof ezpAttributeOperatorFormatterInterface ) || $format != self::$format ) { self::$formatter = self::createFormatter( $format ); self::$format = $format; } return self::$formatter; }
[ "public", "static", "function", "getOutputFormatter", "(", "$", "format", ")", "{", "if", "(", "!", "self", "::", "isRegisteredFormatter", "(", "$", "format", ")", ")", "{", "$", "format", "=", "eZINI", "::", "instance", "(", "'template.ini'", ")", "->", ...
Returns formatter object for a given format @static @param string $format @return ezpAttributeOperatorFormatterInterface|null
[ "Returns", "formatter", "object", "for", "a", "given", "format" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/eztemplate/ezpattributeoperatormanager.php#L61-L75
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/request/http_parser.php
ezpRestHttpRequestParser.fillVariables
protected function fillVariables() { $variables = array(); $internalVariables = array( 'ResponseGroups' ); // Expected variables foreach( $internalVariables as $internalVariable ) { if( isset( $_GET[$internalVariable] ) ) { // Extract and organize variables as expected switch( $internalVariable ) { case 'ResponseGroups': $variables[$internalVariable] = explode( ',', $_GET[$internalVariable] ); break; default: $variables[$internalVariable] = $_GET[$internalVariable]; } unset( $_GET[$internalVariable] ); } else { switch( $internalVariable ) { case 'ResponseGroups': $variables[$internalVariable] = array(); break; default: $variables[$internalVariable] = null; } } } return $variables; }
php
protected function fillVariables() { $variables = array(); $internalVariables = array( 'ResponseGroups' ); // Expected variables foreach( $internalVariables as $internalVariable ) { if( isset( $_GET[$internalVariable] ) ) { // Extract and organize variables as expected switch( $internalVariable ) { case 'ResponseGroups': $variables[$internalVariable] = explode( ',', $_GET[$internalVariable] ); break; default: $variables[$internalVariable] = $_GET[$internalVariable]; } unset( $_GET[$internalVariable] ); } else { switch( $internalVariable ) { case 'ResponseGroups': $variables[$internalVariable] = array(); break; default: $variables[$internalVariable] = null; } } } return $variables; }
[ "protected", "function", "fillVariables", "(", ")", "{", "$", "variables", "=", "array", "(", ")", ";", "$", "internalVariables", "=", "array", "(", "'ResponseGroups'", ")", ";", "// Expected variables", "foreach", "(", "$", "internalVariables", "as", "$", "in...
Extract variables to be used internally from GET @return array
[ "Extract", "variables", "to", "be", "used", "internally", "from", "GET" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/request/http_parser.php#L85-L122
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/request/http_parser.php
ezpRestHttpRequestParser.fillContentVariables
protected function fillContentVariables() { $contentVariables = array(); $expectedVariables = array( 'Translation', 'OutputFormat' ); foreach( $expectedVariables as $variable ) { if( isset( $_GET[$variable] ) ) { // Extract and organize variables as expected switch( $variable ) { case 'Translation': // @TODO => Make some control on the locale provided default: $contentVariables[$variable] = $_GET[$variable]; } unset( $_GET[$variable] ); } else { $contentVariables[$variable] = null; } } return $contentVariables; }
php
protected function fillContentVariables() { $contentVariables = array(); $expectedVariables = array( 'Translation', 'OutputFormat' ); foreach( $expectedVariables as $variable ) { if( isset( $_GET[$variable] ) ) { // Extract and organize variables as expected switch( $variable ) { case 'Translation': // @TODO => Make some control on the locale provided default: $contentVariables[$variable] = $_GET[$variable]; } unset( $_GET[$variable] ); } else { $contentVariables[$variable] = null; } } return $contentVariables; }
[ "protected", "function", "fillContentVariables", "(", ")", "{", "$", "contentVariables", "=", "array", "(", ")", ";", "$", "expectedVariables", "=", "array", "(", "'Translation'", ",", "'OutputFormat'", ")", ";", "foreach", "(", "$", "expectedVariables", "as", ...
Extract variables related to content from GET @return array
[ "Extract", "variables", "related", "to", "content", "from", "GET" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/request/http_parser.php#L129-L155
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/request/http_parser.php
ezpRestHttpRequestParser.processProtocol
protected function processProtocol() { $req = $this->request; $req->originalProtocol = $req->protocol = 'http-' . ( isset( $_SERVER['REQUEST_METHOD'] ) ? strtolower( $_SERVER['REQUEST_METHOD'] ) : "get" ); // Adds support for using POST for PUT and DELETE for legacy browsers that does not support these. // If a post param "_method" is set to either PUT or DELETE, then ->protocol is changed to that. // (original protocol is kept on ->originalProtocol param) // Post is used as this is only meant for forms in legacy browsers. if ( $req->protocol === 'http-post' && isset( $_POST['_method'] ) ) { $method = strtolower( $_POST['_method'] ); if ( $method === 'put' || $method === 'delete' ) $req->protocol = "http-{$method}"; unset( $_POST['_method'] ); } }
php
protected function processProtocol() { $req = $this->request; $req->originalProtocol = $req->protocol = 'http-' . ( isset( $_SERVER['REQUEST_METHOD'] ) ? strtolower( $_SERVER['REQUEST_METHOD'] ) : "get" ); // Adds support for using POST for PUT and DELETE for legacy browsers that does not support these. // If a post param "_method" is set to either PUT or DELETE, then ->protocol is changed to that. // (original protocol is kept on ->originalProtocol param) // Post is used as this is only meant for forms in legacy browsers. if ( $req->protocol === 'http-post' && isset( $_POST['_method'] ) ) { $method = strtolower( $_POST['_method'] ); if ( $method === 'put' || $method === 'delete' ) $req->protocol = "http-{$method}"; unset( $_POST['_method'] ); } }
[ "protected", "function", "processProtocol", "(", ")", "{", "$", "req", "=", "$", "this", "->", "request", ";", "$", "req", "->", "originalProtocol", "=", "$", "req", "->", "protocol", "=", "'http-'", ".", "(", "isset", "(", "$", "_SERVER", "[", "'REQUE...
Processes the request protocol.
[ "Processes", "the", "request", "protocol", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/request/http_parser.php#L160-L177
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/request/http_parser.php
ezpRestHttpRequestParser.processDate
protected function processDate() { $this->request->date = isset( $_SERVER['REQUEST_TIME'] ) ? new DateTime( '@' . (int)$_SERVER['REQUEST_TIME'] ) : new DateTime(); }
php
protected function processDate() { $this->request->date = isset( $_SERVER['REQUEST_TIME'] ) ? new DateTime( '@' . (int)$_SERVER['REQUEST_TIME'] ) : new DateTime(); }
[ "protected", "function", "processDate", "(", ")", "{", "$", "this", "->", "request", "->", "date", "=", "isset", "(", "$", "_SERVER", "[", "'REQUEST_TIME'", "]", ")", "?", "new", "DateTime", "(", "'@'", ".", "(", "int", ")", "$", "_SERVER", "[", "'RE...
Processes the request date. @see http://issues.ez.no/19027
[ "Processes", "the", "request", "date", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/request/http_parser.php#L184-L189
train
ezsystems/ezpublish-legacy
kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmleditoutput.php
eZSimplifiedXMLEditOutput.performOutput
function performOutput( $dom ) { $this->XMLSchema = eZXMLSchema::instance(); $this->NestingLevel = 0; $this->Output = ''; $sectionLevel = -1; $this->createLinksArray( $dom ); $this->outputTag( $dom->documentElement, $sectionLevel ); return $this->Output; }
php
function performOutput( $dom ) { $this->XMLSchema = eZXMLSchema::instance(); $this->NestingLevel = 0; $this->Output = ''; $sectionLevel = -1; $this->createLinksArray( $dom ); $this->outputTag( $dom->documentElement, $sectionLevel ); return $this->Output; }
[ "function", "performOutput", "(", "$", "dom", ")", "{", "$", "this", "->", "XMLSchema", "=", "eZXMLSchema", "::", "instance", "(", ")", ";", "$", "this", "->", "NestingLevel", "=", "0", ";", "$", "this", "->", "Output", "=", "''", ";", "$", "sectionL...
Call this function to obtain edit output string
[ "Call", "this", "function", "to", "obtain", "edit", "output", "string" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/datatypes/ezxmltext/handlers/input/ezsimplifiedxmleditoutput.php#L71-L83
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlerdb.php
ezpSessionHandlerDB.read
public function read( $sessionId ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $escKey = $db->escapeString( $sessionId ); $sessionRes = !$this->userHasCookie ? false : $db->arrayQuery( "SELECT data, user_id, expiration_time FROM ezsession WHERE session_key='$escKey'" ); if ( $sessionRes !== false and count( $sessionRes ) == 1 ) { eZSession::setUserID( $sessionRes[0]['user_id'] ); $ini = eZINI::instance(); $sessionUpdatesTime = $sessionRes[0]['expiration_time'] - $ini->variable( 'Session', 'SessionTimeout' ); $sessionIdle = time() - $sessionUpdatesTime; $GLOBALS['eZSessionIdleTime'] = $sessionIdle; return $sessionRes[0]['data']; } else { return false; } }
php
public function read( $sessionId ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $escKey = $db->escapeString( $sessionId ); $sessionRes = !$this->userHasCookie ? false : $db->arrayQuery( "SELECT data, user_id, expiration_time FROM ezsession WHERE session_key='$escKey'" ); if ( $sessionRes !== false and count( $sessionRes ) == 1 ) { eZSession::setUserID( $sessionRes[0]['user_id'] ); $ini = eZINI::instance(); $sessionUpdatesTime = $sessionRes[0]['expiration_time'] - $ini->variable( 'Session', 'SessionTimeout' ); $sessionIdle = time() - $sessionUpdatesTime; $GLOBALS['eZSessionIdleTime'] = $sessionIdle; return $sessionRes[0]['data']; } else { return false; } }
[ "public", "function", "read", "(", "$", "sessionId", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "if", "(", "!", "$", "db", "->", "isConnected", "(", ")", ")", "{", "return", "false", ";", "}", "$", "escKey", "=", "$", "d...
Session read handler @param string $sessionId @return string|false Binary session data
[ "Session", "read", "handler" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlerdb.php#L53-L82
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlerdb.php
ezpSessionHandlerDB.write
public function write( $sessionId, $sessionData ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $ini = eZINI::instance(); $expirationTime = time() + $ini->variable( 'Session', 'SessionTimeout' ); if ( $db->bindingType() != eZDBInterface::BINDING_NO ) { $sessionData = $db->bindVariable( $sessionData, array( 'name' => 'data' ) ); } else { $sessionData = '\'' . $db->escapeString( $sessionData ) . '\''; } $escKey = $db->escapeString( $sessionId ); $userID = $db->escapeString( eZSession::userID() ); // check if session already exists $sessionRes = !$this->userHasCookie ? false : $db->arrayQuery( "SELECT session_key FROM ezsession WHERE session_key='$escKey'" ); if ( $sessionRes !== false and count( $sessionRes ) == 1 ) { $ret = $db->query( "UPDATE ezsession SET expiration_time='$expirationTime', data=$sessionData, user_id='$userID' WHERE session_key='$escKey'" ); } else { $insertQuery = "INSERT INTO ezsession ( session_key, expiration_time, data, user_id ) VALUES ( '$escKey', '$expirationTime', $sessionData, '$userID' )"; $ret = $db->query( $insertQuery ); } return true; }
php
public function write( $sessionId, $sessionData ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $ini = eZINI::instance(); $expirationTime = time() + $ini->variable( 'Session', 'SessionTimeout' ); if ( $db->bindingType() != eZDBInterface::BINDING_NO ) { $sessionData = $db->bindVariable( $sessionData, array( 'name' => 'data' ) ); } else { $sessionData = '\'' . $db->escapeString( $sessionData ) . '\''; } $escKey = $db->escapeString( $sessionId ); $userID = $db->escapeString( eZSession::userID() ); // check if session already exists $sessionRes = !$this->userHasCookie ? false : $db->arrayQuery( "SELECT session_key FROM ezsession WHERE session_key='$escKey'" ); if ( $sessionRes !== false and count( $sessionRes ) == 1 ) { $ret = $db->query( "UPDATE ezsession SET expiration_time='$expirationTime', data=$sessionData, user_id='$userID' WHERE session_key='$escKey'" ); } else { $insertQuery = "INSERT INTO ezsession ( session_key, expiration_time, data, user_id ) VALUES ( '$escKey', '$expirationTime', $sessionData, '$userID' )"; $ret = $db->query( $insertQuery ); } return true; }
[ "public", "function", "write", "(", "$", "sessionId", ",", "$", "sessionData", ")", "{", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "if", "(", "!", "$", "db", "->", "isConnected", "(", ")", ")", "{", "return", "false", ";", "}", "$"...
Session write handler @param string $sessionId @param string $sessionData Binary session data @return bool
[ "Session", "write", "handler" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlerdb.php#L91-L127
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlerdb.php
ezpSessionHandlerDB.destroy
public function destroy( $sessionId ) { ezpEvent::getInstance()->notify( 'session/destroy', array( $sessionId ) ); $db = eZDB::instance(); $escKey = $db->escapeString( $sessionId ); eZSession::triggerCallback( 'destroy_pre', array( $db, $sessionId, $escKey ) ); $db->query( "DELETE FROM ezsession WHERE session_key='$escKey'" ); eZSession::triggerCallback( 'destroy_post', array( $db, $sessionId, $escKey ) ); return true; }
php
public function destroy( $sessionId ) { ezpEvent::getInstance()->notify( 'session/destroy', array( $sessionId ) ); $db = eZDB::instance(); $escKey = $db->escapeString( $sessionId ); eZSession::triggerCallback( 'destroy_pre', array( $db, $sessionId, $escKey ) ); $db->query( "DELETE FROM ezsession WHERE session_key='$escKey'" ); eZSession::triggerCallback( 'destroy_post', array( $db, $sessionId, $escKey ) ); return true; }
[ "public", "function", "destroy", "(", "$", "sessionId", ")", "{", "ezpEvent", "::", "getInstance", "(", ")", "->", "notify", "(", "'session/destroy'", ",", "array", "(", "$", "sessionId", ")", ")", ";", "$", "db", "=", "eZDB", "::", "instance", "(", ")...
Session destroy handler @param string $sessionId @return bool
[ "Session", "destroy", "handler" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlerdb.php#L135-L147
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlerdb.php
ezpSessionHandlerDB.regenerate
public function regenerate( $updateBackendData = true ) { $oldSessionId = session_id(); session_regenerate_id(); $newSessionId = session_id(); ezpEvent::getInstance()->notify( 'session/regenerate', array( $oldSessionId, $newSessionId ) ); if ( $updateBackendData ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $escOldKey = $db->escapeString( $oldSessionId ); $escNewKey = $db->escapeString( $newSessionId ); $escUserID = $db->escapeString( eZSession::userID() ); eZSession::triggerCallback( 'regenerate_pre', array( $db, $escNewKey, $escOldKey, $escUserID ) ); $db->query( "UPDATE ezsession SET session_key='$escNewKey', user_id='$escUserID' WHERE session_key='$escOldKey'" ); $db->query( "UPDATE ezbasket SET session_id='$escNewKey' WHERE session_id='$escOldKey'" ); eZSession::triggerCallback( 'regenerate_post', array( $db, $escNewKey, $escOldKey, $escUserID ) ); } return true; }
php
public function regenerate( $updateBackendData = true ) { $oldSessionId = session_id(); session_regenerate_id(); $newSessionId = session_id(); ezpEvent::getInstance()->notify( 'session/regenerate', array( $oldSessionId, $newSessionId ) ); if ( $updateBackendData ) { $db = eZDB::instance(); if ( !$db->isConnected() ) { return false; } $escOldKey = $db->escapeString( $oldSessionId ); $escNewKey = $db->escapeString( $newSessionId ); $escUserID = $db->escapeString( eZSession::userID() ); eZSession::triggerCallback( 'regenerate_pre', array( $db, $escNewKey, $escOldKey, $escUserID ) ); $db->query( "UPDATE ezsession SET session_key='$escNewKey', user_id='$escUserID' WHERE session_key='$escOldKey'" ); $db->query( "UPDATE ezbasket SET session_id='$escNewKey' WHERE session_id='$escOldKey'" ); eZSession::triggerCallback( 'regenerate_post', array( $db, $escNewKey, $escOldKey, $escUserID ) ); } return true; }
[ "public", "function", "regenerate", "(", "$", "updateBackendData", "=", "true", ")", "{", "$", "oldSessionId", "=", "session_id", "(", ")", ";", "session_regenerate_id", "(", ")", ";", "$", "newSessionId", "=", "session_id", "(", ")", ";", "ezpEvent", "::", ...
Regenerate session id @param bool $updateBackendData (true if we want to keep session data with the new session id) @return bool
[ "Regenerate", "session", "id" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlerdb.php#L155-L182
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlerdb.php
ezpSessionHandlerDB.deleteByUserIDs
public function deleteByUserIDs( array $userIDArray ) { // re use destroy to make sure it works with callbacks $db = eZDB::instance(); $userINString = $db->generateSQLINStatement( $userIDArray, 'user_id', false, false, 'int' ); $rows = $db->arrayQuery( "SELECT session_key FROM ezsession WHERE $userINString" ); foreach ( $rows as $row ) { $this->destroy( $row['session_key'] ); } }
php
public function deleteByUserIDs( array $userIDArray ) { // re use destroy to make sure it works with callbacks $db = eZDB::instance(); $userINString = $db->generateSQLINStatement( $userIDArray, 'user_id', false, false, 'int' ); $rows = $db->arrayQuery( "SELECT session_key FROM ezsession WHERE $userINString" ); foreach ( $rows as $row ) { $this->destroy( $row['session_key'] ); } }
[ "public", "function", "deleteByUserIDs", "(", "array", "$", "userIDArray", ")", "{", "// re use destroy to make sure it works with callbacks", "$", "db", "=", "eZDB", "::", "instance", "(", ")", ";", "$", "userINString", "=", "$", "db", "->", "generateSQLINStatement...
Remove all session data for a specific user @param array(int) $userIDArray
[ "Remove", "all", "session", "data", "for", "a", "specific", "user" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlerdb.php#L260-L270
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/content_renderer.php
ezpRestContentRenderer.createRenderer
protected static function createRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller ) { $rendererOptions = new ezpExtensionOptions(); $rendererOptions->iniFile = 'rest.ini'; $rendererOptions->iniSection = 'OutputSettings'; $rendererOptions->iniVariable = 'RendererClass'; $rendererOptions->handlerIndex = $renderer; $rendererOptions->handlerParams = array( $content, $controller ); $rendererInstance = eZExtension::getHandlerClass( $rendererOptions ); if ( !( $rendererInstance instanceof ezpRestContentRendererInterface ) ) throw new ezpRestContentRendererNotFoundException( $renderer ); return $rendererInstance; }
php
protected static function createRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller ) { $rendererOptions = new ezpExtensionOptions(); $rendererOptions->iniFile = 'rest.ini'; $rendererOptions->iniSection = 'OutputSettings'; $rendererOptions->iniVariable = 'RendererClass'; $rendererOptions->handlerIndex = $renderer; $rendererOptions->handlerParams = array( $content, $controller ); $rendererInstance = eZExtension::getHandlerClass( $rendererOptions ); if ( !( $rendererInstance instanceof ezpRestContentRendererInterface ) ) throw new ezpRestContentRendererNotFoundException( $renderer ); return $rendererInstance; }
[ "protected", "static", "function", "createRenderer", "(", "$", "renderer", ",", "ezpContent", "$", "content", ",", "ezpRestMvcController", "$", "controller", ")", "{", "$", "rendererOptions", "=", "new", "ezpExtensionOptions", "(", ")", ";", "$", "rendererOptions"...
Returns ezpRestContentProviderInterface object for requested renderer @param string $renderer @param ezpContent $content @return ezpRestContentProviderInterface
[ "Returns", "ezpRestContentProviderInterface", "object", "for", "requested", "renderer" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/content_renderer.php#L27-L42
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/content_renderer.php
ezpRestContentRenderer.getRenderer
public static function getRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller ) { // If no content renderer has been given, we fall back to built-in 'xhtml' renderer. // Note: empty string is not a valid input. if ( empty( $renderer ) ) { $renderer = self::DEFAULT_RENDERER; } if ( !( self::$renderer instanceof ezpRestContentProviderInterface ) ) { self::$renderer = self::createRenderer( $renderer, $content, $controller ); } return self::$renderer; }
php
public static function getRenderer( $renderer, ezpContent $content, ezpRestMvcController $controller ) { // If no content renderer has been given, we fall back to built-in 'xhtml' renderer. // Note: empty string is not a valid input. if ( empty( $renderer ) ) { $renderer = self::DEFAULT_RENDERER; } if ( !( self::$renderer instanceof ezpRestContentProviderInterface ) ) { self::$renderer = self::createRenderer( $renderer, $content, $controller ); } return self::$renderer; }
[ "public", "static", "function", "getRenderer", "(", "$", "renderer", ",", "ezpContent", "$", "content", ",", "ezpRestMvcController", "$", "controller", ")", "{", "// If no content renderer has been given, we fall back to built-in 'xhtml' renderer.", "// Note: empty string is not ...
Returns ezpRestContentProviderInterface object for given renderer and content @static @param string $renderer @param ezpContent $content @return bool|ezpRestContentProviderInterface
[ "Returns", "ezpRestContentProviderInterface", "object", "for", "given", "renderer", "and", "content" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/content_renderer.php#L52-L67
train
ezsystems/ezpublish-legacy
kernel/private/api/content/location.php
ezpContentLocation.fetchByNodeId
public static function fetchByNodeId( $nodeId ) { $node = eZContentObjectTreeNode::fetch( $nodeId ); if ( $node instanceof eZContentObjectTreeNode ) { return self::fromNode( $node ); } else { // @TODO Currently this exception is only in rest package. Needs to be fixed. throw new ezpContentNotFoundException( "Unable to find node with ID $nodeId" ); } }
php
public static function fetchByNodeId( $nodeId ) { $node = eZContentObjectTreeNode::fetch( $nodeId ); if ( $node instanceof eZContentObjectTreeNode ) { return self::fromNode( $node ); } else { // @TODO Currently this exception is only in rest package. Needs to be fixed. throw new ezpContentNotFoundException( "Unable to find node with ID $nodeId" ); } }
[ "public", "static", "function", "fetchByNodeId", "(", "$", "nodeId", ")", "{", "$", "node", "=", "eZContentObjectTreeNode", "::", "fetch", "(", "$", "nodeId", ")", ";", "if", "(", "$", "node", "instanceof", "eZContentObjectTreeNode", ")", "{", "return", "sel...
Returns the ezpContentLocation object for a particular node by ID @param int $nodeId @return ezpContentLocation @throws ezcBaseException When the node is not found
[ "Returns", "the", "ezpContentLocation", "object", "for", "a", "particular", "node", "by", "ID" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/api/content/location.php#L28-L40
train
ezsystems/ezpublish-legacy
lib/ezsession/classes/ezpsessionhandlersymfony.php
ezpSessionHandlerSymfony.sessionStart
public function sessionStart() { if ( $this->storage && !$this->storage->isStarted() ) { $this->storage->start(); } return true; }
php
public function sessionStart() { if ( $this->storage && !$this->storage->isStarted() ) { $this->storage->start(); } return true; }
[ "public", "function", "sessionStart", "(", ")", "{", "if", "(", "$", "this", "->", "storage", "&&", "!", "$", "this", "->", "storage", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "storage", "->", "start", "(", ")", ";", "}", "return",...
Let Symfony starts the session @return bool
[ "Let", "Symfony", "starts", "the", "session" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezsession/classes/ezpsessionhandlersymfony.php#L145-L153
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexpiryhandler.php
eZExpiryHandler.restore
function restore() { $Timestamps = $this->CacheFile->processFile( array( $this, 'fetchData' ) ); if ( $Timestamps === false ) { $errMsg = 'Fatal error - could not restore expiry.php file.'; eZDebug::writeError( $errMsg, __METHOD__ ); trigger_error( $errMsg, E_USER_ERROR ); } $this->Timestamps = $Timestamps; $this->IsModified = false; }
php
function restore() { $Timestamps = $this->CacheFile->processFile( array( $this, 'fetchData' ) ); if ( $Timestamps === false ) { $errMsg = 'Fatal error - could not restore expiry.php file.'; eZDebug::writeError( $errMsg, __METHOD__ ); trigger_error( $errMsg, E_USER_ERROR ); } $this->Timestamps = $Timestamps; $this->IsModified = false; }
[ "function", "restore", "(", ")", "{", "$", "Timestamps", "=", "$", "this", "->", "CacheFile", "->", "processFile", "(", "array", "(", "$", "this", ",", "'fetchData'", ")", ")", ";", "if", "(", "$", "Timestamps", "===", "false", ")", "{", "$", "errMsg...
Load the expiry timestamps from cache @return void
[ "Load", "the", "expiry", "timestamps", "from", "cache" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexpiryhandler.php#L32-L44
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexpiryhandler.php
eZExpiryHandler.store
function store() { if ( !$this->IsModified ) { return; } // EZP-23908: Restore timestamps before saving, to reduce chance of race condition issues $modifiedTimestamps = $this->Timestamps; $this->restore(); // Apply timestamps that have been added or modified in this process foreach ( $modifiedTimestamps as $name => $value ) { if ( $value > self::getTimestamp( $name, 0 ) ) { $this->setTimestamp( $name, $value ); } } if ( $this->IsModified ) { $this->CacheFile->storeContents( "<?php\n\$Timestamps = " . var_export( $this->Timestamps, true ) . ";\n?>", 'expirycache', false, true ); $this->IsModified = false; } }
php
function store() { if ( !$this->IsModified ) { return; } // EZP-23908: Restore timestamps before saving, to reduce chance of race condition issues $modifiedTimestamps = $this->Timestamps; $this->restore(); // Apply timestamps that have been added or modified in this process foreach ( $modifiedTimestamps as $name => $value ) { if ( $value > self::getTimestamp( $name, 0 ) ) { $this->setTimestamp( $name, $value ); } } if ( $this->IsModified ) { $this->CacheFile->storeContents( "<?php\n\$Timestamps = " . var_export( $this->Timestamps, true ) . ";\n?>", 'expirycache', false, true ); $this->IsModified = false; } }
[ "function", "store", "(", ")", "{", "if", "(", "!", "$", "this", "->", "IsModified", ")", "{", "return", ";", "}", "// EZP-23908: Restore timestamps before saving, to reduce chance of race condition issues", "$", "modifiedTimestamps", "=", "$", "this", "->", "Timestam...
Stores the current timestamps values to cache
[ "Stores", "the", "current", "timestamps", "values", "to", "cache" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexpiryhandler.php#L59-L84
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexpiryhandler.php
eZExpiryHandler.setTimestamp
function setTimestamp( $name, $value ) { $this->Timestamps[$name] = $value; $this->IsModified = true; }
php
function setTimestamp( $name, $value ) { $this->Timestamps[$name] = $value; $this->IsModified = true; }
[ "function", "setTimestamp", "(", "$", "name", ",", "$", "value", ")", "{", "$", "this", "->", "Timestamps", "[", "$", "name", "]", "=", "$", "value", ";", "$", "this", "->", "IsModified", "=", "true", ";", "}" ]
Sets the expiry timestamp for a key @param string $name Expiry key @param int $value Expiry timestamp value
[ "Sets", "the", "expiry", "timestamp", "for", "a", "key" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexpiryhandler.php#L92-L96
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexpiryhandler.php
eZExpiryHandler.timestamp
function timestamp( $name ) { if ( !isset( $this->Timestamps[$name] ) ) { eZDebug::writeError( "Unknown expiry timestamp called '$name'", __METHOD__ ); return false; } return $this->Timestamps[$name]; }
php
function timestamp( $name ) { if ( !isset( $this->Timestamps[$name] ) ) { eZDebug::writeError( "Unknown expiry timestamp called '$name'", __METHOD__ ); return false; } return $this->Timestamps[$name]; }
[ "function", "timestamp", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "Timestamps", "[", "$", "name", "]", ")", ")", "{", "eZDebug", "::", "writeError", "(", "\"Unknown expiry timestamp called '$name'\"", ",", "__METHOD__", ...
Returns the expiry timestamp for a key @param string $name Expiry key @return int|false The timestamp if it exists, false otherwise
[ "Returns", "the", "expiry", "timestamp", "for", "a", "key" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexpiryhandler.php#L117-L125
train
ezsystems/ezpublish-legacy
lib/ezutils/classes/ezexpiryhandler.php
eZExpiryHandler.getTimestamp
static function getTimestamp( $name, $default = false ) { $handler = eZExpiryHandler::instance(); if ( !isset( $handler->Timestamps[$name] ) ) { return $default; } return $handler->Timestamps[$name]; }
php
static function getTimestamp( $name, $default = false ) { $handler = eZExpiryHandler::instance(); if ( !isset( $handler->Timestamps[$name] ) ) { return $default; } return $handler->Timestamps[$name]; }
[ "static", "function", "getTimestamp", "(", "$", "name", ",", "$", "default", "=", "false", ")", "{", "$", "handler", "=", "eZExpiryHandler", "::", "instance", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "handler", "->", "Timestamps", "[", "$", ...
Returns the expiry timestamp for a key, or a default value if it isn't set @param string $name Expiry key name @param int $default Default value that will be returned if the key isn't set @return mixed The expiry timestamp, or $default
[ "Returns", "the", "expiry", "timestamp", "for", "a", "key", "or", "a", "default", "value", "if", "it", "isn", "t", "set" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezutils/classes/ezexpiryhandler.php#L135-L143
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/auth/native_user_authfilter.php
ezpNativeUserAuthFilter.run
public function run( $credentials ) { $status = self::STATUS_INVALID_USER; $count = eZPersistentObject::count( eZUser::definition(), array( 'contentobject_id' => (int)$credentials->id ) ); if ( $count > 0 ) { $status = self::STATUS_OK; } return $status; }
php
public function run( $credentials ) { $status = self::STATUS_INVALID_USER; $count = eZPersistentObject::count( eZUser::definition(), array( 'contentobject_id' => (int)$credentials->id ) ); if ( $count > 0 ) { $status = self::STATUS_OK; } return $status; }
[ "public", "function", "run", "(", "$", "credentials", ")", "{", "$", "status", "=", "self", "::", "STATUS_INVALID_USER", ";", "$", "count", "=", "eZPersistentObject", "::", "count", "(", "eZUser", "::", "definition", "(", ")", ",", "array", "(", "'contento...
Will check if UserID provided in credentials is valid @see ezcAuthenticationFilter::run()
[ "Will", "check", "if", "UserID", "provided", "in", "credentials", "is", "valid" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/auth/native_user_authfilter.php#L18-L28
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpextension.php
ezpExtension.getInstance
public static function getInstance( $name ) { if (! isset( self::$instances[$name] ) ) self::$instances[$name] = new self( $name ); return self::$instances[$name]; }
php
public static function getInstance( $name ) { if (! isset( self::$instances[$name] ) ) self::$instances[$name] = new self( $name ); return self::$instances[$name]; }
[ "public", "static", "function", "getInstance", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "self", "::", "$", "instances", "[", "$", "name", "]", ")", ")", "self", "::", "$", "instances", "[", "$", "name", "]", "=", "new", "self", "...
ezpExtension constructor. @see $instances @param string $name Name of the extension @return ezpExtension
[ "ezpExtension", "constructor", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpextension.php#L43-L49
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpextension.php
ezpExtension.getLoadingOrder
public function getLoadingOrder() { $return = array( 'before' => array(), 'after' => array() ); if ( is_readable( $XMLDependencyFile = eZExtension::baseDirectory() . "/{$this->name}/extension.xml" ) ) { libxml_use_internal_errors( true ); $xml = simplexml_load_file( $XMLDependencyFile ); // xml parsing error if ( $xml === false ) { eZDebug::writeError( libxml_get_errors(), "ezpExtension( {$this->name} )::getLoadingOrder()" ); return null; } foreach ( $xml->dependencies as $dependenciesNode ) { foreach ( $dependenciesNode as $dependencyType => $dependenciesNode ) { switch ( $dependencyType ) { case 'requires': $relationship = 'after'; break; case 'uses': $relationship = 'after'; break; case 'extends': $relationship = 'before'; break; } foreach ( $dependenciesNode as $dependency ) { $return[$relationship][] = (string)$dependency['name']; } } } } return $return; }
php
public function getLoadingOrder() { $return = array( 'before' => array(), 'after' => array() ); if ( is_readable( $XMLDependencyFile = eZExtension::baseDirectory() . "/{$this->name}/extension.xml" ) ) { libxml_use_internal_errors( true ); $xml = simplexml_load_file( $XMLDependencyFile ); // xml parsing error if ( $xml === false ) { eZDebug::writeError( libxml_get_errors(), "ezpExtension( {$this->name} )::getLoadingOrder()" ); return null; } foreach ( $xml->dependencies as $dependenciesNode ) { foreach ( $dependenciesNode as $dependencyType => $dependenciesNode ) { switch ( $dependencyType ) { case 'requires': $relationship = 'after'; break; case 'uses': $relationship = 'after'; break; case 'extends': $relationship = 'before'; break; } foreach ( $dependenciesNode as $dependency ) { $return[$relationship][] = (string)$dependency['name']; } } } } return $return; }
[ "public", "function", "getLoadingOrder", "(", ")", "{", "$", "return", "=", "array", "(", "'before'", "=>", "array", "(", ")", ",", "'after'", "=>", "array", "(", ")", ")", ";", "if", "(", "is_readable", "(", "$", "XMLDependencyFile", "=", "eZExtension",...
Returns the loading order informations from extension.xml @return array array( before => array( a, b ), after => array( c, d ) ) or an empty array if not available
[ "Returns", "the", "loading", "order", "informations", "from", "extension", ".", "xml" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpextension.php#L56-L98
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpextension.php
ezpExtension.getInfo
public function getInfo() { // try extension.xml first if ( is_readable( $XMLFilePath = eZExtension::baseDirectory() . "/{$this->name}/extension.xml" ) ) { $infoFields = array( 'name', 'description', 'version', 'copyright', 'author', 'license', 'info_url' ); libxml_use_internal_errors( true ); $xml = simplexml_load_file( $XMLFilePath ); // xml parsing error if ( $xml === false ) { eZDebug::writeError( libxml_get_errors(), "ezpExtension({$this->name})::getInfo()" ); return null; } $return = array(); $metadataNode = $xml->metadata; // standard extension metadata foreach ( $infoFields as $field ) { if ( (string)$metadataNode->$field !== '' ) $return[$field] = (string)$metadataNode->$field; } // 3rd party software if ( !$metadataNode->software->uses ) return $return; $index = 1; foreach ( $metadataNode->software->uses as $software ) { $label = "Includes the following third-party software"; if ( $index > 1 ) $label .= " (" . $index . ")"; foreach ( $infoFields as $field ) { if ( (string)$software->$field !== '' ) $return[$label][$field] = (string)$software->$field; } $index++; } return $return; } // then try ezinfo.php, for backwards compatibility elseif ( is_readable( $infoFilePath = eZExtension::baseDirectory() . "/{$this->name}/ezinfo.php" ) ) { include_once( $infoFilePath ); $className = $this->name . 'Info'; if ( is_callable( array( $className, 'info' ) ) ) { $result = call_user_func_array( array( $className, 'info' ), array() ); if ( is_array( $result ) ) { return $result; } } } else { return null; } }
php
public function getInfo() { // try extension.xml first if ( is_readable( $XMLFilePath = eZExtension::baseDirectory() . "/{$this->name}/extension.xml" ) ) { $infoFields = array( 'name', 'description', 'version', 'copyright', 'author', 'license', 'info_url' ); libxml_use_internal_errors( true ); $xml = simplexml_load_file( $XMLFilePath ); // xml parsing error if ( $xml === false ) { eZDebug::writeError( libxml_get_errors(), "ezpExtension({$this->name})::getInfo()" ); return null; } $return = array(); $metadataNode = $xml->metadata; // standard extension metadata foreach ( $infoFields as $field ) { if ( (string)$metadataNode->$field !== '' ) $return[$field] = (string)$metadataNode->$field; } // 3rd party software if ( !$metadataNode->software->uses ) return $return; $index = 1; foreach ( $metadataNode->software->uses as $software ) { $label = "Includes the following third-party software"; if ( $index > 1 ) $label .= " (" . $index . ")"; foreach ( $infoFields as $field ) { if ( (string)$software->$field !== '' ) $return[$label][$field] = (string)$software->$field; } $index++; } return $return; } // then try ezinfo.php, for backwards compatibility elseif ( is_readable( $infoFilePath = eZExtension::baseDirectory() . "/{$this->name}/ezinfo.php" ) ) { include_once( $infoFilePath ); $className = $this->name . 'Info'; if ( is_callable( array( $className, 'info' ) ) ) { $result = call_user_func_array( array( $className, 'info' ), array() ); if ( is_array( $result ) ) { return $result; } } } else { return null; } }
[ "public", "function", "getInfo", "(", ")", "{", "// try extension.xml first", "if", "(", "is_readable", "(", "$", "XMLFilePath", "=", "eZExtension", "::", "baseDirectory", "(", ")", ".", "\"/{$this->name}/extension.xml\"", ")", ")", "{", "$", "infoFields", "=", ...
Returns the extension informations Uses extension.xml by default, then tries ezinfo.php for backwards compatibility @since 4.4 @return array|null array of extension informations, or null if no source exists
[ "Returns", "the", "extension", "informations", "Uses", "extension", ".", "xml", "by", "default", "then", "tries", "ezinfo", ".", "php", "for", "backwards", "compatibility" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpextension.php#L107-L171
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpevent.php
ezpEvent.registerEventListeners
public function registerEventListeners() { if ( $this->loadGlobalEvents ) { $listeners = eZINI::instance()->variable( 'Event', 'Listeners' ); foreach ( $listeners as $listener ) { // $listener may be empty if some override logic has been involved if ( $listener == "" ) { continue; } // format from ini is seperated by @ list( $event, $callback ) = explode( '@', $listener ); $this->attach( $event, $callback ); } } }
php
public function registerEventListeners() { if ( $this->loadGlobalEvents ) { $listeners = eZINI::instance()->variable( 'Event', 'Listeners' ); foreach ( $listeners as $listener ) { // $listener may be empty if some override logic has been involved if ( $listener == "" ) { continue; } // format from ini is seperated by @ list( $event, $callback ) = explode( '@', $listener ); $this->attach( $event, $callback ); } } }
[ "public", "function", "registerEventListeners", "(", ")", "{", "if", "(", "$", "this", "->", "loadGlobalEvents", ")", "{", "$", "listeners", "=", "eZINI", "::", "instance", "(", ")", "->", "variable", "(", "'Event'", ",", "'Listeners'", ")", ";", "foreach"...
Registers the event listeners defined the site.ini files.
[ "Registers", "the", "event", "listeners", "defined", "the", "site", ".", "ini", "files", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpevent.php#L64-L82
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpevent.php
ezpEvent.attach
public function attach( $name, $listener ) { $id = self::$listenerIdNumber++; // explode callback if static class string, workaround for PHP < 5.2.3 if ( is_string( $listener ) && strpos( $listener, '::' ) !== false ) { $listener = explode( '::', $listener ); } $this->listeners[$name][$id] = $listener; return $id; }
php
public function attach( $name, $listener ) { $id = self::$listenerIdNumber++; // explode callback if static class string, workaround for PHP < 5.2.3 if ( is_string( $listener ) && strpos( $listener, '::' ) !== false ) { $listener = explode( '::', $listener ); } $this->listeners[$name][$id] = $listener; return $id; }
[ "public", "function", "attach", "(", "$", "name", ",", "$", "listener", ")", "{", "$", "id", "=", "self", "::", "$", "listenerIdNumber", "++", ";", "// explode callback if static class string, workaround for PHP < 5.2.3", "if", "(", "is_string", "(", "$", "listene...
Attach an event listener at run time on demand. @param string $name In the form "content/delete/1" or "content/delete" @param array|string $listener A valid PHP callback {@see http://php.net/manual/en/language.pseudo-types.php#language.types.callback} @return int Listener id, can be used to detach a listener later {@see detach()}
[ "Attach", "an", "event", "listener", "at", "run", "time", "on", "demand", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpevent.php#L91-L102
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpevent.php
ezpEvent.detach
public function detach( $name, $id ) { if ( !isset( $this->listeners[$name][$id] ) ) { return false; } unset( $this->listeners[$name][$id] ); return true; }
php
public function detach( $name, $id ) { if ( !isset( $this->listeners[$name][$id] ) ) { return false; } unset( $this->listeners[$name][$id] ); return true; }
[ "public", "function", "detach", "(", "$", "name", ",", "$", "id", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "listeners", "[", "$", "name", "]", "[", "$", "id", "]", ")", ")", "{", "return", "false", ";", "}", "unset", "(", "$...
Detach an event listener by id given when it was added. @param string $name @param int $id The unique id given by {@see attach()} @return bool True if the listener has been correctly detached
[ "Detach", "an", "event", "listener", "by", "id", "given", "when", "it", "was", "added", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpevent.php#L111-L120
train
ezsystems/ezpublish-legacy
kernel/private/classes/ezpevent.php
ezpEvent.notify
public function notify( $name, array $params = array() ) { if ( empty( $this->listeners[$name] ) ) { return false; } foreach ( $this->listeners[$name] as $listener ) { call_user_func_array( $listener, $params ); } return true; }
php
public function notify( $name, array $params = array() ) { if ( empty( $this->listeners[$name] ) ) { return false; } foreach ( $this->listeners[$name] as $listener ) { call_user_func_array( $listener, $params ); } return true; }
[ "public", "function", "notify", "(", "$", "name", ",", "array", "$", "params", "=", "array", "(", ")", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "listeners", "[", "$", "name", "]", ")", ")", "{", "return", "false", ";", "}", "foreach"...
Notify all listeners of an event @param string $name In the form "content/delete/1", "content/delete", "content/read" @param array $params The arguments for the specific event as simple array structure (not hash) @return bool True if some listener where called
[ "Notify", "all", "listeners", "of", "an", "event" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/ezpevent.php#L129-L141
train
ezsystems/ezpublish-legacy
kernel/classes/ezsitedata.php
eZSiteData.fetchByName
public static function fetchByName( $name ) { $result = parent::fetchObject( self::definition(), null, array( 'name' => $name ) ); return $result; }
php
public static function fetchByName( $name ) { $result = parent::fetchObject( self::definition(), null, array( 'name' => $name ) ); return $result; }
[ "public", "static", "function", "fetchByName", "(", "$", "name", ")", "{", "$", "result", "=", "parent", "::", "fetchObject", "(", "self", "::", "definition", "(", ")", ",", "null", ",", "array", "(", "'name'", "=>", "$", "name", ")", ")", ";", "retu...
Fetches a site data by name @param string $name @return eZPersistentObject
[ "Fetches", "a", "site", "data", "by", "name" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezsitedata.php#L67-L71
train
ezsystems/ezpublish-legacy
kernel/private/eztemplate/ezpattributeoperatorhtmlformatter.php
ezpAttributeOperatorHTMLFormatter.line
public function line( $key, $item, $showValues, $level ) { $type = $this->getType( $item ); $value = $this->getValue( $item ); $spacing = str_repeat( "&gt;", $level ); if ( $showValues ) $output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n<td>{$value}</td>\n</tr>\n"; else $output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n</tr>\n"; return $output; }
php
public function line( $key, $item, $showValues, $level ) { $type = $this->getType( $item ); $value = $this->getValue( $item ); $spacing = str_repeat( "&gt;", $level ); if ( $showValues ) $output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n<td>{$value}</td>\n</tr>\n"; else $output = "<tr><td>{$spacing}{$key}</td>\n<td>{$type}</td>\n</tr>\n"; return $output; }
[ "public", "function", "line", "(", "$", "key", ",", "$", "item", ",", "$", "showValues", ",", "$", "level", ")", "{", "$", "type", "=", "$", "this", "->", "getType", "(", "$", "item", ")", ";", "$", "value", "=", "$", "this", "->", "getValue", ...
Formats single line for the 'attribute' template operator output @param string $key @param mixed $item @param bool $showValues @param int $level @return string
[ "Formats", "single", "line", "for", "the", "attribute", "template", "operator", "output" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/eztemplate/ezpattributeoperatorhtmlformatter.php#L39-L51
train
ezsystems/ezpublish-legacy
lib/ezdbschema/classes/ezdbschema.php
eZDbSchema.instance
static function instance( $params = false ) { if ( is_object( $params ) ) { $db = $params; $params = array( 'instance' => $db ); } if ( !isset( $params['instance'] ) ) { $db = eZDB::instance(); $params['instance'] = $db; } $db = $params['instance']; if ( !isset( $params['type'] ) ) $params['type'] = $db->databaseName(); if ( !isset( $params['schema'] ) ) $params['schema'] = false; $dbname = $params['type']; /* Load the database schema handler INI stuff */ $ini = eZINI::instance( 'dbschema.ini' ); $schemaPaths = $ini->variable( 'SchemaSettings', 'SchemaPaths' ); $schemaHandlerClasses = $ini->variable( 'SchemaSettings', 'SchemaHandlerClasses' ); /* Check if we have a handler */ if ( !isset( $schemaPaths[$dbname] ) or !isset( $schemaHandlerClasses[$dbname] ) ) { eZDebug::writeError( "No schema handler for database type: $dbname", __METHOD__ ); return false; } /* Include the schema file and instantiate it */ require_once( $schemaPaths[$dbname] ); return new $schemaHandlerClasses[$dbname]( $params ); }
php
static function instance( $params = false ) { if ( is_object( $params ) ) { $db = $params; $params = array( 'instance' => $db ); } if ( !isset( $params['instance'] ) ) { $db = eZDB::instance(); $params['instance'] = $db; } $db = $params['instance']; if ( !isset( $params['type'] ) ) $params['type'] = $db->databaseName(); if ( !isset( $params['schema'] ) ) $params['schema'] = false; $dbname = $params['type']; /* Load the database schema handler INI stuff */ $ini = eZINI::instance( 'dbschema.ini' ); $schemaPaths = $ini->variable( 'SchemaSettings', 'SchemaPaths' ); $schemaHandlerClasses = $ini->variable( 'SchemaSettings', 'SchemaHandlerClasses' ); /* Check if we have a handler */ if ( !isset( $schemaPaths[$dbname] ) or !isset( $schemaHandlerClasses[$dbname] ) ) { eZDebug::writeError( "No schema handler for database type: $dbname", __METHOD__ ); return false; } /* Include the schema file and instantiate it */ require_once( $schemaPaths[$dbname] ); return new $schemaHandlerClasses[$dbname]( $params ); }
[ "static", "function", "instance", "(", "$", "params", "=", "false", ")", "{", "if", "(", "is_object", "(", "$", "params", ")", ")", "{", "$", "db", "=", "$", "params", ";", "$", "params", "=", "array", "(", "'instance'", "=>", "$", "db", ")", ";"...
Returns a shared instance of the eZDBSchemaInterface class. @param array|eZDBInterface|false $params If array, following key is needed: - instance: the eZDB instance (optional), if none provided, eZDB::instance() will be used. @return eZDBSchemaInterface|false
[ "Returns", "a", "shared", "instance", "of", "the", "eZDBSchemaInterface", "class", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdbschema/classes/ezdbschema.php#L27-L65
train
ezsystems/ezpublish-legacy
lib/ezdbschema/classes/ezdbschema.php
eZDbSchema.merge
static function merge( $schema1, $schema2 ) { $merged = $schema1; foreach( $schema2 as $tablename => $tabledef ) { if ( $tablename != '_info' ) { $merged[$tablename] = $tabledef; } } return $merged; }
php
static function merge( $schema1, $schema2 ) { $merged = $schema1; foreach( $schema2 as $tablename => $tabledef ) { if ( $tablename != '_info' ) { $merged[$tablename] = $tabledef; } } return $merged; }
[ "static", "function", "merge", "(", "$", "schema1", ",", "$", "schema2", ")", "{", "$", "merged", "=", "$", "schema1", ";", "foreach", "(", "$", "schema2", "as", "$", "tablename", "=>", "$", "tabledef", ")", "{", "if", "(", "$", "tablename", "!=", ...
Merges 2 db schemas, basically appending 2nd on top of 1st @return array the merged schema
[ "Merges", "2", "db", "schemas", "basically", "appending", "2nd", "on", "top", "of", "1st" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezdbschema/classes/ezdbschema.php#L148-L159
train
ezsystems/ezpublish-legacy
kernel/classes/ezcollaborationviewhandler.php
eZCollaborationViewHandler.instance
static function instance( $viewMode, $type = self::TYPE_STANDARD ) { if ( $type == self::TYPE_STANDARD ) $instance =& $GLOBALS["eZCollaborationView"][$viewMode]; else if ( $type == self::TYPE_GROUP ) $instance =& $GLOBALS["eZCollaborationGroupView"][$viewMode]; else { return null; } if ( !isset( $instance ) ) { $instance = new eZCollaborationViewHandler( $viewMode, $type ); } return $instance; }
php
static function instance( $viewMode, $type = self::TYPE_STANDARD ) { if ( $type == self::TYPE_STANDARD ) $instance =& $GLOBALS["eZCollaborationView"][$viewMode]; else if ( $type == self::TYPE_GROUP ) $instance =& $GLOBALS["eZCollaborationGroupView"][$viewMode]; else { return null; } if ( !isset( $instance ) ) { $instance = new eZCollaborationViewHandler( $viewMode, $type ); } return $instance; }
[ "static", "function", "instance", "(", "$", "viewMode", ",", "$", "type", "=", "self", "::", "TYPE_STANDARD", ")", "{", "if", "(", "$", "type", "==", "self", "::", "TYPE_STANDARD", ")", "$", "instance", "=", "&", "$", "GLOBALS", "[", "\"eZCollaborationVi...
Returns a shared instance of the eZCollaborationViewHandler class pr the two input params. @param string $viewMode @param int $type Is self::TYPE_STANDARD by default @return eZCollaborationViewHandler
[ "Returns", "a", "shared", "instance", "of", "the", "eZCollaborationViewHandler", "class", "pr", "the", "two", "input", "params", "." ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezcollaborationviewhandler.php#L115-L130
train
ezsystems/ezpublish-legacy
kernel/private/rest/classes/ezpkernelrest.php
ezpKernelRest.shutdown
protected function shutdown( $reInitialize = true ) { eZExecution::cleanup(); eZExecution::setCleanExit(); eZExpiryHandler::shutdown(); if ( $reInitialize ) $this->isInitialized = false; }
php
protected function shutdown( $reInitialize = true ) { eZExecution::cleanup(); eZExecution::setCleanExit(); eZExpiryHandler::shutdown(); if ( $reInitialize ) $this->isInitialized = false; }
[ "protected", "function", "shutdown", "(", "$", "reInitialize", "=", "true", ")", "{", "eZExecution", "::", "cleanup", "(", ")", ";", "eZExecution", "::", "setCleanExit", "(", ")", ";", "eZExpiryHandler", "::", "shutdown", "(", ")", ";", "if", "(", "$", "...
Runs the shutdown process
[ "Runs", "the", "shutdown", "process" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/rest/classes/ezpkernelrest.php#L226-L233
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/dfsbackends/dfs.php
eZDFSFileHandlerDFSBackend.existsOnDFS
public function existsOnDFS( $filePath ) { if ( file_exists( $this->makeDFSPath( $filePath ) ) ) { return true; } // Verify that mount point is still there $filePathDir = substr( $filePath, 0, strpos( $filePath, '/' ) + 1 ); $path = realpath( $this->getMountPoint() ). '/' . $filePathDir; if ( !file_exists( $path ) || !is_dir( $path ) ) { throw new eZDFSFileHandlerBackendException( "NFS mount root $path not found" ); } return false; }
php
public function existsOnDFS( $filePath ) { if ( file_exists( $this->makeDFSPath( $filePath ) ) ) { return true; } // Verify that mount point is still there $filePathDir = substr( $filePath, 0, strpos( $filePath, '/' ) + 1 ); $path = realpath( $this->getMountPoint() ). '/' . $filePathDir; if ( !file_exists( $path ) || !is_dir( $path ) ) { throw new eZDFSFileHandlerBackendException( "NFS mount root $path not found" ); } return false; }
[ "public", "function", "existsOnDFS", "(", "$", "filePath", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "makeDFSPath", "(", "$", "filePath", ")", ")", ")", "{", "return", "true", ";", "}", "// Verify that mount point is still there", "$", "fil...
Checks if a file exists on the DFS @param string $filePath @return bool
[ "Checks", "if", "a", "file", "exists", "on", "the", "DFS" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/dfsbackends/dfs.php#L285-L301
train
ezsystems/ezpublish-legacy
kernel/private/classes/clusterfilehandlers/dfsbackends/dfs.php
eZDFSFileHandlerDFSBackend.copyTimestamp
protected function copyTimestamp( $srcFilePath, $dstFilePath ) { clearstatcache( true, $srcFilePath ); $originalTimestamp = filemtime( $srcFilePath ); if ( !$originalTimestamp ) { return false; } return touch( $dstFilePath, $originalTimestamp); }
php
protected function copyTimestamp( $srcFilePath, $dstFilePath ) { clearstatcache( true, $srcFilePath ); $originalTimestamp = filemtime( $srcFilePath ); if ( !$originalTimestamp ) { return false; } return touch( $dstFilePath, $originalTimestamp); }
[ "protected", "function", "copyTimestamp", "(", "$", "srcFilePath", ",", "$", "dstFilePath", ")", "{", "clearstatcache", "(", "true", ",", "$", "srcFilePath", ")", ";", "$", "originalTimestamp", "=", "filemtime", "(", "$", "srcFilePath", ")", ";", "if", "(", ...
copies the timestamp from the original file to the destination file @param string $srcFilePath @param string $dstFilePath @return bool False if the timestamp is not set with success on target file
[ "copies", "the", "timestamp", "from", "the", "original", "file", "to", "the", "destination", "file" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/private/classes/clusterfilehandlers/dfsbackends/dfs.php#L344-L354
train
ezsystems/ezpublish-legacy
kernel/classes/ezpackage.php
eZPackage.import
static function import( $archiveName, &$packageName, $dbAvailable = true, $repositoryID = false ) { if ( is_dir( $archiveName ) ) { eZDebug::writeError( "Importing from directory is not supported." ); $retValue = false; return $retValue; } else { $tempDirPath = eZPackage::temporaryImportPath(); // make a temporary directory to extract the package file to do { $archivePath = eZDir::path( array( $tempDirPath, mt_rand() ) ); } while ( file_exists( $archivePath ) ); eZDir::mkdir( $archivePath, false, true ); $archiveOptions = new ezcArchiveOptions( array( 'readOnly' => true ) ); // Fix for issue #15891: ezjscore - file names are cutted // Force the type of the archive as ezcArchive::TAR_GNU so that long file names are supported on Windows // The previous value for the second parameter was null which meant the type was guessed from the // archive, but on Windows it was detected as TAR_USTAR and this lead to filenames being limited // to 100 characters $archive = ezcArchive::open( "compress.zlib://$archiveName", ezcArchive::TAR_GNU, $archiveOptions ); $fileList = array(); $fileList[] = eZPackage::definitionFilename(); // Search for the files we want to extract foreach( $archive as $entry ) { if ( in_array( $entry->getPath(), $fileList ) ) { if ( !$archive->extractCurrent( $archivePath ) ) { eZDebug::writeError( "Failed extracting package definition file from $archivePath" ); return false; } } } $definitionFileName = eZDir::path( array( $archivePath, self::definitionFilename() ) ); $package = eZPackage::fetchFromFile( $definitionFileName ); eZPackage::removeFiles( $archivePath ); if ( $package ) { $packageName = $package->attribute( 'name' ); if ( !self::isValidName( $packageName ) ) { return eZPackage::STATUS_INVALID_NAME; } if ( !$repositoryID ) { $repositoryID = $package->attribute( 'vendor-dir' ); } $existingPackage = eZPackage::fetch( $packageName, false, false, $dbAvailable ); if ( $existingPackage ) { return eZPackage::STATUS_ALREADY_EXISTS; } unset( $package ); $fullRepositoryPath = eZPackage::repositoryPath() . '/' . $repositoryID; $packagePath = $fullRepositoryPath . '/' . $packageName; if ( !file_exists( $packagePath ) ) { eZDir::mkdir( $packagePath, false, true ); } $archive->extract( $packagePath ); $package = eZPackage::fetch( $packageName, $fullRepositoryPath, false, $dbAvailable ); if ( !$package ) { eZDebug::writeError( "Failed loading imported package $packageName from $fullRepositoryPath" ); } } else { eZDebug::writeError( "Failed loading temporary package $packageName" ); } return $package; } }
php
static function import( $archiveName, &$packageName, $dbAvailable = true, $repositoryID = false ) { if ( is_dir( $archiveName ) ) { eZDebug::writeError( "Importing from directory is not supported." ); $retValue = false; return $retValue; } else { $tempDirPath = eZPackage::temporaryImportPath(); // make a temporary directory to extract the package file to do { $archivePath = eZDir::path( array( $tempDirPath, mt_rand() ) ); } while ( file_exists( $archivePath ) ); eZDir::mkdir( $archivePath, false, true ); $archiveOptions = new ezcArchiveOptions( array( 'readOnly' => true ) ); // Fix for issue #15891: ezjscore - file names are cutted // Force the type of the archive as ezcArchive::TAR_GNU so that long file names are supported on Windows // The previous value for the second parameter was null which meant the type was guessed from the // archive, but on Windows it was detected as TAR_USTAR and this lead to filenames being limited // to 100 characters $archive = ezcArchive::open( "compress.zlib://$archiveName", ezcArchive::TAR_GNU, $archiveOptions ); $fileList = array(); $fileList[] = eZPackage::definitionFilename(); // Search for the files we want to extract foreach( $archive as $entry ) { if ( in_array( $entry->getPath(), $fileList ) ) { if ( !$archive->extractCurrent( $archivePath ) ) { eZDebug::writeError( "Failed extracting package definition file from $archivePath" ); return false; } } } $definitionFileName = eZDir::path( array( $archivePath, self::definitionFilename() ) ); $package = eZPackage::fetchFromFile( $definitionFileName ); eZPackage::removeFiles( $archivePath ); if ( $package ) { $packageName = $package->attribute( 'name' ); if ( !self::isValidName( $packageName ) ) { return eZPackage::STATUS_INVALID_NAME; } if ( !$repositoryID ) { $repositoryID = $package->attribute( 'vendor-dir' ); } $existingPackage = eZPackage::fetch( $packageName, false, false, $dbAvailable ); if ( $existingPackage ) { return eZPackage::STATUS_ALREADY_EXISTS; } unset( $package ); $fullRepositoryPath = eZPackage::repositoryPath() . '/' . $repositoryID; $packagePath = $fullRepositoryPath . '/' . $packageName; if ( !file_exists( $packagePath ) ) { eZDir::mkdir( $packagePath, false, true ); } $archive->extract( $packagePath ); $package = eZPackage::fetch( $packageName, $fullRepositoryPath, false, $dbAvailable ); if ( !$package ) { eZDebug::writeError( "Failed loading imported package $packageName from $fullRepositoryPath" ); } } else { eZDebug::writeError( "Failed loading temporary package $packageName" ); } return $package; } }
[ "static", "function", "import", "(", "$", "archiveName", ",", "&", "$", "packageName", ",", "$", "dbAvailable", "=", "true", ",", "$", "repositoryID", "=", "false", ")", "{", "if", "(", "is_dir", "(", "$", "archiveName", ")", ")", "{", "eZDebug", "::",...
Imports a package from a gzip compressed tarball file @param string $archiveName Path to the archive file @param string $packageName Package name @param bool $dbAvailable @param bool $repositoryID @return eZPackage The eZPackage object if successfull, or one of the STATUS_* class constants if an error occurs
[ "Imports", "a", "package", "from", "a", "gzip", "compressed", "tarball", "file" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpackage.php#L1109-L1202
train
ezsystems/ezpublish-legacy
kernel/classes/ezpackage.php
eZPackage.install
function install( &$installParameters ) { if ( $this->Parameters['install_type'] != 'install' ) return; $installItems = $this->Parameters['install']; if ( !isset( $installParameters['path'] ) ) $installParameters['path'] = false; $installResult = true; foreach ( $installItems as $item ) { if ( !$this->installItem( $item, $installParameters ) ) { eZDebug::writeDebug( $item, 'item which failed installing' ); $installResult = false; } } $this->setInstalled(); return $installResult; }
php
function install( &$installParameters ) { if ( $this->Parameters['install_type'] != 'install' ) return; $installItems = $this->Parameters['install']; if ( !isset( $installParameters['path'] ) ) $installParameters['path'] = false; $installResult = true; foreach ( $installItems as $item ) { if ( !$this->installItem( $item, $installParameters ) ) { eZDebug::writeDebug( $item, 'item which failed installing' ); $installResult = false; } } $this->setInstalled(); return $installResult; }
[ "function", "install", "(", "&", "$", "installParameters", ")", "{", "if", "(", "$", "this", "->", "Parameters", "[", "'install_type'", "]", "!=", "'install'", ")", "return", ";", "$", "installItems", "=", "$", "this", "->", "Parameters", "[", "'install'",...
Installs all items in the package @param array $installParameters @return bool true if all items installed correctly, false otherwise
[ "Installs", "all", "items", "in", "the", "package" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpackage.php#L1864-L1882
train
ezsystems/ezpublish-legacy
kernel/classes/ezpackage.php
eZPackage.isValidName
static function isValidName( $packageName, &$transformedPackageName = null ) { $trans = eZCharTransform::instance(); $transformedPackageName = $trans->transformByGroup( $packageName, 'identifier' ); return $transformedPackageName === $packageName; }
php
static function isValidName( $packageName, &$transformedPackageName = null ) { $trans = eZCharTransform::instance(); $transformedPackageName = $trans->transformByGroup( $packageName, 'identifier' ); return $transformedPackageName === $packageName; }
[ "static", "function", "isValidName", "(", "$", "packageName", ",", "&", "$", "transformedPackageName", "=", "null", ")", "{", "$", "trans", "=", "eZCharTransform", "::", "instance", "(", ")", ";", "$", "transformedPackageName", "=", "$", "trans", "->", "tran...
Checks if a package name is valid @param string $packageName the package name @param string $transformedPackageName the package name, transformed to be valid @return boolean true if the package name is valid, false if not
[ "Checks", "if", "a", "package", "name", "is", "valid" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/kernel/classes/ezpackage.php#L3082-L3088
train
ezsystems/ezpublish-legacy
extension/ezjscore/autoloads/ezjscpackertemplatefunctions.php
ezjscPackerTemplateFunctions.getPersistentVariable
static public function getPersistentVariable( $key = null ) { if ( $key !== null ) { if ( isset( self::$persistentVariable[ $key ] ) ) return self::$persistentVariable[ $key ]; return null; } return self::$persistentVariable; }
php
static public function getPersistentVariable( $key = null ) { if ( $key !== null ) { if ( isset( self::$persistentVariable[ $key ] ) ) return self::$persistentVariable[ $key ]; return null; } return self::$persistentVariable; }
[ "static", "public", "function", "getPersistentVariable", "(", "$", "key", "=", "null", ")", "{", "if", "(", "$", "key", "!==", "null", ")", "{", "if", "(", "isset", "(", "self", "::", "$", "persistentVariable", "[", "$", "key", "]", ")", ")", "return...
Reusable function for getting internal persistent_variable @internal @param string $key Optional, return all values if null @return array|string
[ "Reusable", "function", "for", "getting", "internal", "persistent_variable" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/extension/ezjscore/autoloads/ezjscpackertemplatefunctions.php#L425-L434
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.pdf.php
Cpdf.o_destination
function o_destination( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'destination', 'info' => array() ); $tmp = ''; switch ( $options['type'] ) { case 'XYZ': case 'FitR': $tmp = ' ' . sprintf( '%.3F', $options['p3'] ) . $tmp; case 'FitV': case 'FitBH': case 'FitBV': $tmp = ' ' . sprintf( '%.3F', $options['p2'] ) . $tmp; case 'Fit': case 'FitH': $tmp = ' ' . sprintf( '%.3F', $options['p1'] ) . $tmp; case 'FitB': $tmp = $options['type'] . $tmp; $this->objects[$id]['info']['string'] = $tmp; $this->objects[$id]['info']['page'] = $options['page']; }break; case 'out': $tmp = $o['info']; $res = "\n" . $id . " 0 obj\n" . '[' . $tmp['page'] . ' 0 R /' . $tmp['string'] . "]\nendobj\n"; return $res; break; } }
php
function o_destination( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'destination', 'info' => array() ); $tmp = ''; switch ( $options['type'] ) { case 'XYZ': case 'FitR': $tmp = ' ' . sprintf( '%.3F', $options['p3'] ) . $tmp; case 'FitV': case 'FitBH': case 'FitBV': $tmp = ' ' . sprintf( '%.3F', $options['p2'] ) . $tmp; case 'Fit': case 'FitH': $tmp = ' ' . sprintf( '%.3F', $options['p1'] ) . $tmp; case 'FitB': $tmp = $options['type'] . $tmp; $this->objects[$id]['info']['string'] = $tmp; $this->objects[$id]['info']['page'] = $options['page']; }break; case 'out': $tmp = $o['info']; $res = "\n" . $id . " 0 obj\n" . '[' . $tmp['page'] . ' 0 R /' . $tmp['string'] . "]\nendobj\n"; return $res; break; } }
[ "function", "o_destination", "(", "$", "id", ",", "$", "action", ",", "$", "options", "=", "''", ")", "{", "if", "(", "$", "action", "!=", "'new'", ")", "{", "$", "o", "=", "&", "$", "this", "->", "objects", "[", "$", "id", "]", ";", "}", "sw...
destination object, used to specify the location for the user to jump to, presently on opening
[ "destination", "object", "used", "to", "specify", "the", "location", "for", "the", "user", "to", "jump", "to", "presently", "on", "opening" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.pdf.php#L266-L301
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.pdf.php
Cpdf.o_catalog
function o_catalog( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'catalog', 'info' => array() ); $this->catalogId = $id; break; case 'outlines': case 'pages': case 'openHere': $o['info'][$action] = $options; break; case 'viewerPreferences': if ( !isset( $o['info']['viewerPreferences'] ) ) { $this->numObj++; $this->o_viewerPreferences( $this->numObj, 'new' ); $o['info']['viewerPreferences'] = $this->numObj; } $vp = $o['info']['viewerPreferences']; $this->o_viewerPreferences( $vp, 'add', $options ); break; case 'out': $res= "\n" . $id . " 0 obj\n" . '<< /Type /Catalog'; foreach ( $o['info'] as $k => $v ) { switch ( $k ) { case 'outlines': $res .= "\n" . '/Outlines ' . $v . ' 0 R'; break; case 'pages': $res .= "\n" . '/Pages ' . $v . ' 0 R'; break; case 'viewerPreferences': $res .= "\n" . '/ViewerPreferences ' . $o['info']['viewerPreferences'] . ' 0 R'; break; case 'openHere': $res .= "\n" . '/OpenAction ' . $o['info']['openHere'] . ' 0 R'; break; } } $res .= " >>\nendobj"; return $res; break; } }
php
function o_catalog( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'catalog', 'info' => array() ); $this->catalogId = $id; break; case 'outlines': case 'pages': case 'openHere': $o['info'][$action] = $options; break; case 'viewerPreferences': if ( !isset( $o['info']['viewerPreferences'] ) ) { $this->numObj++; $this->o_viewerPreferences( $this->numObj, 'new' ); $o['info']['viewerPreferences'] = $this->numObj; } $vp = $o['info']['viewerPreferences']; $this->o_viewerPreferences( $vp, 'add', $options ); break; case 'out': $res= "\n" . $id . " 0 obj\n" . '<< /Type /Catalog'; foreach ( $o['info'] as $k => $v ) { switch ( $k ) { case 'outlines': $res .= "\n" . '/Outlines ' . $v . ' 0 R'; break; case 'pages': $res .= "\n" . '/Pages ' . $v . ' 0 R'; break; case 'viewerPreferences': $res .= "\n" . '/ViewerPreferences ' . $o['info']['viewerPreferences'] . ' 0 R'; break; case 'openHere': $res .= "\n" . '/OpenAction ' . $o['info']['openHere'] . ' 0 R'; break; } } $res .= " >>\nendobj"; return $res; break; } }
[ "function", "o_catalog", "(", "$", "id", ",", "$", "action", ",", "$", "options", "=", "''", ")", "{", "if", "(", "$", "action", "!=", "'new'", ")", "{", "$", "o", "=", "&", "$", "this", "->", "objects", "[", "$", "id", "]", ";", "}", "switch...
define the document catalog, the overall controller for the document
[ "define", "the", "document", "catalog", "the", "overall", "controller", "for", "the", "document" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.pdf.php#L348-L399
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.pdf.php
Cpdf.o_outlines
function o_outlines( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'outlines', 'info' => array( 'outlines' => array() ) ); $this->o_catalog( $this->catalogId, 'outlines', $id ); break; case 'outline': $o['info']['outlines'][] = $options; break; case 'out': if ( count( $o['info']['outlines'] ) ) { $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Kids ["; foreach ( $o['info']['outlines'] as $k => $v ) { $res .= $v . " 0 R "; } $res .= "] /Count " . count( $o['info']['outlines'] ) . " >>\nendobj"; } else { $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj"; } return $res; break; } }
php
function o_outlines( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': $this->objects[$id] = array( 't' => 'outlines', 'info' => array( 'outlines' => array() ) ); $this->o_catalog( $this->catalogId, 'outlines', $id ); break; case 'outline': $o['info']['outlines'][] = $options; break; case 'out': if ( count( $o['info']['outlines'] ) ) { $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Kids ["; foreach ( $o['info']['outlines'] as $k => $v ) { $res .= $v . " 0 R "; } $res .= "] /Count " . count( $o['info']['outlines'] ) . " >>\nendobj"; } else { $res = "\n" . $id . " 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj"; } return $res; break; } }
[ "function", "o_outlines", "(", "$", "id", ",", "$", "action", ",", "$", "options", "=", "''", ")", "{", "if", "(", "$", "action", "!=", "'new'", ")", "{", "$", "o", "=", "&", "$", "this", "->", "objects", "[", "$", "id", "]", ";", "}", "switc...
define the outlines in the doc, empty for now
[ "define", "the", "outlines", "in", "the", "doc", "empty", "for", "now" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.pdf.php#L538-L570
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.pdf.php
Cpdf.o_function
function o_function( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': { $this->objects[$id] = array ( 't' => 'function', 'info' => array() ); if ( isset( $options['type'] ) ) // Set function type { $this->objects[$id]['info']['type'] = $options['type']; } else { $this->objects[$id]['info']['type'] = '2'; } if ( isset( $options['Domain'] ) ) // Set function Domain { $this->objects[$id]['info']['Domain'] = $options['Domain']; } else { $this->objects[$id]['info']['Domain'] = '[0.0 1.0]'; } if ( $this->objects[$id]['info']['type'] == '2' ) // set start and en values { if ( isset( $options['C0'] ) ) // Set values0 { $this->objects[$id]['info']['C0'] = $options['C0']; } if ( isset( $options['C1'] ) ) // Set values1 { $this->objects[$id]['info']['C1'] = $options['C1']; } if ( isset( $options['N'] ) ) // set exponent { $this->objects[$id]['info']['N'] = $options['N']; } else { $this->objects[$id]['info']['N'] = '1.0'; } } } break; case 'out': { $res = "\n" . $id . " 0 obj\n<< "; $res.= "/FunctionType " . $o['info']['type'] . "\n"; $res.= "/Domain " . $o['info']['Domain'] . "\n"; if ( isset ( $o['info']['C0'] ) ) $res.= "/C0 " . $o['info']['C0'] . "\n"; if ( isset ( $o['info']['C1'] ) ) $res.= "/C1 " . $o['info']['C1'] . "\n"; $res.= "/N " . $o['info']['N'] . "\n"; $res.= ">>\nendobject"; return $res; } break; } }
php
function o_function( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': { $this->objects[$id] = array ( 't' => 'function', 'info' => array() ); if ( isset( $options['type'] ) ) // Set function type { $this->objects[$id]['info']['type'] = $options['type']; } else { $this->objects[$id]['info']['type'] = '2'; } if ( isset( $options['Domain'] ) ) // Set function Domain { $this->objects[$id]['info']['Domain'] = $options['Domain']; } else { $this->objects[$id]['info']['Domain'] = '[0.0 1.0]'; } if ( $this->objects[$id]['info']['type'] == '2' ) // set start and en values { if ( isset( $options['C0'] ) ) // Set values0 { $this->objects[$id]['info']['C0'] = $options['C0']; } if ( isset( $options['C1'] ) ) // Set values1 { $this->objects[$id]['info']['C1'] = $options['C1']; } if ( isset( $options['N'] ) ) // set exponent { $this->objects[$id]['info']['N'] = $options['N']; } else { $this->objects[$id]['info']['N'] = '1.0'; } } } break; case 'out': { $res = "\n" . $id . " 0 obj\n<< "; $res.= "/FunctionType " . $o['info']['type'] . "\n"; $res.= "/Domain " . $o['info']['Domain'] . "\n"; if ( isset ( $o['info']['C0'] ) ) $res.= "/C0 " . $o['info']['C0'] . "\n"; if ( isset ( $o['info']['C1'] ) ) $res.= "/C1 " . $o['info']['C1'] . "\n"; $res.= "/N " . $o['info']['N'] . "\n"; $res.= ">>\nendobject"; return $res; } break; } }
[ "function", "o_function", "(", "$", "id", ",", "$", "action", ",", "$", "options", "=", "''", ")", "{", "if", "(", "$", "action", "!=", "'new'", ")", "{", "$", "o", "=", "&", "$", "this", "->", "objects", "[", "$", "id", "]", ";", "}", "switc...
Add object to hold Function properties Only partial support for type 0, 3 and 4 \param object id. \param action \param options
[ "Add", "object", "to", "hold", "Function", "properties", "Only", "partial", "support", "for", "type", "0", "3", "and", "4" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.pdf.php#L580-L650
train
ezsystems/ezpublish-legacy
lib/ezpdf/classes/class.pdf.php
Cpdf.o_pattern
function o_pattern( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': { $this->objects[$id] = array( 't' => 'shading', 'info' => array() ); if ( isset( $options['type'] ) ) //Set pattern type { $this->objects[$id]['info']['PatternType'] = $options['type']; } else { $this->objects[$id]['info']['PatternType'] = '2'; } if ( isset( $options['matrix'] ) ) { $this->objects[$id]['info']['Matrix'] = '[ '; foreach ( $options['matrix'] as $coord ) { $this->objects[$id]['info']['Matrix'] .= sprintf( ' %.3F ', $coord ); } $this->objects[$id]['info']['Matrix'] .= ' ]'; } if ( $this->objects[$id]['info']['PatternType'] == 1 ) // Pattern type 1, tiling pattern { $this->objects[$id]['info']['PaintType'] = $options['paintType']; $this->objects[$id]['info']['TilingType'] = $options['tilingType']; $this->objects[$id]['info']['BBox'] = '[ '; foreach ( $options['bbox'] as $coord ) { $this->objects[$id]['info']['BBox'] .= sprintf( ' %.3F ', $coord ); } $this->objects[$id]['info']['BBox'] .= ']'; $this->objects[$id]['info']['XStep'] = $options['xstep']; $this->objects[$id]['info']['YStep'] = $options['ystep']; } else // Non tiling, smooth pattern. { if ( isset( $options['shading'] ) ) { $this->objects[$id]['info']['Shading'] = $options['shading'] . ' R'; } } } break; case 'out': { $res = "\n" . $id . " 0 obj\n<< "; foreach ( $this->objects[$id]['info'] as $key => $info ) { $res .= '/' . $key . ' ' . $info[$key] . "\n"; } $res .= ">>\nendobject"; return $res; } break; } }
php
function o_pattern( $id, $action, $options = '' ) { if ( $action != 'new' ) { $o =& $this->objects[$id]; } switch ( $action ) { case 'new': { $this->objects[$id] = array( 't' => 'shading', 'info' => array() ); if ( isset( $options['type'] ) ) //Set pattern type { $this->objects[$id]['info']['PatternType'] = $options['type']; } else { $this->objects[$id]['info']['PatternType'] = '2'; } if ( isset( $options['matrix'] ) ) { $this->objects[$id]['info']['Matrix'] = '[ '; foreach ( $options['matrix'] as $coord ) { $this->objects[$id]['info']['Matrix'] .= sprintf( ' %.3F ', $coord ); } $this->objects[$id]['info']['Matrix'] .= ' ]'; } if ( $this->objects[$id]['info']['PatternType'] == 1 ) // Pattern type 1, tiling pattern { $this->objects[$id]['info']['PaintType'] = $options['paintType']; $this->objects[$id]['info']['TilingType'] = $options['tilingType']; $this->objects[$id]['info']['BBox'] = '[ '; foreach ( $options['bbox'] as $coord ) { $this->objects[$id]['info']['BBox'] .= sprintf( ' %.3F ', $coord ); } $this->objects[$id]['info']['BBox'] .= ']'; $this->objects[$id]['info']['XStep'] = $options['xstep']; $this->objects[$id]['info']['YStep'] = $options['ystep']; } else // Non tiling, smooth pattern. { if ( isset( $options['shading'] ) ) { $this->objects[$id]['info']['Shading'] = $options['shading'] . ' R'; } } } break; case 'out': { $res = "\n" . $id . " 0 obj\n<< "; foreach ( $this->objects[$id]['info'] as $key => $info ) { $res .= '/' . $key . ' ' . $info[$key] . "\n"; } $res .= ">>\nendobject"; return $res; } break; } }
[ "function", "o_pattern", "(", "$", "id", ",", "$", "action", ",", "$", "options", "=", "''", ")", "{", "if", "(", "$", "action", "!=", "'new'", ")", "{", "$", "o", "=", "&", "$", "this", "->", "objects", "[", "$", "id", "]", ";", "}", "switch...
Add object to hold pattern properties \param object id. \param action \param options \return action 'new' - dictionary name 'out' - pdf output
[ "Add", "object", "to", "hold", "pattern", "properties" ]
2493420f527fbc829a8d5bdda402e05d64a20db7
https://github.com/ezsystems/ezpublish-legacy/blob/2493420f527fbc829a8d5bdda402e05d64a20db7/lib/ezpdf/classes/class.pdf.php#L662-L730
train