Changeset 2193464
- Timestamp:
- 11/15/2019 07:35:54 AM (6 years ago)
- Location:
- instagram-slider-widget/trunk
- Files:
-
- 7 edited
-
admin/assets/css/jr-insta-admin.css (modified) (1 diff)
-
admin/pages/settings.php (modified) (2 diffs)
-
admin/views/tab-license.php (modified) (1 diff)
-
admin/views/tab-settings.php (modified) (3 diffs)
-
includes/class-wis_instagram_slider.php (modified) (7 diffs)
-
instaram_slider.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
instagram-slider-widget/trunk/admin/assets/css/jr-insta-admin.css
r2188238 r2193464 85 85 box-shadow: inset 0 0 0 rgba(0, 0, 0, 0.00) !important; 86 86 } 87 .wis-help-text 88 { 89 font-size: 16px; 90 margin: 10px 0px 0px 10px; 91 } 92 .wis-help-text p 93 { 94 font-size: 14px; 95 } 96 87 97 i.wis-shortcode-icon 88 98 { -
instagram-slider-widget/trunk/admin/pages/settings.php
r2188238 r2193464 134 134 } 135 135 136 /**137 * Returns options for the Basic Settings screen.138 *139 * @since 1.0.0140 * @return array141 */142 public function getOptions() {143 144 $options = [];145 146 $options[] = [147 'type' => 'html',148 'html' => '<h3 style="margin-left:0">'.__('General','instagram-slider-widget').'</h3>'149 ];150 151 $options[] = [152 'type' => 'separator'153 ];154 155 $options[] = [156 'type' => 'textbox',157 'name' => 'insta_username',158 'title' => __( 'Instagram account', 'instagram-slider-widget' ),159 'default' => '',160 'hint' => __( 'Username of your Instagram account', 'instagram-slider-widget' )161 ];162 163 $options[] = [164 'type' => 'textbox',165 'name' => 'insta_password',166 'title' => __( 'Instagram password', 'instagram-slider-widget' ),167 'default' => '',168 'hint' => __( 'Password of your Instagram account', 'instagram-slider-widget' )169 ];170 //JS for set password type of textbox171 $options[] = [172 'type' => 'html',173 'html' => "<script>document.getElementById('{$this->plugin->getPrefix()}insta_password').setAttribute('type', 'password')</script>"174 ];175 176 return $options;177 }178 179 136 public function indexAction() { 180 137 … … 201 158 </script> 202 159 <?php 203 // creating a form204 global $form;205 $form = new Wbcr_FactoryForms420_Form( [206 'scope' => substr( $this->plugin->getPrefix(), 0, - 1 ),207 'name' => 'setting'208 ], $this->plugin );209 210 $form->setProvider( new Wbcr_FactoryForms420_OptionsValueProvider( $this->plugin ) );211 212 $form->add( $this->getOptions() );213 214 $wis_saved = WIS_Plugin::app()->request->post( $this->plugin->getPrefix() . 'saved', '' );215 if ( ! empty( $wis_saved ) ) {216 $wis_nonce = WIS_Plugin::app()->request->post( $this->plugin->getPrefix() . 'nonce', '' );217 if ( ! wp_verify_nonce( $wis_nonce, $this->plugin->getPrefix() . 'settings_form' ) ) {218 wp_die( 'Permission error. You can not edit this page.' );219 }220 $form->save();221 222 do_action( 'wis/settings/after_form_save' );223 }224 160 parent::indexAction(); 225 161 } -
instagram-slider-widget/trunk/admin/views/tab-license.php
r2188238 r2193464 20 20 class="purchase-premium" target="_blank" rel="noopener"> 21 21 <span class="btn btn-gold btn-inner-wrap"> 22 <?php printf( __( 'Upgrade to Premium for $%s', 'instagram-slider-widget' ), $this->premium->get_price() ) ?>22 <?php printf( __( 'Upgrade to Premium', 'instagram-slider-widget' ), $this->premium->get_price() ) ?> 23 23 </span> 24 24 </a> -
instagram-slider-widget/trunk/admin/views/tab-settings.php
r2188238 r2193464 6 6 "redirect_uri" => "http://instagram.cm-wp.com/?state=" . admin_url( 'admin.php?page=settings-' . WIS_Plugin::app()->getPluginName() ), 7 7 "response_type" => "token", 8 "scope" => "basic", 8 9 //"hl" => "en" 9 10 ]; 10 $autorize_url = "https:// api.instagram.com/oauth/authorize/?" . http_build_query( $args );11 $autorize_url = "https://instagram.com/oauth/authorize/?" . http_build_query( $args ); 11 12 12 13 ?> … … 17 18 <div class="col-md-9"> 18 19 <div class="row"> 19 <div class="col-md-12 ">20 <div class="col-md-12 wis-help-text"> 20 21 <p><?php 21 22 echo __( 'Without authorization Instagram limits the number of requests, and after exceeding the limit asks to log in, so an error is displayed that no images were found.', 'instagram-slider-widget' ); ?> … … 38 39 <span style="float: none; margin-top: 0;" class="spinner" id="wis-spinner"> </span> 39 40 </div> 41 <div class="wis-help-text"><?php echo sprintf( __( "After adding an account, go to the <a href='%s'>widget settings</a> and change the \"Search Instagram for\" setting to Account", 'instagram-slider-widget' ), admin_url('widgets.php')) ?></div> 40 42 <?php 41 43 if ( count( $accounts ) ) : ?> -
instagram-slider-widget/trunk/includes/class-wis_instagram_slider.php
r2189602 r2193464 107 107 108 108 wp_enqueue_style( WIS_Plugin::app()->getPrefix() . 'instag-slider', WIS_PLUGIN_URL.'/assets/css/instag-slider.css', array(), WIS_Plugin::app()->getPluginVersion() ); 109 wp_enqueue_script( WIS_Plugin::app()->getPrefix() . 'jquery-pllexi-slider', WIS_PLUGIN_URL.'/assets/js/jquery.flexslider-min.js', array( 'jquery' ), WIS_Plugin::app()->getPluginVersion(), true );109 wp_enqueue_script( WIS_Plugin::app()->getPrefix() . 'jquery-pllexi-slider', WIS_PLUGIN_URL.'/assets/js/jquery.flexslider-min.js', array( 'jquery' ), WIS_Plugin::app()->getPluginVersion(), false ); 110 110 wp_enqueue_style( WIS_Plugin::app()->getPrefix() . 'wis-header', WIS_PLUGIN_URL.'/assets/css/wis-header.css', array(), WIS_Plugin::app()->getPluginVersion() ); 111 111 } … … 200 200 201 201 $accounts = WIS_Plugin::app()->getOption( 'account_profiles'); 202 if(!is_array($accounts)) $accounts = array(); 202 203 $sliders = $this->sliders; 203 204 … … 732 733 $instagram_images = new WP_Query( $query_args ); 733 734 734 if ( $instagram_images->have_posts() ) { 735 //if ( $instagram_images->have_posts() ) { 736 if ( false ) { 735 737 736 738 $output = $slider_script . $images_div . $images_ul; … … 1073 1075 } 1074 1076 1077 /** 1078 * Get data from instagram by username 1079 * @param string $username 1080 * @return array 1081 */ 1082 private function get_data_by_username( $username ) { 1083 1084 $url = str_replace( '{username}', urlencode( trim( $username ) ), self::USERNAME_URL ); 1085 $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) ); 1086 1087 if(strstr( $response['body'], '-cx-PRIVATE-Page__main' )) { 1088 return ['error' => __( 'Account not found or for this account there are restrictions on Instagram by age', 'instagram-slider-widget' )]; 1089 } 1090 1091 $json = str_replace( 'window._sharedData = ', '', strstr( $response['body'], 'window._sharedData = ' ) ); 1092 1093 // Compatibility for version of php where strstr() doesnt accept third parameter 1094 if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { 1095 $json = strstr( $json, '</script>', true ); 1096 } else { 1097 $json = substr( $json, 0, strpos( $json, '</script>' ) ); 1098 } 1099 $json = rtrim( $json, ';' ); 1100 1101 // Function json_last_error() is not available before PHP * 5.3.0 version 1102 if ( function_exists( 'json_last_error' ) ) { 1103 1104 ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE; 1105 1106 } else { 1107 $results = json_decode( $json, true ); 1108 } 1109 1110 return $results; 1111 } 1112 1075 1113 /** 1076 1114 * Stores the fetched data from instagram in WordPress DB using transients … … 1086 1124 1087 1125 //$nr_images = $nr_images <= 12 ? $nr_images : 12; 1088 $blocked_users = isset( $search_for['blocked_users'] ) && !empty( $search_for['blocked_users'] ) ? $search_for['blocked_users']: false;1126 $blocked_users = isset( $search_for['blocked_users'] ) && !empty( $search_for['blocked_users'] ) ? str_replace( '@', '', $search_for['blocked_users'] ) : false; 1089 1127 if ( isset( $search_for['account'] ) && !empty( $search_for['account'] ) ) { 1090 1128 $search = 'account'; … … 1125 1163 if ( 'user' == $search ) { 1126 1164 1127 $url = str_replace( '{username}', urlencode( trim( $search_string ) ), self::USERNAME_URL ); 1128 $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) ); 1129 1130 if(strstr( $response['body'], '-cx-PRIVATE-Page__main' )) { 1131 return ['error' => __( 'Account not found or for this account there are restrictions on Instagram by age', 'instagram-slider-widget' )]; 1132 } 1133 1134 $json = str_replace( 'window._sharedData = ', '', strstr( $response['body'], 'window._sharedData = ' ) ); 1135 1136 // Compatibility for version of php where strstr() doesnt accept third parameter 1137 if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { 1138 $json = strstr( $json, '</script>', true ); 1139 } else { 1140 $json = substr( $json, 0, strpos( $json, '</script>' ) ); 1141 } 1142 $json = rtrim( $json, ';' ); 1143 1144 // Function json_last_error() is not available before PHP * 5.3.0 version 1145 if ( function_exists( 'json_last_error' ) ) { 1146 1147 ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE; 1148 1149 1150 } else { 1151 $results = json_decode( $json, true ); 1152 } 1165 $results = $this->get_data_by_username($search_string); 1166 if(isset($results['error'])) return $results['error']; 1153 1167 1154 1168 WIS_Plugin::app()->updateOption('profiles_data_by_username', $results); … … 1587 1601 } 1588 1602 1589 $url = str_replace( '{username}', urlencode( trim( $user ) ), self::USERNAME_URL ); 1590 $response = wp_remote_get( $url, array( 'sslverify' => false, 'timeout' => 60 ) ); 1591 1592 if ( is_wp_error( $response ) ) { 1593 1594 return $response->get_error_message(); 1595 } 1596 1597 if ( $response['response']['code'] == 200 ) { 1598 1599 $results = json_decode( $response['body'], true ); 1600 1601 if ( $results && is_array( $results ) ) { 1602 1603 $user_id = isset( $results['user']['id'] ) ? $results['user']['id'] : false; 1604 1605 if ( $user_id ) { 1606 1607 $user_ids[$user] = $user_id; 1608 1609 set_transient( 'jr_insta_user_ids', $user_ids ); 1610 } 1611 } 1612 } 1603 $results = $this->get_data_by_username($user); 1604 if ( $results && is_array( $results ) ) { 1605 1606 $results = $results['entry_data']['ProfilePage']['0']['graphql']['user']; 1607 $user_id = isset( $results['id'] ) ? $results['id'] : false; 1608 1609 if ( $user_id ) { 1610 1611 $user_ids[$user] = $user_id; 1612 1613 set_transient( 'jr_insta_user_ids', $user_ids ); 1614 } 1615 } 1613 1616 } 1614 1617 } -
instagram-slider-widget/trunk/instaram_slider.php
r2189602 r2193464 3 3 Plugin Name: Social Slider Widget 4 4 Plugin URI: https://cm-wp.com/instagram-slider-widget 5 Version: 1.6. 25 Version: 1.6.3 6 6 Description: 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. 7 7 Author: creativemotion -
instagram-slider-widget/trunk/readme.txt
r2189602 r2193464 86 86 87 87 == Changelog == 88 = 1.6.3 = 89 * Add a notification when authorizing an Instagram account 90 88 91 = 1.6.2 = 89 92 * Bug fix
Note: See TracChangeset
for help on using the changeset viewer.