Plugin Directory

Changeset 2266393


Ignore:
Timestamp:
03/24/2020 07:53:29 AM (6 years ago)
Author:
creativemotion
Message:
  • Fixed delete empty account
  • Compatible with PHP 7.4
  • Other fixes
Location:
instagram-slider-widget/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • instagram-slider-widget/trunk/admin/assets/js/jr-insta-admin.js

    r2253396 r2266393  
    261261                _ajax_nonce: add_account_nonce.nonce
    262262            }).done( function( html ) {
     263                console.log(html);
    263264                window.location.reload();
    264265            });
  • instagram-slider-widget/trunk/admin/views/instagram.php

    r2253444 r2266393  
    8080                                    <td>
    8181                                        <a href="#"
    82                                            data-item_id="<?php echo esc_attr( $profile_info['id'] ); ?>"
     82                                           data-item_id="<?php echo !empty($profile_info['id']) ? $profile_info['id'] : 0; ?>"
    8383                                           data-is_business="0"
    8484                                           class="btn btn-danger wis-delete-account">
     
    8686                                        </a>
    8787                                        <span class="spinner"
    88                                               id="wis-delete-spinner-<?php echo esc_attr( $profile_info['id'] ); ?>"></span>
     88                                              id="wis-delete-spinner-<?php echo !empty($profile_info['id']) ? $profile_info['id'] : 0; ?>"></span>
    8989                                        <?php
    9090                                        if(isset($_GET['access_token']) && $_GET['access_token'] === $profile_info['token'])
     
    142142                                    <td>
    143143                                        <a href="#"
    144                                            data-item_id="<?php echo esc_attr( $profile_info['id'] ); ?>"
     144                                           data-item_id="<?php echo !empty($profile_info['id']) ? $profile_info['id'] : 0; ?>"
    145145                                           data-is_business="1"
    146146                                           class="btn btn-danger wis-delete-account">
  • instagram-slider-widget/trunk/includes/class-wis_instagram_slider.php

    r2255459 r2266393  
    231231        $options_linkto = $this->options_linkto;
    232232
    233         $defaults = array(
     233        if( count($accounts)) $s_for = 'account';
     234        else if( count($accounts_business) ) $s_for = 'account_business';
     235        else $s_for =  'username';
     236        $defaults = array(
    234237            'title'            => __('Social Slider', 'instagram-slider-widget'),
    235             'search_for'       => count($accounts) ? 'account' : count($accounts_business) ? 'account_business' : 'username',
     238            'search_for'       => $s_for,
    236239            'account'          => '',
    237240            'account_business' => '',
     
    767770        $output .= __( 'No images found! <br> Try some other hashtag or username', 'instagram-slider-widget' );
    768771
    769         if ( ( $search == 'user' && $attachment ) ) {
     772        if ( ( $search == 'user' && $attachment && false ) ) {
    770773
    771774            if ( !wp_next_scheduled( 'jr_insta_cron', array(  $search_for['username'], $refresh_hour, $images_number ) ) ) {
     
    928931            } // конец песочницы
    929932            else {
    930                 if($search !== 'hashtag') $account = $accounts[$images_data[0]['username']];
     933                if($search !== 'hashtag' && $search !== 'user') $account = $accounts[$images_data[0]['username']];
    931934            }
    932935
     
    12431246     * Stores the fetched data from instagram in WordPress DB using transients
    12441247     *
    1245      * @param string $search_for  Array of widget settings
     1248     * @param array $search_for  Array of widget settings
    12461249     * @param string $cache_hours Cache hours for transient
    12471250     * @param string $nr_images   Nr of images to fetch from instagram
     
    14721475                                $result = $result['node'];
    14731476                                if ( in_array( $result['owner']['id'], $blocked_users_array ) ) {
    1474                                     //$nr_images++;
     1477                                    $nr_images++;
    14751478                                    continue;
    14761479                                }
     
    14941497
    14951498                        if( $this->is_blocked_by_word($blocked_words, $image_data['caption']) ) {
    1496                             continue;
     1499                            $nr_images++;
     1500                            continue;
    14971501                        }
    14981502
     
    19591963
    19601964                if ( !WIS_Plugin::app()->is_premium() && $this->count_accounts() >= 1) {
    1961                     wp_die( '' );
     1965                    wp_die( 'No premium' );
    19621966                }
    19631967
     
    19651969                WIS_Plugin::app()->updateOption( 'account_profiles_new', $user_profile );
    19661970
    1967                 wp_die( '' );
     1971                wp_die( 'Ok' );
    19681972            }
    19691973        }
     
    19881992     */
    19891993    public function delete_account() {
    1990         if ( isset( $_POST['item_id'] ) && ! empty( $_POST['item_id'] ) && isset( $_POST['is_business'] ) ) {
     1994        if ( isset( $_POST['item_id'] ) && isset( $_POST['is_business'] ) ) {
    19911995            if ( ! current_user_can( 'manage_options' ) ) {
    19921996                wp_die( - 1 );
     
    20002004                $accounts = WIS_Plugin::app()->getPopulateOption( $option_name );
    20012005                $accounts_new = array();
    2002                 foreach($accounts as $name => $acc) { if($acc['id'] !== $_POST['item_id']) $accounts_new[$name] = $acc; }
     2006                foreach($accounts as $name => $acc) {
     2007                    $id = isset($acc['id']) ? $acc['id'] : 0;
     2008                    if( $id !== (int)$_POST['item_id'] && !empty($name) )
     2009                        $accounts_new[$name] = $acc;
     2010                }
    20032011                WIS_Plugin::app()->updatePopulateOption( $option_name, $accounts_new);
    20042012
     
    23862394    {
    23872395        if(empty($words) || empty($text)) return false;
    2388         $words = explode( ',', $words);
    2389         foreach ( $words as $word ) {
    2390             $pos = strpos( $text, trim($word) );
     2396        $words_array = explode( ',', $words);
     2397        foreach ( $words_array as $word ) {
     2398            $pos = stripos( $text, trim($word) );
    23912399            if($pos !== false) return true;
    23922400        }
  • instagram-slider-widget/trunk/instaram_slider.php

    r2255459 r2266393  
    33Plugin Name: Social Slider Widget
    44Plugin URI: https://cm-wp.com/instagram-slider-widget
    5 Version: 1.7.4
     5Version: 1.7.5
    66Description: Social Slider Widget is a responsive slider widget that shows 12 latest images from a public Instagram user and up to 18 images from a hashtag.
    77Author: creativemotion
  • instagram-slider-widget/trunk/readme.txt

    r2255459 r2266393  
    104104
    105105== Changelog ==
     106= 1.7.5 =
     107* Fixed delete empty account
     108* Compatible with PHP 7.4
     109* Other fixes
     110
    106111= 1.7.4 =
    107112* Fixed "50 years ago" in Slider Normal and Slider Overlay templates
Note: See TracChangeset for help on using the changeset viewer.