Plugin Directory

Changeset 1608738


Ignore:
Timestamp:
03/06/2017 02:19:33 PM (9 years ago)
Author:
plista
Message:

Delete plista::get_first_plista_image, getimagesize can block server

Location:
plista/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plista/trunk/plista_integration.php

    r1600786 r1608738  
    44    Plugin URI: http://www.plista.com
    55    Description: Plugin for displaying plista RecommendationAds
    6     Version: 1.5.7
     6    Version: 1.5.8
    77    Author: wordpress@plista.com
    88    Author URI: http://www.plista.com
     
    1111class plista {
    1212
    13     const VERSION = '1.5.7';
     13    const VERSION = '1.5.8';
    1414
    1515    /**
     
    8989    public static function plista_admin_actions() {
    9090        if( current_user_can('level_10')) {
    91             wp_enqueue_script( 'plista-admin', plugins_url('/js/plista-admin.js', __FILE__), array(), '1.5.7' );
    92             wp_enqueue_style( 'plista-admin', plugins_url('/css/plista-admin.css', __FILE__), array(), '1.5.7' );
     91            wp_enqueue_script( 'plista-admin', plugins_url('/js/plista-admin.js', __FILE__), array(), '1.5.8' );
     92            wp_enqueue_style( 'plista-admin', plugins_url('/css/plista-admin.css', __FILE__), array(), '1.5.8' );
    9393            add_options_page('plista', 'plista', 1, 'plista', array(__CLASS__, 'plista_admin'));
    9494        }
     
    112112        return $youtube_img;
    113113    }
    114 
    115     /**
    116      * extract first img from current post
    117      *
    118      * @return string
    119      */
    120     public static function get_first_plista_image() {
    121         global $post, $posts;
    122         $first_img = '';
    123         ob_start();
    124         ob_end_clean();
    125         $pattern = "/src=[\"']?([^\"']?.*(png|jpg|gif|jpeg))[\"']?/i";
    126         $output = preg_match_all($pattern, $post->post_content, $matches);
    127         $first_img = '';
    128         if (!empty($matches[1][0])) {
    129             $first_img = $matches[1][0];
    130         }
    131         // always remove title and alt attributes containing something like title="bild.jpg"
    132         $first_img = preg_replace(array('/[\"]+/', '/ (alt|title)=?.*(png|jpg|gif|jpeg)/'), array('', ''), $first_img);
    133 
    134         // add an extra check for img size cause sometimes they use ad pixels in the article
    135         // ad pixels are normaly only 1px x 1px but too be sure set it to 20px x 20px
    136         if ($first_img) {
    137             list($width, $height, $type, $attr) = @getimagesize($first_img);
    138 
    139             if (!is_null($height) && $height >= '20' && $height >= '20') {
    140                 return $first_img;
    141             } else {
    142                 return $first_img;
    143             }
    144         }
    145         return '';
    146     }
    147 
    148 
    149114
    150115    /**
     
    463428                $imgsrc = $thumbnail[0];
    464429            }
    465             if (!$imgsrc || is_null($imgsrc)) {
    466                 $imgsrc = self::get_first_plista_image();
    467                 if (!$imgsrc && !empty($isyoutube)) {
    468                     $imgsrc = self::get_youtube_img();
    469                 }
     430            if (!$imgsrc && !empty($isyoutube)) {
     431                $imgsrc = self::get_youtube_img();
    470432            }
    471433        }
  • plista/trunk/readme.txt

    r1600786 r1608738  
    66Requires at least: 3.0.0
    77Tested up to: 4.7.1
    8 Stable tag: 1.5.7
     8Stable tag: 1.5.8
    99
    1010The plista Widget adds plista RecommendationAds to your Wordpress blog posts.
     
    6565== Upgrade Notice ==
    6666
    67 Please upgrade to Version 1.5.7
     67Please upgrade to Version 1.5.8
    6868
    6969== Screenshots ==
     
    153153
    1541541.5.7 @ 21-02-2017
    155      * Add input for plista origin in the plugin settings
     155    * Add input for plista origin in the plugin settings
     156
     1571.5.8 @ 06-03-2017
     158    * Add input for plista origin in the plugin settings
Note: See TracChangeset for help on using the changeset viewer.