本文整理汇总了PHP中PHPWS_Core::getHomeHttp方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::getHomeHttp方法的具体用法?PHP PHPWS_Core::getHomeHttp怎么用?PHP PHPWS_Core::getHomeHttp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::getHomeHttp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
/**
* returns the url in a link
*/
public function getUrl($full_path = false)
{
if ($full_path) {
return sprintf('<a href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $this->url, $this->title);
} else {
return sprintf('<a href="%s">%s</a>', $this->url, $this->title);
}
}
示例2: load
private function load()
{
if ($this->key_id) {
$key = new Key($this->key_id);
} else {
$key = Key::getHomeKey();
}
$this->url = PHPWS_Core::getHomeHttp() . $key->url;
$this->tag = md5($this->url);
$this->file = QR_IMAGE_DIR . $this->tag . '_' . $this->size . '.png';
$this->image = QR_IMAGE_HTTP . $this->tag . '_' . $this->size . '.png';
}
示例3: registerModule
public static function registerModule($module, &$content)
{
if (is_file(PHPWS_SOURCE_DIR . 'mod/' . $module . '/conf/rss.php')) {
$reg_file = PHPWS_Core::getConfigFile($module, 'rss.php');
} else {
$reg_file = false;
}
if ($reg_file == FALSE) {
PHPWS_Boost::addLog($module, dgettext('rss', 'No RSS file found.'));
return FALSE;
}
PHPWS_Core::initModClass('rss', 'Channel.php');
include $reg_file;
$oChannel = new RSS_Channel();
$oChannel->module = $module;
if (!isset($channel) || !is_array($channel)) {
$content[] = dgettext('rss', 'RSS file found but no channel information.');
PHPWS_Boost::addLog($module, dgettext('rss', 'RSS file found but no channel information.'));
}
$oModule = new PHPWS_Module($module);
if (!empty($channel['title'])) {
$oChannel->title = strip_tags($channel['title']);
} else {
$oChannel->title = $oModule->proper_name;
}
if (!empty($channel['description'])) {
$oChannel->description = strip_tags($channel['description']);
}
if (!empty($channel['link'])) {
$oChannel->link = strip_tags($channel['link']);
} else {
$oChannel->link = PHPWS_Core::getHomeHttp();
}
$result = $oChannel->save();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
PHPWS_Boost::addLog($module, dgettext('rss', 'An error occurred registering to RSS module.'));
$content[] = dgettext('rss', 'An error occurred registering to RSS module.');
return NULL;
} else {
$content[] = sprintf(dgettext('rss', 'RSS registration to %s module successful.'), $oModule->proper_name);
return TRUE;
}
}
示例4: getTag
public function getTag($embed = false)
{
$filter = $this->getFilter();
$is_video = preg_match('/^audio/i', $this->file_type) ? false : true;
$tpl['WIDTH'] = $this->width;
$tpl['HEIGHT'] = $this->height;
$tpl['IMAGE'] = $this->getThumbnail(null, false);
$thumbnail = $this->thumbnailPath();
$tpl['FILE_DIRECTORY'] = $this->file_directory;
$path = $this->getPath();
if (!preg_match('/^(https?|rtmp):/', $path)) {
$path = PHPWS_Core::getHomeHttp() . $path;
}
$tpl['FILE_PATH'] = $path;
$tpl['FILE_NAME'] = $this->file_name;
$tpl['ID'] = 'media' . $this->id;
$tpl['source_http'] = $tpl['SOURCE_HTTP'] = PHPWS_SOURCE_HTTP;
// check for filter file
if ($this->embedded) {
$filter_tpl = sprintf('%smod/filecabinet/inc/embed/rtmp/embed.tpl', PHPWS_SOURCE_DIR);
} else {
$filter_exe = PHPWS_SOURCE_DIR . "mod/filecabinet/templates/filters/media/filter.php";
$filter_tpl = PHPWS_SOURCE_DIR . "mod/filecabinet/templates/filters/{$filter}.tpl";
if (is_file($filter_exe)) {
include $filter_exe;
}
}
return PHPWS_Template::process($tpl, 'filecabinet', $filter_tpl, true);
}
示例5: rand
$default['scrollbars'] = 'yes';
$default['resizable'] = 'yes';
$default['width'] = '400';
$default['height'] = '300';
$default['titlebar'] = 'no';
$default['link_title'] = '';
$default['window_name'] = 'default' . rand();
$default['class'] = 'js-open-window';
$default['center'] = 1;
if (isset($data['type'])) {
if ($data['type'] == 'button') {
$bodyfile = PHPWS_SOURCE_DIR . 'javascript/open_window/body2.js';
}
}
if (isset($data['center'])) {
$data['center'] = (bool) $data['center'] ? 1 : 0;
}
$site_address = PHPWS_Core::getHomeHttp();
if (!stristr($data['address'], $site_address)) {
$data['address'] = $site_address . $data['address'];
}
if (!empty($data['secure'])) {
if (!isset($_GLOBALS['open_window_reset'])) {
unset($_SESSION['secure_open_window']);
$_GLOBALS['open_window_reset'] = true;
}
$rand = PHPWS_Text::randomString();
$data['address'] .= '&owpop=' . $rand;
$_SESSION['secure_open_window'][] = $rand;
$data['id'] = $rand;
}
示例6: viewImage
public function viewImage($id, $view_folder = true)
{
Layout::addStyle('filecabinet');
PHPWS_Core::initModClass('filecabinet', 'Image.php');
$image = new PHPWS_Image($id);
$folder = new Folder($image->folder_id);
if (!$folder->allow()) {
$content = dgettext('filecabinet', 'Sorry, the file you requested is off limits.');
Layout::add($content);
return;
}
$tpl['TITLE'] = $image->title;
if ($image->width > FC_MAX_IMAGE_POPUP_WIDTH || $image->height > FC_MAX_IMAGE_POPUP_HEIGHT) {
if (FC_MAX_IMAGE_POPUP_WIDTH < FC_MAX_IMAGE_POPUP_HEIGHT) {
$ratio = FC_MAX_IMAGE_POPUP_WIDTH / $image->width;
$image->width = FC_MAX_IMAGE_POPUP_WIDTH;
$image->height = $image->height * $ratio;
} else {
$ratio = FC_MAX_IMAGE_POPUP_HEIGHT / $image->height;
$image->height = FC_MAX_IMAGE_POPUP_HEIGHT;
$image->width = $image->width * $ratio;
}
$tpl['IMAGE'] = sprintf('<a href="%s">%s</a>', $image->getPath(), $image->getTag());
} else {
$tpl['IMAGE'] = $image->getTag();
}
$tpl['DESCRIPTION'] = $image->getDescription();
$tpl['CLOSE'] = javascript('close_window');
if ($view_folder && $folder->public_folder) {
$db = new PHPWS_DB('images');
$db->setLimit(1);
$db->addWhere('folder_id', $image->folder_id);
$db->addWhere('title', $image->title, '>');
$db->addOrder('title');
$next_img = $db->getObjects('PHPWS_Image');
if (!empty($next_img)) {
$next_link = Icon::show('next', dgettext('filecabinet', 'Next image'));
$tpl['NEXT'] = sprintf('<a id="next-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $next_img[0]->popupAddress(), $next_link);
}
$db->resetWhere();
$db->resetOrder();
$db->addWhere('folder_id', $image->folder_id);
$db->addWhere('title', $image->title, '<');
$db->addOrder('title desc');
$prev_img = $db->getObjects('PHPWS_Image');
if (!empty($prev_img)) {
$prev_link = Icon::show('previous', dgettext('filecabinet', 'Previous image'));
$tpl['PREV'] = sprintf('<a id="prev-link" href="%s%s">%s</a>', PHPWS_Core::getHomeHttp(), $prev_img[0]->popupAddress(), $prev_link);
}
}
$content = PHPWS_Template::process($tpl, 'filecabinet', 'image_view.tpl');
Layout::nakedDisplay($content);
}
示例7: emailRegistration
public function emailRegistration()
{
$peep =& $this->peep;
$sheet =& $this->sheet;
$slot =& $this->slot;
PHPWS_Core::initCoreClass('Mail.php');
$full_name = $peep->first_name . $peep->last_name;
if (preg_match('@["\'\\.]@', $full_name)) {
$name = str_replace('"', "'", $peep->first_name . ' ' . $peep->last_name);
$send_to = sprintf('"%s" <%s>', $name, $peep->email);
} else {
$send_to = sprintf('%s %s <%s>', $peep->first_name, $peep->last_name, $peep->email);
}
$subject = dgettext('signup', 'Signup confirmation');
if (!empty($sheet->contact_email)) {
$reply_to = $from = $sheet->contact_email;
} else {
$reply_to = $from = PHPWS_Settings::get('users', 'site_contact');
}
$site_title = Layout::getPageTitle(true);
$link = PHPWS_Core::getHomeHttp() . 'index.php?module=signup&uop=confirm&h=' . $peep->hashcheck . '&p=' . $peep->id;
$message[] = sprintf(dgettext('signup', 'Greetings from %s,'), $site_title);
$message[] = '';
$message[] = dgettext('signup', 'Click the link below to confirm your participation in the following:');
$message[] = '';
$message[] = sprintf(dgettext('signup', 'Signup event : %s'), $sheet->title);
$message[] = sprintf(dgettext('signup', 'Slot : %s'), $slot->title);
$message[] = $link;
$message[] = '';
$message[] = dgettext('signup', 'You have one hour to confirm your application.');
$mail = new PHPWS_Mail();
$mail->addSendTo($send_to);
$mail->setSubject($subject);
$mail->setFrom($from);
$mail->setReplyTo($reply_to);
$mail->setMessageBody(implode("\n", $message));
return $mail->send();
}
示例8: view
/**
* Returns a RSS feed. Cached result is returned if exists.
*/
public function view()
{
$cache_key = $this->module . '_cache_key';
$content = PHPWS_Cache::get($cache_key, RSS_CACHE_TIMEOUT);
if (!empty($content)) {
return $content;
}
if (empty($this->_feeds)) {
$this->loadFeeds();
}
$home_http = PHPWS_Core::getHomeHttp();
$template['CHANNEL_TITLE'] = $this->EncodeString($this->title);
$template['CHANNEL_ADDRESS'] = $this->getAddress();
$template['HOME_ADDRESS'] = $home_http;
$template['CHANNEL_DESCRIPTION'] = $this->EncodeString($this->description);
$template['LANGUAGE'] = CURRENT_LANGUAGE;
// change later
$template['SEARCH_LINK'] = sprintf('%sindex.php?module=search&mod_title=%s&user=search', $home_http, $this->module);
$template['SEARCH_DESCRIPTION'] = sprintf('Search in %s', $this->title);
$template['SEARCH_NAME'] = 'search';
$template['COPYRIGHT'] = PHPWS_Settings::get('rss', 'copyright');
$template['WEBMASTER'] = PHPWS_Settings::get('rss', 'webmaster');
$template['MANAGING_EDITOR'] = PHPWS_Settings::get('rss', 'editor');
// $template['LAST_BUILD_DATE'] = $this->_last_build_date;
$timezone = strftime('%z');
$timezone = substr($timezone, 0, 3) . ':' . substr($timezone, 3, 2);
if ($this->_feeds) {
foreach ($this->_feeds as $key) {
$itemTpl = NULL;
$url = preg_replace('/^\\.\\//', '', $key->url);
$url = $home_http . preg_replace('/&(?!amp;)/', '&', $url);
$itemTpl['ITEM_LINK'] = $url;
$itemTpl['ITEM_TITLE'] = $this->EncodeString($key->title);
$itemTpl['ITEM_GUID'] = $url;
$itemTpl['ITEM_LINK'] = $url;
$itemTpl['ITEM_SOURCE'] = sprintf('%sindex.php?module=rss&mod_title=%s', $home_http, $this->module);
$itemTpl['ITEM_DESCRIPTION'] = strip_tags(trim($this->EncodeString($key->summary)));
$itemTpl['ITEM_AUTHOR'] = $key->creator;
// $itemTpl['ITEM_PUBDATE'] = $key->getCreateDate('%Y-%m-%d %H:%M:%S CST');
$itemTpl['ITEM_PUBDATE'] = $this->rssDate($key->create_date);
$itemTpl['ITEM_DC_DATE'] = $key->getCreateDate('%Y-%m-%dT%H:%M:%S') . $timezone;
$itemTpl['ITEM_DC_TYPE'] = 'Text';
//pull from db later
$itemTpl['ITEM_DC_CREATOR'] = $key->creator;
$itemTpl['ITEM_SOURCE_TITLE'] = $this->EncodeString($this->title);
$template['item-listing'][] = $itemTpl;
}
}
if (PHPWS_Settings::get('rss', 'rssfeed') == 2) {
$tpl_file = 'rss20.tpl';
} else {
$tpl_file = 'rss10.tpl';
}
$content = PHPWS_Template::process($template, 'rss', $tpl_file);
$content = utf8_encode($content);
PHPWS_Cache::save($cache_key, $content);
return $content;
}
示例9: sendToAlternate
public static function sendToAlternate($alternate, $search_phrase)
{
$file = PHPWS_Core::getConfigFile('search', 'alternate.php');
if (!$file) {
PHPWS_Core::errorPage();
exit;
}
include $file;
if (!isset($alternate_search_engine) || !is_array($alternate_search_engine) || !isset($alternate_search_engine[$alternate])) {
PHPWS_Core::errorPage();
exit;
}
$gosite =& $alternate_search_engine[$alternate];
$query_string = str_replace(' ', '+', $search_phrase);
$site = urlencode(PHPWS_Core::getHomeHttp(FALSE, FALSE, FALSE));
$url = sprintf($gosite['url'], $query_string, $site);
header('location: ' . $url);
exit;
}
示例10: step2
function step2()
{
$db = Convert::getSourceDB('mod_wiki_interwiki');
$batch = new Batches('convert_wiki_interwiki');
$total = $db->count();
if ($total < 1) {
$batch->clear();
$_SESSION['wiki_convert_step'] = 3;
Convert::forward(PHPWS_Core::getHomeHttp() . 'index.php?command=convert&package=wiki');
return dgettext('wiki', 'No interwiki links to convert.');
}
$batch->setTotalItems($total);
$batch->setBatchSet(5);
if (isset($_REQUEST['reset_batch'])) {
$batch->clear();
}
$content[] = dgettext('wiki', 'Converting interwiki links...');
if (!$batch->load()) {
$content[] = dgettext('wiki', 'Batch previously run.');
} else {
$result = runBatch($db, $batch);
if (is_array($result)) {
$content[] = dgettext('wiki', 'Some errors occurred when trying to convert the following interwiki links:');
$content[] = '<ul><li>' . implode('</li><li>', $result) . '</li></ul>';
return implode('<br />', $content);
}
}
$percent = $batch->percentDone();
$content[] = Convert::getGraph($percent);
$batch->completeBatch();
if (!$batch->isFinished()) {
Convert::forward($batch->getAddress());
} else {
$batch->clear();
$_SESSION['wiki_convert_step'] = 3;
Convert::forward(PHPWS_Core::getHomeHttp() . 'index.php?command=convert&package=wiki');
}
return implode('<br />', $content);
}
示例11: admin
public function admin()
{
switch ($_REQUEST['dop']) {
case 'delete_document':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->document->delete();
PHPWS_Core::returnToBookmark();
break;
case 'post_document_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postDocumentUpload();
javascript('close_refresh');
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_document_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadDocument(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Document Upload', true);
exit;
case 'add_access':
if (!Current_User::authorized('filecabinet')) {
Current_User::disallow();
}
$keyword = null;
$this->loadDocument();
// document exists, try making a shortcut
if ($this->document->id) {
PHPWS_Core::initModClass('access', 'Shortcut.php');
$shortcut = new Access_Shortcut();
if (isset($_GET['keyword'])) {
$keyword = $_GET['keyword'];
}
if (empty($keyword)) {
$keyword = $this->document->title;
}
$result = $shortcut->setKeyword($keyword);
$new_keyword = $shortcut->keyword;
// if setKeyword returns a false or error, we have them pick a different name
if (!$result || PHPWS_Error::isError($result)) {
$message = dgettext('filecabinet', 'Access shortcut name already in use. Please enter another.');
$success = false;
} else {
$shortcut->setUrl('filecabinet', $this->document->getViewLink());
$shortcut->save();
$success = true;
$message = '<p>' . dgettext('filecabinet', 'Access shortcut successful!') . '</p>';
$message .= '<a href="' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '">' . PHPWS_Core::getHomeHttp() . $shortcut->keyword . '</a>';
}
} else {
$message = dgettext('filecabinet', 'File not found');
// not really a success but prevents a repost prompt
$success = true;
}
echo json_encode(array('success' => $success, 'message' => $message, 'keyword' => $new_keyword));
exit;
}
}
示例12: makeRelative
/**
* Makes links relative to home site
*/
public static function makeRelative(&$text, $prefix = true, $inlink_only = false)
{
$address = addslashes(PHPWS_Core::getHomeHttp());
if ($prefix) {
$pre = './';
} else {
$pre = '';
}
if ($inlink_only) {
$src = '@(src|href)="' . $address . '@';
$rpl = "\\1=\"{$pre}";
$text = preg_replace($src, $rpl, $text);
} else {
$text = str_replace($address, $pre, $text);
}
}
示例13: notifyUser
public static function notifyUser($user, $password)
{
PHPWS_Core::initCoreClass('Mail.php');
$page_title = Layout::getPageTitle(true);
$body[] = sprintf(dgettext('users', '%s created an user account for you.'), $page_title);
$body[] = dgettext('users', 'You may log-in using the following information:');
$body[] = sprintf(dgettext('users', 'Site address: %s'), PHPWS_Core::getHomeHttp());
$body[] = sprintf(dgettext('users', 'Username: %s'), $user->username);
$body[] = sprintf(dgettext('users', 'Password: %s'), $password);
$body[] = dgettext('users', 'Please change your password immediately after logging in.');
$mail = new PHPWS_Mail();
$mail->addSendTo($user->email);
$mail->setSubject(sprintf(dgettext('users', '%s account created'), $page_title));
$mail->setFrom(PHPWS_User::getUserSetting('site_contact'));
$mail->setReplyTo(PHPWS_User::getUserSetting('site_contact'));
$mail->setMessageBody(implode("\n\n", $body));
$result = $mail->send();
return $result;
}
示例14: emailApprovalNeeded
private function emailApprovalNeeded()
{
$db = \Database::getDB();
$t = $db->addTable('prop_contacts');
$t->addFieldConditional('approved', 0);
$rows = $db->select();
$count = count($rows);
if ($count == 0) {
return;
}
$vars['site_title'] = \Layout::getPageTitle(true);
$vars['site_address'] = \PHPWS_Core::getHomeHttp() . 'index.php?module=properties&aop=approve';
$vars['count'] = $count > 1 ? "{$count} submissions" : "one submission";
$template = new \Template($vars);
$template->setModuleTemplate('properties', 'reminder.html');
$content = $template->get();
$this->emailContact('Property Manager Approval Required', $content, \PHPWS_Settings::get('properties', 'approver_email'));
}
示例15: sendEmail
/**
* Sends email to Wiki Admin if option enabled
*
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function sendEmail()
{
if (PHPWS_Settings::get('wiki', 'monitor_edits')) {
$pagetitle = WikiManager::formatTitle(strip_tags($_REQUEST['page']));
$message = PHPWS_Settings::get('wiki', 'email_text');
$message = str_replace('[page]', $pagetitle, $message);
$message = str_replace('[url]', PHPWS_Core::getHomeHttp() . (MOD_REWRITE_ENABLED ? 'wiki/' : 'index.php?module=wiki&page=') . $_REQUEST['page'], $message);
PHPWS_Core::initCoreClass('Mail.php');
$mail = new PHPWS_Mail();
$mail->addSendTo(PHPWS_Settings::get('wiki', 'admin_email'));
$mail->setSubject(sprintf(dgettext('wiki', '%s updated!'), $pagetitle));
$mail->setFrom(PHPWS_User::getUserSetting('site_contact'));
$mail->setMessageBody($message);
$mail->send();
}
}