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


PHP importlib函数代码示例

本文整理汇总了PHP中importlib函数的典型用法代码示例。如果您正苦于以下问题:PHP importlib函数的具体用法?PHP importlib怎么用?PHP importlib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: CT_Start_Default

function CT_Start_Default($target)
{
    importlib("model.blog.attachment");
    $context = Model_Context::getInstance();
    $blogURL = $context->getProperty('uri.blog');
    $blogid = $context->getProperty('blog.id');
    $target .= '<ul>';
    $target .= '<li><a href="' . $blogURL . '/owner/entry/post">' . _t('새 글을 씁니다') . '</a></li>' . CRLF;
    $latestEntryId = Setting::getBlogSettingGlobal('LatestEditedEntry_user' . getUserId(), 0);
    if ($latestEntryId !== 0) {
        $latestEntry = CT_Start_Default_getEntry($blogid, $latestEntryId);
        if ($latestEntry != false) {
            $target .= '<li><a href="' . $blogURL . '/owner/entry/edit/' . $latestEntry['id'] . '">' . _f('최근글(%1) 수정', htmlspecialchars(Utils_Unicode::lessenAsEm($latestEntry['title'], 10))) . '</a></li>';
        }
    }
    if (Acl::check('group.administrators')) {
        $target .= '<li><a href="' . $blogURL . '/owner/skin">' . _t('스킨을 변경합니다') . '</a></li>' . CRLF;
        $target .= '<li><a href="' . $blogURL . '/owner/skin/sidebar">' . _t('사이드바 구성을 변경합니다') . '</a></li>' . CRLF;
        $target .= '<li><a href="' . $blogURL . '/owner/skin/setting">' . _t('블로그에 표시되는 값들을 변경합니다') . '</a></li>' . CRLF;
        $target .= '<li><a href="' . $blogURL . '/owner/entry/category">' . _t('카테고리를 변경합니다') . '</a></li>' . CRLF;
        $target .= '<li><a href="' . $blogURL . '/owner/plugin">' . _t('플러그인을 켜거나 끕니다') . '</a></li>' . CRLF;
    }
    if ($context->getProperty('service.reader', false) != false) {
        $target .= '<li><a href="' . $blogURL . '/owner/network/reader">' . _t('RSS 리더를 봅니다') . '</a></li>' . CRLF;
    }
    $target .= '</ul>';
    return $target;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:28,代码来源:index.php

示例2: KeywordUI_bindTag

function KeywordUI_bindTag($target, $mother)
{
    $context = Model_Context::getInstance();
    importlib('model.blog.keyword');
    $blogid = getBlogId();
    $blogURL = $context->getProperty("uri.blog");
    $pluginURL = $context->getProperty("plugin.uri");
    if (isset($mother) && isset($target)) {
        $tagsWithKeywords = array();
        $keywordNames = getKeywordNames($blogid);
        foreach ($target as $tag => $tagLink) {
            if (in_array($tag, $keywordNames) == true) {
                $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>";
            } else {
                $tagsWithKeywords[$tag] = $tagLink;
            }
        }
        $target = $tagsWithKeywords;
    }
    return $target;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:21,代码来源:index.php

示例3: dumbCronScheduler

function dumbCronScheduler($checkOnly = true)
{
    $context = Model_Context::getInstance();
    $now = Timestamp::getUNIXtime();
    $dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize(array('1m' => 0, '5m' => 0, '30m' => 0, '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0)), true);
    $dumbCronStamps = unserialize($dumbCronStamps);
    $schedules = array('1m' => 60, '5m' => 60 * 5, '10m' => 60 * 10, '30m' => 60 * 30, '1h' => 60 * 60, '2h' => 60 * 60 * 2, '6h' => 60 * 60 * 6, '12h' => 60 * 60 * 12, '24h' => 60 * 60 * 24, 'Daily' => 60 * 60 * 24, '1w' => 60 * 60 * 24 * 7);
    /* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */
    $log_file = __TEXTCUBE_CACHE_DIR__ . '/cronlog.txt';
    $log = fopen($log_file, "a");
    foreach ($schedules as $d => $diff) {
        if (!isset($dumbCronStamps[$d])) {
            $dumbCronStamps[$d] = 0;
        }
        if ($now > $diff + $dumbCronStamps[$d]) {
            if ($checkOnly && eventExists("Cron{$d}")) {
                fclose($log);
                return true;
            }
            fireEvent("Cron{$d}", null, $now);
            if ($d == '6h') {
                importlib('model.blog.trash');
                trashVan();
            }
            fwrite($log, date('Y-m-d H:i:s') . ' ' . $context->getProperty('blog.name') . " Cron{$d} executed ({$_SERVER['REQUEST_URI']})\r\n");
            $dumbCronStamps[$d] = $now;
        }
    }
    fclose($log);
    /* Keep just 1000 lines */
    $logcontent = explode("\r\n", file_get_contents($log_file));
    $logcontent = implode("\r\n", array_slice($logcontent, -1000));
    $log = fopen($log_file, "w");
    fwrite($log, $logcontent);
    fclose($log);
    Setting::setServiceSetting('dumbCronStamps', serialize($dumbCronStamps), true);
    return false;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:38,代码来源:cron.php

示例4: array

<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('title' => array('string', 'default' => '')));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
if (!empty($_POST['title'])) {
    importlib('model.blog.blogSetting');
    if (setBlogTitle(getBlogId(), trim($_POST['title']))) {
        Respond::ResultPage(0);
    }
}
Respond::ResultPage(-1);
开发者ID:webhacking,项目名称:Textcube,代码行数:15,代码来源:index.php

示例5: importlib

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
$tabsClass['cover'] = true;
importlib('blogskin');
importlib("model.blog.sidebar");
importlib("model.blog.coverpage");
importlib("model.blog.entry");
importlib("model.blog.archive");
importlib("model.blog.tag");
importlib("model.blog.notice");
importlib("model.blog.comment");
importlib("model.blog.remoteresponse");
importlib("model.blog.link");
require ROOT . '/interface/common/owner/header.php';
$service['pagecache'] = false;
// For plugin setting update.
$stats = Statistics::getStatistics($blogid);
function correctCoverpageImage($subject)
{
    $pattern_with_src = '/(?:\\ssrc\\s*=\\s*["\']?)([^\\s^"^>^\']+)(?:[\\s">\'])/i';
    $pattern_with_background = '/(?:\\sbackground\\s*=\\s*["\']??)([^\\s^"^>^\']+)(?:[\\s">\'])/i';
    $pattern_with_url_func = '/(?:url\\s*\\(\\s*\'?)([^)]+)(?:\'?\\s*\\))/i';
    $return_val = preg_replace_callback($pattern_with_src, 'correctImagePath', $subject);
    $return_val = preg_replace_callback($pattern_with_background, 'correctImagePath', $return_val);
    $return_val = preg_replace_callback($pattern_with_url_func, 'correctImagePath', $return_val);
    return $return_val;
}
function correctImagePath($match)
开发者ID:webhacking,项目名称:Textcube,代码行数:30,代码来源:index.php

示例6: array

<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('allowBlogVisibility' => array('bool'), 'requireLogin' => array('bool'), 'encoding' => array('string'), 'faviconDailyTraffic' => array('int'), 'flashClipboardPoter' => array('bool'), 'flashUploader' => array('bool'), 'language' => array('string'), 'serviceurl' => array('string'), 'cookieprefix' => array('string', 'mandatory' => false, 'default' => ''), 'skin' => array('string'), 'timeout' => array('int'), 'autologinTimeout' => array('int'), 'timezone' => array('string'), 'useDebugMode' => array('bool'), 'useEncodedURL' => array('bool'), 'useNumericRSS' => array('bool'), 'usePageCache' => array('bool'), 'useCodeCache' => array('bool'), 'useReader' => array('bool'), 'useRewriteDebugMode' => array('bool'), 'useSessionDebugMode' => array('bool'), 'useSkinCache' => array('bool'), 'useMemcached' => array('bool'), 'useExternalResource' => array('bool'), 'externalResourceURL' => array('string', 'mandatory' => false, 'default' => '')));
require ROOT . '/library/preprocessor.php';
importlib('model.blog.service');
requireStrictRoute();
$matchTable = array('timeout' => 'timeout', 'autologinTimeout' => 'autologinTimeout', 'skin' => 'skin', 'language' => 'language', 'timezone' => 'timezone', 'encoding' => 'encoding', 'serviceurl' => 'serviceURL', 'cookieprefix' => 'cookie_prefix', 'usePageCache' => 'pagecache', 'useCodeCache' => 'codecache', 'useSkinCache' => 'skincache', 'useMemcached' => 'memcached', 'useReader' => 'reader', 'useNumericRSS' => 'useNumericRSS', 'useEncodedURL' => 'useEncodedURL', 'useExternalResource' => 'externalresources', 'externalResourceURL' => 'resourcepath', 'allowBlogVisibility' => 'allowBlogVisibilitySetting', 'requireLogin' => 'requirelogin', 'flashClipboardPoter' => 'flashclipboardpoter', 'flashUploader' => 'flashuploader', 'useDebugMode' => 'debugmode', 'useSessionDebugMode' => 'debug_session_dump', 'useRewriteDebugMode' => 'debug_rewrite_module', 'faviconDailyTraffic' => 'favicon_daily_traffic');
$description = array('server' => 'Database server location. Can be socket or address.', 'database' => 'Database name.', 'username' => 'Database username.', 'password' => 'Database password.', 'dbms' => 'Database engine.', 'prefix' => 'Table prefix in database.', 'type' => 'Service type. [single|path|domain] e.g. [http://www.example.com/blog | http://www.example.com/blog/blog1 | http://blog1.example.com].', 'domain' => 'Service domain. (http://www.example.com)', 'path' => 'Service path. (e.g. /blog)', 'timeout' => 'Session timeout limit (sec.)', 'autologinTimeout' => 'Automatic login timeout (sec.)', 'skin' => 'Default blog skin name.', 'language' => 'Server language', 'timezone' => 'Server timezone', 'encoding' => 'Character encoding', 'serviceURL' => 'Specify the default service URL. Useful if using other web program under the same domain.', 'cookie_prefix' => 'Service cookie prefix. Default cookie prefix is Textcube_[VERSION_NUMBER].', 'pagecache' => 'Use pagecache function.', 'codecache' => 'Use codecache function.', 'skincache' => 'Use skin pre-fetching.', 'memcached' => 'Use memcache to handle session and cache', 'reader' => 'Use Textcube reader. You can set it to false if you do not use Textcube reader, and want to decrease DB load.', 'useNumericRSS' => 'Can force permalink to numeric format on RSS output.', 'useEncodedURL' => 'URL encoding using RFC1738', 'externalresources' => 'Loads resources from external CDN from resourceURL.', 'resourcepath' => 'Specify the full URI of external resource.', 'useSSL' => 'Use SSL connection. Every http:// will be replaced with https://', 'allowBlogVisibilitySetting' => 'Allow service users to change blog visibility.', 'requirelogin' => 'Force log-in process to every blogs. (for private blog service)', 'flashclipboardpoter' => 'Use Flash clipboard copy to support one-click trackback address copy.', 'flashuploader' => 'Use Flash uploader to upload multiple files.', 'debugmode' => 'Textcube debug mode. (for core / plugin debug or optimization)', 'debug_session_dump' => 'session info debuging.', 'debug_rewrite_module' => 'rewrite handling module info debuging.', 'favicon_daily_traffic' => 'Set favicon traffic limitation. default is 10MB.');
/* Exception handling */
$config = array();
foreach ($matchTable as $abs => $real) {
    if ($_POST[$abs] === 1) {
        $config[$real] = true;
    } else {
        if ($_POST[$abs] === 0) {
            $config[$real] = false;
        } else {
            $config[$real] = $_POST[$abs];
        }
    }
}
$result = writeConfigFile($config, $description);
if ($result === true) {
    Respond::PrintResult(array('error' => 0));
} else {
    Respond::PrintResult(array('error' => 1, 'msg' => $result));
}
开发者ID:webhacking,项目名称:Textcube,代码行数:30,代码来源:index.php

示例7: array

<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('GET' => array('url' => array('url', 'default' => null)));
require ROOT . '/library/preprocessor.php';
importlib("model.blog.remoteresponse");
requireStrictRoute();
Respond::ResultPage(!empty($_GET['url']) && sendTrackback($blogid, $suri['id'], trim($_GET['url'])));
开发者ID:webhacking,项目名称:Textcube,代码行数:10,代码来源:index.php

示例8: array

<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('names' => array('string', 'default' => null)));
require ROOT . '/library/preprocessor.php';
importlib("model.blog.attachment");
requireStrictRoute();
if (!empty($_POST['names']) && deleteAttachmentMulti($blogid, $suri['id'], $_POST['names'])) {
    Respond::ResultPage(0);
} else {
    Respond::ResultPage(-1);
}
开发者ID:webhacking,项目名称:Textcube,代码行数:14,代码来源:index.php

示例9: stripPath

    $path = stripPath(substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF']) - 12));
}
$_SERVER['PHP_SELF'] = rtrim($_SERVER['PHP_SELF'], '/');
// Set default table prefix.
if (isset($_POST['dbPrefix']) && $_POST['dbPrefix'] == '') {
    $_POST['dbPrefix'] == 'tc_';
}
$context = Model_Context::getInstance();
$context->setProperty('import.library', array('function.string', 'function.time', 'function.javascript', 'function.html', 'function.xml', 'function.mail'));
if (isset($_POST['dbms'])) {
    $database['dbms'] = $_POST['dbms'];
}
require ROOT . '/library/include.php';
importlib('model.blog.blogSetting');
importlib('model.blog.entry');
importlib('auth');
if (!empty($_GET['test'])) {
    echo getFingerPrint();
    exit;
}
$baseLanguage = 'ko';
if (!empty($_POST['Lang'])) {
    $baseLanguage = $_POST['Lang'];
}
$locale = Locales::getInstance();
$locale->setDomain('setup');
if ($locale->setDirectory(ROOT . '/resources/locale/setup')) {
    $locale->set($baseLanguage, "setup");
}
if (file_exists($root . '/config.php') && filesize($root . '/config.php') > 0) {
    header('HTTP/1.1 503 Service Unavailable');
开发者ID:hoksi,项目名称:Textcube,代码行数:31,代码来源:setup.php

示例10: array

<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('visibility' => array('int', 0, 3), 'starred' => array('int', 0, 2), 'category' => array('int', 'default' => 0), 'title' => array('string'), 'content' => array('string'), 'contentformatter' => array('string'), 'contenteditor' => array('string'), 'permalink' => array('string', 'default' => ''), 'location' => array('string', 'default' => '/'), 'latitude' => array('number', 'default' => null, 'min' => -90.0, 'max' => 90.0, 'bypass' => true), 'longitude' => array('number', 'default' => null, 'min' => -180.0, 'max' => 180.0, 'bypass' => true), 'tag' => array('string', 'default' => ''), 'acceptcomment' => array(array('0', '1'), 'default' => '0'), 'accepttrackback' => array(array('0', '1'), 'default' => '0'), 'published' => array('int', 0, 'default' => 1)));
require ROOT . '/library/preprocessor.php';
importlib('model.blog.entry');
requireStrictRoute();
if (empty($suri['id'])) {
    $entry = array();
} else {
    $updateDraft = 0;
    $entry = getEntry($blogid, $suri['id']);
    if (is_null($entry)) {
        $entry = getEntry($blogid, $suri['id'], true);
        $updateDraft = 1;
    }
}
if (empty($suri['id']) || !is_null($entry)) {
    $entry['visibility'] = $_POST['visibility'];
    $entry['starred'] = $_POST['starred'];
    $entry['category'] = $_POST['category'];
    $entry['location'] = empty($_POST['location']) ? '/' : $_POST['location'];
    $entry['latitude'] = empty($_POST['latitude']) || $_POST['latitude'] == "null" ? null : $_POST['latitude'];
    $entry['longitude'] = empty($_POST['longitude']) || $_POST['longitude'] == "null" ? null : $_POST['longitude'];
    $entry['tag'] = empty($_POST['tag']) ? '' : $_POST['tag'];
    $entry['title'] = $_POST['title'];
    $entry['content'] = $_POST['content'];
    $entry['contentformatter'] = $_POST['contentformatter'];
    $entry['contenteditor'] = $_POST['contenteditor'];
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例11: getSloganById

 $entry['id'] = $entryId;
 $entry['slogan'] = getSloganById($blogid, $entryId);
 if (!$comment['secret']) {
     $pool = DBModel::getInstance();
     $pool->reset('Entries');
     $pool->setQualifier('blogid', 'equals', $blogid);
     $pool->setQualifier('id', 'equals', $entryId);
     $pool->setQualifier('draft', 'equals', 0);
     $pool->setQualifier('visibility', 'equals', 3);
     $pool->setQualifier('acceptcomment', 'equals', 1);
     $row = $pool->getAll('*');
     if (!empty($row)) {
         sendCommentPing($entryId, $context->getProperty('uri.default') . "/" . ($context->getProperty('blog.useSloganOnPost') ? "entry/{$row['slogan']}" : $entryId), is_null($user) ? $comment['name'] : $user['name'], is_null($user) ? $comment['homepage'] : $user['homepage']);
     }
 }
 importlib('model.blog.skin');
 $skin = new Skin($context->getProperty('skin.skin'));
 if ($entryId > 0) {
     $commentBlock = getCommentView($entry, $skin);
     dress('article_rep_id', $entryId, $commentBlock);
     $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock)));
     $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), null, $skin->recentCommentItem)));
     $commentCount = getCommentCount($blogid, $entryId);
     $commentCount = $commentCount > 0 ? $commentCount : 0;
     list($tempTag, $commentView) = getCommentCountPart($commentCount, $skin);
 } else {
     $commentView = '';
     $commentBlock = getCommentView($entry, $skin);
     dress('article_rep_id', $entryId, $commentBlock);
     $commentBlock = escapeCData(revertTempTags(removeAllTags($commentBlock)));
     $commentCount = 0;
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例12: foreach

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
/** Pre-define basic components */
/***** Loading code pieces *****/
if (isset($uri)) {
    $codeName = $uri->uri['interfaceType'];
}
if ($context->getProperty('service.codecache', null) == true && file_exists(__TEXTCUBE_CACHE_DIR__ . '/code/' . $codeName)) {
    $codeCacheRead = true;
    require __TEXTCUBE_CACHE_DIR__ . '/code/' . $codeName;
} else {
    $codeCacheRead = false;
    foreach ($context->getProperty('import.library') as $lib) {
        if (strpos($lib, 'DEBUG') === false) {
            importlib($lib);
        } else {
            if (defined('TCDEBUG')) {
                __tcSqlLogPoint($lib);
            }
        }
    }
}
if ($context->getProperty('service.codecache', null) == true && $codeCacheRead == false) {
    $libCode = new CodeCache();
    $libCode->name = $codeName;
    foreach ($context->getProperty('import.library') as $lib) {
        array_push($libCode->sources, '/library/' . str_replace(".", "/", $lib) . '.php');
    }
    $libCode->save();
    unset($libCode);
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:include.php

示例13: setDefaultPost

function setDefaultPost($blogid, $userid)
{
    importlib('model.blog.entry');
    $entry = array();
    $entry['category'] = 0;
    $entry['visibility'] = 2;
    $entry['location'] = '/';
    $entry['tag'] = '';
    $entry['title'] = _t('환영합니다!');
    $entry['slogan'] = 'welcome';
    $entry['contentformatter'] = 'ttml';
    $entry['contenteditor'] = 'tinyMCE';
    $entry['starred'] = 0;
    $entry['acceptcomment'] = 1;
    $entry['accepttrackback'] = 1;
    $entry['published'] = null;
    $entry['firstEntry'] = true;
    $entry['content'] = getDefaultPostContent();
    return addEntry($blogid, $entry, $userid);
}
开发者ID:webhacking,项目名称:Textcube,代码行数:20,代码来源:blogSetting.php

示例14: array

<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('visibility' => array('int', 0, 3, 'mandatory' => false), 'acceptComments' => array('int', 0, 1, 'mandatory' => false), 'acceptTrackbacks' => array('int', 0, 1, 'mandatory' => false), 'useiPhoneUI' => array('int', 0, 1, 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
importlib('model.blog.feed');
requireStrictRoute();
$result = false;
if (isset($_POST['visibility'])) {
    if (Setting::setBlogSettingGlobal('visibility', $_POST['visibility'])) {
        CacheControl::flushCommentRSS();
        CacheControl::flushTrackbackRSS();
        clearFeed();
        $result = true;
    }
}
if (isset($_POST['acceptComments'])) {
    if (Setting::setBlogSettingGlobal('acceptComments', $_POST['acceptComments'])) {
        $result = true;
    }
}
if (isset($_POST['acceptTrackbacks'])) {
    if (Setting::setBlogSettingGlobal('acceptTrackbacks', $_POST['acceptTrackbacks'])) {
        $result = true;
    }
}
if (isset($_POST['useiPhoneUI'])) {
    if ($_POST['useiPhoneUI'] == 1) {
        $useiPhoneUI = true;
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php

示例15: save

 function save()
 {
     global $database;
     importlib('model.common.setting');
     if (isset($this->name)) {
         $this->name = trim($this->name);
         if (!BlogSetting::validateName($this->name)) {
             return $this->_error('name');
         }
         Setting::setBlogSettingGlobal('name', $this->name);
     }
     if (isset($this->secondaryDomain)) {
         $this->secondaryDomain = trim($this->secondaryDomain);
         if (!Validator::domain($this->secondaryDomain)) {
             return $this->_error('secondaryDomain');
         }
         Setting::setBlogSettingGlobal('secondaryDomain', $this->secondaryDomain);
     }
     if (isset($this->defaultDomain)) {
         Setting::setBlogSettingGlobal('defaultDomain', Validator::getBit($this->defaultDomain));
     }
     if (isset($this->title)) {
         $this->title = trim($this->title);
         Setting::setBlogSettingGlobal('title', $this->title);
     }
     if (isset($this->description)) {
         $this->description = trim($this->description);
         Setting::setBlogSettingGlobal('description', $this->description);
     }
     if (isset($this->banner)) {
         if (strlen($this->banner) != 0 && !Validator::filename($this->banner)) {
             return $this->_error('banner');
         }
         Setting::setBlogSettingGlobal('logo', $this->banner);
     }
     if (isset($this->useSloganOnPost)) {
         Setting::setBlogSettingGlobal('useSloganOnPost', Validator::getBit($this->useSloganOnPost));
     }
     if (isset($this->useSloganOnCategory)) {
         Setting::setBlogSettingGlobal('useSloganOnCategory', Validator::getBit($this->useSloganOnCategory));
     }
     if (isset($this->useSloganOnTag)) {
         Setting::setBlogSettingGlobal('useSloganOnTag', Validator::getBit($this->useSloganOnTag));
     }
     if (isset($this->postsOnPage)) {
         if (!Validator::number($this->postsOnPage, 1)) {
             return $this->_error('postsOnPage');
         }
         Setting::setBlogSettingGlobal('entriesOnPage', $this->postsOnPage);
     }
     if (isset($this->postsOnList)) {
         if (!Validator::number($this->postsOnList, 1)) {
             return $this->_error('postsOnList');
         }
         Setting::setBlogSettingGlobal('entriesOnList', $this->postsOnList);
     }
     if (isset($this->postsOnFeed)) {
         if (!Validator::number($this->postsOnFeed, 1)) {
             return $this->_error('postsOnFeed');
         }
         Setting::setBlogSettingGlobal('entriesOnRSS', $this->postsOnFeed);
     }
     if (isset($this->publishWholeOnFeed)) {
         Setting::setBlogSettingGlobal('publishWholeOnRSS', Validator::getBit($this->publishWholeOnFeed));
     }
     if (isset($this->acceptGuestComment)) {
         Setting::setBlogSettingGlobal('allowWriteOnGuestbook', Validator::getBit($this->acceptGuestComment));
     }
     if (isset($this->acceptcommentOnGuestComment)) {
         Setting::setBlogSettingGlobal('allowWriteDblCommentOnGuestbook', Validator::getBit($this->acceptcommentOnGuestComment));
     }
     if (isset($this->language)) {
         if (!Validator::language($this->language)) {
             return $this->_error('language');
         }
         Setting::setBlogSettingGlobal('language', $this->language);
     }
     if (isset($this->timezone)) {
         if (empty($this->timezone)) {
             return $this->_error('timezone');
         }
         Setting::setBlogSettingGlobal('timezone', $this->timezone);
     }
     return true;
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:85,代码来源:Textcube.Data.BlogSetting.php


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