本文整理汇总了PHP中record_url函数的典型用法代码示例。如果您正苦于以下问题:PHP record_url函数的具体用法?PHP record_url怎么用?PHP record_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了record_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render html for the save panel buttons
*
* @param string $content
* @return string
*/
public function render($content)
{
$noAttribs = $this->getOption('noAttribs');
$record = $this->getRecord();
$content = $this->getOption('content');
$this->removeOption('content');
$this->removeOption('noAttribs');
$this->removeOption('openOnly');
$this->removeOption('closeOnly');
$this->removeOption('record');
$attribs = null;
if (!$noAttribs) {
$attribs = $this->getOptions();
}
$html = "<input id='save-changes' class='submit big green button' type='submit' value='" . __('Save Changes') . "' name='submit' />";
if ($record) {
if ($this->hasPublicPage() && $record->exists()) {
set_theme_base_url('public');
$publicPageUrl = record_url($record, 'show');
revert_theme_base_url();
$html .= "<a href='{$publicPageUrl}' class='big blue button' target='_blank'>" . __('View Public Page') . "</a>";
}
if (is_allowed($record, 'delete')) {
$recordDeleteConfirm = record_url($record, 'delete-confirm');
$html .= "<a href='{$recordDeleteConfirm}' class='big red button delete-confirm'>" . __('Delete') . "</a>";
}
}
//used by SavePanelHook to locate where to insert hook content
$html .= "<div id='button-field-line'></div>";
return $html;
}
示例2: 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 . '"]');
// --------------------------------------------------------------------
}
示例3: testSearchIndexedElements
/**
* Search queries should match indexed elements.
*/
public function testSearchIndexedElements()
{
$this->fieldTable->setElementIndexed('Dublin Core', 'Description');
$item1 = insert_item(array('public' => true), array('Dublin Core' => array('Title' => array(array('text' => 'Item 1', 'html' => false)), 'Description' => array(array('text' => 'desc1', 'html' => false)))));
$item2 = insert_item(array('public' => true), array('Dublin Core' => array('Title' => array(array('text' => 'Item 2', 'html' => false)), 'Description' => array(array('text' => 'desc2', 'html' => false)))));
$_GET['q'] = 'desc1';
$this->dispatch('solr-search');
// Should match item 1, but not item 2.
$this->_assertResultLink(record_url($item1), 'Item 1');
$this->_assertNotResultLink(record_url($item2));
}
示例4: table_double_field_info
function table_double_field_info($args)
{
if ($args) {
$taletype_search_url = url(array('module' => 'items', 'controller' => 'browse'), 'default', array("search" => "", "submit_search" => "Zoeken", "advanced[0][element_id]" => "49", "advanced[0][type]" => "is exactly", "advanced[0][terms]" => "{$args}"));
$tale_view_url = get_element_by_value($args, "Identifier") ? record_url(get_element_by_value($args, "Identifier"), 'show') : "";
$type_information = __("Temporarily no title information");
## REPLACE BY THIS: $type_information = get_type_description($args);
$pasted_args = str_replace(array(" ", "\r"), "", $args);
return browse_link_in_table($value, $search_url, $additional_information);
}
return __("something went wrong");
}
示例5: testSearchDescriptions
/**
* Search queries should match exhibit descriptions.
*/
public function testSearchDescriptions()
{
$exhibit1 = $this->_exhibit(true, 'Exhibit 1', 'e1');
$exhibit2 = $this->_exhibit(true, 'Exhibit 2', 'e2');
$exhibit1->description = 'desc1';
$exhibit2->description = 'desc2';
$exhibit1->save();
$exhibit2->save();
$_GET['q'] = 'desc1';
$this->dispatch('solr-search');
// Should match exhibit 1, but not exhibit 2.
$this->_assertResultLink(record_url($exhibit1), 'Exhibit 1');
$this->_assertNotResultLink(record_url($exhibit2));
}
示例6: testSearchDescriptions
/**
* Search queries should match page descriptions.
*/
public function testSearchDescriptions()
{
$page1 = $this->_simplePage(true, 'Page 1', 'p1');
$page2 = $this->_simplePage(true, 'Page 2', 'p2');
$page1->text = 'text1';
$page2->text = 'text2';
$page1->save();
$page2->save();
$_GET['q'] = 'text1';
$this->dispatch('solr-search');
// Should match page 1, but not page 2.
$this->_assertResultLink(record_url($page1), 'Page 1');
$this->_assertNotResultLink(record_url($page2));
}
示例7: testSearchEntries
/**
* Search queries should match page entry texts.
*/
public function testSearchEntries()
{
$exhibit1 = $this->_exhibit(true, 'Exhibit 1', 'e1');
$exhibit2 = $this->_exhibit(true, 'Exhibit 2', 'e2');
$page1 = $this->_exhibitPage($exhibit1, 'Page 1', 'p1');
$page2 = $this->_exhibitPage($exhibit2, 'Page 2', 'p2');
$entry1 = $this->_exhibitBlock($page1, 'text1');
$entry2 = $this->_exhibitBlock($page1, 'text2');
$_GET['q'] = 'text1';
$this->dispatch('solr-search');
// Should match page 1, but not page 2.
$this->_assertResultLink(record_url($page1), 'Page 1');
$this->_assertNotResultLink(record_url($page2));
}
示例8: _createItemCitationString
/**
* Creates a test Item and returns a citation string.
*
* @todo This function, like Item::getCitation(), uses date() to generate a date
* accessed for the citation. This should be changed when we
* internationalize date outputs.
*
* @param string|null The Item title.
* @param string|null The Item creator.
* @return string The Item's citation string.
*/
protected function _createItemCitationString($title = null, $creator = null)
{
$elementTexts = array('Dublin Core' => array('Title' => array(array('text' => $title, 'html' => false)), 'Creator' => array(array('text' => $creator, 'html' => false))));
$item = new Item();
$item->addElementTextsByArray($elementTexts);
$item->save();
set_current_record('item', $item, true);
$siteTitle = option('site_title');
$dateAccessed = format_date(time(), Zend_Date::DATE_LONG);
$itemUrl = record_url('item', null, true);
$citationHtml = "“{$title},” <em>{$siteTitle}</em>, accessed {$dateAccessed}, {$itemUrl}.";
if ($creator) {
$citationHtml = "{$creator}, {$citationHtml}";
}
return $citationHtml;
}
示例9: recordToDcmesXml
public function recordToDcmesXml($item)
{
$xml = "\n" . '<rdf:Description rdf:about="' . xml_escape(record_url($item, null, true)) . '">';
// Iterate throught the DCMES.
foreach ($this->_dcElements as $elementName) {
if ($text = metadata($item, array('Dublin Core', $elementName), array('all' => true, 'no_escape' => true))) {
foreach ($text as $k => $v) {
if (!empty($v)) {
$xml .= "\n" . '<dc:' . strtolower($elementName) . '>' . xml_escape($v) . '</dc:' . strtolower($elementName) . '>';
}
}
}
}
$xml .= "\n" . '</rdf:Description>';
return $xml;
}
示例10: itemToDcRdf
public function itemToDcRdf(Item $item)
{
$dces = new DublinCoreExtendedPlugin();
$xml = '<rdf:Description rdf:about="' . html_escape(record_url($item, 'show', true)) . '">';
foreach ($dces->getElements() as $element) {
$elementTexts = metadata($item, array('Dublin Core', $element['label']), array('all' => true));
if ($elementTexts) {
foreach ($elementTexts as $elementText) {
if (strlen($elementText) != 0) {
$xml .= "\n <dcterms:{$element['name']}><![CDATA[{$elementText}]]></dcterms:{$element['name']}>";
}
}
}
}
$xml .= "\n</rdf:Description>";
return $xml;
}
示例11: testLinkToTimeline
/**
* Tests whether link_to_timeline() returns the correct link for a timeline.
*
* @uses link_to_timeline()
*/
public function testLinkToTimeline()
{
$timeline = $this->_createTimeline();
$this->dispatch('neatline-time/timelines/show/1');
$matcher = array('tag' => 'a', 'content' => $timeline->title, 'attributes' => array('href' => record_url($timeline)));
$linkDefault = link_to_timeline();
$this->assertTag($matcher, $linkDefault);
$linkText = 'New Text';
$linkWithNewText = link_to_timeline($linkText);
$matcher['content'] = $linkText;
$this->assertTag($matcher, $linkWithNewText);
$linkToEditWithProps = link_to_timeline(null, array('class' => 'edit'), 'edit');
$matcher['content'] = $timeline->title;
$matcher['attributes']['class'] = 'edit';
$matcher['attributes']['href'] = record_url($timeline, 'edit');
$this->assertTag($matcher, $linkToEditWithProps);
}
示例12: testRecordUrl
/**
* Tests to get the good record url of a record via core functions.
*/
public function testRecordUrl()
{
$record = $this->getRecordByTitle('Title of Collection #1');
$generic = get_option('clean_url_collection_generic');
$generic = $generic ? '/' . $generic : '/';
$url = record_url($record);
$this->assertEquals($generic . 'Identifier_of_Collection_1', $url, sprintf('A collection has a wrong record url.'));
$record = $this->getRecordByTitle('Title of Item #1');
$generic = get_option('clean_url_item_generic');
$generic = $generic ? '/' . $generic : '';
$url = record_url($record);
$this->assertEquals($generic . 'Identifier_of_Item_1', $url, sprintf('A collection has a wrong record url.'));
$record = $this->getRecordByTitle('Title of File #1');
$generic = get_option('clean_url_file_generic');
$generic = $generic ? '/' . $generic : '';
$url = record_url($record);
$this->assertEquals($generic . 'Identifier_of_File_1', $url, sprintf('A collection has a wrong record url.'));
}
示例13: manifestAction
public function manifestAction()
{
$CONTEXT_PRESENTATION = "http://iiif.io/api/presentation/2/context.json";
$CONTEXT_IMAGE = "http://iiif.io/api/image/2/context.json";
$PROFILE_IMAGE = "http://iiif.io/api/image/2/level2.json";
$BASE_URI = record_url($this->item, 'show', true);
$MANIFEST_URI = $BASE_URI . "/manifest.json";
$SEQUENCE_URI = $BASE_URI . "/sequence.json";
$CANVAS_BASE_URI = $BASE_URI . "/canvas/";
$canvases = array("canvases" => array());
$counter = 0;
foreach ($this->item->Files as $file) {
$metadata = json_decode($file->metadata, TRUE);
if (!isset($metadata) or !array_key_exists('iiif', $metadata) or $metadata['iiif'] == array()) {
continue;
}
$base_image_url = $metadata['iiif']['@id'];
$image_width = 0;
$image_height = 0;
$image_url = $base_image_url . "/full/full/0/native.jpg";
if (isset($metadata)) {
$image_width = $metadata['iiif']['width'];
$image_height = $metadata['iiif']['height'];
}
$images = array("@type" => "oa:Annotation", "motivation" => "sc:painting", "resource" => array("@id" => $image_url, "@type" => "dctypes:Image", "service" => array("@context" => $CONTEXT_IMAGE, "profile" => $PROFILE_IMAGE, "@id" => $base_image_url)), "on" => $CANVAS_BASE_URI . "{$counter}.json");
$canvas = array("@id" => $CANVAS_BASE_URI . "{$counter}.json", "@type" => "sc:Canvas", "label" => metadata($this->item, array('Dublin Core', 'Title')) . " - image {$counter}", "width" => (int) $image_width, "height" => (int) $image_height, "images" => array());
$images["resource"]["width"] = (int) $image_width;
$images["resource"]["height"] = (int) $image_height;
array_push($canvas['images'], $images);
array_push($canvases['canvases'], $canvas);
$counter++;
}
$sequences = array("sequences" => array("@id" => $SEQUENCE_URI, "@type" => "sc:Sequence", "label" => metadata($this->item, array('Dublin Core', 'Title')) . " - sequence 1"));
$sequences = $sequences['sequences'] + $canvases;
$manifest = array("@context" => $CONTEXT_PRESENTATION, "@id" => $MANIFEST_URI, "@type" => "sc:Manifest", "label" => metadata($this->item, array('Dublin Core', 'Title')), "sequences" => array($sequences));
$response = $this->getResponse();
$response->setHeader('Content-Type', 'application/json', true);
$response->setHeader('Access-Control-Allow-Origin', '*');
$response->setBody(json_encode($manifest, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
$response->sendResponse();
exit;
}
示例14: itemToRSS
protected function itemToRSS($item)
{
$entry = array();
set_current_record('item', $item, true);
// Title is a CDATA section, so no need for extra escaping.
$entry['title'] = strip_formatting(metadata($item, array('Dublin Core', 'Title'), array('no_escape' => true)));
$entry['description'] = $this->buildDescription($item);
$entry['link'] = xml_escape(record_url($item, null, true));
$entry['lastUpdate'] = strtotime($item->added);
//List the first file as an enclosure (only one per RSS feed)
if (($files = $item->Files) && ($file = current($files))) {
$entry['enclosure'] = array();
$fileDownloadUrl = file_display_url($file);
$enc['url'] = $fileDownloadUrl;
$enc['type'] = $file->mime_type;
$enc['length'] = (int) $file->size;
$entry['enclosure'][] = $enc;
}
return $entry;
}
示例15: appendMetadata
/**
* Appends Dublin Core metadata.
*
* Appends a metadata element, an child element with the required format,
* and further children for each of the Dublin Core fields present in the
* item.
*/
public function appendMetadata($item, $metadataElement)
{
$document = $metadataElement->ownerDocument;
$oai_dc = $document->createElementNS(self::METADATA_NAMESPACE, 'oai_dc:dc');
$metadataElement->appendChild($oai_dc);
$oai_dc->setAttribute('xmlns:dc', self::DC_NAMESPACE_URI);
$oai_dc->declareSchemaLocation(self::METADATA_NAMESPACE, self::METADATA_SCHEMA);
/* Each of the 16 unqualified Dublin Core elements, in the order
* specified by the oai_dc XML schema
*/
$dcElementNames = array('title', 'creator', 'subject', 'description', 'publisher', 'contributor', 'date', 'type', 'format', 'identifier', 'source', 'language', 'relation', 'coverage', 'rights');
/* Must create elements using createElement to make DOM allow a
* top-level xmlns declaration instead of wasteful and non-
* compliant per-node declarations.
*/
foreach ($dcElementNames as $elementName) {
$upperName = Inflector::camelize($elementName);
$dcElements = $item->getElementTexts('Dublin Core', $upperName);
// Prepend the item type, if any.
if ($elementName == 'type' && get_option('oaipmh_repository_expose_item_type')) {
if ($dcType = $item->getProperty('item_type_name')) {
$oai_dc->appendNewElement('dc:type', $dcType);
}
}
foreach ($dcElements as $elementText) {
$oai_dc->appendNewElement('dc:' . $elementName, $elementText->text);
}
// Append the browse URI to all results
if ($elementName == 'identifier') {
$oai_dc->appendNewElement('dc:identifier', record_url($item, 'show', true));
// Also append an identifier for each file
if (get_option('oaipmh_repository_expose_files')) {
$files = $item->getFiles();
foreach ($files as $file) {
$oai_dc->appendNewElement('dc:identifier', $file->getWebPath('original'));
}
}
}
}
}