Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/advanced.../classes
File: ad_group.php
public function get_ad_weights( $ad_ids = [] ) {
[500] Fix | Delete
if ( is_array( $this->ad_weights ) ) {
[501] Fix | Delete
return $this->ad_weights;
[502] Fix | Delete
}
[503] Fix | Delete
[504] Fix | Delete
$weights = get_option( 'advads-ad-weights', [] );
[505] Fix | Delete
$this->ad_weights = [];
[506] Fix | Delete
if ( array_key_exists( $this->id, $weights ) ) {
[507] Fix | Delete
$this->ad_weights = $weights[ $this->id ];
[508] Fix | Delete
}
[509] Fix | Delete
asort( $this->ad_weights );
[510] Fix | Delete
[511] Fix | Delete
// add ads whose weight has not yet been saved with the default value.
[512] Fix | Delete
foreach ( $ad_ids as $ad_id ) {
[513] Fix | Delete
if ( ! array_key_exists( $ad_id, $this->ad_weights ) ) {
[514] Fix | Delete
$this->ad_weights[ $ad_id ] = self::MAX_AD_GROUP_DEFAULT_WEIGHT;
[515] Fix | Delete
}
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
return $this->ad_weights;
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
/**
[522] Fix | Delete
* Save ad group information that are not included in terms or ad weight
[523] Fix | Delete
*
[524] Fix | Delete
* @since 1.4.8
[525] Fix | Delete
* @param arr $args group arguments
[526] Fix | Delete
*/
[527] Fix | Delete
public function save($args = []) {
[528] Fix | Delete
[529] Fix | Delete
$defaults = [ 'type' => 'default', 'ad_count' => 1, 'options' => [] ];
[530] Fix | Delete
$args = wp_parse_args($args, $defaults);
[531] Fix | Delete
[532] Fix | Delete
// get global ad group option
[533] Fix | Delete
$groups = get_option( 'advads-ad-groups', [] );
[534] Fix | Delete
[535] Fix | Delete
$groups[$this->id] = $args;
[536] Fix | Delete
[537] Fix | Delete
update_option( 'advads-ad-groups', $groups );
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
/**
[541] Fix | Delete
* Delete all the ad weights for a group by id
[542] Fix | Delete
*
[543] Fix | Delete
* @since 1.0.0
[544] Fix | Delete
*/
[545] Fix | Delete
public static function delete_ad_weights($group_id){
[546] Fix | Delete
$all_weights = get_option( 'advads-ad-weights', [] );
[547] Fix | Delete
if ($all_weights && isset($all_weights[$group_id])){
[548] Fix | Delete
unset($all_weights[$group_id]);
[549] Fix | Delete
update_option( 'advads-ad-weights', $all_weights );
[550] Fix | Delete
}
[551] Fix | Delete
}
[552] Fix | Delete
[553] Fix | Delete
/**
[554] Fix | Delete
* Create a wrapper to place around the group.
[555] Fix | Delete
*/
[556] Fix | Delete
private function create_wrapper() {
[557] Fix | Delete
$this->wrapper = [];
[558] Fix | Delete
[559] Fix | Delete
if ( $this->ad_args['is_top_level'] ) {
[560] Fix | Delete
// Add label.
[561] Fix | Delete
$placement_state = isset( $this->ad_args['ad_label'] ) ? $this->ad_args['ad_label'] : 'default';
[562] Fix | Delete
$this->label = Advanced_Ads::get_instance()->get_label( $placement_state );
[563] Fix | Delete
[564] Fix | Delete
// Add placement class.
[565] Fix | Delete
if ( ! empty( $this->ad_args['output']['class'] ) && is_array( $this->ad_args['output']['class'] ) ) {
[566] Fix | Delete
$this->wrapper['class'] = $this->ad_args['output']['class'];
[567] Fix | Delete
}
[568] Fix | Delete
[569] Fix | Delete
// ad Health Tool add class wrapper
[570] Fix | Delete
if ( WordPress::user_can('advanced_ads_edit_ads') ) {
[571] Fix | Delete
$frontend_prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
[572] Fix | Delete
$this->wrapper['class'][] = $frontend_prefix . 'highlight-wrapper';
[573] Fix | Delete
}
[574] Fix | Delete
[575] Fix | Delete
if ( isset( $this->ad_args['output']['wrapper_attrs'] ) && is_array( $this->ad_args['output']['wrapper_attrs'] ) ) {
[576] Fix | Delete
foreach ( $this->ad_args['output']['wrapper_attrs'] as $key => $value ) {
[577] Fix | Delete
$this->wrapper[$key] = $value;
[578] Fix | Delete
}
[579] Fix | Delete
}
[580] Fix | Delete
[581] Fix | Delete
if ( ! empty( $this->ad_args['placement_position'] ) ) {
[582] Fix | Delete
switch ( $this->ad_args['placement_position'] ) {
[583] Fix | Delete
case 'left' :
[584] Fix | Delete
$this->wrapper['style']['float'] = 'left';
[585] Fix | Delete
break;
[586] Fix | Delete
case 'right' :
[587] Fix | Delete
$this->wrapper['style']['float'] = 'right';
[588] Fix | Delete
break;
[589] Fix | Delete
case 'center' :
[590] Fix | Delete
// We don't know whether the 'add_wrapper_sizes' option exists and width is set.
[591] Fix | Delete
$this->wrapper['style']['text-align'] = 'center';
[592] Fix | Delete
break;
[593] Fix | Delete
}
[594] Fix | Delete
}
[595] Fix | Delete
}
[596] Fix | Delete
[597] Fix | Delete
$this->wrapper = (array) apply_filters( 'advanced-ads-output-wrapper-options-group', $this->wrapper, $this );
[598] Fix | Delete
[599] Fix | Delete
if ( ( $this->wrapper !== [] || $this->label ) && ! isset( $this->wrapper['id'] ) ) {
[600] Fix | Delete
$prefix = Advanced_Ads_Plugin::get_instance()->get_frontend_prefix();
[601] Fix | Delete
$this->wrapper['id'] = $prefix . mt_rand();
[602] Fix | Delete
}
[603] Fix | Delete
}
[604] Fix | Delete
[605] Fix | Delete
/**
[606] Fix | Delete
* Calculate the number of available weights for a group depending on
[607] Fix | Delete
* number of ads and default value.
[608] Fix | Delete
*
[609] Fix | Delete
* @param int $num_ads Number of ads in the group.
[610] Fix | Delete
* @since 1.8.22
[611] Fix | Delete
*
[612] Fix | Delete
* @return max weight used in group settings
[613] Fix | Delete
*/
[614] Fix | Delete
public static function get_max_ad_weight( $num_ads = 1 ){
[615] Fix | Delete
[616] Fix | Delete
// use default if lower than default.
[617] Fix | Delete
$num_ads = absint( $num_ads );
[618] Fix | Delete
[619] Fix | Delete
// use number of ads or max ad weight value, whatever is higher
[620] Fix | Delete
$max_weight = $num_ads < self::MAX_AD_GROUP_DEFAULT_WEIGHT ? self::MAX_AD_GROUP_DEFAULT_WEIGHT : $num_ads;
[621] Fix | Delete
[622] Fix | Delete
// allow users to manipulate max ad weight
[623] Fix | Delete
return apply_filters( 'advanced-ads-max-ad-weight', $max_weight, $num_ads );
[624] Fix | Delete
}
[625] Fix | Delete
[626] Fix | Delete
/**
[627] Fix | Delete
* Get group hints.
[628] Fix | Delete
*
[629] Fix | Delete
* @param Advanced_Ads_Group $group The group object.
[630] Fix | Delete
*
[631] Fix | Delete
* @return string[] Group hints (escaped strings).
[632] Fix | Delete
*/
[633] Fix | Delete
public static function get_hints( Advanced_Ads_Group $group ) {
[634] Fix | Delete
$hints = [];
[635] Fix | Delete
[636] Fix | Delete
if (
[637] Fix | Delete
! Advanced_Ads_Checks::cache()
[638] Fix | Delete
|| count( $group->get_all_ads() ) < 2
[639] Fix | Delete
) {
[640] Fix | Delete
return $hints;
[641] Fix | Delete
}
[642] Fix | Delete
[643] Fix | Delete
if ( ! class_exists( 'Advanced_Ads_Pro' ) ) {
[644] Fix | Delete
$installed_plugins = get_plugins();
[645] Fix | Delete
[646] Fix | Delete
if ( isset( $installed_plugins['advanced-ads-pro/advanced-ads-pro.php'] ) ) {
[647] Fix | Delete
$link = wp_nonce_url( 'plugins.php?action=activate&amp;plugin=advanced-ads-pro/advanced-ads-pro.php', 'activate-plugin_advanced-ads-pro/advanced-ads-pro.php' );
[648] Fix | Delete
$link_title = __( 'Activate now', 'advanced-ads' );
[649] Fix | Delete
} else {
[650] Fix | Delete
$link = 'https://wpadvancedads.com/add-ons/advanced-ads-pro/?utm_source=advanced-ads&utm_medium=link&utm_campaign=groups-CB';
[651] Fix | Delete
$link_title = __( 'Get this add-on', 'advanced-ads' );
[652] Fix | Delete
}
[653] Fix | Delete
[654] Fix | Delete
$hints[] = sprintf(
[655] Fix | Delete
wp_kses(
[656] Fix | Delete
// translators: %1$s is an URL, %2$s is a URL text
[657] Fix | Delete
__( 'It seems that a caching plugin is activated. Your ads might not rotate properly. The cache busting in Advanced Ads Pro will solve that. <a href="%1$s" target="_blank">%2$s.</a>', 'advanced-ads' ),
[658] Fix | Delete
[
[659] Fix | Delete
'a' => [
[660] Fix | Delete
'href' => [],
[661] Fix | Delete
'target' => [],
[662] Fix | Delete
],
[663] Fix | Delete
]
[664] Fix | Delete
),
[665] Fix | Delete
$link,
[666] Fix | Delete
$link_title
[667] Fix | Delete
);
[668] Fix | Delete
}
[669] Fix | Delete
[670] Fix | Delete
/**
[671] Fix | Delete
* Allows to add new hints.
[672] Fix | Delete
*
[673] Fix | Delete
* @param string[] $hints Existing hints (escaped strings).
[674] Fix | Delete
* @param Advanced_Ads_Group $group The group object.
[675] Fix | Delete
*/
[676] Fix | Delete
return apply_filters( 'advanced-ads-group-hints', $hints, $group );
[677] Fix | Delete
}
[678] Fix | Delete
[679] Fix | Delete
[680] Fix | Delete
}
[681] Fix | Delete
[682] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function