本文整理汇总了PHP中POD::charset方法的典型用法代码示例。如果您正苦于以下问题:PHP POD::charset方法的具体用法?PHP POD::charset怎么用?PHP POD::charset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POD
的用法示例。
在下文中一共展示了POD::charset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register_shutdown_function
$db['database'] = $context->getProperty('database');
$db['server'] = $context->getProperty('server');
$db['port'] = $context->getProperty('port');
$db['username'] = $context->getProperty('username');
$db['password'] = $context->getProperty('password');
$context->useNamespace();
if (POD::bind($db) === false) {
Respond::MessagePage('Problem with connecting database.<br /><br />Please re-visit later.');
exit;
}
POD::cacheLoad();
register_shutdown_function(array('POD', 'cacheSave'));
$context->setProperty('database.connected', true);
//register_shutdown_function( array('POD','unbind') );
}
$database['utf8'] = POD::charset() == 'utf8' ? true : false;
/// Memcache module bind (if possible)
global $memcache;
$memcache = null;
if ($context->getProperty('service.memcached') == true) {
$memcache = new Memcache();
$memcache->connect(!is_null($context->getProperty('memcached.server')) ? $context->getProperty('memcached.server') : 'localhost');
}
/** INITIALIZE : URI Parsing and specify parameters
* -----------------------------------------------
* Textcube judges blogid from its URI.
* After parsing URI-specific variables, fetch global variables (legacy support till Textcube 2)
*/
$__requireComponent = array('Textcube.Core', 'Needlworks.Cache.PageCache');
foreach ($__requireComponent as $lib) {
require ROOT . '/framework/legacy/' . $lib . '.php';
示例2: checkStep
//.........这里部分代码省略.........
</span>
<?php
} else {
if (count($required) == 0) {
?>
<li>OK</li>
<?php
} else {
$error = 4;
?>
<span style="color:red"><?php
echo _t('함수가 설치되어야 합니다.');
?>
</span>
<?php
foreach ($required as $function) {
?>
<li style="color:red"><?php
echo $function;
?>
</li>
<?php
}
}
}
?>
</ul>
<h3><?php
echo POD::dbms();
?>
</h3>
<ul>
<?php
if (POD::charset() == 'utf8') {
echo '<li>Character Set: OK</li>';
} else {
echo '<li style="color:navy">Character Set: ', _t('UTF8 미지원 (경고: 한글 지원이 불완전할 수 있습니다.)'), '</li>';
}
if (POD::query("CREATE TABLE {$_POST['dbPrefix']}Setup (a INT NOT NULL)")) {
POD::query("DROP TABLE {$_POST['dbPrefix']}Setup");
echo '<li>', _t('테이블 생성 권한'), ': OK</li>';
} else {
$error = 6;
echo '<li style="color:red">', _t('테이블 생성 권한'), ': ', _t('없음'), '</li>';
}
?>
</ul>
<?php
$tables = array();
if ($result = POD::tableList()) {
foreach ($result as $table) {
if (strncmp($table, $_POST['dbPrefix'], strlen($_POST['dbPrefix']))) {
continue;
}
switch (strtolower(substr($table, strlen($_POST['dbPrefix'])))) {
case 'attachments':
case 'blogsettings':
case 'blogstatistics':
case 'categories':
case 'comments':
case 'commentsnotified':
case 'commentsnotifiedqueue':
case 'commentsnotifiedsiteinfo':
case 'dailystatistics':
case 'entries':
case 'entriesarchive':
示例3: treatPluginTable
function treatPluginTable($plugin, $name, $fields, $keys, $version)
{
$context = Model_Context::getInstance();
// global $context;
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 = DBModel::getInstance();
$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 = DBModel::getInstance();
$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 = "CREATE TABLE " . $context->getProperty('database.prefix') . $name . " (blogid int(11) NOT NULL default 0,";
$isaiExists = false;
$index = '';
foreach ($fields as $field) {
$ai = '';
if (strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint') {
if ($field['autoincrement'] == 1 && !$isaiExists) {
$ai = ' AUTO_INCREMENT ';
$isaiExists = true;
if (!in_array($field['name'], $keys)) {
$index = ", KEY({$field['name']})";
}
}
}
$isNull = $field['isnull'] == 0 ? ' NOT NULL ' : ' NULL ';
$defaultValue = is_null($field['default']) ? '' : " DEFAULT '" . POD::escapeString($field['default']) . "' ";
$fieldLength = $field['length'] >= 0 ? "(" . $field['length'] . ")" : '';
$sentence = $field['name'] . " " . $field['attribute'] . $fieldLength . $isNull . $defaultValue . $ai . ",";
$query .= $sentence;
}
array_unshift($keys, 'blogid');
$query .= " PRIMARY KEY (" . implode(',', $keys) . ")";
$query .= $index;
$query .= ") TYPE=MyISAM ";
$query .= POD::charset() == 'utf8' ? 'DEFAULT CHARSET=utf8' : '';
if (POD::execute($query)) {
$keyname = Utils_Unicode::lessenAsEncoding('Database_' . $name, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
Setting::setServiceSetting($keyname, $value, true);
#POD::execute("INSERT INTO {$database['prefix']}ServiceSettings SET name='$keyname', value ='$value'");
return true;
} else {
return false;
}
}
return true;
}