Plugin Directory

Changeset 854508


Ignore:
Timestamp:
02/10/2014 02:34:54 AM (12 years ago)
Author:
pyro3x
Message:

bugfix

Location:
wpinstagram-images-widget/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wpinstagram-images-widget/trunk/README.txt

    r848017 r854508  
    33Requires at least: 3.5
    44Tested up to: 3.6 beta 3
    5 Stable tag: 1.2.5
     5Stable tag: 1.2.6
    66
    77Instagram Images Widget get your most recent activity at Instagram and display them in a Widget.
     
    6161== Changelog ==
    6262
     63v.1.2.6 - Bugfix
     64
    6365v.1.2.5 - Bugfix
    6466
  • wpinstagram-images-widget/trunk/class/InstagramCrawler.php

    r848017 r854508  
    88
    99    public static function get( $username ){
     10
     11        $username = preg_replace('/[@\s]/','',$username);
    1012
    1113        if( empty($username) ){
     
    5153                if(!is_null($script)) break;
    5254
    53                 if( preg_match("#(window\.(_jscalls|_sharedData))#i",$item->innertext) ){
     55           
     56                if( preg_match("/(window\.(_jscalls|_sharedData))/i",$item->innertext) ){
    5457                    $script = $item->innertext;
    5558                    break;
     
    6164        if( !is_null($script) ){
    6265
    63             preg_match_all("#(\"userMedia\"\:)(\[)(.*?)(\]\,\"prerelease\")#isU",$script,$matches);
     66
     67            preg_match_all('/(window\._(sharedData|jscall)[\s=]+[^{\"](.*?\})(\;))/isU',$script,$matches);
    6468
    6569            $data  = isset($matches[3][0]) ? $matches[3][0] : null;
     
    6771            if( !is_null($data) ){
    6872
    69                 $results_json = "[".$data."]";
    70                 $results      = json_decode($results_json,true);
     73                $results  = json_decode($data,true);
    7174
    7275                if(json_last_error() !== JSON_ERROR_NONE){
     
    7477                }
    7578
    76                 if(is_array($results)){
    77                     foreach( $results as $current=>$result ) {
     79                if(!isset($results['entry_data']['UserProfile'][0])){
     80                    return;
     81                }
     82
     83                $userProfile = $results['entry_data']['UserProfile'][0];
     84
     85                if(!isset($userProfile['userMedia'])){
     86                    return;
     87                }
     88
     89                $userMedia = $userProfile['userMedia'];
     90
     91
     92                if(isset($userMedia) && is_array($userMedia)){
     93                    foreach( $userMedia as $current=>$result ) {
    7894
    7995                        if($current > 5) break;
  • wpinstagram-images-widget/trunk/wpinstagram-images-widget.php

    r848017 r854508  
    44 * Plugin URI: http://eduardostuart.com.br/
    55 * Description: Instagram Images Widget get your most recent activity at Instagram and display them in a Widget.
    6  * Version: 1.2.5
     6 * Version: 1.2.6
    77 * Author: Eduardo Stuart
    88 * Author URI: http://eduardostuart.com.br
Note: See TracChangeset for help on using the changeset viewer.