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


PHP JDocument::addStyleDeclaration方法代码示例

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


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

示例1: addInlineStyle

	public function addInlineStyle($text, $order = self::DEFAULT_ORDER)
	{
		if (!empty($text)) {
			$this->document->addStyleDeclaration($text);

		}
	}
开发者ID:networksoft,项目名称:networksoft.com.co,代码行数:7,代码来源:RokInjectModule_Header.php

示例2: testAddStyleDeclaration

	/**
	 * Test...
	 *
	 * @covers  JDocument::addStyleDeclaration
	 *
	 * @return void
	 */
	public function testAddStyleDeclaration()
	{
		$this->object = new JDocument;

		$this->object->addStyleDeclaration('My Style');
		$this->assertThat(
			$this->object->_style['text/css'],
			$this->equalTo('My Style'),
			'JDocument->addStyleDeclaration failed'
		);

		$this->object->addStyleDeclaration('My Style', 'my/type');
		$this->assertThat(
			$this->object->_style['my/type'],
			$this->equalTo('My Style'),
			'JDocument->addStyleDeclaration failed'
		);

		$this->object->addStyleDeclaration('My Second Style');
		$this->assertThat(
			$this->object->_style['text/css'],
			$this->equalTo('My Style' . chr(13) . 'My Second Style'),
			'JDocument->addStyleDeclaration failed'
		);
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:32,代码来源:JDocumentTest.php

示例3: populate

 public function populate()
 {
     if (!empty($this->script_files)) {
         ksort($this->script_files);
         foreach ($this->script_files as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $this->document->addScript($entry);
             }
         }
     }
     if (!empty($this->inline_scripts)) {
         ksort($this->inline_scripts);
         foreach ($this->inline_scripts as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $this->document->addScriptDeclaration($entry);
             }
         }
     }
     if (!empty($this->style_files)) {
         ksort($this->style_files);
         foreach ($this->style_files as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $this->document->addStyleSheet($entry);
             }
         }
     }
     if (!empty($this->inline_styles)) {
         ksort($this->inline_styles);
         foreach ($this->inline_styles as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $this->document->addStyleDeclaration($entry);
             }
         }
     }
     // Generate domready script
     if (!empty($this->domready_scripts)) {
         ksort($this->domready_scripts);
         $strHtml = 'window.addEvent(\'domready\', function() {';
         foreach ($this->domready_scripts as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $strHtml .= chr(13) . $entry;
             }
         }
         $strHtml .= chr(13) . '});' . chr(13);
         $this->document->addScriptDeclaration($strHtml);
     }
     if (!empty($this->loadevent_scripts)) {
         ksort($this->loadevent_scripts);
         $strHtml = 'window.addEvent(\'load\', function() {';
         foreach ($this->loadevent_scripts as $order => $order_entries) {
             foreach ($order_entries as $entry_key => $entry) {
                 $strHtml .= chr(13) . $entry;
             }
         }
         $strHtml .= chr(13) . '});' . chr(13);
         $this->document->addScriptDeclaration($strHtml);
     }
     $this->populated = true;
     $this->reset();
 }
开发者ID:TeamCodeStudio,项目名称:fpmoz,代码行数:60,代码来源:Joomla.php

示例4: onMediaEditorButtonLabel

 /**
  * Method to return the button label of this plugin
  *
  * @return string
  *
  * @since  3.7.0
  */
 public function onMediaEditorButtonLabel()
 {
     $this->doc->addStyleDeclaration('.icon-imagecropper:before { content: "\\2a"; }');
     return JText::_('PLG_MEDIA_EDITOR_IMAGECROPPER_BUTTON_LABEL');
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:12,代码来源:imagecropper.php

示例5: addStyleDeclaration

 /**
  * Wrapper for JDocumentHTML::addStyleDeclaration()
  */
 public function addStyleDeclaration($content, $type = 'text/css')
 {
     return $this->document->addStyleDeclaration($content, $type);
 }
开发者ID:andremarceloteixeira,项目名称:relaixamento.com-local,代码行数:7,代码来源:template.php

示例6: testEnsureTwoAddStyleDeclarationCallsReturnsThisObject

 /**
  * @testdox  Test that calling addStyleDeclaration twice returns an instance of $this
  */
 public function testEnsureTwoAddStyleDeclarationCallsReturnsThisObject()
 {
     $this->assertSame($this->object, $this->object->addStyleDeclaration('<style>div { padding: 0; }</style>'));
     $this->assertSame($this->object, $this->object->addStyleDeclaration('<style>h1 { font-size: 4px; }</style>'));
 }
开发者ID:n3t,项目名称:joomla-cms,代码行数:8,代码来源:JDocumentTest.php

示例7: addInlineStyle

 /**
  * @param $text
  */
 public function addInlineStyle($text)
 {
     $this->document->addStyleDeclaration($text);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:7,代码来源:Joomla.php

示例8: getMapCode

 /**
  * @param JDocument $doc
  * @param object $location
  *
  * @return string
  */
 private function getMapCode($doc, $location)
 {
     // Set Google map API key and load the script
     $apiKey = "";
     if ($this->params->get("google_maps_key")) {
         $apiKey = "&amp;key=" . $apiKey;
     }
     $doc->addScript("//maps.googleapis.com/maps/api/js?sensor=false" . $apiKey);
     // Put the JS code that initializes the map.
     $js = '
     function initialize() {
             
         var cfLatlng = new google.maps.LatLng(' . $location->latitude . ', ' . $location->longitude . ');
             
         var map_canvas = document.getElementById("crowdf_map_canvas");
         var map_options = {
           center: cfLatlng,
           disableDefaultUI: true,
           zoom: 8,
           mapTypeId: google.maps.MapTypeId.ROADMAP
         }
         var map = new google.maps.Map(map_canvas, map_options)
                 
         var marker = new google.maps.Marker({
             position: cfLatlng,
             map: map
         });
                 
           
       }
     google.maps.event.addDomListener(window, "load", initialize);
     ';
     $doc->addScriptDeclaration($js);
     // Put the map element style
     $style = '#crowdf_map_canvas {
             width:  ' . $this->params->get("google_maps_width", 300) . 'px;
         height: ' . $this->params->get("google_maps_height", 300) . 'px;
     }';
     $doc->addStyleDeclaration($style);
     // Prepare the HTML code
     $code = '
         <div class="col-md-5">
             <div id="crowdf_map_canvas"></div>
         </div>';
     return $code;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:52,代码来源:crowdfundinginfo.php


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