提交 0f971127 编写于 作者: J jianbo

去除版本控制文件

上级 acb88ba4
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Upload
*
*/
/**
* Info about JavaScript uploaders
*
* https://codex.wordpress.org/Function_Reference/wp_handle_upload
* https://codex.wordpress.org/Function_Reference/media_handle_upload
* http://www.kvcodes.com/2013/12/create-front-end-multiple-file-upload-wordpress/
* https://wordpress.stackexchange.com/questions/173197/upload-multiple-files-with-media-handle-upload
* https://www.ibenic.com/wordpress-file-upload-with-ajax/
* https://www.theaveragedev.com/wordpress-files-ajax/
*
* Dropzone
* https://www.startutorial.com/articles/view/how-to-build-a-file-upload-form-using-dropzonejs-and-php
* http://www.dropzonejs.com/
* https://github.com/enyo/dropzone/wiki/FAQ
* https://wordpress.org/plugins/wp-dropzone/
*
* FineUploader
* wp-multi-file-uploader
* https://docs.fineuploader.com/integrating/jquery.html
* https://github.com/FineUploader/fine-uploader
*
* PlUpload
* http://www.plupload.com/examples/events
*
* JQuery Drag and Drop Files
* https://danielmg.org/demo/java-script/bootstrap-drag-and-drop-uploader
*
* jQuery File Upload
* https://blueimp.github.io/jQuery-File-Upload/jquery-ui.html
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_upload' ) ) {
class Exopite_Simple_Options_Framework_Field_upload extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array() ) {
parent::__construct( $field, $value, $unique, $config );
$defaults = array(
'attach' => false,
'filecount' => 1,
'delete-enabled' => true,
'delete-force-confirm' => true,
'retry-enable-auto' => true,
'retry-max-auto-attempts' => 1,
'retry-auto-attempt-delay' => 2,
'auto-upload' => false,
);
$options = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : array();
$this->field['options'] = wp_parse_args( $options, $defaults );
}
public function output() {
echo $this->element_before();
?>
<!-- Fine Uploader Thumbnails template w/ customization
====================================================================== -->
<script type="text/template" id="qq-template-manual-trigger">
<div class="qq-uploader-selector qq-uploader"
qq-drop-area-text="<?php esc_html_e( 'Drop files here', 'exopite-sof' ); ?>">
<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"></div>
</div>
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span class="qq-upload-drop-area-text-selector"></span>
</div>
<div class="buttons">
<div class="qq-upload-button-selector exopite-sof-btn">
<div><?php esc_html_e( 'Select files', 'exopite-sof' ); ?></div>
</div>
<div class="exopite-sof-btn trigger-upload">
<i class="icon-upload icon-white"></i> <?php esc_html_e( 'Upload', 'exopite-sof' ); ?>
</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span><?php esc_html_e( 'Processing dropped files...', 'exopite-sof' ); ?></span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list" aria-live="polite"
aria-relevant="additions removals">
<li>
<div class="qq-progress-bar-container-selector">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"
class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<img class="qq-thumbnail-selector" qq-max-size="100" qq-server-scale>
<span class="qq-upload-file-selector qq-upload-file"></span>
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon"
aria-label="Edit filename"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
<button type="button"
class="qq-btn qq-upload-cancel-selector qq-upload-cancel"><?php esc_html_e( 'Cancel', 'exopite-sof' ); ?></button>
<button type="button"
class="qq-btn qq-upload-retry-selector qq-upload-retry"><?php esc_html_e( 'Retry', 'exopite-sof' ); ?></button>
<button type="button"
class="qq-btn qq-upload-delete-selector qq-upload-delete"><?php esc_html_e( 'Delete', 'exopite-sof' ); ?></button>
<span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>
<dialog class="qq-alert-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button"
class="qq-cancel-button-selector"><?php esc_html_e( 'Close', 'exopite-sof' ); ?></button>
</div>
</dialog>
<dialog class="qq-confirm-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button"
class="qq-cancel-button-selector"><?php esc_html_e( 'No', 'exopite-sof' ); ?></button>
<button type="button"
class="qq-ok-button-selector"><?php esc_html_e( 'Yes', 'exopite-sof' ); ?></button>
</div>
</dialog>
<dialog class="qq-prompt-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<input type="text">
<div class="qq-dialog-buttons">
<button type="button"
class="qq-cancel-button-selector"><?php esc_html_e( 'Cancel', 'exopite-sof' ); ?></button>
<button type="button"
class="qq-ok-button-selector"><?php esc_html_e( 'Ok', 'exopite-sof' ); ?></button>
</div>
</dialog>
</div>
</script>
<?php
$maxsize = Exopite_Simple_Options_Framework_Upload::file_upload_max_size();
if ( isset( $this->field['options']['maxsize'] ) && Exopite_Simple_Options_Framework_Upload::file_upload_max_size() >= $this->field['options']['maxsize'] ) {
$maxsize = $this->field['options']['maxsize'];
}
$allowed_mime_types = ( gettype( Exopite_Simple_Options_Framework_Upload::allowed_mime_types() ) == 'array' ) ? implode( ',', Exopite_Simple_Options_Framework_Upload::allowed_mime_types() ) : Exopite_Simple_Options_Framework_Upload::allowed_mime_types();
if ( isset( $this->field['options']['allowed'] ) && is_array( $this->field['options']['allowed'] ) ) {
$allowed_mime_types_array = explode( ',', $allowed_mime_types );
$allowed_mime_types_array = array_intersect( $allowed_mime_types_array, $this->field['options']['allowed'] );
$allowed_mime_types = implode( ',', $allowed_mime_types_array );
}
?>
<div class="qq-template" <?php
echo 'data-filecount="' . $this->field['options']['filecount'] . '" ';
echo 'data-mimetypes="' . $allowed_mime_types . '" ';
echo 'data-maxsize="' . $maxsize . '" ';
echo ( $this->field['options']['attach'] && $this->config['type'] == 'metabox' ) ? 'data-postid="' . get_the_ID() . '" ' : '';
echo 'data-ajaxurl="' . site_url( 'wp-admin/admin-ajax.php' ) . '" ';
echo 'data-delete-enabled="' . $this->field['options']['delete-enabled'] . '" ';
echo 'data-delete-force-confirm="' . $this->field['options']['delete-force-confirm'] . '" ';
echo 'data-retry-enable-auto="' . $this->field['options']['retry-enable-auto'] . '" ';
echo 'data-retry-max-auto-attempts="' . $this->field['options']['retry-max-auto-attempts'] . '" ';
echo 'data-retry-auto-attempt-delay="' . $this->field['options']['retry-auto-attempt-delay'] . '" ';
echo 'data-auto-upload="' . $this->field['options']['auto-upload'] . '" ';
?>>
</div>
<div class="qq-template-info">
<?php
echo esc_attr__( 'Max amount of files: ', 'exopite-sof' ) . $this->field['options']['filecount'] . '<br>';
echo esc_attr__( 'Max file upload size: ', 'exopite-sof' ) . number_format( (float) ( Exopite_Simple_Options_Framework_Upload::file_upload_max_size() / 1048576 ), 2, '.', '' ) . 'Mb<br><br>';
// echo '<i style="font-size:.9em;">' . esc_attr__( 'To increase file upload limit in the standard built-in WordPress media uploader up as large as available disk space allows, you could use', 'exopite-sof' ) . ' <a target="_blank" href="' . admin_url() . 'plugin-install.php?tab=plugin-information&plugin=tuxedo-big-file-uploads">Tuxedo Big File Uploads</a> ' . esc_attr__( 'Plugin', 'exopite-sof' ) . '</i>';
?>
</div>
<?php
echo $this->element_after();
}
public static function enqueue( $args ) {
if ( ! wp_script_is( 'fine-uploader' ) ) {
/**
* https://fineuploader.com/
*/
$resources = array(
array(
'name' => 'fine-uploader',
'fn' => 'fine-uploader-new.min.css',
'type' => 'style',
'dependency' => array(),
'version' => '5.15.5',
'attr' => 'all',
),
array(
'name' => 'fine-uploader',
'fn' => 'jquery.fine-uploader.min.js',
'type' => 'script',
'dependency' => array(),
'version' => '5.15.5',
'attr' => true,
),
array(
'name' => 'exopite-sof-fine-uploader-loader',
'fn' => 'loader-fine-uploader.min.js',
'type' => 'script',
'dependency' => array( 'fine-uploader' ),
'version' => '',
'attr' => true,
),
);
parent::do_enqueue( $resources, $args );
}
}
}
}
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Fieldset
*
* - to group elements
* - set element amount per row (1,2,3,4,6) <- like bootstrap
* - title (if more then one) top or bottom of element
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_fieldset' ) ) {
class Exopite_Simple_Options_Framework_Field_fieldset extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array(), $multilang ) {
parent::__construct( $field, $value, $unique, $config, $multilang );
}
public function output() {
echo $this->element_before();
$unallows = array();
$unique_id = ( ! empty( $this->unique ) ) ? $this->unique : $this->field['id'];
$self = new Exopite_Simple_Options_Framework( array(
'id' => $this->element_name(),
'multilang' => $this->config['multilang'],
'is_options_simple' => $this->config['is_options_simple'],
), null );
$i = 0;
$fields = $this->field['fields'];
echo '<div class="container">';
echo '<div class="row">';
/**
* 1 -> col-12 col-lg-12 (12/index)
* 2 -> col-12 col-lg-6
* 3 -> col-12 col-lg-4
* 4 -> col-12 col-lg-3
* 6 -> col-12 col-lg-2
*/
$col_classes = array( 'col', 'col-xs-12' );
$allowed_cols = array( 1, 2, 3, 4, 6 );
$col_number = ( isset( $this->field['options']['cols'] ) ) ? intval( $this->field['options']['cols'] ) : 1;
if ( ! in_array( $col_number, $allowed_cols ) ) {
$col_number = 1;
} else {
$col_classes[] = 'col-lg-' . ( 12 / $col_number );
$col_classes[] = 'exopite-sof-col-lg';
}
foreach ( $fields as $field ) {
echo '<div class="' . implode( ' ', $col_classes ) . '">';
if ( in_array( $field['type'], $unallows ) ) {
$field['_notice'] = true;
continue;
}
if ( is_serialized( $this->value ) ) {
$this->value = unserialize( $this->value );
}
$field_value = '';
if ( isset( $field['id'] ) && isset( $this->value[ $field['id'] ] ) ) {
$field_value = $this->value[ $field['id'] ];
} elseif ( isset( $field['default'] ) ) {
$field_value = $field['default'];
}
$class = 'Exopite_Simple_Options_Framework_Field_' . $field['type'];
echo $self->add_field( $field, $field_value );
echo '</div>'; // col
}
echo '</div>'; // row
echo '</div>'; // container
echo $this->element_after();
}
}
}
<?php
/*
Plugin Name: REST API TO MiniProgram
Plugin URI: http://www.watch-life.net
Description: 为微信小程序、app提供定制化WordPress REST API json 输出.
Version: 1.6.3
Author: jianbo
Author URI: http://www.minapper.com
License: GPL v3
WordPress requires at least: 4.7.1
*/
define('REST_API_TO_MINIPROGRAM_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('REST_API_TO_MINIPROGRAM_PLUGIN_FILE',__FILE__);
const REST_API_TO_MINIPROGRAM_PLUGIN_NAME='rest-api-to-miniprogram';
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/ram-util.php' );
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/ram-api.php' );
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/ram-weixin-api.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/settings/wp-wechat-config.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/settings/wp-post-config.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/settings/wp-tinymce-add-button.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-comment-fields.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-content.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-post-fields.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-category.php');
include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-users-columns.php');
if ( ! class_exists( 'RestAPIMiniProgram' ) ) {
class RestAPIMiniProgram {
public $wxapi = null;
public function __construct() {
//定制化内容输出,对pc端和api都生效
add_filter( 'the_content', 'custocm_content_filter' );
//对文章的自定义输出
add_filter( 'rest_prepare_post', 'custom_post_fields', 10, 3 );
//对页面的自定义输出
add_filter( 'rest_prepare_page', 'custom_post_fields', 10, 3 );
//对评论的自定义输出
add_filter( 'rest_prepare_comment', 'custom_comment_fields', 10, 3 );
add_filter( 'rest_prepare_category', 'custom_fields_rest_prepare_category', 10, 3 ); //获取分类的封面图片
add_filter( 'manage_users_columns', 'users_columns' );
add_action( 'manage_users_custom_column', 'output_users_columns', 10, 3 );
//给TinyMCE编辑器增加A标签按钮
add_action('after_wp_tiny_mce', 'add_tinyMCE_minapper_button');
//更新浏览次数(pc)
add_action('wp_head', 'addPostPageviews');
//获取浏览次数(pc)
//add_filter('raw_post_views', 'post_views');
// 管理配置
if ( is_admin() ) {
//new WP_Category_Config();
add_action('admin_menu', 'weixinapp_create_menu');
add_filter( 'plugin_action_links', 'ram_plugin_action_links', 10, 2 );
wp_post_config();
}
new RAM_API();//api
$this->wxapi = new RAW_Weixin_API();
}
}
// 实例化并加入全局变量
$GLOBALS['RestAPIMiniProgram'] = new RestAPIMiniProgram();
function RAW() {
if( ! isset( $GLOBALS['RestAPIMiniProgram'] ) ) {
$GLOBALS['RestAPIMiniProgram'] = new RestAPIMiniProgram();
}
return $GLOBALS['RestAPIMiniProgram'];
}
function ram_plugin_action_links( $links, $file ) {
if ( plugin_basename( __FILE__ ) !== $file ) {
return $links;
}
$settings_link = '<a href="https://www.minapper.com/" target="_blank"> <span style="color:#d54e21; font-weight:bold;">' . esc_html__( '升级增强版', 'REST API TO MiniProgram' ) . '</span></a>';
array_unshift( $links, $settings_link );
$settings_link = '<a href="https://www.minapper.com/" target="_blank"> <span style="color:#d54e21; font-weight:bold;">' . esc_html__( '升级专业版', 'REST API TO MiniProgram' ) . '</span></a>';
array_unshift( $links, $settings_link );
$settings_link = '<a href="https://www.watch-life.net/" target="_blank"> <span style="color:green; font-weight:bold;">' . esc_html__( '技术支持', 'REST API TO MiniProgram' ) . '</span></a>';
array_unshift( $links, $settings_link );
$settings_link = '<a href="admin.php?page=weixinapp_slug">' . esc_html__( '设置', 'REST API TO MiniProgram' ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
}
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class RAM_REST_Categories_Controller extends WP_REST_Controller{
public function __construct() {
$this->namespace = 'watch-life-net/v1';
$this->resource_name = 'category';
}
public function register_routes() {
register_rest_route( $this->namespace, '/' . $this->resource_name.'/getsubscription', array(
// Here we register the readable endpoint for collections.
array(
'methods' => 'GET',
'callback' => array( $this, 'getSubscription' ),
'permission_callback' => array( $this, 'get_item_permissions_check' ),
'args' => array(
'openid' => array(
'required' => true
)
)
),
// Register our schema callback.
'schema' => array( $this, 'get_public_item_schema' ),
) );
register_rest_route( $this->namespace, '/' . $this->resource_name.'/postsubscription', array(
// Here we register the readable endpoint for collections.
array(
'methods' => 'POST',
'callback' => array( $this, 'postSubscription' ),
'permission_callback' => array( $this, 'post_item_permissions_check' ),
'args' => array(
'openid' => array(
'required' => true
),
'categoryid' => array(
'required' => true
)
)
),
// Register our schema callback.
'schema' => array( $this, 'get_public_item_schema' ),
) );
register_rest_route( $this->namespace, '/' . $this->resource_name.'/ids', array(
// Here we register the readable endpoint for collections.
array(
'methods' => 'GET',
'callback' => array( $this, 'get_categories_ids' ),
//'permission_callback' => array( $this, 'get_item_permissions_check' )
),
// Register our schema callback.
'schema' => array( $this, 'get_public_item_schema' ),
) );
}
public function postSubscription($request)
{
global $wpdb;
$openid= $request['openid'];
$categoryid=$request['categoryid'];
$user_id =0;
$user = get_user_by( 'login', $openid);
if($user)
{
$user_id = $user->ID;
if(!empty($user_id))
{
$sql =$wpdb->prepare("SELECT * FROM ".$wpdb->usermeta ." WHERE user_id=%d and meta_key='wl_sub' and meta_value=%s",$user_id,$categoryid);
$usermetas = $wpdb->get_results($sql);
$count =count($usermetas);
if ($count==0)
{
if(add_user_meta($user_id, "wl_sub",$categoryid,false))
{
$result["code"]="success";
$result["message"]= "订阅成功";
$result["status"]="200";
}
else
{
$result["code"]="success";
$result["message"]= "订阅失败";
$result["status"]="500";
}
}
else
{
if (delete_user_meta($user_id,'wl_sub',$categoryid))
{
$result["code"]="success";
$result["message"]= "取消订阅成功";
$result["status"]="201";
}
else
{
$result["code"]="success";
$result["message"]= "取消订阅失败";
$result["status"]="501";
}
}
}
else
{
$result["code"]="success";
$result["message"]= "用户参数错误";
$result["status"]="500";
}
}
else
{
$result["code"]="success";
$result["message"]= "用户参数错误";
$result["status"]="500";
}
$response = rest_ensure_response($result);
return $response;
}
public function getSubscription($request)
{
global $wpdb;
$openid= $request['openid'];
$user_id =0;
$user = get_user_by( 'login', $openid);
if($user)
{
$user_id = $user->ID;
$usermeta = get_user_meta($user_id);
if (!empty($usermeta))
{
//$usermetaList =$wpdb->get_results($sql);
$result["code"]="success";
$result["message"]= "获取订阅成功";
$result["status"]="200";
if(!empty($usermeta['wl_sub']))
{
$result["subscription"]=$usermeta['wl_sub'];
$substr=implode(",",$usermeta['wl_sub']);
$result["substr"]=$substr;
$sql="SELECT SQL_CALC_FOUND_ROWS ".$wpdb->posts.".ID ,".$wpdb->posts.".post_title FROM ".$wpdb->posts." LEFT JOIN ".$wpdb->term_relationships." ON (".$wpdb->posts.".ID = ".$wpdb->term_relationships.".object_id) WHERE 1=1 AND ( ".$wpdb->term_relationships.".term_taxonomy_id IN (".$substr.")) AND ".$wpdb->posts.".post_type = 'post' AND (".$wpdb->posts.".post_status = 'publish') GROUP BY ".$wpdb->posts.".ID ORDER BY ".$wpdb->posts.".post_date DESC LIMIT 0, 20";
$usermetaList =$wpdb->get_results($sql);
$result["usermetaList"]=$usermetaList;
}
}
else
{
$result["code"]="success";
$result["message"]= "没有订阅的专栏";
$result["status"]="501";
}
}
else
{
$result["code"]="success";
$result["message"]= "用户参数错误";
$result["status"]="501";
}
$response = rest_ensure_response($result);
return $response;
}
public function get_categories_ids()
{
$categoriesId =get_option('wf_display_categories');
$result['Ids'] =$categoriesId;
$response = rest_ensure_response($result);
return $response;
}
public function post_item_permissions_check($request)
{
$openid= $request['openid'];
$categoryid=$request['categoryid'];
if(empty($openid) || empty($categoryid) )
{
return new WP_Error( 'error', '参数错误', array( 'status' => 500 ) );
}
else{
if(!username_exists($openid))
{
return new WP_Error( 'error', '不允许提交', array( 'status' => 500 ) );
}
}
return true;
}
public function get_item_permissions_check($request ) {
$openid= $request['openid'];
if(empty($openid) )
{
return new WP_Error( 'error', '参数错误', array( 'status' => 500 ) );
}
else
{
if(!username_exists($openid))
{
return new WP_Error( 'error', '不允许提交', array( 'status' => 500 ) );
}
}
return true;
}
}
<?php
function custom_fields_rest_prepare_category( $data, $item, $request ) {
$category_thumbnail_image='';
$temp='';
$openid= $request["openid"];
$subscription =getSubscription($openid);
$id =(string)$item->term_id;
if(empty($subscription))
{
$data->data['subimg'] ="subscription.png";
$data->data['subflag'] ="0";
}
else
{
if(array_search($id,$subscription ))
{
$data->data['subimg'] ="subscription-on.png";
$data->data['subflag'] ="1";
}
else
{
$data->data['subimg'] ="subscription.png";
$data->data['subflag'] ="0";
}
}
if($temp=get_term_meta($item->term_id,'catcover',true))
{
$category_thumbnail_image=$temp;
}
elseif($temp=get_term_meta($item->term_id,'thumbnail',true));
{
$category_thumbnail_image=$temp;
}
$data->data['category_thumbnail_image'] =$category_thumbnail_image;
return $data;
}
function getSubscription($openid)
{
global $wpdb;
$user_id =0;
$user = get_user_by('login', $openid);
$subscription= array();
if($user)
{
$user_id = $user->ID;
$usermeta = get_user_meta($user_id);
if (!empty($usermeta))
{
if(!empty($usermeta['wl_sub']))
{
$subscription=$usermeta['wl_sub'];
}
}
}
return $subscription;
}
/********* 给分类添加微信小程序封面 *********/
add_action( 'category_add_form_fields', 'weixin_new_term_catcover_field' );
function weixin_new_term_catcover_field() {
wp_nonce_field( basename( __FILE__ ), 'weixin_app_term_catcover_nonce' );
?>
<!-- <div class="form-field weixin-app-term-catcover-wrap">
<label for="weixin-app-term-catcover">微信小程序封面</label>
<input type="url" name="weixin_app_term_catcover" id="weixin-app-term-catcover" class="type-image regular-text" data-default-catcover="" />
</div> -->
<?php
}
add_action( 'category_edit_form_fields', 'weixin_edit_term_catcover_field' );
function weixin_edit_term_catcover_field( $term ) {
$default = '';
$catcover = get_term_meta( $term->term_id, 'catcover', true );
wp_enqueue_script('rawscript', plugins_url().'/'.REST_API_TO_MINIPROGRAM_PLUGIN_NAME.'/includes/js/script.js', false, '1.0');
if ( ! $catcover )
$catcover = $default; ?>
<tr class="form-field weixin-app-term-catcover-wrap">
<th scope="row"><label for="weixin-app-term-catcover">微信小程序封面</label></th>
<td>
<?php echo wp_nonce_field( basename( __FILE__ ), 'weixin_app_term_catcover_nonce' ); ?>
<input type="url" name="weixin_app_term_catcover" id="weixin-app-term-catcover" class="type-image regular-text" value="<?php echo esc_attr( $catcover ); ?>" data-default-catcover="<?php echo esc_attr( $default ); ?>" />
<input id="weixin_app_term_catcover-btn" class="button im-upload" type="button" value="选择图片" />
</td>
</tr>
<?php }
add_action( 'create_category', 'weixin_app_save_term_catcover' );
add_action( 'edit_category', 'weixin_app_save_term_catcover' );
function weixin_app_save_term_catcover( $term_id ) {
if ( ! isset( $_POST['weixin_app_term_catcover_nonce'] ) || ! wp_verify_nonce( $_POST['weixin_app_term_catcover_nonce'], basename( __FILE__ ) ) )
return;
$catcover = isset( $_POST['weixin_app_term_catcover'] ) ? $_POST['weixin_app_term_catcover'] : '';
if ( '' === $catcover ) {
delete_term_meta( $term_id, 'catcover' );
} else {
update_term_meta( $term_id, 'catcover', $catcover );
}
}
/********* *********/
\ No newline at end of file
<?php
require_once( REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/wxpay/WxPay.Api.php' );
/**
*
* JSAPI支付实现类
* 该类实现了从微信公众平台获取code、通过code获取openid和access_token、
* 生成jsapi支付js接口所需的参数、生成获取共享收货地址所需的参数
*
* 该类是微信支付提供的样例程序,商户可根据自己的需求修改,或者使用lib中的api自行开发
*
* @author widy
*
*/
class RAM_JsApiPay
{
/**
*
* 网页授权接口微信服务器返回的数据,返回样例如下
* {
* "access_token":"ACCESS_TOKEN",
* "expires_in":7200,
* "refresh_token":"REFRESH_TOKEN",
* "openid":"OPENID",
* "scope":"SCOPE",
* "unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL"
* }
* 其中access_token可用于获取共享收货地址
* openid是微信支付jsapi支付接口必须的参数
* @var array
*/
public $data = null;
/**
*
* 通过跳转获取用户的openid,跳转流程如下:
* 1、设置自己需要调回的url及其其他参数,跳转到微信服务器https://open.weixin.qq.com/connect/oauth2/authorize
* 2、微信服务处理完成之后会跳转回用户redirect_uri地址,此时会带上一些参数,如:code
*
* @return 用户的openid
*/
public function GetOpenid()
{
//通过code获得openid
if (!isset($_GET['code'])){
//触发微信返回code码
$baseUrl = urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING']);
$url = $this->__CreateOauthUrlForCode($baseUrl);
Header("Location: $url");
exit();
} else {
//获取code码,以获取openid
$code = $_GET['code'];
$openid = $this->getOpenidFromMp($code);
return $openid;
}
}
/**
*
* 获取jsapi支付的参数
* @param array $UnifiedOrderResult 统一支付接口返回的数据
* @throws RAM_WxPayException
*
* @return json数据,可直接填入js函数作为参数
*/
public function GetJsApiParameters($UnifiedOrderResult)
{
if(!array_key_exists("appid", $UnifiedOrderResult)
|| !array_key_exists("prepay_id", $UnifiedOrderResult)
|| $UnifiedOrderResult['prepay_id'] == "")
{
throw new RAM_WxPayException("参数错误");
}
$jsapi = new RAM_WxPayJsApiPay();
$jsapi->SetAppid($UnifiedOrderResult["appid"]);
$timeStamp = time();
$jsapi->SetTimeStamp("$timeStamp");
$jsapi->SetNonceStr(RAM_WxPayApi::getNonceStr());
$jsapi->SetPackage("prepay_id=" . $UnifiedOrderResult['prepay_id']);
$jsapi->SetSignType("MD5");
$jsapi->SetPaySign($jsapi->MakeSign());
//$parameters = json_encode($jsapi->GetValues());
$parameters = $jsapi->GetValues(); //xjb 修改为返回数组
return $parameters;
}
/**
*
* 通过code从工作平台获取openid机器access_token
* @param string $code 微信跳转回来带上的code
*
* @return openid
*/
public function GetOpenidFromMp($code)
{
$url = $this->__CreateOauthUrlForOpenid($code);
//初始化curl
$ch = curl_init();
$curlVersion = curl_version();
$ua = "WXPaySDK/0.0.5 (".PHP_OS.") PHP/".PHP_VERSION." CURL/".$curlVersion['version']." ".RAM_WxPayConfig::MCHID;
//设置超时
curl_setopt($ch, CURLOPT_TIMEOUT, $this->curl_timeout);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($ch,CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
if(RAM_WxPayConfig::CURL_PROXY_HOST != "0.0.0.0"
&& RAM_WxPayConfig::CURL_PROXY_PORT != 0){
curl_setopt($ch,CURLOPT_PROXY, RAM_WxPayConfig::CURL_PROXY_HOST);
curl_setopt($ch,CURLOPT_PROXYPORT, RAM_WxPayConfig::CURL_PROXY_PORT);
}
//运行curl,结果以jason形式返回
$res = curl_exec($ch);
curl_close($ch);
//取出openid
$data = json_decode($res,true);
$this->data = $data;
$openid = $data['openid'];
return $openid;
}
/**
*
* 拼接签名字符串
* @param array $urlObj
*
* @return 返回已经拼接好的字符串
*/
private function ToUrlParams($urlObj)
{
$buff = "";
foreach ($urlObj as $k => $v)
{
if($k != "sign"){
$buff .= $k . "=" . $v . "&";
}
}
$buff = trim($buff, "&");
return $buff;
}
/**
*
* 获取地址js参数
*
* @return 获取共享收货地址js函数需要的参数,json格式可以直接做参数使用
*/
public function GetEditAddressParameters()
{
$getData = $this->data;
$data = array();
$data["appid"] = RAM_WxPayConfig::APPID;
$data["url"] = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$time = time();
$data["timestamp"] = "$time";
$data["noncestr"] = "1234568";
$data["accesstoken"] = $getData["access_token"];
ksort($data);
$params = $this->ToUrlParams($data);
$addrSign = sha1($params);
$afterData = array(
"addrSign" => $addrSign,
"signType" => "sha1",
"scope" => "jsapi_address",
"appId" => RAM_WxPayConfig::APPID,
"timeStamp" => $data["timestamp"],
"nonceStr" => $data["noncestr"]
);
$parameters = json_encode($afterData);
return $parameters;
}
/**
*
* 构造获取code的url连接
* @param string $redirectUrl 微信服务器回跳的url,需要url编码
*
* @return 返回构造好的url
*/
private function __CreateOauthUrlForCode($redirectUrl)
{
$urlObj["appid"] = RAM_WxPayConfig::APPID;
$urlObj["redirect_uri"] = "$redirectUrl";
$urlObj["response_type"] = "code";
$urlObj["scope"] = "snsapi_base";
$urlObj["state"] = "STATE"."#wechat_redirect";
$bizString = $this->ToUrlParams($urlObj);
return "https://open.weixin.qq.com/connect/oauth2/authorize?".$bizString;
}
/**
*
* 构造获取open和access_toke的url地址
* @param string $code,微信跳转带回的code
*
* @return 请求的url
*/
private function __CreateOauthUrlForOpenid($code)
{
$urlObj["appid"] = RAM_WxPayConfig::APPID;
$urlObj["secret"] = RAM_WxPayConfig::APPSECRET;
$urlObj["code"] = $code;
$urlObj["grant_type"] = "authorization_code";
$bizString = $this->ToUrlParams($urlObj);
return "https://api.weixin.qq.com/sns/oauth2/access_token?".$bizString;
}
}
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Range
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_range' ) ) {
class Exopite_Simple_Options_Framework_Field_range extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array() ) {
parent::__construct( $field, $value, $unique, $config );
}
public function output() {
/**
* Update input if range changed
*
* @link https://stackoverflow.com/questions/10004723/html5-input-type-range-show-range-value/45210546#45210546
*/
$attr = array();
if ( ! empty( $this->field['min'] ) ) {
$attr[] = 'min="' . $this->field['min'] . '"';
}
if ( ! empty( $this->field['max'] ) ) {
$attr[] = 'max="' . $this->field['max'] . '"';
}
if ( ! empty( $this->field['step'] ) ) {
$attr[] = 'step="' . $this->field['step'] . '"';
}
$attrs = ( ! empty( $attr ) ) ? ' ' . trim( implode( ' ', $attr ) ) : '';
$unit = ( isset( $this->field['unit'] ) ) ? '<em>' . $this->field['unit'] . '</em>' : '';
$classes = ( isset( $this->field['class'] ) ) ? implode( ' ', explode( ' ', $this->field['class'] ) ) : '';
echo $this->element_before();
echo '<input type="range" name="' . $this->element_name() . '" oninput="updateRangeInput(this)" class="range ' . $classes . '"' . $attrs . ' value="' . $this->element_value() . '"' . $this->element_attributes() . '>' . $unit;
echo '<input type="number" value="' . $this->element_value() . '" oninput="updateInputRange(this)"' . $attrs . '>';
echo $this->element_after();
}
}
}
/* REQUIRED for core functionality */
.responsive-tabs__heading { display: none;}
.responsive-tabs__list__item { display: inline; cursor:pointer;}
@media (max-width: 767px) {
.responsive-tabs__list { display: none;}
.responsive-tabs__heading { display: block; cursor: pointer; }
.responsive-tabs__panel--closed-accordion-only { display: none;}
}
@media (min-width: 768px) {
.responsive-tabs__panel--closed-accordion-only { display: block !important;}
}
/* END - Required for core functionality */
/* OPTIONAL - Basic Skin */
.responsive-tabs-wrapper {
clear: both;
zoom: 1;
}
.responsive-tabs-wrapper:before,
.responsive-tabs-wrapper:after {
content: "";
display: table;
}
.responsive-tabs-wrapper:after {
clear: both;
}
.responsive-tabs__heading:focus,
.responsive-tabs__list__item:focus { outline: 1px solid #ccc; }
.responsive-tabs__heading--active:focus,
.responsive-tabs__list__item--active:focus { outline: none !important;}
.responsive-tabs__list { font-size: 1.2em; margin: 2em 0 0 0; border-bottom: 1px solid #ddd; padding-top: 0; padding-left:0; padding-right:0; padding-bottom:13px; line-height: 1em;}
.responsive-tabs__list__item { background: #eee; padding: 10px 20px; margin-right: 1em; border-top-left-radius: 5px; border-top-right-radius: 5px;border: 1px solid #ddd; }
.responsive-tabs__list__item:hover {background: #efefef }
.responsive-tabs__list__item--active,
.responsive-tabs__list__item--active:hover { background: #fff; border-bottom-color: #fff;}
.responsive-tabs__panel { background:#fff; margin-top:-1px; padding:20px; border-left: 1px solid #ddd; border-right: 1px solid #ddd; border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}
@media (min-width: 768px) {
.responsive-tabs__list, .responsive-tabs__panel {
width:95%;
}
}
@media (max-width: 767px) {
.responsive-tabs__heading {
padding: 0.5em; border-radius: 5px; border: 1px solid #ccc; box-shadow: 0px 2px 3px rgba(0,0,0,0.4);
background: #ddd;
position: relative;
}
.responsive-tabs__heading:after {
content:"";
display: block;
position: absolute;
right: 20px;
top: 40%;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #000;
}
.responsive-tabs__heading:hover,
.responsive-tabs__heading--active:hover { background-color: #efefef}
.responsive-tabs__heading--active { background: #fff;}
.responsive-tabs__heading--active:after {
border-bottom: 10px solid #000;
border-top:0;
}
}
/* END - Optional - Basic Skin */
.option .imglink {
width:80%;
max-width:600px;
}
.option .intext {
width:60%;
max-width:400px;
}
.option select {
width:160px;
}
.option textarea {
width:80%;
max-width:600px;
min-height:180px;
}
.wrap .dashicons-admin-settings {
color: #0073aa;
font-size: 30px;
margin: 3px 15px 0 0;
}
.wrap .version {
background: #555;
color: #fff;
font-size: 12px;
margin: 0 0 0 10px;
padding: 1px 8px;
border-radius: 2px;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.wrap .clearfix {
margin-top: 20px;
margin-left:-20px;
margin-right:-20px;
padding: 0;
/* border-top: 1px solid #e5e5e5; */
}
.wrap .hide {
display:none!important;
}
\ No newline at end of file
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.8.2
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011-2017 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Editor
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_editor' ) ) {
class Exopite_Simple_Options_Framework_Field_editor extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array() ) {
parent::__construct( $field, $value, $unique, $config );
}
public function output() {
$classes = ( isset( $this->field['class'] ) ) ? explode( ' ', $this->field['class'] ) : array();//$this->element_class()
$editor = ( isset( $this->field['editor'] ) ) ? $this->field['editor'] : 'tinymce';
echo $this->element_before();
if ( $editor == 'tinymce' && isset( $this->field['sub'] ) && $this->field['sub'] ) {
$classes[] = 'tinymce-js';
$classes = implode( ' ', $classes );
echo '<textarea id="' . $this->field['id'] . '" name="' . $this->element_name() . '" class="' . $classes . '"' . $this->element_attributes() . '>' . $this->element_value() . '</textarea>';
} elseif ( $editor == 'trumbowyg' ) {
$classes[] = 'trumbowyg-js';
$classes = implode( ' ', $classes );
echo '<textarea id="' . $this->field['id'] . '" name="' . $this->element_name() . '" data-icon-path="' . plugin_dir_url( __DIR__ ) . 'assets/editors/trumbowyg/icons.svg" class="' . $classes . '"' . $this->element_attributes() . '>' . $this->element_value() . '</textarea>';
} else {
$args = array(
'textarea_rows' => 15,
'editor_class' => implode( ' ', $classes ),
'textarea_name' => $this->element_name(),
'teeny' => false,
// output the minimal editor config used in Press This
'dfw' => false,
// replace the default fullscreen with DFW (supported on the front-end in WordPress 3.4)
'tinymce' => true,
// load TinyMCE, can be used to pass settings directly to TinyMCE using an array()
'quicktags' => true
// load Quicktags, can be used to pass settings directly to Quicktags using an array()
);
wp_editor( $this->element_value(), $this->field['id'], $args );
}
echo $this->element_after();
}
public static function enqueue( $args ) {
if ( isset( $args['field'] ) && isset( $args['field']['editor'] ) && is_array( $args['field']['editor'] ) ) {
foreach ( $args['field']['editor'] as $editor ) {
switch ( $editor ) {
case 'trumbowyg':
$resources = array(
array(
'name' => 'trumbowyg',
'fn' => 'editors/trumbowyg/trumbowyg.min.css',
'type' => 'style',
'dependency' => array(),
'version' => '2.10.0',
'attr' => 'all',
),
array(
'name' => 'trumbowyg-colors',
'fn' => 'editors/trumbowyg/trumbowyg.colors.min.css',
'type' => 'style',
'dependency' => array(),
'version' => '2.10.0',
'attr' => 'all',
),
array(
'name' => 'trumbowyg-user',
'fn' => 'editors/trumbowyg/trumbowyg.user.min.css',
'type' => 'style',
'dependency' => array(),
'version' => '2.10.0',
'attr' => 'all',
),
array(
'name' => 'trumbowyg',
'fn' => 'editors/trumbowyg/trumbowyg.min.js',
'type' => 'script',
'dependency' => array( 'jquery' ),
'version' => '1.8.2',
'attr' => true,
),
array(
'name' => 'trumbowyg-base64',
'fn' => 'editors/trumbowyg/trumbowyg.base64.min.js',
'type' => 'script',
'dependency' => array( 'trumbowyg' ),
'version' => '1.8.2',
'attr' => true,
),
array(
'name' => 'trumbowyg-colors',
'fn' => 'editors/trumbowyg/trumbowyg.colors.min.js',
'type' => 'script',
'dependency' => array( 'trumbowyg' ),
'version' => '1.8.2',
'attr' => true,
),
array(
'name' => 'trumbowyg-fontfamily',
'fn' => 'editors/trumbowyg/trumbowyg.fontfamily.min.js',
'type' => 'script',
'dependency' => array( 'trumbowyg' ),
'version' => '1.8.2',
'attr' => true,
),
array(
'name' => 'trumbowyg-fontsize',
'fn' => 'editors/trumbowyg/trumbowyg.fontsize.min.js',
'type' => 'script',
'dependency' => array( 'trumbowyg' ),
'version' => '1.8.2',
'attr' => true,
),
array(
'name' => 'exopite-sof-trumbowyg-loader',
'fn' => 'loader-jquery-trumbowyg.min.js',
'type' => 'script',
'dependency' => array( 'trumbowyg' ),
'version' => '',
'attr' => true,
),
);
parent::do_enqueue( $resources, $args );
break;
}
}
}
}
}
}
/**
* Exopite Simple Options Framework Trumbowyg
*/
; (function ($, window, document, undefined) {
var pluginName = "exopiteSOFColorpicker";
// The actual plugin constructor
function Plugin(element, options) {
this.element = element;
this._name = pluginName;
this.$element = $(element);
this.init();
}
Plugin.prototype = {
init: function () {
var plugin = this;
plugin.$element.find('.colorpicker').each(function (index, el) {
if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
if ($(el).hasClass('disabled')) return;
$(el).wpColorPicker({
/**
* @param {Event} event - standard jQuery event, produced by whichever
* control was changed.
* @param {Object} ui - standard jQuery UI object, with a color member
* containing a Color.js object.
*/
change: function (event, ui) {
plugin.change(event, ui, $(this));
},
});
});
plugin.$element.closest('.exopite-sof-wrapper').on('exopite-sof-field-group-item-added-after', function (event, $cloned) {
$cloned.find('.colorpicker').each(function (index, el) {
if ($(el).closest('.exopite-sof-cloneable__item').hasClass('exopite-sof-cloneable__muster')) return;
if ($(el).hasClass('disabled')) return;
$(el).wpColorPicker({
change: function (event, ui) {
plugin.change(event, ui, $(this));
},
});
});
console.log('color picker clone');
});
},
change: function (event, ui, $this) {
var color = ui.color.toString();
if ($this.hasClass('font-color-js')) {
console.log('has font-color');
$this.parents('.exopite-sof-font-field').find('.exopite-sof-font-preview').css({ 'color': color });
}
},
};
$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName,
new Plugin(this, options));
}
});
};
})(jQuery, window, document);
; (function ($) {
"use strict";
$(document).ready(function () {
$('.exopite-sof-field').exopiteSOFColorpicker();
});
}(jQuery));
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function weixinapp_create_menu() {
// 创建新的顶级菜单
add_menu_page('微慕小程序', '微慕小程序', 'administrator', 'weixinapp_slug', 'weixinapp_settings_page', plugins_url('rest-api-to-miniprogram/includes/images/icon16.png'),null);
// 调用注册设置函数
add_action( 'admin_init', 'register_weixinappsettings' );
}
function get_jquery_source() {
$url = plugins_url('',__FILE__);
wp_enqueue_style("tabs", plugins_url()."/rest-api-to-miniprogram/includes/js/tab/tabs.css", false, "1.0", "all");
wp_enqueue_script("tabs", plugins_url()."/rest-api-to-miniprogram/includes/js/tab/tabs.min.js", false, "1.0");
}
function register_weixinappsettings() {
// 注册设置
register_setting( 'weixinapp-group', 'wf_appid' );
register_setting( 'weixinapp-group', 'wf_secret' );
register_setting( 'weixinapp-group', 'wf_swipe' );
register_setting( 'weixinapp-group', 'wf_mchid' );
register_setting( 'weixinapp-group', 'wf_paykey' );
register_setting( 'weixinapp-group', 'wf_paybody' );
register_setting( 'weixinapp-group', 'wf_poster_imageurl' );
register_setting( 'weixinapp-group', 'wf_enable_comment_option' );
register_setting( 'weixinapp-group', 'wf_enable_comment_check' );
register_setting( 'weixinapp-group', 'wf_praise_word' );
register_setting( 'weixinapp-group', 'wf_enterprise_minapp' );
register_setting( 'weixinapp-group', 'wf_list_ad' );
register_setting( 'weixinapp-group', 'wf_list_ad_id' );
register_setting( 'weixinapp-group', 'wf_list_ad_every' );
register_setting( 'weixinapp-group', 'wf_excitation_ad_id' );
register_setting( 'weixinapp-group', 'wf_video_ad_id' );
register_setting( 'weixinapp-group', 'wf_interstitial_ad_id' );
register_setting( 'weixinapp-group', 'wf_detail_ad' );
register_setting( 'weixinapp-group', 'wf_detail_ad_id' );
register_setting( 'weixinapp-group', 'wf_about' );
register_setting( 'weixinapp-group', 'wf_display_categories' );
}
function weixinapp_settings_page() {
?>
<div class="wrap">
<h2>微慕小程序设置</h2>
<p>Rest API to miniprogram by <a href="https://www.watch-life.net" target="_blank">守望轩</a>.
<?php
if (!empty($_REQUEST['settings-updated']))
{
echo '<div id="message" class="updated fade"><p><strong>设置已保存</strong></p></div>';
}
if (version_compare(PHP_VERSION, '5.6.0', '<=') )
{
echo '<div class="notice notice-error is-dismissible">
<p><font color="red">提示:php版本小于5.6.0, 插件程序将无法正常使用,当前系统的php版本是:'.PHP_VERSION.'</font></p>
</div>';
}
?>
<form method="post" action="options.php">
<div class="responsive-tabs">
<?php settings_fields( 'weixinapp-group' ); ?>
<?php do_settings_sections( 'weixinapp-group' ); ?>
<div class="responsive-tabs">
<h2> 常规设置</h2>
<div class="section">
<table class="form-table">
<tr valign="top">
<th scope="row">AppID</th>
<td><input type="text" name="wf_appid" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_appid') ); ?>" />* </td>
</tr>
<tr valign="top">
<th scope="row">AppSecret</th>
<td><input type="text" name="wf_secret" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_secret') ); ?>" />* </td>
</tr>
<tr valign="top">
<th scope="row">商户号MCHID</th>
<td><input type="text" name="wf_mchid" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_mchid') ); ?>" /> <p style="color: #959595; display:inline">微信支付商户后台获取</p></td>
</tr>
<tr valign="top">
<th scope="row">商户支付密钥key</th>
<td><input type="text" name="wf_paykey" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_paykey') ); ?>" /> <p style="color: #959595; display:inline">微信支付商户后台获取</p></td>
</tr>
<tr valign="top">
<th scope="row">支付描述</th>
<td><input type="text" name="wf_paybody" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_paybody') ); ?>" /><br /><p style="color: #959595; display:inline">* 商家名称-销售商品类目,例如:守望轩-赞赏</p></td>
</tr>
<tr valign="top">
<th scope="row">小程序首页滑动文章ID</th>
<td><input type="text" name="wf_swipe" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_swipe') ); ?>" /><p style="color: #959595; display:inline">* 请用英文半角逗号分隔</p></td>
</tr>
<tr valign="top">
<th scope="row">在小程序里显示的文章分类id</th>
<td><input type="text" name="wf_display_categories" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_display_categories') ); ?>" />
<br /><p style="color: #959595 ; display:inline">* 文章分类id,只支持一级分类,请用英文半角逗号分隔,留空则显示所有分类</p>
</td>
</tr>
<tr valign="top">
<th scope="row">选择"关于"页面</th>
<td>
<select id="wf_about" name="wf_about" >
<?php
$mypages = get_pages( array( 'child_of' =>0, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) );
foreach( $mypages as $page ) {
$title = $page->post_title;
$pageId=$page->ID;
?>
<option value="<?php echo $pageId; ?>" <?php echo get_option('wf_about')==$pageId?'selected':''; ?>><?php echo $title ?></option>"
<?php } ?>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row">开启小程序的评论</th>
<td>
<?php
$wf_enable_comment_option =get_option('wf_enable_comment_option');
$checkbox=empty($wf_enable_comment_option)?'':'checked';
echo '<input name="wf_enable_comment_option" type="checkbox" value="1" '.$checkbox. ' />';
?>
&emsp;&emsp;&emsp;&emsp;“订阅者”用户开启评论审核
<?php
$wf_enable_comment_check =get_option('wf_enable_comment_check');
$checkbox1=empty($wf_enable_comment_check)?'':'checked';
echo '<input name="wf_enable_comment_check" type="checkbox" value="1" '.$checkbox1. ' />';
?>
</td>
</tr>
<tr valign="top">
<th scope="row">海报图片默认地址</th>
<td><input type="text" name="wf_poster_imageurl" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_poster_imageurl') ); ?>" /><br/><p style="color: #959595; display:inline">* 请输完整的图片地址,例如:https://www.watch-life.net/images/poster.jpg</p></td>
</tr>
<tr valign="top">
<th scope="row">"赞赏"文字调整为</th>
<td><input type="text" name="wf_praise_word" placeholder="喜欢" style="width:400px; height:40px" value="<?php echo esc_attr( get_option('wf_praise_word') ); ?>" /><br /><p style="color: #959595; display:inline">* 例如:<code>鼓励</code>,<code>喜欢</code><code>稀罕</code>,不要超过两个汉字</p></td>
</tr>
<tr valign="top">
<th scope="row">小程序是否是企业主体</th>
<td>
<?php
$wf_enterprise_minapp =get_option('wf_enterprise_minapp');
$checkbox=empty($wf_enterprise_minapp)?'':'checked';
echo '<input name="wf_enterprise_minapp" type="checkbox" value="1" '.$checkbox. ' />';
?><p style="color: #959595; display:inline">* 如果是企业主体的小程序,请勾选</p>
</td>
</tr>
</table>
</div>
<h2>广告设置</h2>
<div class="section">
<table class="form-table">
<tr valign="top">
<th scope="row">开启文章列表广告</th>
<td>
<?php
$wf_list_ad =get_option('wf_list_ad');
$checkbox=empty($wf_list_ad)?'':'checked';
echo '<input name="wf_list_ad" type="checkbox" value="1" '.$checkbox. ' />';
?>
&emsp;&emsp;&emsp;Banner广告id:&emsp;<input type="text" name="wf_list_ad_id" style="width:300px; height:40px" value="<?php echo esc_attr( get_option('wf_list_ad_id') ); ?>" />
<br/>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<input type="number" name="wf_list_ad_every" style="width:40px; height:40px" value="<?php echo esc_attr( get_option('wf_list_ad_every') ); ?>" />条列表展示一条广告<br/><p style="color: #959595; display:inline">&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;请输入整数,否则无法正常展示广告</p>
</td>
</td>
</tr>
<tr valign="top">
<th scope="row">开启内容详情页广告</th>
<td>
<?php
$wf_detail_ad =get_option('wf_detail_ad');
$checkbox=empty($wf_detail_ad)?'':'checked';
echo '<input name="wf_detail_ad" type="checkbox" value="1" '.$checkbox. ' />';
?>
&emsp;&emsp;&emsp;Banner广告id:&emsp;<input type="text" name="wf_detail_ad_id" style="width:300px; height:40px" value="<?php echo esc_attr( get_option('wf_detail_ad_id') ); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">激励视频广告id</th>
<td>
<input type="text" name="wf_excitation_ad_id" style="width:300px; height:40px" value="<?php echo esc_attr( get_option('wf_excitation_ad_id') ); ?>" />
</td>
</tr>
<tr valign="top">
<th scope="row">视频广告id</th>
<td>
<input type="text" name="wf_video_ad_id" style="width:300px; height:40px" value="<?php echo esc_attr( get_option('wf_video_ad_id') ); ?>" />
</td>
</tr>
<th scope="row">插屏广告id</th>
<td>
<input type="text" name="wf_interstitial_ad_id" style="width:300px; height:40px" value="<?php echo esc_attr( get_option('wf_interstitial_ad_id') ); ?>" />
</td>
</tr>
</table>
</div>
<h2>微慕增强版</h2>
<div class="section">
<div style="display: flex; flex-direction: row; margin-bottom: 10px">
<a href="https://www.minapper.com" target="_blank" style="text-decoration: none"><div style="width:120px; height:32px; background-color: #ff8f3b; border-radius: 4px; color: #fff;display: flex;justify-content: center; align-items: center;margin-right: 16px">微慕官网</div></a>
<a href="https://mall.minapper.com" target="_blank" style="text-decoration: none"><div style="width:120px; height:32px; background-color: #fff; border: 1px solid #ff8f3b; border-radius: 4px; box-sizing: border-box; color: #ff8f3b;display: flex;justify-content: center; align-items: center">微慕商城</div></a>
</div>
<p style="color: #4c4c4c;text-align:justify; line-height: 2">微慕增强版WordPress小程序是一款,在原守望轩开源小程序(现微慕开源小程序)基础上重新架构、设计、优化过的wordpress多端小程序,性能和用户体验更佳,界面设计更加简洁清新,同时打通<span style="font-weight:bold">微信小程序、QQ小程序、百度小程序、支付宝小程序、头条小程序...真正实现一站多端</span>,可使用微信扫描下方小程序码直接体验:</p>
<div>
<img src="https://plusimg.minapper.com/wp-content/uploads/2019/08/1565183497-%E5%BE%AE%E6%85%95%E6%B5%B7%E6%8A%A5-2019%E5%B9%B47%E6%9C%88.jpg" alt="微慕增强版" width="100%"></img>
</div>
</div>
<h2>微慕版专业版</h2>
<div class="section">
<div style="display: flex; flex-direction: row; margin-bottom: 10px">
<a href="https://www.minapper.com" target="_blank" style="text-decoration: none"><div style="width:120px; height:32px; background-color: #fc6e6e; border-radius: 4px; color: #fff;display: flex;justify-content: center; align-items: center;margin-right: 16px">微慕官网</div></a>
<a href="https://mall.minapper.com" target="_blank" style="text-decoration: none"><div style="width:120px; height:32px; background-color: #fff; border: 1px solid #fc6e6e; border-radius: 4px; box-sizing: border-box; color: #fc6e6e;display: flex;justify-content: center; align-items: center">微慕商城</div></a>
</div>
<p style="color: #4c4c4c;text-align:justify; line-height: 2">微慕版专业版WordPress小程序和插件,在“守望轩”开源小程序的基础上,架构完全重构,在性能上大幅度优化,增加了<span style="font-weight:bold">动态圈子、积分系统、文章投稿、发布动态、付费阅读、会员权限、多种图文列表样式、预约表单、模板消息</span>等功能,并且免费提供标准版、旅游版、图片版、企业版4套前端模板,可使用微信扫描下方小程序码直接体验:</p>
<div>
<img src="https://www.watch-life.net/images/minapper-pro.jpg" alt="微慕专业版" width="100%"></img>
</div>
</div>
</div>
<?php submit_button();?>
</form>
<?php get_jquery_source(); ?>
<script>
jQuery(document).ready(function($) {
RESPONSIVEUI.responsiveTabs();
// if($("input[name=post_meta]").attr('checked')) {
// $("#section_meta_list").addClass("hide");
// }
});
</script>
</div>
<?php }
\ No newline at end of file
!function(t,o,e,i){var n="exopiteSOFMinicolors";function s(o,e){this.element=o,this._name=n,this.$element=t(o),this.init()}s.prototype={init:function(){var o=this;o.minicolorOptions={theme:"default",swatches:"#000|#fff|#f00|#dd9933|#eeee22|#81d742|#1e73be|#8224e3|#2196f3|#4caf50|#ffeb3b|#ff9800|#795548|rgba(0, 0, 0, 0)".split("|"),change:function(e,i){o.change(e,i,t(this))},hide:function(){let e=t(this).val();t(this).val(o.rgb2hex(e))}},o.$element.find(".minicolor").each(function(e,i){t(i).closest(".exopite-sof-cloneable__item").hasClass("exopite-sof-cloneable__muster")||t(i).hasClass("disabled")||(o.minicolorOptions.opacity=t(i).attr("data-opacity")||!1,o.minicolorOptions.control=t(i).attr("data-control")||"saturation",o.minicolorOptions.format=t(i).attr("data-format")||"rgb",t(i).minicolors(o.minicolorOptions))}),o.$element.closest(".exopite-sof-wrapper").on("exopite-sof-field-group-item-added-after",function(e,i){i.find(".minicolor").each(function(e,i){t(i).closest(".exopite-sof-cloneable__item").hasClass("exopite-sof-cloneable__muster")||t(i).hasClass("disabled")||t(i).minicolors(o.minicolorOptions)})})},rgb2hex:function(t){return rgba=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?1[\s+]?\)/i),console.log("rgba: "+rgba),null===rgba?t:rgba&&4===rgba.length?"#"+("0"+parseInt(rgba[1],10).toString(16)).slice(-2)+("0"+parseInt(rgba[2],10).toString(16)).slice(-2)+("0"+parseInt(rgba[3],10).toString(16)).slice(-2):""},change:function(t,o,e){var i=t;e.hasClass("font-color-js")&&(console.log("has font-color"),e.parents(".exopite-sof-font-field").find(".exopite-sof-font-preview").css({color:i})),e.val(this.rgb2hex(i))}},t.fn[n]=function(o){return this.each(function(){t.data(this,"plugin_"+n)||t.data(this,"plugin_"+n,new s(this,o))})}}(jQuery,window,document),function(t){"use strict";t(document).ready(function(){t(".exopite-sof-field").exopiteSOFMinicolors()})}(jQuery);
\ No newline at end of file
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Notice
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_notice' ) ) {
class Exopite_Simple_Options_Framework_Field_notice extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array() ) {
parent::__construct( $field, $value, $unique, $config );
}
public function output() {
$classes = ( isset( $this->field['class'] ) ) ? implode( ' ', explode( ' ', $this->field['class'] ) ) : '';
$content = ( isset( $this->field['content'] ) ) ? $this->field['content'] : '';
if ( isset( $this->field['callback'] ) ) {
$callback = $this->field['callback'];
if ( is_callable( $callback['function'] ) ) {
$args = ( isset( $callback['args'] ) ) ? $callback['args'] : '';
$content = call_user_func( $callback['function'], $args );
}
}
echo $this->element_before();
echo '<div class="exopite-sof-notice ' . $classes . '">' . $content . '</div>';
echo $this->element_after();
}
}
}
.minicolors{position:relative}.minicolors-sprite{background-image:url(jquery.minicolors.png)}.minicolors-swatch{position:absolute;vertical-align:middle;background-position:-80px 0;border:solid 1px #ccc;cursor:text;padding:0;margin:0;display:inline-block}.minicolors-swatch-color{position:absolute;top:0;left:0;right:0;bottom:0}.minicolors input[type=hidden]+.minicolors-swatch{width:28px;position:static;cursor:pointer}.minicolors input[type=hidden][disabled]+.minicolors-swatch{cursor:default}.minicolors-panel{position:absolute;width:173px;background:#fff;border:solid 1px #ccc;box-shadow:0 0 20px rgba(0,0,0,.2);z-index:99999;box-sizing:content-box;display:none}.minicolors-panel.minicolors-visible{display:block}.minicolors-position-top .minicolors-panel{top:-154px}.minicolors-position-right .minicolors-panel{right:0}.minicolors-position-bottom .minicolors-panel{top:auto}.minicolors-position-left .minicolors-panel{left:0}.minicolors-with-opacity .minicolors-panel{width:194px}.minicolors .minicolors-grid{position:relative;top:1px;left:1px;width:150px;height:150px;margin-bottom:2px;background-position:-120px 0;cursor:crosshair}[dir=rtl] .minicolors .minicolors-grid{right:1px}.minicolors .minicolors-grid-inner{position:absolute;top:0;left:0;width:150px;height:150px}.minicolors-slider-saturation .minicolors-grid{background-position:-420px 0}.minicolors-slider-saturation .minicolors-grid-inner{background-position:-270px 0;background-image:inherit}.minicolors-slider-brightness .minicolors-grid{background-position:-570px 0}.minicolors-slider-brightness .minicolors-grid-inner{background-color:#000}.minicolors-slider-wheel .minicolors-grid{background-position:-720px 0}.minicolors-opacity-slider,.minicolors-slider{position:absolute;top:1px;left:152px;width:20px;height:150px;background-color:#fff;background-position:0 0;cursor:row-resize}[dir=rtl] .minicolors-opacity-slider,[dir=rtl] .minicolors-slider{right:152px}.minicolors-slider-saturation .minicolors-slider{background-position:-60px 0}.minicolors-slider-brightness .minicolors-slider{background-position:-20px 0}.minicolors-slider-wheel .minicolors-slider{background-position:-20px 0}.minicolors-opacity-slider{left:173px;background-position:-40px 0;display:none}[dir=rtl] .minicolors-opacity-slider{right:173px}.minicolors-with-opacity .minicolors-opacity-slider{display:block}.minicolors-grid .minicolors-picker{position:absolute;top:70px;left:70px;width:12px;height:12px;border:solid 1px #000;border-radius:10px;margin-top:-6px;margin-left:-6px;background:0 0}.minicolors-grid .minicolors-picker>div{position:absolute;top:0;left:0;width:8px;height:8px;border-radius:8px;border:solid 2px #fff;box-sizing:content-box}.minicolors-picker{position:absolute;top:0;left:0;width:18px;height:2px;background:#fff;border:solid 1px #000;margin-top:-2px;box-sizing:content-box}.minicolors-swatches,.minicolors-swatches li{margin:5px 0 3px 5px;padding:0;list-style:none;overflow:hidden}[dir=rtl] .minicolors-swatches,[dir=rtl] .minicolors-swatches li{margin:5px 5px 3px 0}.minicolors-swatches .minicolors-swatch{position:relative;float:left;cursor:pointer;margin:0 4px 0 0}[dir=rtl] .minicolors-swatches .minicolors-swatch{float:right;margin:0 0 0 4px}.minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:7px}[dir=rtl] .minicolors-with-opacity .minicolors-swatches .minicolors-swatch{margin-right:0;margin-left:7px}.minicolors-swatch.selected{border-color:#000}.minicolors-inline{display:inline-block}.minicolors-inline .minicolors-input{display:none!important}.minicolors-inline .minicolors-panel{position:relative;top:auto;left:auto;box-shadow:none;z-index:auto;display:inline-block}[dir=rtl] .minicolors-inline .minicolors-panel{right:auto}.minicolors-theme-default .minicolors-swatch{top:5px;left:5px;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatch{right:5px}.minicolors-theme-default .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:18px;height:18px}[dir=rtl] .minicolors-theme-default .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-default.minicolors-position-right .minicolors-swatch{left:auto;right:5px}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-swatch{right:auto;left:5px}.minicolors-theme-default.minicolors{width:auto;display:inline-block}.minicolors-theme-default .minicolors-input{height:20px;width:auto;display:inline-block;padding-left:26px}[dir=rtl] .minicolors-theme-default .minicolors-input{text-align:right;unicode-bidi:plaintext;padding-left:1px;padding-right:26px}.minicolors-theme-default.minicolors-position-right .minicolors-input{padding-right:26px;padding-left:inherit}[dir=rtl] .minicolors-theme-default.minicolors-position-left .minicolors-input{padding-right:inherit;padding-left:26px}.minicolors-theme-bootstrap .minicolors-swatch{z-index:2;top:3px;left:3px;width:28px;height:28px;border-radius:3px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatch{right:3px}.minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{margin-bottom:2px;top:0;left:0;width:20px;height:20px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch{right:0}.minicolors-theme-bootstrap .minicolors-swatch-color{border-radius:inherit}.minicolors-theme-bootstrap.minicolors-position-right>.minicolors-swatch{left:auto;right:3px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left>.minicolors-swatch{right:auto;left:3px}.minicolors-theme-bootstrap .minicolors-input{float:none;padding-left:44px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input{text-align:right;unicode-bidi:plaintext;padding-left:12px;padding-right:44px}.minicolors-theme-bootstrap.minicolors-position-right .minicolors-input{padding-right:44px;padding-left:12px}[dir=rtl] .minicolors-theme-bootstrap.minicolors-position-left .minicolors-input{padding-right:12px;padding-left:44px}.minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{top:4px;left:4px;width:37px;height:37px;border-radius:5px}[dir=rtl] .minicolors-theme-bootstrap .minicolors-input.input-lg+.minicolors-swatch{right:4px}.minicolors-theme-bootstrap .minicolors-input.input-sm+.minicolors-swatch{width:24px;height:24px}.minicolors-theme-bootstrap .minicolors-input.input-xs+.minicolors-swatch{width:18px;height:18px}.input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap .minicolors-input{border-radius:4px}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input{border-top-right-radius:0;border-bottom-right-radius:0}[dir=rtl] .input-group .minicolors-theme-bootstrap:not(:last-child) .minicolors-input{border-top-left-radius:0;border-bottom-left-radius:0}[dir=rtl] .input-group .form-control,[dir=rtl] .input-group-addon,[dir=rtl] .input-group-btn>.btn,[dir=rtl] .input-group-btn>.btn-group>.btn,[dir=rtl] .input-group-btn>.dropdown-toggle{border:1px solid #ccc;border-radius:4px}[dir=rtl] .input-group .form-control:first-child,[dir=rtl] .input-group-addon:first-child,[dir=rtl] .input-group-btn:first-child>.btn,[dir=rtl] .input-group-btn:first-child>.btn-group>.btn,[dir=rtl] .input-group-btn:first-child>.dropdown-toggle,[dir=rtl] .input-group-btn:last-child>.btn-group:not(:last-child)>.btn,[dir=rtl] .input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-left-radius:0;border-bottom-left-radius:0;border-left:0}[dir=rtl] .input-group .form-control:last-child,[dir=rtl] .input-group-addon:last-child,[dir=rtl] .input-group-btn:first-child>.btn-group:not(:first-child)>.btn,[dir=rtl] .input-group-btn:first-child>.btn:not(:first-child),[dir=rtl] .input-group-btn:last-child>.btn,[dir=rtl] .input-group-btn:last-child>.btn-group>.btn,[dir=rtl] .input-group-btn:last-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.minicolors-theme-semanticui .minicolors-swatch{top:0;left:0;padding:18px}[dir=rtl] .minicolors-theme-semanticui .minicolors-swatch{right:0}.minicolors-theme-semanticui input{text-indent:30px}
\ No newline at end of file
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function minapper_admin_menu()
{
$swipe_count=50;
$selected_nav_count=50;
$selected_shops_count=10;
$config_submenu = array(
'type' => 'menu', // Required, menu or metabox
'id' => 'minapper_expand_settings_page', // Required, meta box id, unique per page, to save: get_option( id )
'parent' => 'weixinapp_slug', // Parent page of plugin menu (default Settings [options-general.php])
'submenu' => true, // Required for submenu
'title' => '扩展设置', // The title of the options page and the name in admin menu
'capability' => 'manage_options', // The capability needed to view the page
'plugin_basename' => plugin_basename(plugin_dir_path(__DIR__) . REST_API_TO_MINIPROGRAM_PLUGIN_NAME. '.php'),
'tabbed' => true,
'multilang' => false, // To turn of multilang, default on.
'icon' => plugins_url(REST_API_TO_MINIPROGRAM_PLUGIN_NAME.'/images/icon16.png')
);
$fields[] = array(
'name' => 'swipe_options',
'title' => '首页轮播图',
'icon' => 'fa fa-home',
'fields' => array(
array(
'type' => 'group',
'id' => 'swipe_nav',
'title' => '跳转设置',
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => '添加',
'group_title' => '自定义跳转',
'limit' => $swipe_count,
'sortable' => true,
'closed' => true,
),
'fields' => array(
array(
'id' => 'type',
'type' => 'select',
'title' => '跳转类型',
'options' => array(
'apppage' => '跳转到小程序内页面',
'miniapp' => '跳转其他小程序',
'webpage' => '跳转到网页'
),
'default' => 'apppage', // optional
'class' => 'chosen', // optional
),
array(
'id' => 'appid',
'type' => 'text',
'title' => 'appid',
'after' => '跳转其他小程序时需填写', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入小程序appid'
)
),
array(
'id' => 'image',
'type' => 'image',
'title' => '图片',
),
array(
'id' => 'path',
'type' => 'text',
'title' => '小程序路径',
'after' => '跳转小程序时需填写。
<br/>跳转本小程序的页面路径请以<font color=red>"/pages"</font>开头。
<br/>跳转其他小程序的页面路径一般以<font color=red>"pages"</font>开头。
<br/>跳转直播间<font color=red>"__plugin__/wx2b03c6e691cd7370/pages/live-player-plugin?room_id=11"</font>开头。room_id换成直播间的房间号', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入小程序页面路径'
)
),
array(
'id' => 'url',
'type' => 'text',
'title' => 'url地址',
'after' => '跳转到网页需填写', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入链接'
)
),
array(
'id' => 'title',
'type' => 'text',
'title' => '标题',
'attributes' => array(
'data-title' => 'title',
'placeholder' =>'请输入标题',
),
)
)
)
)
);
$fields[] = array(
'name' => 'selected_options',
'title' => '精选栏目设置',
'icon' => 'fa fa-home',
'fields' => array(
array(
'type' => 'group',
'id' => 'selected_nav',
'title' => '精选栏目',
'options' => array(
'repeater' => true,
'accordion' => true,
'button_title' => '添加',
'group_title' => '栏目设置',
'limit' => $selected_nav_count,
'sortable' => true,
'closed' => true,
),
'fields' => array(
array(
'id' => 'type',
'type' => 'select',
'title' => '跳转类型',
'options' => array(
'apppage' => '跳转到小程序内页面',
'miniapp' => '跳转其他小程序',
'webpage' => '跳转到网页'
),
'default' => 'apppage', // optional
'class' => 'chosen', // optional
),
array(
'id' => 'appid',
'type' => 'text',
'title' => 'appid',
'after' => '跳转小程序时需填写。
<br/>跳转本小程序的页面路径请以<font color=red>"/pages"</font>开头。
<br/>跳转其他小程序的页面路径一般以<font color=red>"pages"</font>开头。
<br/>跳转直播间<font color=red>"__plugin__/wx2b03c6e691cd7370/pages/live-player-plugin?room_id=11"</font>开头。room_id换成直播间的房间号', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入小程序appid'
)
),
array(
'id' => 'image',
'type' => 'image',
'title' => '图片',
),
array(
'id' => 'path',
'type' => 'text',
'title' => '小程序路径',
'after' => '跳转小程序时需填写', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入小程序页面路径'
)
),
array(
'id' => 'url',
'type' => 'text',
'title' => 'url地址',
'after' => '跳转到网页需填写', // optional
'attributes' => array(
'data-title' => 'title',
'placeholder' => '请输入链接'
)
),
array(
'id' => 'title',
'type' => 'text',
'title' => '标题',
'attributes' => array(
'data-title' => 'title',
'placeholder' =>'请输入标题',
),
)
)
)
)
);
$options_panel = new Exopite_Simple_Options_Framework($config_submenu, $fields );
//$options_panel = new Exopite_Simple_Options_Framework($license_submenu, $fields );
//add_submenu_page('minapper_plus_settings_page', "授权激活", "授权激活", "administrator", 'minapper_license_slug', 'minapper_license_page');
}
\ No newline at end of file
<?php
/**
*
* 微信支付API异常类
* @author widyhu
*
*/
class RAM_WxPayException extends Exception {
public function errorMessage()
{
return $this->getMessage();
}
}
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Date
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_date' ) ) {
class Exopite_Simple_Options_Framework_Field_date extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array() ) {
parent::__construct( $field, $value, $unique, $config );
}
public function output() {
$date_format = ( ! empty( $this->field['format'] ) ) ? $this->field['format'] : 'mm/dd/yy';
$classes = ( isset( $this->field['class'] ) ) ? implode( ' ', explode( ' ', $this->field['class'] ) ) : '';
echo $this->element_before();
echo $this->element_prepend();
if ( isset( $this->field['picker'] ) && $this->field['picker'] == 'html5' ) {
echo '<input type="date" ';
} else {
echo '<input type="text" ';
echo 'class="datepicker ' . $classes . '" ';
}
echo 'name="' . $this->element_name() . '" ';
if ( isset( $this->field['picker'] ) && $this->field['picker'] == 'html5' ) {
echo 'value="' . $this->element_value() . '"' . $this->element_class() . $this->element_attributes() . ' ';
} else {
echo 'value="' . $this->element_value() . '"' . $this->element_attributes() . ' ';
echo 'data-format="' . $date_format . '"';
}
echo '>';
echo $this->element_append();
echo $this->element_after();
}
public static function enqueue( $args ) {
$resources = array(
array(
'name' => 'exopite-sof-datepicker-loader',
'fn' => 'loader-datepicker.min.js',
'type' => 'script',
'dependency' => array( 'jquery' ),
'version' => '',
'attr' => true,
),
);
parent::do_enqueue( $resources, $args );
}
}
}
<?php if ( ! defined( 'ABSPATH' ) ) {
die;
} // Cannot access pages directly.
/**
*
* Field: Gallery
*
*/
if ( ! class_exists( 'Exopite_Simple_Options_Framework_Field_gallery' ) ) {
class Exopite_Simple_Options_Framework_Field_gallery extends Exopite_Simple_Options_Framework_Fields {
public function __construct( $field, $value = '', $unique = '', $config = array(), $multilang ) {
parent::__construct( $field, $value, $unique, $config, $multilang );
}
public function output() {
echo $this->element_before();
echo $this->element_prepend();
$defaults = array(
'add_button' => esc_attr__( 'Add to gallery', 'exopite-sof' ),
'media_frame_title' => esc_attr__( 'Select images for gallery', 'exopite-sof' ),
'media_frame_button' => esc_attr__( 'Add', 'exopite-sof' ),
'media_type' => 'image',
);
$options = ( isset( $field['options'] ) && is_array( $field['options'] ) ) ? $field['options'] : array();
$options = wp_parse_args( $options, $defaults );
$value = $this->element_value();
echo '<div class="exopite-sof-gallery-field" data-media-frame-title="' . esc_attr( $options['media_frame_title'] ) . '" data-media-frame-button="' . esc_attr( $options['media_frame_button'] ) . '" data-media-frame-type="' . esc_attr( $options['media_type'] ) . '">';
echo '<input type="hidden" name="' . $this->element_name() . '" data-control="gallery-ids" value="' . $this->element_value() . '"' . $this->element_class() . $this->element_attributes() . '/>';
echo '<div class="exopite-sof-gallery">';
if ( $value ) :
$meta_array = explode( ',', $value );
foreach ( $meta_array as $meta_gall_item ) :
echo '<span><span class="exopite-sof-image-delete"></span><img id="' . esc_attr( $meta_gall_item ) . '" src="' . wp_get_attachment_thumb_url( $meta_gall_item ) . '"></span>';
endforeach;
endif;
echo '</div>';
echo '<input class="exopite-sof-gallery-add button button-primary exopite-sof-button" type="button" value="' . esc_attr( $options['add_button'] ) . '" />';
echo '</div>';
echo $this->element_append();
echo $this->element_after();
}
}
}
<?php
function custom_comment_fields( $data, $comment, $request) {
global $wpdb;
$_data = $data->data;
$comment_id =$comment->comment_ID;
$sql =$wpdb->prepare("SELECT t2.comment_author as parent_name,t2.comment_date as parent_date ,t1.user_id as user_id,(SELECT t3.meta_value from ".$wpdb->commentmeta." t3 where t1.comment_ID = t3.comment_id AND t3.meta_key = 'formId') AS formId from ".$wpdb->comments." t1 LEFT JOIN ".$wpdb->comments." t2 on t1.comment_parent=t2.comment_ID WHERE t1.comment_ID=%d",$comment_id);
$comment = $wpdb->get_row($sql);
$userid=$comment->user_id;
$parent_name=$comment->parent_name;
$parent_date=$comment->parent_date;
$formId=$comment->formId;
if(empty($formId))
{
$formId="";
}
if(empty($parent_name))
{
$parent_name="";
}
if(empty($parent_date))
{
$parent_date="";
}
$_data['parent_name']=$parent_name;
$_data['parent_date']=$parent_date;
$_data['userid']=$userid;
$_data['formId']=$formId;
$data->data = $_data;
return $data;
}
;(function( $ ) {
"use strict";
$( document ).ready(function() {
$( '.exopite-sof-field-select ').find( 'select.chosen' ).each(function(index, el) {
$( el ).chosen({
disable_search_threshold: 15,
width: '375px',
allow_single_deselect: true
});
});
});
}(jQuery));
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册