diff --git a/class/Payjs.php b/class/Payjs.php index 0f3485d..8a9d4e6 100644 --- a/class/Payjs.php +++ b/class/Payjs.php @@ -6,6 +6,7 @@ class GDK_Payjs private $key; private $api_url_native; private $api_url_cashier; + private $api_url_mweb; private $api_url_check; public function __construct($config = null) @@ -14,10 +15,11 @@ class GDK_Payjs $this->mchid = $config['mchid']; $this->key = $config['key']; - $api_url = isset($config['api_url']) ? $config['api_url'] : 'https://payjs.cn/api/'; + $api_url = $config['api_url'] ?? 'https://payjs.cn/api/'; $this->api_url_native = $api_url . 'native'; $this->api_url_cashier = $api_url . 'cashier'; + $this->api_url_mweb = $api_url . 'mweb'; $this->api_url_close = $api_url . 'close'; $this->api_url_check = $api_url . 'check'; } @@ -28,7 +30,12 @@ class GDK_Payjs $this->url = $this->api_url_native; return $this->post($data); } - + // MWEB(H5) 支付 + public function mweb(array $data) + { + $this->url = $this->api_url_mweb; + return $this->post($data); + } // 收银台模式 public function cashier(array $data) { @@ -95,4 +102,3 @@ class GDK_Payjs } } -?> \ No newline at end of file diff --git a/class/ai.php b/class/ai.php deleted file mode 100644 index b822b6a..0000000 --- a/class/ai.php +++ /dev/null @@ -1,45 +0,0 @@ -newsSummary($content, $maxSummaryLen); - -var_dump($result); - - -$my_post = array( - 'ID' => $post_ID, -'post_excerpt' => $result //ժҪϢ - -); - - -// - -//wp_insert_post( $my_post ); - -} -add_action('publish_post', 'gdk_newsSummary', 0); -add_action('update_post', 'gdk_newsSummary', 0); \ No newline at end of file diff --git a/class/ai/AipContentCensor.php b/class/ai/AipContentCensor.php deleted file mode 100644 index 34c3651..0000000 --- a/class/ai/AipContentCensor.php +++ /dev/null @@ -1,25 +0,0 @@ -request($this->commentTagUrl, $data); - } - - /** - * 情感倾向分析接口 - * - * @param string $text - 文本内容(GBK编码),最大102400字节 - * @param array $options - 可选参数对象,key: value都为string类型 - * @description options列表: - * @return array - */ - public function sentimentClassify($text, $options=array()){ - - $data = array(); - - $data['text'] = $text; - - $data = array_merge($data, $options); - $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8'); - - return $this->request($this->sentimentClassifyUrl, $data); - } - - /** - * 文章标签接口 - * - * @param string $title - 篇章的标题,最大80字节 - * @param string $content - 篇章的正文,最大65535字节 - * @param array $options - 可选参数对象,key: value都为string类型 - * @description options列表: - * @return array - */ - public function keyword($title, $content, $options=array()){ - - $data = array(); - - $data['title'] = $title; - $data['content'] = $content; - - $data = array_merge($data, $options); - $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8'); - - return $this->request($this->keywordUrl, $data); - } - - /** - * 文章分类接口 - * - * @param string $title - 篇章的标题,最大80字节 - * @param string $content - 篇章的正文,最大65535字节 - * @param array $options - 可选参数对象,key: value都为string类型 - * @description options列表: - * @return array - */ - public function topic($title, $content, $options=array()){ - - $data = array(); - - $data['title'] = $title; - $data['content'] = $content; - - $data = array_merge($data, $options); - $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8'); - - return $this->request($this->topicUrl, $data); - } - - /** - * 文本纠错接口 - * - * @param string $text - 待纠错文本,输入限制511字节 - * @param array $options - 可选参数对象,key: value都为string类型 - * @description options列表: - * @return array - */ - public function ecnet($text, $options=array()){ - - $data = array(); - - $data['text'] = $text; - - $data = array_merge($data, $options); - $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8'); - - return $this->request($this->ecnetUrl, $data); - } - - /** - * 新闻摘要接口接口 - * - * @param string $content - 字符串(限3000字符数以内)字符串仅支持GBK编码,长度需小于3000字符数(即6000字节),请输入前确认字符数没有超限,若字符数超长会返回错误。正文中如果包含段落信息,请使用"\n"分隔,段落信息算法中有重要的作用,请尽量保留 - * @param integer $maxSummaryLen - 此数值将作为摘要结果的最大长度。例如:原文长度1000字,本参数设置为150,则摘要结果的最大长度是150字;推荐最优区间:200-500字 - * @param array $options - 可选参数对象,key: value都为string类型 - * @description options列表: - * title 字符串(限200字符数)字符串仅支持GBK编码,长度需小于200字符数(即400字节),请输入前确认字符数没有超限,若字符数超长会返回错误。标题在算法中具有重要的作用,若文章确无标题,输入参数的“标题”字段为空即可 - * @return array - */ - public function newsSummary($content, $maxSummaryLen, $options=array()){ - - $data = array(); - - $data['content'] = $content; - $data['max_summary_len'] = $maxSummaryLen; - - $data = array_merge($data, $options); - $data = mb_convert_encoding(json_encode($data), 'GBK', 'UTF8'); - - return $this->request($this->newsSummaryUrl, $data); - } - - -} \ No newline at end of file diff --git a/class/ai/lib/AipBCEUtil.php b/class/ai/lib/AipBCEUtil.php deleted file mode 100644 index 84b79d2..0000000 --- a/class/ai/lib/AipBCEUtil.php +++ /dev/null @@ -1,345 +0,0 @@ - $v) { - //跳过Authorization字段 - if (strcasecmp('Authorization', $k) == 0) { - continue; - } - if (!isset($k)) { - throw new \InvalidArgumentException( - "parameter key should not be null" - ); - } - if (isset($v)) { - //对于有值的,编码后放在=号两边 - $parameterStrings[] = AipHttpUtil::urlEncode($k) - . '=' . AipHttpUtil::urlEncode((string) $v); - } else { - //对于没有值的,只将key编码后放在=号的左边,右边留空 - $parameterStrings[] = AipHttpUtil::urlEncode($k) . '='; - } - } - //按照字典序排序 - sort($parameterStrings); - - //使用'&'符号连接它们 - return implode('&', $parameterStrings); - } - - /** - * 生成标准化uri - * @param string $path - * @return string - */ - public static function getCanonicalURIPath($path) - { - //空路径设置为'/' - if (empty($path)) { - return '/'; - } else { - //所有的uri必须以'/'开头 - if ($path[0] == '/') { - return AipHttpUtil::urlEncodeExceptSlash($path); - } else { - return '/' . AipHttpUtil::urlEncodeExceptSlash($path); - } - } - } - - /** - * 生成标准化http请求头串 - * @param array $headers - * @return array - */ - public static function getCanonicalHeaders($headers) - { - //如果没有headers,则返回空串 - if (count($headers) == 0) { - return ''; - } - - $headerStrings = array(); - foreach ($headers as $k => $v) { - //跳过key为null的 - if ($k === null) { - continue; - } - //如果value为null,则赋值为空串 - if ($v === null) { - $v = ''; - } - //trim后再encode,之后使用':'号连接起来 - $headerStrings[] = AipHttpUtil::urlEncode(strtolower(trim($k))) . ':' . AipHttpUtil::urlEncode(trim($v)); - } - //字典序排序 - sort($headerStrings); - - //用'\n'把它们连接起来 - return implode("\n", $headerStrings); - } -} -AipHttpUtil::__init(); - - -class AipSignOption -{ - const EXPIRATION_IN_SECONDS = 'expirationInSeconds'; - - const HEADERS_TO_SIGN = 'headersToSign'; - - const TIMESTAMP = 'timestamp'; - - const DEFAULT_EXPIRATION_IN_SECONDS = 1800; - - const MIN_EXPIRATION_IN_SECONDS = 300; - - const MAX_EXPIRATION_IN_SECONDS = 129600; -} - - -class AipSampleSigner -{ - - const BCE_AUTH_VERSION = "bce-auth-v1"; - const BCE_PREFIX = 'x-bce-'; - - //不指定headersToSign情况下,默认签名http头,包括: - // 1.host - // 2.content-length - // 3.content-type - // 4.content-md5 - public static $defaultHeadersToSign; - - public static function __init() - { - AipSampleSigner::$defaultHeadersToSign = array( - "host", - "content-length", - "content-type", - "content-md5", - ); - } - - /** - * 签名 - * @param array $credentials - * @param string $httpMethod - * @param string $path - * @param array $headers - * @param string $params - * @param array $options - * @return string - */ - public static function sign( - array $credentials, - $httpMethod, - $path, - $headers, - $params, - $options = array() - ) { - //设定签名有效时间 - if (!isset($options[AipSignOption::EXPIRATION_IN_SECONDS])) { - //默认值1800秒 - $expirationInSeconds = AipSignOption::DEFAULT_EXPIRATION_IN_SECONDS; - } else { - $expirationInSeconds = $options[AipSignOption::EXPIRATION_IN_SECONDS]; - } - - //解析ak sk - $accessKeyId = $credentials['ak']; - $secretAccessKey = $credentials['sk']; - - //设定时间戳,注意:如果自行指定时间戳需要为UTC时间 - if (!isset($options[AipSignOption::TIMESTAMP])) { - //默认值当前时间 - $timestamp = gmdate('Y-m-d\TH:i:s\Z'); - } else { - $timestamp = $options[AipSignOption::TIMESTAMP]; - } - - //生成authString - $authString = AipSampleSigner::BCE_AUTH_VERSION . '/' . $accessKeyId . '/' - . $timestamp . '/' . $expirationInSeconds; - - //使用sk和authString生成signKey - $signingKey = hash_hmac('sha256', $authString, $secretAccessKey); - - //生成标准化URI - $canonicalURI = AipHttpUtil::getCanonicalURIPath($path); - - //生成标准化QueryString - $canonicalQueryString = AipHttpUtil::getCanonicalQueryString($params); - - //填充headersToSign,也就是指明哪些header参与签名 - $headersToSign = null; - if (isset($options[AipSignOption::HEADERS_TO_SIGN])) { - $headersToSign = $options[AipSignOption::HEADERS_TO_SIGN]; - } - - //生成标准化header - $canonicalHeader = AipHttpUtil::getCanonicalHeaders( - AipSampleSigner::getHeadersToSign($headers, $headersToSign) - ); - - //整理headersToSign,以';'号连接 - $signedHeaders = ''; - if ($headersToSign !== null) { - $signedHeaders = strtolower( - trim(implode(";", $headersToSign)) - ); - } - - //组成标准请求串 - $canonicalRequest = "$httpMethod\n$canonicalURI\n" - . "$canonicalQueryString\n$canonicalHeader"; - - //使用signKey和标准请求串完成签名 - $signature = hash_hmac('sha256', $canonicalRequest, $signingKey); - - //组成最终签名串 - $authorizationHeader = "$authString/$signedHeaders/$signature"; - - return $authorizationHeader; - } - - /** - * 根据headsToSign过滤应该参与签名的header - * @param array $headers - * @param array $headersToSign - * @return array - */ - public static function getHeadersToSign($headers, $headersToSign) - { - - $arr = array(); - foreach ($headersToSign as $value) { - $arr[] = strtolower(trim($value)); - } - - //value被trim后为空串的header不参与签名 - $result = array(); - foreach ($headers as $key => $value) { - if (trim($value) !== '') { - $key = strtolower(trim($key)); - if (in_array($key, $arr)) { - $result[$key] = $value; - } - } - } - - //返回需要参与签名的header - return $result; - } - - /** - * 检查header是不是默认参加签名的: - * 1.是host、content-type、content-md5、content-length之一 - * 2.以x-bce开头 - * @param array $header - * @return boolean - */ - public static function isDefaultHeaderToSign($header) - { - $header = strtolower(trim($header)); - if (in_array($header, AipSampleSigner::$defaultHeadersToSign)) { - return true; - } - return substr_compare($header, AipSampleSigner::BCE_PREFIX, 0, strlen(AipSampleSigner::BCE_PREFIX)) == 0; - } -} -AipSampleSigner::__init(); diff --git a/class/ai/lib/AipBase.php b/class/ai/lib/AipBase.php deleted file mode 100644 index 6a54145..0000000 --- a/class/ai/lib/AipBase.php +++ /dev/null @@ -1,394 +0,0 @@ -appId = trim($appId); - $this->apiKey = trim($apiKey); - $this->secretKey = trim($secretKey); - $this->isCloudUser = null; - $this->client = new AipHttpClient(); - $this->version = '2_2_19'; - $this->proxies = array(); - } - - /** - * 查看版本 - * @return string - * - */ - public function getVersion(){ - return $this->version; - } - - /** - * 连接超时 - * @param int $ms 毫秒 - */ - public function setConnectionTimeoutInMillis($ms){ - $this->client->setConnectionTimeoutInMillis($ms); - } - - /** - * 响应超时 - * @param int $ms 毫秒 - */ - public function setSocketTimeoutInMillis($ms){ - $this->client->setSocketTimeoutInMillis($ms); - } - - /** - * 代理 - * @param array $proxy - * @return string - * - */ - public function setProxies($proxies){ - $this->client->setConf($proxies); - } - - /** - * 处理请求参数 - * @param string $url - * @param array $params - * @param array $data - * @param array $headers - */ - protected function proccessRequest($url, &$params, &$data, $headers){ - $params['aipSdk'] = 'php'; - $params['aipSdkVersion'] = $this->version; - } - - /** - * Api 请求 - * @param string $url - * @param mixed $data - * @return mixed - */ - protected function request($url, $data, $headers=array()){ - try{ - $result = $this->validate($url, $data); - if($result !== true){ - return $result; - } - - $params = array(); - $authObj = $this->auth(); - - if($this->isCloudUser === false){ - $params['access_token'] = $authObj['access_token']; - } - - // 特殊处理 - $this->proccessRequest($url, $params, $data, $headers); - - $headers = $this->getAuthHeaders('POST', $url, $params, $headers); - $response = $this->client->post($url, $data, $params, $headers); - - $obj = $this->proccessResult($response['content']); - - if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){ - $authObj = $this->auth(true); - $params['access_token'] = $authObj['access_token']; - $response = $this->client->post($url, $data, $params, $headers); - $obj = $this->proccessResult($response['content']); - } - - if(empty($obj) || !isset($obj['error_code'])){ - $this->writeAuthObj($authObj); - } - }catch(Exception $e){ - return array( - 'error_code' => 'SDK108', - 'error_msg' => 'connection or read data timeout', - ); - } - - return $obj; - } - - /** - * Api 多个并发请求 - * @param string $url - * @param mixed $data - * @return mixed - */ - protected function multi_request($url, $data){ - try{ - $params = array(); - $authObj = $this->auth(); - $headers = $this->getAuthHeaders('POST', $url); - - if($this->isCloudUser === false){ - $params['access_token'] = $authObj['access_token']; - } - - $responses = $this->client->multi_post($url, $data, $params, $headers); - - $is_success = false; - foreach($responses as $response){ - $obj = $this->proccessResult($response['content']); - - if(empty($obj) || !isset($obj['error_code'])){ - $is_success = true; - } - - if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){ - $authObj = $this->auth(true); - $params['access_token'] = $authObj['access_token']; - $responses = $this->client->post($url, $data, $params, $headers); - break; - } - } - - if($is_success){ - $this->writeAuthObj($authObj); - } - - $objs = array(); - foreach($responses as $response){ - $objs[] = $this->proccessResult($response['content']); - } - - }catch(Exception $e){ - return array( - 'error_code' => 'SDK108', - 'error_msg' => 'connection or read data timeout', - ); - } - - return $objs; - } - - /** - * 格式检查 - * @param string $url - * @param array $data - * @return mix - */ - protected function validate($url, &$data){ - return true; - } - - /** - * 格式化结果 - * @param $content string - * @return mixed - */ - protected function proccessResult($content){ - return json_decode($content, true); - } - - /** - * 返回 access token 路径 - * @return string - */ - private function getAuthFilePath(){ - return dirname(__FILE__) . DIRECTORY_SEPARATOR . md5($this->apiKey); - } - - /** - * 写入本地文件 - * @param array $obj - * @return void - */ - private function writeAuthObj($obj){ - if($obj === null || (isset($obj['is_read']) && $obj['is_read'] === true)){ - return; - } - - $obj['time'] = time(); - $obj['is_cloud_user'] = $this->isCloudUser; - @file_put_contents($this->getAuthFilePath(), json_encode($obj)); - } - - /** - * 读取本地缓存 - * @return array - */ - private function readAuthObj(){ - $content = @file_get_contents($this->getAuthFilePath()); - if($content !== false){ - $obj = json_decode($content, true); - $this->isCloudUser = $obj['is_cloud_user']; - $obj['is_read'] = true; - if($this->isCloudUser || $obj['time'] + $obj['expires_in'] - 30 > time()){ - return $obj; - } - } - - return null; - } - - /** - * 认证 - * @param bool $refresh 是否刷新 - * @return array - */ - private function auth($refresh=false){ - - //非过期刷新 - if(!$refresh){ - $obj = $this->readAuthObj(); - if(!empty($obj)){ - return $obj; - } - } - - $response = $this->client->get($this->accessTokenUrl, array( - 'grant_type' => 'client_credentials', - 'client_id' => $this->apiKey, - 'client_secret' => $this->secretKey, - )); - - $obj = json_decode($response['content'], true); - - $this->isCloudUser = !$this->isPermission($obj); - return $obj; - } - - /** - * 判断认证是否有权限 - * @param array $authObj - * @return boolean - */ - protected function isPermission($authObj) - { - if(empty($authObj) || !isset($authObj['scope'])){ - return false; - } - - $scopes = explode(' ', $authObj['scope']); - - return in_array($this->scope, $scopes); - } - - /** - * @param string $method HTTP method - * @param string $url - * @param array $param 参数 - * @return array - */ - private function getAuthHeaders($method, $url, $params=array(), $headers=array()){ - - //不是云的老用户则不用在header中签名 认证 - if($this->isCloudUser === false){ - return $headers; - } - - $obj = parse_url($url); - if(!empty($obj['query'])){ - foreach(explode('&', $obj['query']) as $kv){ - if(!empty($kv)){ - list($k, $v) = explode('=', $kv, 2); - $params[$k] = $v; - } - } - } - - //UTC 时间戳 - $timestamp = gmdate('Y-m-d\TH:i:s\Z'); - $headers['Host'] = isset($obj['port']) ? sprintf('%s:%s', $obj['host'], $obj['port']) : $obj['host']; - $headers['x-bce-date'] = $timestamp; - - //签名 - $headers['authorization'] = AipSampleSigner::sign(array( - 'ak' => $this->apiKey, - 'sk' => $this->secretKey, - ), $method, $obj['path'], $headers, $params, array( - 'timestamp' => $timestamp, - 'headersToSign' => array_keys($headers), - )); - - return $headers; - } - - /** - * 反馈 - * - * @param array $feedbacks - * @return array - */ - public function report($feedback){ - - $data = array(); - - $data['feedback'] = $feedback; - - return $this->request($this->reportUrl, $data); - } - - /** - * 通用接口 - * @param string $url - * @param array $data - * @param array header - * @return array - */ - public function post($url, $data, $headers=array()){ - return $this->request($url, $data, $headers); - } - -} diff --git a/class/ai/lib/AipHttpClient.php b/class/ai/lib/AipHttpClient.php deleted file mode 100644 index 4518d19..0000000 --- a/class/ai/lib/AipHttpClient.php +++ /dev/null @@ -1,214 +0,0 @@ -headers = $this->buildHeaders($headers); - $this->connectTimeout = 60000; - $this->socketTimeout = 60000; - $this->conf = array(); - } - - /** - * 连接超时 - * @param int $ms 毫秒 - */ - public function setConnectionTimeoutInMillis($ms){ - $this->connectTimeout = $ms; - } - - /** - * 响应超时 - * @param int $ms 毫秒 - */ - public function setSocketTimeoutInMillis($ms){ - $this->socketTimeout = $ms; - } - - /** - * 配置 - * @param array $conf - */ - public function setConf($conf){ - $this->conf = $conf; - } - - /** - * 请求预处理 - * @param resource $ch - */ - public function prepare($ch){ - foreach($this->conf as $key => $value){ - curl_setopt($ch, $key, $value); - } - } - - /** - * @param string $url - * @param array $data HTTP POST BODY - * @param array $param HTTP URL - * @param array $headers HTTP header - * @return array - */ - public function post($url, $data=array(), $params=array(), $headers=array()){ - $url = $this->buildUrl($url, $params); - $headers = array_merge($this->headers, $this->buildHeaders($headers)); - - $ch = curl_init(); - $this->prepare($ch); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data); - curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout); - $content = curl_exec($ch); - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - if($code === 0){ - throw new Exception(curl_error($ch)); - } - - curl_close($ch); - return array( - 'code' => $code, - 'content' => $content, - ); - } - - /** - * @param string $url - * @param array $datas HTTP POST BODY - * @param array $param HTTP URL - * @param array $headers HTTP header - * @return array - */ - public function multi_post($url, $datas=array(), $params=array(), $headers=array()){ - $url = $this->buildUrl($url, $params); - $headers = array_merge($this->headers, $this->buildHeaders($headers)); - - $chs = array(); - $result = array(); - $mh = curl_multi_init(); - foreach($datas as $data){ - $ch = curl_init(); - $chs[] = $ch; - $this->prepare($ch); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data); - curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout); - curl_multi_add_handle($mh, $ch); - } - - $running = null; - do{ - curl_multi_exec($mh, $running); - usleep(100); - }while($running); - - foreach($chs as $ch){ - $content = curl_multi_getcontent($ch); - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - $result[] = array( - 'code' => $code, - 'content' => $content, - ); - curl_multi_remove_handle($mh, $ch); - } - curl_multi_close($mh); - - return $result; - } - - /** - * @param string $url - * @param array $param HTTP URL - * @param array $headers HTTP header - * @return array - */ - public function get($url, $params=array(), $headers=array()){ - $url = $this->buildUrl($url, $params); - $headers = array_merge($this->headers, $this->buildHeaders($headers)); - - $ch = curl_init(); - $this->prepare($ch); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_HEADER, false); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); - curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout); - $content = curl_exec($ch); - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - - if($code === 0){ - throw new Exception(curl_error($ch)); - } - - curl_close($ch); - return array( - 'code' => $code, - 'content' => $content, - ); - } - - /** - * 构造 header - * @param array $headers - * @return array - */ - private function buildHeaders($headers){ - $result = array(); - foreach($headers as $k => $v){ - $result[] = sprintf('%s:%s', $k, $v); - } - return $result; - } - - /** - * - * @param string $url - * @param array $params 参数 - * @return string - */ - private function buildUrl($url, $params){ - if(!empty($params)){ - $str = http_build_query($params); - return $url . (strpos($url, '?') === false ? '?' : '&') . $str; - }else{ - return $url; - } - } -} diff --git a/class/class_load.php b/class/class_load.php index af8cd98..bc6a427 100644 --- a/class/class_load.php +++ b/class/class_load.php @@ -1,10 +1,9 @@ /> +echo $t->get_field_name('wc_cache'); ?>" type="checkbox" />

@@ -67,4 +65,6 @@ echo $t->get_field_id('wc_cache'); ?>">禁止缓存本工具? return $instance; } } -$GLOBALS['Auto_Widget_cache'] = new Auto_Widget_cache(); \ No newline at end of file +if( gdk_option('gdk_sidebar_cache')){ + $GLOBALS['Auto_Widget_cache'] = new Auto_Widget_cache(); +} diff --git a/framework/metabox.php b/framework/metabox.php index acb3e1a..d3d4dd0 100644 --- a/framework/metabox.php +++ b/framework/metabox.php @@ -1,5 +1,5 @@ "自定义缩略图", "description" => "这里可以输入您的自定义缩略图链接", "type" => "text", - "scope" => array("post"), + "scope" => ['post'], "capability" => "edit_posts", ), array( @@ -29,7 +29,7 @@ if (!class_exists('myCustomFields')) { "title" => "单页下载文件名字", "description" => "这里可以输入您的下载文件的名字", "type" => "text", - "scope" => array("post"), + "scope" => ['post'], "capability" => "edit_posts", ), array( @@ -37,7 +37,7 @@ if (!class_exists('myCustomFields')) { "title" => "单页下载文件大小", "description" => "这里可以输入您的下载文件的大小,可以加上单位,比如:233KB或者233MB", "type" => "text", - "scope" => array("post"), + "scope" => ['post'], "capability" => "edit_posts", ), array( @@ -45,7 +45,7 @@ if (!class_exists('myCustomFields')) { "title" => "单页下载下载链接", "description" => "按照链接,名字,备注的格式,注意中间是用英文逗号,换行可添加多个,举个栗子:https://www.baidu.com,百度官网,中国最大的搜索引擎网站", "type" => "textarea", - "scope" => array("post"), + "scope" => ['post'], "capability" => "edit_posts", ), ); @@ -56,8 +56,6 @@ if (!class_exists('myCustomFields')) { { add_action('admin_menu', array($this, 'createCustomFields')); add_action('save_post', array($this, 'saveCustomFields'), 1, 2); - // 下面这句可以关闭WordPress自带的自定义栏目,但是不推荐,需要的话可以开启 - //add_action( 'do_meta_boxes', array( $this, 'removeDefaultCustomFields' ), 10, 3 ); } /** * 创建一组你自己的自定义栏目 diff --git a/framework/options-config.php b/framework/options-config.php index eb9fb8d..69b5ea2 100644 --- a/framework/options-config.php +++ b/framework/options-config.php @@ -4,15 +4,15 @@ */ $gdk_options = [ - '优化选项' => [ + '优化' => [ [ 'name' => '古腾堡编辑器', 'desc' => '新版编辑器尚不成熟,很多主题不兼容,建议禁用', 'id' => 'gdk_diasble_gutenberg', 'type' => 'radio', 'options' => [ - '0' => '开启', - '1' => '禁用(推荐)', + '0' => '启用', + '1' => '禁用', ], 'std' => '1', ], @@ -22,97 +22,56 @@ $gdk_options = [ 'id' => 'gdk_diasble_widgets_block', 'type' => 'radio', 'options' => [ - '0' => '开启', - '1' => '禁用(推荐)', + '0' => '启用', + '1' => '禁用', ], 'std' => '1', ], [ 'name' => '头部冗余代码', - 'desc' => 'WordPress头部自带很多无用代码,不安全且浪费,建议禁用', + 'desc' => '禁用
WordPress头部自带很多无用代码,不安全且浪费,建议禁用', 'id' => 'gdk_diasble_head_useless', - 'type' => 'radio', - 'options' => [ - '0' => '开启', - '1' => '禁用(推荐)', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ - 'name' => '禁用WordPress更新', - 'desc' => 'WordPress更新会不时发送请求数据,所以可以关闭WordPress更新,包括主题,插件和内核更新,默认禁用', - 'id' => 'gdk_diasble_wp_update', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', - ], - [ - 'name' => '禁用Emojis功能', - 'desc' => 'WordPress的Emojis功能会加载国外资源,那是网站速度,所以建议开启', + 'name' => 'Emojis表情功能', + 'desc' => '禁用
WordPress自带的Emojis功能会加载国外资源,那是网站速度,建议禁用', 'id' => 'gdk_disable_emojis', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ - 'name' => '前台禁用dashicons字体和编辑器资源', - 'desc' => '一般前台不需要加载dashicons字体,默认开启', + 'name' => '前台Dashicons字体资源', + 'desc' => '禁用
一般前台不需要加载dashicons字体,建议禁用', 'id' => 'gdk_disable_dashicons', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '中英文自动空格', - 'desc' => '启用 【开启后,中文和英文之前将自动增加一个空格,比如:WordPress插件=>WordPress 插件】', + 'desc' => '启用
【开启后,中文和英文之前将自动增加一个空格,比如:WordPress插件=>WordPress 插件】', 'id' => 'gdk_auto_space', 'type' => 'checkbox', ], [ - 'name' => '禁用XML-RPC功能', - 'desc' => '该功能有安全风险,如果不使用WordPress的手机客户端或者第三方编辑器软件,那么建议开启', + 'name' => 'XML-RPC发布功能', + 'desc' => '禁用
该功能有安全风险,如果不使用WordPress的手机客户端或者第三方编辑器软件,那么建议禁用', 'id' => 'gdk_disable_xmlrpc', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ - 'name' => '禁用文章版本功能', - 'desc' => '该功能有会造成数据库体量暴增为了你的数据库考虑,建议开启', + 'name' => '文章版本功能', + 'desc' => '禁用
该功能有会造成数据库体量暴增为了你的数据库考虑,建议禁用', 'id' => 'gdk_disable_revision', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ - 'name' => '禁用pingback功能', - 'desc' => '该功能会增加垃圾评论的几率,建议开启', + 'name' => 'Pingback功能', + 'desc' => '禁用
该功能会增加垃圾评论的几率,建议禁用', 'id' => 'gdk_disable_trackbacks', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '文件上传重命名', - 'desc' => '该功能会将zip,rar,7z格式以外的所有全部数字重命名,服务器文件不建议使用中文,默认开启', + 'desc' => '该功能会将上传的文件图片等按照数字格式重命名,服务器文件不建议使用中文,默认开启', 'id' => 'gdk_upload_rename', 'type' => 'radio', 'options' => [ @@ -121,20 +80,21 @@ $gdk_options = [ ], 'std' => '1', ], + [ + 'name' => 'WordPress更新', + 'desc' => '禁用
WordPress更新会不时发送请求数据,所以可以关闭WordPress更新,包括主题,插件和内核更新,建议禁用', + 'id' => 'gdk_diasble_wp_update', + 'type' => 'checkbox', + ], [ 'name' => 'WordPress更新中国加速', - 'desc' => '该功能会帮助顺利更新WordPress,突破429,注意:如果上面的WordPress禁用更新了,此处设置无效,建议开启', + 'desc' => '启用
该功能会帮助更顺利更新WordPress,注意:如果上面的WordPress禁用更新了,此处设置无效,由Litepress提供镜像,建议开启', 'id' => 'gdk_porxy_update', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '头像加速功能', - 'desc' => '该功能会增加头像加载速度,有随机头像,V2EX头像镜像和七牛头像镜像,默认选择随机头像', + 'desc' => '该功能会增加头像加载速度,有随机头像,V2EX头像镜像和七牛头像镜像,默认选择随机头像,本地头像和微信头像不受影响', 'id' => 'gdk_switch_get_avatar', 'type' => 'radio', 'options' => [ @@ -143,10 +103,10 @@ $gdk_options = [ '3' => '七牛头像镜像', '4' => 'Cravatar', ], - 'std' => '3', + 'std' => '1', ], ], - 'SEO设置' => [ + 'SEO' => [ [ 'name' => '网站关键字', //选项显示的文字,选填 'desc' => '各关键字间用半角逗号', '分割,数量在6个以内最佳。', //选项显示的一段描述文字,选填 @@ -162,21 +122,16 @@ $gdk_options = [ ], [ 'name' => 'title分隔符', - 'desc' => '显示在浏览器标题栏的一个用来风格网站名字的', + 'desc' => '显示在浏览器标题栏的一个用来分隔网站名字的', 'id' => 'gdk_delimiter', 'type' => 'text', 'std' => '|', ], [ 'name' => '自动添加nofollow', - 'desc' => '该功能会给外链自动添加nofollow,默认开启', + 'desc' => '该功能会给外链自动添加nofollow,推荐开启', 'id' => 'gdk_nofollow', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '分类去Category优化', @@ -186,14 +141,9 @@ $gdk_options = [ ], [ 'name' => '文章自动内链', - 'desc' => '该功能会将文章中与标签匹配的文字自动添加标签链接,如果是纯文字的内容建议打开,默认禁用', + 'desc' => '启用
该功能会将文章中与标签匹配的文字自动添加标签链接,如果是纯文字的内容建议打开,注意该功能和一些短代码等功能有冲突', 'id' => 'gdk_tag_link', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => '关键词链接次数', @@ -204,64 +154,39 @@ $gdk_options = [ ], [ 'name' => 'Robots.txt 优化', - 'desc' => '该功能会自动生成一个虚拟Robots.txt文件,和真实文件效果一样的,默认开启', + 'desc' => '启用
该功能会自动生成一个虚拟Robots.txt文件,和真实文件效果一样的,默认开启', 'id' => 'gdk_robots', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '禁止蜘蛛爬取作者页面', - 'desc' => '该功能会屏蔽蜘蛛访问作者页面,如果是单作者网站没必要展示作者页,根据自己网站实际情况选择是否开启,默认禁用', + 'desc' => '启用
该功能会屏蔽蜘蛛访问作者页面,如果是单作者网站没必要展示作者页,根据自己网站实际情况选择是否开启,建议启用', 'id' => 'gdk_no_author_page', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => '网站地图 sitemap', - 'desc' => '该功能会自动生成网站地图[xml版和html版],链接:域名/sitemap.xml,域名/sitemap.html,开启后建议更新固定链接一次,默认开启', + 'desc' => '启用
该功能会自动生成网站地图[xml版和html版],链接:域名/sitemap.xml,域名/sitemap.html,开启后建议更新固定链接一次,建议启用开启', 'id' => 'gdk_sitemap_xml', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '文章图片自动添加alt以及title', 'desc' => '该功能会自动给文章中图片添加alt和title,并且是按照文章标题进行命名,默认开启', 'id' => 'gdk_seo_img', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', + 'type' => 'checkbox', ], [ 'name' => '外链GO跳转', - 'desc' => '启用', + 'desc' => '启用
启用后,文章外链会转化为/go?url=的类型', 'id' => 'gdk_link_go', 'type' => 'checkbox', ], [ 'name' => '百度自动&主动推送', - 'desc' => '该功能会自动给文章中图片添加alt和title,并且是按照文章标题进行命名,默认开启', + 'desc' => '启用
启用后可以采用自动推送和主动推送给百度', 'id' => 'gdk_baidu_push', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => '主动推送接口token', @@ -270,33 +195,33 @@ $gdk_options = [ 'type' => 'text', ], ], - '安全设置' => [ + '安全' => [ [ 'name' => '屏蔽各种不正常的请求', 'desc' => '该功能会将各种不正常的请求比如破解,注入类的屏蔽掉,默认开启', 'id' => 'gdk_block_requst', 'type' => 'radio', 'options' => [ - '1' => '开启', '0' => '禁用', + '1' => '启用', ], 'std' => '1', ], [ 'name' => '网站维护模式', - 'desc' => '开启 【启用后,未登录用户将看到一个简陋的维护页面】', + 'desc' => '启用
启用后,未登录用户将看到一个简陋的维护页面', 'id' => 'gdk_maintenance_mode', 'type' => 'checkbox', ], [ 'name' => '禁用REST API功能', - 'desc' => '禁用 【启用后,REST API功能将关闭,如果没不使用该功能的话,建议关闭】', + 'desc' => '禁用
启用后,REST API功能将关闭,如果没不使用该功能的话,建议关闭', 'id' => 'gdk_disable_restapi', 'type' => 'checkbox', ], [ 'name' => '保护用户暴露用户名', - 'desc' => '开启 【启用后,将隐藏掉用户的登录名,起到保护作用】', + 'desc' => '开启
启用后,将隐藏掉用户的登录名,起到保护作用', 'id' => 'gdk_hide_user_name', 'type' => 'checkbox', ], @@ -310,7 +235,7 @@ $gdk_options = [ 'id' => 'gdk_lock_login', 'type' => 'radio', 'options' => [ - '1' => '开启', + '1' => '启用', '0' => '禁用', ], 'std' => '1', @@ -331,13 +256,13 @@ $gdk_options = [ ], [ 'name' => '登录失败邮件通知', - 'desc' => '启用 【开启后,将所有登陆失败信息发邮件通知管理员】', + 'desc' => '启用
开启后,将所有登陆失败信息发邮件通知管理员,预计会收到很多邮件,不建议启用', 'id' => 'gdk_login_email', 'type' => 'checkbox', ], [ 'name' => '登陆数学验证', - 'desc' => '启用 【开启后,将会登陆页面增加数学验证码】', + 'desc' => '启用
开启后,将会登陆页面增加数学验证码', 'id' => 'gdk_login_verify', 'type' => 'checkbox', ], @@ -351,62 +276,34 @@ $gdk_options = [ 'id' => 'gdk_fuck_spam', 'type' => 'radio', 'options' => [ - '1' => '开启', '0' => '禁用', + '1' => '启用(推荐)', ], 'std' => '1', ], ], - '高级设置' => [ + '高级' => [ [ 'name' => '图片懒加载', - 'desc' => '该功能会降低因为图片而导致的打开速度慢问题,建议开启', + 'desc' => '启用
该功能会降低因为图片而导致的打开速度慢问题,建议开启', 'id' => 'gdk_lazyload', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '1', - ], - [ - 'name' => 'jQuery加载位置设置', - 'desc' => '选择一个适合自己网站的jQuery加载位置,默认是底部加载', - 'id' => 'gdk_jq', - 'type' => 'radio', - 'options' => [ - '1' => '底部加载,速度快', - '0' => '头部加载,兼容好', - ], - 'std' => '1', - ], - [ - 'name' => '友情链接分类ID', - 'desc' => '请选择专门用来存放友链的链接分类ID', - 'id' => 'gdk_link_id', - 'type' => 'number', + 'type' => 'checkbox', ], [ 'name' => 'HTML代码压缩', - 'desc' => '启用 【开启后,将压缩网页HTML代码,可读性会降低,但是性能略有提升】', + 'desc' => '启用
开启后,将压缩网页HTML代码,提高网页加载速度', 'id' => 'gdk_compress', 'type' => 'checkbox', ], - [ - 'name' => '文章目录', - 'desc' => '启用 【开启后,将在文章页显示一个文章目录】', - 'id' => 'gdk_article_list', - 'type' => 'checkbox', - ], [ 'name' => '侧边栏缓存', - 'desc' => '启用 【开启后,将会自动缓存小工具,如果想禁止缓存某个小工具,可以去小工具页面排除】', + 'desc' => '启用
开启后,将会自动缓存小工具,如果想禁止缓存某个小工具,可以去小工具页面排除', 'id' => 'gdk_sidebar_cache', 'type' => 'checkbox', ], [ - 'name' => '新窗口打开', - 'desc' => '禁用 【禁用后,所有文章链接将当前窗口打开】', + 'name' => '链接新窗口打开', + 'desc' => '启用
启用后,所有文章链接将在新标签页打开', 'id' => 'gdk_target_blank', 'type' => 'checkbox', ], @@ -415,19 +312,14 @@ $gdk_options = [ 'type' => 'title', ], [ - 'name' => '网站支付功能', - 'desc' => '开启网站支付功能需要HTTPS支持,需要开通Payjs使用,点击注册Payjs', + 'name' => '网站Psyjs支付功能', + 'desc' => '启用
网站支付功能需要HTTPS支持,需要开通Payjs使用,点击注册Payjs', 'id' => 'gdk_payjs', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => '支付宝支付通道', - 'desc' => '启用 【开启后,将增加支付宝支付方式,支付宝通道需要到payjs申请开通,如果开通的话,建议使用支付宝,因为费率便宜】', + 'desc' => '启用
开启后,将增加支付宝支付方式,支付宝通道需要到payjs申请开通,如果开通的话,建议使用支付宝,因为费率便宜', 'id' => 'gdk_payjs_alipay', 'type' => 'checkbox', ], @@ -458,18 +350,13 @@ $gdk_options = [ ], [ 'name' => 'CDN镜像加速', - 'desc' => '开启本功能可以将本站静态资源同步到远程CDN服务器,减轻本站的流量压力,提高网站整体速度,国内主流CDN服务商[七牛,又拍,阿里OSS,腾讯COS,华为BOS等等]均支持,默认关闭,配置好服务器端后开启', + 'desc' => '开启
本功能可以将本站静态资源同步到远程CDN服务器,减轻本站的流量压力,提高网站整体速度,国内主流CDN服务商[七牛,又拍,阿里OSS,腾讯COS,华为BOS等等]均支持,默认关闭,配置好服务器端后开启', 'id' => 'gdk_cdn', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => 'CDN域名', - 'desc' => '输入您的CDN域名,一般需要到cdn后台获取,必须带 http(s):// ,且结尾不能带/ ', + 'desc' => '输入您的CDN域名,一般需要到VDN后台获取,必须带 http(s):// ,且结尾不能带/ ', 'id' => 'gdk_cdn_host', 'type' => 'text', 'std' => '', @@ -489,22 +376,23 @@ $gdk_options = [ 'std' => 'wp-content|wp-includes', ], [ - 'name' => 'CDN服务商', + 'name' => '静态CDN服务商', 'desc' => '选择使用国内CDN服务商,此项主要影响CDN缩略图,请选择对应服务商', 'id' => 'gdk_cdn_serves', 'type' => 'radio', 'options' => [ '1' => '七牛云', '2' => '又拍云', - '3' => '腾讯云', - '4' => '阿里云', - '5' => '华为云', + '3' => '腾讯云COS', + '4' => '阿里云OSS', + '5' => '华为云OBS', + '6' => '百度云BOS', ], 'std' => '4', ], [ 'name' => 'CDN水印', - 'desc' => '启用【如果启用,请在七牛,又拍,OSS等CDN中设置自定义样式,名字为:water.jpg,分隔符为! 】', + 'desc' => '启用
启用后,请在七牛,又拍,OSS等CDN中设置自定义样式,名字为:water.jpg,分隔符为!', 'id' => 'gdk_cdn_water', 'type' => 'checkbox', ], @@ -514,13 +402,13 @@ $gdk_options = [ ], [ 'name' => '是否启用微信扫码登录', - 'desc' => '启用 【开启后,新建微信登录页面即可,另外需要HTTPS】', + 'desc' => '启用
开启后,可以使用微信扫码,另外需要HTTPS', 'id' => 'gdk_weauth_oauth', 'type' => 'checkbox', ], [ - 'name' => '是否启用强制微信登录', - 'desc' => '启用 【开启后,将禁用WordPress自带的登录,所有登录地址都跳转到微信的登录,如需临时使用自带登录,可以使用这个链接:你的域名/wp-login.php?loggedout=true】', + 'name' => '强制微信登录', + 'desc' => '启用
开启后,将禁用WordPress自带的登录,所有登录地址都跳转到微信的登录,如需临时使用自带登录,可以使用这个链接:你的域名/wp-login.php?loggedout=true', 'id' => 'gdk_weauth_force', 'type' => 'checkbox', ], @@ -530,27 +418,57 @@ $gdk_options = [ ], [ 'name' => '评论微信推送提醒', - 'desc' => '启用【开启后,如果网站有新的评论,可以给您的微信推送提醒,这个只是给网站管理员提醒,不涉及访客】', - 'id' => 'gdk_Server', + 'desc' => '启用
开启后,如果网站有新的评论,可以给管理员的微信推送提醒', + 'id' => 'gdk_workpush', 'type' => 'checkbox', ], + [ + 'name' => '企业微信推送应用ID', + 'desc' => '请输入您的企业微信推送应用ID', + 'id' => 'gdk_workpush_id', + 'type' => 'text', + ], + [ + 'name' => '企业微信推送应用Secret', + 'desc' => '请输入您的企业微信推送应用Secret', + 'id' => 'gdk_workpush_secret', + 'type' => 'text', + ], + [ + 'name' => '企业微信企业ID', + 'desc' => '请输入您的企业微信ID', + 'id' => 'gdk_work_id', + 'type' => 'text', + ], + [ + 'title' => '微信群发设置', + 'type' => 'title', + ], + [ + 'name' => '微信wxPushet应用Token', + 'desc' => '请输入Wxpuers应用Token,从wxpusher后台获取', + 'id' => 'gdk_wxpusher_key', + 'type' => 'text', + ], + [ + 'name' => '微信Wxpusher主题ID', + 'desc' => '请输入您的Wxpusher主题ID,可以从后台获取', + 'id' => 'gdk_wxpusher_id', + 'type' => 'text', + ], + [ + 'title' => '微信公众号设置', + 'type' => 'title', + ], [ 'name' => '微信公众号TOKEN', 'desc' => '请输入您的微信公众号TOKEN,微信公众号后台获取', 'id' => 'gdk_wxmp_token', 'type' => 'text', - 'std' => '', ], [ - 'name' => '微信推送KEY', - 'desc' => '请输入您的微信推送KEY', - 'id' => 'gdk_Server_key', - 'type' => 'text', - 'std' => '', - ], - [ - 'name' => '微信订阅号/公众号二维码', - 'desc' => '请输入您的微信订阅号/公众号二维码图片链接,不要想得太多,只是给主题调用的。', + 'name' => '微信公众号二维码', + 'desc' => '请输入您的微信订阅号/公众号二维码图片链接', 'id' => 'gdk_mp_qr', 'type' => 'text', 'std' => '', @@ -561,14 +479,9 @@ $gdk_options = [ ], [ 'name' => 'HTML5 桌面推送', - 'desc' => '该功能开启后会在浏览器进行信息推送,需要高级浏览器支持,默认关闭', + 'desc' => '启用
该功能开启后会在浏览器右下角进行信息推送', 'id' => 'gdk_h5notice', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => 'HTML5推送标题【必选】', @@ -618,21 +531,15 @@ $gdk_options = [ ], [ 'name' => 'SMTP邮箱发送', - 'desc' => '该功能利用第三方SMTP邮箱服务发送邮件,比如评论邮件,需要配置好再开启', + 'desc' => '启用
该功能利用第三方SMTP邮箱服务发送邮件,比如评论邮件,需要配置好再开启', 'id' => 'gdk_smtp', - 'type' => 'radio', - 'options' => [ - '0' => '禁用', - '1' => '开启', - ], - 'std' => '0', + 'type' => 'checkbox', ], [ 'name' => '发件人昵称', 'desc' => '请输入您的网站名称,比如:云落', 'id' => 'gdk_smtp_username', 'type' => 'text', - 'std' => '', ], [ 'name' => 'SMTP服务器地址', @@ -653,14 +560,12 @@ $gdk_options = [ 'desc' => '请输入您的邮箱地址,比如云落的sp91@qq.com', 'id' => 'gdk_smtp_mail', 'type' => 'text', - 'std' => '', ], [ 'name' => '邮箱密码', 'desc' => '请输入您的邮箱授权码,注意不同邮箱服务器的密码不一样,有的是密码,有的比如QQ邮箱就是授权码', 'id' => 'gdk_smtp_password', 'type' => 'password', - 'std' => '', ], [ 'title' => '自定义代码', @@ -671,28 +576,24 @@ $gdk_options = [ 'desc' => '代码将插入到head区域', 'id' => 'gdk_custom_head_code', 'type' => 'textarea', - 'std' => '', ], [ 'name' => '网站底部自定义代码', 'desc' => '代码将插入到foot区域', 'id' => 'gdk_custom_foot_code', 'type' => 'textarea', - 'std' => '', ], [ 'name' => '文章顶部自定义内容', 'desc' => '在文章顶部插入一个内容', 'id' => 'gdk_artical_top', 'type' => 'textarea', - 'std' => '', ], [ 'name' => '文章底部自定义内容', 'desc' => '在文章底部插入一个内容', 'id' => 'gdk_artical_bottom', 'type' => 'textarea', - 'std' => '', ], ], ]; diff --git a/framework/plugin-options.php b/framework/plugin-options.php index 8da146f..74adab3 100644 --- a/framework/plugin-options.php +++ b/framework/plugin-options.php @@ -254,9 +254,12 @@ break; .filter-links li>a:hover{color:#666} .filter-links a:focus{color:#6b48ff;box-shadow:none} -.gdk_option input[type=radio]:checked::before { +.gdk_option input[type=checkbox]:checked::before,.gdk_option input[type=radio]:checked::before { background-color: #6b48ff; } +.gdk_option input[type=checkbox] { + margin:4px; +} .gdk_option input[type=radio]:focus, .gdk_option input[type=checkbox]:focus{ box-shadow: 0 0 0 1px #6b48ff; } diff --git a/functions/Common.php b/functions/Common.php index 6e3e95f..541a593 100644 --- a/functions/Common.php +++ b/functions/Common.php @@ -6,6 +6,11 @@ function gdk_rand_color() { $rndKey = array_rand($arr); echo $arr[$rndKey]; } +//获取友情链接ID,默认是第一个创建的分类 +function gdk_link_id() { + $arr = get_terms( 'link_category', 'orderby=id&hide_empty=0' ); + return $arr[0]->term_id; +} /** * 获取摘要 */ diff --git a/functions/shortcode.php b/functions/shortcode.php index 7da0544..fe2ca84 100644 --- a/functions/shortcode.php +++ b/functions/shortcode.php @@ -448,49 +448,6 @@ function contentblock_shortcode( $atts, $content = null ) { add_shortcode( 'cb', 'contentblock_shortcode' ); - -// -function points_view($content){ - $cookie_name = 'huoduan_wechat_fans'; - - if (preg_match_all('/([\s\S]*?)/i', $content, $hide_words)) - { - $re = '/【(.*)】/i'; -$str = '我在这里,这里不是付费内容 -【10】dssdssdfs我在这里,这里是付费内容 -第二行 -'; - -preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0); -$points = $matches[1][0]; - $wechatfans = get_option('huoduan_wechatfans'); - $cv = md5($wechatfans['wechat_key'].$cookie_name.'huoduan.com'); - $vtips=''; - if(isset($_POST['huoduan_verifycode'])){ - if($_POST['huoduan_verifycode']==$wechatfans['wechat_code']){ - setcookie($cookie_name, $cv ,time()+(int)$wechatfans['wechat_day']*86400, "/"); - $_COOKIE[$cookie_name] = $cv; - }else{ - $vtips=''; - } - } - $cookievalue = isset($_COOKIE[$cookie_name])?$_COOKIE[$cookie_name]:''; - - if($cookievalue==$cv){ - $content = str_replace($hide_words[0], '
'.$hide_words[0][0].'
', $content); - }else{ - - $hide_notice = '
'.$wechatfans['wechat_name'].'此处内容已经被作者隐藏,请输入验证码查看内容
验证码:
请关注本站微信公众号,回复“'.$wechatfans['wechat_keyword'].'”,获取验证码。在微信里搜索“'.$wechatfans['wechat_name'].'”或者“'.$wechatfans['wechat_account'].'”或者微信扫描右侧二维码都可以关注本站微信公众号。
'.$vtips; - - $content = str_replace($hide_words[0], $hide_notice, $content); - } - - } - return $content; -} - -add_filter('the_content', 'points_view'); - //WordPress 段代码按钮集合 function gdk_shortcode_list() { diff --git a/gdk.php b/gdk.php index 5f83178..3bf3a5d 100644 --- a/gdk.php +++ b/gdk.php @@ -3,10 +3,10 @@ Plugin Name: GitCafe Development Kit 极客公园开发套件 Plugin URI: https://gitcafe.net/ Description: 为WordPress主题开发提供底层支持 -Version: 0.0.3 +Version: 0.0.4 Author: 云落 Author URI: https://gitcafe.net/ -Compatible:5.3.2 +Compatible:5.8.1 */ //万能的开头 @@ -28,7 +28,7 @@ if (!version_compare(PHP_VERSION, '7.2', '>=')) { } //定义各种常量 -define('GDK_PLUGIN_VER', '0.0.3'); +define('GDK_PLUGIN_VER', '0.0.4'); define('GDK_PLUGIN_FILE', __FILE__); //插件入口文件 define('GDK_BASE_URL', plugin_dir_url(__FILE__)); //插件目录url define('GDK_ROOT_PATH', plugin_dir_path(__FILE__)); //插件目录路径 diff --git a/public/daohang.php b/public/daohang.php index cc242e9..bda9ea2 100644 --- a/public/daohang.php +++ b/public/daohang.php @@ -1,6 +1,6 @@ link_description */ - if(empty($bookmark->link_image)){ - $icon = 'https://img12.360buyimg.com/ddimg/jfs/t1/130599/4/13000/527/5f8ef17aE60de6b3e/4da08e59f8e12dec.png'; - }else{ - $icon = $bookmark->link_image; - } + $icon = $bookmark->link_image ?? 'https://img12.360buyimg.com/ddimg/jfs/t1/130599/4/13000/527/5f8ef17aE60de6b3e/4da08e59f8e12dec.png'; + $output .= '
' . $bookmark->link_name . '
' . $bookmark->link_notes . '
'; } @@ -50,8 +47,9 @@ function gdk_get_the_link_items($id = null) } function gdk_get_link_items() -{ - $linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=' . gdk_option('gdk_link_id')); +{ + $linkid = gdk_link_id(); + $linkcats = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=' . $linkid ); $result = ''; foreach ($linkcats as $linkcat) { $result .= '
@@ -78,22 +76,10 @@ function gdk_create_html_daohang() @keyframes fadeIn{0%{opacity:0;-webkit-animation-timing-function:cubic-bezier(0.3,0,0,1);animation-timing-function:cubic-bezier(0.3,0,0,1)}76.92%{opacity:1;-webkit-animation-timing-function:linear;animation-timing-function:linear}100%{opacity:1}}@keyframes fadeOut{0%{opacity:1;-webkit-animation-timing-function:cubic-bezier(0.3,0,0,1);animation-timing-function:cubic-bezier(0.3,0,0,1)}76.92%{opacity:0.5;-webkit-animation-timing-function:linear;animation-timing-function:linear}100%{opacity:0}}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:transparent}body{font-family:Helvetica,Arial,"PingFang SC","Microsoft YaHei","WenQuanYi Micro Hei","tohoma,sans-serif";font-size:14px;line-height:1.42857143;color:#333;background-color:#fff;margin:0;padding:0}@media screen and (max-width:767px){body{background-color:#f9f9f9;padding-right:0 !important}}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;-webkit-appearance:none;box-shadow:none}::-moz-selection{background:#111;color:#fff}::selection{background:#111;color:#fff}a{text-decoration:none}a:hover{color:#3d83ff}::-webkit-scrollbar{width:4px;height:4px;background-color:#222}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,0.3);background-color:#222}::-webkit-scrollbar-thumb{width:2px;background-color:#888}.container{padding-right:10px;padding-left:10px;margin-right:auto;margin-left:auto}.container:after,.row:after,.row-mobile:after{clear:both;content:"";display:table}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media screen and (max-width:767px){.hidden-xs{display:none}}.container-fluid{padding-right:10px;padding-left:10px;margin-right:auto;margin-left:auto}.row{margin-right:-10px;margin-left:-10px}.row-mobile{margin-right:-10px;margin-left:-10px}@media screen and (max-width:767px){.row-mobile{margin-left:0;margin-right:0}}.md-3-5,.md-8-5,.xs-1,.sm-1,.md-1,.lg-1,.xs-2,.sm-2,.md-2,.lg-2,.xs-3,.sm-3,.md-3,.lg-3,.xs-4,.sm-4,.md-4,.lg-4,.xs-5,.sm-5,.md-5,.lg-5,.xs-6,.sm-6,.md-6,.lg-6,.xs-7,.sm-7,.md-7,.lg-7,.xs-8,.sm-8,.md-8,.lg-8,.xs-9,.sm-9,.md-9,.lg-9,.xs-10,.sm-10,.md-10,.lg-10,.xs-11,.sm-11,.md-11,.lg-11,.xs-12,.sm-12,.md-12,.lg-12{position:relative;min-height:1px;padding-right:10px;padding-left:10px}.xs-1,.xs-2,.xs-3,.xs-4,.xs-5,.xs-6,.xs-7,.xs-8,.xs-9,.xs-10,.xs-11,.xs-12{float:left}.xs-12{width:100%}.xs-11{width:91.66666667%}.xs-10{width:83.33333333%}.xs-9{width:75%}.xs-8{width:66.66666667%}.xs-7{width:58.33333333%}.xs-6{width:50%}.xs-5{width:41.66666667%}.xs-4{width:33.33333333%}.xs-3{width:25%}.xs-2{width:16.66666667%}.xs-1{width:8.33333333%}@media (min-width:768px){.sm-1,.sm-2,.sm-3,.sm-4,.sm-5,.sm-6,.sm-7,.sm-8,.sm-9,.sm-10,.sm-11,.sm-12{float:left}.sm-12{width:100%}.sm-11{width:91.66666667%}.sm-10{width:83.33333333%}.sm-9{width:75%}.sm-8{width:66.66666667%}.sm-7{width:58.33333333%}.sm-6{width:50%}.sm-5{width:41.66666667%}.sm-4{width:33.33333333%}.sm-3{width:25%}.sm-2{width:16.66666667%}.sm-1{width:8.33333333%}}@media (min-width:992px){.md-3-5,.md-8-5,.md-1,.md-2,.md-3,.md-4,.md-5,.md-6,.md-7,.md-8,.md-9,.md-10,.md-11,.md-12{float:left}.md-12{width:100%}.md-11{width:91.66666667%}.md-10{width:83.33333333%}.md-9{width:75%}.md-8-5{width:70.833333333%}.md-8{width:66.66666667%}.md-7{width:58.33333333%}.md-6{width:50%}.md-5{width:41.66666667%}.md-4{width:33.33333333%}.md-3-5{width:29.16666666%}.md-3{width:25%}.md-2{width:16.66666667%}.md-1{width:8.33333333%}.md-offset-12{margin-left:100%}.md-offset-11{margin-left:91.66666667%}.md-offset-10{margin-left:83.33333333%}.md-offset-9{margin-left:75%}.md-offset-8{margin-left:66.66666667%}.md-offset-7{margin-left:58.33333333%}.md-offset-6{margin-left:50%}.md-offset-5{margin-left:41.66666667%}.md-offset-4{margin-left:33.33333333%}.md-offset-3{margin-left:25%}.md-offset-2{margin-left:16.66666667%}.md-offset-1{margin-left:8.33333333%}.md-offset-0{margin-left:0}}@media (min-width:1300px){.lg-1,.lg-2,.lg-3,.lg-4,.lg-5,.lg-6,.lg-7,.lg-8,.lg-9,.lg-10,.lg-11,.lg-12{float:left}.lg-12{width:100%}.lg-11{width:91.66666667%}.lg-10{width:83.33333333%}.lg-9{width:75%}.lg-8{width:66.66666667%}.lg-7{width:58.33333333%}.lg-6{width:50%}.lg-5{width:41.66666667%}.lg-4{width:33.33333333%}.lg-3{width:25%}.lg-2{width:16.66666667%}.lg-1{width:8.33333333%}.lg-pull-12{right:100%}.lg-pull-11{right:91.66666667%}.lg-pull-10{right:83.33333333%}.lg-pull-9{right:75%}.lg-pull-8{right:66.66666667%}.lg-pull-7{right:58.33333333%}.lg-pull-6{right:50%}.lg-pull-5{right:41.66666667%}.lg-pull-4{right:33.33333333%}.lg-pull-3{right:25%}.lg-pull-2{right:16.66666667%}.lg-pull-1{right:8.33333333%}.lg-pull-0{right:auto}.lg-push-12{left:100%}.lg-push-11{left:91.66666667%}.lg-push-10{left:83.33333333%}.lg-push-9{left:75%}.lg-push-8{left:66.66666667%}.lg-push-7{left:58.33333333%}.lg-push-6{left:50%}.lg-push-5{left:41.66666667%}.lg-push-4{left:33.33333333%}.lg-push-3{left:25%}.lg-push-2{left:16.66666667%}.lg-push-1{left:8.33333333%}.lg-push-0{left:auto}.lg-offset-12{margin-left:100%}.lg-offset-11{margin-left:91.66666667%}.lg-offset-10{margin-left:83.33333333%}.lg-offset-9{margin-left:75%}.lg-offset-8{margin-left:66.66666667%}.lg-offset-7{margin-left:58.33333333%}.lg-offset-6{margin-left:50%}.lg-offset-5{margin-left:41.66666667%}.lg-offset-4{margin-left:33.33333333%}.lg-offset-3{margin-left:25%}.lg-offset-2{margin-left:16.66666667%}.lg-offset-1{margin-left:8.33333333%}.lg-offset-0{margin-left:0}}.board{box-shadow:0px 0px 6px #e3e3e3;background:#fff}.card{box-shadow:0px 2px 0px rgba(170,170,170,0.1);background:#fff;margin-bottom:20px;border-radius:3px;margin-left:2px;margin-right:2px}.card .card-heading{overflow:hidden;margin-bottom:7px;display:block;cursor:pointer;padding:10px 18px 0;color:#333}.card .card-heading:hover{color:#3d83ff}.card .card-heading .card-icon{width:32px;height:32px;float:left;display:block}.card .card-heading .card-icon img{display:block;width:100%;height:100%}.card .card-heading .card-title{display:block;padding-left:40px;margin-top:5px;font-weight:700;font-size:15px;color:white}.card .card-body{cursor: pointer;color:#666666;font-size:12px;text-overflow:ellipsis;overflow:hidden;margin-bottom:2px;padding: 8px 6px;}.card .card-footer{padding:0 18px 8px}.card .card-footer table{width:100%}.card .card-footer table td{text-align:center;cursor:pointer;color:#bbb}.card .card-footer table .done{color:#ff1677}.card .card-footer table .btn-view{text-align:left;font-size:12px;color:#bbb}.card .card-footer table .btn-view a{color:#bbb}.panel-body .card:hover{box-shadow:0 4px 4px rgba(170,170,170,0.2)}.panel{background-color:#f9f9f9;border-radius:6px;padding:20px 20px;margin-bottom:40px}@media screen and (max-width:767px){.panel{padding:0}}.panel .panel-title{padding:8px 12px;display:inline-block;margin-bottom:16px;font-size:12px;font-weight:900;color:#666}.panel .panel-title .iconfont{font-weight:100}.panel .panel-body{overflow:hidden}.category-item{height:88px;display:flex;align-items:center;justify-content:center;color:#333}.category-item i{font-size:32px;margin-right:15px}.mobile-header-wrap{display:none;z-index:100;height:60px;position:fixed;top:0;left:0;right:0;background-color:#171717}@media screen and (max-width:767px){.mobile-header-wrap{display:block}}.mobile-header-wrap .mobile-logo{display:block;text-decoration:none;margin:10px auto;width:fit-content;}.mobile-header-wrap .mobile-logo img{width:auto;height:40px;display:block}.btn-mobile-sidenav{left:0;top:0;width:40px;height:100%;color:#ddd;cursor:pointer;display:none}@media screen and (max-width:767px){.btn-mobile-sidenav{display:block}}.nav-bar-animate span{opacity:1;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.nav-bar-animate span:nth-last-child(3){opacity:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.nav-bar-animate span:nth-last-child(2){opacity:0}.nav-bar{padding:24px 50px 40px 16px;position:fixed;z-index:1000}.nav-bar span{margin-left:auto;margin-right:auto;display:block;width:20px;height:1px;margin-bottom:6px;position:relative;background:#fff;border-radius:3px;z-index:1;-webkit-transform-origin:20px;transform-origin:20px;-webkit-transition:background 0.5s cubic-bezier(0.77,0.2,0.05,1),opacity 0.55s ease,-webkit-transform 0.5s cubic-bezier(0.77,0.2,0.05,1);transition:background 0.5s cubic-bezier(0.77,0.2,0.05,1),opacity 0.55s ease,-webkit-transform 0.5s cubic-bezier(0.77,0.2,0.05,1);transition:transform 0.5s cubic-bezier(0.77,0.2,0.05,1),background 0.5s cubic-bezier(0.77,0.2,0.05,1),opacity 0.55s ease;transition:transform 0.5s cubic-bezier(0.77,0.2,0.05,1),background 0.5s cubic-bezier(0.77,0.2,0.05,1),opacity 0.55s ease,-webkit-transform 0.5s cubic-bezier(0.77,0.2,0.05,1)}.hide-sidenav{transform:translate(-230px,0) !important}.show-sidenav{transform:translate(0,0) !important}.sidenav-mark{background:rgba(0,0,0,0.75);height:100%;left:0;position:fixed;top:60px;width:100%;-webkit-animation-name:fadeIn;animation-name:fadeIn;-webkit-animation-duration:530ms;animation-duration:530ms;-webkit-animation-timing-function:linear;animation-timing-function:linear;-webkit-animation-direction:normal;animation-direction:normal;-webkit-animation-delay:0s;animation-delay:0s;z-index:199}.sidenav{-webkit-overflow-scrolling:touch;width:230px;position:fixed;z-index:200;top:0;left:0;bottom:-100px;background-color:#171717;padding:31px 0;color:#ccc}@media screen and (min-width:768px) and (max-width:991px){.sidenav{width:180px}}@media screen and (max-width:767px){.sidenav{transform:translate(-230px,0);transition:transform 430ms cubic-bezier(0.3,0,0,1)}}.sidenav .btn-mobile-close{display:none;position:absolute;top:0px;padding-top:18px;padding-left:12px;width:180px;height:40px}@media screen and (max-width:767px){.sidenav .btn-mobile-close{display:block}}.sidenav .copyright{display:block;text-align:center;color:#686868;font-size:12px;padding-top:12px}.sidenav .copyright:hover{color:#fff}.sidenav .logo{position:relative;display:block;text-align:center}.sidenav .logo img{width:114px;display:block;margin:0 auto;z-index:2}.sidenav .logo img.christmas{position:absolute;z-index:3;top:-11px;left:76px;width:42px;height:auto} @media screen and (min-width:768px) and (max-width:991px){.sidenav .logo img.christmas{top:-11px;left:51px}}.sidenav .site-description{color:#686868;text-align:center;margin-bottom:20px;font-size:12px}.sidenav .nav-item{border-top:1px solid #1f1f1f}.sidenav .nav-item:last-child{border-bottom:1px solid #2e2e2e}.sidenav .nav-item:hover{background-color:#fff}.sidenav .nav-item:hover a{color:#000}.sidenav .nav-item a{color:#fff;text-align:center;font-size:14px;font-weight:700;padding:7px;display:block}.sidenav .nav-item a .csz{display:block;text-align:center;font-size:20px;font-weight:200}.sidenav .nav-item a span{text-align:center;position:relative;top:-2px}.sidenav .nav-item.active{background-color:#fff}.sidenav .nav-item.active a{color:#000} .sidenav .nav-tags{display:none;list-style:none;padding:0;overflow:scroll;overflow-x:hidden;margin:0} -/* @media screen and (max-width:767px){.sidenav .nav-tags{display:none !important}} -@media screen and (min-height:900px){} -@media screen and (min-height:760px) and (max-height:899px){.sidenav .nav-tags{max-height:320px} } */ -/*@media screen and (min-height:630px) and (max-height:759px){.sidenav .nav-tags{max-height:200px}}*/ -/*@media screen and (max-height:629px){.sidenav .nav-tags{max-height:0}}*/ .sidenav .nav-tags .active{background-color:#222}.sidenav .nav-tags .active a{color:#fff}.sidenav .nav-tags li{padding-right:0}.sidenav .nav-tags li:hover{background:#222}.sidenav .nav-tags li a{text-decoration:none;color:#686868;display:block;padding:9px;font-size:12px;text-align:center}.sidenav .nav-tags li a:hover{color:#fff}.sidenav .nav-tags li a .csz{font-size:16px;margin-right:8px}.sidenav-ad{font-size:12px;color:#686868;display:block;text-align:center;padding-top:12px;border-top:1px solid #1f1f1f}.sidenav-ad:hover{color:#fff}.tool{margin-bottom:20px}.tool .tool-img{margin-bottom:6px;height:106px;border-radius:4px;position:relative}.tool .tool-img img{display:block;width:auto;height:106px;margin:0 auto}.tool .tool-img .tool-platform{display:none;position:absolute;bottom:0;width:100%;height:30px;background:rgba(0,0,0,0.7);text-align:right;padding-right:10px;padding-top:6px}.tool .tool-img .tool-platform i{color:#fff;font-size:14px;margin-left:8px}.tool .tool-title{font-size:14px;font-weight:800;color:#171717}.tool .tool-body{font-size:12px;color:#bbb}@media screen and (max-width:767px){body{padding-right:0 !important}}.main-wrap{margin-left:230px}@media screen and (min-width:768px) and (max-width:991px){.main-wrap{margin-left:180px}}@media screen and (max-width:767px){.main-wrap{margin-left:0}}.friends-description{font-size:12px;color:#bbb;margin-top:4px;float:right}@media screen and (max-width:767px){.friends-description{display:none}}.friends-email{font-size:12px;color:#000;margin-top:4px;float:right}@media screen and (max-width:767px){.friends-email{display:none}}.main{padding-top:30px;margin:0 auto}@media screen and (min-width:1300px){.main{width:1050px}}@media screen and (min-width:992px) and (max-width:1299px){.main{width:760px}}@media screen and (min-width:768px) and (max-width:991px){.main{width:580px}}@media screen and (max-width:767px){.main{margin:0 10px;padding-top:68px}}.main .selected-nav{padding:16px 20px;border-radius:6px;margin-bottom:17px;height:55px;overflow:hidden}@media screen and (max-width:767px){.main .selected-nav{padding:16px 12px}}.main .selected-nav .nav-left{float:left;position:relative;z-index:10}.main .selected-nav .nav-left .selected-nav-cn{font-size:16px;font-weight:700;color:#666;margin-right:6px;display:inline-block}.main .selected-nav .nav-left .selected-nav-en{color:#bbb;display:inline-block}.main .selected-nav .selected-nav-link-wrapper{margin-right:74px;transform:translateY(-43px);line-height:22px}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item{margin-bottom:20px;text-align:right}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-description,.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-linkname{font-size:12px}@media screen and (max-width:767px){.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-description,.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-linkname{display:none}}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-description{color:#bbb;margin-right:6px;margin-top:5px}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-linkname{margin-top:5px}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-linkname a{color:#000}.main .selected-nav .selected-nav-link-wrapper .selected-nav-link-item .selected-nav-linkname a:hover{color:#3d83ff}.main .selected-nav .navigator{float:right;margin-top:-2px;margin-left:10px}/*@media screen and (max-width:767px){.main .selected-nav .navigator{display:none}*/}.main .selected-nav .navigator a{display:inline-block;border:1px solid #ececf5;height:27px;width:32px;text-align:center;transition:all 0.5s}.main .selected-nav .navigator a i{font-size:12px;font-weight:900;color:gray;line-height:27px}.main .selected-nav .navigator a:hover{background:#f2f2f2}.main .selected-nav .navigator a.up{border-radius:2px 0 0 2px}.main .selected-nav .navigator a.down{border-left:none;border-radius:0 2px 2px 0}.select-bar{list-style:none;padding:0;overflow:hidden}.select-bar ul{display:inline-block;float:right;box-shadow:0px 0px 6px #e3e3e3;background:#fff;margin-right:1px;border-radius:4px;padding:0;margin-top:0}.select-bar li{display:inline-block}.select-bar li:last-child a{border-bottom-right-radius:4px;border-top-right-radius:4px;border-bottom-left-radius:0;border-top-left-radius:0}.select-bar li a{border-bottom-left-radius:4px;border-top-left-radius:4px;display:inline-block;color:#171717;font-size:14px;padding:3px 10px}.select-bar li a.active{background-color:#171717;color:#fff}.page img{display:block;max-width:100%;height:auto;margin:12px auto}.page p{margin:8px 0}#link-tooltip{position:absolute;z-index:100;top:200px;left:300px;min-width:80px;max-width:220px;width:auto;font-size:15px;font-weight:600;padding:8px 12px;background:#171717;background:#eee;border-radius:4px;line-height:18px;color:#A1A7B7;display:none}@media screen and (max-width:767px){#link-tooltip{display:none !important}}#link-tooltip .tooltip-title{color:#171717;margin-bottom:4px}#link-tooltip .tooltip-content{color:#171717;font-size:13px;font-weight:100;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.footer{margin-top:38px;margin-bottom:18px;color:#bbb;font-size:12px;text-align:left}@media screen and (max-width:767px){.footer{text-align:center} -.card-body{ - - height:43px; - } +.card-body{ height:43px;} }.footer a{margin-left:10px;color:#000}.footer a:hover{color:#3d83ff}@media screen and (max-width:767px){.footer .footer-link{display:block}}.footer .footer-top-border{width:70%;height:1px;margin:0 auto}.footer-at{overflow:hidden}.footer-at a{display:block}.footer-at a img{display:block;width:100%;height:auto}.bg-lvs1{background-color:#2ecc71}.bg-lvs2{background-color:#27ae60}.bg-lvs3{background-color:#3498db}.bg-lvs4{background-color:#2980b9}.bg-lvs5{background-color:#9b59b6}.bg-lvs6{background-color:#8e44ad}.bg-lvs7{background-color:#34495e}.bg-lvs8{background-color:#2c3e50}.bg-lvs9{background-color:#f1c40f}.bg-lvs10{background-color:#f39c12}.bg-lvs11{background-color:#2470a0}.bg-lvs12{background-color:#a696c8}.bg-lvs13{background-color:#060608}.bg-lvs14{background-color:#ff585d}.bg-lvs15{background-color:#9dd3a8}.bg-lvs16{background-color:#dd0a35}.bg-lvs17{background-color:#ff8a5c}.bg-lvs18{background-color:#f5587b}.bg-lvs19{background-color:#24a8ac}.bg-lvs20{background-color:#0087cb}.bg-lvs21{background-color:#ffa200}.bg-lvs22{background-color:#014955}.bg-lvs23{background-color:#08ffc8}.bg-lvs24{background-color:#204969}.bg-lvs25{background-color:#2d248a}.panel-title img{width:15px;margin:0 8px;} - - .card-title{ - text-overflow: ellipsis; - white-space: nowrap; -} +.card-title{text-overflow: ellipsis;white-space: nowrap;} @@ -119,7 +105,7 @@ function gdk_create_html_daohang() '; foreach ($linkcats1 as $linkcat) { echo '
  • ' . $linkcat->name . '
  • '; @@ -146,9 +132,6 @@ $linkcats1 = get_terms('link_category', 'orderby=count&hide_empty=1&exclude=7');