Пример #1
0
 static function addPhrase($phrase, $returnCount)
 {
     $db = eZDB::instance();
     $db->begin();
     $db->lock("ezsearch_search_phrase");
     $trans = eZCharTransform::instance();
     $phrase = $trans->transformByGroup(trim($phrase), 'search');
     // 250 is the numbers of characters accepted by the DB table, so shorten to fit
     if (strlen($phrase) > 250) {
         $phrase = substr($phrase, 0, 247) . "...";
     }
     $phrase = $db->escapeString($phrase);
     // find or store the phrase
     $phraseRes = $db->arrayQuery("SELECT id FROM ezsearch_search_phrase WHERE phrase='{$phrase}'");
     if (count($phraseRes) == 1) {
         $phraseID = $phraseRes[0]['id'];
         $db->query("UPDATE ezsearch_search_phrase\n                         SET    phrase_count = phrase_count + 1,\n                                result_count = result_count + {$returnCount}\n                         WHERE  id = {$phraseID}");
     } else {
         $db->query("INSERT INTO\n                              ezsearch_search_phrase ( phrase, phrase_count, result_count )\n                         VALUES ( '{$phrase}', 1, {$returnCount} )");
         /* when breaking BC: delete next line */
         $phraseID = $db->lastSerialID('ezsearch_search_phrase', 'id');
     }
     $db->unlock();
     /* when breaking BC: delete next lines */
     /* ezsearch_return_count is not used any more by eZ Publish
        but perhaps someone else added some functionality... */
     $time = time();
     // store the search result
     $db->query("INSERT INTO\n                           ezsearch_return_count ( phrase_id, count, time )\n                     VALUES ( '{$phraseID}', '{$returnCount}', '{$time}' )");
     /* end of BC breaking delete*/
     $db->commit();
 }
Пример #2
0
 /**
  * Provides auto complete results when adding tags to object
  *
  * @static
  *
  * @param array $args
  *
  * @return array
  */
 public static function autocomplete($args)
 {
     $http = eZHTTPTool::instance();
     $searchString = trim($http->postVariable('search_string'), '');
     if (empty($searchString)) {
         return array('status' => 'success', 'message' => '', 'tags' => array());
     }
     // Initialize transformation system
     $trans = eZCharTransform::instance();
     $searchString = $trans->transformByGroup($http->postVariable('search_string'), 'lowercase');
     return self::generateOutput(array('LOWER( eztags_keyword.keyword )' => array('like', $searchString . '%')), $http->postVariable('subtree_limit', 0), $http->postVariable('hide_root_tag', '0'), $http->postVariable('locale', ''));
 }
 function addColumn($name = false, $id = false)
 {
     if ($name == false) {
         $name = 'Col_' . count($this->ColumnNames);
     }
     if ($id == false) {
         // Initialize transformation system
         $trans = eZCharTransform::instance();
         $id = $trans->transformByGroup($name, 'identifier');
     }
     $this->ColumnNames[] = array('name' => $name, 'identifier' => $id, 'index' => count($this->ColumnNames));
 }
 function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
 {
     $postVariableName = $base . "_data_object_relation_id_" . $contentObjectAttribute->attribute("id");
     $haveData = false;
     if ($http->hasPostVariable($postVariableName)) {
         $relatedObjectID = $http->postVariable($postVariableName);
         if ($relatedObjectID == '') {
             $relatedObjectID = null;
         }
         $contentObjectAttribute->setAttribute('data_int', $relatedObjectID);
         $haveData = true;
     }
     $fuzzyMatchVariableName = $base . "_data_object_relation_fuzzy_match_" . $contentObjectAttribute->attribute("id");
     if ($http->hasPostVariable($fuzzyMatchVariableName)) {
         $trans = eZCharTransform::instance();
         $fuzzyMatchText = trim($http->postVariable($fuzzyMatchVariableName));
         if ($fuzzyMatchText != '') {
             $fuzzyMatchText = $trans->transformByGroup($fuzzyMatchText, 'lowercase');
             $classAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
             if ($classAttribute) {
                 $classContent = $classAttribute->content();
                 if ($classContent['default_selection_node']) {
                     $nodeID = $classContent['default_selection_node'];
                     $nodeList = eZContentObjectTreeNode::subTreeByNodeID(array('Depth' => 1), $nodeID);
                     $lastDiff = false;
                     $matchObjectID = false;
                     foreach ($nodeList as $node) {
                         $name = $trans->transformByGroup(trim($node->attribute('name')), 'lowercase');
                         $diff = $this->fuzzyTextMatch($name, $fuzzyMatchText);
                         if ($diff === false) {
                             continue;
                         }
                         if ($diff == 0) {
                             $matchObjectID = $node->attribute('contentobject_id');
                             break;
                         }
                         if ($lastDiff === false or $diff < $lastDiff) {
                             $lastDiff = $diff;
                             $matchObjectID = $node->attribute('contentobject_id');
                         }
                     }
                     if ($matchObjectID !== false) {
                         $contentObjectAttribute->setAttribute('data_int', $matchObjectID);
                         $haveData = true;
                     }
                 }
             }
         }
     }
     return $haveData;
 }
 function install($package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
 {
     //$this->Package =& $package;
     $trans = eZCharTransform::instance();
     $name = $content->getAttribute('name');
     $extensionName = $trans->transformByGroup($name, 'urlalias');
     if (strcmp($name, $extensionName) !== 0) {
         $description = ezpI18n::tr('kernel/package', 'Package contains an invalid extension name: %extensionname', false, array('%extensionname' => $name));
         $installParameters['error'] = array('error_code' => false, 'element_id' => $name, 'description' => $description);
         return false;
     }
     $siteINI = eZINI::instance();
     $extensionRootDir = $siteINI->variable('ExtensionSettings', 'ExtensionDirectory');
     $extensionDir = $extensionRootDir . '/' . $extensionName;
     $packageExtensionDir = $package->path() . '/' . $parameters['sub-directory'] . '/' . $extensionName;
     // Error: extension already exists.
     if (file_exists($extensionDir)) {
         $description = ezpI18n::tr('kernel/package', "Extension '%extensionname' already exists.", false, array('%extensionname' => $extensionName));
         $choosenAction = $this->errorChoosenAction(self::ERROR_EXISTS, $installParameters, $description, $this->HandlerType);
         switch ($choosenAction) {
             case self::ACTION_SKIP:
                 return true;
             case eZPackage::NON_INTERACTIVE:
             case self::ACTION_REPLACE:
                 eZDir::recursiveDelete($extensionDir);
                 break;
             default:
                 $installParameters['error'] = array('error_code' => self::ERROR_EXISTS, 'element_id' => $extensionName, 'description' => $description, 'actions' => array(self::ACTION_REPLACE => ezpI18n::tr('kernel/package', "Replace extension"), self::ACTION_SKIP => ezpI18n::tr('kernel/package', 'Skip')));
                 return false;
         }
     }
     eZDir::mkdir($extensionDir, false, true);
     eZDir::copy($packageExtensionDir, $extensionRootDir);
     // Regenerate autoloads for extensions to pick up the newly created extension
     ezpAutoloader::updateExtensionAutoloadArray();
     // Activate extension
     $siteINI = eZINI::instance('site.ini', 'settings/override', null, null, false, true);
     if ($siteINI->hasVariable('ExtensionSettings', "ActiveExtensions")) {
         $selectedExtensions = $siteINI->variable('ExtensionSettings', "ActiveExtensions");
     } else {
         $selectedExtensions = array();
     }
     if (!in_array($extensionName, $selectedExtensions)) {
         $selectedExtensions[] = $extensionName;
         $siteINI->setVariable("ExtensionSettings", "ActiveExtensions", $selectedExtensions);
         $siteINI->save('site.ini.append', '.php', false, false);
     }
     return true;
 }
 /**
  * Append the node ID of the object being published
  * So its URL alias will look like :
  * someurlalias-<nodeID>
  *
  * @param string The text of the URL alias
  * @param object The eZContentObject object being published
  * @params object The eZContentObjectTreeNode in which the eZContentObject is published
  * @return string The transformed URL alias with the nodeID
  */
 public function process($text, &$languageObject, &$caller)
 {
     if (!$caller instanceof eZContentObjectTreeNode) {
         eZDebug::writeError('The caller variable was not an eZContentObjectTreeNode', __METHOD__);
         return $text;
     }
     $ini = eZINI::instance('site.ini');
     $applyOnClassList = $ini->variable('AppendNodeIDFilterSettings', 'ApplyOnClass');
     $classIdentifier = $caller->attribute('class_identifier');
     if (in_array($classIdentifier, $applyOnClassList)) {
         $separator = eZCharTransform::wordSeparator();
         $text .= $separator . $caller->attribute('node_id');
     }
     return $text;
 }
 static function addPhrase($phrase, $returnCount)
 {
     $db = eZDB::instance();
     $db->begin();
     $db->lock("ezsearch_search_phrase");
     $trans = eZCharTransform::instance();
     $phrase = $trans->transformByGroup(trim($phrase), 'search');
     // 250 is the numbers of characters accepted by the DB table, so shorten to fit
     if (strlen($phrase) > 250) {
         $phrase = substr($phrase, 0, 247) . "...";
     }
     $phrase = $db->escapeString($phrase);
     // find or store the phrase
     $phraseRes = $db->arrayQuery("SELECT id FROM ezsearch_search_phrase WHERE phrase='{$phrase}'");
     if (count($phraseRes) == 1) {
         $phraseID = $phraseRes[0]['id'];
         $db->query("UPDATE ezsearch_search_phrase\n                         SET    phrase_count = phrase_count + 1,\n                                result_count = result_count + {$returnCount}\n                         WHERE  id = {$phraseID}");
     } else {
         $db->query("INSERT INTO\n                              ezsearch_search_phrase ( phrase, phrase_count, result_count )\n                         VALUES ( '{$phrase}', 1, {$returnCount} )");
     }
     $db->unlock();
     $db->commit();
 }
    static public function fetchKeyword( $alphabet,
                           $classid,
                           $offset,
                           $limit,
                           $owner = false,
                           $sortBy = array(),
                           $parentNodeID = false,
                           $includeDuplicates = true,
                           $strictMatching = false )
    {
        $classIDArray = array();
        if ( is_numeric( $classid ) )
        {
            $classIDArray = array( $classid );
        }
        else if ( is_array( $classid ) )
        {
            $classIDArray = $classid;
        }

        $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString( true, false );
        $limitation = false;
        $limitationList = eZContentObjectTreeNode::getLimitationList( $limitation );
        $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL( $limitationList );

        $db_params = array();
        $db_params['offset'] = $offset;
        $db_params['limit'] = $limit;

        $keywordNodeArray = array();
        $lastKeyword = '';

        $db = eZDB::instance();

        //in SELECT clause below we will use a full keyword value
        //or just a part of ezkeyword.keyword matched to $alphabet respective to $includeDuplicates parameter.
        //In the case $includeDuplicates = ture we need only a part
        //of ezkeyword.keyword to be fetched in field to allow DISTINCT to remove rows with the same node id's
        $sqlKeyword = 'ezkeyword.keyword';
        if ( !$includeDuplicates )
        {
            $sqlKeyword = $db->subString('ezkeyword.keyword', 1, strlen( $alphabet ) ) . ' AS keyword ';
        }

        $alphabet = $db->escapeString( $alphabet );

        $sortingInfo = array();
        $sortingInfo['attributeFromSQL'] = ', ezcontentobject_attribute a1';
        $sortingInfo['attributeWhereSQL'] = '';
        $sqlTarget = $sqlKeyword.',ezcontentobject_tree.node_id';

        if ( is_array( $sortBy ) && count ( $sortBy ) > 0 )
        {
            switch ( $sortBy[0] )
            {
                case 'keyword':
                case 'name':
                {
                    $sortingString = '';
                    if ( $sortBy[0] == 'name' )
                    {
                        $sortingString = 'ezcontentobject.name';
                        $sortingInfo['attributeTargetSQL'] = ', ' . $sortingString;
                    }
                    elseif ( $sortBy[0] == 'keyword' )
                    {
                        if ( $includeDuplicates )
                            $sortingString = 'ezkeyword.keyword';
                        else
                            $sortingString = 'keyword';
                        $sortingInfo['attributeTargetSQL'] = '';
                    }

                    $sortOrder = true; // true is ascending
                    if ( isset( $sortBy[1] ) )
                        $sortOrder = $sortBy[1];
                    $sortingOrder = $sortOrder ? ' ASC' : ' DESC';
                    $sortingInfo['sortingFields'] = $sortingString . $sortingOrder;
                } break;
                default:
                {
                    $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings( $sortBy );

                    if ( $sortBy[0] == 'attribute' )
                    {
                        // if sort_by is 'attribute' we should add ezcontentobject_name to "FromSQL" and link to ezcontentobject
                        $sortingInfo['attributeFromSQL']  .= ', ezcontentobject_name, ezcontentobject_attribute a1';
                        $sortingInfo['attributeWhereSQL'] .= ' ezcontentobject.id = ezcontentobject_name.contentobject_id AND';
                        $sqlTarget = 'DISTINCT ezcontentobject_tree.node_id, '.$sqlKeyword;
                    }
                    else // for unique declaration
                    {
                        $sortByArray = explode( ' ', $sortingInfo['sortingFields'] );
                        $sortingInfo['attributeTargetSQL'] .= ', ' . $sortByArray[0];

                        $sortingInfo['attributeFromSQL']  .= ', ezcontentobject_attribute a1';
                    }

                } break;
            }

            $sqlTarget .= $sortingInfo['attributeTargetSQL'];
        }
        else
        {
            $sortingInfo['sortingFields'] = 'ezkeyword.keyword ASC';
        }
        $sortingInfo['attributeWhereSQL'] .= " a1.version=ezcontentobject.current_version
                                             AND a1.contentobject_id=ezcontentobject.id AND";

        //Adding DISTINCT to avoid duplicates,
        //check if DISTINCT keyword was added before providing clauses for sorting.
        if ( !$includeDuplicates && substr( $sqlTarget, 0, 9) != 'DISTINCT ' )
        {
            $sqlTarget = 'DISTINCT ' . $sqlTarget;
        }

        $sqlOwnerString = is_numeric( $owner ) ? "AND ezcontentobject.owner_id = '$owner'" : '';
        $parentNodeIDString = is_numeric( $parentNodeID ) ? "AND ezcontentobject_tree.parent_node_id = '$parentNodeID'" : '';

        $sqlClassIDString = '';
        if ( is_array( $classIDArray ) and count( $classIDArray ) )
        {
            $sqlClassIDString = 'AND ' . $db->generateSQLINStatement( $classIDArray, 'ezkeyword.class_id', false, false, 'int' ) . ' ';
        }

        // composing sql for matching tag word, it could be strict equiality or LIKE clause
        // dependent of $strictMatching parameter.
        $sqlMatching = "ezkeyword.keyword LIKE '$alphabet%'";
        if ( $strictMatching )
        {
            $sqlMatching = "ezkeyword.keyword = '$alphabet'";
        }

        $query = "SELECT $sqlTarget
                  FROM ezkeyword, ezkeyword_attribute_link,ezcontentobject_tree,ezcontentobject,ezcontentclass
                       $sortingInfo[attributeFromSQL]
                       $sqlPermissionChecking[from]
                  WHERE
                  $sortingInfo[attributeWhereSQL]
                  $sqlMatching
                  $showInvisibleNodesCond
                  $sqlPermissionChecking[where]
                  $sqlClassIDString
                  $sqlOwnerString
                  $parentNodeIDString
                  AND ezcontentclass.version=0
                  AND ezcontentobject.status=".eZContentObject::STATUS_PUBLISHED."
                  AND ezcontentobject_tree.main_node_id=ezcontentobject_tree.node_id
                  AND ezcontentobject_tree.contentobject_id = ezcontentobject.id
                  AND ezcontentclass.id = ezcontentobject.contentclass_id
                  AND a1.id=ezkeyword_attribute_link.objectattribute_id
                  AND ezkeyword_attribute_link.keyword_id = ezkeyword.id ORDER BY {$sortingInfo['sortingFields']}";

        $keyWords = $db->arrayQuery( $query, $db_params );

        $trans = eZCharTransform::instance();

        foreach ( $keyWords as $keywordArray )
        {
            $keyword = $keywordArray['keyword'];
            $nodeID = $keywordArray['node_id'];
            $nodeObject = eZContentObjectTreeNode::fetch( $nodeID );

            if ( $nodeObject != null )
            {
                $keywordLC = $trans->transformByGroup( $keyword, 'lowercase' );
                if ( $lastKeyword == $keywordLC )
                    $keywordNodeArray[] = array( 'keyword' => '', 'link_object' => $nodeObject );
                else
                    $keywordNodeArray[] = array( 'keyword' => $keyword, 'link_object' => $nodeObject );

                $lastKeyword = $keywordLC;
            }
            else
            {
                $lastKeyword = $trans->transformByGroup( $keyword, 'lowercase' );
            }
        }
        return array( 'result' => $keywordNodeArray );
    }
 function sortKey($contentObjectAttribute)
 {
     //include_once( 'lib/ezpI18n::tr/classes/ezchartransform.php' );
     $trans = eZCharTransform::instance();
     return $trans->transformByGroup($contentObjectAttribute->attribute('data_text'), 'lowercase');
 }
Пример #10
0
 function batchInitializeObjectAttributeData($classAttribute)
 {
     $default = $classAttribute->attribute('data_text1');
     if ($default !== '' && $default !== NULL) {
         $db = eZDB::instance();
         $default = "'" . $db->escapeString($default) . "'";
         $trans = eZCharTransform::instance();
         $lowerCasedDefault = $trans->transformByGroup($default, 'lowercase');
         return array('data_text' => $default, 'sort_key_string' => $lowerCasedDefault);
     }
     return array();
 }
Пример #11
0
 function validatePackageInformation($package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList)
 {
     $packageName = false;
     $packageSummary = false;
     $packageVersion = false;
     $packageDescription = false;
     $packageLicence = 'GPL';
     $packageHost = false;
     $packagePackager = false;
     if ($http->hasPostVariable('PackageName')) {
         $packageName = trim($http->postVariable('PackageName'));
     }
     if ($http->hasPostVariable('PackageSummary')) {
         $packageSummary = $http->postVariable('PackageSummary');
     }
     if ($http->hasPostVariable('PackageDescription')) {
         $packageDescription = $http->postVariable('PackageDescription');
     }
     if ($http->hasPostVariable('PackageVersion')) {
         $packageVersion = trim($http->postVariable('PackageVersion'));
     }
     if ($http->hasPostVariable('PackageLicence')) {
         $packageLicence = $http->postVariable('PackageLicence');
     }
     if ($http->hasPostVariable('PackageHost')) {
         $packageHost = $http->postVariable('PackageHost');
     }
     if ($http->hasPostVariable('PackagePackager')) {
         $packagePackager = $http->postVariable('PackagePackager');
     }
     $persistentData['name'] = $packageName;
     $persistentData['summary'] = $packageSummary;
     $persistentData['description'] = $packageDescription;
     $persistentData['version'] = $packageVersion;
     $persistentData['licence'] = $packageLicence;
     $persistentData['host'] = $packageHost;
     $persistentData['packager'] = $packagePackager;
     $result = true;
     if ($packageName == '') {
         $errorList[] = array('field' => ezpI18n::tr('kernel/package', 'Package name'), 'description' => ezpI18n::tr('kernel/package', 'Package name is missing'));
         $result = false;
     } else {
         $existingPackage = eZPackage::fetch($packageName, false, true);
         if ($existingPackage) {
             $errorList[] = array('field' => ezpI18n::tr('kernel/package', 'Package name'), 'description' => ezpI18n::tr('kernel/package', 'A package named %packagename already exists, please give another name', false, array('%packagename' => $packageName)));
             $result = false;
         } else {
             // Make sure the package name contains only valid characters
             $trans = eZCharTransform::instance();
             $validPackageName = $trans->transformByGroup($packageName, 'identifier');
             if (strcmp($validPackageName, $packageName) != 0) {
                 $errorList[] = array('field' => ezpI18n::tr('kernel/package', 'Package name'), 'description' => ezpI18n::tr('kernel/package', "The package name %packagename is not valid, it can only contain characters in the range a-z, 0-9 and underscore.", false, array('%packagename' => $packageName)));
                 $result = false;
             }
         }
     }
     if (!$packageSummary) {
         $errorList[] = array('field' => ezpI18n::tr('kernel/package', 'Summary'), 'description' => ezpI18n::tr('kernel/package', 'Summary is missing'));
         $result = false;
     }
     if (!preg_match("#^[0-9](\\.[0-9]([a-zA-Z]+[0-9]*)?)*\$#", $packageVersion)) {
         $errorList[] = array('field' => ezpI18n::tr('kernel/package', 'Version'), 'description' => ezpI18n::tr('kernel/package', 'The version must only contain numbers (optionally followed by text) and must be delimited by dots (.), e.g. 1.0, 3.4.0beta1'));
         $result = false;
     }
     return $result;
 }
 public static function fetchKeyword($alphabet, $classid, $offset, $limit, $owner = false, $sortBy = array(), $parentNodeID = false, $includeDuplicates = true, $strictMatching = false, $depth = 1)
 {
     $classIDArray = array();
     if (is_numeric($classid)) {
         $classIDArray = array($classid);
     } else {
         if (is_array($classid)) {
             $classIDArray = $classid;
         }
     }
     $showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
     $limitation = false;
     $limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
     $sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
     $db_params = array();
     $db_params['offset'] = $offset;
     $db_params['limit'] = $limit;
     $keywordNodeArray = array();
     $lastKeyword = '';
     $db = eZDB::instance();
     //in SELECT clause below we will use a full keyword value
     //or just a part of ezkeyword.keyword matched to $alphabet respective to $includeDuplicates parameter.
     //In the case $includeDuplicates = ture we need only a part
     //of ezkeyword.keyword to be fetched in field to allow DISTINCT to remove rows with the same node id's
     $sqlKeyword = 'ezkeyword.keyword';
     if (!$includeDuplicates) {
         $sqlKeyword = $db->subString('ezkeyword.keyword', 1, strlen($alphabet)) . ' AS keyword ';
     }
     $alphabet = $db->escapeString($alphabet);
     $sortingInfo = array();
     $sortingInfo['attributeFromSQL'] = '';
     $sqlTarget = $sqlKeyword . ',ezcontentobject_tree.node_id';
     if (is_array($sortBy) && count($sortBy) > 0) {
         switch ($sortBy[0]) {
             case 'keyword':
             case 'name':
                 $sortingString = '';
                 if ($sortBy[0] == 'name') {
                     $sortingString = 'ezcontentobject.name';
                 } elseif ($sortBy[0] == 'keyword') {
                     if ($includeDuplicates) {
                         $sortingString = 'ezkeyword.keyword';
                     } else {
                         $sortingString = 'keyword';
                     }
                 }
                 $sortOrder = true;
                 // true is ascending
                 if (isset($sortBy[1])) {
                     $sortOrder = $sortBy[1];
                 }
                 $sortingOrder = $sortOrder ? ' ASC' : ' DESC';
                 $sortingInfo['sortingFields'] = $sortingString . $sortingOrder;
                 break;
             default:
                 $sortingInfo = eZContentObjectTreeNode::createSortingSQLStrings($sortBy);
         }
         // Fixing the attributeTargetSQL
         switch ($sortBy[0]) {
             case 'keyword':
                 $sortingInfo['attributeTargetSQL'] = '';
                 break;
             case 'name':
                 $sortingInfo['attributeTargetSQL'] = ', ezcontentobject.name';
                 break;
             case 'attribute':
             case 'class_name':
                 break;
             default:
                 $sortingInfo['attributeTargetSQL'] .= ', ' . strtok($sortingInfo["sortingFields"], " ");
         }
         $sqlTarget .= $sortingInfo['attributeTargetSQL'];
     } else {
         $sortingInfo['sortingFields'] = 'ezkeyword.keyword ASC';
     }
     //Adding DISTINCT to avoid duplicates,
     //check if DISTINCT keyword was added before providing clauses for sorting.
     if (!$includeDuplicates && substr($sqlTarget, 0, 9) != 'DISTINCT ') {
         $sqlTarget = 'DISTINCT ' . $sqlTarget;
     }
     $sqlOwnerString = is_numeric($owner) ? "AND ezcontentobject.owner_id = '{$owner}'" : '';
     $parentNodeIDString = '';
     if (is_numeric($parentNodeID)) {
         $notEqParentString = '';
         // If the node(s) doesn't exist we return null.
         if (!eZContentObjectTreeNode::createPathConditionAndNotEqParentSQLStrings($parentNodeIDString, $notEqParentString, $parentNodeID, $depth)) {
             return null;
         }
     }
     $sqlClassIDString = '';
     if (is_array($classIDArray) and count($classIDArray)) {
         $sqlClassIDString = 'AND ' . $db->generateSQLINStatement($classIDArray, 'ezkeyword.class_id', false, false, 'int') . ' ';
     }
     // composing sql for matching tag word, it could be strict equiality or LIKE clause
     // dependent of $strictMatching parameter.
     $sqlMatching = "ezkeyword.keyword LIKE '{$alphabet}%'";
     if ($strictMatching) {
         $sqlMatching = "ezkeyword.keyword = '{$alphabet}'";
     }
     $query = "SELECT {$sqlTarget}\n                  FROM ezkeyword\n                       INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id)\n                       INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id)\n                       INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id)\n                       INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)\n                       INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id)\n                       {$sortingInfo['attributeFromSQL']}\n                       {$sqlPermissionChecking['from']}\n                  WHERE\n                  {$parentNodeIDString}\n                  {$sqlMatching}\n                  {$showInvisibleNodesCond}\n                  {$sqlPermissionChecking['where']}\n                  {$sqlClassIDString}\n                  {$sqlOwnerString}\n                  AND ezcontentclass.version = 0\n                  AND ezcontentobject.status = " . eZContentObject::STATUS_PUBLISHED . "\n                  AND ezcontentobject_tree.main_node_id = ezcontentobject_tree.node_id\n                  ORDER BY {$sortingInfo['sortingFields']}";
     $keyWords = $db->arrayQuery($query, $db_params);
     $trans = eZCharTransform::instance();
     foreach ($keyWords as $keywordArray) {
         $keyword = $keywordArray['keyword'];
         $nodeID = $keywordArray['node_id'];
         $nodeObject = eZContentObjectTreeNode::fetch($nodeID);
         if ($nodeObject != null) {
             $keywordLC = $trans->transformByGroup($keyword, 'lowercase');
             if ($lastKeyword == $keywordLC) {
                 $keywordNodeArray[] = array('keyword' => '', 'link_object' => $nodeObject);
             } else {
                 $keywordNodeArray[] = array('keyword' => $keyword, 'link_object' => $nodeObject);
             }
             $lastKeyword = $keywordLC;
         } else {
             $lastKeyword = $trans->transformByGroup($keyword, 'lowercase');
         }
     }
     return array('result' => $keywordNodeArray);
 }
Пример #13
0
 /**
  * Checks if all data is valid and can be stored to the database.
  *
  * @param array &$messages
  * @return boolean true when valid, false when not valid
  * @see eZContentObjectState::store()
  */
 public function isValid(&$messages = array())
 {
     $isValid = true;
     // missing identifier
     if (!isset($this->Identifier) || $this->Identifier == '') {
         $messages[] = ezpI18n::tr('kernel/state/edit', 'Identifier: input required');
         $isValid = false;
     } else {
         // make sure the identifier contains only valid characters
         $trans = eZCharTransform::instance();
         $validIdentifier = $trans->transformByGroup($this->Identifier, 'identifier');
         if (strcmp($validIdentifier, $this->Identifier) != 0) {
             // invalid identifier
             $messages[] = ezpI18n::tr('kernel/state/edit', 'Identifier: invalid, it can only consist of characters in the range a-z, 0-9 and underscore.');
             $isValid = false;
         } else {
             if (strlen($this->Identifier) > self::MAX_IDENTIFIER_LENGTH) {
                 $messages[] = ezpI18n::tr('kernel/state/edit', 'Identifier: invalid, maximum %max characters allowed.', null, array('%max' => self::MAX_IDENTIFIER_LENGTH));
                 $isValid = false;
             } else {
                 if (isset($this->GroupID)) {
                     // check for existing identifier
                     $existingState = self::fetchByIdentifier($this->Identifier, $this->GroupID);
                     if ($existingState && (!isset($this->ID) || $existingState->attribute('id') !== $this->ID)) {
                         $messages[] = ezpI18n::tr('kernel/state/edit', 'Identifier: a content object state group with this identifier already exists, please give another identifier');
                         $isValid = false;
                     }
                 }
             }
         }
     }
     $translationsWithData = 0;
     foreach ($this->AllTranslations as $translation) {
         if ($translation->hasData()) {
             $translationsWithData++;
             if (!$translation->isValid($messages)) {
                 $isValid = false;
             }
         } else {
             if (($translation->attribute('language_id') & ~1) == $this->DefaultLanguageID) {
                 // if name nor description are set but translation is specified as main language
                 $isValid = false;
                 $messages[] = ezpI18n::tr('kernel/state/edit', '%language_name: this language is the default but neither name or description were provided for this language', null, array('%language_name' => $translation->attribute('language')->attribute('locale_object')->attribute('intl_language_name')));
             }
         }
     }
     if ($translationsWithData == 0) {
         $isValid = false;
         $messages[] = ezpI18n::tr('kernel/state/edit', 'Translations: you need to add at least one localization');
     } else {
         if (empty($this->DefaultLanguageID) && $translationsWithData > 1) {
             $isValid = false;
             $messages[] = ezpI18n::tr('kernel/state/edit', 'Translations: there are multiple localizations but you did not specify which is the default one');
         }
     }
     return $isValid;
 }
Пример #14
0
 static function commandUrlCleanupIRI($text, $charsetName)
 {
     // With IRI support we keep all characters except some reserved ones,
     // they are space, tab, ampersand, semi-colon, forward slash, colon, equal sign, question mark,
     //          square brackets, parenthesis, plus.
     //
     // Note: Spaces and tabs are turned into a dash to make it easier for people to
     //       paste urls from the system and have the whole url recognized
     //       instead of being broken off
     $sep = eZCharTransform::wordSeparator();
     $sepQ = preg_quote($sep);
     $prepost = " ." . $sepQ;
     if ($sep != "-") {
         $prepost .= "-";
     }
     $text = preg_replace(array("#[ \t\\\\%\\#&;/:=?\\[\\]()+]+#", "#\\.\\.+#", "#[{$sepQ}]+#", "#^[{$prepost}]+|[!{$prepost}]+\$#"), array($sep, $sep, $sep, ""), $text);
     return $text;
 }
 public static function convertToAliasCompat($urlElement, $defaultValue = false)
 {
     $trans = eZCharTransform::instance();
     $urlElement = $trans->transformByGroup($urlElement, "urlalias_compat");
     if (strlen($urlElement) == 0) {
         if ($defaultValue === false) {
             $urlElement = '_1';
         } else {
             $urlElement = $defaultValue;
             $urlElement = $trans->transformByGroup($urlElement, "urlalias_compat");
         }
     }
     return $urlElement;
 }
Пример #16
0
 /**
  * Returns the sort key of the attribute
  *
  * @param eZContentObjectAttribute $contentObjectAttribute
  *
  * @return string
  */
 function sortKey($contentObjectAttribute)
 {
     $trans = eZCharTransform::instance();
     return $trans->transformByGroup(trim($contentObjectAttribute->attribute(self::OIB_FIELD)), "lowercase");
 }
Пример #17
0
 function executeCommandCode(&$text, $command, $charsetName)
 {
     if ($command['command'] == 'url_cleanup_iri') {
         $text = eZCharTransform::commandUrlCleanupIRI($text, $charsetName);
         return true;
     } else {
         if ($command['command'] == 'url_cleanup') {
             $text = eZCharTransform::commandUrlCleanup($text, $charsetName);
             return true;
         } else {
             if ($command['command'] == 'url_cleanup_compat') {
                 $text = eZCharTransform::commandUrlCleanupCompat($text, $charsetName);
                 return true;
             } else {
                 if ($command['command'] == 'identifier_cleanup') {
                     $text = strtolower($text);
                     $text = preg_replace(array("#[^a-z0-9_ ]#", "/ /", "/__+/", "/^_|_\$/"), array(" ", "_", "_", ""), $text);
                     return true;
                 } else {
                     if ($command['command'] == 'search_cleanup') {
                         $nonCJKCharsets = $this->nonCJKCharsets();
                         if (!in_array($charsetName, $nonCJKCharsets)) {
                             // 4 Add spaces after chinese / japanese / korean multibyte characters
                             $codec = eZTextCodec::instance(false, 'unicode');
                             $unicodeValueArray = $codec->convertString($text);
                             $normalizedTextArray = array();
                             $bFlag = false;
                             foreach (array_keys($unicodeValueArray) as $valueKey) {
                                 // Check for word characters that should be broken up for search
                                 if ($unicodeValueArray[$valueKey] >= 12289 and $unicodeValueArray[$valueKey] <= 12542 or $unicodeValueArray[$valueKey] >= 13312 and $unicodeValueArray[$valueKey] <= 40863 or $unicodeValueArray[$valueKey] >= 44032 and $unicodeValueArray[$valueKey] <= 55203) {
                                     if ($bFlag) {
                                         $normalizedTextArray[] = $unicodeValueArray[$valueKey];
                                     }
                                     $normalizedTextArray[] = 32;
                                     // A space
                                     $normalizedTextArray[] = $unicodeValueArray[$valueKey];
                                     $bFlag = true;
                                 } else {
                                     if ($bFlag) {
                                         $normalizedTextArray[] = 32;
                                         // A space
                                     }
                                     $normalizedTextArray[] = $unicodeValueArray[$valueKey];
                                     $bFlag = false;
                                 }
                             }
                             if ($bFlag) {
                                 $normalizedTextArray[count($normalizedTextArray) - 1] = 32;
                             }
                             $revCodec = eZTextCodec::instance('unicode', false);
                             // false means use internal charset
                             $text = $revCodec->convertString($normalizedTextArray);
                         }
                         // Make sure dots inside words/numbers are kept, the rest is turned into space
                         $text = preg_replace(array("#(\\.){2,}#", "#^\\.#", "#\\s\\.#", "#\\.\\s#", "#\\.\$#", "#([^0-9])%#"), array(" ", " ", " ", " ", " ", "\$1 "), $text);
                         $ini = eZINI::instance();
                         if ($ini->variable('SearchSettings', 'EnableWildcard') != 'true') {
                             $text = str_replace("*", " ", $text);
                         }
                         $charset = eZTextCodec::internalCharset();
                         $hasUTF8 = $charset == "utf-8";
                         if ($hasUTF8) {
                             $text = preg_replace("#(\\s+)#u", " ", $text);
                         } else {
                             $text = preg_replace("#(\\s+)#", " ", $text);
                         }
                         return true;
                     } else {
                         $ini = eZINI::instance('transform.ini');
                         $commands = $ini->variable('Extensions', 'Commands');
                         if (isset($commands[$command['command']])) {
                             list($path, $className) = explode(':', $commands[$command['command']], 2);
                             if (file_exists($path)) {
                                 include_once $path;
                                 $text = call_user_func_array(array($className, 'executeCommand'), array($text, $command['command'], $charsetName));
                                 return true;
                             } else {
                                 eZDebug::writeError("Could not locate include file '{$path}' for transformation '" . $command['command'] . "'");
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 /**
  * Generates an identifier from provided name
  *
  * @param string $name
  * @param array $identifierArray
  *
  * @return string
  */
 protected function generateIdentifier($name, $identifierArray = array())
 {
     if (empty($name)) {
         return '';
     }
     $identifier = $name;
     $generatedIdentifier = eZCharTransform::instance()->transformByGroup($identifier, 'identifier');
     // We have $generatedIdentifier now, check for existence
     if (is_array($identifierArray) && !empty($identifierArray) && in_array($generatedIdentifier, $identifierArray)) {
         $highestNumber = 0;
         foreach ($identifierArray as $identifierItem) {
             if (preg_match('/^' . $generatedIdentifier . '__(\\d+)$/', $identifierItem, $matchArray)) {
                 if ($matchArray[1] > $highestNumber) {
                     $highestNumber = $matchArray[1];
                 }
             }
         }
         $generatedIdentifier .= "__" . ++$highestNumber;
     }
     return $generatedIdentifier;
 }
Пример #19
0
 function normalizeImageName($imageName)
 {
     // Initialize transformation system
     $trans = eZCharTransform::instance();
     $imageName = eZURLAliasML::convertToAlias($imageName);
     return $imageName;
 }
Пример #20
0
 function normalizeText($text, $isMetaData = false)
 {
     $text = self::removeDuplicatedSpaces(trim(self::removeAllQuotes(eZCharTransform::instance()->transformByGroup($text, 'search'))));
     // Remove quotes and asterix when not handling search text by end-user
     if ($isMetaData) {
         $text = str_replace("*", " ", $text);
     }
     return $text;
 }
Пример #21
0
    function sortKey( $contentObjectAttribute )
    {
        $trans = eZCharTransform::instance();
        $content = $contentObjectAttribute->content();
        if ( is_array( $content['value'] ) )
        {
            $imploded = '';
            foreach ( $content['value'] as $country )
            {
                $countryName = $country['Name'];

                if ( $imploded == '' )
                    $imploded = $countryName;
                else
                    $imploded .= ',' . $countryName;
            }
            $content['value'] = $imploded;
        }
        return $trans->transformByGroup( $content['value'], 'lowercase' );
    }
 /**
  * Returns a key to sort attributes.
  *
  * @param mixed $contentObjectAttribute Class eZContentObjectAttribute.
  *
  * @return string
  */
 public function sortKey($contentObjectAttribute)
 {
     include_once 'lib/ezi18n/classes/ezchartransform.php';
     $trans = eZCharTransform::instance();
     $data = $contentObjectAttribute->attribute('data_text');
     return $trans->transformByGroup($data, 'lowercase');
 }
<?php 
/**
 * File containing the section identifier upgrade script.
 *
 * @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
 * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
 * @version  2013.11
 * @package update
 */
require 'autoload.php';
$script = eZScript::instance(array('description' => 'eZ Publish section identifier update script. ' . 'This script will update existing sections with missing identifiers.', 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
$options = $script->getOptions('', '', array('-q' => 'Quiet mode'));
$script->initialize();
$cli = eZCLI::instance();
$trans = eZCharTransform::instance();
// Fetch 50 items per iteration
$limit = 50;
$offset = 0;
do {
    // Fetch items with empty identifier
    $rows = eZSection::fetchFilteredList(null, $offset, $limit);
    if (!$rows) {
        break;
    }
    foreach ($rows as $row) {
        if ($row->attribute('identifier') == '') {
            // Create a new section identifier with NAME_ID pattern
            $name = $row->attribute('name');
            $identifier = $trans->transformByGroup($name, 'identifier') . '_' . $row->attribute('id');
            // Set new section identifier and store it
Пример #24
0
 function sortKey($contentObjectAttribute)
 {
     $trans = eZCharTransform::instance();
     return $trans->transformByGroup($contentObjectAttribute->attribute('data_text'), 'lowercase');
 }
Пример #25
0
 function normalizeText($text, $isMetaData = false)
 {
     $trans = eZCharTransform::instance();
     $text = $trans->transformByGroup($text, 'search');
     // Remove quotes and asterix when not handling search text by end-user
     if ($isMetaData) {
         $text = str_replace(array("\"", "*"), array(" ", " "), $text);
     }
     return $text;
 }
Пример #26
0
 /**
  * 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
  */
 static function isValidName($packageName, &$transformedPackageName = null)
 {
     $trans = eZCharTransform::instance();
     $transformedPackageName = $trans->transformByGroup($packageName, 'identifier');
     return $transformedPackageName === $packageName;
 }
Пример #27
0
 function fetchClassAttributeHTTPInput($http, $base, $classAttribute)
 {
     // 'default name' is never used => just a stub
     // $defaultValueName = $base . self::DEFAULT_NAME_VARIABLE . $classAttribute->attribute( 'id' );
     $defaultValueName = '';
     $defaultNumColumnsName = $base . self::NUM_COLUMNS_VARIABLE . $classAttribute->attribute('id');
     $defaultNumRowsName = $base . self::NUM_ROWS_VARIABLE . $classAttribute->attribute('id');
     $dataFetched = false;
     // 'default name' is never used => just a stub
     /*
     if ( $http->hasPostVariable( $defaultValueName ) )
     {
         $defaultValueValue = $http->postVariable( $defaultValueName );
     
         if ( $defaultValueValue == '' )
         {
             $defaultValueValue = '';
         }
         $classAttribute->setAttribute( 'data_text1', $defaultValueValue );
         $dataFetched = true;
     }
     */
     if ($http->hasPostVariable($defaultNumRowsName)) {
         $defaultNumRowsValue = $http->postVariable($defaultNumRowsName);
         if ($defaultNumRowsValue == '') {
             $defaultNumRowsValue = '1';
         }
         $classAttribute->setAttribute('data_int1', $defaultNumRowsValue);
         $dataFetched = true;
     }
     $columnNameVariable = $base . '_data_ezmatrix_column_name_' . $classAttribute->attribute('id');
     $columnIDVariable = $base . '_data_ezmatrix_column_id_' . $classAttribute->attribute('id');
     if ($http->hasPostVariable($columnNameVariable) && $http->hasPostVariable($columnIDVariable)) {
         $columns = array();
         $i = 0;
         $columnNameList = $http->postVariable($columnNameVariable);
         $columnIDList = $http->postVariable($columnIDVariable);
         $matrixDefinition = $classAttribute->attribute('content');
         $columnNames = $matrixDefinition->attribute('columns');
         foreach ($columnNames as $columnName) {
             $columnID = '';
             $name = '';
             $index = $columnName['index'];
             // after adding a new column $columnIDList and $columnNameList doesn't contain values for new column.
             // if so just add column with empty 'name' and 'columnID'.
             if (isset($columnIDList[$index]) && isset($columnNameList[$index])) {
                 $columnID = $columnIDList[$index];
                 $name = $columnNameList[$index];
                 if (strlen($columnID) == 0) {
                     $columnID = $name;
                     // Initialize transformation system
                     $trans = eZCharTransform::instance();
                     $columnID = $trans->transformByGroup($columnID, 'identifier');
                 }
             }
             $columns[] = array('name' => $name, 'identifier' => $columnID, 'index' => $i);
             $i++;
         }
         $matrixDefinition->ColumnNames = $columns;
         $classAttribute->setContent($matrixDefinition);
         $classAttribute->setAttribute('data_text5', $matrixDefinition->xmlString());
         $dataFetched = true;
     }
     if ($dataFetched) {
         return true;
     }
     return false;
 }
<?php

// Cached transformation data
// Type: Group:urlalias
// Charset: utf-8
// Cached transformation data
$data = array('table' => array('' => ' ', ' ' => ' ', '״' => '"', '׳' => '\\"', 'ײ' => 'yy', 'ױ' => 'wy', 'װ' => 'ww', 'ת' => 't', 'ש' => 's', 'ר' => 'r', 'ק' => 'q', 'צ' => 'z', 'ץ' => 'z', 'פ' => 'p', 'ף' => 'p', 'ע' => '\\"', 'ס' => 's', 'נ' => 'n', 'ן' => 'n', 'מ' => 'm', 'ם' => 'm', 'ל' => 'l', 'כ' => 'k', 'ך' => 'k', 'י' => 'y', 'ט' => 't', 'ח' => 'h', 'ז' => 'z', 'ו' => 'o', 'ה' => 'h', 'ד' => 'd', 'ג' => 'g', 'ב' => 'b', 'א' => '\\"', '׃' => ':', '׀' => '|', 'ֿ' => '', '־' => '\\"', 'ֽ' => '', 'ּ' => '', 'ֻ' => 'u', 'ֺ' => '', 'ֹ' => 'o', 'ָ' => 'e', 'ַ' => 'a', 'ֶ' => 'e', 'ֵ' => 'e', 'ִ' => 'i', 'ֳ' => 'o', 'ֲ' => 'a', 'ֱ' => 'e', 'ְ' => '', '֯' => '' . "" . '', '֮' => '' . "" . '', '֭' => '' . "" . '', '֬' => '' . "" . '', '֫' => '' . "" . '', '֪' => '' . "" . '', '֩' => '' . "" . '', '֨' => '' . "" . '', '֧' => '' . "" . '', '֦' => '' . "" . '', '֥' => '' . "" . '', '֤' => '' . "" . '', '֣' => '' . "" . '', '֡' => '' . "" . '', '֠' => '' . "" . '', '֟' => '' . "" . '', '֞' => '' . "" . '', '֝' => '' . "" . '', '֜' => '' . "" . '', '֛' => '' . "" . '', '֚' => '' . "" . '', '֙' => '' . "" . '', '֘' => '' . "" . '', '֗' => '' . "" . '', '֖' => '' . "" . '', '֕' => '' . "" . '', '֔' => '' . "" . '', '֓' => '' . "" . '', '֒' => '' . "" . '', '֑' => '' . "" . '', 'ӹ' => 'y', 'Ӹ' => 'Y', 'ӵ' => 'ch', 'Ӵ' => 'CH', 'ӳ' => 'u', 'Ӳ' => 'U', 'ӱ' => 'u', 'Ӱ' => 'U', 'ӯ' => 'u', 'Ӯ' => 'U', 'ӭ' => 'e', 'Ӭ' => 'E', 'ӫ' => 'ө', 'Ӫ' => 'Ө', 'ӧ' => 'o', 'Ӧ' => 'O', 'ӥ' => 'i', 'Ӥ' => 'I', 'ӣ' => 'i', 'Ӣ' => 'I', 'ӟ' => 'z', 'Ӟ' => 'Z', 'ӝ' => 'zh', 'Ӝ' => 'ZH', 'ӛ' => 'ә', 'Ӛ' => 'Ә', 'ӗ' => 'e', 'Ӗ' => 'E', 'ӓ' => 'a', 'Ӓ' => 'A', 'ӑ' => 'a', 'Ӑ' => 'A', 'ӂ' => 'zh', 'Ӂ' => 'ZH', 'ѷ' => 'ѵ', 'Ѷ' => 'Ѵ', 'џ' => 'dz', 'ў' => 'v', 'ѝ' => 'i', 'ќ' => 'kj', 'ћ' => 'c', 'њ' => 'nj', 'љ' => 'lj', 'ј' => 'j', 'ї' => 'yi', 'і' => 'i', 'ѕ' => 'z', 'є' => 'e', 'ѓ' => 'g', 'ђ' => 'dj', 'ё' => 'io', 'ѐ' => 'ie', 'я' => 'ya', 'ю' => 'yu', 'э' => 'e', 'ь' => '\\"', 'ы' => 'y', 'ъ' => '\\"', 'щ' => 'sch', 'ш' => 'sh', 'ч' => 'ch', 'ц' => 'c', 'х' => 'h', 'ф' => 'f', 'у' => 'u', 'т' => 't', 'с' => 's', 'р' => 'r', 'п' => 'p', 'о' => 'o', 'н' => 'n', 'м' => 'm', 'л' => 'l', 'к' => 'k', 'й' => 'j', 'и' => 'i', 'з' => 'z', 'ж' => 'zh', 'е' => 'e', 'д' => 'd', 'г' => 'g', 'в' => 'v', 'б' => 'b', 'а' => 'a', 'Я' => 'YA', 'Ю' => 'YU', 'Э' => 'E', 'Ь' => '\\"', 'Ы' => 'Y', 'Ъ' => '\\"', 'Щ' => 'SCH', 'Ш' => 'SH', 'Ч' => 'CH', 'Ц' => 'C', 'Х' => 'H', 'Ф' => 'F', 'У' => 'U', 'Т' => 'T', 'С' => 'S', 'Р' => 'R', 'П' => 'P', 'О' => 'O', 'Н' => 'N', 'М' => 'M', 'Л' => 'L', 'К' => 'K', 'Й' => 'J', 'И' => 'I', 'З' => 'Z', 'Ж' => 'ZH', 'Е' => 'E', 'Д' => 'D', 'Г' => 'G', 'В' => 'V', 'Б' => 'B', 'А' => 'A', 'Џ' => 'DZ', 'Ў' => 'V', 'Ѝ' => 'I', 'Ќ' => 'KJ', 'Ћ' => 'Ts', 'Њ' => 'NJ', 'Љ' => 'LJ', 'Ј' => 'J', 'Ї' => 'YI', 'І' => 'II', 'Ѕ' => 'DS', 'Є' => 'IE', 'Ѓ' => 'G', 'Ђ' => 'D', 'Ё' => 'IO', 'Ѐ' => 'IE', 'ϻ' => '', 'Ϻ' => '', 'Ϲ' => '', 'ϸ' => '', 'Ϸ' => '', '϶' => 'e', 'ϵ' => 'e', 'ϴ' => '', 'ϳ' => 'j', 'ϲ' => '', 'ϱ' => 'r', 'ϰ' => '', 'ϯ' => '', 'Ϯ' => '', 'ϭ' => '', 'Ϭ' => '', 'ϫ' => '', 'Ϫ' => '', 'ϩ' => '', 'Ϩ' => '', 'ϧ' => '', 'Ϧ' => '', 'ϥ' => '', 'Ϥ' => '', 'ϣ' => '', 'Ϣ' => '', 'ϡ' => '900', 'Ϡ' => 'S', 'ϟ' => '90', 'Ϟ' => 'K', 'ϝ' => 'f', 'Ϝ' => 'F', 'ϛ' => 's', 'Ϛ' => '6', 'ϙ' => 'k', 'Ϙ' => 'K', 'ϗ' => '&', 'ϖ' => 'pi', 'ϕ' => 'phi', 'ϔ' => 'Y', 'ϓ' => 'Y', 'ϒ' => 'Y', 'ϑ' => 'th', 'ϐ' => 'b', 'ώ' => 'ho', 'ύ' => 'hu', 'ό' => 'ho', 'ϋ' => 'y', 'ϊ' => 'i', 'ω' => 'o', 'ψ' => 'ps', 'χ' => 'ch', 'φ' => 'ph', 'υ' => 'y', 'τ' => 't', 'σ' => 's', 'ς' => 's', 'ρ' => 'r', 'π' => 'p', 'ο' => 'o', 'ξ' => 'x', 'ν' => 'n', 'μ' => 'm', 'λ' => 'l', 'κ' => 'k', 'ι' => 'i', 'θ' => 'th', 'η' => 'e', 'ζ' => 'z', 'ε' => 'e', 'δ' => 'd', 'γ' => 'g', 'β' => 'v', 'α' => 'a', 'ΰ' => 'y', 'ί' => 'hi', 'ή' => 'he', 'έ' => 'he', 'ά' => 'ha', 'Ϋ' => 'Y', 'Ϊ' => 'I', 'Ω' => 'O', 'Ψ' => 'Ps', 'Χ' => 'Ch', 'Φ' => 'Ph', 'Υ' => 'Y', 'Τ' => 'T', 'Σ' => 'S', 'Ρ' => 'R', 'Π' => 'P', 'Ο' => 'O', 'Ξ' => 'X', 'Ν' => 'N', 'Μ' => 'M', 'Λ' => 'L', 'Κ' => 'K', 'Ι' => 'I', 'Θ' => 'Th', 'Η' => 'E', 'Ζ' => 'Z', 'Ε' => 'E', 'Δ' => 'D', 'Γ' => 'G', 'Β' => 'V', 'Α' => 'A', 'ΐ' => 'I', 'Ώ' => 'Ho', 'Ύ' => 'Hu', 'Ό' => 'Ho', 'Ί' => 'Hi', 'Ή' => 'He', 'Έ' => 'He', '·' => '·', 'Ά' => 'Ha', '΅' => '¨', '΄' => ' ', ';' => '?', 'ͺ' => ' ', '͵' => '\\"', 'ʹ' => '\\"', '˝' => '"', 'ˏ' => '"', 'ˎ' => '"', 'ˋ' => '"', 'ˊ' => '"', 'ſ' => 's', 'ž' => 'z', 'Ž' => 'Z', 'ż' => 'z', 'Ż' => 'Z', 'ź' => 'z', 'Ź' => 'Z', 'Ÿ' => 'Y', 'ŷ' => 'y', 'Ŷ' => 'Y', 'ŵ' => 'w', 'Ŵ' => 'W', 'ų' => 'u', 'Ų' => 'U', 'ű' => 'u', 'Ű' => 'U', 'ů' => 'u', 'Ů' => 'U', 'ŭ' => 'u', 'Ŭ' => 'U', 'ū' => 'u', 'Ū' => 'U', 'ũ' => 'u', 'Ũ' => 'U', 'ŧ' => 't', 'Ŧ' => 'T', 'ť' => 't', 'Ť' => 'T', 'ţ' => 't', 'Ţ' => 'T', 'š' => 's', 'Š' => 'S', 'ş' => 's', 'Ş' => 'S', 'ŝ' => 's', 'Ŝ' => 'S', 'ś' => 's', 'Ś' => 'S', 'ř' => 'r', 'Ř' => 'R', 'ŗ' => 'r', 'Ŗ' => 'R', 'ŕ' => 'r', 'Ŕ' => 'R', 'œ' => 'oe', 'Œ' => 'OE', 'ő' => 'o', 'Ő' => 'O', 'ŏ' => 'o', 'Ŏ' => 'O', 'ō' => 'o', 'Ō' => 'O', 'ŋ' => 'n', 'Ŋ' => 'N', 'ʼn' => '"n', 'ň' => 'n', 'Ň' => 'N', 'ņ' => 'n', 'Ņ' => 'N', 'ń' => 'n', 'Ń' => 'N', 'ł' => 'l', 'Ł' => 'L', 'ŀ' => 'l', 'Ŀ' => 'L', 'ľ' => 'l', 'Ľ' => 'L', 'ļ' => 'l', 'Ļ' => 'L', 'ĺ' => 'l', 'Ĺ' => 'L', 'ĸ' => 'k', 'ķ' => 'k', 'Ķ' => 'K', 'ĵ' => 'j', 'Ĵ' => 'J', 'ij' => 'ij', 'IJ' => 'IJ', 'ı' => 'i', 'İ' => 'I', 'į' => 'i', 'Į' => 'I', 'ĭ' => 'i', 'Ĭ' => 'I', 'ī' => 'i', 'Ī' => 'I', 'ĩ' => 'i', 'Ĩ' => 'I', 'ħ' => 'h', 'Ħ' => 'H', 'ĥ' => 'h', 'Ĥ' => 'H', 'ģ' => 'g', 'Ģ' => 'G', 'ġ' => 'g', 'Ġ' => 'G', 'ğ' => 'g', 'Ğ' => 'G', 'ĝ' => 'g', 'Ĝ' => 'G', 'ě' => 'e', 'Ě' => 'E', 'ę' => 'e', 'Ę' => 'E', 'ė' => 'e', 'Ė' => 'E', 'ĕ' => 'e', 'Ĕ' => 'E', 'ē' => 'e', 'Ē' => 'E', 'đ' => 'd', 'Đ' => 'D', 'ď' => 'd', 'Ď' => 'D', 'č' => 'c', 'Č' => 'C', 'ċ' => 'c', 'Ċ' => 'C', 'ĉ' => 'c', 'Ĉ' => 'C', 'ć' => 'c', 'Ć' => 'C', 'ą' => 'a', 'Ą' => 'A', 'ă' => 'a', 'Ă' => 'A', 'ā' => 'a', 'Ā' => 'A', 'ÿ' => 'y', 'þ' => 'th', 'ý' => 'y', 'ü' => 'ue', 'û' => 'u', 'ú' => 'u', 'ù' => 'u', 'ø' => 'oe', '÷' => '/', 'ö' => 'oe', 'õ' => 'o', 'ô' => 'o', 'ó' => 'o', 'ò' => 'o', 'ñ' => 'n', 'ð' => 'd', 'ï' => 'i', 'î' => 'i', 'í' => 'i', 'ì' => 'i', 'ë' => 'e', 'ê' => 'e', 'é' => 'e', 'è' => 'e', 'ç' => 'c', 'æ' => 'ae', 'å' => 'aa', 'ä' => 'ae', 'ã' => 'a', 'â' => 'a', 'á' => 'a', 'à' => 'a', 'ß' => 'ss', 'Þ' => 'TH', 'Ý' => 'Y', 'Ü' => 'Ue', 'Û' => 'U', 'Ú' => 'U', 'Ù' => 'U', 'Ø' => 'OE', '×' => '*', 'Ö' => 'Oe', 'Õ' => 'O', 'Ô' => 'O', 'Ó' => 'O', 'Ò' => 'O', 'Ñ' => 'N', 'Ð' => 'D', 'Ï' => 'I', 'Î' => 'I', 'Í' => 'I', 'Ì' => 'I', 'Ë' => 'E', 'Ê' => 'E', 'É' => 'E', 'È' => 'E', 'Ç' => 'C', 'Æ' => 'AE', 'Å' => 'AA', 'Ä' => 'Ae', 'Ã' => 'A', 'Â' => 'A', 'Á' => 'A', 'À' => 'A', '¿' => '?', '¾' => '3/4', '½' => '1/2', '¼' => '1/4', '»' => '"', 'º' => '1', '¹' => '1', '´' => '"', '³' => '3', '²' => '2', '±' => '+-', '®' => '(R)', '­' => '', '«' => '"', 'ª' => 'a', '©' => '(C)', '¡' => '!', ' ' => ' ', 'Ÿ' => 'Y', 'œ' => 'oe', 'Œ' => 'OE', '~' => '-', '`' => '"', '\'' => '"'));
$text = strtr($text, $data['table']);
$text = eZCharTransform::commandUrlCleanup($text, 'utf-8');
Пример #29
0
function repositoryByVendor($vendor)
{
    // it's copy/paste from eZPackage
    $trans = eZCharTransform::instance();
    $repository = $trans->transformByGroup($vendor, 'urlalias');
    return $repository;
}
Пример #30
0
 /**
  * I link da riportare nella parte bassa del footer, vengono inseriti in una
  * matrice chiamata footer_link_bottom nella classe Homepage
  * 
  * @return array
  */
 public static function getFooterBottomLinks()
 {
     $data = array();
     $homePage = FooterTool::fetchRootNode();
     if ($homePage instanceof eZContentObjectTreeNode) {
         $homeObject = $homePage->attribute('object');
         if ($homeObject instanceof eZContentObject) {
             $dataMap = $homeObject->attribute('data_map');
             if (isset($dataMap['footer_link_bottom']) && $dataMap['footer_link_bottom'] instanceof eZContentObjectAttribute && $dataMap['footer_link_bottom']->attribute('data_type_string') == 'ezmatrix' && $dataMap['footer_link_bottom']->attribute('has_content')) {
                 $trans = eZCharTransform::instance();
                 $matrix = $dataMap['footer_link_bottom']->attribute('content')->attribute('matrix');
                 foreach ($matrix['rows']['sequential'] as $row) {
                     $columns = $row['columns'];
                     $name = $columns[0];
                     $identifier = $trans->transformByGroup($name, 'identifier');
                     if (!empty($columns[1])) {
                         $data[$identifier] = $columns[1];
                     }
                 }
             }
         }
     }
     return $data;
 }