本文整理匯總了PHP中IPSText::base64_encode_urlSafe方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::base64_encode_urlSafe方法的具體用法?PHP IPSText::base64_encode_urlSafe怎麽用?PHP IPSText::base64_encode_urlSafe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::base64_encode_urlSafe方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendDigestNotifications
/**
* Send digest notifications to anyone subscribed to item
*
* @param string $type Types of notifications to send (Possible: daily, weekly)
* @param integer $sendMax Null (use ipsRegistry::$setting or send INT only)
* @return @e boolean
* @see allowedFrequencies()
*/
public function sendDigestNotifications($type, $sendMax = null)
{
/* Fetch data */
$blackhole = time();
// mktime( 0, 0 ); - http://community.invisionpower.com/tracker/issue-35320-daily-digests-every-2-days
// The below has been changed based on troubleshooting in a ticket, 10.17.2012. With the code below not commented out, for a weekly digest we grab 15-7 days ago, rather than 8-0 days ago to send.
$time = $blackhole;
//( $type == 'daily' ) ? $blackhole - ( 86400 ) : $blackhole - ( 86400 * 7 );
$data = $this->getDataByAreaAndLastSentOlderThanDate($time, array($type), false, $sendMax);
if (!count($data)) {
return false;
}
/* Check for outdated notifications and update them as required */
$oldestPossDate = 0;
if ($type == 'daily') {
/* Grab 4 days to account for timezone differences */
$oldestPossDate = $blackhole - 86400 * 4;
} else {
/* Grab 10 days to ensure we don't update rows ready to be sent */
$oldestPossDate = $blackhole - 86400 * 10;
}
if ($oldestPossDate) {
$this->DB->update('core_like', array('like_notify_sent' => IPS_UNIX_TIME_NOW), 'like_app=\'' . classes_like_registry::getApp() . '\' AND like_area=\'' . classes_like_registry::getArea() . '\' AND like_notify_sent < ' . $oldestPossDate . " AND like_notify_freq='{$type}'");
}
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications');
$notifyLibrary = new $classToLoad($this->registry);
/* Array structure will be $data[ $memberId ][ $likeId ] = array(); */
foreach ($data as $memberId => $_rows) {
foreach ($_rows as $row) {
if (!$row['like_notify_freq'] or $row['like_notify_freq'] != $type) {
continue;
}
/* Make sure we don't send huge digests if this is their first email since subscribing */
$row['like_notify_sent'] = $row['like_notify_sent'] ? $row['like_notify_sent'] : $row['like_added'];
/* Want to fetch the data from the plug in files? */
$notificationOpts = $this->buildNotificationData($row, $type);
if (!is_array($notificationOpts) or !count($notificationOpts)) {
/* This will get hit if topic hasn't had a post since notification was last sent - to prevent the same row from getting picked up each time this runs
we need to update the last sent timestamp for the like */
$this->DB->update('core_like', array('like_notify_sent' => IPS_UNIX_TIME_NOW), 'like_id=\'' . classes_like_registry::getKey($row['like_rel_id'], $row['like_member_id']) . '\'');
continue;
}
$buildMessage = array();
if (is_array($notificationOpts['build_message_array']) and count($notificationOpts['build_message_array'])) {
foreach ($notificationOpts['build_message_array'] as $k => $v) {
if (preg_match('/\\-member:(.+?)\\-/', $v, $_matches)) {
$v = str_replace($_matches[0], $row[$_matches[1]], $v);
}
$buildMessage[$k] = $v;
}
}
/* Add in unsubscribe link */
$key = $row['like_app'] . ';' . $row['like_area'] . ';' . $row['like_rel_id'] . ';' . $row['like_member_id'] . ';' . $row['member_id'] . ';' . $row['email'];
$buildMessage['UNSUBCRIBE_URL'] = $this->registry->output->buildSEOUrl('app=core&module=global&section=like&do=unsubscribe&key=' . IPSText::base64_encode_urlSafe($key), 'publicNoSession', 'unsubscribe', 'likeunsubscribe');
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate($notificationOpts['email_template'], $row['language'], trim($notificationOpts['email_lang_file']), trim($notificationOpts['email_lang_app'])));
IPSText::getTextClass('email')->buildPlainTextContent($buildMessage);
$notifyLibrary->setMember($row);
$notifyLibrary->setFrom($notificationOpts['from'] ? $notificationOpts['from'] : $this->memberData);
$notifyLibrary->setNotificationKey($notificationOpts['notification_key']);
$notifyLibrary->setNotificationUrl($notificationOpts['notification_url']);
$notifyLibrary->setNotificationText(IPSText::getTextClass('email')->getPlainTextContent());
$notifyLibrary->setNotificationTitle($notificationOpts['email_subject'] ? $notificationOpts['email_subject'] : IPSText::getTextClass('email')->subject);
$notifyLibrary->setNotificationHtml(IPSText::getTextClass('email')->buildHtmlContent($buildMessage));
try {
$notifyLibrary->sendNotification();
} catch (Exception $e) {
}
/* Update sent timestamp */
$this->DB->update('core_like', array('like_notify_sent' => IPS_UNIX_TIME_NOW), 'like_id=\'' . classes_like_registry::getKey($row['like_rel_id'], $row['like_member_id']) . '\'');
}
}
return true;
}
示例2: shareLinks
/**
* Display a strip of share links
*
* @param string Document title (can be left blank and it will attempt to self-discover)
* @param array Addition params: url, cssClass, group [string template group], bit [string template bit], skip [array of share_keys to skip]
* @return string HAITHTEEEMEL
*/
public static function shareLinks($title = '', $params = array())
{
$url = isset($params['url']) ? $params['url'] : '';
$cssClass = isset($params['cssClass']) ? $params['cssClass'] : 'topic_share left';
$group = isset($params['group']) ? $params['group'] : 'global';
$bit = isset($params['bit']) ? $params['bit'] : 'shareLinks';
$skip = isset($params['skip']) ? $params['skip'] : array();
$override = isset($params['overrideApp']) ? $params['overrideApp'] : '';
/* Disabled? */
if (!ipsRegistry::$settings['sl_enable']) {
return '';
}
/* Disable for bots */
if (ipsRegistry::member()->is_not_human) {
return '';
}
$canon = ipsRegistry::getClass('output')->fetchRootDocUrl();
$url = $url ? $url : ipsRegistry::$settings['this_url'];
$raw = $url;
$canon = IPSText::base64_encode_urlSafe($canon ? $canon : $url);
$title = IPSText::base64_encode_urlSafe($title);
$url = IPSText::base64_encode_urlSafe($url);
$cache = ipsRegistry::cache()->getCache('sharelinks');
if (!$cache or !is_array($cache)) {
ipsRegistry::cache()->rebuildCache('sharelinks', 'global');
$cache = ipsRegistry::cache()->getCache('sharelinks');
}
/* Check for required canonical urls or not */
foreach ($cache as $key => $data) {
if (is_array($skip) and in_array($key, $skip)) {
unset($cache[$key]);
} else {
$cache[$key]['_rawUrl'] = $raw;
$cache[$key]['overrideApp'] = $override;
$cache[$key]['_url'] = $data['share_canonical'] ? $canon : $url;
}
}
return ipsRegistry::getClass('output')->getTemplate($group)->{$bit}($cache, $title, $canon, $cssClass);
}
示例3: share
/**
* Redirect to Twitter
* Exciting, isn't it.
*
* @access private
* @param string Plug in
*/
public function share($title, $url)
{
$url = $this->settings['base_url'] . 'app=forums&module=extras§ion=forward&url=' . IPSText::base64_encode_urlSafe($url) . '&title=' . urlencode($title);
$this->registry->output->silentRedirect($url);
}
示例4: metaTags
function metaTags($metaTags)
{
$IPBHTML = "";
//--starthtml--//
$IPBHTML .= <<<HTML
<div class='section_title'>
\t<h2>{$this->lang->words['meta_title']}</h2>
\t<div class='ipsActionBar clearfix'>
\t\t<ul>
\t\t\t<li class='ipsActionButton'><a href='{$this->settings['base_url']}app=core&module=templates§ion=meta&do=add'><img src='{$this->settings['skin_acp_url']}/images/icons/add.png' /> {$this->lang->words['meta_add']}</a></li>
\t\t\t<li class='ipsActionButton'><a href='{$this->settings['public_url']}app=core&module=global§ion=meta&do=init' target='_blank'><img src='{$this->settings['skin_app_url']}/images/wand.png' /> {$this->lang->words['meta_magic']}</a></li>
\t\t</ul>
\t</div>
</div>
<div class='acp-box'>
\t<h3>{$this->lang->words['meta_title']}</h3>
\t<table class='ipsTable'>
HTML;
HTML;
if (!empty($metaTags)) {
foreach ($metaTags as $page => $tags) {
$encodedPage = IPSText::base64_encode_urlSafe($page);
$IPBHTML .= <<<HTML
\t\t<tr class='ipsControlRow'>
\t\t\t<th class='subhead' colspan='2'>{$page}</th>
\t\t\t<th class='subhead col_buttons'>
\t\t\t\t<ul class='ipsControlStrip'>
\t\t\t\t\t<li class='i_edit'><a href='{$this->settings['base_url']}app=core&module=templates§ion=meta&do=edit&page={$encodedPage}'> </a></li>
\t\t\t\t\t<li class='i_delete'><a href='{$this->settings['base_url']}app=core&module=templates§ion=meta&do=delete&page={$encodedPage}'> </a></li>
\t\t\t\t</ul>
\t\t\t</th>
\t\t</tr>
HTML;
foreach ($tags as $title => $content) {
$IPBHTML .= <<<HTML
\t\t<tr>
\t\t\t<td>{$title}</td>
\t\t\t<td>{$content}</td>
\t\t\t<td class='col_buttons'> </th>
\t\t</tr>
HTML;
}
}
} else {
$IPBHTML .= <<<HTML
\t\t<tr>
\t\t\t<td class='no_messages'>{$this->lang->words['meta_none']} <a href='{$this->settings['base_url']}app=core&module=templates§ion=meta&do=add' class='mini_button'>{$this->lang->words['meta_none_add']}</a></td>
\t\t</tr>
HTML;
}
$IPBHTML .= <<<HTML
\t</table>
</div>
HTML;
//--endhtml--//
return $IPBHTML;
}