本文整理匯總了PHP中IPSText::mbsubstr方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::mbsubstr方法的具體用法?PHP IPSText::mbsubstr怎麽用?PHP IPSText::mbsubstr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::mbsubstr方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: connectionCheckerResult
/**
* Connection checker
*
* @param string Raw HTTP headers
* @param string Request result
* @param string Raw HTTPS headers
* @param string Request result
* @return string HTML
*/
public function connectionCheckerResult($headers = '', $output = '', $headers_ssl = '', $output_ssl = '')
{
$IPBHTML = "";
//--starthtml--//
$output = IPSText::mbsubstr(htmlspecialchars($output), 0, 2000);
$output_ssl = IPSText::mbsubstr(htmlspecialchars($output_ssl), 0, 2000);
$IPBHTML .= <<<EOF
<div class='information-box'>
\t{$this->lang->words['connections__message']}
</div>
<br />
<div class='section_title'>
\t<h2>{$this->lang->words['connectionchecker']}</h2>
</div>
<div class='acp-box'>
\t<h3>{$this->lang->words['connections__headers']}</h3>
\t<pre style='overflow: auto;'>{$headers}</pre>
</div>
<br />
<div class='acp-box'>
\t<h3>{$this->lang->words['connections__output']}</h3>
\t<pre style='overflow: auto;'>{$output}</pre>
</div>
<br />
<div class='acp-box'>
\t<h3>{$this->lang->words['connections__headers1']}</h3>
\t<pre style='overflow: auto;'>{$headers_ssl}</pre>
</div>
<br />
<div class='acp-box'>
\t<h3>{$this->lang->words['connections__output1']}</h3>
\t<pre style='overflow: auto;'>{$output_ssl}</pre>
</div>
EOF;
//--endhtml--//
return $IPBHTML;
}
示例2: _memberDoEdit
//.........這裏部分代碼省略.........
if (!IPSLib::appIsInstalled($app_dir)) {
continue;
}
if (file_exists(IPSLib::getAppDir($app_dir) . '/extensions/admin/member_form.php')) {
require_once IPSLib::getAppDir($app_dir) . '/extensions/admin/member_form.php';
$_class = 'admin_member_form__' . $app_dir;
$_object = new $_class($this->registry);
$remote = $_object->getForSave();
$additionalCore = array_merge($remote['core'], $additionalCore);
$additionalExtended = array_merge($remote['extendedProfile'], $additionalExtended);
}
}
//-----------------------------------------
// Fix custom title
// @see http://forums./index.php?app=tracker&showissue=17383
//-----------------------------------------
$memberTitle = $this->request['title'];
$rankCache = ipsRegistry::cache()->getCache('ranks');
if (is_array($rankCache) && count($rankCache)) {
foreach ($rankCache as $k => $v) {
if ($member['posts'] >= $v['POSTS']) {
/* If this is the title passed to us from the form, we didn't have a custom title */
if ($v['TITLE'] == $memberTitle) {
$memberTitle = '';
}
break;
}
}
}
$newMember = array('member_group_id' => intval($this->request['member_group_id']), 'title' => $memberTitle, 'time_offset' => floatval($this->request['time_offset']), 'language' => $this->request['language'], 'skin' => intval($this->request['skin']), 'hide_email' => intval($this->request['hide_email']), 'allow_admin_mails' => intval($this->request['allow_admin_mails']), 'view_sigs' => intval($this->request['view_sigs']), 'view_pop' => intval($this->request['view_pop']), 'email_pm' => intval($this->request['email_pm']), 'posts' => intval($this->request['posts']), 'bday_day' => intval($this->request['bday_day']), 'bday_month' => intval($this->request['bday_month']), 'bday_year' => intval($this->request['bday_year']), 'warn_level' => intval($this->request['warn_level']), 'members_disable_pm' => intval($this->request['members_disable_pm']), 'mgroup_others' => $_POST['mgroup_others'] ? ',' . implode(",", $_POST['mgroup_others']) . ',' : '', 'identity_url' => trim($this->request['identity_url']));
//-----------------------------------------
// Throw to the DB
//-----------------------------------------
IPSMember::save($this->request['member_id'], array('core' => array_merge($newMember, $additionalCore), 'extendedProfile' => array_merge(array('pp_gender' => $this->request['pp_gender'] == 'male' ? 'male' : ($this->request['pp_gender'] == 'female' ? 'female' : ''), 'pp_bio_content' => IPSText::mbsubstr(nl2br($this->request['pp_bio_content']), 0, 300), 'pp_about_me' => $aboutme, 'signature' => $signature, 'pp_reputation_points' => intval($this->request['pp_reputation_points']), 'pp_status' => $this->request['pp_status'], 'pp_setting_count_visitors' => intval($this->request['pp_setting_count_visitors']), 'pp_setting_count_comments' => intval($this->request['pp_setting_count_comments']), 'pp_setting_count_friends' => intval($this->request['pp_setting_count_friends']), 'pp_setting_notify_comments' => $this->request['pp_setting_notify_comments'], 'pp_setting_notify_friend' => $this->request['pp_setting_notify_friend'], 'pp_setting_moderate_comments' => intval($this->request['pp_setting_moderate_comments']), 'pp_setting_moderate_friends' => intval($this->request['pp_setting_moderate_friends'])), $additionalExtended)));
if ($member['member_group_id'] != $newMember['member_group_id']) {
IPSLib::runMemberSync('onGroupChange', $this->request['member_id'], $newMember['member_group_id']);
//-----------------------------------------
// Remove restrictions if member demoted
// Commenting out as this may cause more problems than it's worth
// e.g. if you had accidentally changed their group, you'd need to reconfigure all restrictions
//-----------------------------------------
/*if( !$this->caches['group_cache'][ $newMember['member_group_id'] ]['g_access_cp'] )
{
$this->DB->delete( 'admin_permission_rows', 'row_id=' . $member['member_id'] . " AND row_id_type='member'" );
}*/
}
//-----------------------------------------
// Restriction permissions stuff
//-----------------------------------------
if (is_array($this->registry->getClass('class_permissions')->restrictions_row) and count($this->registry->getClass('class_permissions')->restrictions_row)) {
$is_admin = 0;
$groups = ipsRegistry::cache()->getCache('group_cache');
if (is_array($this->request['mgroup_others']) and count($this->request['mgroup_others'])) {
foreach ($this->request['mgroup_others'] as $omg) {
if ($groups[intval($omg)]['g_access_cp']) {
$is_admin = 1;
break;
}
}
}
if ($groups[intval($this->request['member_group_id'])]['g_access_cp']) {
$is_admin = 1;
}
if ($is_admin) {
//-------------------------------------------------
// Copy restrictions if they do not have any yet...
示例3: cleanTopicTitle
/**
* Clean the topic title
*
* @param string Raw title
* @return string Cleaned title
*/
public function cleanTopicTitle($title = "")
{
if ($this->settings['etfilter_punct']) {
$title = preg_replace('/\\?{1,}/', "?", $title);
$title = preg_replace("/(!){1,}/", "!", $title);
}
//-----------------------------------------
// The DB column is 250 chars, so we need to do true mb_strcut, then fix broken HTML entities
// This should be fine, as DB would do it regardless (cept we can fix the entities)
//-----------------------------------------
$title = preg_replace("/&(#{0,}([a-zA-Z0-9]+?)?)?\$/", '', IPSText::mbsubstr($title, 0, 250));
$title = IPSText::stripAttachTag($title);
$title = str_replace("<br />", "", $title);
$title = trim($title);
return $title;
}
示例4: __f__d6ef75c64bd4fbf9d0af5b37cd8fa121
function __f__d6ef75c64bd4fbf9d0af5b37cd8fa121($month = "", $mid = "", $year = "", $events = "", $day_words = "")
{
$_ips___x_retval = '';
foreach ($day_words as $day) {
$_ips___x_retval .= "\n\t\t\t<th>" . IPSText::mbsubstr($day, 0, 1) . "</th>\n\t\t\n";
}
$_ips___x_retval .= '';
return $_ips___x_retval;
}
示例5: _buildOutput
//.........這裏部分代碼省略.........
}
}
}
//-----------------------------------------
// Some security checking
//-----------------------------------------
if (IPSText::xssCheckUrl($option) !== TRUE) {
return $content;
}
/* Check for mangled or embedded URLs */
if (stristr($option, '[attachment') or stristr($option, '[quote') or stristr($option, '[url') or stristr($option, '[/url') or stristr($content, '[url') or stristr($content, '[/url')) {
return $content;
}
//-----------------------------------------
// Fix quotes in urls
//-----------------------------------------
$option = str_replace(array(''', "'"), '%27', $option);
$option = str_replace(array('"', '"'), '%22', $option);
foreach ($this->cache->getCache('bbcode') as $bbcode) {
$_tags = $this->_retrieveTags();
foreach ($_tags as $tag) {
if (strpos($option, '[' . $tag) !== false) {
return $content;
}
}
}
//-----------------------------------------
// URL filtering?
//-----------------------------------------
if ($this->settings['ipb_use_url_filter']) {
$list_type = $this->settings['ipb_url_filter_option'] == "black" ? "blacklist" : "whitelist";
if ($this->settings['ipb_url_' . $list_type]) {
$list_values = array();
$list_values = explode("\n", str_replace("\r", "", $this->settings['ipb_url_' . $list_type]));
if ($list_type == "whitelist") {
$list_values[] = "http://{$_SERVER['HTTP_HOST']}/*";
}
if (count($list_values)) {
$good_url = 0;
foreach ($list_values as $my_url) {
if (!trim($my_url)) {
continue;
}
$my_url = preg_quote($my_url, '/');
$my_url = str_replace('\\*', "(.*?)", $my_url);
if ($list_type == "blacklist") {
if (preg_match('/' . $my_url . '/i', $option)) {
$this->warning = 'domain_not_allowed';
return $content;
}
} else {
if (preg_match('/' . $my_url . '/i', $option)) {
$good_url = 1;
}
}
}
if (!$good_url and $list_type == "whitelist") {
$this->warning = 'domain_not_allowed';
return $content;
}
}
}
}
//-----------------------------------------
// Let's remove any nested links..
//-----------------------------------------
$content = preg_replace('/<a href=\'(.+?)\'(.*?)>(.+?)<\\/a>/is', "\\3", $content);
//-----------------------------------------
// Need to "truncate" the "content" to ~35
// EDIT: but only if it's the same as content
//-----------------------------------------
/* Changes here @link http://community.invisionpower.com/tracker/issue-36082-long-links-on-mobile-extend-width/ */
if (empty($this->settings['__noTruncateUrl']) and IPSText::mbstrlen($content) > 38 and (substr($content, 0, 7) == 'http://' or substr($content, 0, 8) == 'https://')) {
$content = htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($content)), 0, 20)) . '...' . htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($content)), -15));
}
//-----------------------------------------
// Adding rel='nofollow'?
//-----------------------------------------
$rels = array();
$rel = '';
$_title = '';
/* Fetch actual host for better matching */
$data = @parse_url($option);
if ($this->settings['posts_add_nofollow']) {
if (!stristr($data['host'], $_SERVER['HTTP_HOST'])) {
$rels[] = "nofollow";
}
}
if ($this->settings['links_external']) {
if (!stristr($data['host'], $_SERVER['HTTP_HOST'])) {
/* Look a little closer */
$rels[] = "external";
$_title = $this->lang->words['bbc_external_link'];
}
}
if (count($rels)) {
$rel = " rel='" . implode(' ', $rels) . "'";
}
return "<a href='{$option}' class='bbc_url' title='{$_title}'{$rel}>{$content}</a>";
}
示例6: load
/**
* Load member
*
* @param string Member key: Either ID or email address OR array of IDs when $key_type is either ID or not set OR a list of $key_type strings (email address, name, etc)
* @param string Extra tables to load(all, none or comma delisted tables) Tables: members, pfields_content, profile_portal, groups, sessions, core_item_markers_storage, members_partial.
* You can also use the aliases: 'extendedProfile', 'customFields' and 'itemMarkingStorage'
* @param string Key type. Leave it blank to auto-detect or specify "id", "email", "username", "displayname".
* @return array Array containing member data
* <code>
* # Single member
* $member = IPSMember::load( 1, 'extendedProfile,groups' );
* $member = IPSMember::load( 'matt@email.com', 'all' );
* $member = IPSMember::load( 'MattM', 'all', 'displayname' ); // Can also use 'username', 'email' or 'id'
* # Multiple members
* $members = IPSMember::load( array( 1, 2, 10 ), 'all' );
* $members = IPSMember::load( array( 'MattM, 'JoeD', 'DaveP' ), 'all', 'displayname' );
* </code>
*/
public static function load($member_key, $extra_tables = 'all', $key_type = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_value = 0;
$members = array();
$multiple_ids = array();
$member_field = '';
$joins = array();
$tables = array('pfields_content' => 0, 'profile_portal' => 0, 'groups' => 0, 'sessions' => 0, 'members_partial' => 0);
$remap = array('extendedProfile' => 'profile_portal', 'customFields' => 'pfields_content');
//-----------------------------------------
// ID or email?
//-----------------------------------------
if (!$key_type) {
if (is_array($member_key)) {
$multiple_ids = array_map('intval', $member_key);
// Bug #20908
$member_field = 'member_id';
} else {
if (strstr($member_key, '@')) {
if (strstr($member_key, ' ')) {
$member_key = '';
}
$member_key = IPSText::mbsubstr($member_key, 0, 150);
$member_value = "'" . ipsRegistry::DB()->addSlashes(strtolower($member_key)) . "'";
$member_field = 'email';
} else {
$member_value = intval($member_key);
$member_field = 'member_id';
}
}
} else {
switch ($key_type) {
default:
case 'id':
if (is_array($member_key)) {
$multiple_ids = $member_key;
} else {
$member_value = intval($member_key);
}
$member_field = 'member_id';
break;
case 'fb_uid':
if (is_array($member_key)) {
$multiple_ids = $member_key;
} else {
$member_value = is_numeric($member_key) ? $member_key : 0;
}
$member_field = 'fb_uid';
if ($member_value == 0) {
return array();
}
break;
case 'twitter_id':
if (is_array($member_key)) {
$multiple_ids = $member_key;
} else {
$member_value = is_numeric($member_key) ? $member_key : 0;
}
$member_field = 'twitter_id';
if ($member_value == 0) {
return array();
}
break;
case 'email':
if (is_array($member_key)) {
array_walk($member_key, create_function('&$v,$k', '$v="\'".( ( strstr( $v, \' \' ) ) ? \'\' : ipsRegistry::DB()->addSlashes( IPSText::mbsubstr( strtolower( $v ), 0, 150 ) ) ) . "\'";'));
$multiple_ids = $member_key;
} else {
if (strstr($member_key, ' ')) {
$member_key = '';
}
$member_key = IPSText::mbsubstr($member_key, 0, 150);
$member_value = "'" . ipsRegistry::DB()->addSlashes(strtolower($member_key)) . "'";
}
$member_field = 'email';
break;
case 'username':
if (is_array($member_key)) {
array_walk($member_key, create_function('&$v,$k', '$v="\'".ipsRegistry::DB()->addSlashes( IPSText::mbsubstr( strtolower( $v ), 0, 255 ) ) . "\'";'));
//.........這裏部分代碼省略.........
示例7: __f__dbe8275c142422a1dbf962583d35a571
function __f__dbe8275c142422a1dbf962583d35a571($data)
{
$_ips___x_retval = '';
$__iteratorCount = 0;
foreach ($data['day_words'] as $day) {
$__iteratorCount++;
$_ips___x_retval .= "\n\t\t\t\t<th>" . IPSText::mbsubstr($day, 0, 1) . "</th>\n\t\t\t\n";
}
$_ips___x_retval .= '';
unset($__iteratorCount);
return $_ips___x_retval;
}
示例8: updateStatusWithUrl
/**
* Post a status update to Facebook based on native content
* Which may be longer and such and so on and so forth, etc
*
* @access public
* @param string Content
* @param string URL to add
* @param bool Always add the URL regardless of content length
*/
public function updateStatusWithUrl($content, $url, $alwaysAdd = false)
{
$memberData = $this->memberData;
/* Got a member? */
if (!$memberData['member_id']) {
throw new Exception('NO_MEMBER');
}
/* Linked account? */
if (!$memberData['fb_uid']) {
throw new Exception('NOT_LINKED');
}
/* Ensure content is correctly de-html-ized */
$content = IPSText::UNhtmlspecialchars($content);
/* Ensure it's converted cleanly into utf-8 */
$content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
/* Is the text longer than 140 chars? */
if ($alwaysAdd === TRUE or IPSText::mbstrlen($content) > 500) {
/* Leave 26 chars for URL shortener */
$content = IPSText::mbsubstr($content, 0, 474) . '...';
if (IPSText::mbstrlen($url) > 26) {
/* Generate short URL */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/url/shorten.php', 'urlShorten');
$shorten = new $classToLoad();
try {
$data = $shorten->shorten($url, IPS_URL_SHORTEN_SERVICE);
$url = $data['url'];
} catch (Exception $ex) {
/* Stop the exception bubbling back to parent classes */
}
}
$content .= ' ' . $url;
}
/* POST the data */
try {
$this->_api->api(array('method' => 'users.setStatus', 'access_token' => $this->_userToken, 'uid' => $this->_userId, 'status' => $content, 'status_includes_verb' => true));
} catch (Exception $e) {
$this->registry->output->logErrorMessage($e->getMessage(), 'FB-EXCEPTION');
}
}
示例9: updateStatusWithUrl
/**
* Post a status update to twitter based on native content
* Which may be longer and such and so on and so forth, etc
*
* @access public
* @param string Content
* @param string URL to add
* @param bool Always add the URL regardless of content length
* @param bool Add a hashtag
*/
public function updateStatusWithUrl($content, $url, $alwaysAdd = TRUE, $hashtag = '')
{
if (is_string($hashtag) && !empty($hashtag)) {
if (substr($hashtag, 0, 1) != '#') {
$hashtag = '#' . $hashtag;
}
$hashtag = ' ' . $hashtag;
} else {
if (!is_string($hashtag)) {
$hashtag = '';
}
}
/* Ensure content is correctly de-html-ized */
$content = IPSText::UNhtmlspecialchars($content);
/* Is the text longer than 140 chars? */
if ($alwaysAdd === TRUE or IPSText::mbstrlen($content) > 140) {
/* Leave 26 chars for URL shortener */
$less = 26 + strlen($hashtag);
if (IPSText::mbstrlen($content) > 140 - $less) {
$content = IPSText::mbsubstr($content, 0, 140 - ($less + 3)) . '...' . $hashtag;
}
if (IPSText::mbstrlen($url) > 26) {
/* Generate short URL */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/url/shorten.php', 'urlShorten');
$shorten = new $classToLoad();
try {
$data = $shorten->shorten($url, IPS_URL_SHORTEN_SERVICE);
$url = $data['url'];
} catch (Exception $ex) {
/* Stop the exception bubbling back to parent classes */
}
}
return $this->updateStatus($content . ' ' . $url);
} else {
/* Just post it */
return $this->updateStatus($content);
}
}
示例10: __f__80b8170fedb0bf6e656e59f768de6697
function __f__80b8170fedb0bf6e656e59f768de6697($data)
{
$_ips___x_retval = '';
$__iteratorCount = 0;
foreach ($data['day_words'] as $day) {
$__iteratorCount++;
$_ips___x_retval .= "\n\t\t\t\t\t<th>" . IPSText::mbsubstr($day, 0, 1) . "</th>\n\t\t\t\t\n";
}
$_ips___x_retval .= '';
unset($__iteratorCount);
return $_ips___x_retval;
}
示例11: saveProfileInfo
/**
* UserCP Save Form: Profile Info
*
* @access public
* @return array Errors
*/
public function saveProfileInfo()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$pp_setting_notify_comments = trim(substr($this->request['pp_setting_notify_comments'], 0, 10));
$pp_setting_notify_friend = trim(substr($this->request['pp_setting_notify_friend'], 0, 10));
$pp_setting_moderate_comments = intval($this->request['pp_setting_moderate_comments']);
$pp_setting_moderate_friends = intval($this->request['pp_setting_moderate_friends']);
$pp_setting_count_visitors = intval($this->request['pp_setting_count_visitors']);
$pp_setting_count_comments = intval($this->request['pp_setting_count_comments']);
$pp_setting_count_friends = intval($this->request['pp_setting_count_friends']);
$_gender = $this->request['gender'] == 'male' ? 'male' : ($this->request['gender'] == 'female' ? 'female' : '');
//-----------------------------------------
// Check to make sure that we can edit profiles..
//-----------------------------------------
if (!$this->memberData['g_edit_profile']) {
$this->registry->getClass('output')->showError('members_profile_disabled', 10214);
}
//-----------------------------------------
// make sure that either we entered
// all calendar fields, or we left them
// all blank
//-----------------------------------------
$c_cnt = 0;
foreach (array('day', 'month', 'year') as $v) {
if ($this->request[$v]) {
$c_cnt++;
}
}
if ($c_cnt > 0 && $c_cnt < 2) {
$this->registry->getClass('output')->showError('member_bad_birthday', 10215);
} else {
if ($c_cnt > 0) {
//-----------------------------------------
// Make sure it's a legal date
//-----------------------------------------
$_year = $this->request['year'] ? $this->request['year'] : 1999;
if (!checkdate($this->request['month'], $this->request['day'], $_year)) {
$this->registry->getClass('output')->showError('member_bad_birthday', 10216);
}
}
}
if ($this->memberData['g_edit_profile']) {
$pp_bio_content = IPSText::mbsubstr(nl2br($this->request['pp_bio_content']), 0, 300);
}
if (!$this->memberData['g_edit_profile']) {
$pp_bio_content = $this->memberData['pp_bio_content'];
}
//-----------------------------------------
// Start off our array
//-----------------------------------------
$core = array('bday_day' => $this->request['day'], 'bday_month' => $this->request['month'], 'bday_year' => $this->request['year']);
$extendedProfile = array('pp_bio_content' => IPSText::getTextClass('bbcode')->stripBadWords($pp_bio_content), 'pp_setting_notify_comments' => $pp_setting_notify_comments, 'pp_setting_notify_friend' => $pp_setting_notify_friend, 'pp_setting_moderate_comments' => $pp_setting_moderate_comments, 'pp_setting_moderate_friends' => $pp_setting_moderate_friends, 'pp_setting_count_visitors' => $pp_setting_count_visitors, 'pp_setting_count_comments' => $pp_setting_count_comments, 'pp_setting_count_friends' => $pp_setting_count_friends);
//-----------------------------------------
// check to see if we can enter a member title
// and if one is entered, update it.
//-----------------------------------------
if (isset($this->request['member_title']) and $this->settings['post_titlechange'] and $this->memberData['posts'] >= $this->settings['post_titlechange']) {
$core['title'] = IPSText::getTextClass('bbcode')->stripBadWords($this->request['member_title']);
}
//-----------------------------------------
// Custom profile field stuff
//-----------------------------------------
require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
$fields = new customProfileFields();
$fields->member_data = $this->member->fetchMemberData();
$fields->initData('edit');
/* Use $_POST and not ipsRegistry::$request as the custom profile field kernel class has its own cleaning routines for saving and showing
which means we end up with double & -> & conversion (&lt;, etc) */
$fields->parseToSave($_POST);
if ($fields->error_messages) {
return $fields->error_messages;
}
/* Check the website url field */
$website_field = $fields->getFieldIDByKey('website');
if ($website_field && $fields->out_fields['field_' . $website_field]) {
if (!stristr($fields->out_fields['field_' . $website_field], 'http://')) {
$fields->out_fields['field_' . $website_field] = 'http://' . $fields->out_fields['field_' . $website_field];
}
}
//-----------------------------------------
// Check...
//-----------------------------------------
if (count($fields->error_fields['empty'])) {
$this->registry->getClass('output')->showError(array('customfields_empty', $fields->error_fields['empty'][0]['pf_title']), 10217);
}
if (count($fields->error_fields['invalid'])) {
$this->registry->getClass('output')->showError(array('customfields_invalid', $fields->error_fields['invalid'][0]['pf_title']), 10218);
}
if (count($fields->error_fields['toobig'])) {
$this->registry->getClass('output')->showError(array('customfields_toobig', $fields->error_fields['toobig'][0]['pf_title']), 10219);
}
//-----------------------------------------
//.........這裏部分代碼省略.........
示例12: __f__376ad1e62926b98d829f55e6871bf3ab
function __f__376ad1e62926b98d829f55e6871bf3ab($month = "", $mid = "", $year = "", $events = "", $day_words = "")
{
$_ips___x_retval = '';
foreach ($day_words as $day) {
$_ips___x_retval .= "\n\t\t<th>" . IPSText::mbsubstr($day, 0, 1) . "</th>\n\t\n";
}
$_ips___x_retval .= '';
return $_ips___x_retval;
}
示例13: rssImportRebuildCache
//.........這裏部分代碼省略.........
foreach ($tmp_final_items as $date => $data) {
$final_items[$date] = $data;
if ($count >= $row['rss_import_pergo']) {
break;
}
$count++;
}
/* Anything left? */
if (!count($final_items)) {
continue;
}
/* Figure out MID */
$member = $this->DB->buildAndFetch(array('select' => 'member_id, name, members_display_name, ip_address', 'from' => 'members', 'where' => "member_id={$row['rss_import_mid']}"));
if (!$member['member_id']) {
continue;
}
/* Set member in post class */
$this->post->setAuthor($member['member_id']);
$this->post->setForumData($this->registry->getClass('class_forums')->forum_by_id[$row['rss_import_forum_id']]);
/* Make 'dem posts */
$affected_forum_ids[] = $row['rss_import_forum_id'];
foreach ($final_items as $topic_item) {
/* Fix & */
$topic_item['title'] = str_replace('&', '&', $topic_item['title']);
$topic_item['title'] = trim(IPSText::br2nl($topic_item['title']));
$topic_item['title'] = strip_tags($topic_item['title']);
$topic_item['title'] = IPSText::parseCleanValue($topic_item['title']);
/* Fix up &reg; */
$topic_item['title'] = str_replace('&reg;', '®', $topic_item['title']);
if ($row['rss_import_topic_pre']) {
$topic_item['title'] = str_replace(' ', ' ', str_replace('&nbsp;', ' ', $row['rss_import_topic_pre'])) . ' ' . $topic_item['title'];
}
/* Build topic insert array */
$topic = array('title' => IPSText::mbsubstr($topic_item['title'], 0, 250), 'title_seo' => IPSText::makeSeoTitle(IPSText::mbsubstr($topic_item['title'], 0, 250)), 'description' => '', 'state' => $row['rss_import_topic_open'] ? 'open' : 'closed', 'posts' => 0, 'starter_id' => $member['member_id'], 'starter_name' => $member['members_display_name'], 'start_date' => $topic_item['unixdate'], 'last_poster_id' => $member['member_id'], 'last_poster_name' => $member['members_display_name'], 'last_post' => $topic_item['unixdate'], 'icon_id' => 0, 'author_mode' => 1, 'poll_state' => 0, 'last_vote' => 0, 'views' => 0, 'forum_id' => $row['rss_import_forum_id'], 'approved' => $row['rss_import_topic_hide'] ? 0 : 1, 'pinned' => 0);
/* More post class stuff */
$this->post->setPublished($row['rss_import_topic_hide'] ? FALSE : TRUE);
/* Sort post content: Convert HTML to BBCode */
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = intval($row['rss_import_allow_html']);
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
$this->memberData['_canUseRTE'] = true;
$_POST['ed-0_wysiwyg_used'] = 1;
IPSText::getTextClass('editor')->method = 'rte';
/* Clean up.. */
$topic_item['content'] = preg_replace("#<br />(\r)?\n#is", "<br />", $topic_item['content']);
/* Add in Show link... */
if ($row['rss_import_showlink'] and $topic_item['link']) {
$the_link = str_replace('{url}', trim($topic_item['link']), $row['rss_import_showlink']);
if ($row['rss_import_allow_html']) {
$_POST['_tmpPostField'] = IPSText::getTextClass('bbcode')->preEditParse(stripslashes($the_link));
$the_link = "<br /><br />" . IPSText::getTextClass('bbcode')->preDbParse(IPSText::getTextClass('editor')->processRawPost('_tmpPostField'));
} else {
$the_link = "<br /><br />" . $the_link;
}
$topic_item['content'] .= $the_link;
}
if (!$row['rss_import_allow_html']) {
$_POST['_tmpPostField'] = stripslashes($topic_item['content']);
//IPSText::getTextClass( 'bbcode' )->preEditParse( stripslashes($topic_item['content']) );
$post_content = IPSText::getTextClass('bbcode')->preDbParse(IPSText::getTextClass('editor')->processRawPost('_tmpPostField'));
} else {
$post_content = stripslashes($topic_item['content']);
}
/* Build Post insert array */
$post = array('author_id' => $member['member_id'], 'use_sig' => 1, 'use_emo' => 1, 'ip_address' => $member['ip_address'], 'post_date' => $topic_item['unixdate'], 'icon_id' => 0, 'post' => $post_content, 'author_name' => $member['members_display_name'], 'topic_id' => "", 'queued' => 0, 'post_htmlstate' => 0);
示例14: _finishUrlsForDisplay
/**
* Finish URLs for display
* Truncates them, applies white/black lists, adds rel / targets
* @param string In
* @return string Out
*/
protected function _finishUrlsForDisplay($txt)
{
/* If HTML mode, don't clean links */
if (parent::$Perms['parseHtml']) {
return $txt;
}
/* Reset counter */
$this->cache->updateCacheWithoutSaving('_tmp_bbcode_media', 0);
/* Parse media URLs that are NOT linked */
$txt = preg_replace_callback('#(^|\\s|\\)|\\(|\\{|\\}|>|\\]|\\[|;|href=\\S)((http|https|news|ftp)://(?:[^<>\\)\\[\\"\\s]+|[a-zA-Z0-9/\\._\\-!&\\#;,%\\+\\?:=]+))(</a>)?#is', array($this, '_parseMediaUrls_CallBack'), $txt);
/* LEGACY stuffs - a post from < 3.4 may not be HTMLised properly */
if ($this->_urlsEnabled === true && preg_match('#(http|https)://#', $txt) && !stristr($txt, '<a')) {
$txt = $this->_autoLinkUrls($txt);
}
preg_match_all('#<a\\s+?(?:[^>]*?)href=["\']([^"\']+?)?["\']([^>]*?)?>(.+?)</a>#is', $txt, $urlMatches);
/* Finish up URLs and such */
for ($i = 0; $i < count($urlMatches[0]); $i++) {
$raw = $urlMatches[0][$i];
$url = $urlMatches[1][$i];
$attr = $urlMatches[2][$i];
$text = $urlMatches[3][$i];
$done = false;
$pm = true;
preg_match('#data-ipb=["\']([^"\']+?)?["\']#i', $raw, $matches);
if ($matches[1] && stristr($matches[1], 'noparse')) {
continue;
} else {
if ($matches[1] && stristr($matches[1], 'nomediaparse')) {
$pm = false;
}
}
preg_match('#rel=["\']([^"\']+?)?["\']#i', $raw, $matches);
if ($matches[1] && stristr($matches[1], 'lightbox')) {
continue;
}
/* Urls disabled? */
if ($this->_urlsEnabled !== true) {
$txt = str_replace($raw, $url, $txt);
continue;
}
/* Restored 1st March, Matt @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/some-previously-embedded-content-youtube-etc-now-showing-as-links-after-upgrade-r41411 */
/* Is this a media URL? */
/* Updated 14 May, http://community.invisionpower.com/resources/bugs.html/_/ip-board/url-tags-get-changed-to-media-tags-automatically-r40467 -
Editor now sets "noparsemedia" data-ipb attribute, which we can skip here for automatic parsing */
if ($pm and $this->settings['bbcode_automatic_media'] and isset($this->_bbcodes['media']) and ($this->_bbcodes['media']['bbcode_sections'] == 'all' or in_array(parent::$Perms['parseArea'], explode(',', $this->_bbcodes['media']['bbcode_sections'])))) {
$media = $this->cache->getCache('mediatag');
if ($url == $text && is_array($media) and count($media)) {
foreach ($media as $type => $r) {
if (preg_match("#^" . $r['match'] . "\$#is", $url)) {
$this->cache->updateCacheWithoutSaving('_tmp_autoparse_media', 1);
$_result = $this->_parseBBCode('[media]' . $url . '[/media]', 'display', array('media'));
$this->cache->updateCacheWithoutSaving('_tmp_autoparse_media', 0);
$txt = str_replace($raw, $_result, $txt);
$done = true;
}
}
}
}
/* Format the URL */
if ($done !== true) {
// -----------------------------------------
// URL filtering?
// -----------------------------------------
if (!$this->isAllowedUrl($url)) {
/* Unlink */
$txt = str_replace($raw, $url, $txt);
}
// -----------------------------------------
// Let's remove any nested links..
// -----------------------------------------
$text = preg_replace('/<a href=[\'"](.+?)[\'"](.*?)>(.+?)<\\/a>/is', "\\3", $text);
// -----------------------------------------
// Need to "truncate" the "content" to ~35
// EDIT: but only if it's the same as content
// -----------------------------------------
/*
* Changes here @link
* http://community.invisionpower.com/tracker/issue-36082-long-links-on-mobile-extend-width/ # V V Don't split if URL has entities V V #
*/
if (empty($this->settings['__noTruncateUrl']) and IPSText::mbstrlen($text) > 38 && !preg_match('#&\\#([0-9]{2,4})#i', $text) and (substr($text, 0, 7) == 'http://' or substr($text, 0, 8) == 'https://')) {
$text = htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($text)), 0, 20)) . '...' . htmlspecialchars(IPSText::mbsubstr(html_entity_decode(urldecode($text)), -15));
}
// -----------------------------------------
// Adding rel='nofollow'?
// -----------------------------------------
$rels = array();
$rel = '';
$_title = '';
/* Skipping VigLink? */
if ($this->settings['viglink_norewrite'] and IPSMember::isInGroup(parent::$Perms['memberData'], explode(',', $this->settings['viglink_norewrite']))) {
$rels[] = 'norewrite';
}
/* Fetch actual host for better matching */
$data = @parse_url($url);
//.........這裏部分代碼省略.........
示例15: _handleIpsConnect
/**
* Set member based on IPS Connect
*
* @param array Data returned from IPS Connect
* @return void
*/
protected function _handleIpsConnect($data)
{
if ($data['connect_status'] != 'SUCCESS') {
return false;
}
$update = array();
$member = IPSMember::load($data['connect_id'], 'all,members_partial', 'ipsconnect');
if (!isset($member['member_id'])) {
if (IPSText::mbstrlen($data['connect_username']) > ipsRegistry::$settings['max_user_name_length']) {
$data['connect_username'] = IPSText::mbsubstr($data['connect_username'], 0, ipsRegistry::$settings['max_user_name_length']);
}
$member = IPSMember::create(array('members' => array('name' => $data['connect_username'], 'members_display_name' => $data['connect_displayname'], 'email' => $data['connect_email'], 'ipsconnect_id' => $data['connect_id'])), FALSE, TRUE, FALSE);
}
if (!$member['ipsconnect_id']) {
$update['ipsconnect_id'] = $data['connect_id'];
}
if ($member['name'] != $data['connect_username'] and !defined('CONNECT_NOSYNC_NAMES')) {
$update['name'] = $data['connect_username'];
}
if ($member['members_display_name'] != $data['connect_displayname'] and !defined('CONNECT_NOSYNC_NAMES')) {
$update['members_display_name'] = $data['connect_displayname'];
}
if ($member['email'] != $data['connect_email']) {
$update['email'] = $data['connect_email'];
}
if (!empty($update)) {
IPSMember::save($member['member_id'], array('members' => $update));
}
self::setMember($member['member_id']);
if ($member['partial_member_id']) {
$this->DB->delete('members_partial', "partial_member_id={$member['partial_member_id']}");
}
}