Api.class.php

来自通约智库
跳转至: 导航搜索

<?php /**

* Created by PhpStorm.
* User: yzg
* Date: 2016/1/26
* Time: 15:15
*/

if (!defined('IN_DISCUZ')) {

   exit('Access Denied');

} class xigua_re {

   public function viewthread_variables(& $params)
   {
       include_once DISCUZ_ROOT.'./source/plugin/xigua_re/common.php';
       include_once DISCUZ_ROOT.'./source/plugin/xigua_re/hook.class.php';
       global $_G;
       $config = $_G['cache']['plugin']['xigua_re'];
       $color = $config['linkcolor'] ? $config['linkcolor'] : '#D75847';
       $ren = lang('plugin/xigua_re', 'ren');

//如果(没有创建数组($_G[id],序列化($config[关闭fid])

       if(in_array($_G['fid'], unserialize($config['closefids']))){

//回来

           return;
       }

//循环执行($params[放入列表])向$index 传入 $itme)

       foreach ($params['postlist'] as $index => $item) 
           {

//如果没有创建数值($项目[名单],序列化的($配置[打开组]))

           if(!in_array($item['groupid'], unserialize($config['opengroups'])))
           {

//持续

               continue;
           }

//如果($config[第一]  !$item[第一])是一样的

           if($config['first'] && !$item['first'])
           {

//持续执行

               continue;
           }

//$user = 合并作用域t(#xigua_re#xgre_user)指向 取来_使用者($item[作者])

           $user = C::t('#xigua_re#xgre_user')->fetch_user($item['authorid']);

//如果(!$user[打开id])

           if(!$user['openid']){

//如果($config[需要开放id])

               if($config['needopenid']) {

//持续执行

                   continue;
               }
           }

//如果$user[信息]

           if(!$user['word']){

//$user[信息] = $config[之前信息]

               $user['word'] = $config['preword'];
           }

//$subject = $params[线][主题]?网址编码($params[线][主题]):网址编码($item[最近的注释])

           $subject = $params['thread']['subject'] ? urlencode($params['thread']['subject']) : urlencode($item['recentnote']);

//$subjest = 字符串_替换(创建数组(

           $subject = str_replace(array(

// \ 回车 空格 跳格(移至下一列)

               '\, "\n", "\r", "\t", " ", "&nbsp;"
           ), , $subject);
           $postid = 'pid_'.$item['pid'];
           $tid  = $item['tid'];
           $imgs = $reilist = ;
           //                                    取来_使用者计数_通过_放入用户
           $count = C::t('#xigua_re#xgre_order')->fetch_usercount_by_postid($postid);
           if($count){
               //                                  取来_使用者_通过_放入id
               $list = C::t('#xigua_re#xgre_order')->fetch_user_by_postid($postid);
               foreach ($list as $itm) {
                   //            风格 = 陈列:排成行-立方体;边缘:             竖的-排列:顶部          风格   宽度       高度        显示   立方体 边缘                                                               站点     来源
$imgs .= "
  • <img style='width:28px;height:28px;display:block;margin:0' src=\"$itm\" onerror='this.error=null;this.src=\"{$_G['siteurl']}source/plugin/xigua_re/static/noavatar.gif\"' />
  • ";
                   }
    
                   $count = "<a style='color:#627C97;font-size:16px' href=\"{$_G['siteurl']}plugin.php?id=xigua_re:list&uid={$item['authorid']}&tid=$tid&postid=$postid\">$count</a>";
                   $reilist = "
    

    {$count}$ren$config[linkword]

      $imgs

    ";

               }
    
               $params['postlist'][ $index ]['message'] = $params['postlist'][ $index ]['message'].
               
    

    //风格 = 字体大小 灰色 //风格 = 宽度:100%;填充:8px 0 25px;:水平_对齐:居中

                   <<<HTML
    
    $user[word]
    <a style="display:inline-block;height:32px;line-height:32px;padding:0 25px;font-size:16px;text-align: center;margin:0 auto;vertical-align: middle;color: #fff;border-radius: 4px;background:$color" href='{$_G['siteurl']}plugin.php?id=xigua_re:index&uid={$item['authorid']}&subject=$subject&tid=$tid&postid=$postid'>$config[linkword]</a>

    $reilist HTML;

           }
       }
       function profile_extraInfo()
       {
           global $_G;
           $config = $_G['cache']['plugin']['xigua_re'];
           $link = $_G['siteurl']. 'home.php?mod=spacecp&ac=plugin&id=xigua_re:setting';
           $return[] = array(
               'name' => "<a href='$link'>{$config['navword']}</a>",
               'link' => $link,
           );
           return $return;
    
    }