本文整理汇总了PHP中eval_js函数的典型用法代码示例。如果您正苦于以下问题:PHP eval_js函数的具体用法?PHP eval_js怎么用?PHP eval_js使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eval_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: body
public function body($params2 = array(), $def_account_id = null)
{
$accounts = Utils_RecordBrowserCommon::get_records('rc_accounts', array('epesi_user' => Acl::get_user()));
$def = null;
$user_def = null;
$def_id = $this->get_module_variable('default', $def_account_id);
foreach ($accounts as $a) {
if ($def === null) {
$def = $a;
}
if ($a['default_account']) {
$user_def = $a;
}
if ($def_id === null && $a['default_account']) {
$def = $a;
break;
} elseif ($a['id'] == $def_id) {
$def = $a;
break;
}
}
foreach ($accounts as $a) {
Base_ActionBarCommon::add('add', $a == $def ? '<b><u>' . $a['account_name'] . '</u></b>' : $a['account_name'], $this->create_callback_href(array($this, 'account'), $a['id']), $a['email'], $a == $user_def ? -1 : 0);
}
if ($def === null) {
print '<h1><a ' . $this->create_callback_href(array($this, 'push_settings'), array(__('E-mail Accounts'))) . '>Please set your e-mail account</a></h1>';
return;
}
$params = array('_autologin_id' => $def['id']) + $params2;
// if($params2) $params['_url'] = http_build_query($params2);
print '<div style="background:transparent url(images/loader-0.gif) no-repeat 50% 50%;"><iframe style="border:0" border="0" src="modules/CRM/Roundcube/RC/index.php?' . http_build_query($params) . '" width="100%" height="300px" id="rc_frame"></iframe></div>';
eval_js('var dim=document.viewport.getDimensions();var rc=$("rc_frame");rc.style.height=(Math.max(dim.height,document.documentElement.clientHeight)-130)+"px";');
}
示例2: body
public function body()
{
$t = $this->pack_module('Base/Theme');
//caption
$box_module = ModuleManager::get_instance('/Base_Box|0');
if ($box_module) {
$active_module = $box_module->get_main_module();
}
if ($active_module && is_callable(array($active_module, 'caption'))) {
$caption = $active_module->caption();
if (Variable::get('show_module_indicator')) {
$t->assign('text', $caption);
} else {
$t->assign('text', '');
}
$show_caption = Variable::get('show_caption_in_title');
$maintenance_mode = MaintenanceMode::is_on() ? ' (Maintenance mode)' : '';
$base_title = Variable::get('base_page_title') . $maintenance_mode;
if ($show_caption || strlen($base_title) > 0) {
if ($show_caption && strlen($base_title) > 0) {
$caption = $base_title . ' - ' . $caption;
} elseif (strlen($base_title) > 0) {
$caption = $base_title;
}
eval_js('document.title=\'' . addslashes($caption) . '\'');
}
} else {
$t->assign('text', '');
eval_js('document.title=\'' . addslashes(Variable::get('base_page_title')) . '\'');
}
$t->display();
}
示例3: autohide_fields
public static function autohide_fields($field, $field_type, $hide_mapping)
{
$allowed_modes = array('hide', 'show');
$groups = array();
foreach ($hide_mapping as $map) {
if (!isset($map['fields']) || !isset($map['values'])) {
continue;
}
$map['mode'] = isset($map['mode']) ? $map['mode'] : reset($allowed_modes);
if (!in_array($map['mode'], $allowed_modes)) {
continue;
}
$map['fields'] = is_array($map['fields']) ? $map['fields'] : array($map['fields']);
$map['fields'] = array_map(function ($f) {
return "#{$f}, #_{$f}__data";
}, $map['fields']);
$map['fields'] = implode(', ', $map['fields']);
$map['values'] = is_array($map['values']) ? $map['values'] : array($map['values']);
$map['values'] = array_map(function ($v) {
if (is_bool($v)) {
$v = intval($v);
}
return strval($v);
}, $map['values']);
$groups[] = $map;
}
if (empty($groups)) {
return;
}
load_js('modules/Libs/QuickForm/autohide_fields.js');
$js_groups = json_encode($groups);
eval_js("\n\t\t\t\tjq(function(){\n\t\t\t\t\tvar hide_ctrl = jq('#{$field}');\n\t\t\t\t\tLibs_QuickForm__hide_groups['{$field}']={$js_groups};\n\t\t\t\t\thide_ctrl.change(Libs_QuickForm__autohide).trigger('change');\n\t\t\t\t});");
}
示例4: toHtml
function toHtml() {
if(count($this->_cd)>1) {
load_js('modules/Utils/CommonData/qf.js');
$id=$this->getAttribute('id');
if(!isset($id)) {
$id = $this->getName();
$this->updateAttributes(array('id'=>$id));
}
$val = $this->getValue();
$val = $val[0];
if($this->_flagFrozen) {
eval_js('new Utils_CommonData_freeze(\''.Epesi::escapeJS($id,false).'\', \''.Epesi::escapeJS(json_encode($this->_cd),false).'\')');
$html = '<span id="'.$id.'_label"> </span>';
$name = $this->getPrivateName();
// Only use id attribute if doing single hidden input
$html .= '<input' . $this->_getAttrString(array(
'type' => 'hidden',
'name' => $name,
'value' => $val,
'id' => $id
)) . ' />';
return $html;
}
eval_js('new Utils_CommonData(\''.Epesi::escapeJS($id,false).'\', \''.Epesi::escapeJS($val,false).'\', \''.Epesi::escapeJS(json_encode($this->_cd),false).'\', '.($this->_add_empty_fields?1:0).')');
}
return parent::toHtml();
}
示例5: toHtml
function toHtml()
{
$str = "";
if ($this->_flagFrozen) {
$str .= $this->getFrozenHtml();
} else {
$value = $this->getAttribute('value');
if (is_numeric($value)) {
$value = date('Y-m-d', $value);
}
$id = $this->getAttribute('id');
$name = $this->getAttribute('name');
if ($value) {
$this->setAttribute('value', Base_RegionalSettingsCommon::time2reg($value, false, true, false));
}
if (!isset($id)) {
$id = 'datepicker_field_' . $name;
$this->updateAttributes(array('id' => $id));
}
$ex_date = Base_RegionalSettingsCommon::time2reg(null, false, true, false);
$date_format = Base_RegionalSettingsCommon::date_format();
$this->setType('text');
if (!$this->getAttribute('placeholder')) {
$this->setAttribute('placeholder', __('Click to select date'));
}
$js = Utils_PopupCalendarCommon::create_href(md5($id), 'new Ajax.Request(\'modules/Utils/PopupCalendar/up.php\',' . '{method:\'post\', parameters:{date: __YEAR__+\'-\'+__MONTH__+\'-\'+__DAY__},' . 'onSuccess:function(t){e=$(\'' . Epesi::escapeJS($id, false) . '\');if(e) {e.value=t.responseText;jq(e).change();}}})', null, null, 'popup.clonePosition(\'' . $id . '\',{setWidth:false,setHeight:false,offsetTop:$(\'' . $id . '\').getHeight()})', $value, $id);
$str .= $this->_getTabs() . '<input ' . $js . ' ' . $this->_getAttrString($this->_attributes) . ' ' . Utils_TooltipCommon::open_tag_attrs(__('Example date: %s', array($ex_date)), false) . ' />';
eval_js('Event.observe(\'' . $id . '\',\'keypress\',Utils_PopupCalendarDatePicker.validate.bindAsEventListener(Utils_PopupCalendarDatePicker,\'' . Epesi::escapeJS($date_format, false) . '\'))');
eval_js('Event.observe(\'' . $id . '\',\'blur\',Utils_PopupCalendarDatePicker.validate_blur.bindAsEventListener(Utils_PopupCalendarDatePicker,\'' . Epesi::escapeJS($date_format, false) . '\'))');
}
return $str;
}
示例6: open
public static function open($group, $params = array())
{
Libs_LeightboxCommon::open($group . '_prompt_leightbox');
if (!empty($params)) {
eval_js('f' . $group . '_set_params(\'' . implode('\',\'', $params) . '\');');
}
}
示例7: submit_admin
public function submit_admin($data)
{
Variable::set('default_theme', $data['theme']);
Base_ThemeCommon::create_cache();
Base_StatusBarCommon::message('Theme changed - reloading page');
eval_js('setTimeout(\'document.location=\\\'index.php\\\'\',\'3000\')');
return true;
}
示例8: add
public static function add($keys, $func, $opts = array())
{
if (isset($_REQUEST['__location']) && self::$clean !== $_REQUEST['__location'] || self::$clean === false) {
self::$clean = isset($_REQUEST['__location']) ? $_REQUEST['__location'] : true;
eval_js('shortcut.remove_all();');
}
$js = 'shortcut.add("' . implode('+', $keys) . '",' . $func . ',{';
$js .= '\'type\':\'' . (isset($opts['type']) ? $opts['type'] : 'keydown') . '\',';
$js .= '\'propagate\':' . (isset($opts['propagate']) ? $opts['propagate'] : 'false') . ',';
$js .= '\'disable_in_input\':' . (isset($opts['disable_in_input']) ? $opts['disable_in_input'] : 'false') . ',';
$js .= '\'target\':' . (isset($opts['target']) ? $opts['target'] : 'document');
$js .= '});';
eval_js($js);
}
示例9: create_href
public static function create_href($name, $function = '', $mode = null, $first_day_of_week = null, $pos_js = null, $default = null, $id = null)
{
Base_ThemeCommon::load_css('Utils_PopupCalendar');
load_js('modules/Utils/PopupCalendar/js/main2.js');
load_js('modules/Utils/PopupCalendar/datepicker.js');
if (!isset($mode)) {
$mode = 'day';
}
if (!isset($first_day_of_week)) {
if (Acl::is_user()) {
$first_day_of_week = self::get_first_day_of_week();
} else {
$first_day_of_week = 0;
}
} elseif (!is_numeric($first_day_of_week)) {
trigger_error('Invalid first day of week', E_USER_ERROR);
}
$calendar = '<div id="Utils_PopupCalendar">' . '<table cellspacing="0" cellpadding="0" border="0"><tr><td id="datepicker_' . $name . '_header">error</td></tr>' . '<tr><td id="datepicker_' . $name . '_view">calendar not loaded</td></tr></table></div>';
$entry = 'datepicker_' . $name . '_calendar';
$butt = $id === null ? 'datepicker_' . $name . '_button' : $id;
$smarty = Base_ThemeCommon::init_smarty();
$smarty->assign('calendar', $calendar);
ob_start();
Base_ThemeCommon::display_smarty($smarty, 'Utils_PopupCalendar');
$cal_out = ob_get_clean();
print '<div id="' . $entry . '" class="utils_popupcalendar_popup" style="display:none;z-index:2050;width:1px;">' . $cal_out . '</div>';
if (!isset($pos_js)) {
$pos_js = 'popup.clonePosition(\'' . $butt . '\',{setWidth:false,setHeight:false,offsetTop:$(\'' . $butt . '\').getHeight()});';
}
eval_js('if(Epesi.ie)$(\'' . $entry . '\').style.position="fixed";else $(\'' . $entry . '\').absolutize();');
$ret = 'onClick="var popup=$(\'' . $entry . '\');' . $pos_js . ';$(\'' . $entry . '\').toggle()" href="javascript:void(0)" id="' . $butt . '"';
$function .= ';$(\'' . $entry . '\').hide()';
if ($default) {
if (!is_numeric($default)) {
$default = strtotime($default);
}
$args = date('Y', $default) . ',' . (date('n', $default) - 1) . ',' . date('d', $default);
} else {
$args = '';
}
$js = 'var datepicker_' . $name . ' = new Utils_PopupCalendar("' . Epesi::escapeJS($function, true, false) . '", \'' . $name . '\',\'' . $mode . '\',\'' . $first_day_of_week . '\',';
$months = array(__('January'), __('February'), __('March'), __('April'), __('May'), __('June'), __('July'), __('August'), __('September'), __('October'), __('November'), __('December'));
$days = array(__('Sun'), __('Mon'), __('Tue'), __('Wed'), __('Thu'), __('Fri'), __('Sat'));
$js .= 'new Array(\'' . implode('\',\'', $months) . '\'),';
$js .= 'new Array(\'' . implode('\',\'', $days) . '\')';
$js .= ');' . 'datepicker_' . $name . '.show(' . $args . ')';
eval_js($js);
// eval_js('$(\''.$entry.'\').absolutize();');
return $ret;
}
示例10: body
public function body()
{
load_js('modules/Base/Help/js/canvasutilities.js');
load_js('modules/Base/Help/js/main.js');
eval_js('Helper.stop_tutorial_message = "' . Epesi::escapeJS('Tutorial was stopped') . '";');
eval_js('setTimeout("Helper.get_all_help_hooks();", 500);');
$theme = $this->init_module('Base_Theme');
$theme->assign('href', 'href="javascript:void(0);" onclick="Helper.menu()"');
$theme->assign('search_placeholder', __('Start typing to search help topics'));
$theme->assign('label', __('Help'));
Utils_ShortcutCommon::add(array('esc'), 'function(){Helper.escape();}');
Utils_ShortcutCommon::add(array('f1'), 'function(){Helper.menu();}');
$theme->display();
}
示例11: generate_query_builder
protected function generate_query_builder()
{
$this->load_libs();
$this->init_form();
$this->options['filters'] = $this->filters;
if ($this->plugins) {
$this->options['plugins'] = $this->plugins;
}
$options_json = json_encode($this->options);
$rules_json = $this->rules ? json_encode($this->rules) : json_encode(self::$empty_rules);
$error_msg = __('Please fix query builder rules');
$error_msg = json_encode($error_msg);
eval_js("Utils_QueryBuilder('{$this->form->get_name()}', '{$this->form_element_id}', '{$this->instance_id}', {$options_json}, {$rules_json}, {$error_msg});");
}
示例12: applet
public function applet($values, &$opts)
{
//available applet options: toggle,href,title,go,go_function,go_arguments,go_contruct_arguments
Base_ThemeCommon::load_css('Applets_Weather');
$opts['title'] = __('Weather');
$rssfeed = $values['rssfeed'] . '?p=' . $values['zipcode'] . '&u=' . $values['temperature'];
$name = md5($this->get_path() . $rssfeed);
//div for updating
print '<div id="Applets_Weather"><div id="rssfeed_' . $name . '"><span>' . __('Loading Weather...') . '</span></div></div>';
//interval execution
eval_js_once('var rssfeedcache = Array();' . 'rssfeedfunc = function(name,fee,num,cache){' . 'if(!$(\'rssfeed_\'+name)) return;' . 'if(cache && typeof rssfeedcache[name] != \'undefined\')' . '$(\'rssfeed_\'+name).innerHTML = rssfeedcache[name];' . 'else ' . 'new Ajax.Updater(\'rssfeed_\'+name,\'modules/Applets/Weather/refresh.php\',{' . 'method:\'post\',' . 'onComplete:function(r){rssfeedcache[name]=r.responseText},' . 'parameters:{feed:fee, number:num, cid: Epesi.client_id}});' . '}');
eval_js_once('setInterval(\'rssfeedfunc(\\\'' . $name . '\\\',\\\'' . Epesi::escapeJS($rssfeed, false) . '\\\' , 2 , 0)\',1799993)');
//29 minutes and 53 seconds
//get rss now!
eval_js('rssfeedfunc(\'' . $name . '\',\'' . Epesi::escapeJS($rssfeed, false) . '\' , 2 , 1)');
}
示例13: body
public function body($skin, $size = 200)
{
print '<center' . ($skin == 'chunkySwissOnBlack' ? ' style="background-color:black; color:white;"' : '') . '>';
$browser = stripos($_SERVER['HTTP_USER_AGENT'], 'msie');
if ($browser !== false || $skin == 'flash') {
$size *= 2;
//clock taken from http://www.kirupa.com/developer/actionscript/clock.htm
$clock = $this->get_module_dir() . 'clock.swf';
print '<center><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="' . $size . '" width="' . $size . '">' . '<param name="movie" value="' . $clock . '">' . '<param name="quality" value="high">' . '<param name="wmode" value="transparent">' . '<param name="menu" value="false">' . '<embed src="' . $clock . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" height="' . $size . '" width="' . $size . '">' . '</object></center>';
} else {
load_js($this->get_module_dir() . 'coolclock.js');
eval_js('CoolClock.findAndCreateClocks()');
print '<canvas id="' . $this->get_path() . 'canvas" class="CoolClock:' . $skin . ':' . $size . '"></canvas>';
}
print '<BR>' . Base_RegionalSettingsCommon::time2reg(null, false) . '</center>';
}
示例14: load_image_cache
private function load_image_cache()
{
if (isset($_SESSION['client']['image_cache'])) {
return;
}
$_SESSION['client']['image_cache'] = true;
$imgs = array();
if (Variable::get('preload_image_cache_selected') && file_exists($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images')) {
$imgs = explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . self::$theme . '/__cache.images'));
}
if (Variable::get('preload_image_cache_default') && self::$theme != 'default' && file_exists($this->get_data_dir() . 'templates/' . 'default/__cache.images')) {
$imgs = array_merge($imgs, explode("\n", file_get_contents($this->get_data_dir() . 'templates/' . 'default/__cache.images')));
}
if (!empty($imgs)) {
eval_js("var cache = document.createElement('div');" . "cache.style.display='none';" . "document.body.appendChild(cache);" . "var current_image = null;" . "var cache_pause = false;" . "var images_list = Array('" . implode("','", $imgs) . "');" . "cache_images = function() {" . "if(!cache_pause && (current_image==null || current_image.complete)) {" . "current_image = document.createElement('img');" . "current_image.src = images_list.shift();" . "cache.appendChild(current_image);" . "}" . "if(images_list.length)" . "setTimeout('cache_images()',500);" . "};" . "cache_images();", false);
}
}
示例15: applet
public function applet($values, &$opts)
{
//available applet options: toggle,href,title,go,go_function,go_arguments,go_contruct_arguments
if (!$values['title']) {
$values['title'] = __('RSS Feed');
}
$opts['title'] = $values['title'];
$name = md5($this->get_path() . $values['rssfeed']);
//div for updating
print '<div id="rssfeed_' . $name . '" style="width: 270px; padding: 5px 5px 5px 20px;">' . __('Loading RSS...') . '</div>';
//interval execution
eval_js_once('var rssfeedcache = Array();' . 'rssfeedfunc = function(name,fee,num,cache){' . 'if(!$(\'rssfeed_\'+name)) return;' . 'if(cache && typeof rssfeedcache[name] != \'undefined\')' . '$(\'rssfeed_\'+name).innerHTML = rssfeedcache[name];' . 'else ' . 'new Ajax.Updater(\'rssfeed_\'+name,\'modules/Applets/RssFeed/refresh.php\',{' . 'method:\'post\',' . 'onComplete:function(r){rssfeedcache[name]=r.responseText},' . 'parameters:{feed:fee, number:num, cid: Epesi.client_id}});' . '}');
eval_js_once('setInterval(\'rssfeedfunc(\\\'' . $name . '\\\',\\\'' . Epesi::escapeJS($values['rssfeed'], false) . '\\\' ,' . $values['rssnumber'] . ' , 0)\',1799993)');
//29 minutes and 53 seconds
//get rss now!
eval_js('rssfeedfunc(\'' . $name . '\',\'' . Epesi::escapeJS($values['rssfeed'], false) . '\' ,' . $values['rssnumber'] . ' , 1)');
}