Plugin Directory

Changeset 2956613


Ignore:
Timestamp:
08/22/2023 08:30:11 AM (3 years ago)
Author:
setupad
Message:

Plugin name change

Location:
setupad/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • setupad/trunk/public/includes/ad-placement/the-content.php

    r2954187 r2956613  
    462462function setupad_between_list_items($content, $setupad_rows) {
    463463
    464     preg_match_all('/<(li|dt|dd)[^>]*>.*?<\/\1>/s', $content, $matches);
     464    preg_match_all('/<(ul|ol|dl)[^>]*>.*?(<(li|dt|dd)[^>]*>.*?<\/\2>.*?)*<\/\1>/s', $content, $matches);
     465
    465466    if (empty($matches[0]))
    466467        return $content;
    467     $content_block = $matches[0];
     468
     469    $list_block = $matches[0];
     470    $list_type_block = $matches[1];
    468471
    469472    foreach ( $setupad_rows as $row ) {
     473
    470474        if (!$row->setupad_insertion_pages || !in_array(setupad_page_check(),explode(',',$row->setupad_insertion_pages))) continue; //page check
    471475        if (setupad_url_inclusions($row->setupad_url_inclusions)) continue; // URL Inclusions - Prioritize whitelisting before blacklisting
     
    478482            $positions = setupad_get_positions($position, true, true);
    479483
    480             if ($repeated_position) {
    481                 for ($i = 0; $i <= count($content_block); $i++) {
    482                     if ($row->setupad_starting_position > $i+1) continue; //Skip until starting position
    483                     if (($i - $row->setupad_starting_position) % $repeated_position == 0 && $i) {
     484            foreach($list_block as $index => $list){
     485
     486                preg_match_all('/<(li|dt|dd)[^>]*>.*?<\/\1>/s', $list, $matches);
     487                $list = $matches[0];
     488                array_unshift($list, '<'. $list_type_block[$index] . '>');
     489
     490                if ($repeated_position) {
     491                    for ($i = 0; $i <= count($list); $i++) {
     492
     493                        if ($row->setupad_starting_position > $i+1) continue; //Skip until starting position
     494                        if (($i - $row->setupad_starting_position) % $repeated_position == 0 && $i) {
     495                            $adContents = setupad_get_ad_contents($row);
     496
     497                            if (!empty($list[$i]) && $adContents) {
     498                                $list[$i] .= '</li></dt></dd>' . $adContents;
     499                            }
     500                        }
     501                    }
     502                } else {
     503                    foreach ($positions as $position) {
    484504                        $adContents = setupad_get_ad_contents($row);
    485505
    486                         if (!empty($content_block[$i - 1]) && $adContents) {
    487                             $content_block[$i - 1] .= '</li></dt></dd>' . $adContents;
     506                        if (!empty($list[$position+1]) && $adContents) {
     507                            $list[$position+1] .= $adContents;
    488508                        }
    489509                    }
    490510                }
    491             } else {
    492                 foreach ($positions as $position) {
    493                     $adContents = setupad_get_ad_contents($row);
    494 
    495                     if (!empty($content_block[$position]) && $adContents) {
    496                         $content_block[$position] .= $adContents;
    497                     }
    498                 }
    499             }
    500         }
    501     }
    502 
     511
     512                $list[] .= '</'. $list_type_block[$index] .'>';
     513
     514                $list_block[$index] = implode("", $list);
     515
     516            }
     517        }
     518    }
    503519    $merged_content = '';
    504520
    505     $original_content_parts = preg_split('/<(li|dt|dd)[^>]*>.*?<\/\1>/s', $content);
     521    $original_content_parts = preg_split('/<(ul|ol|dl)[^>]*>.*?(<(li|dt|dd)[^>]*>.*?<\/\2>.*?)*<\/\1>/s', $content);
    506522
    507523    foreach ($original_content_parts as $i => $original_part) {
    508524        $merged_content .= $original_part;
    509525
    510         if (isset($content_block[$i])) {
    511             $merged_content .= $content_block[$i];
     526        if (isset($list_block[$i])) {
     527            $merged_content .= $list_block[$i];
    512528        }
    513529    }
  • setupad/trunk/readme.txt

    r2954221 r2956613  
    1 === Setupad ===
     1=== Setupad WP Ads ===
    22
    33Contributors: setupad
    4 Tags: setupad, setupad ads, ads inserter, ads, advertising, adsense, ad manager
     4Tags: setupad, setupad ads, Setupad WP Ads, ads, Wordpress Ads, adsense, ad manager
    55Requires at least: 4.4
    66Tested up to: 6.3
    7 Stable tag: 1.4.1
     7Stable tag: 1.4.2
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    1414== Description ==
    1515
    16 Looking for an ultimate solution for managing and displaying ads on your WordPress site? Look no further! Introducing the Setupad WordPress plugin – a simple and powerful tool suitable for both beginners in website monetization and experienced website owners.
     16Looking for an ultimate solution for managing and displaying ads on your WordPress site? Look no further! Introducing the Setupad WP Ads – a simple and powerful plugin for WordPress suitable for both beginners in website monetization and experienced website owners.
    1717
    1818With this plugin, you can:
    1919
     20* Insert all kinds of ads, including Google AdSense and Google Ad Manager (GAM), through code snippets.
    2021* Insert ad placements (HTML/JS) or images in multiple positions, including before and after posts, content, paragraphs, images, comments, and excerpts.
    2122* Insert placements on different pages and choose which devices to display them on (desktop, tablet, mobile).
     
    3334Want to know what the best part is? Our plugin comes with all these advanced features completely free of charge.
    3435
    35 Get the Setupad WordPress plugin and take full control over your ad management today!
     36Get the Setupad WP Ads plugin for your WordPress site and take full control over your ad management today!
    3637
    3738[Full feature list and documentation](https://setupad.github.io/Setupad-WP-Plugin-Documentation/features)
     
    7879== Changelog ==
    7980
     81= 1.4.2 =
     82- Name change
     83- Bug fixes
     84
    8085= 1.4.1 =
    8186- insertion between list items
  • setupad/trunk/setupad.php

    r2954221 r2956613  
    11<?php
    22/**
    3  * @package Setupad
    4  * @version 1.4.1
     3 * @package Setupad WP Ads
     4 * @version 1.4.2
    55 */
    66/*
    7 Plugin Name: Setupad
     7Plugin Name: Setupad WP Ads
    88Description: Simple and powerful ad insertion and management tool for WordPress users with built-in integration with Setupad header bidding monetization platform.
    99Author: Setupad
    10 Version: 1.4.1
     10Version: 1.4.2
    1111Author URI: https://setupad.com/
    1212*/
Note: See TracChangeset for help on using the changeset viewer.