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


PHP eZSys::clearAccessPath方法代码示例

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


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

示例1: change

    /**
     * Changes the site access to what's defined in $access. It will change the
     * access path in eZSys and prepend an override dir to eZINI
     * Note: does not load extensions, use {@link eZSiteAccess::load()} if you want that
     *
     * @since 4.4
     * @param array $access An associative array with 'name' (string), 'type' (int) and 'uri_part' (array).
     *                      See {@link eZSiteAccess::match()} for array structure definition
     * @param eZINI|null $siteINI Optional parameter to be able to only do change on specific instance of site.ini
     *                   hence skip changing eZSys access paths (but not siteaccess, see {@link eZSiteAccess::load()})
     * @return array The $access parameter
     */
    static function change( array $access, eZINI $siteINI = null )
    {
        $name = $access['name'];
        $GLOBALS['eZCurrentAccess'] =& $access;
        if ( $siteINI !== null )
        {
            $ini = $siteINI;
        }
        else
        {
            $ini = eZINI::instance();
        }

        $ini->prependOverrideDir( "siteaccess/$name", false, 'siteaccess', 'siteaccess' );

        /* Make sure extension siteaccesses are prepended */
        eZExtension::prependExtensionSiteAccesses( $name, $ini );

        $ini->loadCache();

        // change some global settings if $siteINI is null
        if ( $siteINI === null )
        {
            eZSys::clearAccessPath();
            if ( !isset( $access['uri_part'] ) || $access['uri_part'] === null )
            {
                if ( $ini->hasVariable('SiteSettings', 'SiteUriParts') )
                    $access['uri_part'] = $ini->variable('SiteSettings', 'SiteUriParts');
                else if ( isset( $access['type'] ) && $access['type'] === eZSiteAccess::TYPE_URI )
                    $access['uri_part'] = array( $access['name'] );
                else
                    $access['uri_part'] = array();
            }
            eZSys::setAccessPath( $access['uri_part'], $name );

            eZUpdateDebugSettings();
            eZDebugSetting::writeDebug( 'kernel-siteaccess', "Updated settings to use siteaccess '$name'", __METHOD__ );
        }

        return $access;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:53,代码来源:ezsiteaccess.php

示例2: testIndexFileRemoveSiteAccessIfDefaultAccessDisabled2

    /**
     * Test eZSys $AccessPath as it works as of 4.4 with propertied to
     * define scope of path with RemoveSiteAccessIfDefaultAccess=disabled
     */
    public function testIndexFileRemoveSiteAccessIfDefaultAccessDisabled2()
    {
        // TEST SETUP --------------------------------------------------------
        $ini = eZINI::instance();

        $defaultAccess = $ini->variable( 'SiteSettings', 'DefaultAccess' );
        $this->setSiteAccess( $defaultAccess );

        // Make sure to preserve ini settings in case other tests depend on them
        $orgRemoveSiteaccess = $ini->variable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess' );

        // DISABLE RemoveSiteAccessIfDefaultAccess
        $ini->setVariable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess', 'disabled' );
        // -------------------------------------------------------------------

        // TEST --------------------------------------------------------------
        $indexFile = eZSys::indexFile();
        self::assertEquals( "/$defaultAccess", $indexFile );

        eZSys::setAccessPath( array( 'testing', 'indexFile' ), 'test-path', false );
        $indexFile = eZSys::indexFile();
        self::assertEquals( "/$defaultAccess/testing/indexFile", $indexFile );
        // -------------------------------------------------------------------

        // TEST TEAR DOWN ----------------------------------------------------
        $ini->setVariable( 'SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess', $orgRemoveSiteaccess );
        eZSys::clearAccessPath( false );
        // -------------------------------------------------------------------
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:33,代码来源:ezsys_test.php


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