本文整理汇总了PHP中JS::raw方法的典型用法代码示例。如果您正苦于以下问题:PHP JS::raw方法的具体用法?PHP JS::raw怎么用?PHP JS::raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JS
的用法示例。
在下文中一共展示了JS::raw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Outputs the code and content for the accordion
* @return string
*/
public function render()
{
global $SITE, $CONFIG;
JS::loadjQuery();
JS::raw('$(function() {$(".ui-accordion-container").accordion({ header: "h3" ' . ($this->params ? ',' . $this->params : '') . '});});');
Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
Head::add('.ui-accordion-container li {width: 100%;}', 'css-raw');
$r = '<ol class="ui-accordion-container">';
$mode = 0;
$title = false;
$selected = false;
$i = 0;
foreach ($this->tabs as $arg) {
if ($mode == 0) {
$title = $arg;
$mode = 1;
} else {
$r .= '
<li>
<h3><a href="#">' . $title . '</a></h3>
<div>' . $arg . '</div>
</li>';
$mode = 0;
$selected = false;
$title = false;
$i++;
}
}
return $r . '</ol>';
}
示例2: render
function render()
{
JS::loadjQuery();
JS::lib('viewslider');
JS::raw('$(function(){$("div.viewslider-view").closest(".formdiv").viewslider();});');
Head::add('viewslider/viewslider', 'css-lib');
return '<div class="formsection viewslider-view"><h3>' . $this->header . '</h3>' . implode('', flatten($this->elements)) . '</div>';
}
示例3: render
function render()
{
$id = idfy($this->name);
JS::loadjQuery(false);
JS::lib('imgPicker');
JS::raw('setupPreview("' . $id . '");');
//FIXME: Flytta styling till stylesheet!
return '<span class="formelem">' . ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '" class="text' . ($this->validate ? ' ' . $this->validate : '') . '" value="' . $this->value . '" type="hidden" />' . '<div class="tools">' . icon('small/cross', __('Remove'), "javascript:removePreview('{$id}');", $id . "remicon") . icon('small/folder_picture', __('Browse picture'), "javascript:explore('{$id}', " . ($this->dir ? $this->dir : 'false') . ");") . '</div>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : '') . ($this->preview ? '<div id="' . $id . 'prev" style="margin:10px 0 5px 150px;"><img id="' . $id . 'img" src="index.php?id=' . $this->value . '&mw=300" /></div>' : '') . '</span>';
}
示例4: render
function render()
{
$id = idfy($this->name);
if ($this->multiple) {
JS::loadJQuery(true);
JS::lib('jquery/plugins/localisation/jquery.localisation-min');
JS::lib('jquery/plugins/scrollTo/jquery.scrollTo-min');
JS::lib('jquery/ui.multiselect');
if (!$this->nojs) {
/*FIXME: Translation
JS::raw('$(function(){$.localise("ui-multiselect", {language: "en", path: "lib/js/locale/"});});');
*/
JS::raw('$(function(){$("#' . $id . '").multiselect({' . $this->jsparams . '});});');
}
Head::add('ui.multiselect', 'css-lib');
if ($this->class) {
$this->class .= ' ';
}
$this->class .= 'multiselect';
}
$r = ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<select id="' . $id . '" name="' . $this->name . ($this->multiple ? '[]" multiple="multiple"' : '"') . ' class="' . $this->validate . ($this->validate ? ' ' : '') . $this->class . '">';
if ($this->startEmpty) {
$r .= '<option value="">' . ($this->startEmpty !== true ? $this->startEmpty : '') . '</option>';
}
if (is_array($this->data)) {
foreach ($this->data as $value => $text) {
if (is_array($text)) {
if (isset($text['id'])) {
$r .= $this->inflatedGroup($text);
} else {
$r .= $this->optgroup($value, $text);
}
} else {
if (is_bool($this->selected)) {
$s = $this->selected;
} else {
$match_pos = array_search($value, $this->selected, true);
if (!$match_pos) {
$match_pos = array_search($value, $this->selected);
}
$match = $match_pos === false ? false : $this->selected[$match_pos];
$s = strcmp($match, $value) === 0;
}
$r .= '<option value="' . $value . '"' . ($s ? ' selected="selected"' : '') . '>' . $text . '</option>';
}
}
}
$r .= '</select>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : ($this->multiple ? ' ' : ''));
return '<span class="formelem">' . $r . '</span>';
}
示例5: render
function render()
{
$id = idfy($this->name);
JS::loadjQuery(false);
if ($this->available_values) {
JS::lib('jquery/jquery.bgiframe.min');
JS::lib('jquery/jquery-plugin-ajaxqueue');
JS::lib('jquery/jquery.autocomplete.min');
Head::add('jquery.autocomplete', 'css-lib');
JS::raw('$(function(){$("#' . $id . '").autocomplete(["' . join('","', $this->available_values) . '"], {width: 320,max: 4,highlight: false,multiple: true,multipleSeparator: " ",scroll: true,scrollHeight: 300})});');
}
$r = ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '" class="text tags' . ($this->validate ? ' ' . $this->validate : '') . '" value="' . $this->value . '" />' . ($this->description ? '<span class="description">' . $this->description . '</span>' : '');
return '<span class="formelem">' . $r . '</span>';
}
示例6: render
function render()
{
$id = idfy($this->name);
JS::loadjQuery();
/*
Head::add('3rdParty/tiny_mce/tiny_mce_gzip.js', 'js-url', true, false, false);
*/
/*
Head::add('tinyMCEGZinit', 'js-lib', true, false, false);
*/
//Head::add('3rdParty/tiny_mce/tiny_mce.js', 'js-url', true, false, false);
/*
Head::add('tinyMCEinit', 'js-lib', true, false, false);
*/
//testar ny editor
Head::add('3rdParty/ckeditor/ckeditor.js', 'js-url', false, false);
Head::add('3rdParty/ckeditor/adapters/jquery.js', 'js-url', false, false);
JS::raw('CKEDITOR.replace("' . $id . '",{customConfig : "/3rdParty/ckeditor/config.js"});');
return '<span class="formelem">' . ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<textarea id="' . $id . '" name="' . $this->name . '" class="textarea mceEditor' . ($this->validate ? ' ' . $this->validate : '') . ($this->validate ? ' ' : '') . $this->class . '" rows="8" cols="70">' . $this->value . '</textarea>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : '') . '</span>';
}
示例7: display
/**
* Display all flashes
* @return HTML
*/
static function display()
{
if (isset($_SESSION['__FLASHES']) && is_array($_SESSION['__FLASHES'])) {
self::$__FLASHES = $_SESSION['__FLASHES'] + self::$__FLASHES;
unset($_SESSION['__FLASHES']);
}
if (!empty(self::$__FLASHES)) {
echo '<div class="flash_container">';
foreach (self::$__FLASHES as $type => $flashes) {
echo '<div class="flash flash_type_' . $type . '"><div class="icon"></div><ul>';
foreach ($flashes as $flash) {
echo '<li>' . $flash . '</li>';
}
echo '</ul></div>';
}
//FIXME: Add function for yes/no buttons
echo '</div>';
JS::loadjQuery(true);
JS::raw('$(function(){' . '$(".flash_container").dialog({modal:true,buttons:{Ok:function(){$(this).dialog("close");}}});' . '});');
}
}
示例8: render
/**
* (non-PHPdoc)
* @see solidbase/lib/__FormField#render()
*/
function render()
{
$id = idfy($this->name);
if ($this->value === false) {
$sel = $this->interval;
} else {
$sel = (array) $this->value;
if (count($sel) == 1) {
$sel[1] = $sel[0];
}
}
Head::add(JQUERY_THEME . '/jquery-ui-1.8.7.custom', 'css-lib');
if (!$this->nojs) {
JS::loadjQuery(true);
JS::raw('$(function(){$("#' . $id . ' .slider").slider({' . 'range:' . ($this->return_interval ? 'true' : 'false') . ',' . 'min:' . $this->interval[0] . ',' . 'max:' . $this->interval[1] . ',' . 'values:[' . ($this->return_interval ? $sel[0] . ',' . $sel[1] : $sel[0]) . '],' . 'slide:function(event,ui){' . '$(event.target).closest(".slidercontainer")' . '
.find(".val_low").text(ui.values[0]).end()' . ($this->return_interval ? '
.find(".val_high").text(ui.values[1]).end()' : '') . '
.find(".sliderfield").val(ui.values[0]' . ($this->return_interval ? '+":"+ui.values[1]' : '') . '
);' . '}});});');
}
JS::raw('$(".sliderfield").hide();');
return '<span class="formelem"><div id="' . $id . '" class="slidercontainer">' . ($this->label === false ? '' : '<label for="' . $id . '">' . $this->label . '</label>') . '<input name="' . $this->name . '" id="' . $id . '_value" class="sliderfield' . ($this->validate ? ' ' . $this->validate : '') . ($this->class ? ' ' . $this->class : '') . '" value="' . ($this->return_interval ? $sel[0] . ":" . $sel[1] : $sel[0]) . '" />' . '<div class="slidervalues">' . '<span class="slidertext val_low">' . $sel[0] . '</span>' . ($this->return_interval ? '<span class="slidertext sliderdash">-</span><span class="slidertext val_high">' . $sel[1] . '</span>' : '') . '</div>' . '<div class="slider"></div>' . (strpos($this->validate, 'required') !== false ? '<span class="reqstar">*</span>' : '') . ($this->description ? '<span class="description">' . $this->description . '</span>' : '') . '</div></span>';
}
示例9: viewAds
function viewAds()
{
//FIXME:Move setting to CompanyEditor
$slider = true;
$cycletime = 5000;
$r = '';
$ms = self::sortedList('main');
$s = self::sortedList('sub');
if ($ms) {
$r .= '<div class="col first four company"><h2>' . __('Main sponsors') . '</h2>' . $ms . '</div>';
}
if ($s) {
$r .= '<div class="col first four company"><h2>' . __('Sponsors') . '</h2>' . $s . '</div>';
}
if ($slider) {
JS::lib('jquery/jquery.cycle.all.min');
JS::raw('$(function(){
$(".companies_sub").css({height:"230px"}).children("li").css({top:0,left:0,position:"fixed"});
$(".companies_sub").cycle({fx:"scrollHorz",timeout:' . $cycletime . '});
});');
}
return $r;
}
示例10: render
/**
* Renders the HTML and loads the libraries needed to view the tabs
* @return void
*/
public function render()
{
global $SITE, $CONFIG;
static $tabnames = array();
JS::loadjQuery();
JS::raw('$(function() {$(".ui-tabs-dohide").addClass("ui-tabs-hide");$(".ui-tabs").tabs({show:function(event,ui){
id = $(ui.tab.hash).attr("id");
obj = $(ui.tab.hash).attr("id", ""); //So the browser doesnt jump to the object
window.location.hash=ui.tab.hash;
obj.attr("id", id);
}});
//if(window.location.hash) {
//$(window.location.hash).parent(".ui-tabs").tabs("select", document.location.hash);
//}
});');
Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
$r = '<div class="ui-tabs"><ul class="ui-tabs-nav">';
foreach ($this->tabs as $id => $tab) {
$a = $tab->id;
$i = 0;
while (in_array($a, $tabnames)) {
$i++;
$a = $tab->id . $i;
}
$tabnames[] = $tab->id = $a;
$classes = implode(' ', array_filter(array($tab->selected ? 'ui-tabs-selected' : false, $tab->disabled ? 'ui-tabs-disabled' : false)));
$r .= '<li class="' . $classes . '">' . '<a href="#tab' . $this->uniqid . (!is_numeric($id) ? $id : ($tab->id ? $tab->id : $id)) . '"><span>' . $tab->name . '</span></a></li>';
}
$r .= '</ul>';
foreach ($this->tabs as $id => $tab) {
$id = $this->uniqid . (!is_numeric($id) ? $id : ($tab->id ? $tab->id : $id));
$r .= '<div id="tab' . $id . '" class="ui-tabs-panel' . (!$tab->selected ? ' ui-tabs-dohide' : '') . '">' . str_replace('#::tab-id::#', 'tab' . $id, $tab->render()) . '</div>';
}
return $r . '</div>';
}
示例11: Box
</div>
<?php
new Box('feedback');
/* $Controller->newObj('Report')->setAlias('Report'); */
?>
<?php
JS::loadjQuery(false);
JS::lib('jquery/jquery.keynav.1.1');
JS::lib('globalsearch');
/* JS::lib('jquery/jquery.backgroundPosition'); */
JS::lib('jquery/jquery.lavalamp-1.3.4b2');
JS::lib('jquery/jquery.easing.1.3');
/* Head::add('$(document).ready(function() { $("#username").focus();});','js-raw'); */
/*
JS::raw('
$(".topnav li a, .topnav div.admin a")
.css({backgroundPosition:"0 -50px"})
.mouseover(function() {
$(this).stop(true)
.animate({backgroundPosition:"0 0"},"fast")
})
.mouseout(function() {
$(this).stop(true)
.animate({backgroundPosition:"0 -50px"},"fast")
});
');
*/
JS::raw('$(function(){ $(".topnav ul.menu").lavaLamp({speed:300}); });');
示例12: collection
/**
* Creates the form for outputting
* Usage example
* <code>
* $form = new Form('uploadToFolder', url(null, 'id'));
* return $form->collection(
* new Fieldset(__('Select files'),
* new FileUpload(__('File to upload'), 'uFiles[]'),
* new CheckBox(__('Uncompress compressed files'), 'uncompress', false)
* ),
* new Fieldset(__('Select another file'),
* new FileUpload(__('File to upload'), 'uFiles[]'),
* new CheckBox(__('Uncompress compressed files'), 'uncompress', false)
* )
* );
* </code>
* @param The objects that make up the form
* @return string
*/
public function collection()
{
$args = func_get_args();
$args = $this->__flatten($args);
$rt = '';
foreach ($args as $arg) {
if (is_object($arg) && method_exists($arg, 'render')) {
$rt .= $arg->render();
} elseif (is_string($arg)) {
$rt .= $arg;
}
}
$r = '<form action="' . (empty($this->action) ? url(false, true) : (is_array($this->action) ? url($this->action) : $this->action)) . '" method="' . $this->method . '"' . (stripos($rt, 'type="file"') !== false ? ' enctype="multipart/form-data"' : '');
if (!$this->id) {
$r .= '>';
} else {
$r .= ' id="' . $this->id . '"><div style="display: none;"><input type="hidden" value="' . time() . '" name="' . $this->id . '" /></div>';
}
$r .= '<div class="formdiv">' . $rt . '</div>';
if ($this->submittext !== false) {
$r .= '<div class="submit">' . new Submit($this->submittext ? $this->submittext : __('Submit')) . '</div>';
}
$r .= '</form>';
if ($this->validate) {
JS::lib('jquery/jquery-validate/jquery.validate.min');
JS::raw('$(function(){$("#' . $this->id . '").validate();});');
}
return $r;
}
示例13: internal
function internal($title, $image, $alt = '', $youtube = false, $youtubetext = false, $comment = false)
{
if (!$youtubetext) {
$youtubetext = 'Dagens videolänk';
}
if (is_array($image)) {
JS::loadjQuery();
JS::lib('jquery/jquery.cycle.all.2.72');
JS::raw("\$('.images').cycle({fx:'fade'});");
} else {
$image = array($image);
}
Head::add('h1 {font-size: 3em; color: #000;} div {text-align: center;} .images {position: relative; left: 600px; margin: 0 0 0 -525px; width: 600px;} .youtube {font-size: 2em;} .wrapper {border: 10px solid red;}', 'css-raw');
$r = '';
if ($title) {
$r .= '<h1>' . $title . '</h1>';
}
$r .= '<div class="images">';
foreach ($image as $img) {
if ($img[0] == '<') {
$r .= $img;
} else {
$r .= '<img src="' . $img . '" alt="' . $alt . '" title="' . $alt . '" />';
}
}
$r .= '</div>';
if ($comment) {
$r .= '<div class="comment">' . nl2br($comment) . '</div>';
}
if ($youtube) {
$youtube = (array) $youtube;
$youtubetext = (array) $youtubetext;
foreach ($youtube as $i => $yt) {
if (isset($youtubetext[$i])) {
$r .= '<div class="youtube"><a href="' . $yt . '" target="_blank">' . $youtubetext[$i] . '</a></div>';
}
}
}
$this->setContent('main', $r);
}
示例14: feedback
function feedback()
{
global $USER, $PAGE;
$feedbackForm = new Form('feedbackform', '/Report', __('Send'), 'post', false);
echo '
<div class="help_div">
<div class="help_content">' . ($USER->ID == NOBODY ? '<div class="disable"><h1>' . __('You must be logged in to send feedback') . '</h1><p style="text-align:center"><a href="javascript:;" class="linkbutton" onclick="feedbackLogin();">' . __('Login') . '</a></p></div>' : '') . '
<div class="report_content">
<h2>' . __('Report an error') . '</h2>' . $feedbackForm->collection(new RadioSet('Feedback type', 'feedback', array('error' => __('Bug'), 'suggestion' => __('Other feedback')), false, 1), new TextArea(__('Description'), 'description', '', false, false, false, 20, 25)) . '<p style="margin-top:15px;">' . __('Here you can report any bugs you come across. Please include as much information as possible.') . '</p>
</div>
</div>
<div id="btn_report"><h1><nobr>' . __('REPORT BUG') . '</nobr></h1></div>
</div>';
$ajaxReport = true;
JS::raw('
$("#btn_report").click(
function() {
$(this).siblings(".help_content")
.stop(true)
.animate({width:"toggle"},"fast");
}
);
$("#feedbackform").submit(
function () {
if($("#feedbackform input[name=feedback]:checked").length != 1){
alert("' . __('You have to choose a feedback type') . '");
return(false);
} else if($("#feedbackform textarea").val() == ""){
alert("' . __('Please describe the problem before sending') . '");
return(false);
} else if(' . (int) (bool) $ajaxReport . '){
$.post("/Report", $("#feedbackform").serialize(),
function(data){
if(data.length > 0){
alert(data);
}
}
);
$("#btn_report").siblings(".help_content").stop(true).animate({width:"toggle"},"fast");
$("#feedbackform")[0].reset();
return(false);
}
}
);
function feedbackLogin() {
$("#btn_report").siblings(".help_content").stop(true).animate({width:"toggle"},"fast","linear",
function(){
$("#login2 .login_help .content_help:hidden")
.stop(true)
.slideToggle("fast");
$("#username").focus();
}
)
};
');
}
示例15:
<?php
JS::raw("var switchTo5x=true;");
JS::require_script("http://w.sharethis.com/button/buttons.js");
JS::raw("stLight.options({publisher: \"32c5799c-98c2-477f-8411-33138c29989c\"});");
?>
<span class='st_sharethis_large' displayText='ShareThis'></span>
<span class='st_facebook_large' displayText='Facebook'></span>
<span class='st_twitter_large' displayText='Tweet'></span>
<span class='st_linkedin_large' displayText='LinkedIn'></span>
<span class='st_email_large' displayText='Email'></span>