Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter fredriksundstrom

    (@fredriksundstrom)

    P.S. I’m using the javascript way of showing ads, if it makes any difference. And PHP 7.

    Anyway… I don’t know if it’s the prettiest of solutions in this case, but a simple check might get rid of it, and still leave working code. Like this:

    public function addExcerptAds( $excerpt ) {
    			$options = self::getSettings();
    			$bpAd = '';
    			$bpTI = explode('_', $options['bpAdsId']);
    
    			if (!isset($bpTI[1])) return $excerpt;
    
    			$bpId = (int)$bpTI[1];
    			$bpType = (int)$bpTI[0];
    			if(!$this->isSingle) {
    				if(empty($this->clause)) $this->clause = self::buildWhereClause();
    
    				if(!empty($options['beforePost']) && !empty($options['bpExcerpt']) && !empty($options['bpAdsId'])) {
    					$bpAd = self::buildAdObject( $bpType, $bpId, null, $options['bpUseCodes'], $this->clause);
    				}
    
    				return $bpAd.$excerpt;
    			}
    			else return $excerpt;
    		}
    Thread Starter fredriksundstrom

    (@fredriksundstrom)

    Or, depending on the intended functionality, to catch it even sooner, maybe rearrange the code a bit and get the check higher up:

    public function addExcerptAds( $excerpt ) {
    			$options = self::getSettings();
    			$bpTI = explode('_', $options['bpAdsId']);
    
    			if (count($bpTI) == 1) return $excerpt;
    
    			$bpAd = '';
    			$bpId = (int)$bpTI[1];
    			$bpType = (int)$bpTI[0];
    			if(!$this->isSingle) {
    				if(empty($this->clause)) $this->clause = self::buildWhereClause();
    
    				if(!empty($options['beforePost']) && !empty($options['bpExcerpt']) && !empty($options['bpAdsId'])) {
    					$bpAd = self::buildAdObject( $bpType, $bpId, null, $options['bpUseCodes'], $this->clause);
    				}
    
    				return $bpAd.$excerpt;
    			}
    			else return $excerpt;
    		}

    Only in the case that any other real situation would have the array count higher than 1.

    Plugin Author minimus

    (@minimus)

    Thanks! Resolved…

    Thread Starter fredriksundstrom

    (@fredriksundstrom)

    I’ve installed the new version and can also conclude that it is indeed solved. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Excerpt warning upon new install’ is closed to new replies.