当前位置: 首页>>代码示例>>PHP>>正文


PHP JDocument::setMetaData方法代码示例

本文整理汇总了PHP中JDocument::setMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP JDocument::setMetaData方法的具体用法?PHP JDocument::setMetaData怎么用?PHP JDocument::setMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDocument的用法示例。


在下文中一共展示了JDocument::setMetaData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetMetaData

	/**
	 * @todo Implement testGetMetaData().
	 */
	public function testGetMetaData() {
		$this->object = new JDocument;
		$this->assertThat(
			$this->object->getMetaData('generator'),
			$this->equalTo('Joomla! 1.7 - Open Source Content Management'),
			'JDocument::getMetaData did not return generator properly'
		);

		$this->object->setMetaData('generator', 'My Custom Generator');

		$this->assertThat(
			$this->object->getMetaData('generator'),
			$this->equalTo('My Custom Generator'),
			'JDocument::getMetaData did not return generator properly or setMetaData with generator did not work'
		);

		$this->assertThat(
			$this->object->getMetaData('description'),
			$this->equalTo(''),
			'JDocument::getMetaData did not return description properly'
		);

		$this->object->setMetaData('description', 'My Description');

		$this->assertThat(
			$this->object->getMetaData('description'),
			$this->equalTo('My Description'),
			'JDocument::getMetaData did not return description properly or setMetaData with description didn not set properly'
		);

		$this->object->setMetaData('myMetaTag', 'myMetaContent');

		$this->assertThat(
			$this->object->getMetaData('myMetaTag'),
			$this->equalTo('myMetaContent'),
			'JDocument::getMetaData or setMetaData failed'
		);

		$this->assertThat(
			$this->object->getMetaData('myMetaTag', true),
			$this->logicalNot($this->equalTo('myMetaContent')),
			'JDocument::getMetaData or setMetaData returned http_equiv when it should not have'
		);

		$this->object->setMetaData('myOtherMetaTag', 'myOtherMetaContent', true);

		$this->assertThat(
			$this->object->getMetaData('myOtherMetaTag', true),
			$this->equalTo('myOtherMetaContent'),
			'JDocument::getMetaData or setMetaData failed'
		);

		$this->assertThat(
			$this->object->getMetaData('myOtherMetaTag'),
			$this->logicalNot($this->equalTo('myOtherMetaContent')),
			'JDocument::getMetaData or setMetaData returned http_equiv when it should not have'
		);


	}
开发者ID:realityking,项目名称:JAJAX,代码行数:63,代码来源:JDocumentTest.php

示例2: prepareDocument

	/**
	 * Prepares the document
	 *
	 * @return void
	 *
	 * @since       1.7.2
	 */
	protected function prepareDocument()
	{
		$app   = JFactory::getApplication();
		$menus = $app->getMenu();
		$title = null;

		// Because the application sets a default page title,
		// we need to get it from the menu item itself
		$menu = $menus->getActive();

		if ($menu)
		{
			$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
		}
		else
		{
			$this->params->def('page_heading', JText::_('COM_CHURCHDIRECTORY_DEFAULT_PAGE_TITLE'));
		}

		$title = $this->params->get('page_title', '');

		if (empty($title))
		{
			$title = $app->get('sitename');
		}
		elseif ($app->get('sitename_pagetitles', 0) == 1)
		{
			$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
		}
		elseif ($app->get('sitename_pagetitles', 0) == 2)
		{
			$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
		}

		$this->document->setTitle($title);

		if ($this->category->metadesc)
		{
			$this->document->setDescription($this->category->metadesc);
		}
		elseif (!$this->category->metadesc && $this->params->get('menu-meta_description'))
		{
			$this->document->setDescription($this->params->get('menu-meta_description'));
		}

		if ($this->category->metakey)
		{
			$this->document->setMetaData('keywords', $this->category->metakey);
		}
		elseif (!$this->category->metakey && $this->params->get('menu-meta_keywords'))
		{
			$this->document->setMetaData('keywords', $this->params->get('menu-meta_keywords'));
		}

		if ($this->params->get('robots'))
		{
			$this->document->setMetaData('robots', $this->params->get('robots'));
		}
	}
开发者ID:Joomla-Bible-Study,项目名称:joomla_churchdirectory,代码行数:66,代码来源:view.html.php

示例3: testTheReturnForGetMetaDataWithCustomParamAndHttpEquivFalseAndDataSet

 /**
  * @testdox  Test the return for getMetaData with a custom param and HTTP-Equiv flag false with data not set to HTTP-Equiv
  */
 public function testTheReturnForGetMetaDataWithCustomParamAndHttpEquivFalseAndDataSet()
 {
     $this->object->setMetaData('myMetaTag', 'myMetaContent');
     $this->assertSame('myMetaContent', $this->object->getMetaData('myMetaTag'));
 }
开发者ID:n3t,项目名称:joomla-cms,代码行数:8,代码来源:JDocumentTest.php

示例4: defined

http://www.yourwebsite.com/index.php?option=com_blastchatc&d=1

Load client with parameters defined in admin backend for BlastChat component, but force to go to room with id
http://www.yourwebsite.com/index.php?option=com_blastchatc&rid=123
**********************************************************************************************************/
/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
/* disable cache */
$cache =& JFactory::getCache();
$cache->setCaching(false);
// make sure it caches
$nowDate = date("D, d M Y H:i:s", time());
JDocument::setMetaData("robots", "noindex, nofollow", true);
JDocument::setMetaData("expires", $nowDate . " GMT");
JDocument::setMetaData("cache-control", "no-store, no-cache, must-revalidate");
JDocument::setMetaData("pragma", "no-store");
/* check - server to server communication for public access
*  keepsession - keep user session active with your website
*  signoff - chatter logout/signoff from chat
*  return null (stop precessing this file)
 */
$bc_task = JRequest::getString('bc_task', null);
if ($bc_task) {
    require_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'api.blastchatc.php';
    switch ($bc_task) {
        case 'updatelist':
            if (file_exists(JPATH_ROOT . DS . 'modules' . DS . 'mod_blastchatc' . DS . 'mod_blastchatc_api.php')) {
                require_once JPATH_ROOT . DS . 'modules' . DS . 'mod_blastchatc' . DS . 'mod_blastchatc_api.php';
            } else {
                echo "BlastChat module dynamic support not available.";
            }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:31,代码来源:blastchatc.php


注:本文中的JDocument::setMetaData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。