本文整理汇总了PHP中Skin::define_img_href方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::define_img_href方法的具体用法?PHP Skin::define_img_href怎么用?PHP Skin::define_img_href使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::define_img_href方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* build a unfolded box
*
* Based on DHTML and DOM. The Javascript [code]toggle_folder()[/code] code
* is inserted at the bottom of the page in [script]shared/global.php[/script]
*
* @link http://www.dddekerf.dds.nl/DHTML_Treeview/DHTML_Treeview.htm Easy DHTML TreeView
*
* @param string the box title, if any
* @param string the box content
* @param string an optional unique id for this box
* @return the HTML to display
*
* @see articles/edit.php
* @see sections/edit.php
* @see users/edit.php
*/
public static function &build_unfolded_box($title, &$content, $id = '')
{
global $context;
// the icon used to stretch folder divisions
Skin::define_img_href('FOLDER_EXTEND_IMG_HREF', 'layouts/folder_plus.gif');
// the icon used to pack folder divisions
Skin::define_img_href('FOLDER_PACK_IMG_HREF', 'layouts/folder_minus.gif');
// we need a clickable title
if (!$title) {
$title = i18n::s('Click to slide');
}
if ($id) {
$id = ' id="' . $id . '"';
}
// maybe we have an image to enhance rendering
$img = '';
if (FOLDER_PACK_IMG_HREF) {
$img = '<img src="' . FOLDER_PACK_IMG_HREF . '" alt="" title="' . encode_field(i18n::s('Click to slide')) . '" />';
}
// Yacs.toggle_folder() is in shared/yacs.js
$text = '<div class="folder_box"' . $id . '><a href="#" class="folder_header" onclick="javascript:Yacs.toggle_folder(this, \'' . FOLDER_EXTEND_IMG_HREF . '\', \'' . FOLDER_PACK_IMG_HREF . '\'); return false;">' . $img . $title . '</a>' . '<div class="folder_body" style="display: block"><div>' . $content . "</div></div></div>\n";
// pass by reference
return $text;
}
示例2: render_embed
/**
* embed an interactive object
*
* The id designates the target file.
* It can also include width and height of the target canvas, as in: '12, 100%, 250px'
*
* @param string id of the target file
* @return string the rendered string
**/
public static function render_embed($id)
{
global $context;
// split parameters
$attributes = preg_split("/\\s*,\\s*/", $id, 4);
$id = $attributes[0];
// get the file
if (!($item = Files::get($id))) {
$output = '[embed=' . $id . ']';
return $output;
}
// stream in a separate page
if (isset($attributes[1]) && preg_match('/window/i', $attributes[1])) {
if (!isset($attributes[2])) {
$attributes[2] = i18n::s('Play in a separate window');
}
$output = '<a href="' . $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'stream', $item['file_name']) . '" onclick="window.open(this.href); return false;" class="button"><span>' . $attributes[2] . '</span></a>';
return $output;
}
// file extension
$extension = strtolower(substr($item['file_name'], -3));
// set a default size
if (!isset($attributes[1])) {
if (!strcmp($extension, 'gan')) {
$attributes[1] = '98%';
} elseif (!strcmp($extension, 'mm') && isset($context['skins_freemind_canvas_width'])) {
$attributes[1] = $context['skins_freemind_canvas_width'];
} else {
$attributes[1] = 480;
}
}
if (!isset($attributes[2])) {
if (!strcmp($extension, 'gan')) {
$attributes[2] = '300px';
} elseif (!strcmp($extension, 'mm') && isset($context['skins_freemind_canvas_height'])) {
$attributes[2] = $context['skins_freemind_canvas_height'];
} else {
$attributes[2] = 360;
}
}
// object attributes
$width = $attributes[1];
$height = $attributes[2];
$flashvars = '';
if (isset($attributes[3])) {
$flashvars = $attributes[3];
}
// rendering depends on file extension
switch ($extension) {
// stream a video
case '3gp':
case 'flv':
case 'm4v':
case 'mov':
case 'mp4':
// a flash player to stream a flash video
$flvplayer_url = $context['url_to_home'] . $context['url_to_root'] . 'included/browser/player_flv_maxi.swf';
// file is elsewhere
if (isset($item['file_href']) && $item['file_href']) {
$url = $item['file_href'];
} else {
$url = $context['url_to_home'] . $context['url_to_root'] . Files::get_url($item['id'], 'fetch', $item['file_name']);
}
// pass parameters to the player
if ($flashvars) {
$flashvars = str_replace('autostart=true', 'autoplay=1', $flashvars) . '&';
}
$flashvars .= 'width=' . $width . '&height=' . $height;
// if there is a static image for this video, use it
if (isset($item['icon_url']) && $item['icon_url']) {
$flashvars .= '&startimage=' . urlencode($item['icon_url']);
}
// if there is a subtitle file for this video, use it
if (isset($item['file_name']) && ($srt = 'files/' . str_replace(':', '/', $item['anchor']) . '/' . str_replace('.' . $extension, '.srt', $item['file_name'])) && file_exists($context['path_to_root'] . $srt)) {
$flashvars .= '&srt=1&srturl=' . urlencode($context['url_to_home'] . $context['url_to_root'] . $srt);
}
// if there is a logo file in the skin, use it
Skin::define_img_href('FLV_IMG_HREF', 'codes/flvplayer_logo.png', '');
if (FLV_IMG_HREF) {
$flashvars .= '&top1=' . urlencode(FLV_IMG_HREF . '|10|10');
}
// rely on Flash
if (Surfer::has_flash()) {
// the full object is built in Javascript --see parameters at http://flv-player.net/players/maxi/documentation/
$output = '<div id="flv_' . $item['id'] . '" class="no_print">Flash plugin or Javascript are turned off. Activate both and reload to view the object</div>' . "\n";
Page::insert_script('var flashvars = { flv:"' . $url . '", ' . str_replace(array('&', '='), array('", ', ':"'), $flashvars) . '", autoload:0, margin:1, showiconplay:1, playeralpha:50, iconplaybgalpha:30, showfullscreen:1, showloading:"always", ondoubleclick:"fullscreen" }' . "\n" . 'var params = { allowfullscreen: "true", allowscriptaccess: "always" }' . "\n" . 'var attributes = { id: "file_' . $item['id'] . '", name: "file_' . $item['id'] . '"}' . "\n" . 'swfobject.embedSWF("' . $flvplayer_url . '", "flv_' . $item['id'] . '", "' . $width . '", "' . $height . '", "9", "' . $context['url_to_home'] . $context['url_to_root'] . 'included/browser/expressinstall.swf", flashvars, params);' . "\n");
// native support
} else {
// <video> is HTML5, <object> is legacy
$output = '<video width="' . $width . '" height="' . $height . '" autoplay="" controls="" src="' . $url . '" >' . "\n" . ' <object width="' . $width . '" height="' . $height . '" data="' . $url . '" type="' . Files::get_mime_type($item['file_name']) . '">' . "\n" . ' <param value="' . $url . '" name="movie" />' . "\n" . ' <param value="true" name="allowFullScreen" />' . "\n" . ' <param value="always" name="allowscriptaccess" />' . "\n" . ' <a href="' . $url . '">No video playback capabilities, please download the file</a>' . "\n" . ' </object>' . "\n" . '</video>' . "\n";
}
//.........这里部分代码省略.........
示例3: build_accordion_box
/**
* build a box part of one accordion
*
* @param string the box title, if any
* @param string the box content
* @param string the accordion id, used as CSS class
* @return the HTML to display
*/
function build_accordion_box($title, $content, $id)
{
global $context;
// we need a clickable title
if (!$title) {
$title = i18n::s('Click to slide');
}
// maybe we have an image to enhance rendering
$img = '';
// the icon to close accordion boxes
Skin::define_img_href('ACCORDION_CLOSE_IMG_HREF', 'layouts/accordion_minus.jpg');
// the icon to open accordion boxes
Skin::define_img_href('ACCORDION_OPEN_IMG_HREF', 'layouts/accordion_plus.jpg');
// detect first box of the accordion
static $fused;
if (!isset($fused)) {
$fused = array();
}
$more_class = '';
// first box is always open
if (!isset($fused[$id])) {
$style = '';
if (ACCORDION_CLOSE_IMG_HREF) {
$img = '<img src="' . ACCORDION_CLOSE_IMG_HREF . '" alt="" title="' . encode_field(i18n::s('Click to slide')) . '" class="handle" />';
}
// close following boxes
$fused[$id] = TRUE;
// help css
$more_class = ' accordion-open';
// following boxes are closed
} else {
$style = ' style="display: none"';
if (ACCORDION_OPEN_IMG_HREF) {
$img = '<img src="' . ACCORDION_OPEN_IMG_HREF . '" alt="" title="' . encode_field(i18n::s('Click to slide')) . '" class="handle" />';
}
}
// Yacs.toggle_folder() is in shared/yacs.js -- div.accordion_content div is required for slide effect to work
$text = '<div class="accordion_handle ' . $id . '"><div class="accordion_link' . $more_class . '" onclick="javascript:accordion.toggle(this, \'' . ACCORDION_OPEN_IMG_HREF . '\', \'' . ACCORDION_CLOSE_IMG_HREF . '\', \'' . $id . '\');">' . $img . $title . '</div>' . '<div class="accordion_content' . $more_class . '"' . $style . '><div>' . $content . "</div></div></div>\n";
// pass by reference
return $text;
}