本文整理汇总了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);
}
}
示例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'
);
}
示例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();
}
示例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');
}
示例5: addStyleDeclaration
/**
* Wrapper for JDocumentHTML::addStyleDeclaration()
*/
public function addStyleDeclaration($content, $type = 'text/css')
{
return $this->document->addStyleDeclaration($content, $type);
}
示例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>'));
}
示例7: addInlineStyle
/**
* @param $text
*/
public function addInlineStyle($text)
{
$this->document->addStyleDeclaration($text);
}
示例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 = "&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;
}