示例#1
0
                $masterCollection->update(array('cCacheFullPageContent' => 1, 'cCacheFullPageContentOverrideLifetime' => 'custom', 'cCacheFullPageContentLifetimeCustom' => 10));
            } else {
                // follow system default for other page types
                $masterCollection->update(array('cCacheFullPageContent' => -1, 'cCacheFullPageContentOverrideLifetime' => '0', 'cCacheFullPageContentLifetimeCustom' => 0));
            }
        }
    }
    flush();
    ob_flush();
}
// install single pages
$single_pths = array(array('cHandle' => 'fse_login', 'cName' => 'Sign in', 'cDescription' => 'Sign in', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_login'))), array('cHandle' => 'fse_logout', 'cName' => 'Sign out', 'cDescription' => 'Sign out'), array('cHandle' => 'fse_register', 'cName' => 'Sign up', 'cDescription' => 'Sign up', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_register'))), array('cHandle' => 'fse_request_to_reset_password', 'cName' => 'Request to Reset Password', 'cDescription' => 'Request to reset password via your primary email', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_request_to_reset_password'))), array('cHandle' => 'fse_reset_password', 'cName' => 'Reset Password', 'cDescription' => 'Reset password', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_reset_password'))), array('cHandle' => 'fse_validate_email', 'cName' => 'Validate Email', 'cDescription' => 'Validate your primary email'), array('cHandle' => 'fse_settings', 'cName' => 'Personal Settings', 'cDescription' => 'Your personal settings'), array('cHandle' => 'fse_settings/profile', 'cName' => 'Profile', 'cDescription' => 'Your profile', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_profile'))), array('cHandle' => 'fse_settings/account', 'cName' => 'Account', 'cDescription' => 'Account settings', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_change_password'), array('areaHandle' => 'Main', 'btHandle' => 'fse_email_settings'), array('areaHandle' => 'Main', 'btHandle' => 'fse_delete_account'))), array('cHandle' => 'fse_settings/applications', 'cName' => 'Applications', 'cDescription' => 'Your application keys', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_app_key'))), array('cHandle' => 'fse_settings/projects', 'cName' => 'Projects', 'cDescription' => 'Your projects', 'blocks' => array(array('areaHandle' => 'Main', 'btHandle' => 'fse_projects'))));
echo '<br/>';
echo 'Creating single pages... <br/>';
foreach ($single_pths as $sp) {
    $p = SinglePage::getByPath('/' . $sp['cHandle']);
    if ($p->getCollectionID() > 0) {
        echo $sp['cHandle'] . ' had been installed; skip installing.<br/>';
    } else {
        $p = SinglePage::add($sp['cHandle'], $pkg);
        if ($p instanceof SinglePage) {
            $p->update(array('cName' => $sp['cName'], 'cDescription' => $sp['cDescription']));
        }
        echo $sp['cHandle'] . ' newly installed.<br/>';
    }
    echo ' Check/add block to this single page...';
    // add block to single pages
    if (count($sp['blocks']) > 0) {
        foreach ($sp['blocks'] as $b) {
            if (count($p->getBlocks($b['areaHandle'])) == 0) {
                $block_type = BlockType::getByHandle($b['btHandle']);