Plugin Directory

Changeset 3398720


Ignore:
Timestamp:
11/19/2025 09:44:49 AM (5 months ago)
Author:
emplibot
Message:

prepare version 1.1.0 with security fixes

Location:
emplibot/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • emplibot/trunk/emplibot.php

    r3284888 r3398720  
    33 * Plugin Name:       Emplibot
    44 * Description:       Automated keyword research, automated blogging, with internal and external links, engaging infographics, unique featured images, and more.
    5  * Version:           1.0.9
     5 * Version:           1.1.0
    66 * Requires at least: 6.4
    77 * Requires PHP:      7.2
  • emplibot/trunk/includes/class-emplibot.php

    r3153973 r3398720  
    8787            'emplibot_setting_section' // section
    8888        );
     89
     90        add_settings_field(
     91            'upload_version', // id
     92            'Upload Version', // title
     93            array( $this, 'upload_version_callback' ), // callback
     94            'emplibot-admin', // page
     95            'emplibot_setting_section' // section
     96        );
    8997    }
    9098
     
    122130                $sanitary_values['plugin_key'] = sanitize_text_field( $plugin_key );
    123131            }
     132        }
     133
     134        if ( isset( $input['upload_version'] ) ) {
     135            // Only allow v1 or v2 as valid values
     136            $sanitary_values['upload_version'] = ($input['upload_version'] === 'v2') ? 'v2' : 'v1';
    124137        }
    125138
     
    164177   
    165178    }
     179
     180    public function upload_version_callback() {
     181        $emplibot_options = get_option('emplibot_options');
     182        $upload_version = (is_array($emplibot_options) && isset($emplibot_options['upload_version']))
     183                          ? $emplibot_options['upload_version'] : 'v2'; // Default to v2
     184        ?>
     185        <select name="emplibot_options[upload_version]" id="upload_version">
     186            <option value="v1" <?php selected($upload_version, 'v1'); ?>>v1</option>
     187            <option value="v2" <?php selected($upload_version, 'v2'); ?>>v2</option>
     188        </select>
     189        <p class="description">
     190            Upload version v2 is recommended. Use v1 only if you experience issues while receiving blogposts with v2.
     191        </p>
     192        <?php
     193    }
    166194}
  • emplibot/trunk/includes/functions.php

    r3281098 r3398720  
    1010
    1111    // Make a GET request to the REST API
    12     $response = wp_remote_get($backend_url . '/public-key');
     12    $response = wp_safe_remote_get($backend_url . '/public-key');
    1313
    1414    // Check if the request was successful
  • emplibot/trunk/includes/rest-api.php

    r3284888 r3398720  
    341341 *
    342342 * @param WP_REST_Request $request The request object.
    343  * @return WP_REST_Response The response containing the plugin version, plugin key hash, and environment info.
     343 * @return WP_REST_Response The response containing the plugin version, plugin key hash, upload version, and environment info.
    344344 */
    345345function emplibot_get_version(WP_REST_Request $request) {
     
    351351    $plugin_key = isset($emplibot_options['plugin_key']) ? sanitize_text_field($emplibot_options['plugin_key']) : '';
    352352   
     353    // Get the upload version from options (default to v2 if not set)
     354    $upload_version = isset($emplibot_options['upload_version']) ? sanitize_text_field($emplibot_options['upload_version']) : 'v2';
     355   
    353356    // Generate SHA-256 hash of the plugin key
    354357    $pk_hash = hash('sha256', $plugin_key);
     
    360363    $fastcgi_finish_request_supported = function_exists('fastcgi_finish_request');
    361364   
    362     // Return the version, pk_hash, and environment info as a JSON response
     365    // Return the version, pk_hash, upload_version, and environment info as a JSON response
    363366    return new WP_REST_Response(
    364367        array(
    365368            'version' => $plugin_data['Version'],
    366369            'pk_hash' => $pk_hash,
     370            'upload_version' => $upload_version,
    367371            'wp_cron_enabled' => $wp_cron_enabled,
    368372            'fastcgi_finish_request_supported' => $fastcgi_finish_request_supported
     
    484488    // Download the ZIP file
    485489    $zip_file_path = $temp_dir . '/blog_post.zip';
    486     $download_response = wp_remote_get($download_url, array(
     490    $download_response = wp_safe_remote_get($download_url, array(
    487491        'timeout' => 60,
    488492        'stream' => true,
     
    763767        );
    764768       
    765         wp_remote_post($webhook_callback_url, array(
     769        wp_safe_remote_post($webhook_callback_url, array(
    766770            'body' => json_encode($webhook_payload),
    767771            'headers' => array('Content-Type' => 'application/json'),
     
    797801    );
    798802   
    799     wp_remote_post($webhook_url, array(
     803    wp_safe_remote_post($webhook_url, array(
    800804        'body' => json_encode($webhook_payload),
    801805        'headers' => array('Content-Type' => 'application/json'),
  • emplibot/trunk/readme.txt

    r3284888 r3398720  
    44Requires at least: 6.4
    55Tested up to: 6.8
    6 Stable tag: 1.0.9
    7 Requires PHP: 7.1
     6Stable tag: 1.1.0
     7Requires PHP: 7.2
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    6262= 1.0.9 =
    6363* Prefer GD Image processing.
     64
     65= 1.1.0 =
     66* Add the option to choose the blogpost processing workflow.
     67* Security improvements.
     68
Note: See TracChangeset for help on using the changeset viewer.