本文整理汇总了PHP中MyTextSanitizer::sGetInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP MyTextSanitizer::sGetInstance方法的具体用法?PHP MyTextSanitizer::sGetInstance怎么用?PHP MyTextSanitizer::sGetInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyTextSanitizer
的用法示例。
在下文中一共展示了MyTextSanitizer::sGetInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: b_sitemap_xpwiki
function b_sitemap_xpwiki($mydirname)
{
global $sitemap_configs;
(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
$ret = array();
include_once dirname(dirname(__FILE__)) . '/include.php';
$xpwiki =& XpWiki::getInitedSingleton($mydirname);
$result = $xpwiki->func->get_existpages(FALSE, '', array('limit' => 5, 'order' => ' ORDER BY editedtime DESC', 'select' => array('title'), 'nolisting' => TRUE));
$ret = array();
// Recent Changes
$show_cat = @$sitemap_configs['show_subcategoris'] ? 'child' : 'parent';
if ($show_cat === 'child') {
$ret['id'] = 0;
$ret['title'] = $xpwiki->root->_LANG['skin']['recent'];
$ret['url'] = '?' . rawurlencode($xpwiki->root->whatsnew);
}
foreach ($result as $_res) {
$pgid = $_res['pgid'];
$page = $_res['name'];
$title = $_res['title'];
$title = $xpwiki->root->pagename_num2str ? preg_replace('/\\/(?:[0-9\\-]+|[B0-9][A-Z0-9]{9})$/', '/' . $xpwiki->func->get_heading($page), $page) : $page;
$ret[$show_cat][] = array("id" => intval($pgid), "title" => $myts->makeTboxData4Show($title), "url" => $xpwiki->func->get_page_uri($page), 'image' => 2);
}
if ($show_cat === 'child') {
$ret = array('parent' => array($ret));
}
// Other menus
$ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['list'], 'url' => '?cmd=list');
$ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_attach_messages['msg_list'], 'url' => '?plugin=attach&pcmd=list');
$ret['parent'][] = array('id' => 0, 'title' => $xpwiki->root->_LANG['skin']['help'], 'url' => '?Help');
return $ret;
}
示例2: reassign
function reassign($data)
{
(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
$entries = array();
foreach ($data['entry'] as $item) {
$ctime = preg_split("/[-: ]/", $item['create_time']);
$yd_timestamp = mktime($ctime[3], $ctime[4], $ctime[5], $ctime[1], $ctime[2], $ctime[0]);
$entry = array('pubtime' => $yd_timestamp, 'link' => $item['url'], 'headline' => $item['title'], 'description' => strip_tags($item['diary']), 'allow_html' => true);
$entry['fingerprint'] = $entry['link'];
$entries[] = $entry;
}
return $entries;
}
示例3: fetchSummary
function fetchSummary($pgid)
{
$db =& Database::getInstance();
(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextsanitizer::getInstance());
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($this->mydirname);
$pgid = intval($pgid);
$mydirname = $this->mydirname;
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
// query
$data = $db->fetchArray($db->query("SELECT `name`, `title`, `editedtime` FROM " . $db->prefix($mydirname . "_pginfo") . " WHERE `pgid`={$pgid} LIMIT 1"));
// get body
$uri = $body = '';
if ($data['name'] !== '') {
if (strpos(@$_SERVER['REQUEST_URI'], '/modules/' . $mydirname) === FALSE) {
include_once dirname(dirname(__FILE__)) . "/include.php";
$page =& XpWiki::getSingleton($mydirname);
if ($data['editedtime']) {
$page->init($data['name']);
$page->execute();
$body = $page->body;
} else {
$body = _MD_D3FORUM_ERR_READPOST . " \n" . '"' . $data['name'] . '" is deleted.';
}
$uri = $page->func->get_page_uri($data['name'], true);
}
} else {
$body = _MD_D3FORUM_ERR_READPOST;
}
// make subject
$subject = $data['name'];
if ($subject !== $data['title']) {
$subject .= ' [ ' . $data['title'] . ' ]';
}
return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($subject), 'uri' => $uri, 'summary' => xoops_substr(strip_tags($body), 0, 255));
}
示例4: __construct
public function __construct($mydirname, $req_uid = 0, $caller = "")
{
global $xoopsUser, $xoopsConfig;
$this->start_time = (int) (microtime(true) * 1000);
$this->db =& Database::getInstance();
$this->mydirname = $mydirname;
$this->caller = $caller;
if (is_object(@$xoopsUser)) {
$this->uid = intval($xoopsUser->getVar('uid'));
$this->uname = $xoopsUser->getVar('uname');
$this->name = $xoopsUser->getVar('name');
} else {
$this->uid = 0;
$this->uname = "";
$this->name = "";
}
$this->req_uid = (int) $req_uid > 0 ? (int) $req_uid : ((int) $this->getpost_param("req_uid") ? (int) $this->getpost_param("req_uid") : 0);
// ((int)$this->getpost_param("req_uid") ? (int)$this->getpost_param("req_uid") : $this->uid ) ; // !! Must not do this
//var_dump($this->mydirname); var_dump($this->req_uid); var_dump($this->uid); var_dump($caller); echo "<br />";
// module ID
$module_handler =& xoops_gethandler('module');
$this_module =& $module_handler->getByDirname($this->mydirname);
if (is_object($this_module)) {
$this->mid = (int) $this_module->getVar('mid');
$this->module_name = $this_module->getVar('name');
// module config
$config_handler =& xoops_gethandler("config");
$this->mod_config = $config_handler->getConfigsByCat(0, $this->mid);
}
// is_main
$constpref = "_MB_" . strtoupper($this->mydirname);
if (defined("_MD_W_SUN")) {
$this->is_main = true;
} elseif (!defined($constpref . "_W_SUN")) {
$langmanpath = XOOPS_TRUST_PATH . '/libs/altsys/class/D3LanguageManager.class.php';
if (!file_exists($langmanpath)) {
die('install the latest altsys');
}
require_once $langmanpath;
$langman =& D3LanguageManager::getInstance();
$mytrustdirname = basename(dirname(dirname(__FILE__)));
$langman->read('blocks_each.php', $this->mydirname, $mytrustdirname, false);
}
if (XOOPS_USE_MULTIBYTES == 1) {
// mbstring emulator
if (!extension_loaded('mbstring') && !class_exists('HypMBString')) {
if (file_exists(XOOPS_TRUST_PATH . '/class/hyp_common/mbemulator/mb-emulator.php')) {
require_once XOOPS_TRUST_PATH . '/class/hyp_common/mbemulator/mb-emulator.php';
}
}
// rss feed encoding from
switch ($this->mod_config['enc_from']) {
case 'xoops_charset':
$this->enc_from = _CHARSET;
break;
case 'auto':
$this->enc_from = "auto";
break;
case 'default':
default:
// null
}
}
$this->params['uploaddir_abs'] = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/upimg/';
// photo upload dir
$this->params['previewdir'] = 'prev/';
// photo preview dir
$this->params['cachedir'] = XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/cache/';
// photo cache dir
//if( $caller != "xoops_uname" ) {
$_year = $this->getpost_param('year');
$_month = $this->getpost_param('month');
$this->set_month($_year, $_month);
// permission_class (read ef class and create the object)
$perm_class = empty($this->mod_config['permission_class']) ? 'd3diaryPermission' : preg_replace('/[^0-9a-zA-Z_]/', '', $this->mod_config['permission_class']);
(method_exists('MyTextSanitizer', 'sGetInstance') and $this->myts =& MyTextSanitizer::sGetInstance()) || ($this->myts =& MyTextSanitizer::getInstance());
require_once dirname(__FILE__) . '/' . $perm_class . '.class.php';
require_once dirname(__FILE__) . '/groupperm.class.php';
require_once dirname(__FILE__) . '/func.class.php';
include_once dirname(__FILE__) . '/diaryconfig.class.php';
require_once dirname(__FILE__) . '/sanitizer.class.php';
$this->mPerm = new $perm_class($this);
$this->gPerm = new D3dGperm($this);
$this->func = new D3diaryFunc($this);
// needs req_uid
$this->mPerm->ini_set();
$this->gPerm->ini_set();
$this->func->ini_set();
// get personal config for req_uid
$this->dcfg = new DiaryConfig();
$this->dcfg->uid = $this->req_uid;
$this->dcfg->readdb($this->mydirname);
// sanitizer class for input validation vulnerabilities
$this->sani = new D3diarySanitizer();
// mail post class
if ($this->caller == "mailpost" || $this->caller == "index") {
require_once dirname(__FILE__) . '/mailpost.class.php';
$this->mPost = new D3diaryMailPost($this);
$this->mPost->ini_set();
}
//.........这里部分代码省略.........
示例5: array
} else {
// no custom session cookie set, destroy session if any
$_SESSION = array();
//session_destroy();
}
@ini_set('session.gc_maxlifetime', $xoopsConfig['session_expire'] * 60);
@ini_set('session.cookie_lifetime', $xoopsConfig['session_expire'] * 60);
}
session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
session_start();
// autologin hack GIJ
if ($xoopsConfig['autologin'] && empty($_SESSION['xoopsUserId']) && isset($_COOKIE['autologin_uname']) && isset($_COOKIE['autologin_pass'])) {
if (!empty($_POST)) {
redirect_header(XOOPS_URL . '/', 0, _RETRYPOST);
}
(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
$uname = $myts->stripSlashesGPC($_COOKIE['autologin_uname']);
$pass = $myts->stripSlashesGPC($_COOKIE['autologin_pass']);
if (empty($uname) || is_numeric($pass)) {
$user = false;
} else {
// V3
$uname4sql = addslashes($uname);
$criteria = new CriteriaCompo(new Criteria('uname', $uname4sql));
$user_handler =& xoops_gethandler('user');
$users =& $user_handler->getObjects($criteria, false);
if (empty($users) || count($users) != 1) {
$user = false;
} else {
// V3.1 begin
$user = $users[0];
示例6: hypconfShowForm
function hypconfShowForm($config)
{
global $constpref, $mydirname, $mydirpath, $mytrustdirpath, $page, $xoopsConfig, $xoopsGTicket;
if (!$config) {
die('no configs');
}
if (isset($config['error'])) {
echo '<div class="error">' . join('</div><div class="error">', $config['error']) . '</div>';
unset($config['error']);
}
if (isset($config['contents'])) {
echo $config['contents'];
unset($config['contents']);
}
$underContents = '';
if (isset($config['underContents'])) {
$underContents = $config['underContents'];
unset($config['underContents']);
}
if ($config) {
$count = count($config);
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
include_once dirname(dirname(__FILE__)) . '/class/formcheckbox.php';
if (!XC_CLASS_EXISTS('XoopsFormBreak')) {
include_once dirname(dirname(__FILE__)) . '/class/formbreak.php';
}
$form = new XoopsThemeForm(hypconf_constant($constpref . '_ADMENU_' . strtoupper($page)), 'pref_form', 'index.php');
$button_tray = new XoopsFormElementTray("");
for ($i = 0; $i < $count; $i++) {
$description = defined($config[$i]['description']) ? constant($config[$i]['description']) : '';
//$title4tray = (!$description) ? hypconf_constant($config[$i]['title']) : hypconf_constant($config[$i]['title']).'<br /><br /><span style="font-weight:normal;">'.hypconf_constant($config[$i]['description']).'</span>'; // GIJ
$title4tray = hypconf_constant($config[$i]['title']);
$title = '';
// GIJ
switch ($config[$i]['formtype']) {
case 'textarea':
(method_exists('MyTextSanitizer', 'sGetInstance') and $myts =& MyTextSanitizer::sGetInstance()) || ($myts =& MyTextSanitizer::getInstance());
if ($config[$i]['valuetype'] == 'array') {
// this is exceptional.. only when value type is arrayneed a smarter way for this
$ele = $config[$i]['value'] != '' ? new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars(implode('|', $config[$i]['value'], _CHARSET)), 5, 50) : new XoopsFormTextArea($title, $config[$i]['name'], '', 5, 50);
} else {
$ele = new XoopsFormTextArea($title, $config[$i]['name'], $myts->htmlspecialchars($config[$i]['value'], ENT_COMPAT, _CHARSET), 5, 50);
$ele->setExtra('class="norich plain" spellcheck="false"');
}
break;
case 'select':
$size = 1;
if (!empty($config[$i]['size'])) {
$size = $config[$i]['size'];
}
$ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size);
$options = $config[$i]['options'];
$opcount = count($options);
//var_dump($options);
foreach ($options as $option) {
if (isset($option['confop_value']) && isset($option['confop_name'])) {
$optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
$optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
} else {
$optval = $optkey = $option;
}
$ele->addOption($optval, $optkey);
}
break;
case 'select_multi':
$size = 5;
if (!empty($config[$i]['size'])) {
$size = $config[$i]['size'];
}
$ele = new XoopsFormSelect($title, $config[$i]['name'], $config[$i]['value'], $size, true);
$options = $config[$i]['options'];
foreach ($options as $option) {
$optval = defined($option['confop_value']) ? constant($option['confop_value']) : $option['confop_value'];
$optkey = defined($option['confop_name']) ? constant($option['confop_name']) : $option['confop_name'];
$ele->addOption($optval, $optkey);
}
break;
case 'check':
$ele = new HypconfFormCheckBox($title, $config[$i]['name'], $config[$i]['value']);
if (!empty($config[$i]['width'])) {
//$ele->setWidth($config[$i]['width']);
}
$options = $config[$i]['options'];
foreach ($options as $option) {
$optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
$optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
$ele->addOption($optval, $optkey);
}
break;
case 'radio':
$ele = new XoopsFormRadio($title, $config[$i]['name'], $config[$i]['value']);
if (!empty($config[$i]['width'])) {
//$ele->setWidth($config[$i]['width']);
}
$options = $config[$i]['options'];
foreach ($options as $option) {
$optval = defined($option['confop_value']) ? hypconf_constant($option['confop_value']) : $option['confop_value'];
$optkey = defined($option['confop_name']) ? hypconf_constant($option['confop_name']) : $option['confop_name'];
$ele->addOption($optval, $optkey);
}
//.........这里部分代码省略.........