Version Description
- Fixed: Link to the pricing page
- Fixed: WP 5.8 compatibility.
Download this release
Release Info
Developer | webtemyk |
Plugin | Auto Post Thumbnail |
Version | 3.9.2 |
Comparing to | |
See all releases |
Code changes from version 3.9.0 to 3.9.2
- admin/class-wapt-activation.php +3 -3
- admin/pages/generate.php +1 -1
- admin/pages/image.php +1 -1
- admin/pages/settings.php +2 -2
- admin/views/sources/google.php +2 -2
- auto-post-thumbnail.php +2 -2
- includes/class-apt.php +39 -28
- includes/image-search/class-google-images.php +3 -3
- includes/image-search/result/class.google-founded-image.php +2 -1
- readme.txt +10 -1
admin/class-wapt-activation.php
CHANGED
@@ -27,9 +27,9 @@ class WAPT_Activation extends Wbcr_Factory449_Activator {
|
|
27 |
'count' => 10,
|
28 |
'expires' => time(),
|
29 |
);
|
30 |
-
$google_limit = WAPT_Plugin::app()->
|
31 |
if ( ! $google_limit ) {
|
32 |
-
WAPT_Plugin::app()->
|
33 |
}
|
34 |
|
35 |
//update_option( $this->plugin->getOptionName( 'whats_new_v360' ), 1 );
|
@@ -41,7 +41,7 @@ class WAPT_Activation extends Wbcr_Factory449_Activator {
|
|
41 |
* @since 1.0.0
|
42 |
*/
|
43 |
public function deactivate() {
|
44 |
-
$apt_ds = WAPT_Plugin::app()->
|
45 |
|
46 |
if ( $apt_ds ) {
|
47 |
// remove plugin options
|
27 |
'count' => 10,
|
28 |
'expires' => time(),
|
29 |
);
|
30 |
+
$google_limit = WAPT_Plugin::app()->getPopulateOption( 'google_limit' );
|
31 |
if ( ! $google_limit ) {
|
32 |
+
WAPT_Plugin::app()->updatePopulateOption( 'google_limit', $limit );
|
33 |
}
|
34 |
|
35 |
//update_option( $this->plugin->getOptionName( 'whats_new_v360' ), 1 );
|
41 |
* @since 1.0.0
|
42 |
*/
|
43 |
public function deactivate() {
|
44 |
+
$apt_ds = WAPT_Plugin::app()->getPopulateOption( 'delete_settings', false );
|
45 |
|
46 |
if ( $apt_ds ) {
|
47 |
// remove plugin options
|
admin/pages/generate.php
CHANGED
@@ -154,7 +154,7 @@ class WAPT_Generate extends WAPT_Page {
|
|
154 |
public function showPageContent() {
|
155 |
$no_featured = $this->plugin->apt->get_posts_count();
|
156 |
$w_featured = $this->plugin->apt->get_posts_count( true );
|
157 |
-
$percent = ceil( $w_featured / ( $no_featured + $w_featured ) * 100 );
|
158 |
|
159 |
$data = [
|
160 |
'stats' => [
|
154 |
public function showPageContent() {
|
155 |
$no_featured = $this->plugin->apt->get_posts_count();
|
156 |
$w_featured = $this->plugin->apt->get_posts_count( true );
|
157 |
+
$percent = ( $no_featured + $w_featured == 0 ) ? 0 : ceil( $w_featured / ( $no_featured + $w_featured ) * 100 );
|
158 |
|
159 |
$data = [
|
160 |
'stats' => [
|
admin/pages/image.php
CHANGED
@@ -140,7 +140,7 @@ class WAPT_ImageSettings extends WAPT_Page {
|
|
140 |
<div id="wapt-image-preview" class="wapt-image-preview">
|
141 |
<div class="wapt-image-preview-title"><h3><?php echo __( 'Post thumbnail preview', 'apt' ); ?></h3></div>
|
142 |
<?php
|
143 |
-
$format = WAPT_Plugin::app()->
|
144 |
switch ( $format ) {
|
145 |
case 'png':
|
146 |
$format = 'png';
|
140 |
<div id="wapt-image-preview" class="wapt-image-preview">
|
141 |
<div class="wapt-image-preview-title"><h3><?php echo __( 'Post thumbnail preview', 'apt' ); ?></h3></div>
|
142 |
<?php
|
143 |
+
$format = WAPT_Plugin::app()->getPopulateOption( "image-type", "jpg" );
|
144 |
switch ( $format ) {
|
145 |
case 'png':
|
146 |
$format = 'png';
|
admin/pages/settings.php
CHANGED
@@ -156,7 +156,7 @@ class WAPT_Settings extends WAPT_Page {
|
|
156 |
'type' => 'list',
|
157 |
'way' => 'checklist',
|
158 |
'name' => 'auto_post_types',
|
159 |
-
'data' => $this->post_types,
|
160 |
'default' => 'post,page',
|
161 |
'title' => __( 'Generate for post types', 'apt' ),
|
162 |
'hint' => __( "What types of posts to generate images for", 'apt' ),
|
@@ -191,7 +191,7 @@ class WAPT_Settings extends WAPT_Page {
|
|
191 |
'type' => 'list',
|
192 |
'way' => 'checklist',
|
193 |
'name' => 'import_post_types',
|
194 |
-
'data' => $this->post_types,
|
195 |
'default' => '',
|
196 |
'title' => __( 'Import for post types', 'apt' ) . $pro,
|
197 |
'hint' => __( "What types of posts to import images for", 'apt' ),
|
156 |
'type' => 'list',
|
157 |
'way' => 'checklist',
|
158 |
'name' => 'auto_post_types',
|
159 |
+
'data' => $is_premium ? $this->getPostTypes() : $this->post_types,
|
160 |
'default' => 'post,page',
|
161 |
'title' => __( 'Generate for post types', 'apt' ),
|
162 |
'hint' => __( "What types of posts to generate images for", 'apt' ),
|
191 |
'type' => 'list',
|
192 |
'way' => 'checklist',
|
193 |
'name' => 'import_post_types',
|
194 |
+
'data' => $is_premium ? $this->getPostTypes() : $this->post_types,
|
195 |
'default' => '',
|
196 |
'title' => __( 'Import for post types', 'apt' ) . $pro,
|
197 |
'hint' => __( "What types of posts to import images for", 'apt' ),
|
admin/views/sources/google.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
$ajaxloader = WAPT_PLUGIN_URL . "/admin/assets/img/ajax-loader-line.gif";
|
3 |
$apt_google_nonce = wp_create_nonce( 'apt_api' );
|
4 |
|
5 |
-
$apt_google_key = WAPT_Plugin::app()->
|
6 |
-
$apt_google_cse = WAPT_Plugin::app()->
|
7 |
|
8 |
if ( isset( $_REQUEST['post'] ) ) {
|
9 |
$pid = $_REQUEST['post'];
|
2 |
$ajaxloader = WAPT_PLUGIN_URL . "/admin/assets/img/ajax-loader-line.gif";
|
3 |
$apt_google_nonce = wp_create_nonce( 'apt_api' );
|
4 |
|
5 |
+
$apt_google_key = WAPT_Plugin::app()->getPopulateOption( 'google_apikey' );
|
6 |
+
$apt_google_cse = WAPT_Plugin::app()->getPopulateOption( 'google_cse' );
|
7 |
|
8 |
if ( isset( $_REQUEST['post'] ) ) {
|
9 |
$pid = $_REQUEST['post'];
|
auto-post-thumbnail.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Auto Featured Image (Auto Post Thumbnail)
|
4 |
Plugin URI: https://cm-wp.com/apt
|
5 |
Description: Automatically generate the Featured Image from the first image in post or any custom post type only if Featured Image is not set manually. Featured Image Generation From Title. Native image search for Elementor, Gutenberg, Classic Editor.
|
6 |
-
Version: 3.9.
|
7 |
Author: Creative Motion <support@cm-wp.com>
|
8 |
Author URI: https://cm-wp.com
|
9 |
Text Domain: apt
|
@@ -46,7 +46,7 @@ $plugin_info = array(
|
|
46 |
'url' => 'https://cm-wp.com',
|
47 |
'pages_map' => array(
|
48 |
'features' => 'features',
|
49 |
-
'pricing' => 'pricing',
|
50 |
'support' => 'support',
|
51 |
'docs' => 'docs',
|
52 |
)
|
3 |
Plugin Name: Auto Featured Image (Auto Post Thumbnail)
|
4 |
Plugin URI: https://cm-wp.com/apt
|
5 |
Description: Automatically generate the Featured Image from the first image in post or any custom post type only if Featured Image is not set manually. Featured Image Generation From Title. Native image search for Elementor, Gutenberg, Classic Editor.
|
6 |
+
Version: 3.9.2
|
7 |
Author: Creative Motion <support@cm-wp.com>
|
8 |
Author URI: https://cm-wp.com
|
9 |
Text Domain: apt
|
46 |
'url' => 'https://cm-wp.com',
|
47 |
'pages_map' => array(
|
48 |
'features' => 'features',
|
49 |
+
'pricing' => 'features/pricing',
|
50 |
'support' => 'support',
|
51 |
'docs' => 'docs',
|
52 |
)
|
includes/class-apt.php
CHANGED
@@ -100,11 +100,11 @@ class AutoPostThumbnails {
|
|
100 |
* Initiate all required hooks.
|
101 |
*/
|
102 |
private function init() {
|
103 |
-
$is_auto_generate = \WAPT_Plugin::app()->
|
104 |
-
$is_auto_upload = \WAPT_Plugin::app()->
|
105 |
-
$allowed_import_post_types = explode( ',', \WAPT_Plugin::app()->
|
106 |
|
107 |
-
$this->allowed_generate_post_types = explode( ',', \WAPT_Plugin::app()->
|
108 |
|
109 |
add_filter( 'mime_types', [ $this, 'allow_upload_webp' ] );
|
110 |
|
@@ -119,7 +119,7 @@ class AutoPostThumbnails {
|
|
119 |
|
120 |
if ( $is_auto_generate ) {
|
121 |
//add_action( 'publish_post', [ $this, 'publish_post' ], 10, 1 );
|
122 |
-
add_action( 'save_post', [ $this, '
|
123 |
|
124 |
// This hook handle update post via rest api. for example Wordpress mobile apps
|
125 |
foreach ( $this->allowed_generate_post_types as $post_type ) {
|
@@ -128,7 +128,7 @@ class AutoPostThumbnails {
|
|
128 |
// This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
|
129 |
add_action( 'transition_post_status', [ $this, 'check_required_transition' ], 10, 3 );
|
130 |
} else {
|
131 |
-
if ( \WAPT_Plugin::app()->
|
132 |
add_action( 'admin_notices', [ $this, 'notice_auto_generation' ] );
|
133 |
}
|
134 |
}
|
@@ -172,7 +172,7 @@ class AutoPostThumbnails {
|
|
172 |
}
|
173 |
check_ajax_referer( 'get-posts' );
|
174 |
|
175 |
-
$generate = \WAPT_Plugin::app()->
|
176 |
|
177 |
$this->plugin->logger->info( "START generate in mode: {$generate}" );
|
178 |
|
@@ -437,6 +437,23 @@ class AutoPostThumbnails {
|
|
437 |
$this->publish_post( $post->ID, $post, ! $is_insert );
|
438 |
}
|
439 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
/**
|
441 |
* Function to save first image in post as post thumbnail.
|
442 |
*
|
@@ -450,7 +467,7 @@ class AutoPostThumbnails {
|
|
450 |
public function publish_post( $post_id, $post = null, $update = true ) {
|
451 |
global $wpdb;
|
452 |
|
453 |
-
$autoimage = \WAPT_Plugin::app()->
|
454 |
$generation = new GenerateResult( $post_id, $autoimage );
|
455 |
|
456 |
if ( ! $post ) {
|
@@ -467,12 +484,6 @@ class AutoPostThumbnails {
|
|
467 |
|
468 |
}
|
469 |
|
470 |
-
if ( ! in_array( $post->post_type, $this->allowed_generate_post_types ) ) {
|
471 |
-
$this->plugin->logger->warning( "The post type ({$post->post_type}) is not allowed for generation in settings" );
|
472 |
-
|
473 |
-
return $generation->result( __( "The post type is not allowed for generation in settings", 'apt' ) );
|
474 |
-
}
|
475 |
-
|
476 |
// First check whether Post Thumbnail is already set for this post.
|
477 |
$_thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
|
478 |
if ( $_thumbnail_id && $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE id = '" . esc_sql( $_thumbnail_id ) . "' AND post_type = 'attachment'" ) || get_post_meta( $post_id, 'skip_post_thumb', true ) ) {
|
@@ -520,7 +531,7 @@ class AutoPostThumbnails {
|
|
520 |
} else if ( $autoimage == 'google' || $autoimage == 'find_google' ) {
|
521 |
$response = ( new GoogleImages() )->search( $post->post_title, 1 );
|
522 |
if ( ! empty( $response->images ) ) {
|
523 |
-
$this->plugin->logger->info( "Google image search
|
524 |
$thumb_id = apply_filters( 'wapt/download_from_google', 0, $response->images, $post_id );
|
525 |
}
|
526 |
if ( $thumb_id ) {
|
@@ -543,7 +554,7 @@ class AutoPostThumbnails {
|
|
543 |
* @param array $postarr
|
544 |
*/
|
545 |
public function auto_upload( $data, $postarr = [] ) {
|
546 |
-
$allowed_post_types = explode( ',', \WAPT_Plugin::app()->
|
547 |
|
548 |
if ( $data instanceof \WP_Post ) {
|
549 |
$post_type = $data->post_type ?? '';
|
@@ -1105,7 +1116,7 @@ class AutoPostThumbnails {
|
|
1105 |
// Получаем заголовок плагина
|
1106 |
$plugin_title = \WAPT_Plugin::app()->getPluginTitle();
|
1107 |
|
1108 |
-
if ( ! \WAPT_Plugin::app()->
|
1109 |
// Задаем текст уведомления
|
1110 |
$notice_text = '<p><b>' . $plugin_title . ':</b> <br>' . sprintf( __( "To download images from Google, specify Google API keys in the <a href='%s'>settings</a>.", 'apt' ), admin_url( 'admin.php?page=wapt_settings-wbcr_apt' ) ) . "</p>";
|
1111 |
|
@@ -1182,27 +1193,27 @@ class AutoPostThumbnails {
|
|
1182 |
*/
|
1183 |
public static function generate_image_with_text( $text, $pathToSave = '', $format = 'jpg', $width = 0, $height = 0 ) {
|
1184 |
$font = WAPT_PLUGIN_DIR . "/fonts/Arial.ttf";
|
1185 |
-
$font_size = \WAPT_Plugin::app()->
|
1186 |
-
$font_color = \WAPT_Plugin::app()->
|
1187 |
if ( $width == 0 ) {
|
1188 |
-
$width = (int) \WAPT_Plugin::app()->
|
1189 |
}
|
1190 |
if ( $height == 0 ) {
|
1191 |
-
$height = (int) \WAPT_Plugin::app()->
|
1192 |
}
|
1193 |
$before_text = '';
|
1194 |
$after_text = '';
|
1195 |
-
$shadow = \WAPT_Plugin::app()->
|
1196 |
if ( ! $shadow ) {
|
1197 |
$shadow_color = '';
|
1198 |
} else {
|
1199 |
-
$shadow_color = \WAPT_Plugin::app()->
|
1200 |
}
|
1201 |
|
1202 |
$background_type = "color";
|
1203 |
-
$background = \WAPT_Plugin::app()->
|
1204 |
|
1205 |
-
$text_transform = \WAPT_Plugin::app()->
|
1206 |
switch ( $text_transform ) {
|
1207 |
case 'upper':
|
1208 |
$text = mb_strtoupper( $text );
|
@@ -1212,7 +1223,7 @@ class AutoPostThumbnails {
|
|
1212 |
break;
|
1213 |
}
|
1214 |
|
1215 |
-
$text_crop = \WAPT_Plugin::app()->
|
1216 |
if ( $text_crop > 0 ) {
|
1217 |
if ( strlen( $text ) > $text_crop ) {
|
1218 |
$temp = substr( $text, 0, $text_crop );
|
@@ -1225,7 +1236,7 @@ class AutoPostThumbnails {
|
|
1225 |
$valign = 'center';
|
1226 |
$padding_tb = 15;
|
1227 |
$padding_lr = 15;
|
1228 |
-
$line_spacing = \WAPT_Plugin::app()->
|
1229 |
|
1230 |
$params = array(
|
1231 |
'text' => $text,
|
@@ -1264,7 +1275,7 @@ class AutoPostThumbnails {
|
|
1264 |
public function generate_and_attachment( $post_id ) {
|
1265 |
$this->plugin->logger->info( "Start generate attachment for post ID = {$post_id}" );
|
1266 |
|
1267 |
-
$format = \WAPT_Plugin::app()->
|
1268 |
switch ( $format ) {
|
1269 |
case 'png':
|
1270 |
$extension = 'png';
|
100 |
* Initiate all required hooks.
|
101 |
*/
|
102 |
private function init() {
|
103 |
+
$is_auto_generate = \WAPT_Plugin::app()->getPopulateOption( 'auto_generation', true );
|
104 |
+
$is_auto_upload = \WAPT_Plugin::app()->getPopulateOption( 'auto_upload_images' );
|
105 |
+
$allowed_import_post_types = explode( ',', \WAPT_Plugin::app()->getPopulateOption( 'import_post_types', 'post' ) );
|
106 |
|
107 |
+
$this->allowed_generate_post_types = explode( ',', \WAPT_Plugin::app()->getPopulateOption( 'auto_post_types', 'post,page' ) );
|
108 |
|
109 |
add_filter( 'mime_types', [ $this, 'allow_upload_webp' ] );
|
110 |
|
119 |
|
120 |
if ( $is_auto_generate ) {
|
121 |
//add_action( 'publish_post', [ $this, 'publish_post' ], 10, 1 );
|
122 |
+
add_action( 'save_post', [ $this, 'save_post' ], 10, 3 );
|
123 |
|
124 |
// This hook handle update post via rest api. for example Wordpress mobile apps
|
125 |
foreach ( $this->allowed_generate_post_types as $post_type ) {
|
128 |
// This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
|
129 |
add_action( 'transition_post_status', [ $this, 'check_required_transition' ], 10, 3 );
|
130 |
} else {
|
131 |
+
if ( \WAPT_Plugin::app()->getPopulateOption( 'auto_generation_notice', 1 ) ) {
|
132 |
add_action( 'admin_notices', [ $this, 'notice_auto_generation' ] );
|
133 |
}
|
134 |
}
|
172 |
}
|
173 |
check_ajax_referer( 'get-posts' );
|
174 |
|
175 |
+
$generate = \WAPT_Plugin::app()->getPopulateOption( "generate_autoimage", 'find' );
|
176 |
|
177 |
$this->plugin->logger->info( "START generate in mode: {$generate}" );
|
178 |
|
437 |
$this->publish_post( $post->ID, $post, ! $is_insert );
|
438 |
}
|
439 |
|
440 |
+
/**
|
441 |
+
* Function for 'save_post' hook
|
442 |
+
*
|
443 |
+
* @param int $post_id Post ID.
|
444 |
+
* @param \WP_Post $post
|
445 |
+
* @param bool $update
|
446 |
+
*
|
447 |
+
* @throws Exception
|
448 |
+
*/
|
449 |
+
public function save_post( $post_id, $post = null, $update = true ) {
|
450 |
+
if ( ! in_array( $post->post_type, $this->allowed_generate_post_types ) ) {
|
451 |
+
$this->plugin->logger->warning( "The post type ({$post->post_type}) is not allowed for generation in settings" );
|
452 |
+
} else {
|
453 |
+
$this->publish_post( $post_id, $post, $update );
|
454 |
+
}
|
455 |
+
}
|
456 |
+
|
457 |
/**
|
458 |
* Function to save first image in post as post thumbnail.
|
459 |
*
|
467 |
public function publish_post( $post_id, $post = null, $update = true ) {
|
468 |
global $wpdb;
|
469 |
|
470 |
+
$autoimage = \WAPT_Plugin::app()->getPopulateOption( "generate_autoimage", 'find' );
|
471 |
$generation = new GenerateResult( $post_id, $autoimage );
|
472 |
|
473 |
if ( ! $post ) {
|
484 |
|
485 |
}
|
486 |
|
|
|
|
|
|
|
|
|
|
|
|
|
487 |
// First check whether Post Thumbnail is already set for this post.
|
488 |
$_thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true );
|
489 |
if ( $_thumbnail_id && $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE id = '" . esc_sql( $_thumbnail_id ) . "' AND post_type = 'attachment'" ) || get_post_meta( $post_id, 'skip_post_thumb', true ) ) {
|
531 |
} else if ( $autoimage == 'google' || $autoimage == 'find_google' ) {
|
532 |
$response = ( new GoogleImages() )->search( $post->post_title, 1 );
|
533 |
if ( ! empty( $response->images ) ) {
|
534 |
+
$this->plugin->logger->info( "Google image search result = " . var_export( $response->images[0], true ) );
|
535 |
$thumb_id = apply_filters( 'wapt/download_from_google', 0, $response->images, $post_id );
|
536 |
}
|
537 |
if ( $thumb_id ) {
|
554 |
* @param array $postarr
|
555 |
*/
|
556 |
public function auto_upload( $data, $postarr = [] ) {
|
557 |
+
$allowed_post_types = explode( ',', \WAPT_Plugin::app()->getPopulateOption( 'import_post_types', '' ) );
|
558 |
|
559 |
if ( $data instanceof \WP_Post ) {
|
560 |
$post_type = $data->post_type ?? '';
|
1116 |
// Получаем заголовок плагина
|
1117 |
$plugin_title = \WAPT_Plugin::app()->getPluginTitle();
|
1118 |
|
1119 |
+
if ( ! \WAPT_Plugin::app()->getPopulateOption( 'google_apikey' ) && ! \WAPT_Plugin::app()->getPopulateOption( 'google_cse' ) ) {
|
1120 |
// Задаем текст уведомления
|
1121 |
$notice_text = '<p><b>' . $plugin_title . ':</b> <br>' . sprintf( __( "To download images from Google, specify Google API keys in the <a href='%s'>settings</a>.", 'apt' ), admin_url( 'admin.php?page=wapt_settings-wbcr_apt' ) ) . "</p>";
|
1122 |
|
1193 |
*/
|
1194 |
public static function generate_image_with_text( $text, $pathToSave = '', $format = 'jpg', $width = 0, $height = 0 ) {
|
1195 |
$font = WAPT_PLUGIN_DIR . "/fonts/Arial.ttf";
|
1196 |
+
$font_size = \WAPT_Plugin::app()->getPopulateOption( 'font-size', 25 );
|
1197 |
+
$font_color = \WAPT_Plugin::app()->getPopulateOption( 'font-color', "#ffffff" );
|
1198 |
if ( $width == 0 ) {
|
1199 |
+
$width = (int) \WAPT_Plugin::app()->getPopulateOption( 'image-width', 800 );
|
1200 |
}
|
1201 |
if ( $height == 0 ) {
|
1202 |
+
$height = (int) \WAPT_Plugin::app()->getPopulateOption( 'image-height', 600 );
|
1203 |
}
|
1204 |
$before_text = '';
|
1205 |
$after_text = '';
|
1206 |
+
$shadow = \WAPT_Plugin::app()->getPopulateOption( 'shadow', 0 );
|
1207 |
if ( ! $shadow ) {
|
1208 |
$shadow_color = '';
|
1209 |
} else {
|
1210 |
+
$shadow_color = \WAPT_Plugin::app()->getPopulateOption( 'shadow-color', "#ffffff" );
|
1211 |
}
|
1212 |
|
1213 |
$background_type = "color";
|
1214 |
+
$background = \WAPT_Plugin::app()->getPopulateOption( 'background-color', "#ff6262" );
|
1215 |
|
1216 |
+
$text_transform = \WAPT_Plugin::app()->getPopulateOption( 'text-transform', "no" );
|
1217 |
switch ( $text_transform ) {
|
1218 |
case 'upper':
|
1219 |
$text = mb_strtoupper( $text );
|
1223 |
break;
|
1224 |
}
|
1225 |
|
1226 |
+
$text_crop = \WAPT_Plugin::app()->getPopulateOption( 'text-crop', 100 );
|
1227 |
if ( $text_crop > 0 ) {
|
1228 |
if ( strlen( $text ) > $text_crop ) {
|
1229 |
$temp = substr( $text, 0, $text_crop );
|
1236 |
$valign = 'center';
|
1237 |
$padding_tb = 15;
|
1238 |
$padding_lr = 15;
|
1239 |
+
$line_spacing = \WAPT_Plugin::app()->getPopulateOption( 'text-line-spacing', 1.5 );
|
1240 |
|
1241 |
$params = array(
|
1242 |
'text' => $text,
|
1275 |
public function generate_and_attachment( $post_id ) {
|
1276 |
$this->plugin->logger->info( "Start generate attachment for post ID = {$post_id}" );
|
1277 |
|
1278 |
+
$format = \WAPT_Plugin::app()->getPopulateOption( "image-type", "jpg" );
|
1279 |
switch ( $format ) {
|
1280 |
case 'png':
|
1281 |
$extension = 'png';
|
includes/image-search/class-google-images.php
CHANGED
@@ -23,8 +23,8 @@ class GoogleImages implements ImageSearch {
|
|
23 |
private $cse;
|
24 |
|
25 |
public function __construct() {
|
26 |
-
$this->key = WAPT_Plugin::app()->
|
27 |
-
$this->cse = WAPT_Plugin::app()->
|
28 |
}
|
29 |
|
30 |
|
@@ -57,7 +57,7 @@ class GoogleImages implements ImageSearch {
|
|
57 |
* 'count' => 10 | int,
|
58 |
* ]
|
59 |
*/
|
60 |
-
$limit = WAPT_Plugin::app()->
|
61 |
if ( time() - $limit['expires'] > 3600 ) {
|
62 |
$limit['expires'] = time();
|
63 |
$limit['count'] = 10;
|
23 |
private $cse;
|
24 |
|
25 |
public function __construct() {
|
26 |
+
$this->key = WAPT_Plugin::app()->getPopulateOption( 'google_apikey' );
|
27 |
+
$this->cse = WAPT_Plugin::app()->getPopulateOption( 'google_cse' );
|
28 |
}
|
29 |
|
30 |
|
57 |
* 'count' => 10 | int,
|
58 |
* ]
|
59 |
*/
|
60 |
+
$limit = WAPT_Plugin::app()->getPopulateOption( 'google_limit', [ 'expires' => time(), 'count' => 10 ] );
|
61 |
if ( time() - $limit['expires'] > 3600 ) {
|
62 |
$limit['expires'] = time();
|
63 |
$limit['count'] = 10;
|
includes/image-search/result/class.google-founded-image.php
CHANGED
@@ -29,7 +29,8 @@ class GoogleFoundedImage extends FoundedImage {
|
|
29 |
$this->image->height = $item['image']['height'] ?? '';
|
30 |
|
31 |
|
32 |
-
|
|
|
33 |
|
34 |
$this->file = new \stdClass();
|
35 |
$this->file->name = $match[1][0] ?? '';
|
29 |
$this->image->height = $item['image']['height'] ?? '';
|
30 |
|
31 |
|
32 |
+
$path = parse_url( $this->link, PHP_URL_PATH );
|
33 |
+
preg_match_all( '/.*\/(.*)\.(\w{3,4})?(\?|\/.*)?/', $path, $match );
|
34 |
|
35 |
$this->file = new \stdClass();
|
36 |
$this->file->name = $match[1][0] ?? '';
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: creativemotion
|
3 |
Tags: post thumbnails, featured image, elementor, thumbnails, featured image from title
|
4 |
Requires at least: 4.8
|
5 |
-
Tested up to: 5.
|
6 |
Requires PHP: 7.0
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2
|
@@ -113,6 +113,15 @@ This section describes how to install the plugin and get it working.
|
|
113 |
|
114 |
== Changelog ==
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
= 3.9.0 =
|
117 |
* New appearance of the plugin pages.
|
118 |
* Add: Logging the generation process.
|
2 |
Contributors: creativemotion
|
3 |
Tags: post thumbnails, featured image, elementor, thumbnails, featured image from title
|
4 |
Requires at least: 4.8
|
5 |
+
Tested up to: 5.8
|
6 |
Requires PHP: 7.0
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2
|
113 |
|
114 |
== Changelog ==
|
115 |
|
116 |
+
= 3.9.2 =
|
117 |
+
* Fixed: Link to the pricing page
|
118 |
+
* Fixed: WP 5.8 compatibility.
|
119 |
+
|
120 |
+
= 3.9.1 =
|
121 |
+
* Fixed: post type generation.
|
122 |
+
* Fixed: multisite support.
|
123 |
+
* Other minor fixes
|
124 |
+
|
125 |
= 3.9.0 =
|
126 |
* New appearance of the plugin pages.
|
127 |
* Add: Logging the generation process.
|