Plugin Directory

Changeset 3435517


Ignore:
Timestamp:
01/08/2026 10:45:17 PM (4 days ago)
Author:
adunblock
Message:

Prepare for version 1.1.2 release.

Location:
ad-unblock/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ad-unblock/trunk/ad-unblock.php

    r3396365 r3435517  
    44 * Plugin Name: Ad Unblock
    55 * Description: Integrates your WordPress site with Ad Unblock service to recover ad revenue lost to ad blockers.
    6  * Version: 1.1.1
     6 * Version: 1.1.2
    77 * Author: Ad Unblock
    88 * Author URI: https://ad-unblock.com
     
    1717}
    1818
    19 define('AD_UNBLOCK_VERSION', '1.1.1');
     19define('AD_UNBLOCK_VERSION', '1.1.2');
    2020define('AD_UNBLOCK_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2121define('AD_UNBLOCK_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    109109        register_setting('ad_unblock_options', 'ad_unblock_verification_code', array(
    110110            'sanitize_callback' => 'sanitize_text_field',
     111            'default' => '',
     112        ));
     113
     114        register_setting('ad_unblock_options', 'ad_unblock_custom_api_endpoint', array(
     115            'sanitize_callback' => 'esc_url_raw',
    111116            'default' => '',
    112117        ));
     
    141146            esc_html__('Enable On Pages', 'ad-unblock'),
    142147            array($this, 'render_page_rules_field'),
     148            'ad_unblock',
     149            'ad_unblock_section_main'
     150        );
     151
     152        add_settings_field(
     153            'ad_unblock_custom_api_endpoint',
     154            esc_html__('API Endpoint', 'ad-unblock'),
     155            array($this, 'render_custom_api_endpoint_field'),
    143156            'ad_unblock',
    144157            'ad_unblock_section_main'
     
    272285            </p>
    273286        </div>
     287    <?php
     288    }
     289
     290    /**
     291     * Render custom API endpoint field
     292     */
     293    public function render_custom_api_endpoint_field()
     294    {
     295        $custom_endpoint = get_option('ad_unblock_custom_api_endpoint', '');
     296        $use_custom = !empty($custom_endpoint);
     297    ?>
     298        <fieldset>
     299            <legend class="screen-reader-text"><?php esc_html_e('API Endpoint', 'ad-unblock'); ?></legend>
     300           
     301            <p>
     302                <label>
     303                    <input type="radio" name="ad_unblock_endpoint_type" value="default"
     304                        <?php checked(!$use_custom); ?> class="ad-unblock-endpoint-toggle">
     305                    <?php esc_html_e('Use default endpoint', 'ad-unblock'); ?>
     306                </label>
     307                <br>
     308                <span class="description" style="margin-left: 25px;">
     309                    <code><?php echo esc_html(self::API_ENDPOINT); ?></code>
     310                </span>
     311            </p>
     312
     313            <p>
     314                <label>
     315                    <input type="radio" name="ad_unblock_endpoint_type" value="custom"
     316                        <?php checked($use_custom); ?> class="ad-unblock-endpoint-toggle">
     317                    <?php esc_html_e('Use custom endpoint', 'ad-unblock'); ?>
     318                </label>
     319            </p>
     320           
     321            <div id="ad_unblock_custom_endpoint_wrapper" style="<?php echo $use_custom ? '' : 'display:none;'; ?>">
     322                <input type="url" name="ad_unblock_custom_api_endpoint" id="ad_unblock_custom_api_endpoint"
     323                    value="<?php echo esc_attr($custom_endpoint); ?>" class="regular-text"
     324                    placeholder="https://example.com/api/scripts">
     325                <p class="description">
     326                    <?php esc_html_e('Enter the custom API endpoint URL to fetch unblock script sources.', 'ad-unblock'); ?>
     327                </p>
     328            </div>
     329        </fieldset>
    274330    <?php
    275331    }
     
    547603
    548604    /**
     605     * Get the API endpoint to use (custom or default)
     606     */
     607    private function get_api_endpoint()
     608    {
     609        $custom_endpoint = get_option('ad_unblock_custom_api_endpoint', '');
     610        return !empty($custom_endpoint) ? $custom_endpoint : self::API_ENDPOINT;
     611    }
     612
     613    /**
    549614     * Fetch script sources from API
    550615     */
    551616    private function fetch_script_sources_from_api()
    552617    {
    553         $response = wp_remote_get(self::API_ENDPOINT, array('timeout' => 10));
     618        $api_endpoint = $this->get_api_endpoint();
     619        $response = wp_remote_get($api_endpoint, array('timeout' => 10));
    554620
    555621        if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) {
  • ad-unblock/trunk/assets/css/admin.css

    r3342583 r3435517  
    105105}
    106106
     107#ad_unblock_custom_endpoint_wrapper {
     108    margin-top: 10px;
     109    margin-left: 25px;
     110    padding: 15px;
     111    background: #f9f9f9;
     112    border-radius: 4px;
     113    border-left: 3px solid #2271b1;
     114}
     115
     116#ad_unblock_custom_endpoint_wrapper input[type="url"] {
     117    width: 100%;
     118    max-width: 600px;
     119}
     120
     121#ad_unblock_custom_endpoint_wrapper .description {
     122    margin-top: 8px;
     123}
     124
     125.ad-unblock-endpoint-toggle {
     126    margin-right: 5px;
     127}
     128
    107129/* Cache Status Styles */
    108130.ad-unblock-cache-status {
  • ad-unblock/trunk/assets/js/admin.js

    r3366120 r3435517  
    4444  });
    4545
     46  // Handle custom API endpoint toggle
     47  var $endpointRadios = $(".ad-unblock-endpoint-toggle");
     48  var $customEndpointWrapper = $("#ad_unblock_custom_endpoint_wrapper");
     49  var $customEndpointInput = $("#ad_unblock_custom_api_endpoint");
     50
     51  function toggleCustomEndpoint(animate) {
     52    var selectedValue = $('input[name="ad_unblock_endpoint_type"]:checked').val();
     53   
     54    if (selectedValue === "custom") {
     55      if (animate !== false) {
     56        $customEndpointWrapper.slideDown(200);
     57      } else {
     58        $customEndpointWrapper.show();
     59      }
     60    } else {
     61      if (animate !== false) {
     62        $customEndpointWrapper.slideUp(200);
     63      } else {
     64        $customEndpointWrapper.hide();
     65      }
     66      // Clear the input when switching to default
     67      $customEndpointInput.val("");
     68    }
     69  }
     70
     71  // Set initial state without animation
     72  if ($endpointRadios.length > 0) {
     73    toggleCustomEndpoint(false);
     74  }
     75
     76  // Handle radio button change with animation
     77  $endpointRadios.on("change", function() {
     78    toggleCustomEndpoint(true);
     79  });
     80
    4681  // Handle "Enable on all pages" checkbox
    4782  var $allPagesCheckbox = $('input[name="ad_unblock_page_rules[all_pages]"]');
  • ad-unblock/trunk/readme.txt

    r3396365 r3435517  
    44Requires at least: 5.0
    55Tested up to: 6.8
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    7575== Changelog ==
    7676
     77= 1.1.2 =
     78* Added custom API endpoint option with toggle to use default or custom URL
     79
    7780= 1.1.1 =
    7881* Update server side API URL
  • ad-unblock/trunk/uninstall.php

    r3396365 r3435517  
    44 *
    55 * @link       https://ad-unblock.com
    6  * @since      1.1.1
     6 * @since      1.1.2
    77 *
    88 * @package    Ad_Unblock
Note: See TracChangeset for help on using the changeset viewer.