Changeset 182475
- Timestamp:
- 12/14/2009 05:10:05 AM (16 years ago)
- Location:
- ecall/tags/1.12.15
- Files:
-
- 1 deleted
- 4 edited
-
api_temp.php (deleted)
-
class.php (modified) (6 diffs)
-
config.data (modified) (1 diff)
-
ecall.php (modified) (1 diff)
-
html.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ecall/tags/1.12.15/class.php
r182465 r182475 74 74 private $call_error;//调用出错,可以显示 75 75 private $copy;//版权信息 76 public function __construct($key='',$cid='',$rows=8){ 76 private $rows; 77 private $len; 78 public function __construct($key='',$cid=0,$rows=8,$len=120){ 77 79 $this->copy="<br/><a href='http://wordpress.org/extend/plugins/ecall/' title='wordpress Ecall插件'>Wordpress Ecall</a> <strong>Powered by</strong> <a href='http://http://blog.webfuns.cn/archives/313.html' title='获得更多帮助'>webfuns<a>"; 78 80 $cfg=new Config(); 79 81 $this->rows=intval($rows); 82 $this->len=intval($len); 80 83 $this->sys_cfg=$cfg->read(); 84 $this->cid=$cid; 81 85 if($this->sys_cfg['key']==$key){ 82 86 //echo"访问合法"; 83 87 84 88 $this->cat=get_all_category_ids(); 85 if(array_value_exists($ cid,$this->cat)&& !array_value_exists($cid,$this->sys_cfg['ban_cat'])||$cid==0){89 if(array_value_exists($this->cid,$this->cat)&& !array_value_exists($this->cid,$this->sys_cfg['ban_cat'])||$this->cid==0){ 86 90 87 91 //echo "cid合法"; 88 if($ rows >$this->sys_cfg['max_rows']) $rows=$this->sys_cfg['max_rows'];89 $ rank=$this->sys_cfg['rank'];92 if($this->rows >$this->sys_cfg['max_rows']) $this->rows=$this->sys_cfg['max_rows']; 93 $this->rank=$this->sys_cfg['rank']; 90 94 if(intval($this->sys_cfg['cache_time'])>0){ 91 95 //是否超过系统最大配置数目 92 96 93 $cache_id=$ cid.'_'.$rows;97 $cache_id=$this->cid.'_'.$this->rows.$this->len; 94 98 $this->cache=new Cache(); 95 99 $cache=$this->cache->read($cache_id); … … 100 104 //echo"失效"; 101 105 102 $html=$this->get_html( $cid,$rank,$rows);106 $html=$this->get_html(); 103 107 $this->cache->build($cache_id,$html); 104 108 }else{ … … 122 126 123 127 } 124 private function get_html( $cid='',$rank='date',$rows=8){128 private function get_html(){ 125 129 126 if($ cid>=0){127 if($ cid==0&&$this->sys_cfg['ban_cat']){130 if($this->cid>=0){ 131 if($this->cid==0&&$this->sys_cfg['ban_cat']){ 128 132 foreach($this->cat as $k => $v){ 129 133 if(!array_value_exists($v,$this->sys_cfg['ban_cat'])) $carray[]=$v; 130 134 } 131 $ cid=join($carray,",");132 if(!$ cid) {135 $this->cid=join($carray,","); 136 if(!$this->cid) { 133 137 //echo $cid.'helo'; 134 138 $this->error("博主可能关闭了插件,或者禁止了调用功能。"); … … 137 141 } 138 142 139 $posts = get_posts("&category=".$ cid."&numberposts=".$rows."&orderby=".$rank);143 $posts = get_posts("&category=".$this->cid."&numberposts=".$this->rows."&orderby=".$this->rank); 140 144 141 145 foreach($posts as $post){ … … 146 150 //print_r($post); 147 151 $parse['title']=get_the_title($id); 152 //echo strlen($parse['title']);echo $this->len+3; 153 /*if(strlen($parse['title'])>$this->len+3){ 154 $parse['title']=substr($parse['title'],0,$this->len)."..."; 155 }*/ 156 $parse['title']=sysSubStr($parse['title'],$this->len); 148 157 $parse['pubdate']=date('Y-m-d',strtotime($post->post_date)); 149 158 $parse['author']=get_the_author($id); … … 223 232 } 224 233 } 234 function sysSubStr($String,$Length,$Append = false) 235 { 236 if (strlen($String) <= $Length ) 237 { // echo 'hello'; 238 return $String; 239 } 240 else 241 { 242 $I = 0; 243 while ($I < $Length) 244 { 245 $StringTMP = substr($String,$I,1); 246 if ( ord($StringTMP) >=224 ) 247 { 248 $StringTMP = substr($String,$I,3); 249 $I = $I + 3; 250 } 251 elseif( ord($StringTMP) >=192 ) 252 { 253 $StringTMP = substr($String,$I,2); 254 $I = $I + 2; 255 } 256 else 257 { 258 $I = $I + 1; 259 } 260 $StringLast[] = $StringTMP; 261 } 262 $StringLast = implode("",$StringLast); 263 if($Append) 264 { 265 $StringLast .= "..."; 266 } 267 return $StringLast; 268 } 269 } 225 270 ?> -
ecall/tags/1.12.15/config.data
r182465 r182475 1 a:1:{s:3:"key";s:32:"15e3f539603bee92e0d5c6f2718a02e3";} -
ecall/tags/1.12.15/ecall.php
r182465 r182475 27 27 $cid=$_GET['cid']; 28 28 $rows=$_GET['rows']; 29 $len=$_GET['len']; 29 30 if(!$rows) $rows=8; 30 $data=new MakeData($key,$cid,$rows );31 $data=new MakeData($key,$cid,$rows,$len); 31 32 exit; 32 33 } -
ecall/tags/1.12.15/html.php
r182465 r182475 196 196 $id=rand(0,count($cats)-1);*/ 197 197 $id=0; 198 $call="<script type='text/javascript' src='".get_bloginfo('home')."/ api.php?key=". $old_cfg['key']."&cid={$id}&rows=6'></script>";198 $call="<script type='text/javascript' src='".get_bloginfo('home')."/index.php?key=". $old_cfg['key']."&cid={$id}&rows=6'></script>"; 199 199 echo $call=htmlspecialchars($call); 200 200 ?></textarea>
Note: See TracChangeset
for help on using the changeset viewer.