当前位置: 首页>>代码示例>>PHP>>正文


PHP eZContentLanguage::maskByLocale方法代码示例

本文整理汇总了PHP中eZContentLanguage::maskByLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentLanguage::maskByLocale方法的具体用法?PHP eZContentLanguage::maskByLocale怎么用?PHP eZContentLanguage::maskByLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZContentLanguage的用法示例。


在下文中一共展示了eZContentLanguage::maskByLocale方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fetchByAction

 public static function fetchByAction($actionName, $actionValue, $maskLanguages = false, $onlyPrioritized = false, $includeRedirections = false)
 {
     $action = $actionName . ":" . $actionValue;
     $db = eZDB::instance();
     $actionStr = $db->escapeString($action);
     $langMask = '';
     if ($maskLanguages === true) {
         $langMask = "(" . trim(eZContentLanguage::languagesSQLFilter('ezurlalias_ml', 'lang_mask')) . ") AND ";
     } else {
         if (is_string($maskLanguages) || is_array($maskLanguages)) {
             // maskByLocale can support array input, here we only want one item.
             $mask = eZContentLanguage::maskByLocale((array) $maskLanguages);
             $langFilter = $db->bitAnd('lang_mask', $mask);
             $langMask = "({$langFilter} > 0) AND";
         }
     }
     $query = "SELECT * FROM ezurlalias_ml WHERE {$langMask} action = '{$actionStr}'";
     if (!$includeRedirections) {
         $query .= " AND is_original = 1 AND is_alias = 0";
     }
     $rows = $db->arrayQuery($query);
     if (count($rows) == 0) {
         return array();
     }
     $rows = eZURLAliasML::filterRows($rows, $onlyPrioritized);
     $objectList = eZPersistentObject::handleRows($rows, 'eZURLAliasML', true);
     return $objectList;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:28,代码来源:ezurlaliasml.php

示例2: setObjectStatusPublished

 public static function setObjectStatusPublished($objectID, $versionNum)
 {
     $object = eZContentObject::fetch($objectID);
     $version = $object->version($versionNum);
     $db = eZDB::instance();
     $db->begin();
     $object->publishContentObjectRelations($versionNum);
     $object->setAttribute('status', eZContentObject::STATUS_PUBLISHED);
     $version->setAttribute('status', eZContentObjectVersion::STATUS_PUBLISHED);
     $object->setAttribute('current_version', $versionNum);
     $objectIsAlwaysAvailable = $object->isAlwaysAvailable();
     $object->setAttribute('language_mask', eZContentLanguage::maskByLocale($version->translationList(false, false), $objectIsAlwaysAvailable));
     if ($object->attribute('published') == 0) {
         $object->setAttribute('published', time());
     }
     $object->setAttribute('modified', time());
     $classID = $object->attribute('contentclass_id');
     $class = eZContentClass::fetch($classID);
     $objectName = $class->contentObjectName($object);
     $object->setName($objectName, $versionNum);
     $existingTranslations = $version->translations(false);
     foreach ($existingTranslations as $translation) {
         $translatedName = $class->contentObjectName($object, $versionNum, $translation);
         $object->setName($translatedName, $versionNum, $translation);
     }
     if ($objectIsAlwaysAvailable) {
         $initialLanguageID = $object->attribute('initial_language_id');
         $object->setAlwaysAvailableLanguageID($initialLanguageID);
     }
     $version->store();
     $object->store();
     eZContentObjectTreeNode::setVersionByObjectID($objectID, $versionNum);
     $nodes = $object->assignedNodes();
     foreach ($nodes as $node) {
         $node->setName($object->attribute('name'));
         $node->updateSubTreePath();
     }
     $db->commit();
     /* Check if current class is the user class, and if so, clean up the user-policy cache */
     if (in_array($classID, eZUser::contentClassIDs())) {
         eZUser::purgeUserCacheByUserId($object->attribute('id'));
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:43,代码来源:ezcontentoperationcollection.php

示例3: checkAccess


//.........这里部分代码省略.........
                             break;
                         case 'Language':
                             $languageMask = 0;
                             // If we don't have a language list yet we need to fetch it
                             // and optionally filter out based on $language.
                             if ($functionName == 'create') {
                                 // If the function is 'create' we do not use the language_mask for matching.
                                 if ($language !== false) {
                                     $languageMask = $language;
                                 } else {
                                     // If the create is used and no language specified then
                                     // we need to match against all possible languages (which
                                     // is all bits set, ie. -1).
                                     $languageMask = -1;
                                 }
                             } else {
                                 if ($language !== false) {
                                     if ($languageList === false) {
                                         $languageMask = $contentObject->attribute('language_mask');
                                         // We are restricting language check to just one language
                                         $languageMask &= $language;
                                         // If the resulting mask is 0 it means that the user is trying to
                                         // edit a language which does not exist, ie. translating.
                                         // The mask will then become the language trying to edit.
                                         if ($languageMask == 0) {
                                             $languageMask = $language;
                                         }
                                     }
                                 } else {
                                     $languageMask = -1;
                                 }
                             }
                             // Fetch limit mask for limitation list
                             $limitMask = eZContentLanguage::maskByLocale($valueList);
                             if (($languageMask & $limitMask) != 0) {
                                 $access = 'allowed';
                             } else {
                                 $access = 'denied';
                                 $limitationList = array('Limitation' => $key, 'Required' => $valueList);
                             }
                             break;
                         case 'Owner':
                         case 'ParentOwner':
                             // if limitation value == 2, anonymous limited to current session.
                             if (in_array(2, $valueList) && $user->isAnonymous()) {
                                 $createdObjectIDList = eZPreferences::value('ObjectCreationIDList');
                                 if ($createdObjectIDList && in_array($contentObject->attribute('id'), unserialize($createdObjectIDList))) {
                                     $access = 'allowed';
                                 }
                             } else {
                                 if ($contentObject->attribute('owner_id') == $userID || $contentObject->attribute('id') == $userID) {
                                     $access = 'allowed';
                                 }
                             }
                             if ($access != 'allowed') {
                                 $access = 'denied';
                                 $limitationList = array('Limitation' => $key);
                             }
                             break;
                         case 'Group':
                         case 'ParentGroup':
                             $access = $contentObject->checkGroupLimitationAccess($valueList, $userID);
                             if ($access != 'allowed') {
                                 $access = 'denied';
                                 $limitationList = array('Limitation' => $key, 'Required' => $valueList);
                             }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:67,代码来源:ezcontentobjecttreenode.php

示例4: updateLanguageMask

    function updateLanguageMask( $mask = false, $forceStore = true )
    {
        if ( $mask == false )
        {
            $mask = eZContentLanguage::maskByLocale( $this->translationList( false, false ), true );
        }

        $this->setAttribute( 'language_mask', $mask );

        if ( $forceStore )
        {
            $this->store();
        }
    }
开发者ID:ataxel,项目名称:tp,代码行数:14,代码来源:ezcontentobjectversion.php

示例5: trim

if (!$language instanceof eZContentLanguage) {
    return $Module->handleError(eZError::KERNEL_NOT_FOUND, 'kernel');
}
$error = '';
if ($http->hasPostVariable('SaveButton')) {
    $newKeyword = trim($http->postVariable('TagEditKeyword', ''));
    if (empty($newKeyword)) {
        $error = ezpI18n::tr('extension/eztags/errors', 'Name cannot be empty.');
    }
    if (empty($error) && eZTagsObject::exists(0, $newKeyword, $parentTag instanceof eZTagsObject ? $parentTag->attribute('id') : 0)) {
        $error = ezpI18n::tr('extension/eztags/errors', 'Tag/synonym with that translation already exists in selected location.');
    }
    if (empty($error)) {
        $db = eZDB::instance();
        $db->begin();
        $languageMask = eZContentLanguage::maskByLocale(array($language->attribute('locale')), $http->hasPostVariable('AlwaysAvailable'));
        $tag = new eZTagsObject(array('parent_id' => $parentTagID, 'main_tag_id' => 0, 'depth' => $parentTag instanceof eZTagsObject ? $parentTag->attribute('depth') + 1 : 1, 'path_string' => $parentTag instanceof eZTagsObject ? $parentTag->attribute('path_string') : '/', 'main_language_id' => $language->attribute('id'), 'language_mask' => $languageMask), $language->attribute('locale'));
        $tag->store();
        $translation = new eZTagsKeyword(array('keyword_id' => $tag->attribute('id'), 'language_id' => $language->attribute('id'), 'keyword' => $newKeyword, 'locale' => $language->attribute('locale'), 'status' => eZTagsKeyword::STATUS_PUBLISHED));
        if ($http->hasPostVariable('AlwaysAvailable')) {
            $translation->setAttribute('language_id', $translation->attribute('language_id') + 1);
        }
        $translation->store();
        $tag->setAttribute('path_string', $tag->attribute('path_string') . $tag->attribute('id') . '/');
        $tag->store();
        $tag->updateModified();
        /* Extended Hook */
        if (class_exists('ezpEvent', false)) {
            ezpEvent::getInstance()->filter('tag/add', array('tag' => $tag, 'parentTag' => $parentTag));
        }
        $db->commit();
开发者ID:oki34,项目名称:eztags,代码行数:31,代码来源:add.php

示例6: updateLanguageMask

 /**
  * Updates language mask of the tag based on current translations or provided language mask
  *
  * @param mixed $mask
  */
 public function updateLanguageMask($mask = false)
 {
     if ($mask === false) {
         $locales = array();
         foreach ($this->getTranslations() as $translation) {
             $locales[] = $translation->attribute('locale');
         }
         $mask = eZContentLanguage::maskByLocale($locales, $this->isAlwaysAvailable());
     }
     $this->setAttribute('language_mask', $mask);
     $this->store();
 }
开发者ID:oki34,项目名称:eztags,代码行数:17,代码来源:eztagsobject.php


注:本文中的eZContentLanguage::maskByLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。