Changeset 3277817
- Timestamp:
- 04/21/2025 04:03:29 AM (12 months ago)
- Location:
- blogify-ai/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (1 diff)
-
admin/actions/rest.php (modified) (6 diffs)
-
admin/ui/all-blogs.php (modified) (2 diffs)
-
blogify-ai.php (modified) (2 diffs)
-
changelog.md (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
blogify-ai/trunk/README.txt
r3184709 r3277817 3 3 Tags: AI Blogging, Automated Post Creation, Video to Blog, Audio to Blog, Blogging Tools 4 4 Requires at least: 6.0 5 Tested up to: 6. 66 Stable tag: 1.1. 25 Tested up to: 6.8 6 Stable tag: 1.1.3 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later -
blogify-ai/trunk/admin/actions/rest.php
r3170423 r3277817 30 30 require_once ABSPATH . 'wp-admin/includes/image.php'; 31 31 32 add_action('rest_api_init', fn () => 32 add_action( 33 'rest_api_init', 34 fn() => 33 35 register_rest_route('blogify/v1', '/create-post', [ 34 36 'methods' => ['POST'], … … 36 38 'callback' => function (\WP_REST_Request $request) { 37 39 38 $required = function ($field) use ($request) {40 $required = function ($field) use ($request) { 39 41 $value = $request->get_param($field); 40 42 if (empty($value)) { … … 44 46 }; 45 47 46 $status_validation = function () use ($request) {48 $status_validation = function () use ($request) { 47 49 $status = $request->get_param('status'); 48 50 if ($status && !in_array($status, array_keys(get_post_statuses()), true)) { … … 51 53 return $status; 52 54 }; 53 55 54 56 $sanitize_text_array = fn(?array $array) => is_array($array) ? array_map('sanitize_text_field', $array) : []; 55 57 … … 87 89 'blogify_meta_description' => sanitize_text_field($request->get_param('meta_description')), 88 90 ], 89 true 91 true, 90 92 ]); 91 93 … … 104 106 ); 105 107 108 add_action( 109 'rest_api_init', 110 fn() => 111 register_rest_route('blogify/v1', '/upload-image', [ 112 'methods' => ['POST'], 113 'permission_callback' => fn(\WP_REST_Request $request) => $request->get_param('client_secret') === get_option('blogify_client_secret'), 114 'callback' => function (\WP_REST_Request $request) { 115 $image_url = $request->get_param('image'); 106 116 117 if (empty($image_url)) { 118 return new \WP_Error('error', 'image URL is required', ['status' => 400]); 119 } 107 120 108 add_action('wp_head', function () { 109 global $post; 110 if (is_page() || is_single()) { 111 $meta_description = get_post_meta(get_queried_object_id(), 'blogify_meta_description', true); 112 $meta_tags = get_post_meta(get_queried_object_id(), 'blogify_meta_tags', true); 121 $image_src = media_sideload_image(sanitize_url($image_url), 0, null, 'src'); 113 122 114 if (!empty($meta_description)) { 115 printf( 116 '<meta name="description" content="%s" />' . "\n", 117 esc_attr(trim($meta_description)) 118 ); 119 } 123 if (is_wp_error($image_src)) { 124 return new \WP_Error('error', 'Failed to upload image: ' . $image_src->get_error_message(), ['status' => 500]); 125 } 120 126 121 if (!empty($meta_tags)) { 122 printf( 123 '<meta name="keywords" content="%s" />' . "\n", 124 esc_attr(trim(implode(',', $meta_tags))) 125 ); 127 return ['src' => $image_src]; 128 }, 129 ]) 130 ); 131 132 add_action( 133 'wp_head', 134 function () { 135 global $post; 136 if (is_page() || is_single()) { 137 $meta_description = get_post_meta(get_queried_object_id(), 'blogify_meta_description', true); 138 $meta_tags = get_post_meta(get_queried_object_id(), 'blogify_meta_tags', true); 139 140 if (!empty($meta_description)) { 141 printf( 142 '<meta name="description" content="%s" />' . "\n", 143 esc_attr(trim($meta_description)), 144 ); 145 } 146 147 if (!empty($meta_tags)) { 148 printf( 149 '<meta name="keywords" content="%s" />' . "\n", 150 esc_attr(trim(implode(',', $meta_tags))), 151 ); 152 } 126 153 } 127 154 } 128 }129 155 ); -
blogify-ai/trunk/admin/ui/all-blogs.php
r3170423 r3277817 25 25 'post_author' => sanitize_text_field($_POST['author']), 26 26 'post_category' => array_map('sanitize_text_field', $_POST['categories'] ?? []), 27 'meta_input' => [ 28 'blogify_blog_id' => sanitize_text_field($blog_id), 29 'blogify_meta_tags' => array_map('sanitize_text_field', $blog['blogOutline']['metaTags'] ?? []), 30 'blogify_meta_description' => sanitize_text_field($blog['blogOutline']['metaDescription']), 31 ], 27 32 ], true); 33 if ($blog['image']) { 34 $image = media_sideload_image(sanitize_url($blog['image']), $post_id, null, 'id'); 35 set_post_thumbnail($post_id, $image); 36 } 28 37 if (is_wp_error($post_id)) { 29 38 throw new \Exception('Failed to create post: ' . esc_textarea($post_id->get_error_message())); … … 78 87 ceil($blogs['total'] / $page_size), 79 88 $nonce, 80 'blogify-ai' 89 'blogify-ai', 81 90 ); 82 91 ?> -
blogify-ai/trunk/blogify-ai.php
r3184706 r3277817 13 13 * Plugin URI: https://blogify.ai/ 14 14 * Description: Seamlessly publish AI-generated blog posts from Blogify.ai to your WordPress site with ease, enhancing content management and SEO optimization in a few clicks. 15 * Version: 1.1. 215 * Version: 1.1.3 16 16 * Requires at least: 6.0 17 17 * Requires PHP: 7.4 … … 31 31 32 32 // Constants 33 DEFINE('BLOGIFY_VERSION', '1.1. 2');33 DEFINE('BLOGIFY_VERSION', '1.1.3'); 34 34 35 35 DEFINE('BLOGIFY_PLUGIN_DIR', plugin_dir_path(__FILE__)); -
blogify-ai/trunk/changelog.md
r3184706 r3277817 5 5 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 6 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 8 ## [1.1.3] - 2025-Apr-20 9 10 ### Added 11 12 - Addded REST endpoint for adding images to Media Library 13 14 ### Fixed 15 16 - Set blog image as thumbanil when publishing from within the plugin 17 - Set meta tags and meta description when publishing from within the plugin 18 7 19 8 20 ## [1.1.2] - 2024-Nov-09
Note: See TracChangeset
for help on using the changeset viewer.