本文整理汇总了PHP中Core::getApplicationURL方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getApplicationURL方法的具体用法?PHP Core::getApplicationURL怎么用?PHP Core::getApplicationURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getApplicationURL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create($ptID, $parentID = false) {
$pagetype = PageType::getByID(Loader::helper('security')->sanitizeInt($ptID));
if ($parentID) {
$parent = ConcretePage::getByID($parentID);
}
if (is_object($pagetype)) {
$proceed = false;
if (is_object($parent) && !$parent->isError()) {
$pp = new Permissions($parent);
$proceed = $pp->canAddSubCollection($pagetype);
} else {
$ptp = new Permissions($pagetype);
$proceed = $ptp->canAddPageType();
if (isset($parent)) {
unset($parent);
}
}
if ($proceed) {
$pt = $pagetype->getPageTypeDefaultPageTemplateObject();
$d = $pagetype->createDraft($pt);
if (is_object($parent)) {
$d->setPageDraftTargetParentPageID($parent->getCollectionID());
}
return Redirect::url(\Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '?cID=' . $d->getCollectionID() . '&ctask=check-out-first&' . Loader::helper('validation/token')->getParameter());
}
}
}
示例2: run
/** Executes the job.
* @throws \Exception Throws an exception in case of errors.
*
* @return string Returns a string describing the job result in case of success.
*/
public function run()
{
Cache::disableAll();
try {
$instances = array('navigation' => Core::make('helper/navigation'), 'dashboard' => Core::make('helper/concrete/dashboard'), 'view_page' => PermissionKey::getByHandle('view_page'), 'guestGroup' => Group::getByID(GUEST_GROUP_ID), 'now' => new DateTime('now'), 'ak_exclude_sitemapxml' => CollectionAttributeKey::getByHandle('exclude_sitemapxml'), 'ak_sitemap_changefreq' => CollectionAttributeKey::getByHandle('sitemap_changefreq'), 'ak_sitemap_priority' => CollectionAttributeKey::getByHandle('sitemap_priority'));
$instances['guestGroupAE'] = array(GroupPermissionAccessEntity::getOrCreate($instances['guestGroup']));
if (\Core::make('multilingual/detector')->isEnabled()) {
$instances['multilingualSections'] = MultilingualSection::getList();
} else {
$instances['multilingualSections'] = array();
}
$xml = '<?xml version="1.0" encoding="' . APP_CHARSET . '"?>';
$xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"';
if ($instances['multilingualSections']) {
$xml .= ' xmlns:x="http://www.w3.org/1999/xhtml"';
}
$xml .= ' />';
$xmlDoc = new SimpleXMLElement($xml);
$rs = Database::get()->query('SELECT cID FROM Pages');
while ($row = $rs->FetchRow()) {
self::addPage($xmlDoc, intval($row['cID']), $instances);
}
$rs->Close();
$event = new \Symfony\Component\EventDispatcher\GenericEvent();
$event->setArgument('xmlDoc', $xmlDoc);
Events::dispatch('on_sitemap_xml_ready', $event);
$dom = dom_import_simplexml($xmlDoc)->ownerDocument;
$dom->formatOutput = true;
$addedPages = count($xmlDoc->url);
$relName = ltrim(Config::get('concrete.sitemap_xml.file'), '\\/');
$osName = rtrim(DIR_BASE, '\\/') . '/' . $relName;
$urlName = rtrim(\Core::getApplicationURL(), '\\/') . '/' . $relName;
if (!file_exists($osName)) {
@touch($osName);
}
if (!is_writable($osName)) {
throw new \Exception(t('The file %s is not writable', $osName));
}
if (!($hFile = @fopen($osName, 'w'))) {
throw new \Exception(t('Cannot open file %s', $osName));
}
if (!@fwrite($hFile, $dom->saveXML())) {
throw new \Exception(t('Error writing to file %s', $osName));
}
@fflush($hFile);
@fclose($hFile);
unset($hFile);
return t('%1$s file saved (%2$d pages).', sprintf('<a href="%s" target="_blank">%s</a>', $urlName, preg_replace('/^https?:\\/\\//i', '', $urlName)), $addedPages);
} catch (\Exception $x) {
if (isset($hFile) && $hFile) {
@fflush($hFile);
@ftruncate($hFile, 0);
@fclose($hFile);
$hFile = null;
}
throw $x;
}
}
示例3: getPublicURLToFile
public function getPublicURLToFile($file)
{
$rel = $this->getRelativePathToFile($file);
if (strpos($rel, '://')) {
return $rel;
}
$url = \Core::getApplicationURL(true);
$url = $url->setPath($rel);
return trim((string) $url, '/');
}
示例4: array
<?php
echo $form->text('collection_handle', $cobj->getCollectionHandle(), array('title' => $cID, 'class' => 'collectionHandle'));
?>
<?php
Page::rescanCollectionPath($cID);
$path = $cobj->getCollectionPath();
$tokens = explode('/', $path);
$lastkey = array_pop(array_keys($tokens));
$tokens[$lastkey] = '<strong class="collectionPath">' . $tokens[$lastkey] . '</strong>';
$untokens = implode('/', $tokens);
?>
<a class="help-inline url-path" href="<?php
echo $nh->getLinkToCollection($cobj);
?>
" target="_blank"><?php
echo Core::getApplicationURL() . $untokens;
?>
</a><?php
?>
</div>
<?php
}
?>
<div class="form-group submit-changes">
<form id="seoForm<?php
echo $cID;
?>
" action="<?php
echo View::url('/dashboard/system/seo/page_data/', 'saveRecord');
?>
" method="post" class="pageForm">
示例5: contentsFrom
public function contentsFrom()
{
\Core::forgetInstance('url/canonical');
return array(array('<a href="{CCM:CID_3}">Super Cool!</a>', '<a href="' . \Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '/awesome/all-right">Super Cool!</a>'));
}
示例6: getCollectionIcon
/**
* Gets the icon for a page (also fires the on_page_get_icon event).
*
* @return string $icon Path to the icon
*/
public function getCollectionIcon()
{
// returns a fully qualified image link for this page's icon, either based on its collection type or if icon.png appears in its view directory
$icon = '';
$pe = new Event($this);
Events::dispatch('on_page_get_icon', $pe);
if ($icon) {
return $icon;
}
if (\Core::make('multilingual/detector')->isEnabled()) {
$icon = \Concrete\Core\Multilingual\Service\UserInterface\Flag::getDashboardSitemapIconSRC($this);
}
if ($this->isGeneratedCollection()) {
if ($this->getPackageID() > 0) {
if (is_dir(DIR_PACKAGES . '/' . $this->getPackageHandle())) {
$dirp = DIR_PACKAGES;
$url = \Core::getApplicationURL();
} else {
$dirp = DIR_PACKAGES_CORE;
$url = ASSETS_URL;
}
$file = $dirp . '/' . $this->getPackageHandle() . '/' . DIRNAME_PAGES . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON;
if (file_exists($file)) {
$icon = $url . '/' . DIRNAME_PACKAGES . '/' . $this->getPackageHandle() . '/' . DIRNAME_PAGES . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON;
}
} elseif (file_exists(DIR_FILES_CONTENT . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON)) {
$icon = \Core::getApplicationURL() . '/' . DIRNAME_PAGES . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON;
} elseif (file_exists(DIR_FILES_CONTENT_REQUIRED . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON)) {
$icon = ASSETS_URL . '/' . DIRNAME_PAGES . $this->getCollectionPath() . '/' . FILENAME_PAGE_ICON;
}
} else {
}
return $icon;
}
示例7: t
?>
<div class="form-group">
<span>
<?php
echo t('Sign in with a community account');
?>
</span>
<hr>
</div>
<div class="form-group">
<a href="<?php
echo \URL::to('/ccm/system/authentication/oauth2/community/attempt_auth');
?>
" class="btn btn-primary btn-community btn-block">
<img src="<?php
echo Core::getApplicationURL();
?>
/concrete/images/logo.png" class="concrete5-icon"></i>
<?php
echo t('Log in with concrete5.org');
?>
</a>
</div>
<div class="form-group">
<p><?php
echo t('Join the concrete5.org community to setup multiple websites, shop for extensions, and get support.');
?>
</p>
</div>
<?php
}
示例8: User
exit;
break;
}
}
break;
case 'approve-recent':
if ($cp->canApprovePageVersions()) {
$u = new User();
$pkr = new \Concrete\Core\Workflow\Request\ApprovePageRequest();
$pkr->setRequestedPage($c);
$v = CollectionVersion::get($c, "RECENT");
$pkr->setRequestedVersionID($v->getVersionID());
$pkr->setRequesterUserID($u->getUserID());
$u->unloadCollectionEdit($c);
$response = $pkr->trigger();
header('Location: ' . \Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '?cID=' . $c->getCollectionID() . $step);
exit;
}
break;
}
}
if (isset($_REQUEST['ptask']) && $_REQUEST['ptask'] && $valt->validate()) {
// piles !
switch ($_REQUEST['ptask']) {
case 'delete_content':
//personal scrapbook
if ($_REQUEST['pcID'] > 0) {
$pc = PileContent::get($_REQUEST['pcID']);
$p = $pc->getPile();
if ($p->isMyPile()) {
$pc->delete();
示例9: User
<?php $u = new User(); ?>
<script type="text/javascript">
<?php
echo("var CCM_DISPATCHER_FILENAME = '" . DIR_REL . '/' . DISPATCHER_FILENAME . "';\r");
echo("var CCM_CID = ".($cID?$cID:0).";\r");
if (isset($isEditMode)) {
echo("var CCM_EDIT_MODE = {$isEditMode};\r");
}
if (isset($isEditMode)) {
echo("var CCM_ARRANGE_MODE = {$isArrangeMode};\r");
}
?>
var CCM_IMAGE_PATH = "<?php echo ASSETS_URL_IMAGES?>";
var CCM_TOOLS_PATH = "<?php echo REL_DIR_FILES_TOOLS_REQUIRED?>";
var CCM_APPLICATION_URL = "<?php echo \Core::getApplicationURL()?>";
var CCM_REL = "<?php echo \Core::getApplicationRelativePath()?>";
</script>
<? if (isset($scc) && is_object($scc)) { ?>
<style type="text/css">
<? print $scc->getValue();?>
</style>
<? } ?>
<?php
$v = View::getInstance();
if (Config::get('concrete.user.profiles_enabled') && $u->isRegistered()) {
示例10: getDiagnosticObject
/**
* Given the current update object, sends information to concrete5.org to determine updatability
* @return \Concrete\Core\Updater\ApplicationUpdateDiagnostic
*/
public function getDiagnosticObject()
{
$request = new Request();
$request->setUri(Config::get('concrete.updates.services.inspect_update'));
$request->setMethod('POST');
$request->getPost()->set('current_version', Config::get('concrete.version_installed'));
$request->getPost()->set('requested_version', $this->getVersion());
$request->getPost()->set('site_url', (string) \Core::getApplicationURL());
$mi = Marketplace::getInstance();
if ($mi->isConnected() && !$mi->hasConnectionError()) {
$config = \Core::make('config/database');
$request->getPost()->set('marketplace_token', $config->get('concrete.marketplace.token'));
$list = Package::getInstalledList();
$packages = array();
foreach ($list as $pkg) {
$packages[] = array('version' => $pkg->getPackageVersion(), 'handle' => $pkg->getPackageHandle());
}
$request->getPost()->set('packages', $packages);
}
$overrides = id(Environment::get())->getOverrideList();
$request->getPost()->set('overrides', $overrides);
$client = new Client();
$client->setMethod('POST');
$response = $client->send($request);
$body = $response->getBody();
$diagnostic = DiagnosticFactory::getFromJSON($body);
return $diagnostic;
}
示例11: translateFromEditMode
/**
* Takes a chunk of content containing abstracted link references,
* and expands them to urls suitable for the rich text editor.
*/
public static function translateFromEditMode($text)
{
$text = preg_replace(array('/{CCM:BASE_URL}/i'), array(\Core::getApplicationURL()), $text);
//page links...
$text = preg_replace('/{CCM:CID_([0-9]+)}/i', \Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '?cID=\\1', $text);
//images...
$dom = new HtmlDomParser();
$r = $dom->str_get_html($text, true, true, DEFAULT_TARGET_CHARSET, false);
if (is_object($r)) {
foreach ($r->find('concrete-picture') as $picture) {
$fID = $picture->fid;
$attrString = "";
foreach ($picture->attr as $attr => $val) {
if (!in_array($attr, self::$blackListImgAttributes)) {
$attrString .= "{$attr}=\"{$val}\" ";
}
}
$picture->outertext = '<img src="' . URL::to('/download_file', 'view_inline', $fID) . '" ' . $attrString . '/>';
}
$text = (string) $r->restore_noise($r);
}
// now we add in support for the links
$text = preg_replace_callback('/{CCM:FID_([0-9]+)}/i', function ($matches) {
$fID = $matches[1];
if ($fID > 0) {
return URL::to('/download_file', 'view_inline', $fID);
}
}, $text);
//file downloads...
$text = preg_replace_callback('/{CCM:FID_DL_([0-9]+)}/i', function ($matches) {
$fID = $matches[1];
if ($fID > 0) {
return URL::to('/download_file', 'view', $fID);
}
}, $text);
return $text;
}
示例12:
</title>
<?php
$canonical_link = $c->getCollectionLink(true);
echo new \Concrete\Core\Html\Object\HeadLink($canonical_link, 'canonical');
?>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
<?php
if (is_object($c)) {
/** @var \Concrete\Core\Localization\Service\Date $date */
$date = Core::make('helper/date');
/** @var \Concrete\Core\Utility\Service\Text $text */
$text = Core::make('helper/text');
/** @var \Concrete\Core\Page\Theme\Theme $theme */
$theme = \Concrete\Core\Page\Theme\Theme::getByHandle('amp');
$theme_url = Core::getApplicationURL() . $theme->getThemeURL();
$theme_path = DIR_BASE . $theme->getThemeURL();
// We can set a headline 3 ways:
// 1. It comes through programmatically as $pageDescription.
// 2. It comes from meta description
// 3. It comes from getCollectionDescription()
if (!isset($pageDescription) || !$pageDescription) {
// we aren't getting it dynamically.
$pageDescription = $c->getCollectionAttributeValue('meta_description');
if (!$pageDescription) {
$pageDescription = $c->getCollectionDescription();
}
}
/** @var \Concrete\Core\User\UserInfo $author */
$author = Core::make('Concrete\\Core\\User\\UserInfoFactory')->getByID($c->getCollectionUserID());
/** @see https://developers.google.com/search/docs/data-types/articles */
示例13: translateFromEditMode
/**
* Takes a chunk of content containing abstracted link references,
* and expands them to urls suitable for the rich text editor.
*/
public static function translateFromEditMode($text)
{
$app = \Core::make('app');
//page links...
$text = preg_replace('/{CCM:CID_([0-9]+)}/i', \Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '?cID=\\1', $text);
//images...
$dom = new HtmlDomParser();
$r = $dom->str_get_html($text);
if (is_object($r)) {
foreach ($r->find('concrete-picture') as $picture) {
$fID = $picture->fid;
$alt = $picture->alt;
$style = $picture->style;
$picture->outertext = '<img src="' . URL::to('/download_file', 'view_inline', $fID) . '" alt="' . $alt . '" style="' . $style . '" />';
}
$text = (string) $r;
}
//file downloads...
$text = preg_replace_callback('/{CCM:FID_DL_([0-9]+)}/i', function ($matches) {
$fID = $matches[1];
if ($fID > 0) {
return URL::to('/download_file', 'view', $fID);
}
}, $text);
return $text;
}
示例14: getMarketplacePurchaseFrame
public function getMarketplacePurchaseFrame($mp, $width = '100%', $height = '530')
{
$tp = new TaskPermission();
if ($tp->canInstallPackages()) {
if (!is_object($mp)) {
return '<div class="alert-message block-message error">' . t('Unable to get information about this product.') . '</div>';
}
if ($this->isConnected()) {
$url = Config::get('concrete.urls.concrete5_secure') . Config::get('concrete.urls.paths.marketplace.checkout');
$csiURL = urlencode(\Core::getApplicationURL());
$csiBaseURL = urlencode(\Core::getApplicationURL());
$csToken = $this->getSiteToken();
$url = $url . '/' . $mp->getProductBlockID() . '?ts=' . time() . '&csiBaseURL=' . $csiBaseURL . '&csiURL=' . $csiURL . '&csToken=' . $csToken;
}
$time = time();
$ifr = '<script type="text/javascript">
window.addEventListener("message", function(e) {
jQuery.fn.dialog.hideLoader();
if (e.data == "loading") {
jQuery.fn.dialog.showLoader();
} else {
var eh = e.data;
eh = parseInt(eh) + 100;
$("#ccm-marketplace-frame-' . $time . '").attr("height", eh);
}
});
</script>';
$ifr .= '<iframe class="ccm-marketplace-frame" id="ccm-marketplace-frame-' . $time . '" frameborder="0" width="' . $width . '" height="' . $height . '" src="' . $url . '"></iframe>';
return $ifr;
} else {
return '<div class="ccm-error">' . t('You do not have permission to connect this site to the marketplace.') . '</div>';
}
}
示例15: new_page
public function new_page()
{
if ($this->validateAction()) {
$c = $this->page;
$e = Core::make('helper/validation/error');
$pt = $c->getPageTypeObject();
if (is_object($pt)) {
$ptp = new \Permissions($pt);
if (!$ptp->canAddPageType()) {
$e->add(t('You do not have permission to create new pages of this type.'));
}
}
$r = new PageEditVersionResponse();
$r->setError($e);
if (!$e->has()) {
$c->loadVersionObject($_REQUEST['cvID']);
$nc = $c->cloneVersion(t('New Page Created From Version'));
$v = $nc->getVersionObject();
$drafts = Page::getByPath(Config::get('concrete.paths.drafts'));
$nc = $c->duplicate($drafts);
$nc->deactivate();
$nc->move($drafts);
// now we delete all but the new version
$vls = new VersionList($nc);
$vls->setItemsPerPage(-1);
$vArray = $vls->getPage();
for ($i = 1; $i < count($vArray); $i++) {
$cv = $vArray[$i];
$cv->delete();
}
// now, we delete the version we duped on the current page, since we don't need it anymore.
$v->delete();
// finally, we redirect the user to the new drafts page in composer mode.
$r->setPage($nc);
$r->setRedirectURL(\Core::getApplicationURL() . '/' . DISPATCHER_FILENAME . '?cID=' . $nc->getCollectionID() . '&ctask=check-out-first&' . Loader::helper('validation/token')->getParameter());
}
$r->outputJSON();
}
}