1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-25 01:42:22 +02:00

删除文件

This commit is contained in:
云落 2020-01-28 02:07:35 +08:00
parent 9f02958b82
commit 156430bc31
16 changed files with 0 additions and 7468 deletions

View file

@ -1,115 +0,0 @@
jQuery(document).on('ready', function() {
var ajax_url = nicetheme.ajax_url
retrieve_database_items_count()
function acf_site_tips(type, msg) {
var c = type ? 'updated' : 'error';
var html = '<div class="nicetheme-notice notice '+ c +'">'
+ '<p>' + msg + '</p>'
+ '</div>'
jQuery('.acf-settings-wrap h1').append(html);
var tipsDOM = jQuery('.nicetheme-notice');
window.setTimeout(function(){
tipsDOM.remove();
}, 3000);
}
function acf_fire(data, successCallback = function() {}, failCallback = function() {}) {
jQuery.ajax({
url: ajax_url,
type: 'POST',
dataType: 'html',
data: data,
})
.done(function(data) {
data = JSON.parse(data)
if (data.s == 200) {
acf_site_tips(1, data.m)
successCallback()
} else {
acf_site_tips(0, data.m)
failCallback()
}
})
.fail(function() {
acf_site_tips(0, '网络错误,请稍后再试!')
failCallback()
});
}
// 显示数据库优化内容
function retrieve_database_items_count() {
jQuery.ajax({
url: ajax_url,
type: 'POST',
dataType: 'html',
data: { action: 'nc_database_clean_up_count' },
})
.done(function(data) {
counts = JSON.parse(data).counts
var cleanupForm = jQuery('.acf-database-cleanup-form')
var cleanupFormKeys = Object.keys(counts)
cleanupFormKeys.forEach(function (item) {
cleanupForm.find('.' + item).text(counts[item])
counts[item] == 0 && cleanupForm.find('input[data-action_type="' + item + '"]').prop('disabled', 'disabled')
})
})
.fail(function() {
acf_site_tips(0, '网络错误,请刷新页面重试!')
});
}
jQuery(document).on('click', 'input[data-action=nc_test_email]', function(event) {
event.preventDefault();
var data = jQuery(this).data();
acf_fire(data)
});
jQuery(document).on('click', 'input[data-action=nc_database_optimize]', function(event) {
event.preventDefault();
var data = jQuery(this).data();
acf_fire(data)
});
jQuery(document).on('click', 'input[data-action_type]', function(event) {
event.preventDefault();
var data = jQuery(this).data();
acf_fire(data, function() {
retrieve_database_items_count()
}, function() {
retrieve_database_items_count()
})
});
jQuery(document).on('keydown', '.wp-block-code textarea, .mce-highlight textarea', function(e){
if(e.keyCode == 9 && !e.shiftKey){
e.preventDefault();
var indent = ' ';
var start = this.selectionStart;
var end = this.selectionEnd;
var selected = window.getSelection().toString();
selected = indent + selected.replace(/\n/g,'\n'+indent);
this.value = this.value.substring(0,start) + selected + this.value.substring(end);
this.setSelectionRange(start+indent.length,start+selected.length);
}else if( e.keyCode == 9 && e.shiftKey ){
e.preventDefault();
var indent = ' ';
var start = this.selectionStart;
var end = this.selectionEnd;
var selected = window.getSelection().toString();
this.value = this.value.substring(0,start).replace(indent,'') + selected + this.value.substring(end);
this.setSelectionRange(start-indent.length,start-selected.length-indent.length);
}
});
})

File diff suppressed because it is too large Load diff

View file

@ -1,205 +0,0 @@
{
"key": "group_5bfa538e2d540",
"title": "SEO 设置",
"fields": [
{
"key": "field_5bfa53958ae40",
"label": "自定义标题",
"name": "seo_title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_5c00e509e0772",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "留空为不启用",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5bfb81023e1d1",
"label": "手动设置页面关键词Meta keywords",
"name": "seo_manual_keywords",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_5c00e509e0772",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"default_value": 0,
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
},
{
"key": "field_5bfa53b74f618",
"label": "自定义关键词",
"name": "seo_keywords",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_5bfb81023e1d1",
"operator": "==",
"value": "1"
},
{
"field": "field_5c00e509e0772",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "留空为不启用",
"maxlength": "",
"rows": "",
"new_lines": ""
},
{
"key": "field_5bfb81163e1d2",
"label": "手动设置页面描述Meta description",
"name": "seo_manual_des",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_5c00e509e0772",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "",
"default_value": 0,
"ui": 0,
"ui_on_text": "",
"ui_off_text": ""
},
{
"key": "field_5bfa53c54f619",
"label": "自定义描述",
"name": "seo_description",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_5bfb81163e1d2",
"operator": "==",
"value": "1"
},
{
"field": "field_5c00e509e0772",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "留空为不启用",
"maxlength": "",
"rows": "",
"new_lines": ""
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "website"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "bookmovie"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "news"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "music"
}
]
],
"menu_order": 3,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"config_save_path": "plugins\/nicetheme-jimu\/modules\/base\/conf",
"modified": 1575518434
}

View file

@ -1,82 +0,0 @@
{
"key": "group_5c00e9a304f98",
"title": "分类法相关 SEO 设置",
"fields": [
{
"key": "field_5c00e9b1c9698",
"label": "自定义标题",
"name": "taxonomy_title",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5c00eab1c9699",
"label": "自定义关键词",
"name": "taxonomy_keywords",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"prepend": "",
"append": "",
"maxlength": ""
},
{
"key": "field_5c00eac1c969a",
"label": "自定义描述",
"name": "taxonomy_desc",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"placeholder": "",
"maxlength": "",
"rows": "",
"new_lines": ""
}
],
"location": [
[
{
"param": "taxonomy",
"operator": "==",
"value": "all"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"config_save_path": "plugins\/nc-plugins\/modules\/base\/conf",
"modified": 1552982935
}

View file

@ -1,59 +0,0 @@
{
"key": "group_5c4dc918e5ca5",
"title": "关于 WP积木 插件",
"fields": [
{
"key": "field_5c4dcb364bf8d",
"label": "介绍",
"name": "",
"type": "message",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "WP 积木插件 2019年3月20日 更名为WP 积木 。\r\n\r\n目前来说WordPress的使用覆盖全世界使用范围从个人博客到企业网站等等通过WordPress主题+WordPress插件绝大多数的WordPress使用者可以搭建出自己的网站。但往往都遇到一个情况便是主题和插件的样式不统一或者设计过于规范统一不尽完美和匹配。要么忍受要么有能力的进行二次开发。\r\n\r\n而nicetheme 是一个不将就的设计开发团队。\r\n\r\n因此我们希望把一些功能模块化做成小而美的、匹配主题设计风格的积木——积木从而搭建属于自己style的小窝网站。",
"new_lines": "wpautop",
"esc_html": 0
},
{
"key": "field_5c4dcdb2f8c07",
"label": "插件详细介绍&更新日志",
"name": "",
"type": "message",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "请详看官网https:\/\/www.nicetheme.cn\/jimu",
"new_lines": "wpautop",
"esc_html": 0
}
],
"location": [
[
{
"param": "options_page",
"operator": "==",
"value": "nc-intro"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"config_save_path": "plugins\/nc-plugins\/modules\/base\/conf",
"modified": 1553093834
}

View file

@ -1,138 +0,0 @@
<?php
/*
Plugin Name: NICETHEME 基础拓展
Plugin URI: https://www.nicetheme.cn
Description: WordPress 常用优化操作 & SEO
Version: 1.0
Compatible: Cosy|Grace|nicetheme|LivingCoral
Nicetheme Module: OptimizeUp
Author: PCDotFan
Author URI: https://www.nicetheme.cn
*/
define( 'NC_OPTIMIZEUP_DIR', dirname(__FILE__) );
define( 'NC_OPTIMIZEUP_RELATIVE_DIR', NC_OPTIMIZEUP_DIR );
define( 'NC_OPTIMIZEUP_CONF_DIR', NC_OPTIMIZEUP_DIR . '/conf/' );
define( 'NC_OPTIMIZEUP_VERSION', '1.0' );
define( 'NC_OPTIMIZEUP__FILE__', __FILE__ );
define( 'NC_OPTIMIZEUP_URL', plugin_dir_url(__FILE__) );
add_action( 'plugins_loaded', 'nc_optimizeup_init' );
function nc_optimizeup_init() {
// nc store check
if( !defined('NC_STORE_ROOT_PATH') ){
add_action( 'admin_notices', 'nc_optimizeup_init_check' );
function nc_optimizeup_init_check(){
$html = '<div class="notice notice-error">
<p><b>错误:</b> 网站优化 积木 缺少依赖插件 <code>WP 积木</code> 请先安装并启用 <code>WP 积木</code> 插件。</p>
</div>';
echo $html;
}
} else {
load_theme_textdomain('jimu', NC_OPTIMIZEUP_DIR . '/languages');
acf_add_options_sub_page(
array(
'page_title' => '网站优化 积木',
'menu_title' => '网站优化 积木',
'menu_slug' => 'nc-optimizeup-options',
'parent_slug' => 'nc-modules-store',
'capability' => 'manage_options',
'update_button' => '保存',
'updated_message' => '设置已保存!'
)
);
add_filter('nc_save_json_paths', 'nc_optimizeup_acf_json_save_point');
function nc_optimizeup_acf_json_save_point( $path ) {
$path[] = NC_OPTIMIZEUP_DIR . '/conf';
return $path;
}
add_filter('acf/settings/load_json', 'nc_optimizeup_acf_json_load_point');
function nc_optimizeup_acf_json_load_point( $paths ) {
$paths[] = NC_OPTIMIZEUP_DIR . '/conf';
return $paths;
}
function nc_set_main_option() {
$field_group_json = 'group_5beacfbc334a4.json';
$option_config = json_decode(file_get_contents(NC_OPTIMIZEUP_CONF_DIR.$field_group_json), true);
$nc_option = get_all_custom_field_meta('option', $option_config);
update_option('nc_option', $nc_option, true);
}
add_action('acf/save_post', 'nc_set_main_option');
$nc_option = get_option('nc_option');
get_field('seo_switcher', 'option'); // trick
if (false == $nc_option) nc_set_main_option();
include_once NC_OPTIMIZEUP_DIR . '/functions/utils.php';
include_once NC_OPTIMIZEUP_DIR . '/functions/rocket.php';
include_once NC_OPTIMIZEUP_DIR . '/functions/usability.php';
if ($nc_option['seo_switcher']) {
include_once NC_OPTIMIZEUP_DIR . '/functions/seo.php';
}
if ($nc_option['smtp_switcher']) {
include_once NC_OPTIMIZEUP_DIR . '/functions/smtp.php';
}
if ($nc_option['general']['anti_spam_switcher']) {
include_once NC_OPTIMIZEUP_DIR . '/functions/anti-spam.php';
}
include_once NC_OPTIMIZEUP_DIR . '/functions/seo-extra.php';
include_once NC_OPTIMIZEUP_DIR . '/functions/database.php';
if( isset( $nc_option['open_cdn_replace'] ) && $nc_option['open_cdn_replace'] == 'enable' ){
$GLOBALS['nc_cdn_replace_list'] = $nc_option['cdn_replace_list'];
include_once NC_OPTIMIZEUP_DIR . '/functions/cdn.php';
}
if( isset( $nc_option['wp-admin-access-control'] ) && $nc_option['wp-admin-access-control'] == 'enable' ){
$GLOBALS['wp-admin-access-group'] = $nc_option['wp-admin-access-group'];
include_once NC_OPTIMIZEUP_DIR . '/functions/wp-admin-access-control.php';
}
function wp_admin_access_group_select( $field ) {
global $wp_roles;
$roles = $wp_roles->roles;
$choices = [];
foreach ($roles as $key => $value) {
$choices[$key] = translate_user_role($value['name']);
}
$field['choices'] = $choices;
return $field;
}
add_action( 'acf/load_field/name=wp-admin-access-group', 'wp_admin_access_group_select', 10, 1 );
if( isset( $nc_option['nice-security-access'] ) && $nc_option['nice-security-access'] == 'enable' ){
$GLOBALS['nice-security-access-path'] = $nc_option['nice-security-access-path'];
include_once NC_OPTIMIZEUP_DIR . '/functions/nice-security-access.php';
}
}
}

View file

@ -1,444 +0,0 @@
<?php
/**
* Field_Group_Values Class
*
* @author Tim Jensen <tim@timjensen.us>
* @license GNU General Public License 3.0+
* @link https://www.timjensen.us
* @since 1.3.0
* @package TimJensen\ACF\Field_Group_Values
*/
declare( strict_types = 1 );
namespace TimJensen\ACF;
if ( ! class_exists( 'TimJensen\ACF\Field_Group_Values' ) ) :
/**
* Class Field_Group_Values
*/
class Field_Group_Values {
/**
* Field group configuration array for the current level of recursion.
*
* @var array
*/
public $config;
/**
* Field group configuration array containing fields/groups to clone.
*
* @since 2.0.0
*
* @var array
*/
protected $clone_fields;
/**
* Post ID, 'option', or 'term_{id}'.
*
* @var int|string
*/
protected $post_id;
/**
* Stores all the custom field values.
*
* @var array
*/
protected $results = [];
/**
* Field_Group_Values constructor.
*
* @param int|string $post_id Post ID, 'option', or 'term_{id}'.
* @param array $config Field group configuration array.
* @param array $clone_fields Field group configuration arrays for cloned fields/groups.
*/
public function __construct( $post_id, array $config, $clone_fields = [] ) {
$this->post_id = $post_id;
$this->config = $config['fields'];
$this->clone_fields = array_merge( [ $config ], $clone_fields );
}
/**
* Builds the multidimensional array that contains all the custom field values.
*
* @param array $config
* @return array
*/
public function get_all_field_group_values( array $config ): array {
$this->reset_results();
foreach ( $config as $field ) {
if ( ! $this->has_valid_field_structure( $field ) ) {
continue;
}
$field_key = $this->get_field_key( $field );
$field_value = $this->get_field_value( $field_key );
switch ( $field['type'] ) :
case 'group':
$this->get_group_field_values( $field, $field_key );
break;
case 'repeater':
if ( empty( $field_value ) ) {
break;
}
$this->get_repeater_field_values( $field, $field_key, $field_value );
break;
case 'flexible_content':
if ( empty( $field_value ) ) {
break;
}
$this->get_flexible_content_field_values( $field, $field_key, $field_value );
break;
case 'clone':
$this->get_clone_field_values( $field );
break;
default:
$this->store_field_value( $field, $field_value );
endswitch;
}
return $this->results;
}
/**
* Resets the results property so that the final array is formatted correctly.
*
* @return void
*/
protected function reset_results() {
$this->results = [];
}
/**
* Determines whether the specified field has a valid structure.
*
* @param array $field ACF field configuration.
* @return bool
*/
protected function has_valid_field_structure( array $field ): bool {
return ! empty( $field['name'] ) && ! empty( $field['type'] );
}
/**
* Builds the field key that is used for looking up the custom field value.
*
* @param array $field ACF field configuration.
* @return string
*/
protected function get_field_key( array $field ): string {
$field_key = $field['name'];
if ( isset( $field['meta_key_prefix'] ) ) {
return $field['meta_key_prefix'] . $field_key;
}
return $field_key;
}
/**
* Retrieve the value for the specified field from the options, term_meta, or post meta tables.
*
* @param string $field_key Custom field key.
* @return mixed
*/
protected function get_field_value( string $field_key ) {
// Allow 'option' or 'options'.
if ( in_array( $this->post_id, [ 'option', 'options' ], true ) ) {
return get_option( "options_{$field_key}" );
} elseif ( 'term_' === substr( (string) $this->post_id, 0, 5 ) ) {
$term_id = (int) substr( $this->post_id, 5 );
return get_term_meta( $term_id, $field_key, true );
} elseif ( 'user_' === substr( (string) $this->post_id, 0, 5 ) ) {
$user_id = (int) substr( $this->post_id, 5 );
return get_user_meta( $user_id, $field_key, true );
}
return get_post_meta( $this->post_id, $field_key, true );
}
/**
* Returns an array of ACF flexible content layout types.
*
* @param array $field ACF field configuration.
* @return array
*/
protected function get_flexible_content_layout_types( array $field ): array {
$layout_types = [];
foreach ( $field['layouts'] as $layout ) {
$layout_types[ $layout['name'] ] = $layout;
}
return $layout_types;
}
/**
* Returns the values for repeater fields.
*
* @param array $field ACF field configuration.
* @param string $parent_meta_key Field key.
* @param array $field_value Array of layout types for each flexible content row.
* @return void
*/
protected function get_flexible_content_field_values( array $field, string $parent_meta_key, array $field_value ) {
$results = $this->results;
$layout_types = $this->get_flexible_content_layout_types( $field );
// Loop through the chosen layouts.
foreach ( $field_value as $index => $current_layout_type ) {
// Check if the layout has been deleted from the ACF group.
if ( empty( $layout_types[ $current_layout_type ]['sub_fields'] ) ) {
continue;
}
$config = $layout_types[ $current_layout_type ]['sub_fields'];
$config = $this->set_meta_key_prefix( 'flexible_content', $config, $parent_meta_key, $index );
$results[ $field['name'] ][] = array_merge(
[
'acf_fc_layout' => $current_layout_type,
],
$this->get_all_field_group_values( $config )
);
}
$this->results = $results;
}
/**
* Returns the custom field values for clone fields.
*
* @since 1.4.0
*
* @param array $field ACF field configuration.
* @return void
*/
protected function get_clone_field_values( array $field ) {
$results = $this->results;
$config = [];
foreach ( $field['clone'] as $clone_field_key ) {
$clone_field_config = $this->get_clone_field_config( $clone_field_key, $this->clone_fields );
// A `false` value means the corresponding field was deleted from the field group.
if ( false === $clone_field_config ) {
continue;
}
$config = array_merge( $config, $clone_field_config );
}
// Build the field key prefix including ACF's option for prefixing, if set. The prefix is only used for
// retrieving meta values, not for storing the values in the returned array.
$meta_key_prefix = $field['meta_key_prefix'] ?? '';
if ( $field['prefix_name'] ) {
$meta_key_prefix .= "{$field['name']}_";
}
$config = $this->set_meta_key_prefix( 'clone', $config, $meta_key_prefix );
// ACF optionally saves the data in a prefixed format, so we need to account for that.
if ( $field['prefix_name'] ) {
$this->result_key_prefix = $field['name'];
}
$results = array_merge( $results, $this->get_all_field_group_values( $config ) );
// Ensure the prefix does not get applied to other fields.
unset( $this->result_key_prefix );
$this->results = $results;
}
/**
* Sets the value for the meta key prefix and adds it to the field configuration array.
*
* @since 2.1.2
*
* @param string $field_type Field type: 'clone', 'repeater', 'flexible_content', or 'group'.
* @param array $config Field configuration.
* @param string $parent_meta_key Meta key of the parent field.
* @param int $index Loop index.
* @return array
*/
protected function set_meta_key_prefix( string $field_type, array $config, string $parent_meta_key = '', int $index = 0 ): array {
foreach ( $config as &$field_config ) {
switch ( $field_type ) :
case 'group':
$field_config['meta_key_prefix'] = "{$parent_meta_key}_";
break;
case 'repeater':
$field_config['meta_key_prefix'] = "{$parent_meta_key}_{$index}_";
break;
case 'flexible_content':
$field_config['meta_key_prefix'] = "{$parent_meta_key}_{$index}_";
break;
case 'clone':
$field_config['meta_key_prefix'] = $parent_meta_key;
endswitch;
}
return $config;
}
/**
* Recursively search for the appropriate clone group/field configuration array.
*
* @since 1.4.0
*
* @param string $clone_field_key Field key to search for.
* @param array $clone_fields ACF fields configuration.
* @return bool|array
*/
protected function get_clone_field_config( string $clone_field_key, array $clone_fields ) {
foreach ( $clone_fields as $field ) {
if ( $field['key'] === $clone_field_key ) {
if ( isset( $field['fields'] ) ) {
// Return the matched field group.
return $field['fields'];
}
// Return the matched field in a new array.
return [ $field ];
} elseif ( isset( $field['fields'] ) ) { // Whole field group.
$config = $field['fields'];
} elseif ( isset( $field['sub_fields'] ) ) { // Repeater, Group, and Flex Content layouts.
$config = $field['sub_fields'];
} elseif ( isset( $field['layouts'] ) ) { // Flexible Content.
$config = $field['layouts'];
}
if ( empty( $config ) ) {
// Stop recursion for the current field.
continue;
}
$result = $this->get_clone_field_config( $clone_field_key, $config );
if ( $result ) {
return $result;
}
}
return false;
}
/**
* Returns the custom field values for group fields.
*
* @since 1.4.0
*
* @param array $field ACF field configuration.
* @param string $parent_meta_key Field key.
* @return void
*/
protected function get_group_field_values( array $field, string $parent_meta_key ) {
$results = $this->results;
$field['sub_fields'] = $this->set_meta_key_prefix( 'group', $field['sub_fields'], $parent_meta_key );
$results[ $field['name'] ] = $this->get_all_field_group_values( $field['sub_fields'] );
$this->results = $results;
}
/**
* Returns the custom field values for repeater fields.
*
* @param array $field ACF field configuration.
* @param string $parent_meta_key Field key.
* @param string $field_value Field value.
* @return void
*/
protected function get_repeater_field_values( array $field, string $parent_meta_key,$field_value ) {
$results = $this->results;
for ( $i = 0; $i < $field_value; $i ++ ) {
$field['sub_fields'] = $this->set_meta_key_prefix( 'repeater', $field['sub_fields'], $parent_meta_key, $i );
$results[ $field['name'] ][] = $this->get_all_field_group_values( $field['sub_fields'] );
}
$this->results = $results;
}
/**
* Store the field value to the results property.
*
* @param array $field ACF field configuration.
* @param string|array $field_value Field value.
*/
protected function store_field_value( array $field, $field_value ) {
// ACF allows clone fields to be prefixed.
$result_key = ! empty( $this->result_key_prefix )
? "{$this->result_key_prefix}_{$field['name']}"
: $field['name'];
$this->results[ $result_key ] = $field_value;
}
/**
* Getter method.
*
* @param string $property Name of the property to return.
* @return mixed
*/
public function __get( $property ) {
return $this->{$property};
}
/**
* Returns a multidimensional array containing all the custom field values.
*
* @return array
*/
public function get_results(): array {
if ( empty( $this->results ) ) {
$this->get_all_field_group_values( $this->config );
}
return $this->results;
}
}
endif;

View file

@ -1,36 +0,0 @@
<?php
declare( strict_types = 1 );
/**
* Function Get All Custom Field Meta
*
* @package TimJensen\ACF\Field_Group_Values
* @author Tim Jensen <tim@timjensen.us>
* @license GNU General Public License 3.0+
* @since 2.2.1
*/
if ( ! function_exists( 'get_all_custom_field_meta' ) ) :
/**
* Instantiates the Field_Group_Values class and returns the results.
*
* @link https://www.timjensen.us/acf-get-field-alternative/
*
* @param int|string $post_id Required. Post ID, 'option', or 'term_{id}'.
* @param array $config Required. ACF field group JSON reformatted as an array.
* @param array $clone_fields Optional. ACF field group JSON arrays for all cloned fields/groups.
* @return array
*/
function get_all_custom_field_meta( $post_id, array $config, array $clone_fields = [] ): array {
if ( empty( $config['fields'] ) ) {
$corrected_config['fields'] = $config;
$config = $corrected_config;
trigger_error( 'As of version 2.0.0 the $config argument should include the field group key in addition to the array of fields. Pass $config instead of $config[\'fields\'].', E_USER_WARNING );
}
$field_group_values = new \TimJensen\ACF\Field_Group_Values( $post_id, $config, $clone_fields );
return $field_group_values->get_results();
}
endif;

View file

@ -1,605 +0,0 @@
/*
/$$
/$$ /$$$$
| $$ |_ $$ /$$$$$$$
/$$$$$$$$ | $$ /$$_____/
|__ $$__/ | $$ | $$$$$$
| $$ | $$ \____ $$
|__/ /$$$$$$ /$$$$$$$/
|______/|_______/
================================
Keep calm and get rich.
Is the best.
@Author: Dami
@Date: 2019-03-18 17:47:07
* @Last Modified by: suxing
* @Last Modified time: 2019-08-13 11:23:35
*/
/*
SimpleBar style
*/
[data-simplebar] {
position: relative;
flex-direction: column;
flex-wrap: wrap;
justify-content: flex-start;
align-content: flex-start;
align-items: flex-start;
}
.simplebar-wrapper {
overflow: hidden;
width: inherit;
height: inherit;
max-width: inherit;
max-height: inherit;
}
.simplebar-mask {
direction: inherit;
position: absolute;
overflow: hidden;
padding: 0;
margin: 0;
left: 0;
top: 0;
bottom: 0;
right: 0;
width: auto !important;
height: auto !important;
z-index: 0;
}
.simplebar-offset {
direction: inherit !important;
box-sizing: inherit !important;
resize: none !important;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
padding: 0;
margin: 0;
-webkit-overflow-scrolling: touch;
}
.simplebar-content-wrapper {
direction: inherit;
box-sizing: border-box !important;
position: relative;
display: block;
height: 100%;
/* Required for horizontal native scrollbar to not appear if parent is taller than natural height */
width: auto;
visibility: visible;
overflow: auto;
/* Scroll on this element otherwise element can't have a padding applied properly */
max-width: 100%;
/* Not required for horizontal scroll to trigger */
max-height: 100%;
/* Needed for vertical scroll to trigger */
}
.simplebar-content:before,
.simplebar-content:after {
content: " ";
display: table;
}
.simplebar-placeholder {
max-height: 100%;
max-width: 100%;
width: 100%;
pointer-events: none;
}
.simplebar-height-auto-observer-wrapper {
box-sizing: inherit !important;
height: 100%;
width: inherit;
max-width: 1px;
position: relative;
float: left;
max-height: 1px;
overflow: hidden;
z-index: -1;
padding: 0;
margin: 0;
pointer-events: none;
flex-grow: inherit;
flex-shrink: 0;
flex-basis: 0;
}
.simplebar-height-auto-observer {
box-sizing: inherit;
display: block;
opacity: 0;
position: absolute;
top: 0;
left: 0;
height: 1000%;
width: 1000%;
min-height: 1px;
min-width: 1px;
overflow: hidden;
pointer-events: none;
z-index: -1;
}
.simplebar-track {
z-index: 1;
position: absolute;
right: 0;
bottom: 0;
pointer-events: none;
overflow: hidden;
}
[data-simplebar].simplebar-dragging .simplebar-track {
pointer-events: all;
}
.simplebar-scrollbar {
position: absolute;
right: 2px;
width: 7px;
min-height: 10px;
}
.simplebar-scrollbar:before {
position: absolute;
content: "";
background: black;
border-radius: 7px;
left: 0;
right: 0;
opacity: 0;
transition: opacity 0.2s linear;
}
.simplebar-track .simplebar-scrollbar.simplebar-visible:before {
/* When hovered, remove all transitions from drag handle */
opacity: 0.5;
transition: opacity 0s linear;
}
.simplebar-track.simplebar-vertical {
top: 0;
width: 11px;
}
.simplebar-track.simplebar-vertical .simplebar-scrollbar:before {
top: 2px;
bottom: 2px;
}
.simplebar-track.simplebar-horizontal {
left: 0;
height: 11px;
}
.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before {
height: 100%;
left: 2px;
right: 2px;
}
.simplebar-track.simplebar-horizontal .simplebar-scrollbar {
right: auto;
left: 0;
top: 2px;
height: 7px;
min-height: 0;
min-width: 10px;
width: auto;
}
/* Rtl support */
[data-simplebar-direction="rtl"] .simplebar-track.simplebar-vertical {
right: auto;
left: 0;
}
.hs-dummy-scrollbar-size {
direction: rtl;
position: fixed;
opacity: 0;
visibility: hidden;
height: 500px;
width: 500px;
overflow-y: hidden;
overflow-x: scroll;
}
/*--------------------------------------------------------------
POPUP CSS
--------------------------------------------------------------*/
.nice-tips,
.nice-tips-overlay {
width: 100%;
height: 100vh;
top: 0;
left: 0;
}
.nice-tips {
position: fixed;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
pointer-events: none
}
.nice-tips-open {
z-index: 1031;
}
.nice-tips-overlay {
position: absolute;
background: rgba(120, 129, 147, .22);
opacity: 0;
-webkit-transition: opacity .3s;
transition: opacity .3s;
-webkit-backface-visibility: hidden -webkit-transition-duration: .3s;
transition-duration: .3s
}
.nice-tips-open .nice-tips-overlay {
opacity: 1;
pointer-events: auto;
}
@supports (-webkit-backdrop-filter:blur(10px)) or (backdrop-filter:blur(10px)) {
.nice-tips-open .nice-tips-overlay {
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
}
}
/*--------------------------------------------------------------
tips body
--------------------------------------------------------------*/
.nice-tips-body {
position: relative;
opacity: 0;
max-width: 400px;
width: 100%;
}
@media (max-width: 575.98px) {
.nice-tips-body {
max-width: 93.3333%;
}
}
.nice-tips-open .nice-tips-body {
pointer-events: auto;
}
.nice-tips-xl .nice-tips-body {
width: 100%;
max-width: 790px;
}
.nice-tips-scroll .nice-tips-body{
width: 100%;
max-width: 790px;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
max-height: calc(100vh - 100px);
height: calc(100vh - 100px);
}
.nice-tips-lg .nice-tips-body {
width: 100%;
max-width: 790px;
}
.nice-tips-md .nice-tips-body {
max-width: 540px;
width: 100%;
}
.nice-tips-sm .nice-tips-body {
max-width: 300px;
width: auto;
}
.nice-tips-nopd .nice-tips-body {
max-width: 340px;
}
@media (min-width:768px) and (max-width:991.98px) {
.nice-tips-scroll .nice-tips-body,
.nice-tips-xl .nice-tips-body {
max-width: 670px;
}
}
@media (max-width:767.98px) {
.nice-tips-scroll .nice-tips-body,
.nice-tips-xl .nice-tips-body {
height: 100vh;
}
.nice-tips-md .nice-tips-body {
padding:1rem;
}
}
/*--------------------------------------------------------------
tips body animation
--------------------------------------------------------------*/
.nice-tips.nice-tips-open .nice-tips-body,
.nice-tips.nice-tips-close .nice-tips-body {
-webkit-animation-duration: .3s;
animation-duration: .3s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards
}
.nice-tips.nice-tips-open .nice-tips-body {
-webkit-animation-name: tips-open;
animation-name: tips-open
}
.nice-tips.nice-tips-close .nice-tips-body {
-webkit-animation-name: tips-close;
animation-name: tips-close
}
@-webkit-keyframes tips-open {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 50px, 0)
}
100% {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0)
}
}
@keyframes tips-open {
0% {
opacity: 0;
-webkit-transform: translate3d(0, 50px, 0);
transform: translate3d(0, 50px, 0)
}
100% {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
}
@-webkit-keyframes tips-close {
0% {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0)
}
100% {
opacity: 0;
-webkit-transform: translate3d(0, 50px, 0)
}
}
@keyframes tips-close {
0% {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0)
}
100% {
opacity: 0;
-webkit-transform: translate3d(0, 50px, 0);
transform: translate3d(0, 50px, 0)
}
}
/*--------------------------------------------------------------
tips content
--------------------------------------------------------------*/
.nice-tips-content {
background: #fff;
padding: 1.25rem;
position: relative;
border-radius: 4px;
border: 1px solid #f4f5f9;
box-shadow: 0 10px 50px -5px rgba(6, 39, 67, 0.12);
}
.nice-tips-xl .nice-tips-content{
padding: 0;
border: 0;
width: 100%;
height: auto;
overflow: hidden;
}
.nice-tips-scroll .nice-tips-content{
padding: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
.nice-tips-lg .nice-tips-content {
padding: 0;
border: 0;
border-radius: 0;
}
.nice-tips-sm .nice-tips-content {
padding: 2rem;
padding: 1.75rem 2.5rem;
}
.nice-tips-nopd .nice-tips-content {
padding: 0;
border: 0;
}
@media (max-width:767.98px) {
.nice-tips-scroll .nice-tips-body .nice-tips-content,
.nice-tips-xl .nice-tips-body .nice-tips-content {
box-shadow: none;
border-radius: 0;
height: 100vh;
}
}
/*--------------------------------------------------------------
tips svg color
--------------------------------------------------------------*/
.nice-tips-content .text-success svg path {
fill: #28a745;
}
.nice-tips-content .text-danger svg path {
fill: #ffc107;
}
/*--------------------------------------------------------------
tips close btn
--------------------------------------------------------------*/
.btn-close-tips {
position: absolute;
bottom: 0px;
left: 0;
width: 100%;
z-index: 44;
cursor: pointer;
transform: translateY(150%);
text-align: center;
}
.btn-close-tips svg path {
fill: #fff
}
@media (max-width:767.98px) {
.nice-tips-scroll .btn-close-tips{
transform: translateY(120%);
}
.nice-tips-xl .btn-close-tips {
transform: translateY(-100%);
}
.nice-tips-scroll .btn-close-tips svg path ,
.nice-tips-xl .btn-close-tips svg path {
fill: #888;
}
}
@media (min-width:768px) {
.nice-tips-scroll .btn-close-tips {
right: 0;
top: 0;
bottom: auto;
left: auto;
width: auto;
z-index: 44;
cursor: pointer;
transform: translateX(120%);
}
}
/*
post cover style
*/
.nice-tips-cover .nice-tips-overlay {
background: rgb(120, 129, 147);
}
.tips-content-cover {
max-width: 340px;
width: 100%;
padding: 0;
border: 0;
border-radius: .22rem;
}
.cover-image {
position: relative;
overflow: hidden;
border-radius: .22rem .22rem 0 0;
padding: 0;
}
.cover-image img {}
.cover-overlay {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
-webkit-filter: blur(10px);
filter: blur(20px);
z-index: -1;
}
.cover-overlay:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: .11;
}
.cover-share {
text-align: center;
padding: 1rem 0;
border-top: 1px solid #f4f6f9;
}
.cover-share a {
color: #8a92a9;
padding: .25rem;
margin: .25rem;
font-size: 1.125rem;
}
.cover-share a:hover {
color: #062743;
}
.cover-text {
text-align: center;
position: absolute;
top: 0px;
left: 0;
width: 100%;
z-index: 44;
cursor: pointer;
transform: translateY(-36px);
text-align: center;
color: #fff;
font-size: .875rem;
}

File diff suppressed because one or more lines are too long

View file

@ -1,66 +0,0 @@
<?php
/*
/$$
/$$ /$$$$
| $$ |_ $$ /$$$$$$$
/$$$$$$$$ | $$ /$$_____/
|__ $$__/ | $$ | $$$$$$
| $$ | $$ \____ $$
|__/ /$$$$$$ /$$$$$$$/
|______/|_______/
================================
Keep calm and get rich.
Is the best.
@Author: Dami
@Date: 2019-08-02 11:36:30
@Last Modified by: Dami
@Last Modified time: 2019-08-02 21:38:32
*/
if( !function_exists('timeago') ){
function timeago( $ptime ) {
$ptime = strtotime($ptime);
$current_offset = get_option('gmt_offset');
if( $current_offset > 0 ){
$etime = strtotime( date_i18n( 'Y-m-d H:i:s' ) ) - $current_offset * 60 * 60 - $ptime;
}else if( $current_offset < 0 ){
$etime = strtotime( date_i18n( 'Y-m-d H:i:s' ) ) + $current_offset * 60 * 60 - $ptime;
}else{
$etime = strtotime( date_i18n( 'Y-m-d H:i:s' ) ) - $ptime;
}
if($etime < 1) return '刚刚';
$interval = array (
12 * 30 * 24 * 60 * 60 => date('Y-m-d', $ptime),
30 * 24 * 60 * 60 => date('m-d', $ptime),
7 * 24 * 60 * 60 => date('m-d', $ptime),
24 * 60 * 60 => '天前',
60 * 60 => '小时前',
60 => '分钟前',
1 => '秒前'
);
foreach ($interval as $secs => $str) {
if( $etime - ( 24 * 60 * 60 ) > 0 ){
return $str;
} else {
$d = $etime / $secs;
if ($d >= 1) {
$r = round($d);
return $r . $str;
}
}
}
}
}

View file

@ -1,258 +0,0 @@
<?php
/*
/$$
/$$ /$$$$
| $$ |_ $$ /$$$$$$$
/$$$$$$$$ | $$ /$$_____/
|__ $$__/ | $$ | $$$$$$
| $$ | $$ \____ $$
|__/ /$$$$$$ /$$$$$$$/
|______/|_______/
================================
Keep calm and get rich.
Is the best.
@Author: Dami
@Date: 2017-09-16 14:42:56
@Last Modified by: Dami
@Last Modified time: 2019-08-08 20:59:32
*/
if( !class_exists('MiCustomShare') ) :
class MiCustomShare {
private $config;
function __construct(){
$nc_option = get_option('nc_option');
$this->config = $nc_option['wechat_qq_share_custom_conf'];
add_action( 'wp_enqueue_scripts', array( $this, 'mi_add_share_js' ) );
add_action( 'wp_footer', array( $this, 'mi_add_share_info' ), 2333 );
}
function mi_add_share_js(){
wp_enqueue_script( 'mi-share-js', '//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js', array(), NC_OPTIMIZEUP_VERSION, 'all' );
}
function get_signature_url(){
$protocol = is_ssl() ? 'https://' : 'http://';
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$url = explode('#', $url);
$url = $url[0];
return $url;
}
//获取Access Token
function get_access_token(){
if( ($access_token = get_option('ws_access_token')) !== false && $access_token != '' && time() < $access_token['expire_time']){
return $access_token['access_token'];
}
$api_url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='. $this->config['share_appid'] .'&secret='. $this->config[ 'appsecret' ];
$response = wp_remote_get($api_url);
if ( is_array( $response ) && ! is_wp_error($response) ){
$result = json_decode($response['body']);
} else {
return false;
}
$access_token['access_token'] = !$result->errcode ? $result->access_token : '';
$access_token['expire_time'] = !$result->errcode ? time() + intval( $result->expires_in ) : '';
update_option( 'ws_access_token', $access_token );
return $access_token['access_token'];
}
//获取JSAPI TICKET
function get_jsapi_ticket(){
if( ($jsapi_ticket = get_option('wx_jsapi_ticket')) !== false && $jsapi_ticket != '' && time() < $jsapi_ticket['expire_time']){
return $jsapi_ticket['jsapi_ticket'];
}
if( ($access_token = $this->get_access_token()) === false ) return false;
$api_url = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token='. $access_token .'&type=jsapi';
$response = wp_remote_get($api_url);
if ( is_array( $response ) && ! is_wp_error($response) ){
$result = json_decode($response['body']);
}
else{
return false;
}
$jsapi_ticket['jsapi_ticket'] = !$result->errcode ? $result->ticket : '';
$jsapi_ticket['expire_time'] = !$result->errcode ? time() + intval( $result->expires_in ) : '';
update_option( 'wx_jsapi_ticket', $jsapi_ticket );
return $jsapi_ticket['jsapi_ticket'];
}
//生成随机字符串
function generate_noncestr( $length = 16 ){
$noncestr = '';
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for( $i = 0; $i < $length; $i++ ){
$noncestr .= $chars[ mt_rand(0, strlen($chars) - 1) ];
}
return $noncestr;
}
//生成签名
function generate_signature($jsapi_ticket, $noncestr, $timestamp, $url){
$str = 'jsapi_ticket='. $jsapi_ticket .'&noncestr='. $noncestr .'&timestamp='. $timestamp .'&url='. $url;
return sha1($str);
}
function get_wx_config(){
if( $this->config['share_appid'] && $this->config[ 'appsecret' ] && ( $jsapi_ticket = $this->get_jsapi_ticket() ) !== false ){
$noncestr = $this->generate_noncestr();
$timestamp = time();
$signature_url = $this->get_signature_url();
$signature = $this->generate_signature($jsapi_ticket, $noncestr, $timestamp, $signature_url);
$config = array(
'noncestr' => $noncestr,
'timestamp' => $timestamp,
'signature' => $signature,
);
}else{
$config = null;
}
return $config;
}
function get_share_info(){
$info = array();
if( is_single() || is_singular() ){
global $post;
if( has_post_thumbnail( $post->ID ) ){
$post_thumbnail_src = get_post_thumbnail_id($post->ID);
$post_thumbnail_src = wp_get_attachment_image_src($post_thumbnail_src, 'full');
$pic = $post_thumbnail_src[0];
}else{
$preg = '/<img.*?src=[\"|\']?(.*?)[\"|\']?\s.*?>/i';
preg_match_all($preg, apply_filters( 'the_content', $post->post_content ), $match);
if( isset( $match[1][0] ) && !empty( $match[1][0] ) ){
$pic = $match[1][0];
}else{
$pic = $this->config['share_img'];
}
}
$pic = isset( $pic ) ? $pic : NC_BASE_URL . 'library/static/default.png';
$info = array(
'title' => $this->config['share_title_in_single'] ? $this->config[ 'share_title' ] . $this->config[ 'share_title_in_single_line' ] . get_the_title() : get_the_title(),
'summary' => get_the_excerpt(),
'url' => get_permalink(),
'pic' => $pic,
);
}else{
$pngdata = NC_BASE_URL . 'library/static/default.png';
if( isset( $this->config[ 'share_img' ] ) && is_numeric( $this->config[ 'share_img' ] ) ){
$att = wp_get_attachment_image_url( $this->config[ 'share_img' ], 'full' );
}else if( isset( $this->config[ 'share_img' ] ) && !empty( $this->config[ 'share_img' ] ) ) {
$att = $this->config[ 'share_img' ];
}
if( isset( $att ) ){
$pic = $att;
}else{
$pic = null;
}
$info = array(
'title' => $this->config[ 'share_title' ] ? $this->config[ 'share_title' ] : get_bloginfo( 'name' ),
'summary' => $this->config[ 'share_summary' ] ? $this->config[ 'share_summary' ] :get_bloginfo( 'description' ),
'url' => $this->get_signature_url(),
'pic' => $pic ? $pic : $pngdata,
);
}
return $info;
}
function mi_add_share_info(){
$info = $this->get_share_info();
$wxconfig = $this->get_wx_config();
$wxappid = $this->config['share_appid'];
if( $wxconfig && $wxappid ){
$WXconfig = <<<WX
WXconfig:{
swapTitleInWX: false,
appId: '{$wxappid}',
timestamp: '{$wxconfig['timestamp']}',
nonceStr: '{$wxconfig['noncestr']}',
signature: '{$wxconfig['signature']}'
}
WX;
}else{
$WXconfig = '';
}
$script = <<<SCRIPT
<script>
setShareInfo({
title: '{$info['title']}',
summary: '{$info['summary']}',
pic: '{$info['pic']}',
url: '{$info['url']}',
{$WXconfig}
});
</script>
SCRIPT;
echo $script;
}
}
new MiCustomShare();
endif;

View file

@ -1,23 +0,0 @@
<?php
/*
/$$
/$$ /$$$$
| $$ |_ $$ /$$$$$$$
/$$$$$$$$ | $$ /$$_____/
|__ $$__/ | $$ | $$$$$$
| $$ | $$ \____ $$
|__/ /$$$$$$ /$$$$$$$/
|______/|_______/
================================
Keep calm and get rich.
Is the best.
@Author: Dami
@Date: 2019-03-19 22:54:07
@Last Modified by: Dami
@Last Modified time: 2019-08-02 11:38:21
*/
include('share.php');
include('custom_date.php');

View file

@ -1,127 +0,0 @@
<?php
/*
/$$
/$$ /$$$$
| $$ |_ $$ /$$$$$$$
/$$$$$$$$ | $$ /$$_____/
|__ $$__/ | $$ | $$$$$$
| $$ | $$ \____ $$
|__/ /$$$$$$ /$$$$$$$/
|______/|_______/
================================
Keep calm and get rich.
Is the best.
@Author: Dami
@Date: 2017-09-16 11:36:51
@Last Modified by: Dami
@Last Modified time: 2019-03-20 21:36:02
*/
if( !class_exists('MiShare') ) :
class MiShare {
//private $config;
private $config;
function __construct(){
$this->config = array(
'url' => get_permalink(),
'title' => get_the_title(),
'pic' => null,
'des' => wp_trim_words( get_the_excerpt(), 55, null ),
);
}
function __set($property,$value){
$this->$property = $value;
}
/**
* [weibo Share]
* @return [str] [ Share api link]
*/
public function weibo() {
$pic = isset($this->config['pic']) ? '&pic='.urlencode( $this->config['pic'] ) : '';
if( isset( $this->config['des'] ) ){
$text = urlencode( sprintf( '【%s】%s', $this->config['title'], $this->config['des']) );
}else{
$text = $this->config['title'];
}
$share_link = sprintf( '//service.weibo.com/share/share.php?url=%s&type=button&language=zh_cn&title=%s%s&searchPic=true', urlencode( $this->config['url'] ), $text , $pic );
return $share_link;
}
/**
* [qq Share]
* @return [str] [ Share api link]
*/
public function qq() {
$pic = isset($this->config['pic']) ? '&pics='.urlencode( $this->config['pic'] ) : '';
$des = isset($this->config['des']) ? '&summary='.urlencode($this->config['des']) : '';
$share_link = sprintf( 'https://connect.qq.com/widget/shareqq/index.html?url=%s&title=%s%s%s', urlencode( $this->config['url'] ), urlencode($this->config['title']), $pic, $des );
return $share_link;
}
/**
* [weixin Share]
* @return [str] [Share qrcode link]
*/
public function weixin() {
$share_link = NC_BASE_URL . 'modules/qrcode/qrcode.php?data='.urlencode( $this->config['url'] );
return $share_link;
}
/**
* facebook
*/
public function facebook(){
$share_link = sprintf( 'https://www.facebook.com/sharer.php?u=%s', urlencode( $this->config['url'] ) );
return $share_link;
}
/**
* twitter
*/
public function twitter(){
$share_link = sprintf( 'https://twitter.com/intent/tweet?url=%s', urlencode( $this->config['url'] ) );
return $share_link;
}
/**
* linkedin
*/
public function linkedin(){
$share_link = sprintf( 'https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s&summary=%s', urlencode( $this->config['url'] ), urlencode($this->config['title']), urlencode($this->config['des']) );
return $share_link;
}
}
endif;
// $s = new MiShare();
// $s->config = array( 'url' => 'https://www.baidu.com', 'title' => '标题', 'pic' => 'https://cdn.v2ex.com/gravatar/afa39accf8700cbbe7b13e1d01aa5b17', 'des' => '123');
// echo $s->weixin();

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
<?php
//error_reporting(E_ERROR);
require_once 'phpqrcode.php';
$url = urldecode($_GET["data"]);
QRcode::png($url);