本文整理汇总了PHP中Setting::setServiceSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::setServiceSetting方法的具体用法?PHP Setting::setServiceSetting怎么用?PHP Setting::setServiceSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::setServiceSetting方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doesExistTable
function doesExistTable($tablename)
{
global $database;
static $tables = array();
if (empty($tables)) {
$tables = POD::tableList($database['prefix']);
}
$dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', null, 'global');
if ($dbCaseInsensitive === null) {
if (in_array(POD::dbms(), array('MySQL', 'MySQLi'))) {
$result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'");
$dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0;
} else {
$dbCaseInsensitive = 1;
}
Setting::setServiceSetting('lowercaseTableNames', $dbCaseInsensitive, true);
}
if ($dbCaseInsensitive == 1) {
$tablename = strtolower($tablename);
}
if (in_array($tablename, $tables)) {
return true;
}
return false;
}
示例2: setBlogVersion
function setBlogVersion()
{
$version = TEXTCUBE_VERSION_ID;
if (defined('__TEXTCUBE_GAE__')) {
Setting::setServiceSetting('blogVersion', $version, true);
return;
}
$fp = fopen(__TEXTCUBE_CHECKUP_FILE__, 'w');
if ($fp !== FALSE) {
fwrite($fp, $version);
fclose($fp);
@chmod(__TEXTCUBE_CHECKUP_FILE__, 0666);
}
}
示例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;
}
示例4: setServiceSetting
function setServiceSetting($name, $value)
{
return Setting::setServiceSetting($name, true);
}
示例5: treatPluginTable
function treatPluginTable($plugin, $name, $fields, $keys, $version)
{
$context = Model_Context::getInstance();
$query = DBModel::getInstance();
if (doesExistTable($context->getProperty('database.prefix') . $name)) {
$keyname = 'Database_' . $name;
$value = $plugin;
$result = Setting::getServiceSetting($keyname, null, true);
if (is_null($result)) {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$query->reset('ServiceSettings');
$query->setAttribute('name', $keyname, true);
$query->setAttribute('value', $value, true);
$query->insert();
} else {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$values = explode('/', $result, 2);
if (strcmp($plugin, $values[0]) != 0) {
// diff plugin
return false;
// nothing can be done
} else {
if (strcmp($version, $values[1]) != 0) {
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', $keyname, true);
$query->setAttribute('value', $value, true);
$query->update();
$eventName = 'UpdateDB_' . $name;
fireEvent($eventName, $values[1]);
}
}
}
return true;
} else {
$query->init($name);
$query->structure = array("blogid" => array("type" => 'integer', "isNull" => false, "default" => 0, "index" => true));
$isaiExists = false;
foreach ($fields as $field) {
$branch = array();
$ai = '';
if (strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint') {
if ($field['autoincrement'] == 1 && !$isaiExists) {
$branch['autoincrement'] = true;
//$branch['index'] = true;
$isaiExists = true;
if (!in_array($field['name'], $keys)) {
$branch['index'] = true;
}
}
}
$branch['type'] = strtolower($field['attribute']);
if ($field['isnull'] == 0) {
$branch['isNull'] = false;
} else {
$branch['isNull'] = true;
}
if (!is_null($field['default'])) {
$branch['default'] = $field['default'];
}
if ($field['length'] >= 0) {
$branch['length'] = $field['length'];
}
$query->structure[$field['name']] = $branch;
}
array_unshift($keys, 'blogid');
$query->option['primary'] = $keys;
if ($query->create()) {
$keyname = Utils_Unicode::lessenAsEncoding('Database_' . $name, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
Setting::setServiceSetting($keyname, $value, true);
return true;
} else {
return false;
}
}
return true;
}
示例6: updateRandomFeed
function updateRandomFeed()
{
global $database;
$updatecycle = POD::queryCell("SELECT updatecycle FROM {$database['prefix']}FeedSettings LIMIT 1");
if ($updatecycle != 0) {
if ($feed = POD::queryRow("SELECT * FROM {$database['prefix']}Feeds WHERE modified < " . (gmmktime() - $updatecycle * 60) . " ORDER BY RAND() LIMIT 1")) {
Setting::setServiceSetting('lastFeedUpdate', gmmktime(), true);
return array(updateFeed($feed), $feed['xmlurl']);
}
}
return array(1, 'No feeds to update');
}
示例7: getDefaultCenterPanel
//.........这里部分代码省略.........
"><?php
echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 20));
?>
</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
$noticeURL = TEXTCUBE_NOTICE_URL;
$noticeURLRSS = $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko") . "/rss";
$noticeEntries = array();
if (!is_null(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')))) {
$noticeEntries = unserialize(Setting::getServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language')));
} else {
list($result, $feed, $xml) = getRemoteFeed($noticeURLRSS);
if ($result == 0) {
$xmls = new XMLStruct();
$xmls->setXPathBaseIndex(1);
$noticeEntries = array();
if ($xmls->open($xml, $ctx->getProperty('service.encoding'))) {
if ($xmls->getAttribute('/rss', 'version')) {
for ($i = 1; $link = $xmls->getValue("/rss/channel/item[{$i}]/link"); $i++) {
$item = array('permalink' => rawurldecode($link));
$item['title'] = $xmls->getValue("/rss/channel/item[{$i}]/title");
if ($xmls->getValue("/rss/channel/item[{$i}]/pubDate")) {
$item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/pubDate"));
} else {
if ($xmls->getValue("/rss/channel/item[{$i}]/dc:date")) {
$item['written'] = parseDate($xmls->getValue("/rss/channel/item[{$i}]/dc:date"));
} else {
$item['written'] = 0;
}
}
array_push($noticeEntries, $item);
}
}
}
Setting::setServiceSetting('TextcubeNotice' . $ctx->getProperty('blog.language'), serialize($noticeEntries));
}
}
?>
<div id="textcube-notice">
<h4 class="caption"><span><a href="<?php
echo $noticeURL . ($ctx->getProperty('blog.language') ? $ctx->getProperty('blog.language') : "ko");
?>
"><?php
echo _t('공지사항');
?>
</a></span></h4>
<?php
if (count($noticeEntries) > 0) {
array_splice($noticeEntries, 3, count($noticeEntries) - 3);
?>
<table>
<tbody>
<?php
foreach ($noticeEntries as $item) {
?>
<tr>
<td class="date"><?php
echo Timestamp::format2($item['written']);
?>
</td>
<td class="title"><a href="<?php
echo $item['permalink'];
?>
" onclick="return openLinkInNewWindow(this);" ><?php
echo htmlspecialchars(Utils_Unicode::lessenAsEm($item['title'], 35));
?>
</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
} else {
?>
<div id="fail-notice">
<?php
echo _t('공지사항을 가져올 수 없습니다. 잠시 후 다시 시도해 주십시오.');
?>
</div>
<?php
}
?>
</div>
<?php
}
?>
</div>
<?php
}
示例8: trashVan
function trashVan()
{
global $database;
requireModel('common.setting');
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 86400) {
// var_dump(Timestamp::getUNIXtime());
// var_dump(Setting::getServiceSetting('lastTrashSweep',0, true));
POD::execute("DELETE FROM {$database['prefix']}Comments where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
POD::execute("DELETE FROM {$database['prefix']}RemoteResponses where isfiltered < " . Timestamp::getUNIXtime() . " - 1296000 AND isfiltered > 0");
POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < " . Timestamp::getUNIXtime() . " - 604800");
Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
}
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
Setting::removeServiceSetting('TextcubeNotice', true);
Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
}
}
示例9: setServiceSettingGlobal
static function setServiceSettingGlobal($name, $value)
{
return Setting::setServiceSetting($name, $value, true);
}
示例10: getPluginTableName
function getPluginTableName()
{
requireModel('common.setting');
$ctx = Model_Context::getInstance();
$likeEscape = array('/_/', '/%/');
$likeReplace = array('\\_', '\\%');
$escapename = preg_replace($likeEscape, $likeReplace, $ctx->getProperty('database.prefix'));
$dbtables = POD::tableList($escapename);
$dbCaseInsensitive = Setting::getServiceSetting('lowercaseTableNames', true);
if ($dbCaseInsensitive === null) {
$result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'");
$dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0;
Setting::setServiceSetting('lowercaseTableNames', $dbCaseInsensitive, true);
}
$definedTables = getDefinedTableNames();
$dbtables = array_values(array_diff($dbtables, $definedTables));
if ($dbCaseInsensitive == 1) {
$tempTables = $definedTables;
$definedTables = array();
foreach ($tempTables as $table) {
$table = strtolower($table);
array_push($definedTables, $table);
}
$tempTables = $dbtables;
$dbtables = array();
foreach ($tempTables as $table) {
$table = strtolower($table);
array_push($dbtables, $table);
}
$dbtables = array_values(array_diff($dbtables, $definedTables));
}
return $dbtables;
}
示例11: trashVan
function trashVan()
{
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 86400) {
$pool = DBModel::getInstance();
$pool->reset('Comments');
$pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - 1296000);
$pool->setQualifier('isfiltered', 'b', 0);
$pool->delete();
$pool->reset('RemoteResponses');
$pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - 1296000);
$pool->setQualifier('isfiltered', 'b', 0);
$pool->delete();
$pool->reset('RefererLogs');
$pool->setQualifier('referred', 's', Timestamp::getUNIXtime() - 604800);
$pool->delete();
Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
}
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
Setting::removeServiceSetting('TextcubeNotice', true);
Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
}
}
示例12: setNotify
public function setNotify($type)
{
$type = strtolower($type);
switch ($type) {
case "google":
Setting::setServiceSetting("SitemapNotifyGoogle", $onchange ? 1 : 0);
$this->notify[$type] = $onchange;
break;
case "yahoo":
Setting::setServiceSetting("SitemapNotifyYahoo", $onchange ? 1 : 0);
$this->notify[$type] = $onchange;
break;
case "msn":
Setting::setServiceSetting("SitemapNotifyMSN", $onchange ? 1 : 0);
$this->notify[$type] = $onchange;
break;
case "ask":
Setting::setServiceSetting("SitemapNotifyASK", $onchange ? 1 : 0);
$this->notify[$type] = $onchange;
break;
case "bing":
Setting::setServiceSetting("SitemapNotifyBing", $onchange ? 1 : 0);
$this->notify[$type] = $onchange;
break;
default:
}
}
示例13: trashVan
function trashVan()
{
$context = Model_Context::getInstance();
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep', 0, true) > 43200) {
$pool = DBModel::getInstance();
$pool->reset('Comments');
$pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - $context->getProperty('service.trashtimelimit', 302400));
$pool->setQualifier('isfiltered', 'b', 0);
$pool->delete();
$pool->reset('RemoteResponses');
$pool->setQualifier('isfiltered', 's', Timestamp::getUNIXtime() - $context->getProperty('service.trashtimelimit', 302400));
$pool->setQualifier('isfiltered', 'b', 0);
$pool->delete();
$pool->reset('RefererLogs');
$pool->setQualifier('referred', 's', Timestamp::getUNIXtime() - 604800);
$pool->delete();
Setting::setServiceSetting('lastTrashSweep', Timestamp::getUNIXtime(), true);
}
if (Timestamp::getUNIXtime() - Setting::getServiceSetting('lastNoticeRead', 0, true) > 43200) {
Setting::removeServiceSetting('TextcubeNotice', true);
Setting::setServiceSetting('lastNoticeRead', Timestamp::getUNIXtime(), true);
}
}
示例14: _text
if (Setting::getServiceSetting('useNewPluginSetting', false, true) != true) {
$changed = true;
echo '<li>', _text('플러그인 환경 설정 저장 방식을 변경합니다.'), ': ';
$query = DBModel::getInstance();
$query->reset('Plugins');
if ($candidates = $query->getAll()) {
foreach ($candidates as $c) {
if (!is_null($c['settings'])) {
$query->reset('Plugins');
$query->setQualifier('blogid', 'equals', $c['blogid']);
$query->setQualifier('name', 'equals', $c['name'], true);
$query->setAttribute('settings', serialize(Setting::fetchConfigXML($c['settings'])), true);
$query->update();
}
}
Setting::setServiceSetting('useNewPluginSetting', true, true);
showCheckupMessage(true);
} else {
showCheckupMessage(false);
}
}
/* From Textcube 1.9 */
if (version_compare($currentVersion, '1.9.0', '<')) {
$changed = true;
echo '<li>', _text('기본 에디터를 변경합니다.'), ': ';
$query = DBModel::getInstance();
$query->reset('BlogSettings');
$query->setQualifier('name', 'equals', 'defaultEditor', true);
$query->setQualifier('value', 'equals', 'modern', true);
$query->setAttribute('value', 'tinyMCE', true);
if ($query->update()) {