Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
friend-nicen committed Aug 3, 2023
1 parent cc354ce commit 99fcdd4
Show file tree
Hide file tree
Showing 24 changed files with 1,409 additions and 859 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: nicen-localize-image
Plugin URI:https://nicen.cn/2893.html
Description: 用于本地化文章的外部图片的插件,支持文章发布前通过编辑器插件本地化、文章发布时自动本地化、定时发布文章时自动本地化、已发布的文章批量本地化。
Version: 1.3.9
Version: 1.4.0
Author: 友人a丶
Author URI: https://nicen.cn
Text Domain: nicen-localize-image
Expand All @@ -22,7 +22,15 @@ nicen-localize-image,是一款用于本地化文章的外部图片的插件,

# 更新日志:

### 1.3.92
## 1.4.0

1. 新增定时任务可选单次定时发布的文章数量和状态
2. 新增编辑器插件本地化可以并发下载(默认同时下载5张图片)
3. 新增本地化图片保存到数据库时,可选是否生成缩略图
4. 新增批量本地化时,可选待审、定时任务等其它文章状态
5. 修复存在空格时,会导致白名单功能失效的问题

## 1.3.92

1. 修复定时发布文章,选择文章时间同步为发布时的时间,功能失效的问题。

Expand Down
10 changes: 5 additions & 5 deletions admin/common.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?php

/*
/**
* 公共数据和方法
* */

global $nicen_make_CONFIGS; //声明全局变量

$nicen_make_CONFIGS = []; //保存所有插件配置

/*
/**
* 遍历整个配置
* */
foreach ( nicen_make_CONFIG as $key => $value ) {
$nicen_make_CONFIGS[ $key ] = get_option( $key );
}

/*
/**
* 返回指定配置
* */
function nicen_make_config( $key = '' ) {
Expand Down Expand Up @@ -48,7 +48,7 @@ function nicen_plugin_getAllCat() {

$cat = [];

/*
/**
* 遍历目录
* */
$terms = get_terms( 'category', 'orderby=name&hide_empty=0' );
Expand All @@ -66,7 +66,7 @@ function nicen_plugin_getAllCat() {
}


/*
/**
* 获取图片类型
* 1 = GIF,2 = JPG,3 = PNG,4 = SWF,5 = PSD,6 = BMP,7 = TIFF(intel byte order),8 = TIFF(motorola byte order),9 = JPC,10 = JP2,11 = JPX,12 = JB2,13 = SWC,14 = IFF,15 = WBMP,16 = XBM
* */
Expand Down
46 changes: 23 additions & 23 deletions admin/form.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/*
/**
* @author
*
* 后台表单渲染函数
Expand All @@ -9,7 +9,7 @@

include_once __DIR__ . '/render.php'; //引入各种渲染函数

/*
/**
* 部分组件没有输出表单元素,
* 所以需要一个隐藏的input
*
Expand All @@ -18,7 +18,7 @@
* */


/*
/**
* 加载主题设置页面
* */
function nicen_make_setting_load( $options ) {
Expand Down Expand Up @@ -85,7 +85,7 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
return;
}

/*
/**
* 判断是否有条件判断
* */

Expand All @@ -96,13 +96,13 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
}


/*
/**
* 遍历所有分节
* */
foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) {


/*
/**
* 如果是文字说明
* */
if ( $field['id'] == 'text_info' ) {
Expand All @@ -112,7 +112,7 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
continue;
}

/*
/**
* 是否需要自定义提示
* */
if ( ! isset( $field['args']['tip'] ) ) {
Expand All @@ -121,14 +121,14 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
$label = '';
}

/*
/**
* 是否具有总开关
* */
if ( ! isset( $param['key'] ) ) {
echo sprintf( '<a-form-item :label-col="labelCol" ' . esc_html( $label ) . '>', esc_html( $field['title'] ) );
} else {

/*
/**
* 总开关或者忽略的
* */
if ( $param['key'] == $field['id'] || in_array( $field['id'], $param['ignore'] ) ) {
Expand All @@ -139,7 +139,7 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false

}

/*
/**
* 是否需要输出自定义tip
* */
if ( isset( $field['args']['tip'] ) ) {
Expand All @@ -154,7 +154,7 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
</template>', esc_html( $field['args']['tip'] ), esc_html( $field['title'] ) );
}

/*
/**
* 调用输出函数
* */
call_user_func(
Expand All @@ -173,7 +173,7 @@ function nicen_make_do_settings_fields_user( $page, $section, $callback = false
}
}

/*
/**
* 主题设置片段页面输出
* */
function nicen_make_do_settings_sections_user( $page ) {
Expand All @@ -193,7 +193,7 @@ function nicen_make_do_settings_sections_user( $page ) {

$param = [];//是否需要显示、隐藏切换

/*
/**
* 是否有传递回调函数
* */
if ( isset( $section['callback'] ) ) {
Expand All @@ -210,7 +210,7 @@ function nicen_make_do_settings_sections_user( $page ) {

nicen_make_do_settings_fields_user( $page, $section['id'], $section['callback'] ?? false );

/*
/**
* 回调函数如果有自定义输出
* */
if ( isset( $param['render'] ) ) {
Expand All @@ -224,7 +224,7 @@ function nicen_make_do_settings_sections_user( $page ) {
}
}

/*
/**
* 数字输入框
* */
function nicen_make_form_number( $args ) {
Expand All @@ -239,7 +239,7 @@ function nicen_make_form_number( $args ) {
}


/*
/**
* 基础输入框
* */
function nicen_make_form_input( $args ) {
Expand All @@ -253,7 +253,7 @@ function nicen_make_form_input( $args ) {
}


/*
/**
* 基础密码输入框
* */
function nicen_make_form_password( $args ) {
Expand All @@ -266,7 +266,7 @@ function nicen_make_form_password( $args ) {
<?php
}

/*
/**
* 基础开关
* */
function nicen_make_form_switch( $args ) {
Expand All @@ -282,7 +282,7 @@ function nicen_make_form_switch( $args ) {
<?php
}

/*
/**
* 基础开关
* */
function nicen_make_form_textarea( $args ) {
Expand All @@ -297,7 +297,7 @@ function nicen_make_form_textarea( $args ) {
<?php
}

/*
/**
* 基础开关
* */
function nicen_make_form_color( $args ) {
Expand All @@ -316,7 +316,7 @@ function nicen_make_form_color( $args ) {
}


/*
/**
* 文字说明
* */
function nicen_make_plugin_form_text( $args ) {
Expand All @@ -327,7 +327,7 @@ function nicen_make_plugin_form_text( $args ) {
}


/*
/**
* 单选
* */
function nicen_make_form_select( $args ) {
Expand All @@ -346,7 +346,7 @@ function nicen_make_form_select( $args ) {
}


/*
/**
* 单选
* */
function nicen_make_form_multi( $args ) {
Expand Down
18 changes: 9 additions & 9 deletions admin/initialize.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/*
* @author 友人a丶
* @date ${date}
* 说明
*/
/**
* @author 友人a丶
* @date ${date}
* 说明
*/


/*
/**
* 插件初始化
* */
function nicen_make_initialize() {

/*
/**
* 是否启用经典编辑器
* */

Expand All @@ -30,7 +30,7 @@ function nicen_make_initialize() {
if ( get_user_option( 'rich_editing' ) == 'true' ) {
/*tinymce加载时引入插件的js*/
add_filter( 'mce_external_plugins', function ( $plugin_array ) {
/*
/**
* 引入插件的js
* */
$plugin_array['local'] = nicen_local_image_url . 'tinymcc/local.js?ver=' . filemtime( nicen_local_image_path . 'tinymcc/local.js' );/*指定要加载的插件*/
Expand All @@ -48,7 +48,7 @@ function nicen_make_initialize() {
}


/*
/**
* 判断是否开启编辑器本地化插件
* */
if ( nicen_make_config( 'nicen_make_plugin_editor' ) ) {
Expand Down
14 changes: 7 additions & 7 deletions admin/install.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/*
* @author 友人a丶
* @date ${date}
* 插件安装时写入默认配置
*/
/**
* @author 友人a丶
* @date ${date}
* 插件安装时写入默认配置
*/


/*
/**
* 初始化默认配置
* */
function nicen_make_install() {
Expand All @@ -17,7 +17,7 @@ function nicen_make_install() {

nicen_make_install(); //插件自动设置

/*
/**
* 关闭插件时注销任务
* */
function nicen_make_end() {
Expand Down
Loading

0 comments on commit 99fcdd4

Please sign in to comment.