Exemple #1
0
 /**
  * 格式化属性
  *
  * @param array $attribs
  */
 function _formatAttribs(&$attribs)
 {
     // 格式化参数
     foreach ($attribs as $option => $value) {
         if (!isset($this->paramsType[$option])) {
             $type = 'object';
         } else {
             $type = $this->paramsType[$option];
         }
         switch ($type) {
             case 'raw':
             case 'function':
             case 'number':
                 break;
             case 'pair':
                 if (is_array($value)) {
                     $value = t2js(encode_url_args($value));
                 }
                 break;
             case 'boolean':
                 $value = $value ? 'true' : 'false';
                 break;
             case 'object':
                 $value = "\$(\"{$value}\")";
                 break;
             case 'string':
             default:
                 $value = '"' . t2js($value) . '"';
         }
         $attribs[$option] = $value;
     }
 }
Exemple #2
0
/**
 * 输出按照模版要求格式化以后的代码
 *
 * @param string $code
 */
function __error_highlight_string($code)
{
    $text = t2js($code);
    $code = str_replace("<br />", "\n", highlight_string($code, true));
    echo <<<EOT
<pre>
[<a href="#" onclick="copytextToClipboard('{$text}'); return false;">Copy To Clipboard</a>]

{$code}
</pre>
EOT;
}
<script language="javascript" type="text/javascript">
<!--
function fnOnBack() {
	var url = '<?php 
echo $this->_getBack();
?>
';
	document.location.href = url;
}

function fnOnSubmit(form) {
	form.Save.disabled = true;

	if (form.postfile.value == '') {
		alert('<?php 
echo t2js(_T('ui_p_picman_form_validation'));
?>
');
		form.Save.disabled = false;
		return false;
	}

	return true;
}

// -->
</script>
</head>
<body>
<div id="content">
  <h3><?php 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo RESPONSE_CHARSET;
?>
" />
<title><?php 
echo h(_T('ui_g_title'));
?>
</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
function fnOnSubmit(form) {
	if (form.username.value == '' || form.password.value == '') {
		alert('<?php 
echo t2js(_T('ui_l_form_validation'));
?>
');
		return false;
	}
	return true;
}
function bodyonload()
{
	document.loginform.username.focus();
}
</script>
</head>
<body onload="javascript:if ('function' == typeof(bodyonload)) { bodyonload(); }">
<center>
<div>
 public function update()
 {
     if (empty($_POST['ids'])) {
         $this->error('请选择需要更新的广告!');
     }
     $array = $_POST;
     foreach ($array['ids'] as $key => $value) {
         $data['title'] = trim($array['titles'][$key]);
         $list = $this->AdsDB->field('id,title')->where($data)->find();
         if ($list) {
             if ($value != $list['id']) {
                 $this->error('广告标识重复,请核查并重新填写!');
             }
         }
         //删除原广告代码
         $title = $this->AdsDB->where('id=' . $value)->getField('title');
         @unlink('./' . C('web_adsensepath') . '/' . $title . '.js');
         //
         $data['content'] = stripslashes(trim($array['contents'][$key]));
         $this->AdsDB->where('id = ' . $value)->save($data);
         write_file('./' . C('web_adsensepath') . '/' . $data['title'] . '.js', t2js($data['content']));
     }
     $this->success('批量修改广告位成功!');
 }