Plugin Directory

Changeset 3425851


Ignore:
Timestamp:
12/23/2025 06:28:16 AM (2 months ago)
Author:
ratneshmagicbid
Message:

Solved The errors, bugs and issues. Tagged letest version

Location:
ads-txt-by-magicbid
Files:
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • ads-txt-by-magicbid/tags/2.1.9/ads-txt.php

    r3417323 r3425851  
    11<?php
    22/**
    3  * Plugin Name:       Ads.txt File Manager
    4  * Plugin URI:        https://magicbid.ai/contact-us/?utm_source=wordpress-plugin%09&utm_medium=wordpress-plugin%09&utm_campaign=wordpress-plugin-traffic&utm_id=wordpress-plugin%09
     3 * Plugin Name:       Ads.txt File Manager By Magicbid
     4 * Plugin URI:        https://magicbid.ai/contact-us/?utm_source=wordpress-plugin&utm_medium=wordpress-plugin&utm_campaign=wordpress-plugin-traffic&utm_id=wordpress-plugin
    55 * Description:       Easily manage your site's both ads.txt and app-ads.txt file directly from the WordPress admin, with automatic versioned backups.
    6  * Version:           2.1.8
     6 * Version:           2.1.9
    77 * Author:            Magicbid.ai
    8  * Author URI:        https://magicbid.ai/?utm_source=wordpressplugin%09&utm_medium=wordpressplugin%09&utm_campaign=wordpressplugin%09traffic&utm_id=wordpressplugin%09
     8 * Author URI:        https://magicbid.ai/?utm_source=wordpressplugin&utm_medium=wordpressplugin&utm_campaign=wordpressplugintraffic&utm_id=wordpressplugin
    99 * License:           GPL-2.0-or-later
    1010 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    5454}
    5555
     56define('MB_PLGN_ADS_TXT_TABLE_BACKUPS', $wpdb->prefix . 'mb_plgn_ads_txt_backups' );
     57
    5658// UPDATE COLUMN
    5759add_action('plugins_loaded', 'mb_plgn_ads_txt_check_db_version');
     
    6264    $installed_ver = get_option('mb_plgn_ads_txt_db_version');
    6365    if ($installed_ver !== MB_PLGN_ADS_TXT_DB_VERSION) {
    64         $table_name = $wpdb->prefix . 'mb_plgn_ads_txt_backups';
    6566
    6667        // Check if 'file_type' column exists
    67         $column = $wpdb->get_results("SHOW COLUMNS FROM `$table_name` LIKE 'file_type'");
    68         if (empty($column)) {
    69             $wpdb->query("ALTER TABLE `$table_name` ADD COLUMN `file_type` VARCHAR(10) DEFAULT 'web'");
     68        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.NotPrepared -- $table is derived from $wpdb->prefix and escaped. DDL queries cannot be prepared or cached.;
     69        $column = $wpdb->get_var("SHOW COLUMNS FROM `".MB_PLGN_ADS_TXT_TABLE_BACKUPS."` LIKE 'file_type'");
     70        if (empty($column) || $column === null) {
     71        // Add column if missing (schema change during plugin upgrade)
     72        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared -- $table is derived from $wpdb->prefix and escaped;
     73            $wpdb->query("ALTER TABLE `".MB_PLGN_ADS_TXT_TABLE_BACKUPS."` ADD COLUMN `file_type` VARCHAR(10) DEFAULT 'web'");
    7074        }
    7175
  • ads-txt-by-magicbid/tags/2.1.9/functions/functions.php

    r3401696 r3425851  
    3939    check_ajax_referer('mb_plgn_ads_txt_nonce');
    4040
    41     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     41    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    4242    $file = MB_PLGN_HOME_PATH . $type;
    4343    if (!file_exists($file)) {
     
    5050
    5151add_action('wp_ajax_create_mb_plgn_ads_txt', function () {
    52     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     52    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    5353    check_ajax_referer('mb_plgn_ads_txt_nonce');
    5454    file_put_contents(MB_PLGN_HOME_PATH . $type, '');
     
    6464    }
    6565    $content = implode("\n", array_map('sanitize_text_field', wp_unslash($_POST['content'])));
    66     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     66    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    6767    $file = MB_PLGN_HOME_PATH . $type;
    6868
     
    7878                'content' => $old_content,
    7979                'user_id' => get_current_user_id(),
    80                 'file_type' => $_POST['file_type'] === 'app' ? 'app' : 'web'
     80                'file_type' => (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app' : 'web'
    8181            ]);
    8282        }
     
    8888
    8989add_action('wp_ajax_load_mb_plgn_ads_txt_backups', function () {
     90    check_ajax_referer('mb_plgn_ads_txt_nonce');
     91    if (!current_user_can('manage_options')) wp_send_json_error();
    9092    global $wpdb;
    91     $fileType = $_POST['file_type'] === 'app' ? 'app' : 'web';
     93    $fileType = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app' : 'web';
    9294    /** @noinspection SqlResolve */
    9395    /** @noinspection SqlNoDataSourceInspection */
     
    121123
    122124    // Backup current before restoring
    123     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     125    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    124126    $current = file_get_contents(MB_PLGN_HOME_PATH . $type);
    125127    /** @noinspection SqlResolve */
     
    140142
    141143    global $wpdb;
    142     $id = intval($_POST['id']);
     144    $id = isset($_POST['id']) ? intval($_POST['id']) : '';
    143145    $table = $wpdb->prefix . 'mb_plgn_ads_txt_backups';
     146    // Delete backup row (safe prepared DELETE query)
     147    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    144148    $deleted = $wpdb->delete($table, ['id' => $id]);
    145149
  • ads-txt-by-magicbid/tags/2.1.9/readme.txt

    r3417323 r3425851  
    1 === Ads.txt File Manager ===
     1=== Ads.txt File Manager By Magicbid ===
    22Contributors: ratneshmagicbid
    33Tags: ads.txt, app-ads.txt, monetization, publisher, google ads
     
    55Tested up to: 6.9
    66Requires PHP: 7.2
    7 Stable tag: 2.1.8
     7Stable tag: 2.1.9
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 **Ads.txt File Manager** allows publishers to manage both `ads.txt` and `app-ads.txt` file directly from the WordPress admin panel, without using FTP or file managers. It offers a safe and intuitive UI to help users edit, save, and back up their ads.txt file to comply with programmatic advertising requirements.
     15**Ads.txt File Manager By Magicbid** allows publishers to manage both `ads.txt` and `app-ads.txt` file directly from the WordPress admin panel, without using FTP or file managers. It offers a safe and intuitive UI to help users edit, save, and back up their ads.txt file to comply with programmatic advertising requirements.
    1616
    1717### Features
  • ads-txt-by-magicbid/tags/2.1.9/views/admin-page.php

    r3318170 r3425851  
     1<?php
     2/*
     3 * Admin Page
     4 */
     5if (!defined('ABSPATH')) exit;
     6?>
     7
    18<div class="ads-txt-mb-theme">
    29    <div class="ads-txt-mb-top-bar">
  • ads-txt-by-magicbid/trunk/ads-txt.php

    r3417323 r3425851  
    11<?php
    22/**
    3  * Plugin Name:       Ads.txt File Manager
    4  * Plugin URI:        https://magicbid.ai/contact-us/?utm_source=wordpress-plugin%09&utm_medium=wordpress-plugin%09&utm_campaign=wordpress-plugin-traffic&utm_id=wordpress-plugin%09
     3 * Plugin Name:       Ads.txt File Manager By Magicbid
     4 * Plugin URI:        https://magicbid.ai/contact-us/?utm_source=wordpress-plugin&utm_medium=wordpress-plugin&utm_campaign=wordpress-plugin-traffic&utm_id=wordpress-plugin
    55 * Description:       Easily manage your site's both ads.txt and app-ads.txt file directly from the WordPress admin, with automatic versioned backups.
    6  * Version:           2.1.8
     6 * Version:           2.1.9
    77 * Author:            Magicbid.ai
    8  * Author URI:        https://magicbid.ai/?utm_source=wordpressplugin%09&utm_medium=wordpressplugin%09&utm_campaign=wordpressplugin%09traffic&utm_id=wordpressplugin%09
     8 * Author URI:        https://magicbid.ai/?utm_source=wordpressplugin&utm_medium=wordpressplugin&utm_campaign=wordpressplugintraffic&utm_id=wordpressplugin
    99 * License:           GPL-2.0-or-later
    1010 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    5454}
    5555
     56define('MB_PLGN_ADS_TXT_TABLE_BACKUPS', $wpdb->prefix . 'mb_plgn_ads_txt_backups' );
     57
    5658// UPDATE COLUMN
    5759add_action('plugins_loaded', 'mb_plgn_ads_txt_check_db_version');
     
    6264    $installed_ver = get_option('mb_plgn_ads_txt_db_version');
    6365    if ($installed_ver !== MB_PLGN_ADS_TXT_DB_VERSION) {
    64         $table_name = $wpdb->prefix . 'mb_plgn_ads_txt_backups';
    6566
    6667        // Check if 'file_type' column exists
    67         $column = $wpdb->get_results("SHOW COLUMNS FROM `$table_name` LIKE 'file_type'");
    68         if (empty($column)) {
    69             $wpdb->query("ALTER TABLE `$table_name` ADD COLUMN `file_type` VARCHAR(10) DEFAULT 'web'");
     68        // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.PreparedSQL.NotPrepared -- $table is derived from $wpdb->prefix and escaped. DDL queries cannot be prepared or cached.;
     69        $column = $wpdb->get_var("SHOW COLUMNS FROM `".MB_PLGN_ADS_TXT_TABLE_BACKUPS."` LIKE 'file_type'");
     70        if (empty($column) || $column === null) {
     71        // Add column if missing (schema change during plugin upgrade)
     72        // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared -- $table is derived from $wpdb->prefix and escaped;
     73            $wpdb->query("ALTER TABLE `".MB_PLGN_ADS_TXT_TABLE_BACKUPS."` ADD COLUMN `file_type` VARCHAR(10) DEFAULT 'web'");
    7074        }
    7175
  • ads-txt-by-magicbid/trunk/functions/functions.php

    r3401696 r3425851  
    3939    check_ajax_referer('mb_plgn_ads_txt_nonce');
    4040
    41     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     41    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    4242    $file = MB_PLGN_HOME_PATH . $type;
    4343    if (!file_exists($file)) {
     
    5050
    5151add_action('wp_ajax_create_mb_plgn_ads_txt', function () {
    52     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     52    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    5353    check_ajax_referer('mb_plgn_ads_txt_nonce');
    5454    file_put_contents(MB_PLGN_HOME_PATH . $type, '');
     
    6464    }
    6565    $content = implode("\n", array_map('sanitize_text_field', wp_unslash($_POST['content'])));
    66     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     66    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    6767    $file = MB_PLGN_HOME_PATH . $type;
    6868
     
    7878                'content' => $old_content,
    7979                'user_id' => get_current_user_id(),
    80                 'file_type' => $_POST['file_type'] === 'app' ? 'app' : 'web'
     80                'file_type' => (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app' : 'web'
    8181            ]);
    8282        }
     
    8888
    8989add_action('wp_ajax_load_mb_plgn_ads_txt_backups', function () {
     90    check_ajax_referer('mb_plgn_ads_txt_nonce');
     91    if (!current_user_can('manage_options')) wp_send_json_error();
    9092    global $wpdb;
    91     $fileType = $_POST['file_type'] === 'app' ? 'app' : 'web';
     93    $fileType = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app' : 'web';
    9294    /** @noinspection SqlResolve */
    9395    /** @noinspection SqlNoDataSourceInspection */
     
    121123
    122124    // Backup current before restoring
    123     $type = $_POST['file_type'] === 'app' ? 'app-ads.txt' : 'ads.txt';
     125    $type = (isset($_POST['file_type']) && $_POST['file_type'] === 'app') ? 'app-ads.txt' : 'ads.txt';
    124126    $current = file_get_contents(MB_PLGN_HOME_PATH . $type);
    125127    /** @noinspection SqlResolve */
     
    140142
    141143    global $wpdb;
    142     $id = intval($_POST['id']);
     144    $id = isset($_POST['id']) ? intval($_POST['id']) : '';
    143145    $table = $wpdb->prefix . 'mb_plgn_ads_txt_backups';
     146    // Delete backup row (safe prepared DELETE query)
     147    // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
    144148    $deleted = $wpdb->delete($table, ['id' => $id]);
    145149
  • ads-txt-by-magicbid/trunk/readme.txt

    r3417323 r3425851  
    1 === Ads.txt File Manager ===
     1=== Ads.txt File Manager By Magicbid ===
    22Contributors: ratneshmagicbid
    33Tags: ads.txt, app-ads.txt, monetization, publisher, google ads
     
    55Tested up to: 6.9
    66Requires PHP: 7.2
    7 Stable tag: 2.1.8
     7Stable tag: 2.1.9
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 **Ads.txt File Manager** allows publishers to manage both `ads.txt` and `app-ads.txt` file directly from the WordPress admin panel, without using FTP or file managers. It offers a safe and intuitive UI to help users edit, save, and back up their ads.txt file to comply with programmatic advertising requirements.
     15**Ads.txt File Manager By Magicbid** allows publishers to manage both `ads.txt` and `app-ads.txt` file directly from the WordPress admin panel, without using FTP or file managers. It offers a safe and intuitive UI to help users edit, save, and back up their ads.txt file to comply with programmatic advertising requirements.
    1616
    1717### Features
  • ads-txt-by-magicbid/trunk/views/admin-page.php

    r3318170 r3425851  
     1<?php
     2/*
     3 * Admin Page
     4 */
     5if (!defined('ABSPATH')) exit;
     6?>
     7
    18<div class="ads-txt-mb-theme">
    29    <div class="ads-txt-mb-top-bar">
Note: See TracChangeset for help on using the changeset viewer.