本文整理汇总了PHP中public_url函数的典型用法代码示例。如果您正苦于以下问题:PHP public_url函数的具体用法?PHP public_url怎么用?PHP public_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了public_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCanBrowseOtherUsersPrivateExhibits
/**
* Contributors should be able to browse other users' private exhibits.
*/
public function testCanBrowseOtherUsersPrivateExhibits()
{
$this->dispatch('neatline');
$this->assertNotAction('forbidden');
// Should list other user's private exhibit.
$this->assertXpath('//a[@class="neatline"][@href="' . public_url('neatline/show/slug1') . '"]');
}
示例2: getRecordUrl
public function getRecordUrl($action = 'show')
{
if ('show' == $action) {
return public_url($this->slug);
}
return array('module' => 'catalog-search', 'controller' => 'index', 'action' => $action, 'id' => $this->id);
}
示例3: link_to
public static function link_to($args, $attributes)
{
$text = isset($args[1]) ? $args[1] : $args[0];
$app_key = \Hook\Application\Context::getKey();
$public_url = public_url($args[0]) . '?X-App-Id=' . $app_key->app_id . '&X-App-Key=' . $app_key->key;
return array('<a href="' . $public_url . '"' . html_attributes($attributes) . '>' . $text . '</a>', 'raw');
}
示例4: testCanBrowsePublicExhibits
/**
* Anonymous users should be able to browse public exhibits.
*/
public function testCanBrowsePublicExhibits()
{
$this->dispatch('neatline');
$this->assertNotAction('login');
// Should list public exhibit.
$this->assertXpath('//a[@class="neatline"][@href="' . public_url('neatline/show/slug') . '"]');
}
示例5: testOverrideSearchFormAction
/**
* The simple search form should point to the Solr Search interceptor.
*/
public function testOverrideSearchFormAction()
{
$this->dispatch('');
// Get the interceptor URL.
$url = public_url('solr-search/results/interceptor');
// Should override the default search action.
$this->assertXpath("//form[@id='search-form'][@action='{$url}']");
}
示例6: testPagination
/**
* When the number of results exceeds the page length, the maximum number
* of results and the pagination should be displayed.
*/
public function testPagination()
{
// Set public page length to 2.
set_option('per_page_public', 2);
$item1 = $this->_item(true, 'Item 1');
$item2 = $this->_item(true, 'Item 2');
$item3 = $this->_item(true, 'Item 3');
$item4 = $this->_item(true, 'Item 4');
$item5 = $this->_item(true, 'Item 5');
$item6 = $this->_item(true, 'Item 6');
// --------------------------------------------------------------------
// Page 1.
$this->dispatch('solr-search');
// Should just list items 1-2.
$this->assertXpath('//a[@href="' . record_url($item1) . '"]');
$this->assertXpath('//a[@href="' . record_url($item2) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item3) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item4) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item5) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item6) . '"]');
// Should link to page 2.
$next = public_url('solr-search?page=2');
$this->assertXpath('//a[@href="' . $next . '"]');
$this->resetResponse();
$this->resetRequest();
// --------------------------------------------------------------------
// Page 2.
$_GET['page'] = '2';
$this->dispatch('solr-search');
// Should just list items 3-4.
$this->assertNotXpath('//a[@href="' . record_url($item1) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item2) . '"]');
$this->assertXpath('//a[@href="' . record_url($item3) . '"]');
$this->assertXpath('//a[@href="' . record_url($item4) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item5) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item6) . '"]');
// Should link to page 3.
$next = public_url('solr-search?page=3');
$this->assertXpath('//a[@href="' . $next . '"]');
$this->resetResponse();
$this->resetRequest();
// --------------------------------------------------------------------
// Page 3.
$_GET['page'] = '3';
$this->dispatch('solr-search');
// Should just list items 5-6.
$this->assertNotXpath('//a[@href="' . record_url($item1) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item2) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item3) . '"]');
$this->assertNotXpath('//a[@href="' . record_url($item4) . '"]');
$this->assertXpath('//a[@href="' . record_url($item5) . '"]');
$this->assertXpath('//a[@href="' . record_url($item6) . '"]');
// Should link back to page 2.
$prev = public_url('solr-search?page=2');
$this->assertXpath('//a[@href="' . $prev . '"]');
// --------------------------------------------------------------------
}
示例7: nl_getExhibitUrl
/**
* Returns a link to a Neatline exhibit.
*
* @param NeatlineExhibit|null $exhibit The exhibit record.
* @param string $action The action for the link.
* @return string The URL.
*/
function nl_getExhibitUrl($exhibit, $action, $public = true)
{
$exhibit = $exhibit ? $exhibit : nl_getExhibit();
if (in_array($action, array('show', 'fullscreen'))) {
$identifier = $exhibit->slug;
} else {
$identifier = $exhibit->id;
}
$route = 'neatline/' . $action . '/' . $identifier;
$href = $public ? public_url($route) : url($route);
return $href;
}
示例8: store
public function store($filename, $data, $options = array())
{
$storage_dir = storage_dir(true);
$public_dir = storage_dir(false);
// create directory if it doesn't exists
if (!is_dir($storage_dir)) {
mkdir($storage_dir, 0777, true);
}
if (file_put_contents($storage_dir . $filename, $data)) {
return public_url($public_dir . $filename);
}
}
示例9: setUp
public function setUp()
{
parent::setUp();
$this->helper = new ExhibitBuilder_IntegrationHelper();
$this->helper->setUpPlugin();
$this->exhibit = $this->helper->createNewExhibit(true, false, 'Exhibit Title', 'Exhibit Description', 'Exhibit Credits', 'exhibit');
$this->assertTrue($this->exhibit->exists());
$maxPageCount = 3;
$parentPage = null;
for ($i = 1; $i <= $maxPageCount; $i++) {
$exhibitPage = $this->helper->createNewExhibitPage($this->exhibit, $parentPage, 'Exhibit Page Title ' . $i, 'page' . $i, 1, 'text');
$this->assertTrue($exhibitPage->exists());
$parentPage = $exhibitPage;
}
$this->dispatch('exhibits/show/exhibit/page1/page2/page3');
$this->basePageUrl = public_url('exhibits/show/exhibit');
}
开发者ID:fitnycdigitalinitiatives,项目名称:plugin-ExhibitBuilder,代码行数:17,代码来源:ExhibitBuilderPageNavTest.php
示例10: nl_getExhibitLink
/**
* Returns a link to a Neatline exhibit.
*
* @param NeatlineExhibit|null $exhibit The exhibit record.
* @param string $action The action for the link.
* @param string $text The link text.
* @param array $props Array of properties for the element.
* @return string The HTML link.
*/
function nl_getExhibitLink($exhibit, $action, $text, $props = array(), $public = true)
{
// Get exhibit and link text.
$exhibit = $exhibit ? $exhibit : nl_getExhibit();
$text = $text ? $text : nl_getExhibitField('title');
// Get the exhibit identifier (`id` or `slug`).
if (in_array($action, array('show', 'fullscreen'))) {
$identifier = $exhibit->slug;
} else {
$identifier = $exhibit->id;
}
// Construct the exhibit route.
$route = 'neatline/' . $action . '/' . $identifier;
$props['href'] = $public ? public_url($route) : url($route);
// Return the anchor tag.
return '<a ' . tag_attributes($props) . '>' . $text . '</a>';
}
示例11: exhibit_builder_exhibit_uri
/**
* Return a URI to an exhibit.
*
* @param Exhibit $exhibit If null, it uses the current exhibit.
* @param ExhibitPage $exhibitPage A specific page to link to
* @return string
*/
function exhibit_builder_exhibit_uri($exhibit = null, $exhibitPage = null)
{
if (!$exhibit) {
$exhibit = get_current_record('exhibit');
}
$exhibitSlug = $exhibit instanceof Exhibit ? $exhibit->slug : $exhibit;
//If there is no page slug available, we want to build a URL for the summary page
if (!$exhibitPage) {
$uri = public_url(array('slug' => $exhibitSlug), 'exhibitSimple');
} else {
$pagesTrail = $exhibitPage->getAncestors();
$pagesTrail[] = $exhibitPage;
$options = array();
$options['slug'] = $exhibitSlug;
foreach ($pagesTrail as $index => $page) {
$adjustedIndex = $index + 1;
$options["page_slug_{$adjustedIndex}"] = $page->slug;
}
$uri = public_url($options, 'exhibitShow', array(), true);
}
return $uri;
}
示例12: _update_robots
private function _update_robots()
{
$serverUrlHelper = new Zend_View_Helper_ServerUrl();
$serverUrl = $serverUrlHelper->serverUrl();
$sitemap_uri = $serverUrl . public_url('sitemap.xml');
//update the site robots.txt file so it lists the sitemap
// options for robots file
$mapdef = "\n#START XML-SITEMAP-PLUGIN\n";
$mapdef .= "Sitemap: " . $sitemap_uri . "\n";
$mapdef .= "#END XML-SITEMAP-PLUGIN\n";
// open file
$robotspath = BASE_DIR . "/robots.txt";
if (is_writeable($robotspath)) {
$robotsfile = fopen($robotspath, 'a');
//write to file
fwrite($robotsfile, $mapdef);
//close file
fclose($robotsfile);
} else {
echo "Robots.txt file is not writeable";
}
}
示例13: testGetPageLinksForPublishedPages
public function testGetPageLinksForPublishedPages()
{
$pages = $this->db->getTable('SimplePagesPage')->findAll();
$this->assertEquals(1, count($pages));
$aboutPage = $pages[0];
$testPage1 = $this->_addTestPage('Test Title 1', 'testslug1', 'testtext1');
$testPage1->parent_id = $aboutPage->id;
$testPage1->order = 1;
$testPage1->is_published = 1;
$testPage1->save();
$testPage2 = $this->_addTestPage('Test Title 2', 'testslug2', 'testtext2');
$testPage2->parent_id = $aboutPage->id;
$testPage2->order = 2;
$testPage2->is_published = 1;
$testPage2->save();
$testPage3 = $this->_addTestPage('Test Title 3', 'testslug3', 'testtext3');
$testPage3->parent_id = $aboutPage->id;
$testPage3->order = 3;
$testPage3->is_published = 0;
$testPage3->save();
$testPage4 = $this->_addTestPage('Test Title 4', 'testslug4', 'testtext4');
$testPage4->parent_id = $testPage2->id;
$testPage4->order = 1;
$testPage4->is_published = 0;
$testPage4->save();
$testPage5 = $this->_addTestPage('Test Title 5', 'testslug5', 'testtext5');
$testPage5->parent_id = $testPage2->id;
$testPage5->order = 2;
$testPage5->is_published = 1;
$testPage5->save();
$this->dispatch('/');
$actualNavLinks = simple_pages_get_links_for_children_pages($aboutPage->id, 'order', true);
$this->assertEquals(2, count($actualNavLinks));
$expectedNavLinks = array();
$expectedNavLinks[] = array('label' => 'Test Title 1', 'uri' => public_url('testslug1'));
$expectedNavLinks[] = array('label' => 'Test Title 2', 'uri' => public_url('testslug2'), 'pages' => array(array('label' => 'Test Title 5', 'uri' => public_url('testslug5'))));
$this->assertEquals($expectedNavLinks, $actualNavLinks);
}
示例14: generate
public function generate($products)
{
$tpl = '';
if (!$products) {
return $tpl;
}
$tpl .= '<ul>';
foreach ($products as $row) {
$tpl .= '<li>';
if (isset($row['thumbnail']) && $row['thumbnail']) {
$tpl .= '<a href="/i/' . $row['url'] . '" class="item">';
$tpl .= '<img class="item-img" src="' . public_url() . '/products/' . $row['thumbnail'] . '" alt="" />';
} else {
$tpl .= '<a href="/i/' . $row['url'] . '" class="item none">';
}
$tpl .= '</a>';
$tpl .= '<span class="item-price abs">' . $row['price'] . '<em>AED</em></span>';
$tpl .= '<a class="btn-lg abs addcart-btn" data-addcart-id="' . $row['id'] . '" data-addcart-img="' . public_url() . '/products/' . (isset($row['thumbnail']) && $row['thumbnail'] ? $row['thumbnail'] : 'default.png') . '"><span class="glyphicon glyphicon-shopping-cart"></span></a>';
$tpl .= '<p class="item-caption">' . $row['name'] . '</p>';
$tpl .= '</li>';
}
$tpl .= '</ul>';
return $tpl;
}
示例15: head
echo head(array('title' => $itemTitle, 'bodyclass' => 'items edit'));
include 'form-tabs.php';
echo flash();
?>
<form method="post" enctype="multipart/form-data" id="item-form" action="">
<?php
include 'form.php';
?>
<section class="three columns omega">
<div id="save" class="panel">
<?php
echo $this->formSubmit('submit', __('Save Changes'), array('id' => 'save-changes', 'class' => 'submit big green button'));
?>
<a href="<?php
echo html_escape(public_url('items/show/' . metadata('item', 'id')));
?>
" class="big blue button" target="_blank"><?php
echo __('View Public Page');
?>
</a>
<?php
echo link_to_item(__('Delete'), array('class' => 'delete-confirm big red button'), 'delete-confirm');
?>
<?php
fire_plugin_hook("admin_items_panel_buttons", array('view' => $this, 'record' => $item));
?>
<div id="public-featured">
<?php