Version Description
Download this release
Release Info
Developer | advancedads |
Plugin | Advanced Ads |
Version | 1.30.2-rc.1 |
Comparing to | |
See all releases |
Code changes from version 1.30.1 to 1.30.2-rc.1
- advanced-ads.php +2 -2
- classes/ad_group.php +18 -12
- languages/advanced-ads.pot +2 -2
- readme.txt +6 -1
advanced-ads.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
-
* Version: 1.30.1
|
16 |
* Author: Thomas Maier, Advanced Ads GmbH
|
17 |
* Author URI: https://wpadvancedads.com
|
18 |
* Text Domain: advanced-ads
|
@@ -39,7 +39,7 @@ define( 'ADVADS_BASE_DIR', dirname( ADVADS_BASE ) ); // directory of the plugin
|
|
39 |
// general and global slug, e.g. to store options in WP.
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
-
define( 'ADVADS_VERSION', '1.30.1' );
|
43 |
|
44 |
// Autoloading, modules and functions.
|
45 |
|
12 |
* Plugin Name: Advanced Ads
|
13 |
* Plugin URI: https://wpadvancedads.com
|
14 |
* Description: Manage and optimize your ads in WordPress
|
15 |
+
* Version: 1.30.2-rc.1
|
16 |
* Author: Thomas Maier, Advanced Ads GmbH
|
17 |
* Author URI: https://wpadvancedads.com
|
18 |
* Text Domain: advanced-ads
|
39 |
// general and global slug, e.g. to store options in WP.
|
40 |
define( 'ADVADS_SLUG', 'advanced-ads' );
|
41 |
define( 'ADVADS_URL', 'https://wpadvancedads.com/' );
|
42 |
+
define( 'ADVADS_VERSION', '1.30.2-rc.1' );
|
43 |
|
44 |
// Autoloading, modules and functions.
|
45 |
|
classes/ad_group.php
CHANGED
@@ -278,21 +278,29 @@ class Advanced_Ads_Group {
|
|
278 |
/**
|
279 |
* Get ordered ids of the ads that belong to the group
|
280 |
*
|
281 |
-
* @return array
|
282 |
*/
|
283 |
public function get_ordered_ad_ids() {
|
284 |
-
if ( ! $this->id ) {
|
285 |
-
return false;
|
286 |
-
}
|
287 |
-
|
288 |
// load ads
|
289 |
-
$ads
|
|
|
|
|
|
|
290 |
$ad_ids = array_keys( $ads );
|
291 |
|
292 |
// get ad weights serving as an order here
|
293 |
$weights = $this->get_ad_weights();
|
294 |
asort($weights);
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
// remove ads with 0 ad weight and unavailable ads (e.g. drafts).
|
297 |
foreach ( $weights as $ad_id => $ad_weight ) {
|
298 |
if ( $ad_weight === 0 || ! in_array( $ad_id, $ad_ids, true ) ) {
|
@@ -301,12 +309,10 @@ class Advanced_Ads_Group {
|
|
301 |
}
|
302 |
|
303 |
// order ads based on group type
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
default : // default
|
309 |
-
$ordered_ad_ids = $this->shuffle_ads($ads, $weights);
|
310 |
}
|
311 |
|
312 |
return apply_filters( 'advanced-ads-group-output-ad-ids', $ordered_ad_ids, $this->type, $ads, $weights, $this );
|
278 |
/**
|
279 |
* Get ordered ids of the ads that belong to the group
|
280 |
*
|
281 |
+
* @return array
|
282 |
*/
|
283 |
public function get_ordered_ad_ids() {
|
|
|
|
|
|
|
|
|
284 |
// load ads
|
285 |
+
$ads = $this->load_all_ads();
|
286 |
+
if ( ! is_array( $ads ) ) {
|
287 |
+
return array();
|
288 |
+
}
|
289 |
$ad_ids = array_keys( $ads );
|
290 |
|
291 |
// get ad weights serving as an order here
|
292 |
$weights = $this->get_ad_weights();
|
293 |
asort($weights);
|
294 |
|
295 |
+
// add ads whose weight has not yet been saved with the default value.
|
296 |
+
if ( count( $ad_ids ) > count( $weights ) ) {
|
297 |
+
foreach ( $ad_ids as $ad_id ) {
|
298 |
+
if ( ! array_key_exists( $ad_id, $weights ) ) {
|
299 |
+
$weights[ $ad_id ] = self::MAX_AD_GROUP_DEFAULT_WEIGHT;
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
// remove ads with 0 ad weight and unavailable ads (e.g. drafts).
|
305 |
foreach ( $weights as $ad_id => $ad_weight ) {
|
306 |
if ( $ad_weight === 0 || ! in_array( $ad_id, $ad_ids, true ) ) {
|
309 |
}
|
310 |
|
311 |
// order ads based on group type
|
312 |
+
if ( $this->type === 'ordered' ) {
|
313 |
+
$ordered_ad_ids = $this->shuffle_ordered_ads( $weights );
|
314 |
+
} else { // default
|
315 |
+
$ordered_ad_ids = $this->shuffle_ads( $ads, $weights );
|
|
|
|
|
316 |
}
|
317 |
|
318 |
return apply_filters( 'advanced-ads-group-output-ad-ids', $ordered_ad_ids, $this->type, $ads, $weights, $this );
|
languages/advanced-ads.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Advanced Ads plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Advanced Ads 1.30.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
|
7 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
8 |
"Language-Team: webgilde <support@wpadvancedads.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-11-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: advanced-ads\n"
|
2 |
# This file is distributed under the same license as the Advanced Ads plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Advanced Ads 1.30.2-rc.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/advanced-ads/\n"
|
7 |
"Last-Translator: Thomas Maier <post@webzunft.de>\n"
|
8 |
"Language-Team: webgilde <support@wpadvancedads.com>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-11-16T09:53:54+01:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: advanced-ads\n"
|
readme.txt
CHANGED
@@ -322,9 +322,14 @@ Yes. You can use plenty of [hooks](https://wpadvancedads.com/codex/) to customiz
|
|
322 |
|
323 |
== Changelog ==
|
324 |
|
|
|
|
|
|
|
|
|
|
|
325 |
= 1.30.1 =
|
326 |
|
327 |
-
Fix: copy missing `composer/platform_check.php`
|
328 |
|
329 |
= 1.30.0 =
|
330 |
|
322 |
|
323 |
== Changelog ==
|
324 |
|
325 |
+
= untagged =
|
326 |
+
|
327 |
+
- Fix: prevent applying array functions to boolean in `Advanced_Ads_Group`
|
328 |
+
- Fix: add default weight for ads added to groups via the ad edit screen
|
329 |
+
|
330 |
= 1.30.1 =
|
331 |
|
332 |
+
- Fix: copy missing `composer/platform_check.php`
|
333 |
|
334 |
= 1.30.0 =
|
335 |
|