Version Description
Fixed: Security issues
Download this release
Release Info
Developer | 10web |
Plugin | WD Instagram Feed – Instagram Gallery |
Version | 1.3.19 |
Comparing to | |
See all releases |
Code changes from version 1.3.17 to 1.3.19
- admin-functions.php +1 -17
- admin/controllers/WDIControllerFeeds_wdi.php +165 -229
- admin/controllers/WDIControllerLicensing_wdi.php +4 -30
- admin/controllers/WDIControllerSettings_wdi.php +3 -7
- admin/controllers/WDIControllerThemes_wdi.php +15 -12
- admin/controllers/WDIControllerUninstall_wdi.php +14 -14
- admin/models/WDIModelFeeds_wdi.php +102 -121
- admin/models/WDIModelSettings_wdi.php +7 -10
- admin/models/WDIModelThemes_wdi.php +15 -14
- admin/views/WDIViewFeeds_wdi.php +37 -56
- admin/views/WDIViewSettings_wdi.php +7 -18
- admin/views/WDIViewThemes_wdi.php +4 -30
- changelog.txt +0 -319
- framework/WDILibrary.php +49 -45
- framework/WDI_admin_view.php +2 -12
- frontend/controllers/WDIControllerGalleryBox.php +3 -117
- frontend/controllers/WDIControllerThumbnails_view.php +12 -29
- frontend/models/WDIModelGalleryBox.php +1 -1
- frontend/shortcode.php +10 -32
- frontend/views/WDIViewGalleryBox.php +36 -111
- frontend/views/WDIViewThumbnails_view.php +9 -25
- js/gallerybox/wdi_gallery_box.js +5 -20
- js/gallerybox/wdi_gallery_box.min.js +1 -1
- js/wdi_admin.js +0 -6
- js/wdi_frontend.js +6 -2
- js/wdi_frontend.min.js +1 -1
- readme.txt +9 -1
- wd-instagram-feed.php +21 -72
- wd/includes/deactivate.php +134 -167
- wd/includes/notices.php +14 -8
- wd/includes/subscribe.php +7 -35
- wd/wd.php +114 -151
admin-functions.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Checks if username and access_token exist, if not redirects to settings page
|
4 |
*/
|
5 |
|
6 |
function wdi_check_necessary_params(){
|
7 |
-
|
8 |
global $wdi_options;
|
9 |
$instagram = (!isset($wdi_options['wdi_access_token']) || !isset($wdi_options['wdi_user_name']) || $wdi_options['wdi_access_token']=='' || $wdi_options['wdi_user_name'] =='');
|
10 |
$fb = (empty($wdi_options['fb_token']) && empty($wdi_options['business_account_id']));
|
@@ -16,7 +16,6 @@ function wdi_check_necessary_params(){
|
|
16 |
</script>
|
17 |
<?php
|
18 |
}
|
19 |
-
|
20 |
}
|
21 |
|
22 |
|
@@ -61,14 +60,8 @@ function wdi_check_uninstalled(){
|
|
61 |
*/
|
62 |
|
63 |
function wdi_install(){
|
64 |
-
|
65 |
-
|
66 |
wdi_get_options();
|
67 |
global $wdi_options;
|
68 |
-
|
69 |
-
// if(isset($wdi_options['wdi_plugin_uninstalled']) && $wdi_options['wdi_plugin_uninstalled'] == 'false'){
|
70 |
-
// return;
|
71 |
-
// }
|
72 |
$current_version = WDI_VERSION;
|
73 |
$saved_version = get_option('wdi_version');
|
74 |
if ($saved_version) {
|
@@ -500,7 +493,6 @@ function wdi_configure_section_callback(){
|
|
500 |
|
501 |
?>
|
502 |
<div id="login_with_instagram">
|
503 |
-
|
504 |
<?php if (!isset($options['wdi_access_token']) || $options['wdi_access_token'] == ''){
|
505 |
WDILibrary::add_auth_button();
|
506 |
}
|
@@ -699,29 +691,24 @@ function wdi_set_options_defaults()
|
|
699 |
$db_options = array();
|
700 |
$options = get_option(WDI_OPT);
|
701 |
|
702 |
-
|
703 |
$settings = wdi_get_settings();
|
704 |
foreach ($settings as $setting) {
|
705 |
$settingDefault = isset($setting['default']) ? $setting['default'] : '';
|
706 |
$db_options[$setting['name']] = $settingDefault;
|
707 |
}
|
708 |
|
709 |
-
|
710 |
$options = wp_parse_args($options, $db_options);
|
711 |
if (isset($options['wdi_plugin_uninstalled']) && $options['wdi_plugin_uninstalled'] == 'true') {
|
712 |
$options['wdi_plugin_uninstalled'] = 'false';
|
713 |
}
|
714 |
|
715 |
-
|
716 |
if(empty($options['wdi_authenticated_users_list'])){
|
717 |
$options['wdi_authenticated_users_list'] = '[]';
|
718 |
}
|
719 |
|
720 |
-
|
721 |
add_option(WDI_OPT, $options, '', 'yes');
|
722 |
update_option(WDI_OPT, $options, 'yes');
|
723 |
wdi_get_options();
|
724 |
-
|
725 |
}
|
726 |
|
727 |
function wdi_get_options()
|
@@ -731,7 +718,6 @@ function wdi_get_options()
|
|
731 |
return apply_filters('wdi_get_options', $wdi_options);
|
732 |
}
|
733 |
|
734 |
-
|
735 |
function wdi_install_default_themes()
|
736 |
{
|
737 |
global $wdi_options;
|
@@ -749,10 +735,8 @@ function wdi_install_default_themes()
|
|
749 |
$wpdb->insert($table_name, $theme);
|
750 |
}
|
751 |
}
|
752 |
-
|
753 |
}
|
754 |
|
755 |
-
|
756 |
function wdi_get_create_feeds_cap()
|
757 |
{
|
758 |
global $wdi_options;
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Checks if username and access_token exist, if not redirects to settings page
|
5 |
*/
|
6 |
|
7 |
function wdi_check_necessary_params(){
|
|
|
8 |
global $wdi_options;
|
9 |
$instagram = (!isset($wdi_options['wdi_access_token']) || !isset($wdi_options['wdi_user_name']) || $wdi_options['wdi_access_token']=='' || $wdi_options['wdi_user_name'] =='');
|
10 |
$fb = (empty($wdi_options['fb_token']) && empty($wdi_options['business_account_id']));
|
16 |
</script>
|
17 |
<?php
|
18 |
}
|
|
|
19 |
}
|
20 |
|
21 |
|
60 |
*/
|
61 |
|
62 |
function wdi_install(){
|
|
|
|
|
63 |
wdi_get_options();
|
64 |
global $wdi_options;
|
|
|
|
|
|
|
|
|
65 |
$current_version = WDI_VERSION;
|
66 |
$saved_version = get_option('wdi_version');
|
67 |
if ($saved_version) {
|
493 |
|
494 |
?>
|
495 |
<div id="login_with_instagram">
|
|
|
496 |
<?php if (!isset($options['wdi_access_token']) || $options['wdi_access_token'] == ''){
|
497 |
WDILibrary::add_auth_button();
|
498 |
}
|
691 |
$db_options = array();
|
692 |
$options = get_option(WDI_OPT);
|
693 |
|
|
|
694 |
$settings = wdi_get_settings();
|
695 |
foreach ($settings as $setting) {
|
696 |
$settingDefault = isset($setting['default']) ? $setting['default'] : '';
|
697 |
$db_options[$setting['name']] = $settingDefault;
|
698 |
}
|
699 |
|
|
|
700 |
$options = wp_parse_args($options, $db_options);
|
701 |
if (isset($options['wdi_plugin_uninstalled']) && $options['wdi_plugin_uninstalled'] == 'true') {
|
702 |
$options['wdi_plugin_uninstalled'] = 'false';
|
703 |
}
|
704 |
|
|
|
705 |
if(empty($options['wdi_authenticated_users_list'])){
|
706 |
$options['wdi_authenticated_users_list'] = '[]';
|
707 |
}
|
708 |
|
|
|
709 |
add_option(WDI_OPT, $options, '', 'yes');
|
710 |
update_option(WDI_OPT, $options, 'yes');
|
711 |
wdi_get_options();
|
|
|
712 |
}
|
713 |
|
714 |
function wdi_get_options()
|
718 |
return apply_filters('wdi_get_options', $wdi_options);
|
719 |
}
|
720 |
|
|
|
721 |
function wdi_install_default_themes()
|
722 |
{
|
723 |
global $wdi_options;
|
735 |
$wpdb->insert($table_name, $theme);
|
736 |
}
|
737 |
}
|
|
|
738 |
}
|
739 |
|
|
|
740 |
function wdi_get_create_feeds_cap()
|
741 |
{
|
742 |
global $wdi_options;
|
admin/controllers/WDIControllerFeeds_wdi.php
CHANGED
@@ -1,24 +1,12 @@
|
|
1 |
<?php
|
2 |
class WDIControllerFeeds_wdi {
|
3 |
-
|
4 |
-
// Events //
|
5 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
// Constants //
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
// Variables //
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
private $dataFormat;
|
13 |
-
|
14 |
-
// Constructor & Destructor //
|
15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
16 |
public function __construct() {
|
17 |
$this->setDataFormat();
|
18 |
}
|
19 |
-
|
20 |
-
// Public Methods //
|
21 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
22 |
public function execute() {
|
23 |
$task = WDILibrary::get('task');
|
24 |
$id = WDILibrary::get('current_id', 0);
|
@@ -29,27 +17,23 @@ class WDIControllerFeeds_wdi {
|
|
29 |
"edit",
|
30 |
"display"
|
31 |
);
|
32 |
-
$
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
if (method_exists($this, $task)) {
|
37 |
-
if(!in_array($get_task , $get_method_tasks)){
|
38 |
-
check_admin_referer('nonce_wd', 'nonce_wd');
|
39 |
-
}
|
40 |
$this->$task($id);
|
41 |
}
|
42 |
else {
|
43 |
-
|
|
|
44 |
WDILibrary::wdi_spider_redirect(add_query_arg(array(
|
45 |
'page' => WDILibrary::get('page'),
|
46 |
'task' => 'display',
|
47 |
-
'search' => $
|
48 |
), admin_url('admin.php')));
|
49 |
}else{
|
50 |
$this->display();
|
51 |
}
|
52 |
-
|
53 |
}
|
54 |
}
|
55 |
|
@@ -70,13 +54,8 @@ class WDIControllerFeeds_wdi {
|
|
70 |
|
71 |
$wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
|
72 |
return $wpdb->insert_id;
|
73 |
-
//if ($wpdb->insert_id == false) {
|
74 |
-
//$this->message(__('Cannot Write on database. Check database permissions.', "wd-instagram-feed"), 'error');
|
75 |
-
//}
|
76 |
}
|
77 |
-
|
78 |
-
// Private Methods //
|
79 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
80 |
private function setDataFormat(){
|
81 |
$this->dataFormat = array(
|
82 |
'%s',/*feed_name*/
|
@@ -186,16 +165,11 @@ class WDIControllerFeeds_wdi {
|
|
186 |
if($customId != ''){
|
187 |
$id = $customId;
|
188 |
}else{
|
189 |
-
$id = (
|
190 |
}
|
191 |
$view->edit($id);
|
192 |
}
|
193 |
|
194 |
-
// private function save() {
|
195 |
-
// $page = WDILibrary::get('page');
|
196 |
-
// WDILibrary::wdi_spider_redirect(add_query_arg(array('page' => $page, 'task' => 'display', 'message' => 1), admin_url('admin.php')));
|
197 |
-
// }
|
198 |
-
|
199 |
private function apply() {
|
200 |
$this->save_slider_db();
|
201 |
$this->save_slide_db();
|
@@ -206,20 +180,16 @@ class WDIControllerFeeds_wdi {
|
|
206 |
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
207 |
$model = new WDIModelFeeds_wdi();
|
208 |
|
209 |
-
$settings = ($_POST[WDI_FSN]);
|
|
|
210 |
$defaults = $model->wdi_get_feed_defaults();
|
211 |
-
|
212 |
$settings = $this->sanitize_input($settings,$defaults);
|
213 |
$settings = wp_parse_args( $settings, $defaults );
|
214 |
-
|
215 |
$settings = $this->check_settings($settings);
|
216 |
-
|
217 |
|
218 |
global $wpdb;
|
219 |
-
$action =
|
220 |
-
|
221 |
-
|
222 |
-
if($action==''){
|
223 |
$wpdb->insert($wpdb->prefix. WDI_FEED_TABLE, $settings,$this->dataFormat);
|
224 |
if($wpdb->insert_id == false){
|
225 |
$this->message(__('Cannot Write on database. Check database permissions.',"wd-instagram-feed"),'error');
|
@@ -235,23 +205,18 @@ class WDIControllerFeeds_wdi {
|
|
235 |
$this->display();
|
236 |
}
|
237 |
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
private function apply_changes(){
|
242 |
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
|
|
243 |
$model = new WDIModelFeeds_wdi();
|
244 |
-
|
245 |
-
$settings = ($
|
246 |
$defaults = $model->wdi_get_feed_defaults();
|
247 |
-
|
248 |
$settings = $this->sanitize_input($settings,$defaults);
|
249 |
$settings = wp_parse_args( $settings, $defaults );
|
250 |
$settings = $this->check_settings($settings);
|
251 |
-
|
252 |
-
$action
|
253 |
-
|
254 |
-
if($action==''){
|
255 |
$wpdb->insert($wpdb->prefix. WDI_FEED_TABLE, $settings,$this->dataFormat);
|
256 |
if($wpdb->insert_id == false){
|
257 |
$message = 24;
|
@@ -290,36 +255,6 @@ class WDIControllerFeeds_wdi {
|
|
290 |
$this->display();
|
291 |
}
|
292 |
|
293 |
-
private function reset_changes(){
|
294 |
-
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
295 |
-
$model = new WDIModelFeeds_wdi();
|
296 |
-
$defaults = $model->wdi_get_feed_defaults();
|
297 |
-
$defaults = $this->check_settings($defaults);
|
298 |
-
global $wpdb;
|
299 |
-
$action = $_POST['add_or_edit'];
|
300 |
-
|
301 |
-
|
302 |
-
if($action==''){
|
303 |
-
$wpdb->insert($wpdb->prefix. WDI_FEED_TABLE, $defaults,$this->dataFormat);
|
304 |
-
if($wpdb->insert_id == false){
|
305 |
-
$this->message(__('Cannot Write on database. Check database permissions.',"wd-instagram-feed"),'error');
|
306 |
-
$this->display();
|
307 |
-
}else{
|
308 |
-
$this->edit($wpdb->insert_id);
|
309 |
-
}
|
310 |
-
}else{
|
311 |
-
$msg = $wpdb->update($wpdb->prefix. WDI_FEED_TABLE, $defaults, array('id'=>$action), $this->dataFormat,array('%d'));
|
312 |
-
if($msg == false){
|
313 |
-
$this->message(__("You have not made new changes","wd-instagram-feed"),'notice');
|
314 |
-
+ $this->edit();
|
315 |
-
}else{
|
316 |
-
$this->message(__("Feed successfully reseted","wd-instagram-feed"),"updated");
|
317 |
-
$this->edit();
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
}
|
322 |
-
|
323 |
private function duplicate($id) {
|
324 |
$message = 20;
|
325 |
$duplicated = $this->duplicate_tabels($id);
|
@@ -340,7 +275,8 @@ class WDIControllerFeeds_wdi {
|
|
340 |
|
341 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
342 |
foreach ($feed_ids_col as $slider_id) {
|
343 |
-
|
|
|
344 |
if(!$flag){
|
345 |
$flag = true;
|
346 |
}
|
@@ -391,7 +327,9 @@ class WDIControllerFeeds_wdi {
|
|
391 |
$flag = FALSE;
|
392 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
393 |
foreach ($feed_ids_col as $slider_id) {
|
394 |
-
|
|
|
|
|
395 |
$flag = TRUE;
|
396 |
$query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_FEED_TABLE.' WHERE id="%d"', $slider_id);
|
397 |
$wpdb->query($query);
|
@@ -430,14 +368,16 @@ class WDIControllerFeeds_wdi {
|
|
430 |
private function publish_all() {
|
431 |
global $wpdb;
|
432 |
$flag = FALSE;
|
433 |
-
|
434 |
-
|
|
|
435 |
$flag = TRUE;
|
436 |
}
|
437 |
else {
|
438 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
439 |
foreach ($feed_ids_col as $slider_id) {
|
440 |
-
|
|
|
441 |
$flag = TRUE;
|
442 |
$wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array('published' => 1), array('id' => $slider_id));
|
443 |
}
|
@@ -475,14 +415,16 @@ class WDIControllerFeeds_wdi {
|
|
475 |
private function unpublish_all() {
|
476 |
global $wpdb;
|
477 |
$flag = FALSE;
|
478 |
-
|
|
|
479 |
$wpdb->query('UPDATE ' . $wpdb->prefix . WDI_FEED_TABLE.' SET published=0');
|
480 |
$flag = TRUE;
|
481 |
}
|
482 |
else {
|
483 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
484 |
foreach ($feed_ids_col as $slider_id) {
|
485 |
-
|
|
|
486 |
$flag = TRUE;
|
487 |
$wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array('published' => 0), array('id' => $slider_id));
|
488 |
}
|
@@ -502,140 +444,134 @@ class WDIControllerFeeds_wdi {
|
|
502 |
|
503 |
}
|
504 |
|
505 |
-
private function check_settings($settings){
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
}
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
}
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
private function message($text,$type){
|
636 |
-
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
637 |
-
echo WDILibrary::message($text, $type);
|
638 |
-
}
|
639 |
-
|
640 |
}
|
641 |
-
?>
|
1 |
<?php
|
2 |
class WDIControllerFeeds_wdi {
|
3 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
private $dataFormat;
|
5 |
+
|
|
|
|
|
6 |
public function __construct() {
|
7 |
$this->setDataFormat();
|
8 |
}
|
9 |
+
|
|
|
|
|
10 |
public function execute() {
|
11 |
$task = WDILibrary::get('task');
|
12 |
$id = WDILibrary::get('current_id', 0);
|
17 |
"edit",
|
18 |
"display"
|
19 |
);
|
20 |
+
if ( method_exists($this, $task) ) {
|
21 |
+
if( !in_array($task , $get_method_tasks) ) {
|
22 |
+
check_admin_referer('nonce_wd', 'nonce_wd');
|
23 |
+
}
|
|
|
|
|
|
|
|
|
24 |
$this->$task($id);
|
25 |
}
|
26 |
else {
|
27 |
+
$search_value = WDILibrary::get('search_value', '');
|
28 |
+
if( !empty($search_value) ) {
|
29 |
WDILibrary::wdi_spider_redirect(add_query_arg(array(
|
30 |
'page' => WDILibrary::get('page'),
|
31 |
'task' => 'display',
|
32 |
+
'search' => $search_value,
|
33 |
), admin_url('admin.php')));
|
34 |
}else{
|
35 |
$this->display();
|
36 |
}
|
|
|
37 |
}
|
38 |
}
|
39 |
|
54 |
|
55 |
$wpdb->insert($wpdb->prefix . WDI_FEED_TABLE, $settings, $this->dataFormat);
|
56 |
return $wpdb->insert_id;
|
|
|
|
|
|
|
57 |
}
|
58 |
+
|
|
|
|
|
59 |
private function setDataFormat(){
|
60 |
$this->dataFormat = array(
|
61 |
'%s',/*feed_name*/
|
165 |
if($customId != ''){
|
166 |
$id = $customId;
|
167 |
}else{
|
168 |
+
$id = (int) WDILibrary::get('current_id', 0);
|
169 |
}
|
170 |
$view->edit($id);
|
171 |
}
|
172 |
|
|
|
|
|
|
|
|
|
|
|
173 |
private function apply() {
|
174 |
$this->save_slider_db();
|
175 |
$this->save_slide_db();
|
180 |
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
181 |
$model = new WDIModelFeeds_wdi();
|
182 |
|
183 |
+
$settings = isset($_POST[WDI_FSN]) ? (array) $_POST[WDI_FSN]: array();
|
184 |
+
// $settings = array_map( 'esc_attr', $settings );
|
185 |
$defaults = $model->wdi_get_feed_defaults();
|
|
|
186 |
$settings = $this->sanitize_input($settings,$defaults);
|
187 |
$settings = wp_parse_args( $settings, $defaults );
|
|
|
188 |
$settings = $this->check_settings($settings);
|
|
|
189 |
|
190 |
global $wpdb;
|
191 |
+
$action = WDILibrary::get('add_or_edit', '');
|
192 |
+
if( $action=='' ){
|
|
|
|
|
193 |
$wpdb->insert($wpdb->prefix. WDI_FEED_TABLE, $settings,$this->dataFormat);
|
194 |
if($wpdb->insert_id == false){
|
195 |
$this->message(__('Cannot Write on database. Check database permissions.',"wd-instagram-feed"),'error');
|
205 |
$this->display();
|
206 |
}
|
207 |
|
|
|
|
|
|
|
208 |
private function apply_changes(){
|
209 |
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
210 |
+
global $wpdb;
|
211 |
$model = new WDIModelFeeds_wdi();
|
212 |
+
$settings = isset($_POST[WDI_FSN]) ? (array) $_POST[WDI_FSN] : array();
|
213 |
+
// $settings = array_map( 'esc_attr', $settings );
|
214 |
$defaults = $model->wdi_get_feed_defaults();
|
|
|
215 |
$settings = $this->sanitize_input($settings,$defaults);
|
216 |
$settings = wp_parse_args( $settings, $defaults );
|
217 |
$settings = $this->check_settings($settings);
|
218 |
+
$action = WDILibrary::get('add_or_edit', '');
|
219 |
+
if( $action == '' ){
|
|
|
|
|
220 |
$wpdb->insert($wpdb->prefix. WDI_FEED_TABLE, $settings,$this->dataFormat);
|
221 |
if($wpdb->insert_id == false){
|
222 |
$message = 24;
|
255 |
$this->display();
|
256 |
}
|
257 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
private function duplicate($id) {
|
259 |
$message = 20;
|
260 |
$duplicated = $this->duplicate_tabels($id);
|
275 |
|
276 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
277 |
foreach ($feed_ids_col as $slider_id) {
|
278 |
+
$check_id = WDILibrary::get('check_' . $slider_id, '');
|
279 |
+
if ( !empty($check_id) ) {
|
280 |
if(!$flag){
|
281 |
$flag = true;
|
282 |
}
|
327 |
$flag = FALSE;
|
328 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
329 |
foreach ($feed_ids_col as $slider_id) {
|
330 |
+
$check_id = WDILibrary::get('check_' . $slider_id, '');
|
331 |
+
$check_all_items = WDILibrary::get('check_all_items', '');
|
332 |
+
if ( !empty($check_id) || !empty($check_all_items) ) {
|
333 |
$flag = TRUE;
|
334 |
$query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_FEED_TABLE.' WHERE id="%d"', $slider_id);
|
335 |
$wpdb->query($query);
|
368 |
private function publish_all() {
|
369 |
global $wpdb;
|
370 |
$flag = FALSE;
|
371 |
+
$check_all_items = WDILibrary::get('check_all_items', '');
|
372 |
+
if ( isset($check_all_items) ) {
|
373 |
+
$wpdb->query('UPDATE ' . $wpdb->prefix . WDI_FEED_TABLE .' SET published=1');
|
374 |
$flag = TRUE;
|
375 |
}
|
376 |
else {
|
377 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
378 |
foreach ($feed_ids_col as $slider_id) {
|
379 |
+
$check_id = WDILibrary::get('check_' . $slider_id, '');
|
380 |
+
if ( !empty($check_id) ) {
|
381 |
$flag = TRUE;
|
382 |
$wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array('published' => 1), array('id' => $slider_id));
|
383 |
}
|
415 |
private function unpublish_all() {
|
416 |
global $wpdb;
|
417 |
$flag = FALSE;
|
418 |
+
$check_all_items = WDILibrary::get('check_all_items', '');
|
419 |
+
if ( isset($check_all_items) ) {
|
420 |
$wpdb->query('UPDATE ' . $wpdb->prefix . WDI_FEED_TABLE.' SET published=0');
|
421 |
$flag = TRUE;
|
422 |
}
|
423 |
else {
|
424 |
$feed_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_FEED_TABLE);
|
425 |
foreach ($feed_ids_col as $slider_id) {
|
426 |
+
$check_id = WDILibrary::get('check_' . $slider_id, '');
|
427 |
+
if ( !empty($check_id) ) {
|
428 |
$flag = TRUE;
|
429 |
$wpdb->update($wpdb->prefix . WDI_FEED_TABLE, array('published' => 0), array('id' => $slider_id));
|
430 |
}
|
444 |
|
445 |
}
|
446 |
|
447 |
+
private function check_settings($settings){
|
448 |
+
if($settings['feed_users']){
|
449 |
+
$settings['feed_users'] = json_decode($settings['feed_users']);
|
450 |
+
$settings['feed_users'] = json_encode(array($settings['feed_users'][0]));
|
451 |
+
};
|
452 |
+
if(intval($settings['theme_id']) > 1){
|
453 |
+
$settings['theme_id'] = '1';
|
454 |
+
};
|
455 |
+
if($settings['feed_display_view'] === 'infinite_scroll'){
|
456 |
+
$settings['feed_display_view'] = 'load_more_btn';
|
457 |
+
}
|
458 |
+
if($settings['feed_type'] === 'masonry' || $settings['feed_type'] === 'blog_style'){
|
459 |
+
$settings['feed_type'] = 'thumbnails';
|
460 |
+
}
|
461 |
+
if($settings['popup_enable_filmstrip'] == '1'){
|
462 |
+
$settings['popup_enable_filmstrip'] = '0';
|
463 |
+
}
|
464 |
+
if($settings['popup_filmstrip_height'] != '70'){
|
465 |
+
$settings['popup_filmstrip_height'] = '70';
|
466 |
+
}
|
467 |
+
if($settings['popup_enable_comment'] == '1'){
|
468 |
+
$settings['popup_enable_comment'] = '0';
|
469 |
+
}
|
470 |
+
if($settings['popup_enable_share_buttons'] == '1'){
|
471 |
+
$settings['popup_enable_share_buttons'] = '0';
|
472 |
+
}
|
473 |
+
|
474 |
+
if($settings['popup_info_always_show'] == '1'){
|
475 |
+
$settings['popup_info_always_show'] = '0';
|
476 |
+
}
|
477 |
+
|
478 |
+
if($settings['popup_info_full_width'] == '1'){
|
479 |
+
$settings['popup_info_full_width'] = '0';
|
480 |
+
}
|
481 |
+
|
482 |
+
if($settings['popup_enable_info'] == '1'){
|
483 |
+
$settings['popup_enable_info'] = '0';
|
484 |
+
}
|
485 |
+
if($settings['show_likes'] == '1'){
|
486 |
+
$settings['show_likes'] = '0';
|
487 |
+
}
|
488 |
+
|
489 |
+
if($settings['show_description'] == '1'){
|
490 |
+
$settings['show_description'] = '0';
|
491 |
+
}
|
492 |
+
|
493 |
+
if($settings['show_comments'] == '1'){
|
494 |
+
$settings['show_comments'] = '0';
|
495 |
+
}
|
496 |
+
|
497 |
+
if($settings['show_username_on_thumb'] == '1'){
|
498 |
+
$settings['show_username_on_thumb'] = '0';
|
499 |
+
}
|
500 |
+
|
501 |
+
if($settings['conditional_filter_enable'] == '1'){
|
502 |
+
$settings['conditional_filter_enable'] = '0';
|
503 |
+
}
|
504 |
+
if($settings['liked_feed'] == 'liked'){
|
505 |
+
$settings['liked_feed'] = 'userhash';
|
506 |
+
}
|
507 |
+
return $settings;
|
508 |
+
}
|
509 |
+
|
510 |
+
private function sanitize_input($settings,$defaults){
|
511 |
+
require_once WDI_DIR . "/admin/models/WDIModelFeeds_wdi.php";
|
512 |
+
$model = new WDIModelFeeds_wdi();
|
513 |
+
$sanitize_types=$model->get_sanitize_types();
|
514 |
+
$sanitized_output = array();
|
515 |
+
foreach ($settings as $setting_name => $value) {
|
516 |
+
switch($sanitize_types[$setting_name]){
|
517 |
+
case 'string':{
|
518 |
+
$sanitized_val=$this->sanitize_string($value,$defaults[$setting_name]);
|
519 |
+
$sanitized_output[$setting_name] = $sanitized_val;
|
520 |
+
break;
|
521 |
+
}
|
522 |
+
case 'number':{
|
523 |
+
$sanitized_val=$this->sanitize_number($value,$defaults[$setting_name]);
|
524 |
+
$sanitized_output[$setting_name] = $sanitized_val;
|
525 |
+
break;
|
526 |
+
}
|
527 |
+
case 'bool':{
|
528 |
+
$sanitized_val=$this->sanitize_bool($value,$defaults[$setting_name]);
|
529 |
+
$sanitized_output[$setting_name] = $sanitized_val;
|
530 |
+
break;
|
531 |
+
}
|
532 |
+
case 'url':{
|
533 |
+
$sanitized_val=$this->sanitize_url($value,$defaults[$setting_name]);
|
534 |
+
$sanitized_output[$setting_name] = $sanitized_val;
|
535 |
+
break;
|
536 |
+
}
|
537 |
+
}
|
538 |
+
}
|
539 |
+
return $sanitized_output;
|
540 |
+
}
|
541 |
+
|
542 |
+
private function sanitize_bool($value,$default){
|
543 |
+
if($value == 1 || $value == 0){
|
544 |
+
return $value;
|
545 |
+
}
|
546 |
+
else{
|
547 |
+
return $default;
|
548 |
+
}
|
549 |
+
}
|
550 |
+
private function sanitize_string($value,$default){
|
551 |
+
$sanitized_val = strip_tags(stripslashes($value));
|
552 |
+
if($sanitized_val == ''){
|
553 |
+
return $default;
|
554 |
+
}else{
|
555 |
+
return $sanitized_val;
|
556 |
+
}
|
557 |
+
}
|
558 |
+
private function sanitize_number($value,$default){
|
559 |
+
if(is_numeric($value) && $value>0){
|
560 |
+
return $value;
|
561 |
+
}else{
|
562 |
+
return $default;
|
563 |
+
}
|
564 |
+
}
|
565 |
+
private function sanitize_url($value,$default){
|
566 |
+
if (function_exists('filter_var') && !filter_var($value, FILTER_VALIDATE_URL) === false) {
|
567 |
+
return $value;
|
568 |
+
} else {
|
569 |
+
return $default;
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
private function message($text,$type){
|
574 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
575 |
+
echo WDILibrary::message($text, $type);
|
576 |
+
}
|
|
|
|
|
|
|
|
|
|
|
577 |
}
|
|
admin/controllers/WDIControllerLicensing_wdi.php
CHANGED
@@ -1,33 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerLicensing_wdi {
|
4 |
-
|
5 |
-
// Events //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constants //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// Variables //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
-
// Constructor & Destructor //
|
15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
16 |
public function __construct() {
|
17 |
}
|
18 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
19 |
-
// Public Methods //
|
20 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
-
public function execute() {
|
22 |
-
$task = ((isset($_POST['task'])) ? esc_html(stripslashes($_POST['task'])) : '');
|
23 |
|
24 |
-
|
|
|
|
|
25 |
if(!WDWLibrary::verify_nonce('licensing_bwg')){
|
26 |
die('Sorry, your nonce did not verify.');
|
27 |
}
|
28 |
}
|
29 |
-
|
30 |
-
|
31 |
if (method_exists($this, $task)) {
|
32 |
$this->$task($id);
|
33 |
}
|
@@ -44,14 +28,4 @@ class WDIControllerLicensing_wdi {
|
|
44 |
$view = new WDIViewLicensing_wdi($model);
|
45 |
$view->display();
|
46 |
}
|
47 |
-
|
48 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
49 |
-
// Getters & Setters //
|
50 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
51 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
52 |
-
// Private Methods //
|
53 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
54 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
55 |
-
// Listeners //
|
56 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
57 |
}
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerLicensing_wdi {
|
4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public function __construct() {
|
6 |
}
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
public function execute() {
|
9 |
+
$task = WDILibrary::get('task', '');
|
10 |
+
if ( $task != '' ) {
|
11 |
if(!WDWLibrary::verify_nonce('licensing_bwg')){
|
12 |
die('Sorry, your nonce did not verify.');
|
13 |
}
|
14 |
}
|
|
|
|
|
15 |
if (method_exists($this, $task)) {
|
16 |
$this->$task($id);
|
17 |
}
|
28 |
$view = new WDIViewLicensing_wdi($model);
|
29 |
$view->display();
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
admin/controllers/WDIControllerSettings_wdi.php
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerSettings_wdi{
|
4 |
-
|
5 |
-
// Constructor & Destructor //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
function __construct(){
|
8 |
|
9 |
}
|
10 |
-
|
11 |
-
// Public Methods //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
public function execute() {
|
14 |
|
15 |
$this->display();
|
@@ -22,4 +18,4 @@ class WDIControllerSettings_wdi{
|
|
22 |
$view = new WDIViewSettings_wdi($model);
|
23 |
$view->display();
|
24 |
}
|
25 |
-
}
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerSettings_wdi{
|
4 |
+
|
|
|
|
|
5 |
function __construct(){
|
6 |
|
7 |
}
|
8 |
+
|
|
|
|
|
9 |
public function execute() {
|
10 |
|
11 |
$this->display();
|
18 |
$view = new WDIViewSettings_wdi($model);
|
19 |
$view->display();
|
20 |
}
|
21 |
+
}
|
admin/controllers/WDIControllerThemes_wdi.php
CHANGED
@@ -322,11 +322,11 @@ class WDIControllerThemes_wdi {
|
|
322 |
if($customId != ''){
|
323 |
$id = $customId;
|
324 |
}else{
|
325 |
-
$id = (
|
326 |
}
|
327 |
$view->edit($id);
|
328 |
-
|
329 |
}
|
|
|
330 |
private function apply() {
|
331 |
$this->save_slider_db();
|
332 |
$this->save_slide_db();
|
@@ -337,7 +337,8 @@ class WDIControllerThemes_wdi {
|
|
337 |
global $wpdb;
|
338 |
$sliders_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_THEME_TABLE);
|
339 |
foreach ($sliders_ids_col as $theme_id) {
|
340 |
-
|
|
|
341 |
$msg = $this->duplicate_tabels($theme_id);
|
342 |
}
|
343 |
}
|
@@ -396,19 +397,21 @@ class WDIControllerThemes_wdi {
|
|
396 |
$defaultFalg = false;
|
397 |
$sliders_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_THEME_TABLE);
|
398 |
foreach ($sliders_ids_col as $theme_id) {
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
|
|
404 |
$flag = TRUE;
|
405 |
$query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_THEME_TABLE.' WHERE id="%d"', $theme_id);
|
406 |
$wpdb->query($query);
|
407 |
-
}else{
|
408 |
-
$defaulFlag = true;
|
409 |
-
echo WDILibrary::message(__('You cannot delete default theme.',"wd-instagram-feed"), 'error');
|
410 |
-
}
|
411 |
}
|
|
|
|
|
|
|
|
|
|
|
412 |
}
|
413 |
if ($flag) {
|
414 |
echo WDILibrary::message(__('Items Succesfully Deleted.',"wd-instagram-feed"), 'updated');
|
322 |
if($customId != ''){
|
323 |
$id = $customId;
|
324 |
}else{
|
325 |
+
$id = (int) WDILibrary::get('current_id', 0);
|
326 |
}
|
327 |
$view->edit($id);
|
|
|
328 |
}
|
329 |
+
|
330 |
private function apply() {
|
331 |
$this->save_slider_db();
|
332 |
$this->save_slide_db();
|
337 |
global $wpdb;
|
338 |
$sliders_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_THEME_TABLE);
|
339 |
foreach ($sliders_ids_col as $theme_id) {
|
340 |
+
$check_id = WDILibrary::get('check_' . $theme_id, '');
|
341 |
+
if ( !empty($check_id) ) {
|
342 |
$msg = $this->duplicate_tabels($theme_id);
|
343 |
}
|
344 |
}
|
397 |
$defaultFalg = false;
|
398 |
$sliders_ids_col = $wpdb->get_col('SELECT id FROM ' . $wpdb->prefix . WDI_THEME_TABLE);
|
399 |
foreach ($sliders_ids_col as $theme_id) {
|
400 |
+
$defaulFlag = false;
|
401 |
+
$theme_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix . WDI_THEME_TABLE." WHERE id = %d",$theme_id));
|
402 |
+
$check_id = WDILibrary::get('check_' . $theme_id, '');
|
403 |
+
$check_all_items = WDILibrary::get('check_all_items', '');
|
404 |
+
if ( !empty($check_id) || !empty($check_all_items) ) {
|
405 |
+
if( $theme_row->default_theme == '0' ) {
|
406 |
$flag = TRUE;
|
407 |
$query = $wpdb->prepare('DELETE FROM ' . $wpdb->prefix . WDI_THEME_TABLE.' WHERE id="%d"', $theme_id);
|
408 |
$wpdb->query($query);
|
|
|
|
|
|
|
|
|
409 |
}
|
410 |
+
else {
|
411 |
+
$defaulFlag = true;
|
412 |
+
echo WDILibrary::message(__('You cannot delete default theme.',"wd-instagram-feed"), 'error');
|
413 |
+
}
|
414 |
+
}
|
415 |
}
|
416 |
if ($flag) {
|
417 |
echo WDILibrary::message(__('Items Succesfully Deleted.',"wd-instagram-feed"), 'updated');
|
admin/controllers/WDIControllerUninstall_wdi.php
CHANGED
@@ -71,10 +71,10 @@ class WDIControllerUninstall_wdi{
|
|
71 |
}
|
72 |
|
73 |
private function uninstall(){
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
$removed = false;
|
79 |
$table_name = $wpdb->prefix.WDI_FEED_TABLE;
|
80 |
$checktable = $wpdb->query("SHOW TABLES LIKE '$table_name'");
|
@@ -111,8 +111,7 @@ class WDIControllerUninstall_wdi{
|
|
111 |
delete_option('wdi_first_user_username');
|
112 |
delete_option('tenweb_notice_status');
|
113 |
|
114 |
-
|
115 |
-
$default_option=array();
|
116 |
$default_option['wdi_plugin_uninstalled'] = 'true';
|
117 |
|
118 |
add_option(WDI_OPT,$default_option);
|
@@ -124,8 +123,9 @@ class WDIControllerUninstall_wdi{
|
|
124 |
}else{
|
125 |
$this->display();
|
126 |
}
|
127 |
-
}
|
128 |
-
|
|
|
129 |
}
|
130 |
delete_option('wdi_subscribe_done');
|
131 |
delete_option('wdi_redirect_to_settings');
|
@@ -134,11 +134,11 @@ class WDIControllerUninstall_wdi{
|
|
134 |
}
|
135 |
|
136 |
private function is_uninstalled(){
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
}
|
144 |
}
|
71 |
}
|
72 |
|
73 |
private function uninstall(){
|
74 |
+
$verify = WDILibrary::get('wdi_verify', 0);
|
75 |
+
if ( !$this->is_uninstalled() ) {
|
76 |
+
if( $verify == '1' ) {
|
77 |
+
global $wpdb;
|
78 |
$removed = false;
|
79 |
$table_name = $wpdb->prefix.WDI_FEED_TABLE;
|
80 |
$checktable = $wpdb->query("SHOW TABLES LIKE '$table_name'");
|
111 |
delete_option('wdi_first_user_username');
|
112 |
delete_option('tenweb_notice_status');
|
113 |
|
114 |
+
$default_option=array();
|
|
|
115 |
$default_option['wdi_plugin_uninstalled'] = 'true';
|
116 |
|
117 |
add_option(WDI_OPT,$default_option);
|
123 |
}else{
|
124 |
$this->display();
|
125 |
}
|
126 |
+
}
|
127 |
+
else{
|
128 |
+
$this->already_uninstalled();
|
129 |
}
|
130 |
delete_option('wdi_subscribe_done');
|
131 |
delete_option('wdi_redirect_to_settings');
|
134 |
}
|
135 |
|
136 |
private function is_uninstalled(){
|
137 |
+
global $wdi_options;
|
138 |
+
if(isset($wdi_options['wdi_plugin_uninstalled']) && $wdi_options['wdi_plugin_uninstalled']=='true') {
|
139 |
+
return true;
|
140 |
+
}else{
|
141 |
+
return false;
|
142 |
+
}
|
143 |
}
|
144 |
}
|
admin/models/WDIModelFeeds_wdi.php
CHANGED
@@ -1,42 +1,26 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIModelFeeds_wdi {
|
4 |
-
|
5 |
-
// Events //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constants //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// Variables //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
-
// Constructor & Destructor //
|
15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
16 |
private $page_number = null;
|
|
|
17 |
private $search_text = "";
|
|
|
18 |
public function __construct() {
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
$this->page_number = $_POST['page_number'];
|
23 |
}
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
$this->search_text = $_GET['search'];
|
28 |
}
|
29 |
}
|
30 |
-
|
31 |
-
// Public Methods //
|
32 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
33 |
public function get_slides_row_data($slider_id) {
|
34 |
global $wpdb;
|
35 |
$row = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . WDI_FEED_TABLE. " WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id));
|
36 |
-
|
37 |
-
// $row->image_url = $row->image_url ? $row->image_url : WD_S_URL . '/images/no-image.png';
|
38 |
-
// $row->thumb_url = $row->thumb_url ? $row->thumb_url : WD_S_URL . '/images/no-image.png';
|
39 |
-
}
|
40 |
return $row;
|
41 |
}
|
42 |
|
@@ -45,12 +29,13 @@ class WDIModelFeeds_wdi {
|
|
45 |
global $wpdb;
|
46 |
|
47 |
$where = ((!empty($this->search_text)) ? 'WHERE feed_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
|
48 |
-
$
|
49 |
|
50 |
$order_by_arr = array('id', 'feed_name', 'published');
|
51 |
-
$order_by = (
|
52 |
-
|
53 |
-
$order_by = ' ORDER BY `' . $order_by . '` ' . $
|
|
|
54 |
if (isset($this->page_number) && $this->page_number) {
|
55 |
$limit = ((int) $this->page_number - 1) * 20;
|
56 |
}
|
@@ -86,87 +71,83 @@ class WDIModelFeeds_wdi {
|
|
86 |
return $page_nav;
|
87 |
}
|
88 |
|
89 |
-
public static function wdi_get_feed_defaults(){
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
'hashtag_top_recent' => '1',
|
167 |
-
);
|
168 |
-
return $settings;
|
169 |
-
}
|
170 |
|
171 |
public function get_sanitize_types(){
|
172 |
$sanitize_types = array(
|
@@ -242,14 +223,15 @@ class WDIModelFeeds_wdi {
|
|
242 |
return $sanitize_types;
|
243 |
}
|
244 |
|
245 |
-
public function get_feed_row($current_id){
|
246 |
-
|
247 |
-
|
248 |
-
return $feed_row;
|
249 |
-
}
|
250 |
-
private function check_settings($settings){
|
251 |
|
252 |
-
|
|
|
|
|
|
|
|
|
253 |
$settings = WDILibrary::objectToArray($settings);
|
254 |
|
255 |
if(isset($settings['feed_users'])){
|
@@ -330,6 +312,5 @@ private function check_settings($settings){
|
|
330 |
}
|
331 |
}
|
332 |
}
|
333 |
-
|
334 |
}
|
335 |
-
|
1 |
<?php
|
2 |
|
3 |
class WDIModelFeeds_wdi {
|
4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
private $page_number = null;
|
6 |
+
|
7 |
private $search_text = "";
|
8 |
+
|
9 |
public function __construct() {
|
10 |
+
$this->page_number = WDILibrary::get('paged', '');
|
11 |
+
if( empty($this->page_number) ){
|
12 |
+
$this->page_number = WDILibrary::get('page_number', '');
|
|
|
13 |
}
|
14 |
+
$this->search_text = WDILibrary::get('search_value', '');
|
15 |
+
if( empty($this->search_text) ){
|
16 |
+
$this->search_text = WDILibrary::get('search', '');
|
|
|
17 |
}
|
18 |
}
|
19 |
+
|
|
|
|
|
20 |
public function get_slides_row_data($slider_id) {
|
21 |
global $wpdb;
|
22 |
$row = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . WDI_FEED_TABLE. " WHERE slider_id='%d' ORDER BY `order` ASC", $slider_id));
|
23 |
+
|
|
|
|
|
|
|
24 |
return $row;
|
25 |
}
|
26 |
|
29 |
global $wpdb;
|
30 |
|
31 |
$where = ((!empty($this->search_text)) ? 'WHERE feed_name LIKE "%' . esc_html(stripslashes($this->search_text)) . '%"' : '');
|
32 |
+
$order = WDILibrary::get('order', 'desc');
|
33 |
|
34 |
$order_by_arr = array('id', 'feed_name', 'published');
|
35 |
+
$order_by = WDILibrary::get('order_by', 'id');
|
36 |
+
$order_by = ( in_array($order_by, $order_by_arr) ) ? $order_by : 'id';
|
37 |
+
$order_by = ' ORDER BY `' . $order_by . '` ' . $order;
|
38 |
+
|
39 |
if (isset($this->page_number) && $this->page_number) {
|
40 |
$limit = ((int) $this->page_number - 1) * 20;
|
41 |
}
|
71 |
return $page_nav;
|
72 |
}
|
73 |
|
74 |
+
public static function wdi_get_feed_defaults() {
|
75 |
+
global $wdi_options;
|
76 |
+
global $wpdb;
|
77 |
+
$query = $wpdb->prepare("SELECT id FROM " . $wpdb->prefix . WDI_THEME_TABLE . " WHERE default_theme='%d'", 1);
|
78 |
+
$default_theme = WDILibrary::objectToArray($wpdb->get_results($query));
|
79 |
+
$default_user = new stdClass();
|
80 |
+
$default_user->username = $wdi_options['wdi_user_name'];
|
81 |
+
$default_user->id = $wdi_options['wdi_user_id'];
|
82 |
+
$settings = array(
|
83 |
+
'thumb_user' => $wdi_options['wdi_user_name'],
|
84 |
+
'feed_name' => 'Sample Feed',
|
85 |
+
'feed_thumb' => WDI_URL . '/images/no-image.png',
|
86 |
+
'published' => '1',
|
87 |
+
'theme_id' => $default_theme[0]['id'],
|
88 |
+
'feed_users' => json_encode(array( $default_user )),
|
89 |
+
'feed_display_view' => 'load_more_btn',
|
90 |
+
'sort_images_by' => 'date',
|
91 |
+
'display_order' => 'desc',
|
92 |
+
'follow_on_instagram_btn' => '1',
|
93 |
+
'display_header' => '0',
|
94 |
+
'number_of_photos' => '20',
|
95 |
+
'load_more_number' => '4',
|
96 |
+
'pagination_per_page_number' => '12',
|
97 |
+
'pagination_preload_number' => '10',
|
98 |
+
'image_browser_preload_number' => '10',
|
99 |
+
'image_browser_load_number' => '10',
|
100 |
+
'number_of_columns' => '4',
|
101 |
+
'resort_after_load_more' => '0',
|
102 |
+
'show_likes' => '0',
|
103 |
+
'show_description' => '0',
|
104 |
+
'show_comments' => '0',
|
105 |
+
'show_usernames' => '1',
|
106 |
+
'display_user_info' => '1',
|
107 |
+
'display_user_post_follow_number' => '1',
|
108 |
+
'show_full_description' => '1',
|
109 |
+
'disable_mobile_layout' => '0',
|
110 |
+
'feed_type' => 'thumbnails',
|
111 |
+
'feed_item_onclick' => 'lightbox',
|
112 |
+
//lightbox defaults
|
113 |
+
'popup_fullscreen' => '0',
|
114 |
+
'popup_width' => '640',
|
115 |
+
'popup_height' => '640',
|
116 |
+
'popup_type' => 'none',
|
117 |
+
'popup_autoplay' => '0',
|
118 |
+
'popup_interval' => '5',
|
119 |
+
'popup_enable_filmstrip' => '0',
|
120 |
+
'popup_filmstrip_height' => '70',
|
121 |
+
'autohide_lightbox_navigation' => '1',
|
122 |
+
'popup_enable_ctrl_btn' => '1',
|
123 |
+
'popup_enable_fullscreen' => '1',
|
124 |
+
'popup_enable_info' => '0',
|
125 |
+
'popup_info_always_show' => '0',
|
126 |
+
'popup_info_full_width' => '0',
|
127 |
+
'popup_enable_comment' => '0',
|
128 |
+
'popup_enable_fullsize_image' => '1',
|
129 |
+
'popup_enable_download' => '0',
|
130 |
+
'popup_enable_share_buttons' => '0',
|
131 |
+
'popup_enable_facebook' => '0',
|
132 |
+
'popup_enable_twitter' => '0',
|
133 |
+
'popup_enable_google' => '0',
|
134 |
+
'popup_enable_pinterest' => '0',
|
135 |
+
'popup_enable_tumblr' => '0',
|
136 |
+
'show_image_counts' => '0',
|
137 |
+
'enable_loop' => '1',
|
138 |
+
'popup_image_right_click' => '1',
|
139 |
+
'conditional_filters' => '',
|
140 |
+
'conditional_filter_type' => 'none',
|
141 |
+
'show_username_on_thumb' => '0',
|
142 |
+
'conditional_filter_enable' => '0',
|
143 |
+
'liked_feed' => 'userhash',
|
144 |
+
'mobile_breakpoint' => '640',
|
145 |
+
'redirect_url' => '',
|
146 |
+
'feed_resolution' => 'optimal',
|
147 |
+
'hashtag_top_recent' => '1',
|
148 |
+
);
|
149 |
+
return $settings;
|
150 |
+
}
|
|
|
|
|
|
|
|
|
151 |
|
152 |
public function get_sanitize_types(){
|
153 |
$sanitize_types = array(
|
223 |
return $sanitize_types;
|
224 |
}
|
225 |
|
226 |
+
public function get_feed_row($current_id){
|
227 |
+
global $wpdb;
|
228 |
+
$settings = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix.WDI_FEED_TABLE. " WHERE id ='%d' ",$current_id));
|
|
|
|
|
|
|
229 |
|
230 |
+
$feed_row = $this->check_settings( $settings );
|
231 |
+
return $feed_row;
|
232 |
+
}
|
233 |
+
|
234 |
+
private function check_settings($settings){
|
235 |
$settings = WDILibrary::objectToArray($settings);
|
236 |
|
237 |
if(isset($settings['feed_users'])){
|
312 |
}
|
313 |
}
|
314 |
}
|
|
|
315 |
}
|
316 |
+
?>
|
admin/models/WDIModelSettings_wdi.php
CHANGED
@@ -1,13 +1,10 @@
|
|
1 |
<?php
|
|
|
2 |
class WDIModelSettings_wdi{
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
public
|
7 |
-
|
8 |
-
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
public function __construct(){
|
11 |
-
$this->activeTab = (isset($_GET['form_action']) ? $_GET['form_action'] : isset($_POST['form_action']) ? $_POST['form_action'] : 'configure');
|
12 |
-
}
|
13 |
}
|
1 |
<?php
|
2 |
+
|
3 |
class WDIModelSettings_wdi{
|
4 |
+
|
5 |
+
public $active_tab = 'configure';
|
6 |
+
|
7 |
+
public function __construct(){
|
8 |
+
$this->activeTab = WDILibrary::get('form_action', 'configure');
|
9 |
+
}
|
|
|
|
|
|
|
|
|
10 |
}
|
admin/models/WDIModelThemes_wdi.php
CHANGED
@@ -21,13 +21,17 @@ class WDIModelThemes_wdi {
|
|
21 |
|
22 |
public function get_rows_data() {
|
23 |
global $wpdb;
|
24 |
-
$
|
25 |
-
$
|
|
|
|
|
26 |
$order_by_arr = array('id', 'theme_name', 'default_theme');
|
27 |
-
$order_by = (
|
28 |
-
$order_by =
|
29 |
-
|
30 |
-
|
|
|
|
|
31 |
}
|
32 |
else {
|
33 |
$limit = 0;
|
@@ -38,14 +42,15 @@ class WDIModelThemes_wdi {
|
|
38 |
return $rows;
|
39 |
}
|
40 |
|
41 |
-
|
42 |
public function page_nav() {
|
43 |
global $wpdb;
|
44 |
-
$
|
|
|
45 |
$total = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . WDI_THEME_TABLE. ' ' . $where);
|
46 |
$page_nav['total'] = $total;
|
47 |
-
|
48 |
-
|
|
|
49 |
}
|
50 |
else {
|
51 |
$limit = 0;
|
@@ -107,10 +112,6 @@ class WDIModelThemes_wdi {
|
|
107 |
'users_text_font_size' => '18px',
|
108 |
'users_text_font_style' => 'normal',
|
109 |
'user_description_font_size' => '18px',
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
'lightbox_overlay_bg_color'=>'#25292c',
|
115 |
'lightbox_overlay_bg_transparent'=>'90',
|
116 |
'lightbox_bg_color'=>'#ffffff',
|
21 |
|
22 |
public function get_rows_data() {
|
23 |
global $wpdb;
|
24 |
+
$search_value = WDILibrary::get('search_value', '');
|
25 |
+
$where = ( !empty($search_value) ) ? 'WHERE theme_name LIKE "%' . esc_html(stripslashes($search_value)) . '%"' : '';
|
26 |
+
|
27 |
+
$order = WDILibrary::get('asc_or_desc', 'asc');
|
28 |
$order_by_arr = array('id', 'theme_name', 'default_theme');
|
29 |
+
$order_by = WDILibrary::get('order_by', 'id');
|
30 |
+
$order_by = ( in_array($order_by, $order_by_arr) ) ? $order_by : 'id';
|
31 |
+
$order_by = ' ORDER BY `' . $order_by . '` ' . $order;
|
32 |
+
$page_number = (int) WDILibrary::get('page_number');
|
33 |
+
if (isset($page_number) && $page_number) {
|
34 |
+
$limit = ( $page_number - 1 ) * 20;
|
35 |
}
|
36 |
else {
|
37 |
$limit = 0;
|
42 |
return $rows;
|
43 |
}
|
44 |
|
|
|
45 |
public function page_nav() {
|
46 |
global $wpdb;
|
47 |
+
$search_value = WDILibrary::get('search_value', '');
|
48 |
+
$where = ( !empty($search_value) ) ? 'WHERE theme_name LIKE "%' . esc_html(stripslashes($search_value)) . '%"' : '';
|
49 |
$total = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . WDI_THEME_TABLE. ' ' . $where);
|
50 |
$page_nav['total'] = $total;
|
51 |
+
$page_number = (int) WDILibrary::get('page_number');
|
52 |
+
if ( isset($page_number) && $page_number ) {
|
53 |
+
$limit = ( $page_number - 1 ) * 20;
|
54 |
}
|
55 |
else {
|
56 |
$limit = 0;
|
112 |
'users_text_font_size' => '18px',
|
113 |
'users_text_font_style' => 'normal',
|
114 |
'user_description_font_size' => '18px',
|
|
|
|
|
|
|
|
|
115 |
'lightbox_overlay_bg_color'=>'#25292c',
|
116 |
'lightbox_overlay_bg_transparent'=>'90',
|
117 |
'lightbox_bg_color'=>'#ffffff',
|
admin/views/WDIViewFeeds_wdi.php
CHANGED
@@ -2,42 +2,27 @@
|
|
2 |
|
3 |
class WDIViewFeeds_wdi
|
4 |
{
|
5 |
-
|
6 |
-
// Events //
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
// Constants //
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
// Variables //
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
private $model;
|
15 |
|
16 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
17 |
-
// Constructor & Destructor //
|
18 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
19 |
public function __construct($model)
|
20 |
{
|
21 |
$this->model = $model;
|
22 |
}
|
23 |
-
|
24 |
-
// Public Methods //
|
25 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
26 |
public function display()
|
27 |
{
|
28 |
/*My Edit*/
|
29 |
global $wdi_options;
|
30 |
$rows_data = $this->model->get_rows_data();
|
31 |
$page_nav = $this->model->page_nav();
|
32 |
-
$search_value =
|
33 |
-
if(
|
34 |
-
$search_value =
|
35 |
-
}elseif (isset($_GET["search"])){
|
36 |
-
$search_value =esc_html(stripslashes($_GET["search"]));
|
37 |
}
|
38 |
|
39 |
-
$asc_or_desc = (
|
40 |
-
$order_by = (
|
41 |
if($order_by==="feed_name"){
|
42 |
$wdi_sort = " sorted ";
|
43 |
}else{
|
@@ -242,7 +227,7 @@ class WDIViewFeeds_wdi
|
|
242 |
$feed_row = $this->model->get_feed_row($current_id);
|
243 |
$view_id = $feed_row->feed_type;
|
244 |
$this->generateForm($current_id);
|
245 |
-
$tab =
|
246 |
?>
|
247 |
<script>jQuery(document).ready(function ()
|
248 |
{
|
@@ -489,38 +474,37 @@ public function genarateFeedViews()
|
|
489 |
}
|
490 |
|
491 |
public function generateForm($current_id = ''){
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
|
505 |
-
|
506 |
//for edit
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
if(isset($feed_row['liked_feed'])) {
|
521 |
-
$feed_row['liked_feed'] = 'userhash';
|
522 |
-
}
|
523 |
|
|
|
|
|
|
|
524 |
?>
|
525 |
<div class="update-nag notice wd-notice wdi_help_bar_wrap">
|
526 |
<span class="wdi_help_bar_text">
|
@@ -576,8 +560,7 @@ public function genarateFeedViews()
|
|
576 |
}
|
577 |
?>
|
578 |
<div id="<?php echo $key; ?>_section" class="wdi_section <?php echo $section["type"]; ?> <?php echo $section["column"]; ?>">
|
579 |
-
|
580 |
-
<h3 data-section_name="<?php echo $section['section_name']?>" class="wdi_section_name <?php echo $section_class;?>"><?php echo $section["title"]; ?></h3>
|
581 |
<div class="wdi_elements wdi_clear_tag">
|
582 |
<?php foreach ($section["elements"] as $elements) { ?>
|
583 |
<div class="section_col">
|
@@ -604,7 +587,6 @@ public function genarateFeedViews()
|
|
604 |
<span class="wdi_settings_link" ><?php echo $element['title']; ?></span>
|
605 |
</div>
|
606 |
<div class="wdi_element_content">
|
607 |
-
|
608 |
<?php $this->buildField($element, $feed_row); ?>
|
609 |
<!-- FEED USERS -->
|
610 |
<?php if ($element['name'] == 'feed_users'): ?>
|
@@ -637,6 +619,7 @@ public function genarateFeedViews()
|
|
637 |
</div>
|
638 |
<?php
|
639 |
}
|
|
|
640 |
private function buildField($element, $feed_row = '')
|
641 |
{
|
642 |
require_once(WDI_DIR . '/framework/WDI_form_builder.php');
|
@@ -677,13 +660,11 @@ public function genarateFeedViews()
|
|
677 |
if ($users === null) {
|
678 |
$users = array();
|
679 |
}
|
680 |
-
|
681 |
$token = WDILibrary::get_user_access_token($users);
|
682 |
?>
|
683 |
<script>
|
684 |
jQuery(document).ready(function ()
|
685 |
{
|
686 |
-
|
687 |
var users_list = JSON.parse(wdi_options.wdi_authenticated_users_list);
|
688 |
if (typeof users_list !== 'object') {
|
689 |
users_list = {};
|
2 |
|
3 |
class WDIViewFeeds_wdi
|
4 |
{
|
5 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
private $model;
|
7 |
|
|
|
|
|
|
|
8 |
public function __construct($model)
|
9 |
{
|
10 |
$this->model = $model;
|
11 |
}
|
12 |
+
|
|
|
|
|
13 |
public function display()
|
14 |
{
|
15 |
/*My Edit*/
|
16 |
global $wdi_options;
|
17 |
$rows_data = $this->model->get_rows_data();
|
18 |
$page_nav = $this->model->page_nav();
|
19 |
+
$search_value = WDILibrary::get('search_value', '');
|
20 |
+
if( empty($search_value) ){
|
21 |
+
$search_value = WDILibrary::get('search', '');
|
|
|
|
|
22 |
}
|
23 |
|
24 |
+
$asc_or_desc = WDILibrary::get('order', 'asc');
|
25 |
+
$order_by = WDILibrary::get('order_by', 'id');
|
26 |
if($order_by==="feed_name"){
|
27 |
$wdi_sort = " sorted ";
|
28 |
}else{
|
227 |
$feed_row = $this->model->get_feed_row($current_id);
|
228 |
$view_id = $feed_row->feed_type;
|
229 |
$this->generateForm($current_id);
|
230 |
+
$tab = WDILibrary::get('wdi_refresh_tab', 'feed_settings');
|
231 |
?>
|
232 |
<script>jQuery(document).ready(function ()
|
233 |
{
|
474 |
}
|
475 |
|
476 |
public function generateForm($current_id = ''){
|
477 |
+
if ( $current_id === "" ) {
|
478 |
+
$wdi_preview_btn = false;
|
479 |
+
$save_btn_name = __('Publish', "wd-instagram-feed");
|
480 |
+
}
|
481 |
+
else {
|
482 |
+
$wdi_preview_btn = true;
|
483 |
+
$save_btn_name = __('Update', "wd-instagram-feed");
|
484 |
+
}
|
485 |
|
486 |
+
$formInfo = $this->getFormElements($current_id);
|
487 |
+
$tabs = $formInfo['tabs'];
|
488 |
+
$wdi_preview_link = $this->model->get_instagram_preview_post();
|
489 |
|
490 |
+
global $wdi_options;
|
491 |
//for edit
|
492 |
+
$edit = false;
|
493 |
+
if ($current_id != '') {
|
494 |
+
$feed_row = WDILibrary::objectToarray($this->model->get_feed_row($current_id));
|
495 |
+
$edit = true;
|
496 |
+
}
|
497 |
+
else {
|
498 |
+
$feed_row = '';
|
499 |
+
}
|
500 |
+
$feed_row_id = "";
|
501 |
+
if(isset($feed_row["id"])){
|
502 |
+
$feed_row_id = $feed_row["id"];
|
503 |
+
}
|
|
|
|
|
|
|
|
|
504 |
|
505 |
+
if(isset($feed_row['liked_feed'])) {
|
506 |
+
$feed_row['liked_feed'] = 'userhash';
|
507 |
+
}
|
508 |
?>
|
509 |
<div class="update-nag notice wd-notice wdi_help_bar_wrap">
|
510 |
<span class="wdi_help_bar_text">
|
560 |
}
|
561 |
?>
|
562 |
<div id="<?php echo $key; ?>_section" class="wdi_section <?php echo $section["type"]; ?> <?php echo $section["column"]; ?>">
|
563 |
+
<h3 data-section_name="<?php echo $section['section_name']?>" class="wdi_section_name <?php echo $section_class;?>"><?php echo $section["title"]; ?></h3>
|
|
|
564 |
<div class="wdi_elements wdi_clear_tag">
|
565 |
<?php foreach ($section["elements"] as $elements) { ?>
|
566 |
<div class="section_col">
|
587 |
<span class="wdi_settings_link" ><?php echo $element['title']; ?></span>
|
588 |
</div>
|
589 |
<div class="wdi_element_content">
|
|
|
590 |
<?php $this->buildField($element, $feed_row); ?>
|
591 |
<!-- FEED USERS -->
|
592 |
<?php if ($element['name'] == 'feed_users'): ?>
|
619 |
</div>
|
620 |
<?php
|
621 |
}
|
622 |
+
|
623 |
private function buildField($element, $feed_row = '')
|
624 |
{
|
625 |
require_once(WDI_DIR . '/framework/WDI_form_builder.php');
|
660 |
if ($users === null) {
|
661 |
$users = array();
|
662 |
}
|
|
|
663 |
$token = WDILibrary::get_user_access_token($users);
|
664 |
?>
|
665 |
<script>
|
666 |
jQuery(document).ready(function ()
|
667 |
{
|
|
|
668 |
var users_list = JSON.parse(wdi_options.wdi_authenticated_users_list);
|
669 |
if (typeof users_list !== 'object') {
|
670 |
users_list = {};
|
admin/views/WDIViewSettings_wdi.php
CHANGED
@@ -1,23 +1,17 @@
|
|
1 |
<?php
|
2 |
class WDIViewSettings_wdi{
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
private $model;
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constructor and Destructor //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
public function __construct($model){
|
11 |
$this->model = $model;
|
12 |
}
|
13 |
-
|
14 |
-
// Public Methods //
|
15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
16 |
public function display(){
|
17 |
global $wdi_options;
|
18 |
require_once(WDI_DIR . '/framework/WDI_admin_view.php');
|
19 |
-
|
20 |
-
|
21 |
/*dismiss api update notice*/
|
22 |
$admin_notices_option = get_option('wdi_admin_notice', array());
|
23 |
$admin_notices_option['api_update_token_reset'] = array(
|
@@ -26,7 +20,6 @@ private $model;
|
|
26 |
'dismissed' => 1,
|
27 |
);
|
28 |
update_option('wdi_admin_notice', $admin_notices_option);
|
29 |
-
|
30 |
?>
|
31 |
<script>
|
32 |
wdi_controller.instagram = new WDIInstagram();
|
@@ -38,7 +31,6 @@ private $model;
|
|
38 |
jQuery('#submit').trigger('click');
|
39 |
})
|
40 |
});
|
41 |
-
|
42 |
}
|
43 |
</script>
|
44 |
<?php
|
@@ -61,16 +53,13 @@ private $model;
|
|
61 |
</a>
|
62 |
</div>
|
63 |
</div>
|
64 |
-
|
65 |
-
|
66 |
<h1 id="settings_wdi_title"><?php _e('Instagram Settings', "wd-instagram-feed"); ?></h1>
|
67 |
<form method="post" action="options.php" class="wdi_settings_form">
|
68 |
<input type="hidden"id="wdi_user_id" name="<?php echo WDI_OPT.'[wdi_user_id]' ?>">
|
69 |
<?php settings_fields('wdi_all_settings'); ?>
|
70 |
<?php do_settings_sections('settings_wdi'); ?>
|
71 |
<div id="wdi_options_page_buttons_wrapper">
|
72 |
-
|
73 |
-
class="button button-secondary"><?php _e("Reset Primary Access Token", "wd-instagram-feed") ?></div>
|
74 |
<?php submit_button(); ?>
|
75 |
</div>
|
76 |
</form>
|
1 |
<?php
|
2 |
class WDIViewSettings_wdi{
|
3 |
+
|
4 |
+
private $model;
|
5 |
+
|
|
|
|
|
|
|
|
|
6 |
public function __construct($model){
|
7 |
$this->model = $model;
|
8 |
}
|
9 |
+
|
|
|
|
|
10 |
public function display(){
|
11 |
global $wdi_options;
|
12 |
require_once(WDI_DIR . '/framework/WDI_admin_view.php');
|
13 |
+
$access_token = WDILibrary::get('access_token', '');
|
14 |
+
if( !empty($access_token) ) {
|
15 |
/*dismiss api update notice*/
|
16 |
$admin_notices_option = get_option('wdi_admin_notice', array());
|
17 |
$admin_notices_option['api_update_token_reset'] = array(
|
20 |
'dismissed' => 1,
|
21 |
);
|
22 |
update_option('wdi_admin_notice', $admin_notices_option);
|
|
|
23 |
?>
|
24 |
<script>
|
25 |
wdi_controller.instagram = new WDIInstagram();
|
31 |
jQuery('#submit').trigger('click');
|
32 |
})
|
33 |
});
|
|
|
34 |
}
|
35 |
</script>
|
36 |
<?php
|
53 |
</a>
|
54 |
</div>
|
55 |
</div>
|
|
|
|
|
56 |
<h1 id="settings_wdi_title"><?php _e('Instagram Settings', "wd-instagram-feed"); ?></h1>
|
57 |
<form method="post" action="options.php" class="wdi_settings_form">
|
58 |
<input type="hidden"id="wdi_user_id" name="<?php echo WDI_OPT.'[wdi_user_id]' ?>">
|
59 |
<?php settings_fields('wdi_all_settings'); ?>
|
60 |
<?php do_settings_sections('settings_wdi'); ?>
|
61 |
<div id="wdi_options_page_buttons_wrapper">
|
62 |
+
<div id="wdi_reset_access_token" class="button button-secondary"><?php _e("Reset Primary Access Token", "wd-instagram-feed") ?></div>
|
|
|
63 |
<?php submit_button(); ?>
|
64 |
</div>
|
65 |
</form>
|
admin/views/WDIViewThemes_wdi.php
CHANGED
@@ -1,28 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIViewThemes_wdi {
|
4 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
5 |
-
// Events //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constants //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// Variables //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
private $model;
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
18 |
public function __construct($model) {
|
19 |
$this->model = $model;
|
20 |
}
|
21 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
22 |
-
// Public Methods //
|
23 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
24 |
-
public function display() {
|
25 |
|
|
|
26 |
?>
|
27 |
<div class="wrap">
|
28 |
<div class="update-nag notice wd-notice wdi_help_bar_wrap">
|
@@ -41,11 +27,7 @@ class WDIViewThemes_wdi {
|
|
41 |
</a>
|
42 |
</div>
|
43 |
</div>
|
44 |
-
|
45 |
-
|
46 |
<div class="wdi_pro_notice"> <?php _e("This is free version, Customizing themes is available only in premium version","wd-instagram-feed"); ?> </div>
|
47 |
-
|
48 |
-
|
49 |
<?php
|
50 |
$this->buildFreeThemeDemo();
|
51 |
?>
|
@@ -72,12 +54,4 @@ class WDIViewThemes_wdi {
|
|
72 |
<div class="wdi_demo_img" demo-tab="lb_comments"><img src="<?php echo WDI_URL . '/demo_images/l7.png'; ?>" alt=""></div>
|
73 |
<?php
|
74 |
}
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
}
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
1 |
<?php
|
2 |
|
3 |
class WDIViewThemes_wdi {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
private $model;
|
6 |
+
|
|
|
7 |
public function __construct($model) {
|
8 |
$this->model = $model;
|
9 |
}
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
public function display() {
|
12 |
?>
|
13 |
<div class="wrap">
|
14 |
<div class="update-nag notice wd-notice wdi_help_bar_wrap">
|
27 |
</a>
|
28 |
</div>
|
29 |
</div>
|
|
|
|
|
30 |
<div class="wdi_pro_notice"> <?php _e("This is free version, Customizing themes is available only in premium version","wd-instagram-feed"); ?> </div>
|
|
|
|
|
31 |
<?php
|
32 |
$this->buildFreeThemeDemo();
|
33 |
?>
|
54 |
<div class="wdi_demo_img" demo-tab="lb_comments"><img src="<?php echo WDI_URL . '/demo_images/l7.png'; ?>" alt=""></div>
|
55 |
<?php
|
56 |
}
|
57 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changelog.txt
DELETED
@@ -1,319 +0,0 @@
|
|
1 |
-
= 1.3.17 =
|
2 |
-
Added: Feed edit links for Elementor widget.
|
3 |
-
|
4 |
-
= 1.3.16 =
|
5 |
-
Fixed: First time authorization.
|
6 |
-
|
7 |
-
= 1.3.15 =
|
8 |
-
Added: Banner to install 10Web manager.
|
9 |
-
|
10 |
-
= 1.3.14 =
|
11 |
-
New: Added contributor role in the option 'Minimal role to add and manage Feeds or Themes'.
|
12 |
-
Fixed: Conditional filters for hashtags.
|
13 |
-
|
14 |
-
= 1.3.13 =
|
15 |
-
New: Option to get hashtag top media
|
16 |
-
Improved: Notices during Facebook Log in
|
17 |
-
Fixed: Occasional JS error on front end
|
18 |
-
|
19 |
-
= 1.3.12 =
|
20 |
-
Fixed: Conflict with Gutenberg.
|
21 |
-
|
22 |
-
= 1.3.11 =
|
23 |
-
New: Create hashtag feeds for business profiles using Instagram Graph API
|
24 |
-
|
25 |
-
= 1.3.10 =
|
26 |
-
Fixed: Gutenberg compatibility
|
27 |
-
Fixed: Duplicate media when several filters are applied (Premium)
|
28 |
-
|
29 |
-
= 1.3.9 =
|
30 |
-
Fixed: Free user lib conflict with photo-gallery
|
31 |
-
|
32 |
-
= 1.3.8 =
|
33 |
-
Changed: Links to docs
|
34 |
-
Fixed: Compatibility with Elementor
|
35 |
-
Added: wdi_display_shortcode_button filter
|
36 |
-
|
37 |
-
= 1.3.7 =
|
38 |
-
New: Option to disable loading of Font-Awesome by the plugin
|
39 |
-
Fixed: PHP notice in feed preview
|
40 |
-
Fixed: Issue with admin styles for notices
|
41 |
-
|
42 |
-
= 1.3.6 =
|
43 |
-
Changed: Instagram Feed by 10Web
|
44 |
-
Fixed: Minor bugs when saving feed and opening lightbox
|
45 |
-
|
46 |
-
= 1.3.5 =
|
47 |
-
Changed: Deactivation popup
|
48 |
-
|
49 |
-
= 1.3.4 =
|
50 |
-
New: Display website link in header along with bio
|
51 |
-
|
52 |
-
= 1.3.3 =
|
53 |
-
New: Cache debugging tools
|
54 |
-
New: WD library updated
|
55 |
-
New: GDPR compliance help
|
56 |
-
|
57 |
-
= 1.3.2 =
|
58 |
-
New: Signing up with multiple accounts
|
59 |
-
Fixed: Settings page layout when language is not English
|
60 |
-
|
61 |
-
= 1.3.1 =
|
62 |
-
Fixed: Security issues. Reported by Karan Saini https://www.karansaini.com/
|
63 |
-
|
64 |
-
= 1.3.0 =
|
65 |
-
New: Caching of Instagram data. API rate limits do not constrain feed loading anymore.
|
66 |
-
New: Compatibility with Gutenberg editor.
|
67 |
-
Improved: It is possible now to manually edit access token.
|
68 |
-
Changed: Plugin will output a warning when an incompatible version of Font-Awesome is loaded (SVG generated by JS)
|
69 |
-
Fixed: Cannot correctly include generated styles if site has HTTPS (premium version)
|
70 |
-
Fixed: Conditional filters set up with user's own feed (premium version)
|
71 |
-
Fixed: Error when PHP filter extension is not enabled.
|
72 |
-
Fixed: PHP warning in feed editor page appearing sometimes.
|
73 |
-
|
74 |
-
= 1.2.19 =
|
75 |
-
Fixed: Loading more images (free version)
|
76 |
-
|
77 |
-
= 1.2.18 =
|
78 |
-
Important: Instagram shut down its API partially without any warning. See [changelog](https://www.instagram.com/developer/endpoints/media/). It is not allowed anymore to display photos from other Instagram accounts which are not your own.
|
79 |
-
Sorry.
|
80 |
-
|
81 |
-
= 1.2.17 =
|
82 |
-
Changed: Video play issue on mac safari
|
83 |
-
Changed: Uninstall moved to settings page
|
84 |
-
|
85 |
-
= 1.2.16 =
|
86 |
-
New: Instagram slideshow is supported in popup
|
87 |
-
New: UX of feeds and themes admin screen, it is now similar to posts list screen
|
88 |
-
New: Inline actions for feeds and themes in admin list view
|
89 |
-
Improved: Theme styles are generated as CSS files, not inline styles. Faster page loading and better styles caching.
|
90 |
-
Improved: Popup is faster now and less data is being sent via AJAX
|
91 |
-
|
92 |
-
= 1.2.15 =
|
93 |
-
Added: "How to publish feed" tab in feeds editor screen
|
94 |
-
Added: Closeable metaboxes in feeds editor screen
|
95 |
-
Added: Feed preview button in feeds editor screen
|
96 |
-
Changed: Save, apply and cancel buttons in feed and theme editor screens
|
97 |
-
Changed: Feed and theme title input design
|
98 |
-
Fixed: Minor bugs and conflicts with some themes
|
99 |
-
Improved: Shortcode popup design
|
100 |
-
Removed: Update submenu (Premium)
|
101 |
-
|
102 |
-
= 1.2.14 =
|
103 |
-
Fixed: Conflict with Page Builder by SiteOrigin
|
104 |
-
|
105 |
-
= 1.2.13 =
|
106 |
-
Fixed: Conflict with Divi
|
107 |
-
|
108 |
-
= 1.2.12 =
|
109 |
-
New: Customize feed media resolution. Choose between optimal or custom resolutions, fast loading and higher quality.
|
110 |
-
Improved: Redesigned feed and theme editor screens
|
111 |
-
Improved: More user-friendly names and descriptions of feed settings
|
112 |
-
Improved: UX when access token is expired or have not been obtained yet
|
113 |
-
Improved: UX when there are JS errors on front-end
|
114 |
-
Fixed: Minor: do not include custom scroll bar JS if feed does not have popup
|
115 |
-
|
116 |
-
= 1.2.11 =
|
117 |
-
Changed: Scripts and styles are minified by default
|
118 |
-
Changed: Font-Awesome has been updated to version 4.7.0 and loaded from CDN
|
119 |
-
Changed: Pagination buttons are smaller now in default theme
|
120 |
-
Changed: Deactivation popup
|
121 |
-
|
122 |
-
= 1.2.10 =
|
123 |
-
Fixed: CSS XSS vulnerability in lightbox
|
124 |
-
|
125 |
-
= 1.2.9 =
|
126 |
-
Changed: Web-Dorado links
|
127 |
-
|
128 |
-
= 1.2.8 =
|
129 |
-
Changed: Allow more users and hashtags in feed settings
|
130 |
-
|
131 |
-
= 1.2.7 =
|
132 |
-
Changed: Show notification to install Backup WD plugin only on plugin pages
|
133 |
-
|
134 |
-
= 1.2.6 =
|
135 |
-
Change: Introduction of Backup WD plugin
|
136 |
-
|
137 |
-
= 1.2.5 =
|
138 |
-
Change: "create_function" is not used anymore
|
139 |
-
|
140 |
-
= 1.2.4 =
|
141 |
-
Fixed: Compatibility issue with Better WordPress Minify plugin, thanks to @amityweb for bug report
|
142 |
-
|
143 |
-
= 1.2.3 =
|
144 |
-
Change: WD library updated to version 1.0.11
|
145 |
-
Fixed: Error message when editing feed and token is expired
|
146 |
-
|
147 |
-
= 1.2.2 =
|
148 |
-
New: Redirection to custom URL
|
149 |
-
|
150 |
-
= 1.2.1 =
|
151 |
-
New: Option to disable loading of new images in feed
|
152 |
-
|
153 |
-
= 1.2.0 =
|
154 |
-
New: Default feed
|
155 |
-
Fixed: Infinite scroll triggering (PRO)
|
156 |
-
Fixed: "No media in feed" message on mobile masonry feed
|
157 |
-
Fixed: Minor style conflicts with some themes
|
158 |
-
|
159 |
-
= 1.1.30 =
|
160 |
-
Changed: Frontend styles optimized, loads faster now
|
161 |
-
|
162 |
-
= 1.1.29 =
|
163 |
-
Fixed: Display only published feeds in feeds selector popup for shortcode
|
164 |
-
Changed: UX improvement - no error message when user first inserts a widget then creates feeds
|
165 |
-
|
166 |
-
= 1.1.28 =
|
167 |
-
Fixed: Conflict with some themes
|
168 |
-
|
169 |
-
= 1.1.27 =
|
170 |
-
Fixed: Overriding window.onload function
|
171 |
-
Changed: Some strings on frontend are translatable now
|
172 |
-
|
173 |
-
= 1.1.26 =
|
174 |
-
Fixed: Conflict with Beaver Builder
|
175 |
-
Fixed: Frontend error messages in old Chrome and Safari browsers
|
176 |
-
Changed: Translations hosted on WordPress.org
|
177 |
-
|
178 |
-
= 1.1.25 =
|
179 |
-
New: UX improvements: when authorizing and editing feeds
|
180 |
-
Changed: JavaScript error notices on frontend
|
181 |
-
Fixed: Updates page restored (PRO)
|
182 |
-
Fixed: Deactivation popup in uninstall page (PRO)
|
183 |
-
Fixed: Subscribe after uninstall
|
184 |
-
|
185 |
-
= 1.1.24 =
|
186 |
-
New: Overview page
|
187 |
-
Changed: Deactivation
|
188 |
-
|
189 |
-
= 1.1.23 =
|
190 |
-
Fixed: cropping of "landscape" images in thumbnails layout
|
191 |
-
|
192 |
-
= 1.1.22 =
|
193 |
-
New: message displayed on frontend if feed has no media
|
194 |
-
Fixed: JS errors for media with Instagram's new "Slideshow" feature. This feature is not supported by Instagram's API yet.
|
195 |
-
Changed: Errors by plugin and Instagram API are alerted in frontend only for admins, otherwise output the message to the Web Console
|
196 |
-
Changed: Custom attribute "wdi_media_user" added to media containers in frontend. Useful for adding different event listeners, e.g. custom redirects for every user's media.
|
197 |
-
Changed: Minor style conflicts fixed
|
198 |
-
|
199 |
-
= 1.1.21 =
|
200 |
-
New: Three new plugins added to featured plugins list: Ad Manager WD, Youtube WD and Staff Team WD
|
201 |
-
Fixed: Colors and opacities of share buttons in lightbox (PRO)
|
202 |
-
|
203 |
-
= 1.1.20 =
|
204 |
-
New: Instagram feed displayed in AJAX-loaded content. AJAX request callback needs to call wp_footer() in the end.
|
205 |
-
|
206 |
-
= 1.1.19 =
|
207 |
-
Fixed: Strange bug in Instagram API when user feed pagination is null, causing JS errors in frontend
|
208 |
-
|
209 |
-
= 1.1.18 =
|
210 |
-
Fixed: Frontend filter colors (PRO)
|
211 |
-
Changed: Featured plugins, brand new Mailchimp Forms WD plugin added
|
212 |
-
|
213 |
-
= 1.1.17 =
|
214 |
-
New: Option in feed settings to show small size images and low-bandwidth videos when viewed in mobile devices
|
215 |
-
Fixed: Escaping in custom JS
|
216 |
-
Change: WP 4.7 compatibility - language of frontend content in AJAX response
|
217 |
-
|
218 |
-
= 1.1.16 =
|
219 |
-
Fixed: Unicode "paragraph separator" symbol in media caption crashes lightbox
|
220 |
-
Fixed: Javascript error in admin feed page and styling issue in lightbox because of some non-standard themes
|
221 |
-
|
222 |
-
= 1.1.15 =
|
223 |
-
New: Show hashtag media number in header
|
224 |
-
Fixed: Scripts dependency on underscore.js
|
225 |
-
Fixed: Compatibility issues with Yoast SEO
|
226 |
-
|
227 |
-
= 1.1.14 =
|
228 |
-
Fixed: Single user bio not shown
|
229 |
-
Changed: Plugin logo
|
230 |
-
Changed: Featured plugins logos
|
231 |
-
|
232 |
-
= 1.1.13 =
|
233 |
-
Fixed: Changes in database after plugin version update via FTP or AJAX requests with silent activation
|
234 |
-
|
235 |
-
= 1.1.12 =
|
236 |
-
New: Feed based on liked media (Pro)
|
237 |
-
Fixed: Hidden media in last page
|
238 |
-
Fixed: Minor issues
|
239 |
-
|
240 |
-
= 1.1.11 =
|
241 |
-
Added: Setting to show media descriptions in widget mode (Pro)
|
242 |
-
Fixed: Untranslatable strings in widget editor
|
243 |
-
Change: Featured plugins list
|
244 |
-
|
245 |
-
= 1.1.10 =
|
246 |
-
Added: New text in uninstall page
|
247 |
-
Added: Featured plugins admin page
|
248 |
-
Fixed: Video not centering issue on blogstyle
|
249 |
-
Added: Swedish translations
|
250 |
-
|
251 |
-
= 1.1.9 =
|
252 |
-
New: Option to set minimal user role for adding and managing feeds and themes
|
253 |
-
Fixed: Masonry feed thumbnails overlay opacity (Pro)
|
254 |
-
|
255 |
-
= 1.1.8 =
|
256 |
-
Changed: Font-Awesome updated to version 4.6.3
|
257 |
-
|
258 |
-
= 1.1.7 =
|
259 |
-
New: Featured themes admin page
|
260 |
-
Fixed: Javascript error in hashtag feed
|
261 |
-
|
262 |
-
= 1.1.6 =
|
263 |
-
Change: Added compatibility with "All in one SEO pack" and other plugins running shortcodes in page head
|
264 |
-
|
265 |
-
= 1.1.5 =
|
266 |
-
Fixed: javascript error on firefox and safari
|
267 |
-
|
268 |
-
= 1.1.4 =
|
269 |
-
Fixed: Error handling in case of wrong access_token
|
270 |
-
Fixed: Image description not opening after pagination (Pro)
|
271 |
-
Fixed: Do not show load more button if feed media are finished
|
272 |
-
Fixed: Infinite scroll triggering bug (Pro)
|
273 |
-
|
274 |
-
= 1.1.3 =
|
275 |
-
New: French translation (Thanks to Guillaume Barjou)
|
276 |
-
New: English US and UK translation files. Edit them to change default strings
|
277 |
-
Fixed: Image sizes and overwflows in thumbnails layout
|
278 |
-
Fixed: Lightbox filmstrip thumb styles (Pro)
|
279 |
-
|
280 |
-
= 1.1.2 =
|
281 |
-
Fixed: Bug when saving theme data to some MySQL 5.6 databases
|
282 |
-
Changed: Pagination of hashtag feeds restored
|
283 |
-
Changed: Check and get user id on frontend if empty for some unknown reason
|
284 |
-
|
285 |
-
= 1.1.1 =
|
286 |
-
fix: bug when duplicating feeds
|
287 |
-
|
288 |
-
= 1.1.0 =
|
289 |
-
new: Instagram new API
|
290 |
-
new: Spanish translation (Thanks to Alexandro Lacadena Gomez)
|
291 |
-
|
292 |
-
= 1.0.10 =
|
293 |
-
Temporarily disable pagination in hashtag based feeds
|
294 |
-
Updated Russian Translations ( Thanks to Alex Petrin )
|
295 |
-
|
296 |
-
= 1.0.9 =
|
297 |
-
Bug fixes
|
298 |
-
|
299 |
-
= 1.0.8 =
|
300 |
-
Show video play button when redirect is enabled
|
301 |
-
|
302 |
-
= 1.0.7 =
|
303 |
-
new: Image Hover Effects
|
304 |
-
|
305 |
-
= 1.0.6 =
|
306 |
-
new: Conditional Filters (Pro)
|
307 |
-
new: Option for displaying username in masonry/thumbnails view (Pro)
|
308 |
-
new: Russian translation (Thanks to Ruslan Tertyshny).
|
309 |
-
|
310 |
-
= 1.0.2 =
|
311 |
-
fix: PHP error after plugin update
|
312 |
-
|
313 |
-
= 1.0.1 =
|
314 |
-
fix: PHP 5.3 compatibility
|
315 |
-
fix: video redirect bug
|
316 |
-
change: user info styles
|
317 |
-
|
318 |
-
= 1.0.0 =
|
319 |
-
Initial version
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
framework/WDILibrary.php
CHANGED
@@ -6,10 +6,10 @@ class WDILibrary {
|
|
6 |
|
7 |
public static function get($key, $default_value = '') {
|
8 |
if (isset($_GET[$key])) {
|
9 |
-
$value = $_GET[$key];
|
10 |
}
|
11 |
elseif (isset($_POST[$key])) {
|
12 |
-
$value = $_POST[$key];
|
13 |
}
|
14 |
else {
|
15 |
$value = '';
|
@@ -17,7 +17,7 @@ class WDILibrary {
|
|
17 |
if (!$value) {
|
18 |
$value = $default_value;
|
19 |
}
|
20 |
-
return
|
21 |
}
|
22 |
|
23 |
public static function message_id($message_id) {
|
@@ -162,6 +162,11 @@ class WDILibrary {
|
|
162 |
$type = 'updated';
|
163 |
break;
|
164 |
}
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
return '<div style="width:99%"><div class="' . $type . '"><p><strong>' . $message . '</strong></p></div></div>';
|
167 |
}
|
@@ -231,7 +236,7 @@ class WDILibrary {
|
|
231 |
</div>
|
232 |
<?php
|
233 |
}
|
234 |
-
|
235 |
public static function html_page_nav($count_items, $page_number, $form_id, $items_per_page = 20) {
|
236 |
$limit = 20;
|
237 |
if ($count_items) {
|
@@ -365,8 +370,8 @@ class WDILibrary {
|
|
365 |
?>
|
366 |
</span>
|
367 |
</div>
|
368 |
-
<input type="hidden" id="page_number" name="page_number" value="<?php echo (
|
369 |
-
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo (
|
370 |
<?php
|
371 |
}
|
372 |
|
@@ -402,18 +407,24 @@ class WDILibrary {
|
|
402 |
"paged" => $page_number
|
403 |
);
|
404 |
|
405 |
-
|
406 |
-
|
|
|
407 |
}
|
408 |
-
|
409 |
-
|
|
|
|
|
410 |
}
|
411 |
-
|
412 |
-
|
|
|
|
|
413 |
}
|
414 |
-
return self::get_page_link(array($page_link_data));
|
415 |
|
|
|
416 |
}
|
|
|
417 |
public static function ajax_search($search_by, $search_value, $form_id) {
|
418 |
?>
|
419 |
<div class="alignleft actions" style="clear:both;">
|
@@ -559,15 +570,15 @@ class WDILibrary {
|
|
559 |
</span>
|
560 |
</div>
|
561 |
<?php if (!$pager) { ?>
|
562 |
-
<input type="hidden" id="page_number" name="page_number" value="<?php echo (
|
563 |
-
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo (
|
564 |
<?php
|
565 |
}
|
566 |
}
|
567 |
|
568 |
public static function ajax_html_frontend_page_nav($theme_row, $count_items, $page_number, $form_id, $limit = 20, $current_view, $id, $cur_alb_gal_id = 0, $type = 'album', $enable_seo = false, $pagination = 1) {
|
569 |
-
$type = (
|
570 |
-
$album_gallery_id = (
|
571 |
if ($count_items) {
|
572 |
if ($count_items % $limit) {
|
573 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1;
|
@@ -663,7 +674,7 @@ class WDILibrary {
|
|
663 |
}
|
664 |
}
|
665 |
?>
|
666 |
-
<input type="hidden" id="page_number_<?php echo $current_view; ?>" name="page_number_<?php echo $current_view; ?>" value="<?php echo (
|
667 |
<script type="text/javascript">
|
668 |
function wdi_spider_page_<?php echo $current_view; ?>(cur, x, y, load_more) {
|
669 |
if (typeof load_more == "undefined") {
|
@@ -728,9 +739,9 @@ class WDILibrary {
|
|
728 |
}
|
729 |
|
730 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
731 |
-
$wdi_search = (
|
732 |
-
$type = (
|
733 |
-
$album_gallery_id = (
|
734 |
?>
|
735 |
<style>
|
736 |
.wdi_search_container_1 {
|
@@ -817,9 +828,9 @@ class WDILibrary {
|
|
817 |
}
|
818 |
|
819 |
public static function ajax_html_frontend_sort_box($form_id, $current_view, $cur_gal_id, $sort_by = '', $search_box_width = 180) {
|
820 |
-
$wdi_search = (
|
821 |
-
$type = (
|
822 |
-
$album_gallery_id = (
|
823 |
?>
|
824 |
<style>
|
825 |
.wdi_order_cont_<?php echo $current_view; ?> {
|
@@ -903,18 +914,15 @@ class WDILibrary {
|
|
903 |
public static function verify_nonce($page){
|
904 |
|
905 |
$nonce_verified = false;
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
elseif ( isset( $_POST['wdi_nonce'] ) && wp_verify_nonce( $_POST['wdi_nonce'], $page )) {
|
910 |
-
$nonce_verified = true;
|
911 |
-
}
|
912 |
-
elseif ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], $page )) {
|
913 |
$nonce_verified = true;
|
914 |
}
|
915 |
-
elseif ( isset( $
|
916 |
$nonce_verified = true;
|
917 |
}
|
|
|
918 |
return $nonce_verified;
|
919 |
}
|
920 |
|
@@ -947,9 +955,6 @@ class WDILibrary {
|
|
947 |
* Using __FUNCTION__ (Magic constant)
|
948 |
* for recursive call
|
949 |
*/
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
return array_map(array('WDILibrary','objectToArray'), $d);
|
954 |
}
|
955 |
else {
|
@@ -970,13 +975,13 @@ class WDILibrary {
|
|
970 |
$users = json_decode($feed_row['feed_users']);
|
971 |
$new_users_list = array();
|
972 |
$users_list = self::get_users_list();
|
973 |
-
|
974 |
-
|
975 |
-
if(substr($user->username,0,1) === '#' || $user->username === $wdi_options['wdi_user_name'] || !empty($users_list[$user->username])){
|
976 |
-
|
|
|
977 |
}
|
978 |
}
|
979 |
-
|
980 |
$feed_row['nothing_to_display'] = (empty($new_users_list)) ? '1' : '0';
|
981 |
$feed_row['feed_users'] = json_encode($new_users_list);
|
982 |
|
@@ -1065,11 +1070,12 @@ class WDILibrary {
|
|
1065 |
}
|
1066 |
}
|
1067 |
|
1068 |
-
public static function get_page_link($data){
|
1069 |
$page = WDILibrary::get('page');
|
1070 |
$url = add_query_arg(array( 'page' => $page, $data ), admin_url('admin.php'));
|
1071 |
return $url;
|
1072 |
}
|
|
|
1073 |
public static function get_shortcode_data() {
|
1074 |
global $wpdb;
|
1075 |
require_once WDI_DIR . "/admin/models/WDIModelEditorShortcode.php";
|
@@ -1099,7 +1105,7 @@ class WDILibrary {
|
|
1099 |
$new_url = urlencode(admin_url('admin.php?page=wdi_settings')) . '&response_type=token&state='. admin_url('admin.php?wdi_settings');
|
1100 |
?>
|
1101 |
<a onclick="document.cookie = 'wdi_autofill=true'" class="wdi_sign_in_button"
|
1102 |
-
href="https://api.instagram.com/oauth/authorize/?client_id=54da896cf80343ecb0e356ac5479d9ec&scope=basic
|
1103 |
<?php echo $text; ?>
|
1104 |
</a>
|
1105 |
<?php
|
@@ -1118,9 +1124,8 @@ class WDILibrary {
|
|
1118 |
}
|
1119 |
|
1120 |
public static function get_user_access_token($users){
|
1121 |
-
|
1122 |
$users_list = self::get_users_list();
|
1123 |
-
|
1124 |
foreach($users as $user) {
|
1125 |
if(substr($user->username, 0, 1) === '#') {
|
1126 |
continue;
|
@@ -1135,7 +1140,6 @@ class WDILibrary {
|
|
1135 |
return $wdi_options['wdi_access_token'];
|
1136 |
}
|
1137 |
|
1138 |
-
|
1139 |
public static function localize_script($object_name, $l10n){
|
1140 |
foreach ( (array) $l10n as $key => $value ) {
|
1141 |
if ( !is_scalar($value) )
|
6 |
|
7 |
public static function get($key, $default_value = '') {
|
8 |
if (isset($_GET[$key])) {
|
9 |
+
$value = sanitize_text_field($_GET[$key]);
|
10 |
}
|
11 |
elseif (isset($_POST[$key])) {
|
12 |
+
$value = sanitize_text_field($_POST[$key]);
|
13 |
}
|
14 |
else {
|
15 |
$value = '';
|
17 |
if (!$value) {
|
18 |
$value = $default_value;
|
19 |
}
|
20 |
+
return $value;
|
21 |
}
|
22 |
|
23 |
public static function message_id($message_id) {
|
162 |
$type = 'updated';
|
163 |
break;
|
164 |
}
|
165 |
+
case 25: {
|
166 |
+
$message = "Style file generation failed. Maybe you don't have write permissions on wp-content/uploads folder. Your Instagram feed theme styles will be written inline.";
|
167 |
+
$type = 'error';
|
168 |
+
break;
|
169 |
+
}
|
170 |
}
|
171 |
return '<div style="width:99%"><div class="' . $type . '"><p><strong>' . $message . '</strong></p></div></div>';
|
172 |
}
|
236 |
</div>
|
237 |
<?php
|
238 |
}
|
239 |
+
|
240 |
public static function html_page_nav($count_items, $page_number, $form_id, $items_per_page = 20) {
|
241 |
$limit = 20;
|
242 |
if ($count_items) {
|
370 |
?>
|
371 |
</span>
|
372 |
</div>
|
373 |
+
<input type="hidden" id="page_number" name="page_number" value="<?php echo (int) WDILibrary::get('page_number',1); ?>" />
|
374 |
+
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo WDILibrary::get('search_or_not', ''); ?>"/>
|
375 |
<?php
|
376 |
}
|
377 |
|
407 |
"paged" => $page_number
|
408 |
);
|
409 |
|
410 |
+
$search = WDILibrary::get('search', '');
|
411 |
+
if( !empty($search) ){
|
412 |
+
$page_link_data['search'] = $search;
|
413 |
}
|
414 |
+
|
415 |
+
$order_by = WDILibrary::get('order_by', '');
|
416 |
+
if( !empty($order_by) ) {
|
417 |
+
$page_link_data['order_by'] = $order_by;
|
418 |
}
|
419 |
+
|
420 |
+
$order = WDILibrary::get('order', '');
|
421 |
+
if( !empty($order) ) {
|
422 |
+
$page_link_data['order'] = $order;
|
423 |
}
|
|
|
424 |
|
425 |
+
return self::get_page_link(array($page_link_data));
|
426 |
}
|
427 |
+
|
428 |
public static function ajax_search($search_by, $search_value, $form_id) {
|
429 |
?>
|
430 |
<div class="alignleft actions" style="clear:both;">
|
570 |
</span>
|
571 |
</div>
|
572 |
<?php if (!$pager) { ?>
|
573 |
+
<input type="hidden" id="page_number" name="page_number" value="<?php echo (int) WDILibrary::get('page_number', 1); ?>" />
|
574 |
+
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo WDILibrary::get('search_or_not', ''); ?>"/>
|
575 |
<?php
|
576 |
}
|
577 |
}
|
578 |
|
579 |
public static function ajax_html_frontend_page_nav($theme_row, $count_items, $page_number, $form_id, $limit = 20, $current_view, $id, $cur_alb_gal_id = 0, $type = 'album', $enable_seo = false, $pagination = 1) {
|
580 |
+
$type = WDILibrary::get('type_' . $current_view, $type);
|
581 |
+
$album_gallery_id = WDILibrary::get('album_gallery_id_' . $current_view, $cur_alb_gal_id);
|
582 |
if ($count_items) {
|
583 |
if ($count_items % $limit) {
|
584 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1;
|
674 |
}
|
675 |
}
|
676 |
?>
|
677 |
+
<input type="hidden" id="page_number_<?php echo $current_view; ?>" name="page_number_<?php echo $current_view; ?>" value="<?php echo (int) WDILibrary::get('page_number_' . $current_view, 1); ?>" />
|
678 |
<script type="text/javascript">
|
679 |
function wdi_spider_page_<?php echo $current_view; ?>(cur, x, y, load_more) {
|
680 |
if (typeof load_more == "undefined") {
|
739 |
}
|
740 |
|
741 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
742 |
+
$wdi_search = WDILibrary::get('wdi_search_' . $current_view, '');
|
743 |
+
$type = WDILibrary::get('type_' . $current_view, 'album');
|
744 |
+
$album_gallery_id = (int) WDILibrary::get('album_gallery_id_' . $current_view, 0);
|
745 |
?>
|
746 |
<style>
|
747 |
.wdi_search_container_1 {
|
828 |
}
|
829 |
|
830 |
public static function ajax_html_frontend_sort_box($form_id, $current_view, $cur_gal_id, $sort_by = '', $search_box_width = 180) {
|
831 |
+
$wdi_search = WDILibrary::get('wdi_search_' . $current_view, '');
|
832 |
+
$type = WDILibrary::get('type_' . $current_view, 'album');
|
833 |
+
$album_gallery_id = (int) WDILibrary::get('album_gallery_id_' . $current_view, 'album');
|
834 |
?>
|
835 |
<style>
|
836 |
.wdi_order_cont_<?php echo $current_view; ?> {
|
914 |
public static function verify_nonce($page){
|
915 |
|
916 |
$nonce_verified = false;
|
917 |
+
$wdi_nonce = WDILibrary::get('wdi_nonce', '');
|
918 |
+
$_wpnonce = WDILibrary::get('_wpnonce', '');
|
919 |
+
if ( isset( $wdi_nonce ) && wp_verify_nonce( $wdi_nonce, $page )) {
|
|
|
|
|
|
|
|
|
920 |
$nonce_verified = true;
|
921 |
}
|
922 |
+
elseif ( isset( $_wpnonce ) && wp_verify_nonce( $_wpnonce, $page )) {
|
923 |
$nonce_verified = true;
|
924 |
}
|
925 |
+
|
926 |
return $nonce_verified;
|
927 |
}
|
928 |
|
955 |
* Using __FUNCTION__ (Magic constant)
|
956 |
* for recursive call
|
957 |
*/
|
|
|
|
|
|
|
958 |
return array_map(array('WDILibrary','objectToArray'), $d);
|
959 |
}
|
960 |
else {
|
975 |
$users = json_decode($feed_row['feed_users']);
|
976 |
$new_users_list = array();
|
977 |
$users_list = self::get_users_list();
|
978 |
+
if(is_array($users)) {
|
979 |
+
foreach($users as $i => $user) {
|
980 |
+
if(substr($user->username, 0, 1) === '#' || $user->username === $wdi_options['wdi_user_name'] || !empty($users_list[$user->username])) {
|
981 |
+
$new_users_list[] = $user;
|
982 |
+
}
|
983 |
}
|
984 |
}
|
|
|
985 |
$feed_row['nothing_to_display'] = (empty($new_users_list)) ? '1' : '0';
|
986 |
$feed_row['feed_users'] = json_encode($new_users_list);
|
987 |
|
1070 |
}
|
1071 |
}
|
1072 |
|
1073 |
+
public static function get_page_link( $data ){
|
1074 |
$page = WDILibrary::get('page');
|
1075 |
$url = add_query_arg(array( 'page' => $page, $data ), admin_url('admin.php'));
|
1076 |
return $url;
|
1077 |
}
|
1078 |
+
|
1079 |
public static function get_shortcode_data() {
|
1080 |
global $wpdb;
|
1081 |
require_once WDI_DIR . "/admin/models/WDIModelEditorShortcode.php";
|
1105 |
$new_url = urlencode(admin_url('admin.php?page=wdi_settings')) . '&response_type=token&state='. admin_url('admin.php?wdi_settings');
|
1106 |
?>
|
1107 |
<a onclick="document.cookie = 'wdi_autofill=true'" class="wdi_sign_in_button"
|
1108 |
+
href="https://api.instagram.com/oauth/authorize/?client_id=54da896cf80343ecb0e356ac5479d9ec&scope=basic&redirect_uri=http://api.web-dorado.com/instagram/?return_url=<?php echo $new_url; ?>">
|
1109 |
<?php echo $text; ?>
|
1110 |
</a>
|
1111 |
<?php
|
1124 |
}
|
1125 |
|
1126 |
public static function get_user_access_token($users){
|
1127 |
+
global $wdi_options;
|
1128 |
$users_list = self::get_users_list();
|
|
|
1129 |
foreach($users as $user) {
|
1130 |
if(substr($user->username, 0, 1) === '#') {
|
1131 |
continue;
|
1140 |
return $wdi_options['wdi_access_token'];
|
1141 |
}
|
1142 |
|
|
|
1143 |
public static function localize_script($object_name, $l10n){
|
1144 |
foreach ( (array) $l10n as $key => $value ) {
|
1145 |
if ( !is_scalar($value) )
|
framework/WDI_admin_view.php
CHANGED
@@ -1334,21 +1334,11 @@ class WDI_admin_view{
|
|
1334 |
?>
|
1335 |
</span>
|
1336 |
</div>
|
1337 |
-
<input type="hidden" id="page_number" name="page_number" value="<?php echo (
|
1338 |
-
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo (
|
1339 |
<?php
|
1340 |
}
|
1341 |
|
1342 |
-
|
1343 |
-
|
1344 |
-
/**
|
1345 |
-
*
|
1346 |
-
*
|
1347 |
-
*
|
1348 |
-
*/
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
private function merge_params($param_begin_low_prioritet,$param_last_high_priorete){
|
1353 |
$new_param=array();
|
1354 |
foreach($param_begin_low_prioritet as $key=>$value){
|
1334 |
?>
|
1335 |
</span>
|
1336 |
</div>
|
1337 |
+
<input type="hidden" id="page_number" name="page_number" value="<?php echo (int) WDILibrary::get('page_number', 1); ?>" />
|
1338 |
+
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo WDILibrary::get('search_or_not', ''); ?>"/>
|
1339 |
<?php
|
1340 |
}
|
1341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1342 |
private function merge_params($param_begin_low_prioritet,$param_last_high_priorete){
|
1343 |
$new_param=array();
|
1344 |
foreach($param_begin_low_prioritet as $key=>$value){
|
frontend/controllers/WDIControllerGalleryBox.php
CHANGED
@@ -1,25 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerGalleryBox {
|
4 |
-
|
5 |
-
// Events //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constants //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// Variables //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
-
// Constructor & Destructor //
|
15 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
16 |
public function __construct() {
|
17 |
}
|
18 |
-
|
19 |
-
// Public Methods //
|
20 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
-
$ajax_task = (
|
23 |
if (method_exists($this, $ajax_task)) {
|
24 |
$this->$ajax_task();
|
25 |
}
|
@@ -37,105 +24,4 @@ class WDIControllerGalleryBox {
|
|
37 |
|
38 |
$view->display();
|
39 |
}
|
40 |
-
|
41 |
-
public function save() {
|
42 |
-
require_once WDI_DIR . "/frontend/models/WDIModelGalleryBox.php";
|
43 |
-
$model = new WDIModelGalleryBox();
|
44 |
-
$option_row = $model->get_option_row_data();
|
45 |
-
if ($option_row->popup_enable_email) {
|
46 |
-
// Email validation.
|
47 |
-
$email = (isset($_POST['wdi_email']) ? is_email(stripslashes($_POST['wdi_email'])) : FALSE);
|
48 |
-
}
|
49 |
-
else {
|
50 |
-
$email = TRUE;
|
51 |
-
}
|
52 |
-
if ($option_row->popup_enable_captcha) {
|
53 |
-
$wdi_captcha_input = (isset($_POST['wdi_captcha_input']) ? esc_html(stripslashes($_POST['wdi_captcha_input'])) : '');
|
54 |
-
@session_start();
|
55 |
-
$wdi_captcha_code = (isset($_SESSION['wdi_captcha_code']) ? esc_html(stripslashes($_SESSION['wdi_captcha_code'])) : '');
|
56 |
-
if ($wdi_captcha_input === $wdi_captcha_code) {
|
57 |
-
$captcha = TRUE;
|
58 |
-
}
|
59 |
-
else {
|
60 |
-
$captcha = FALSE;
|
61 |
-
}
|
62 |
-
}
|
63 |
-
else {
|
64 |
-
$captcha = TRUE;
|
65 |
-
}
|
66 |
-
|
67 |
-
if ($email && $captcha) {
|
68 |
-
global $wpdb;
|
69 |
-
$image_id = (isset($_POST['image_id']) ? (int) $_POST['image_id'] : 0);
|
70 |
-
$name = (isset($_POST['wdi_name']) ? esc_html(stripslashes($_POST['wdi_name'])) : '');
|
71 |
-
$wdi_comment = (isset($_POST['wdi_comment']) ? esc_html(stripslashes($_POST['wdi_comment'])) : '');
|
72 |
-
$wdi_email = (isset($_POST['wdi_email']) ? esc_html(stripslashes($_POST['wdi_email'])) : '');
|
73 |
-
$published = (current_user_can('manage_options') || !$option_row->comment_moderation) ? 1 : 0;
|
74 |
-
$save = $wpdb->insert($wpdb->prefix . 'wdi_image_comment', array(
|
75 |
-
'image_id' => $image_id,
|
76 |
-
'name' => $name,
|
77 |
-
'date' => date('Y-m-d H:i'),
|
78 |
-
'comment' => $wdi_comment,
|
79 |
-
'url' => '',
|
80 |
-
'mail' => $wdi_email,
|
81 |
-
'published' => $published,
|
82 |
-
), array(
|
83 |
-
'%d',
|
84 |
-
'%s',
|
85 |
-
'%s',
|
86 |
-
'%s',
|
87 |
-
'%s',
|
88 |
-
'%s',
|
89 |
-
'%d',
|
90 |
-
));
|
91 |
-
$wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'wdi_image SET comment_count=comment_count+1 WHERE id="%d"', $image_id));
|
92 |
-
}
|
93 |
-
$this->display();
|
94 |
-
}
|
95 |
-
|
96 |
-
public function save_rate() {
|
97 |
-
global $wpdb;
|
98 |
-
$image_id = (isset($_POST['image_id']) ? esc_html(stripslashes($_POST['image_id'])) : 0);
|
99 |
-
$rate = (isset($_POST['rate']) ? esc_html(stripslashes($_POST['rate'])) : '');
|
100 |
-
if (!$wpdb->get_var($wpdb->prepare('SELECT image_id FROM ' . $wpdb->prefix . 'wdi_image_rate WHERE ip="%s" AND image_id="%d"', $_SERVER['REMOTE_ADDR'], $image_id))) {
|
101 |
-
$wpdb->insert($wpdb->prefix . 'wdi_image_rate', array(
|
102 |
-
'image_id' => $image_id,
|
103 |
-
'rate' => $rate,
|
104 |
-
'ip' => $_SERVER['REMOTE_ADDR'],
|
105 |
-
'date' => date('Y-m-d H:i:s'),
|
106 |
-
), array(
|
107 |
-
'%d',
|
108 |
-
'%f',
|
109 |
-
'%s',
|
110 |
-
'%s',
|
111 |
-
));
|
112 |
-
$rates = $wpdb->get_row($wpdb->prepare('SELECT AVG(`rate`) as `average`, COUNT(`rate`) as `rate_count` FROM ' . $wpdb->prefix . 'wdi_image_rate WHERE image_id="%d"', $image_id));
|
113 |
-
$wpdb->update($wpdb->prefix . 'wdi_image', array('avg_rating' => $rates->average, 'rate_count' => $rates->rate_count), array('id' => $image_id));
|
114 |
-
}
|
115 |
-
$this->display();
|
116 |
-
}
|
117 |
-
|
118 |
-
public function save_hit_count() {
|
119 |
-
global $wpdb;
|
120 |
-
$image_id = (isset($_POST['image_id']) ? esc_html(stripslashes($_POST['image_id'])) : 0);
|
121 |
-
$wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'wdi_image SET hit_count = hit_count + 1 WHERE id="%d"', $image_id));
|
122 |
-
}
|
123 |
-
|
124 |
-
public function delete() {
|
125 |
-
global $wpdb;
|
126 |
-
$comment_id = (isset($_POST['comment_id']) ? (int) $_POST['comment_id'] : 0);
|
127 |
-
$image_id = (isset($_POST['image_id']) ? (int) $_POST['image_id'] : 0);
|
128 |
-
$wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wdi_image_comment WHERE id="%d"', $comment_id));
|
129 |
-
$wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->prefix . 'wdi_image SET comment_count=comment_count-1 WHERE id="%d"', $image_id));
|
130 |
-
$this->display();
|
131 |
-
}
|
132 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
133 |
-
// Getters & Setters //
|
134 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
135 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
136 |
-
// Private Methods //
|
137 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
138 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
139 |
-
// Listeners //
|
140 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
141 |
}
|
1 |
<?php
|
2 |
|
3 |
class WDIControllerGalleryBox {
|
4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
public function __construct() {
|
6 |
}
|
7 |
+
|
|
|
|
|
8 |
public function execute() {
|
9 |
+
$ajax_task = WDILibrary::get('ajax_task', '');
|
10 |
if (method_exists($this, $ajax_task)) {
|
11 |
$this->$ajax_task();
|
12 |
}
|
24 |
|
25 |
$view->display();
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
frontend/controllers/WDIControllerThumbnails_view.php
CHANGED
@@ -1,36 +1,19 @@
|
|
1 |
<?php
|
2 |
-
class WDIControllerThumbnails_view{
|
3 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
4 |
-
// Events //
|
5 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
// Constants //
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
// Variables //
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
-
// Constructor & Destructor //
|
14 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
15 |
-
public function __construct() {
|
16 |
-
}
|
17 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
18 |
-
// Public Methods //
|
19 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
20 |
-
public function execute($feed_row,$wdi_feed_counter){
|
21 |
-
//including model
|
22 |
-
require_once(WDI_DIR .'/frontend/models/WDIModelThumbnails_view.php');
|
23 |
-
$model = new WDIModelThumbnails_view($feed_row,$wdi_feed_counter);
|
24 |
-
//including view
|
25 |
-
require_once(WDI_DIR .'/frontend/views/WDIViewThumbnails_view.php');
|
26 |
-
$view = new WDIViewThumbnails_view($model);
|
27 |
-
$view->display();
|
28 |
-
}
|
29 |
-
|
30 |
-
|
31 |
|
|
|
32 |
|
|
|
|
|
33 |
|
|
|
|
|
|
|
|
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
?>
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
class WDIControllerThumbnails_view{
|
4 |
|
5 |
+
public function __construct() {
|
6 |
+
}
|
7 |
|
8 |
+
public function execute($feed_row,$wdi_feed_counter){
|
9 |
+
//including model
|
10 |
+
require_once(WDI_DIR .'/frontend/models/WDIModelThumbnails_view.php');
|
11 |
+
$model = new WDIModelThumbnails_view($feed_row,$wdi_feed_counter);
|
12 |
|
13 |
+
//including view
|
14 |
+
require_once(WDI_DIR .'/frontend/views/WDIViewThumbnails_view.php');
|
15 |
+
$view = new WDIViewThumbnails_view($model);
|
16 |
+
$view->display();
|
17 |
+
}
|
18 |
}
|
19 |
?>
|
frontend/models/WDIModelGalleryBox.php
CHANGED
@@ -86,7 +86,7 @@ public function get_feed_row_data($id) {
|
|
86 |
private function check_settings($settings){
|
87 |
$settings = WDILibrary::objectToArray($settings);
|
88 |
if(isset($settings['feed_users']) && count(explode(',', $settings['feed_users']))>1){
|
89 |
-
|
90 |
$settings['feed_users'] = $settings['feed_users'][0];
|
91 |
};
|
92 |
if(isset($settings['theme_id']) && intval($settings['theme_id']) > 1){
|
86 |
private function check_settings($settings){
|
87 |
$settings = WDILibrary::objectToArray($settings);
|
88 |
if(isset($settings['feed_users']) && count(explode(',', $settings['feed_users']))>1){
|
89 |
+
$settings['feed_users'] = explode(',', $settings['feed_users']);
|
90 |
$settings['feed_users'] = $settings['feed_users'][0];
|
91 |
};
|
92 |
if(isset($settings['theme_id']) && intval($settings['theme_id']) > 1){
|
frontend/shortcode.php
CHANGED
@@ -1,54 +1,47 @@
|
|
1 |
<?php
|
2 |
//global counter for webpage feeds
|
3 |
-
/*
|
4 |
$wdi_feed_counter = 0;
|
5 |
|
6 |
add_action('init', 'wdi_frontend_init');
|
7 |
|
8 |
function wdi_frontend_init()
|
9 |
{
|
|
|
10 |
global $wdi_options;
|
11 |
$wdi_options = get_option(WDI_OPT);
|
12 |
}
|
13 |
|
14 |
add_shortcode('wdi_feed', 'wdi_feed');
|
15 |
add_shortcode('wdi_preview', 'wdi_feed');
|
16 |
-
|
17 |
function wdi_feed($atts, $widget_params = '')
|
18 |
{
|
|
|
19 |
global $post;
|
20 |
-
|
21 |
ob_start();
|
22 |
global $wdi_feed_counter;
|
23 |
-
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
24 |
|
25 |
wdi_register_frontend_scripts();
|
26 |
-
|
27 |
-
if(WDILibrary::is_ajax() || WDILibrary::elementor_is_active()) {
|
28 |
-
|
29 |
if ($wdi_feed_counter == 0) {
|
30 |
-
|
31 |
$wdi_feed_counter = rand(1000, 9999);
|
32 |
global $wdi_feed_counter_init;
|
33 |
$wdi_feed_counter_init = $wdi_feed_counter;
|
34 |
}
|
35 |
-
|
36 |
//load scripts and styles from view files
|
37 |
} else {
|
38 |
wdi_load_frontend_scripts();
|
39 |
}
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
if(isset($_GET["feed_id"]) && $post->post_type === "wdi_instagram" && $widget_params === ""){
|
44 |
if(!is_array($atts)) {
|
45 |
$atts = array();
|
46 |
}
|
47 |
-
$atts["id"] = $
|
48 |
}
|
49 |
-
$attributes = shortcode_atts(array(
|
50 |
-
'id' => 'no_id',
|
51 |
-
), $atts);
|
52 |
if ($attributes['id'] == 'no_id') {
|
53 |
//including feed model
|
54 |
require_once(WDI_DIR . '/admin/models/WDIModelEditorShortcode.php');
|
@@ -63,23 +56,17 @@ function wdi_feed($atts, $widget_params = '')
|
|
63 |
return __('No feed. Create and publish a feed to display it.', "wd-instagram-feed");
|
64 |
}
|
65 |
/*else continue*/
|
66 |
-
|
67 |
}
|
68 |
-
|
69 |
-
|
70 |
//including feed model
|
71 |
require_once(WDI_DIR . '/admin/models/WDIModelFeeds_wdi.php');
|
72 |
$feed_model = new WDIModelFeeds_wdi();
|
73 |
//getting all feed information from db
|
74 |
$feed_row = WDILibrary::objectToArray($feed_model->get_feed_row($attributes['id']));
|
75 |
$feed_row = WDILibrary::keep_only_self_user($feed_row);
|
76 |
-
|
77 |
if($feed_row['nothing_to_display'] === '1'){
|
78 |
ob_get_clean();
|
79 |
return __('Cannot get other user media. API shut down by Instagram. Sorry. Display only your media.', "wd-instagram-feed");
|
80 |
}
|
81 |
-
|
82 |
-
|
83 |
//checking if access token is not set or removed display proper error message
|
84 |
global $wdi_options;
|
85 |
if ((!isset($wdi_options['wdi_access_token']) || $wdi_options['wdi_access_token'] == '') && empty($wdi_options['fb_token'])) {
|
@@ -92,7 +79,6 @@ function wdi_feed($atts, $widget_params = '')
|
|
92 |
return __('Feed with such ID does not exist', "wd-instagram-feed");
|
93 |
}
|
94 |
|
95 |
-
|
96 |
$feed_row['widget'] = false;
|
97 |
if ($widget_params != '' && $widget_params['widget'] == true) {
|
98 |
$feed_row['widget'] = true;
|
@@ -104,12 +90,6 @@ function wdi_feed($atts, $widget_params = '')
|
|
104 |
$feed_row['show_description'] = '0';
|
105 |
$feed_row['number_of_columns'] = (string)$widget_params['number_of_columns'];
|
106 |
|
107 |
-
// if($feed_row['feed_display_view'] == "load_more_btn" || $feed_row['feed_display_view'] == "infinite_scroll") {
|
108 |
-
// $feed_row['load_more_number'] = (string)$widget_params['widget_image_num'];
|
109 |
-
// } else if($feed_row['feed_display_view'] == "pagination") {
|
110 |
-
// $feed_row['pagination_per_page_number'] = (string)$widget_params['widget_image_num'];
|
111 |
-
// }
|
112 |
-
|
113 |
if ($widget_params['enable_loading_buttons'] == 0) {
|
114 |
$feed_row['feed_display_view'] = 'none';
|
115 |
}
|
@@ -121,6 +101,7 @@ function wdi_feed($atts, $widget_params = '')
|
|
121 |
}
|
122 |
//checking feed type and using proper MVC
|
123 |
$feed_type = isset($feed_row['feed_type']) ? $feed_row['feed_type'] : '';
|
|
|
124 |
switch ($feed_type) {
|
125 |
case 'thumbnails': {
|
126 |
//including thumbnails controller
|
@@ -144,8 +125,6 @@ function wdi_feed($atts, $widget_params = '')
|
|
144 |
}
|
145 |
|
146 |
}
|
147 |
-
|
148 |
-
|
149 |
global $wdi_options;
|
150 |
if (isset($wdi_options['wdi_custom_css'])) {
|
151 |
?>
|
@@ -162,7 +141,6 @@ function wdi_feed($atts, $widget_params = '')
|
|
162 |
<?php
|
163 |
}
|
164 |
|
165 |
-
|
166 |
return ob_get_clean();
|
167 |
}
|
168 |
|
1 |
<?php
|
2 |
//global counter for webpage feeds
|
3 |
+
/* This will not work in case of AJAX request, note that for future versions */
|
4 |
$wdi_feed_counter = 0;
|
5 |
|
6 |
add_action('init', 'wdi_frontend_init');
|
7 |
|
8 |
function wdi_frontend_init()
|
9 |
{
|
10 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
11 |
global $wdi_options;
|
12 |
$wdi_options = get_option(WDI_OPT);
|
13 |
}
|
14 |
|
15 |
add_shortcode('wdi_feed', 'wdi_feed');
|
16 |
add_shortcode('wdi_preview', 'wdi_feed');
|
17 |
+
|
18 |
function wdi_feed($atts, $widget_params = '')
|
19 |
{
|
20 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
21 |
global $post;
|
|
|
22 |
ob_start();
|
23 |
global $wdi_feed_counter;
|
|
|
24 |
|
25 |
wdi_register_frontend_scripts();
|
26 |
+
if( WDILibrary::is_ajax() || WDILibrary::elementor_is_active() ) {
|
|
|
|
|
27 |
if ($wdi_feed_counter == 0) {
|
|
|
28 |
$wdi_feed_counter = rand(1000, 9999);
|
29 |
global $wdi_feed_counter_init;
|
30 |
$wdi_feed_counter_init = $wdi_feed_counter;
|
31 |
}
|
|
|
32 |
//load scripts and styles from view files
|
33 |
} else {
|
34 |
wdi_load_frontend_scripts();
|
35 |
}
|
36 |
|
37 |
+
$feed_id = WDILibrary::get('feed_id', '');
|
38 |
+
if(isset($feed_id) && $post->post_type === "wdi_instagram" && $widget_params === ""){
|
|
|
39 |
if(!is_array($atts)) {
|
40 |
$atts = array();
|
41 |
}
|
42 |
+
$atts["id"] = $feed_id;
|
43 |
}
|
44 |
+
$attributes = shortcode_atts(array('id' => 'no_id'), $atts);
|
|
|
|
|
45 |
if ($attributes['id'] == 'no_id') {
|
46 |
//including feed model
|
47 |
require_once(WDI_DIR . '/admin/models/WDIModelEditorShortcode.php');
|
56 |
return __('No feed. Create and publish a feed to display it.', "wd-instagram-feed");
|
57 |
}
|
58 |
/*else continue*/
|
|
|
59 |
}
|
|
|
|
|
60 |
//including feed model
|
61 |
require_once(WDI_DIR . '/admin/models/WDIModelFeeds_wdi.php');
|
62 |
$feed_model = new WDIModelFeeds_wdi();
|
63 |
//getting all feed information from db
|
64 |
$feed_row = WDILibrary::objectToArray($feed_model->get_feed_row($attributes['id']));
|
65 |
$feed_row = WDILibrary::keep_only_self_user($feed_row);
|
|
|
66 |
if($feed_row['nothing_to_display'] === '1'){
|
67 |
ob_get_clean();
|
68 |
return __('Cannot get other user media. API shut down by Instagram. Sorry. Display only your media.', "wd-instagram-feed");
|
69 |
}
|
|
|
|
|
70 |
//checking if access token is not set or removed display proper error message
|
71 |
global $wdi_options;
|
72 |
if ((!isset($wdi_options['wdi_access_token']) || $wdi_options['wdi_access_token'] == '') && empty($wdi_options['fb_token'])) {
|
79 |
return __('Feed with such ID does not exist', "wd-instagram-feed");
|
80 |
}
|
81 |
|
|
|
82 |
$feed_row['widget'] = false;
|
83 |
if ($widget_params != '' && $widget_params['widget'] == true) {
|
84 |
$feed_row['widget'] = true;
|
90 |
$feed_row['show_description'] = '0';
|
91 |
$feed_row['number_of_columns'] = (string)$widget_params['number_of_columns'];
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
if ($widget_params['enable_loading_buttons'] == 0) {
|
94 |
$feed_row['feed_display_view'] = 'none';
|
95 |
}
|
101 |
}
|
102 |
//checking feed type and using proper MVC
|
103 |
$feed_type = isset($feed_row['feed_type']) ? $feed_row['feed_type'] : '';
|
104 |
+
|
105 |
switch ($feed_type) {
|
106 |
case 'thumbnails': {
|
107 |
//including thumbnails controller
|
125 |
}
|
126 |
|
127 |
}
|
|
|
|
|
128 |
global $wdi_options;
|
129 |
if (isset($wdi_options['wdi_custom_css'])) {
|
130 |
?>
|
141 |
<?php
|
142 |
}
|
143 |
|
|
|
144 |
return ob_get_clean();
|
145 |
}
|
146 |
|
frontend/views/WDIViewGalleryBox.php
CHANGED
@@ -1,56 +1,43 @@
|
|
1 |
<?php
|
2 |
|
3 |
class WDIViewGalleryBox {
|
4 |
-
|
5 |
-
// Events //
|
6 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
// Constants //
|
9 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// Variables //
|
12 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
13 |
private $model;
|
14 |
-
|
15 |
-
// Constructor & Destructor //
|
16 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
17 |
public function __construct($model) {
|
18 |
$this->model = $model;
|
19 |
}
|
20 |
-
|
21 |
-
// Public Methods //
|
22 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
23 |
public function display() {
|
24 |
global $WD_WDI_UPLOAD_DIR;
|
25 |
global $wp;
|
26 |
require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
|
27 |
|
28 |
-
|
29 |
-
$current_feed = $this->model->get_feed_row_data($
|
30 |
|
31 |
$theme_row = WDILibrary::arrayToObject($this->model->get_theme_row_data($current_feed['theme_id']));
|
32 |
$option_row = WDILibrary::arrayToObject($current_feed);
|
33 |
$option_row->preload_images_count = 0;
|
34 |
-
$option_row->enable_addthis = 0;
|
35 |
$option_row->popup_enable_captcha = 0;
|
36 |
$option_row->popup_enable_email = 0;
|
37 |
|
38 |
//////////////////////////////////////////////////////////////////
|
39 |
-
|
40 |
-
$current_url = (
|
41 |
-
$tag_id = (
|
42 |
$gallery_id = (isset($current_feed['id']) ? esc_html($current_feed['id']) : 0);
|
43 |
-
$wdi = (
|
44 |
-
$current_image_id = (
|
45 |
-
$current_image_index = (
|
46 |
$theme_id = (isset($current_feed['theme_id']) ? esc_html($current_feed['theme_id']) : 1);
|
47 |
|
48 |
-
|
49 |
$carousel_media = json_decode(stripslashes($carousel_media_row), true);
|
50 |
$carousel_media = is_array($carousel_media) ? $carousel_media : array();
|
51 |
-
|
52 |
-
$thumb_width = (
|
53 |
-
$thumb_height = (
|
54 |
|
55 |
$open_with_fullscreen = (isset($current_feed['popup_fullscreen']) ? esc_html($current_feed['popup_fullscreen']) : 0);
|
56 |
$open_with_autoplay = (isset($current_feed['popup_autoplay']) ? esc_html($current_feed['popup_autoplay']) : 0);
|
@@ -59,8 +46,8 @@ class WDIViewGalleryBox {
|
|
59 |
|
60 |
$image_effect = (isset($current_feed['popup_type']) && esc_html(isset($current_feed['popup_type'])) ? esc_html($current_feed['popup_type']) : 'fade');
|
61 |
|
62 |
-
$sort_by = (
|
63 |
-
$order_by = (
|
64 |
|
65 |
$enable_image_filmstrip = (isset($current_feed['popup_enable_filmstrip']) ? esc_html($current_feed['popup_enable_filmstrip']) : 0);
|
66 |
$enable_image_fullscreen = (isset($current_feed['popup_enable_fullscreen']) ? esc_html($current_feed['popup_enable_fullscreen']) : 0);/*watch later*/
|
@@ -116,11 +103,11 @@ class WDIViewGalleryBox {
|
|
116 |
}
|
117 |
|
118 |
|
119 |
-
$json =
|
120 |
str_replace('"',""", $json);
|
121 |
|
122 |
$image_rows = json_decode(stripslashes($json));
|
123 |
-
$image_rows_count = (
|
124 |
$image_rows = WDILibrary::arrayToObject($image_rows);
|
125 |
|
126 |
/////////////////////////////////Parametes for deprecated content////////////////////
|
@@ -128,9 +115,7 @@ class WDIViewGalleryBox {
|
|
128 |
$theme_row->lightbox_rate_size = 0;
|
129 |
/////////////////////////////////////////////////////////////////////////////////////
|
130 |
|
131 |
-
$image_id = (
|
132 |
-
//$comment_rows = $this->model->get_comment_rows_data($image_id);
|
133 |
-
|
134 |
$params_array = array(
|
135 |
'action' => 'GalleryBox',
|
136 |
'image_id' => $current_image_id,
|
@@ -204,13 +189,6 @@ class WDIViewGalleryBox {
|
|
204 |
}
|
205 |
|
206 |
$current_filename = '';
|
207 |
-
|
208 |
-
if ($option_row->enable_addthis && $option_row->addthis_profile_id) {
|
209 |
-
?>
|
210 |
-
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=<?php echo $option_row->addthis_profile_id; ?>" async="async"></script>
|
211 |
-
<?php
|
212 |
-
}
|
213 |
-
|
214 |
?>
|
215 |
<style>
|
216 |
.wdi_popup_image {
|
@@ -590,23 +568,25 @@ continue;
|
|
590 |
$wdi_name = '';
|
591 |
$wdi_comment = '';
|
592 |
$wdi_email = '';
|
593 |
-
|
|
|
594 |
if ($option_row->popup_enable_captcha) {
|
595 |
-
$wdi_captcha_input = (
|
596 |
@session_start();
|
597 |
$wdi_captcha_code = (isset($_SESSION['wdi_captcha_code']) ? esc_html(stripslashes($_SESSION['wdi_captcha_code'])) : '');
|
598 |
if ($wdi_captcha_input !== $wdi_captcha_code) {
|
599 |
$captcha_error_message = __('Error. Incorrect Verification Code.', "wd-instagram-feed");
|
600 |
-
$wdi_name = (
|
601 |
-
$wdi_comment = (
|
602 |
-
$wdi_email = (
|
603 |
}
|
604 |
}
|
605 |
-
|
|
|
|
|
606 |
$email_error_message = __( 'This is not a valid email address.', "wd-instagram-feed" );
|
607 |
-
$wdi_name = (
|
608 |
-
$wdi_comment = (
|
609 |
-
$wdi_email = (isset($_POST['wdi_email']) ? esc_html(stripslashes($_POST['wdi_email'])) : '');
|
610 |
}
|
611 |
}
|
612 |
?>
|
@@ -658,7 +638,9 @@ continue;
|
|
658 |
wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));
|
659 |
wdi_spider_ajax_save('wdi_comment_form');
|
660 |
return false;" class="wdi_submit" type="submit" name="wdi_submit" id="wdi_submit" value="<?php echo __('Submit', "wd-instagram-feed"); ?>" /></p>
|
661 |
-
<?php
|
|
|
|
|
662 |
<input id="ajax_task" name="ajax_task" type="hidden" value="" />
|
663 |
<input id="image_id" name="image_id" type="hidden" value="<?php echo $image_id; ?>" />
|
664 |
<input id="comment_id" name="comment_id" type="hidden" value="" />
|
@@ -671,20 +653,8 @@ continue;
|
|
671 |
</div>
|
672 |
</div>
|
673 |
<?php } ?>
|
674 |
-
|
675 |
<a class="wdi_spider_popup_close" onclick="wdi_spider_destroypopup(1000); return false;" ontouchend="wdi_spider_destroypopup(1000); return false;"><span><i class="wdi_close_btn fa fa-times"></i></span></a>
|
676 |
-
|
677 |
<script>
|
678 |
-
|
679 |
-
<?php
|
680 |
-
if ($option_row->enable_addthis && $option_row->addthis_profile_id) {
|
681 |
-
?>
|
682 |
-
var addthis_share = {
|
683 |
-
url: "<?php echo urlencode($share_url); ?>"
|
684 |
-
}
|
685 |
-
<?php
|
686 |
-
}
|
687 |
-
?>
|
688 |
var wdi_trans_in_progress = false;
|
689 |
var wdi_transition_duration = <?php echo (($slideshow_interval < 4) && ($slideshow_interval != 0)) ? ($slideshow_interval * 1000) / 4 : 800; ?>;
|
690 |
var wdi_playInterval;
|
@@ -718,9 +688,6 @@ continue;
|
|
718 |
}, 800);
|
719 |
}
|
720 |
});
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
}
|
725 |
var wdi_current_key = '<?php echo $current_key; ?>';
|
726 |
var wdi_current_filmstrip_pos = <?php echo $current_pos; ?>;
|
@@ -773,12 +740,6 @@ continue;
|
|
773 |
jQuery(".wdi_filmstrip_right").show();
|
774 |
}
|
775 |
}
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
function wdi_change_image(current_key, key, wdi_data, from_effect) {
|
783 |
wdi_pause_stream('#wdi_image_container');
|
784 |
jQuery("#wdi_spider_popup_left").show();
|
@@ -942,10 +903,6 @@ continue;
|
|
942 |
jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height);
|
943 |
//jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
|
944 |
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
<?php
|
950 |
if (isset($option_row->preload_images)) {
|
951 |
echo 'wdi_preload_images(key);';
|
@@ -1317,7 +1274,6 @@ continue;
|
|
1317 |
jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_open");
|
1318 |
jQuery(".wdi_comment").attr("title", "<?php echo __('Hide Comments', "wd-instagram-feed"); ?>");
|
1319 |
/* Load comments.*/
|
1320 |
-
|
1321 |
var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
|
1322 |
if (wdi_data[cur_image_key]["comment_count"] != 0) {
|
1323 |
jQuery("#wdi_added_comments").show();/*deprecated*/
|
@@ -1327,29 +1283,10 @@ continue;
|
|
1327 |
}else{
|
1328 |
jQuery("#wdi_added_comments").html('<p class="wdi_no_comment"><?php _e('There are no comments to show','wd-instagram-feed');?></p>');
|
1329 |
}
|
1330 |
-
// console.log("has open:"+jQuery(".wdi_comment_container").hasClass("wdi_open"));
|
1331 |
-
// console.log("has clos:"+jQuery(".wdi_comment_container").hasClass("wdi_close"));
|
1332 |
}
|
1333 |
}
|
1334 |
|
1335 |
jQuery(document).ready(function () {
|
1336 |
-
|
1337 |
-
|
1338 |
-
<?php
|
1339 |
-
if ($option_row->enable_addthis && $option_row->addthis_profile_id) {
|
1340 |
-
?>
|
1341 |
-
jQuery(".at4-share-outer").show();
|
1342 |
-
<?php
|
1343 |
-
}
|
1344 |
-
?>
|
1345 |
-
/* Increase image hit counter.*/
|
1346 |
-
// wdi_spider_set_input_value('rate_ajax_task', 'save_hit_count');
|
1347 |
-
// wdi_spider_rate_ajax_save('wdi_rate_form');
|
1348 |
-
// jQuery(".wdi_image_hits span").html(++wdi_data["<?php echo $current_image_key; ?>"]["hit_count"]);
|
1349 |
-
// var wdi_hash = window.location.hash;
|
1350 |
-
// if (!wdi_hash || wdi_hash.indexOf("wdi") == "-1") {
|
1351 |
-
// window.location.hash = "wdi<?php echo $gallery_id; ?>/<?php echo $current_image_id; ?>";
|
1352 |
-
// }
|
1353 |
<?php
|
1354 |
if ($image_right_click) {
|
1355 |
?>
|
@@ -1532,9 +1469,7 @@ continue;
|
|
1532 |
jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height+"px");
|
1533 |
jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
|
1534 |
}*/
|
1535 |
-
|
1536 |
-
|
1537 |
-
}
|
1538 |
else {
|
1539 |
jQuery(".wdi_image_info_container1").css("display", "none");
|
1540 |
jQuery(".wdi_info").attr("title", "<?php echo __('Show info', "wd-instagram-feed"); ?>");
|
@@ -1577,7 +1512,7 @@ continue;
|
|
1577 |
|
1578 |
?>
|
1579 |
jQuery(".wdi_ctrl_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: '-' + jQuery(".wdi_ctrl_btn_container").height()}, 500);
|
1580 |
-
|
1581 |
jQuery(".wdi_toggle_container").animate({
|
1582 |
<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: 0
|
1583 |
}, {
|
@@ -2006,14 +1941,4 @@ continue;
|
|
2006 |
<?php
|
2007 |
die();
|
2008 |
}
|
2009 |
-
|
2010 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2011 |
-
// Getters & Setters //
|
2012 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2013 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2014 |
-
// Private Methods //
|
2015 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2016 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2017 |
-
// Listeners //
|
2018 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
2019 |
}
|
1 |
<?php
|
2 |
|
3 |
class WDIViewGalleryBox {
|
4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
private $model;
|
6 |
+
|
|
|
|
|
7 |
public function __construct($model) {
|
8 |
$this->model = $model;
|
9 |
}
|
10 |
+
|
|
|
|
|
11 |
public function display() {
|
12 |
global $WD_WDI_UPLOAD_DIR;
|
13 |
global $wp;
|
14 |
require_once(WDI_DIR . '/framework/WDILibraryEmbed.php');
|
15 |
|
16 |
+
$feed_id = (int) WDILibrary::get('feed_id', 0);
|
17 |
+
$current_feed = $this->model->get_feed_row_data($feed_id);
|
18 |
|
19 |
$theme_row = WDILibrary::arrayToObject($this->model->get_theme_row_data($current_feed['theme_id']));
|
20 |
$option_row = WDILibrary::arrayToObject($current_feed);
|
21 |
$option_row->preload_images_count = 0;
|
|
|
22 |
$option_row->popup_enable_captcha = 0;
|
23 |
$option_row->popup_enable_email = 0;
|
24 |
|
25 |
//////////////////////////////////////////////////////////////////
|
26 |
+
$current_url = WDILibrary::get('current_url', '');
|
27 |
+
$current_url = ( !empty($current_url) ? add_query_arg(esc_html($current_url), '', home_url($wp->request)) : '' );
|
28 |
+
$tag_id = WDILibrary::get('tag_id', 0);
|
29 |
$gallery_id = (isset($current_feed['id']) ? esc_html($current_feed['id']) : 0);
|
30 |
+
$wdi = WDILibrary::get('feed_counter', 0);
|
31 |
+
$current_image_id = WDILibrary::get('image_id', 0);
|
32 |
+
$current_image_index = WDILibrary::get('current_image_index', 0);
|
33 |
$theme_id = (isset($current_feed['theme_id']) ? esc_html($current_feed['theme_id']) : 1);
|
34 |
|
35 |
+
$carousel_media_row = WDILibrary::get('carousel_media_row', '');
|
36 |
$carousel_media = json_decode(stripslashes($carousel_media_row), true);
|
37 |
$carousel_media = is_array($carousel_media) ? $carousel_media : array();
|
38 |
+
|
39 |
+
$thumb_width = WDILibrary::get('thumb_width', 90); /*watch later*/
|
40 |
+
$thumb_height = WDILibrary::get('thumb_height', 90); /*watch later*/
|
41 |
|
42 |
$open_with_fullscreen = (isset($current_feed['popup_fullscreen']) ? esc_html($current_feed['popup_fullscreen']) : 0);
|
43 |
$open_with_autoplay = (isset($current_feed['popup_autoplay']) ? esc_html($current_feed['popup_autoplay']) : 0);
|
46 |
|
47 |
$image_effect = (isset($current_feed['popup_type']) && esc_html(isset($current_feed['popup_type'])) ? esc_html($current_feed['popup_type']) : 'fade');
|
48 |
|
49 |
+
$sort_by = WDILibrary::get('wd_sor', 'order'); /*watch later*/
|
50 |
+
$order_by = WDILibrary::get('wd_ord', 'asc'); /*watch later*/
|
51 |
|
52 |
$enable_image_filmstrip = (isset($current_feed['popup_enable_filmstrip']) ? esc_html($current_feed['popup_enable_filmstrip']) : 0);
|
53 |
$enable_image_fullscreen = (isset($current_feed['popup_enable_fullscreen']) ? esc_html($current_feed['popup_enable_fullscreen']) : 0);/*watch later*/
|
103 |
}
|
104 |
|
105 |
|
106 |
+
$json = WDILibrary::get('image_rows');
|
107 |
str_replace('"',""", $json);
|
108 |
|
109 |
$image_rows = json_decode(stripslashes($json));
|
110 |
+
$image_rows_count = (int) ( WDILibrary::get('image_rows_count') * 1 );
|
111 |
$image_rows = WDILibrary::arrayToObject($image_rows);
|
112 |
|
113 |
/////////////////////////////////Parametes for deprecated content////////////////////
|
115 |
$theme_row->lightbox_rate_size = 0;
|
116 |
/////////////////////////////////////////////////////////////////////////////////////
|
117 |
|
118 |
+
$image_id = (int) WDILibrary::get('image_id', $current_image_id);
|
|
|
|
|
119 |
$params_array = array(
|
120 |
'action' => 'GalleryBox',
|
121 |
'image_id' => $current_image_id,
|
189 |
}
|
190 |
|
191 |
$current_filename = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
?>
|
193 |
<style>
|
194 |
.wdi_popup_image {
|
568 |
$wdi_name = '';
|
569 |
$wdi_comment = '';
|
570 |
$wdi_email = '';
|
571 |
+
$ajax_task = WDILibrary::get('ajax_task', '');
|
572 |
+
if ( isset($ajax_task) && $ajax_task === 'save' ) {
|
573 |
if ($option_row->popup_enable_captcha) {
|
574 |
+
$wdi_captcha_input = WDILibrary::get('wdi_captcha_input', '');
|
575 |
@session_start();
|
576 |
$wdi_captcha_code = (isset($_SESSION['wdi_captcha_code']) ? esc_html(stripslashes($_SESSION['wdi_captcha_code'])) : '');
|
577 |
if ($wdi_captcha_input !== $wdi_captcha_code) {
|
578 |
$captcha_error_message = __('Error. Incorrect Verification Code.', "wd-instagram-feed");
|
579 |
+
$wdi_name = WDILibrary::get('wdi_name', '');
|
580 |
+
$wdi_comment = WDILibrary::get('wdi_comment', '');
|
581 |
+
$wdi_email = WDILibrary::get('wdi_email', '');
|
582 |
}
|
583 |
}
|
584 |
+
|
585 |
+
$wdi_email = WDILibrary::get('wdi_email', '');
|
586 |
+
if ($option_row->popup_enable_email && isset($wdi_email) && !is_email(stripslashes($wdi_email))) {
|
587 |
$email_error_message = __( 'This is not a valid email address.', "wd-instagram-feed" );
|
588 |
+
$wdi_name = WDILibrary::get('wdi_name', '');
|
589 |
+
$wdi_comment = WDILibrary::get('wdi_comment', '');
|
|
|
590 |
}
|
591 |
}
|
592 |
?>
|
638 |
wdi_spider_set_input_value('image_id', jQuery('#wdi_popup_image').attr('image_id'));
|
639 |
wdi_spider_ajax_save('wdi_comment_form');
|
640 |
return false;" class="wdi_submit" type="submit" name="wdi_submit" id="wdi_submit" value="<?php echo __('Submit', "wd-instagram-feed"); ?>" /></p>
|
641 |
+
<?php
|
642 |
+
$wdi_comment = WDILibrary::get('wdi_comment', '');
|
643 |
+
echo ( !current_user_can('manage_options') && ( $comment_moderation && isset($wdi_comment)) ) ? __('Your comment is awaiting moderation', "wd-instagram-feed") : ''; ?>
|
644 |
<input id="ajax_task" name="ajax_task" type="hidden" value="" />
|
645 |
<input id="image_id" name="image_id" type="hidden" value="<?php echo $image_id; ?>" />
|
646 |
<input id="comment_id" name="comment_id" type="hidden" value="" />
|
653 |
</div>
|
654 |
</div>
|
655 |
<?php } ?>
|
|
|
656 |
<a class="wdi_spider_popup_close" onclick="wdi_spider_destroypopup(1000); return false;" ontouchend="wdi_spider_destroypopup(1000); return false;"><span><i class="wdi_close_btn fa fa-times"></i></span></a>
|
|
|
657 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
var wdi_trans_in_progress = false;
|
659 |
var wdi_transition_duration = <?php echo (($slideshow_interval < 4) && ($slideshow_interval != 0)) ? ($slideshow_interval * 1000) / 4 : 800; ?>;
|
660 |
var wdi_playInterval;
|
688 |
}, 800);
|
689 |
}
|
690 |
});
|
|
|
|
|
|
|
691 |
}
|
692 |
var wdi_current_key = '<?php echo $current_key; ?>';
|
693 |
var wdi_current_filmstrip_pos = <?php echo $current_pos; ?>;
|
740 |
jQuery(".wdi_filmstrip_right").show();
|
741 |
}
|
742 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
743 |
function wdi_change_image(current_key, key, wdi_data, from_effect) {
|
744 |
wdi_pause_stream('#wdi_image_container');
|
745 |
jQuery("#wdi_spider_popup_left").show();
|
903 |
jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height);
|
904 |
//jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
|
905 |
|
|
|
|
|
|
|
|
|
906 |
<?php
|
907 |
if (isset($option_row->preload_images)) {
|
908 |
echo 'wdi_preload_images(key);';
|
1274 |
jQuery(".wdi_comment_container").attr("class", "wdi_comment_container wdi_open");
|
1275 |
jQuery(".wdi_comment").attr("title", "<?php echo __('Hide Comments', "wd-instagram-feed"); ?>");
|
1276 |
/* Load comments.*/
|
|
|
1277 |
var cur_image_key = parseInt(jQuery("#wdi_current_image_key").val());
|
1278 |
if (wdi_data[cur_image_key]["comment_count"] != 0) {
|
1279 |
jQuery("#wdi_added_comments").show();/*deprecated*/
|
1283 |
}else{
|
1284 |
jQuery("#wdi_added_comments").html('<p class="wdi_no_comment"><?php _e('There are no comments to show','wd-instagram-feed');?></p>');
|
1285 |
}
|
|
|
|
|
1286 |
}
|
1287 |
}
|
1288 |
|
1289 |
jQuery(document).ready(function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1290 |
<?php
|
1291 |
if ($image_right_click) {
|
1292 |
?>
|
1469 |
jQuery('.wdi_image_info').css('max-height',wdi_desc_max_height+"px");
|
1470 |
jQuery('.wdi_image_info').mCustomScrollbar({scrollInertia: 250});
|
1471 |
}*/
|
1472 |
+
}
|
|
|
|
|
1473 |
else {
|
1474 |
jQuery(".wdi_image_info_container1").css("display", "none");
|
1475 |
jQuery(".wdi_info").attr("title", "<?php echo __('Show info', "wd-instagram-feed"); ?>");
|
1512 |
|
1513 |
?>
|
1514 |
jQuery(".wdi_ctrl_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: '-' + jQuery(".wdi_ctrl_btn_container").height()}, 500);
|
1515 |
+
jQuery(".wdi_carousel_btn_container").animate({<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: '40px'}, 500);
|
1516 |
jQuery(".wdi_toggle_container").animate({
|
1517 |
<?php echo $theme_row->lightbox_ctrl_btn_pos; ?>: 0
|
1518 |
}, {
|
1941 |
<?php
|
1942 |
die();
|
1943 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1944 |
}
|
frontend/views/WDIViewThumbnails_view.php
CHANGED
@@ -2,26 +2,13 @@
|
|
2 |
|
3 |
class WDIViewThumbnails_view
|
4 |
{
|
5 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
6 |
-
// Events //
|
7 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
// Constants //
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
// Variables //
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
private $model;
|
15 |
-
|
16 |
-
// Constructor & Destructor //
|
17 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
18 |
public function __construct($model)
|
19 |
{
|
20 |
$this->model = $model;
|
21 |
}
|
22 |
-
|
23 |
-
// Public Methods //
|
24 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
25 |
public function display()
|
26 |
{
|
27 |
|
@@ -33,9 +20,7 @@ class WDIViewThumbnails_view
|
|
33 |
$style = $this->model->theme_row;
|
34 |
$container_class = 'wdi_feed_theme_' . '1' . ' wdi_feed_thumbnail_' . '1';
|
35 |
$wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
|
36 |
-
|
37 |
?>
|
38 |
-
|
39 |
<div id="wdi_feed_<?php echo $wdi_feed_counter ?>" class="wdi_feed_main_container wdi_layout_th <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
|
40 |
<?php wdi_feed_frontend_messages();?>
|
41 |
<div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
|
@@ -50,7 +35,7 @@ class WDIViewThumbnails_view
|
|
50 |
if ($feed_row['feed_display_view'] === 'pagination' && $style['pagination_position_vert'] === 'top') {
|
51 |
?>
|
52 |
<div id="wdi_pagination" class="wdi_pagination">
|
53 |
-
|
54 |
title="<?php echo __('First Page', "wd-instagram-feed") ?>"
|
55 |
class="fa fa-step-backward wdi_pagination_ctrl wdi_disabled"></i><i
|
56 |
id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>"
|
@@ -58,14 +43,15 @@ class WDIViewThumbnails_view
|
|
58 |
style="font-style:normal">1</i><i id="wdi_next"
|
59 |
title="<?php echo __('Next Page', "wd-instagram-feed") ?>"
|
60 |
class="fa fa-arrow-right wdi_pagination_ctrl"></i>
|
61 |
-
|
62 |
-
class="fa fa-step-forward wdi_pagination_ctrl wdi_disabled"></i
|
|
|
|
|
|
|
63 |
}
|
64 |
?>
|
65 |
-
<div class="wdi_feed_wrapper <?php echo 'wdi_col_' . $feed_row['number_of_columns'] ?>"
|
66 |
-
wdi-res='<?php echo 'wdi_col_' . $feed_row['number_of_columns'] ?>'></div>
|
67 |
<div class="wdi_clear"></div>
|
68 |
-
|
69 |
<?php switch ($feed_row['feed_display_view']) {
|
70 |
case 'load_more_btn': {
|
71 |
?>
|
@@ -116,7 +102,6 @@ class WDIViewThumbnails_view
|
|
116 |
<div class="wdi_front_overlay"></div>
|
117 |
</div>
|
118 |
<?php
|
119 |
-
|
120 |
}
|
121 |
|
122 |
public function pass_feed_data_to_js()
|
@@ -134,7 +119,6 @@ class WDIViewThumbnails_view
|
|
134 |
$feed_row['access_token'] = WDILibrary::get_user_access_token($users);
|
135 |
$feed_row['wdi_feed_counter'] = $wdi_feed_counter;
|
136 |
|
137 |
-
|
138 |
wp_localize_script("wdi_frontend", 'wdi_feed_' . $wdi_feed_counter, array('feed_row' => $feed_row, 'data' => array(), 'usersData' => array(), 'dataCount' => 0));
|
139 |
wp_localize_script("wdi_frontend", 'wdi_theme_' . $this->model->theme_row['id'], $this->model->theme_row);
|
140 |
wp_localize_script("wdi_frontend", 'wdi_front', array('feed_counter' => $wdi_feed_counter));
|
2 |
|
3 |
class WDIViewThumbnails_view
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
private $model;
|
6 |
+
|
|
|
|
|
7 |
public function __construct($model)
|
8 |
{
|
9 |
$this->model = $model;
|
10 |
}
|
11 |
+
|
|
|
|
|
12 |
public function display()
|
13 |
{
|
14 |
|
20 |
$style = $this->model->theme_row;
|
21 |
$container_class = 'wdi_feed_theme_' . '1' . ' wdi_feed_thumbnail_' . '1';
|
22 |
$wdi_data_ajax = defined('DOING_AJAX') && DOING_AJAX ? 'data-wdi_ajax=1' : '';
|
|
|
23 |
?>
|
|
|
24 |
<div id="wdi_feed_<?php echo $wdi_feed_counter ?>" class="wdi_feed_main_container wdi_layout_th <?php echo $container_class; ?>" <?php echo $wdi_data_ajax; ?> >
|
25 |
<?php wdi_feed_frontend_messages();?>
|
26 |
<div id="wdi_spider_popup_loading_<?php echo $wdi_feed_counter ?>" class="wdi_spider_popup_loading"></div>
|
35 |
if ($feed_row['feed_display_view'] === 'pagination' && $style['pagination_position_vert'] === 'top') {
|
36 |
?>
|
37 |
<div id="wdi_pagination" class="wdi_pagination">
|
38 |
+
<div class="wdi_pagination_container"><i id="wdi_first_page"
|
39 |
title="<?php echo __('First Page', "wd-instagram-feed") ?>"
|
40 |
class="fa fa-step-backward wdi_pagination_ctrl wdi_disabled"></i><i
|
41 |
id="wdi_prev" title="<?php echo __('Previous Page', "wd-instagram-feed") ?>"
|
43 |
style="font-style:normal">1</i><i id="wdi_next"
|
44 |
title="<?php echo __('Next Page', "wd-instagram-feed") ?>"
|
45 |
class="fa fa-arrow-right wdi_pagination_ctrl"></i>
|
46 |
+
<i id="wdi_last_page" title="<?php echo __('Last Page', "wd-instagram-feed") ?>"
|
47 |
+
class="fa fa-step-forward wdi_pagination_ctrl wdi_disabled"></i>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
<?php
|
51 |
}
|
52 |
?>
|
53 |
+
<div class="wdi_feed_wrapper <?php echo 'wdi_col_' . $feed_row['number_of_columns'] ?>" wdi-res='<?php echo 'wdi_col_' . $feed_row['number_of_columns'] ?>'></div>
|
|
|
54 |
<div class="wdi_clear"></div>
|
|
|
55 |
<?php switch ($feed_row['feed_display_view']) {
|
56 |
case 'load_more_btn': {
|
57 |
?>
|
102 |
<div class="wdi_front_overlay"></div>
|
103 |
</div>
|
104 |
<?php
|
|
|
105 |
}
|
106 |
|
107 |
public function pass_feed_data_to_js()
|
119 |
$feed_row['access_token'] = WDILibrary::get_user_access_token($users);
|
120 |
$feed_row['wdi_feed_counter'] = $wdi_feed_counter;
|
121 |
|
|
|
122 |
wp_localize_script("wdi_frontend", 'wdi_feed_' . $wdi_feed_counter, array('feed_row' => $feed_row, 'data' => array(), 'usersData' => array(), 'dataCount' => 0));
|
123 |
wp_localize_script("wdi_frontend", 'wdi_theme_' . $this->model->theme_row['id'], $this->model->theme_row);
|
124 |
wp_localize_script("wdi_frontend", 'wdi_front', array('feed_counter' => $wdi_feed_counter));
|
js/gallerybox/wdi_gallery_box.js
CHANGED
@@ -84,7 +84,6 @@ function wdi_spider_createpopup(url, current_view, width, height, duration, desc
|
|
84 |
});
|
85 |
}
|
86 |
});
|
87 |
-
/////////////////////////////////////////
|
88 |
}
|
89 |
|
90 |
var wdi_construct_popup = function (popup, currentFeed, image_rows, current_image_id) {
|
@@ -250,9 +249,6 @@ function wdi_spider_destroypopup(duration)
|
|
250 |
jQuery.fullscreen.exit();
|
251 |
}
|
252 |
}
|
253 |
-
if (typeof enable_addthis != "undefined" && enable_addthis) {
|
254 |
-
jQuery(".at4-share-outer").hide();
|
255 |
-
}
|
256 |
setTimeout(function ()
|
257 |
{
|
258 |
jQuery(".wdi_spider_popup_wrap").remove();
|
@@ -295,11 +291,7 @@ Object.size = function (obj)
|
|
295 |
|
296 |
function wdi_spider_ajax_save(form_id, image_id)
|
297 |
{
|
298 |
-
|
299 |
-
|
300 |
wdi_comments_manager.init(image_id);
|
301 |
-
|
302 |
-
|
303 |
// var post_data = {};
|
304 |
// post_wdi_data["wdi_name"] = jQuery("#wdi_name").val();
|
305 |
// post_wdi_data["wdi_comment"] = jQuery("#wdi_comment").val();
|
@@ -418,7 +410,6 @@ wdi_comments_manager = {
|
|
418 |
}
|
419 |
|
420 |
this.updateScrollbar();
|
421 |
-
|
422 |
},
|
423 |
|
424 |
//function for updating scrollbar
|
@@ -444,17 +435,11 @@ wdi_comments_manager = {
|
|
444 |
|
445 |
/* for free version */
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
}
|
453 |
-
}*/
|
454 |
-
|
455 |
-
////
|
456 |
-
jQuery('.wdi_comments_close_btn').on('click', wdi_comment);
|
457 |
-
//binding click event for loading more commetn by ajax
|
458 |
|
459 |
|
460 |
},
|
84 |
});
|
85 |
}
|
86 |
});
|
|
|
87 |
}
|
88 |
|
89 |
var wdi_construct_popup = function (popup, currentFeed, image_rows, current_image_id) {
|
249 |
jQuery.fullscreen.exit();
|
250 |
}
|
251 |
}
|
|
|
|
|
|
|
252 |
setTimeout(function ()
|
253 |
{
|
254 |
jQuery(".wdi_spider_popup_wrap").remove();
|
291 |
|
292 |
function wdi_spider_ajax_save(form_id, image_id)
|
293 |
{
|
|
|
|
|
294 |
wdi_comments_manager.init(image_id);
|
|
|
|
|
295 |
// var post_data = {};
|
296 |
// post_wdi_data["wdi_name"] = jQuery("#wdi_name").val();
|
297 |
// post_wdi_data["wdi_comment"] = jQuery("#wdi_comment").val();
|
410 |
}
|
411 |
|
412 |
this.updateScrollbar();
|
|
|
413 |
},
|
414 |
|
415 |
//function for updating scrollbar
|
435 |
|
436 |
/* for free version */
|
437 |
|
438 |
+
|
439 |
+
|
440 |
+
////
|
441 |
+
jQuery('.wdi_comments_close_btn').on('click', wdi_comment);
|
442 |
+
//binding click event for loading more commetn by ajax
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
|
444 |
|
445 |
},
|
js/gallerybox/wdi_gallery_box.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]!=="undefined"&&typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=wdi_front.escape_tags(c[e].description);wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}if(typeof enable_addthis!="undefined"&&enable_addthis){jQuery(".at4-share-outer").hide()}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=wdi_front.escape_tags(d);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
|
1 |
+
var isPopUpOpened=false;var wdi_data=[];function wdi_spider_createpopup(a,k,b,m,e,l,f,j,h){a=a.replace(/&/g,"&");if(isPopUpOpened){return}isPopUpOpened=true;if(wdi_spider_hasalreadyreceivedpopup(l)||wdi_spider_isunsupporteduseragent()){return}jQuery("html").attr("style","overflow:hidden !important;");jQuery("#wdi_spider_popup_loading_"+k).css({display:"block"});jQuery("#wdi_spider_popup_overlay_"+k).css({display:"block"});var d=0;var c;for(var g=0;g<j.parsedData.length;g++){if(j.parsedData[g].id===h){d=g;c=[j.parsedData[g]];break}}jQuery.ajax({type:"POST",url:a,dataType:"text",data:{action:"WDIGalleryBox",image_rows:JSON.stringify(c),feed_id:j.feed_row.id,feed_counter:j.feed_row.wdi_feed_counter,current_image_index:d,image_rows_count:j.parsedData.length,carousel_media_row:JSON.stringify(c[0].carousel_media)},success:function(o){var n=jQuery('<div id="wdi_spider_popup_wrap" class="wdi_spider_popup_wrap wdi_lightbox_theme_'+j.feed_row.theme_id+'" style="width:'+b+"px;height:"+m+"px;margin-top:-"+(m/2)+"px;margin-left: -"+(b/2)+'px; ">'+o+"</div>");var p=new wdi_construct_popup(n,j,j.parsedData,h);p.construct();n.hide().appendTo("body");wdi_spider_showpopup(l,f,n,e);jQuery("#wdi_spider_popup_loading_"+k).css({display:"none !important;"})}})}var wdi_construct_popup=function(a,b,c,d){this.theme_row={};this.construct=function(){this.theme_row=window["wdi_theme_"+b.feed_row.theme_id];if(b.feed_row.popup_enable_filmstrip&&b.feed_row.popup_enable_filmstrip==="1"){this.add_filmstrip()}this.set_wdi_data()};this.add_filmstrip=function(){var l="horizontal";if(this.theme_row.lightbox_filmstrip_pos==="right"||this.theme_row.lightbox_filmstrip_pos==="left"){l="vertical"}var y=(l==="horizontal")?"fa-angle-left":"fa-angle-up";var x=(l==="horizontal")?"fa-angle-right":"fa-angle-down";var h="";var q,f;if(l==="horizontal"){f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"20"}else{f=q=(typeof b.feed_row.popup_filmstrip_height!=="undefined")?(b.feed_row.popup_filmstrip_height):"50"}q=f=parseInt(f);for(var w=0;w<c.length;w++){var e=c[w];var s,k,A;if(e.resolution&&e.resolution!==""){var n=e.resolution.split(" ");var p=intval($resolution_arr[0]);var z=intval($resolution_arr[2]);if(p!==0&&z!==0){A=Math.max(f/p,q/z);s=p*A;k=z*A}else{s=f;k=q}}else{s=f;k=q}A=Math.max(f/s,q/k);s*=A;k*=A;var g=(f-s)/2;var j=(q-k)/2;var u="wdi_filmstrip_thumbnail "+((parseInt(e.id)===parseInt(d))?"wdi_thumb_active":"wdi_thumb_deactive");var t="width:"+s+"px;height:"+k+"px;margin-left:"+g+"px;margin-top:"+j+"px;";var m=(typeof e.images[b.feedImageResolution]!=="undefined"&&typeof e.images[b.feedImageResolution]["url"]!=="undefined")?e.images[b.feedImageResolution]["url"]:e.thumb_url;var B="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var v="wdi_change_image(parseInt(jQuery('#wdi_current_image_key').val()), '"+w+"', wdi_data)";var r='<img style="'+t+'" class="wdi_filmstrip_thumbnail_img" src="'+m+'" onclick="'+B+'" ontouchend="'+v+'" image_id="'+e.id+'" image_key="'+w+'" alt="'+e.alt+'" />';h+='<div id="wdi_filmstrip_thumbnail_'+w+'" class="'+u+'">'+r+"</div>"}var o='<div class="wdi_filmstrip_left"><i class="fa '+y+'"></i></div><div class="wdi_filmstrip"><div class="wdi_filmstrip_thumbnails">'+h+'</div></div><div class="wdi_filmstrip_right"><i class="fa '+x+'"></i></div>';a.find(".wdi_filmstrip_container").append(o)};this.set_wdi_data=function(){wdi_data=[];for(var e=0;e<c.length;e++){wdi_data[e]=[];wdi_data[e]["number"]=e+1;wdi_data[e]["id"]=c[e].id;wdi_data[e]["alt"]=c[e].alt;wdi_data[e]["description"]=wdi_front.escape_tags(c[e].description);wdi_data[e]["username"]=c[e].username;wdi_data[e]["profile_picture"]=c[e].profile_picture;wdi_data[e]["image_url"]=c[e].image_url;wdi_data[e]["thumb_url"]=c[e].thumb_url;wdi_data[e]["date"]=c[e].date;wdi_data[e]["comment_count"]=c[e].comment_count;wdi_data[e]["filetype"]=c[e].filetype;wdi_data[e]["filename"]=c[e].filename;wdi_data[e]["avg_rating"]=c[e].avg_rating;wdi_data[e]["rate"]=c[e].rate;wdi_data[e]["rate_count"]=c[e].rate_count;wdi_data[e]["hit_count"]=c[e].hit_count;wdi_data[e]["comments_data"]=(typeof c[e].comments_data!=="undefined")?c[e].comments_data:"null";wdi_data[e]["carousel_media"]=(typeof c[e]["carousel_media"]!=="undefined")?c[e]["carousel_media"]:null}}};function wdi_spider_showpopup(c,a,b,d){isPopUpOpened=true;b.show();wdi_spider_receivedpopup(c,a)}function wdi_spider_hasalreadyreceivedpopup(a){if(document.cookie.indexOf(a)>-1){delete document.cookie[document.cookie.indexOf(a)]}return false}function wdi_spider_receivedpopup(c,a){var b=new Date();b.setDate(b.getDate()+a);document.cookie=c+"=true;expires="+b.toUTCString()+";path=/"}function wdi_spider_isunsupporteduseragent(){return(!window.XMLHttpRequest)}function wdi_spider_destroypopup(d){if(document.getElementById("wdi_spider_popup_wrap")!=null){wdi_comments_manager.popup_destroyed();if(typeof jQuery().fullscreen!=="undefined"&&jQuery.isFunction(jQuery().fullscreen)){if(jQuery.fullscreen.isFullScreen()){jQuery.fullscreen.exit()}}setTimeout(function(){jQuery(".wdi_spider_popup_wrap").remove();jQuery(".wdi_spider_popup_loading").css({display:"none"});jQuery(".wdi_spider_popup_overlay").css({display:"none"});jQuery(document).off("keydown");jQuery("html").attr("style","")},20)}isPopUpOpened=false;var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var c=document.querySelector('meta[name="viewport"]');if(a&&c){c.content="width=device-width, initial-scale=1"}var b=jQuery(document).scrollTop();window.location.hash="";jQuery(document).scrollTop(b);if(typeof wdi_playInterval!="undefined"){clearInterval(wdi_playInterval)}}Object.size=function(c){var b=0,a;for(a in c){if(c.hasOwnProperty(a)){b++}}return b};function wdi_spider_ajax_save(a,b){wdi_comments_manager.init(b);return false}wdi_comments_manager={media_id:"",mediaComments:[],load_more_count:10,commentCounter:0,currentKey:-1,init:function(a){this.instagram=new WDIInstagram();this.instagram.addToken(wdi_front.access_token);if(this.currentKey!=a){this.currentKey=a;this.reset_comments()}else{}},reset_comments:function(){jQuery("#wdi_load_more_comments").remove();jQuery("#wdi_added_comments").html("");this.commentCounter=0;this.media_id=wdi_data[this.currentKey]["id"];this.getAjaxComments(this.currentKey)},popup_destroyed:function(){this.media_id="";this.mediaComments=[];this.commentCounter=0;this.currentKey=-1},showComments:function(f,e){if(Object.size(f)-this.commentCounter-e<0||e===undefined){e=Object.size(f)-this.commentCounter}var b=this.commentCounter;for(i=Object.size(f)-b-1;i>=Object.size(f)-b-e;i--){this.commentCounter++;var d=(f[i]["text"]);d=wdi_front.escape_tags(d);d=this.filterCommentText(d);var g=(f[i]["from"]["username"]);var c=(f[i]["from"]["profile_picture"]);var a=jQuery('<div class="wdi_single_comment"></div>');a.append(jQuery('<p class="wdi_comment_header_p"><span class="wdi_comment_header"><a target="_blank" href="//instagram.com/'+g+'">'+g+'</a></span><span class="wdi_comment_date">'+wdi_front.convertUnixDate(f[i]["created_time"])+"</span></p>"));a.append(jQuery('<div class="wdi_comment_body_p"><span class="wdi_comment_body"><p>'+d+"</p></span></div>"));jQuery("#wdi_added_comments").prepend(a)}this.updateScrollbar()},updateScrollbar:function(){var b=jQuery("#wdi_comments");var a=jQuery("#wdi_added_comments");jQuery(".wdi_comments").attr("class","wdi_comments");jQuery(".wdi_comments").html("");jQuery(".wdi_comments").append(b);jQuery(".wdi_comments").append(a);jQuery(".wdi_comments_close_btn").on("click",wdi_comment)},getAjaxComments:function(){this.instagram.getRecentMediaComments(this.media_id,{success:function(a){if(a==""||a==undefined||a==null){errorMessage="Network Error, please try again later :(";console.log("%c"+errorMessage,"color:#cc0000;");return}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];console.log("%c"+errorMessage,"color:#cc0000;");return}wdi_comments_manager.mediaComments=a.data;var b=wdi_data[wdi_comments_manager.currentKey];b.comments_data=a.data;wdi_comments_manager.showComments(b.comments_data,wdi_comments_manager.load_more_count);wdi_comments_manager.ajax_comments_ready(a.data)}})},ajax_comments_ready:function(a){this.createLoadMoreAndBindEvent()},createLoadMoreAndBindEvent:function(){jQuery("#wdi_added_comments").prepend(jQuery('<p id="wdi_load_more_comments" class="wdi_load_more_comments">load more comments</p>'));jQuery(".wdi_comment_container #wdi_load_more_comments").on("click",function(){jQuery(this).remove();wdi_comments_manager.showComments(wdi_comments_manager.mediaComments,wdi_comments_manager.load_more_count);wdi_comments_manager.createLoadMoreAndBindEvent()})},filterCommentText:function(d){var c=d.split(" ");var b="";for(var a=0;a<c.length;a++){switch(c[a][0]){case"@":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;case"#":b+='<a target="blank" class="wdi_comm_text_link" href="//instagram.com/explore/tags/'+c[a].substring(1,c[a].length)+'">'+c[a]+"</a> ";break;default:b+=c[a]+" "}}b=b.substring(0,b.length-1);return b}};function wdi_spider_set_input_value(b,a){if(document.getElementById(b)){document.getElementById(b).value=a}}function wdi_spider_form_submit(b,a){if(document.getElementById(a)){document.getElementById(a).submit()}if(b.preventDefault){b.preventDefault()}else{b.returnValue=false}}function wdi_spider_check_required(b,a){if(jQuery("#"+b).val()==""){wdi_front.show_alert(a+"* "+wdi_objectL10n.wdi_field_required);jQuery("#"+b).attr("style","border-color: #FF0000;");jQuery("#"+b).focus();return true}else{return false}}function wdi_spider_check_email(b){if(jQuery("#"+b).val()!=""){var a=jQuery("#"+b).val().replace(/^\s+|\s+$/g,"");if(a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==-1){wdi_front.show_alert(wdi_objectL10n.wdi_mail_validation);return true}return false}}function wdi_captcha_refresh(a){if(document.getElementById(a+"_img")&&document.getElementById(a+"_input")){srcArr=document.getElementById(a+"_img").src.split("&r=");document.getElementById(a+"_img").src=srcArr[0]+"&r="+Math.floor(Math.random()*100);document.getElementById(a+"_img").style.display="inline-block";document.getElementById(a+"_input").value=""}}function wdi_play_pause(e){var f=navigator.userAgent.indexOf("Chrome")>-1;var d=navigator.userAgent.indexOf("Safari")>-1;if((f)&&(d)){d=false}if(d){return}var c=e.get(0);var b=/firefox/i;var a=false;if(navigator.userAgent.match(b)){a=true}if(!a){if(!c.paused){c.pause()}else{c.play()}}}function wdi_spider_display_embed(m,n,j,g){var b="";switch(m){case"EMBED_OEMBED_YOUTUBE_VIDEO":var k="<iframe ";if(n!=""){k+=' src="//www.youtube.com/embed/'+n+'?enablejsapi=1&wmode=transparent"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){k+=" "+attr+'="'+j[attr]+'"'}}}k+=" ></iframe>";b+=k;break;case"EMBED_OEMBED_VIMEO_VIDEO":var f="<iframe ";if(n!=""){f+=' src="//player.vimeo.com/video/'+n+'?enablejsapi=1"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){f+=" "+attr+'="'+j[attr]+'"'}}}f+=" ></iframe>";b+=f;break;case"EMBED_OEMBED_FLICKR_IMAGE":var d="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){d+=" "+attr+'="'+j[attr]+'"'}}}d+=" >";if(n!=""){d+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;">'}d+="</div>";b+=d;break;case"EMBED_OEMBED_FLICKR_VIDEO":break;case"EMBED_OEMBED_INSTAGRAM_VIDEO":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(n!=""){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls><source src="'+n+'" type="video/mp4"> Your browser does not support the video tag. </video>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_IMAGE":var e="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}e+=" >";if(g!=null&&g.length){for(var c=0;c<g.length;c++){if(g[c]["type"]=="image"){e+='<img src="'+g[c]["images"]["standard_resolution"]["url"]+'" style="max-width:100% !important; max-height:100% !important; width:auto !important; height:auto !important;" data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'">'}else{if(g[c]["type"]=="video"){e+='<video onclick="wdi_play_pause(jQuery(this));" style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls data-id="'+c+'" class="carousel_media '+(c==0?"active":"")+'"><source src="'+g[c]["videos"]["standard_resolution"]["url"]+'" type="video/mp4"> Your browser does not support the video tag. </video>'}}}}else{if(n!=""){e+='<img src="//instagram.com/p/'+n+'/media/?size=l" style=" max-width:100% !important; max-height:100% !important; width:auto; height:auto;">'}}e+="</div>";b+=e;break;case"EMBED_OEMBED_INSTAGRAM_POST":var e="<div ";var a="";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"';if(attr=="CLASS"||attr=="class"||attr=="Class"){obj_class=j[attr]}}}}e+=" >";if(n!=""){e+='<iframe class="inner_instagram_iframe_'+obj_class+'" src="//instagr.am/p/'+n+'/embed/?enablejsapi=1" style="max-width:100% !important; max-height:100% !important; width:100%; height:100%; margin:0; display:table-cell; vertical-align:middle;"frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen></iframe>'}e+="</div>";b+=e;break;case"EMBED_OEMBED_DAILYMOTION_VIDEO":var l="<iframe ";if(n!=""){l+=' src="//www.dailymotion.com/embed/video/'+n+'?api=postMessage"'}for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){l+=" "+attr+'="'+j[attr]+'"'}}}l+=" ></iframe>";b+=l;break;case"EMBED_OEMBED_IMGUR":var h="<div ";for(attr in j){if(!(/src/i).test(attr)){if(attr!=""&&j[attr]!=""){e+=" "+attr+'="'+j[attr]+'"'}}}h+=" >";if(n!=""){h+='<img src="'+n+'" style="max-width:100% !important; max-height:100% !important; width:auto; height:auto !important;">'}h+="</div>";b+=h;break;default:}return b}function wdi_testBrowser_cssTransitions(){return wdi_testDom("Transition")}function wdi_testBrowser_cssTransforms3d(){return wdi_testDom("Perspective")}function wdi_testDom(d){var a=["","-webkit-","-moz-","-ms-","-o-","-khtml-"];var c=["","Webkit","Moz","ms","O","Khtml"];var b=c.length;while(b--){if(typeof document.body.style[c[b]+d]!=="undefined"){return true}}return false}function wdi_cube(c,d,b,a,k,l,h,j,e,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(j,e,g)}if(!wdi_testBrowser_cssTransforms3d()){return wdi_fallback3d(j,e,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");jQuery(".wdi_slide_bg").css("perspective",1000);jQuery(j).css({transform:"translateZ("+c+"px)",backfaceVisibility:"hidden"});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)",backfaceVisibility:"hidden",transform:"translateY("+b+"px) translateX("+d+"px) rotateY("+k+"deg) rotateX("+a+"deg)"});jQuery(".wdi_slider").css({transform:"translateZ(-"+c+"px)",transformStyle:"preserve-3d"});setTimeout(function(){jQuery(".wdi_slider").css({transition:"all "+wdi_transition_duration+"ms ease-in-out",transform:"translateZ(-"+c+"px) rotateX("+l+"deg) rotateY("+h+"deg)"})},20);jQuery(".wdi_slider").one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(f));function f(){jQuery(j).removeAttr("style");jQuery(e).removeAttr("style");jQuery(".wdi_slider").removeAttr("style");jQuery(j).css({opacity:0,filter:"Alpha(opacity=0)","z-index":1});jQuery(e).css({opacity:1,filter:"Alpha(opacity=100)","z-index":2});wdi_trans_in_progress=false;jQuery(j).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_cubeH(b,a,d){var c=jQuery(b).width()/2;if(d=="right"){wdi_cube(c,c,0,0,90,0,-90,b,a,d)}else{if(d=="left"){wdi_cube(c,-c,0,0,-90,0,90,b,a,d)}}}function wdi_cubeV(b,a,d){var c=jQuery(b).height()/2;if(d=="right"){wdi_cube(c,0,-c,90,0,-90,0,b,a,d)}else{if(d=="left"){wdi_cube(c,0,c,-90,0,90,0,b,a,d)}}}function wdi_fallback(b,a,c){wdi_fade(b,a,c)}function wdi_fallback3d(b,a,c){wdi_sliceV(b,a,c)}function wdi_none(b,a,c){jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}function wdi_fade(b,a,c){jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");if(wdi_testBrowser_cssTransitions()){jQuery(a).css("transition","opacity "+wdi_transition_duration+"ms linear");jQuery(b).css({opacity:0,"z-index":1});jQuery(a).css({opacity:1,"z-index":2});wdi_change_watermark_container()}else{jQuery(b).animate({opacity:0,"z-index":1},wdi_transition_duration);jQuery(a).animate({opacity:1,"z-index":2},{duration:wdi_transition_duration,complete:function(){wdi_trans_in_progress=false;jQuery(b).html("");wdi_change_watermark_container()}});jQuery(b).fadeTo(wdi_transition_duration,0);jQuery(a).fadeTo(wdi_transition_duration,1)}}function wdi_grid(k,L,w,I,H,o,u,A,M,g){if(!wdi_testBrowser_cssTransitions()){return wdi_fallback(A,M,g)}wdi_trans_in_progress=true;jQuery(".wdi_filmstrip_thumbnail").removeClass("wdi_thumb_active").addClass("wdi_thumb_deactive");jQuery("#wdi_filmstrip_thumbnail_"+wdi_current_key).removeClass("wdi_thumb_deactive").addClass("wdi_thumb_active");var F=(wdi_transition_duration)/(k+L);function x(P,Y,V,R,Q,X,O,W,U,T,j){var S=(T+j)*F;return jQuery('<span class="wdi_gridlet" />').css({display:"block",width:P,height:Y,top:V,left:Q,backgroundImage:'url("'+O+'")',backgroundColor:jQuery(".wdi_spider_popup_wrap").css("background-color"),backgroundRepeat:"no-repeat",backgroundPosition:X+"px "+R+"px",backgroundSize:W+"px "+U+"px",transition:"all "+wdi_transition_duration+"ms ease-in-out "+S+"ms",transform:"none"})}var v=jQuery(A).find("img");var D=jQuery('<span style="display: block;" />').addClass("wdi_grid");jQuery(A).prepend(D);var z=jQuery(".wdi_slide_bg");var n=v.width();var b=v.height();var C=z.width(),h=z.height(),q=Math.floor(C/k),e=Math.floor(h/L),d=C-(k*q),G=Math.ceil(d/k),p=h-(L*e),f=Math.ceil(p/L),t=0,y=Math.ceil((jQuery(".wdi_slide_bg").width()-v.width())/2);var E=typeof v.attr("src")=="undefined"?"":v.attr("src");I=I==="auto"?C:I;I=I==="min-auto"?-C:I;H=H==="auto"?h:H;H=H==="min-auto"?-h:H;for(var K=0;K<k;K++){var N=0,m=Math.floor((jQuery(".wdi_slide_bg").height()-v.height())/2),B=q;if(d>0){var c=d>=G?G:d;B+=c;d-=c}for(var J=0;J<L;J++){var r=e,s=p;if(s>0){c=s>=f?f:p;r+=c;s-=c}D.append(x(B,r,N,m,t,y,E,n,b,K,J));N+=r;m-=r}y-=B;t+=B}var a=D.children().last();D.show();v.css("opacity",0);D.children().first().addClass("rs-top-left");D.children().last().addClass("rs-bottom-right");D.children().eq(L-1).addClass("rs-bottom-left");D.children().eq(-L).addClass("rs-top-right");setTimeout(function(){D.children().css({opacity:u,transform:"rotate("+w+"deg) translateX("+I+"px) translateY("+H+"px) scale("+o+")"})},1);jQuery(M).css("opacity",1);jQuery(a).one("webkitTransitionEnd transitionend otransitionend oTransitionEnd mstransitionend",jQuery.proxy(l));function l(){jQuery(A).css({opacity:0,"z-index":1});jQuery(M).css({opacity:1,"z-index":2});v.css("opacity",1);D.remove();wdi_trans_in_progress=false;jQuery(A).html("");if(typeof event_stack!=="undefined"){if(event_stack.length>0){key=event_stack[0].split("-");event_stack.shift();wdi_change_image(key[0],key[1],wdi_data,true)}}wdi_change_watermark_container()}}function wdi_sliceH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,8,0,d,0,1,0,b,a,c)}function wdi_sliceV(b,a,d){if(d=="right"){var c="min-auto"}else{if(d=="left"){var c="auto"}}wdi_grid(10,1,0,0,c,1,0,b,a,d)}function wdi_slideV(b,a,d){if(d=="right"){var c="auto"}else{if(d=="left"){var c="min-auto"}}wdi_grid(1,1,0,0,c,1,1,b,a,d)}function wdi_slideH(b,a,c){if(c=="right"){var d="min-auto"}else{if(c=="left"){var d="auto"}}wdi_grid(1,1,0,d,0,1,1,b,a,c)}function wdi_scaleOut(b,a,c){wdi_grid(1,1,0,0,0,1.5,0,b,a,c)}function wdi_scaleIn(b,a,c){wdi_grid(1,1,0,0,0,0.5,0,b,a,c)}function wdi_blockScale(b,a,c){wdi_grid(8,6,0,0,0,0.6,0,b,a,c)}function wdi_kaleidoscope(b,a,c){wdi_grid(10,8,0,0,0,1,0,b,a,c)}function wdi_fan(b,a,d){if(d=="right"){var c=45;var e=100}else{if(d=="left"){var c=-45;var e=-100}}wdi_grid(1,10,c,e,0,1,0,b,a,d)}function wdi_blindV(b,a,c){wdi_grid(1,8,0,0,0,0.7,0,b,a)}function wdi_blindH(b,a,c){wdi_grid(10,1,0,0,0,0.7,0,b,a)}function wdi_random(c,b,d){var a=["sliceH","sliceV","slideH","slideV","scaleOut","scaleIn","blockScale","kaleidoscope","fan","blindH","blindV"];this["wdi_"+a[Math.floor(Math.random()*a.length)]](c,b,d)}function wdi_pause_stream(a){jQuery(a).find("video").each(function(){jQuery(this).get(0).pause()})}function wdi_reset_zoom(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));var b=document.querySelector('meta[name="viewport"]');if(a){if(b){b.content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0"}}};
|
js/wdi_admin.js
CHANGED
@@ -909,12 +909,6 @@ wdi_controller.bindSaveThemeEvent = function() {
|
|
909 |
jQuery('#wdi_current_id').attr('value', id);
|
910 |
jQuery('#wdi_save_feed').submit();
|
911 |
});
|
912 |
-
jQuery('#wdi_save_theme_reset').on('click', function() {
|
913 |
-
jQuery('#task').attr('value', 'reset_changes');
|
914 |
-
var id = jQuery('#wdi_add_or_edit').attr('value');
|
915 |
-
jQuery('#wdi_current_id').attr('value', id);
|
916 |
-
jQuery('#wdi_save_feed').submit();
|
917 |
-
});
|
918 |
}
|
919 |
|
920 |
|
909 |
jQuery('#wdi_current_id').attr('value', id);
|
910 |
jQuery('#wdi_save_feed').submit();
|
911 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
912 |
}
|
913 |
|
914 |
|
js/wdi_frontend.js
CHANGED
@@ -1464,6 +1464,10 @@ wdi_front.createObject = function (obj, currentFeed)
|
|
1464 |
else if(media_standard_h < media_standard_w){
|
1465 |
wdi_shape = 'landscape';
|
1466 |
}
|
|
|
|
|
|
|
|
|
1467 |
var photoObject = {
|
1468 |
'id': obj['id'],
|
1469 |
'caption': wdi_front.escape_tags(caption),
|
@@ -1472,10 +1476,10 @@ wdi_front.createObject = function (obj, currentFeed)
|
|
1472 |
'comments': obj['comments']['count'],
|
1473 |
'wdi_index': imageIndex,
|
1474 |
'wdi_res_index': currentFeed.resIndex,
|
1475 |
-
'wdi_media_user':
|
1476 |
'link': obj['link'],
|
1477 |
'video_url': videoUrl,
|
1478 |
-
'wdi_username':
|
1479 |
'wdi_shape': wdi_shape
|
1480 |
};
|
1481 |
return photoObject;
|
1464 |
else if(media_standard_h < media_standard_w){
|
1465 |
wdi_shape = 'landscape';
|
1466 |
}
|
1467 |
+
var obj_user_name = obj['user']['username'];
|
1468 |
+
if(obj_user_name === ""){
|
1469 |
+
obj_user_name = "no_user";
|
1470 |
+
}
|
1471 |
var photoObject = {
|
1472 |
'id': obj['id'],
|
1473 |
'caption': wdi_front.escape_tags(caption),
|
1476 |
'comments': obj['comments']['count'],
|
1477 |
'wdi_index': imageIndex,
|
1478 |
'wdi_res_index': currentFeed.resIndex,
|
1479 |
+
'wdi_media_user': obj_user_name,
|
1480 |
'link': obj['link'],
|
1481 |
'video_url': videoUrl,
|
1482 |
+
'wdi_username': obj_user_name,
|
1483 |
'wdi_shape': wdi_shape
|
1484 |
};
|
1485 |
return photoObject;
|
js/wdi_frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.escape_tags=function(e){var b=/</g,c=/>/g,d=/'/g,a=/"/g;if(typeof e=="undefined"){e=""}e=e.toString().replace(b,"<").replace(c,">").replace(d,"'").replace(a,""");return e};wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(d){jQuery(".wdi_js_error").hide();d.photoCounter=d.feed_row.number_of_photos;if(d.feed_row.liked_feed=="liked"){d.feed_users=["self"]}else{if(wdi_front.isJsonString(d.feed_row.feed_users)){d.feed_users=JSON.parse(d.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,d);return}}var e=[];if(typeof window.wdi_all_tags!=="undefined"){e=window.wdi_all_tags}for(var a=0;a<d.feed_users.length;a++){if(d.feed_users[a].username[0]==="#"&&typeof d.feed_users[a].tag_id!=="undefined"){e[d.feed_users[a].tag_id]=d.feed_users[a]}}window.wdi_all_tags=e;d.dataCount=d.feed_users.length;var b=wdi_front.getFeedItemResolution(d);d.feedImageResolution=b.image;d.feedVideoResolution=b.video;for(var c=0;c<d.dataCount;c++){wdi_front.instagramRequest(c,d)}if(d.feed_row.number_of_photos>0){wdi_front.ajaxLoader(d)}if(d.feed_row["display_header"]==="1"){wdi_front.show("header",d)}if(d.feed_row["show_usernames"]==="1"){wdi_front.show("users",d)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}},null,b.feed_row.hashtag_top_recent)}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")||d[e]["type"]=="video"){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,h){var j=(e.caption!=null)?e.caption["text"]:" ";var i="";if(e.type=="video"){i=e.hasOwnProperty("videos")?e.videos[h.feedVideoResolution]["url"]:""}if(typeof e.images[h.feedImageResolution]=="undefined"){var f=wdi_url.plugin_url+"images/missing.png"}else{var f=e.images[h.feedImageResolution].url}var a=h.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var g=e.images["standard_resolution"]["width"];if(d>g){b="portrait"}else{if(d<g){b="landscape"}}var c={id:e.id,caption:wdi_front.escape_tags(j),image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:h.resIndex,wdi_media_user:e.user["username"],link:e.link,video_url:i,wdi_username:e.user["username"],wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";var g=function(h){if(typeof h.meta!="undefined"&&typeof h.meta.error_type!="undefined"){wdi_front.show_alert(false,h,e)}if(h===""||typeof h=="undefined"||h==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}if(h.meta["code"]!=200){c=h.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}h.user_id=b.user_id;h.username=b.username;for(var j=0;j<e.usersData.length;j++){if(h.user_id===e.usersData[j]["user_id"]){if(h.user_id[0]==="#"){h.data=wdi_front.appendRequestHashtag(h.data,h.user_id)}if(d=="initial-keep"){e.temproraryUsersData[j]=e.usersData[j]}e.usersData[j]=h;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)};if(b.username[0]!=="#"){e.instagram.requestByUrl(a,{success:g})}else{e.instagram.getTagRecentMedia(b.username,{success:g},a,e.feed_row.hashtag_top_recent)}};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(d){var b=d.src.split("/p/");if(typeof b[0]!=="undefined"&&typeof b[1]!=="undefined"&&b[0]!=="https://www.instagram.com"){var a=wdi_baseName(b[0]);var c=a+"/p/"+b[1];d.src=c}else{d.src=wdi_url.plugin_url+"images/missing.png"}d.onerror="";return true};function wdi_baseName(b){var a=b.substr(b.lastIndexOf("/"));return b.replace(a,"")}wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(false&&g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var v={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var u=wdi_extractHostname(i[q]["website"]);var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:wdi_front.escape_tags(i[q]["bio"]),website:u,website_url:i[q]["website"],usersCount:t.feed_row.feed_users.length,hashtagClass:p};var x=wdi_front.getUserTemplate(t,i[q]["name"]),r=x(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(v);var w=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(w);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>';e+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if(((typeof c.dataStorageList[b]["user"]["id"]!="undefined"&&c.dataStorageList[b]["user"]["id"]==d[a]["id"])||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?wdi_front.escape_tags(f[d]["caption"]["text"]):""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){if(typeof c[b].pagination.cursors!=="undefined"){d=c[b].pagination.cursors.after}}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});function wdi_extractHostname(b){if(typeof b==="undefined"||b===""){return""}var a=b.replace(/(^\w+:|^)\/\//,"");return a};
|
1 |
+
if(typeof wdi_front=="undefined"){wdi_front={type:"not_declared"}}wdi_front.detectEvent=function(){var a=(/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));if(a){return"touchend"}else{return"click"}};var wdi_error_show=false;wdi_front.escape_tags=function(e){var b=/</g,c=/>/g,d=/'/g,a=/"/g;if(typeof e=="undefined"){e=""}e=e.toString().replace(b,"<").replace(c,">").replace(d,"'").replace(a,""");return e};wdi_front.show_alert=function(e,b,f){f=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter);if(b.meta["code"]===400&&b.meta["error_type"]==="APINotAllowedError"){if(typeof b.wdi_current_feed_name!="undefined"){var a=b.wdi_current_feed_name;var d=f.find(".wdi_private_feed_names");d.html(a);f.find(".wdi_private_feed_error").removeClass("wdi_hidden")}f.find(".wdi_spinner").remove()}if(typeof f!="undefined"&&b.meta["error_type"]!="APINotAllowedError"){f.find(".wdi_spinner").remove();wdi_error_show=true;var c=f.find(".wdi_js_error");var g=f.find(".wdi_token_error");if(b!=false&&typeof b.meta!=undefined&&b.meta.error_type==="OAuthAccessTokenException"){g.removeClass("wdi_hidden");if(wdi_front_messages.wdi_token_error_flag!="1"){jQuery.ajax({type:"POST",url:wdi_url.ajax_url,dataType:"json",data:{action:"wdi_token_flag",wdi_token_flag_nonce:wdi_front_messages.wdi_token_flag_nonce},success:function(h){}})}}else{c.removeClass("wdi_js_error");c.addClass("wdi_js_error_no_animate");jQuery(".wdi_js_error_no_animate").show()}if(wdi_front_messages.show_alerts){}else{console.log("%c"+e,"color:#cc0000;")}}wdi_error_show=true};wdi_front.globalInit=function(){var a=wdi_front.feed_counter;if(typeof wdi_ajax.ajax_response!="undefined"){var c=wdi_feed_counter_init.wdi_feed_counter_init}else{var c=0}for(var b=c;b<=a;b++){if(jQuery("#wdi_feed_"+b).length===0){continue}var d=new WDIFeed(window["wdi_feed_"+b]);d.instagram=new WDIInstagram();d.instagram.filterArguments={feed:d};d.instagram.filters=[{where:"getUserRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getTagRecentMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"getRecentLikedMedia",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}},{where:"requestByUrl",what:function(f,g,e){return g.feed.conditionalFilter(f,e)}}];d.instagram.addToken(d.feed_row["access_token"]);wdi_front.access_token=d.feed_row["access_token"];d.dataStorageRaw=[];d.dataStorage=[];d.dataStorageList=[];d.allResponseLength=0;d.currentResponseLength=0;d.temproraryUsersData=[];d.removedUsers=0;d.nowLoadingImages=true;d.imageIndex=0;d.resIndex=0;d.currentPage=1;d.userSortFlags=[];d.customFilterChanged=false;d.maxConditionalFiltersRequestCount=10;d.instagramRequestCounter=0;d.mediaRequestsDone=false;d.conditionalFilterBuffer=[];d.stopInfiniteScrollFlag=false;if(d.feed_row.feed_type=="masonry"){d.displayedData=[]}if(d.feed_row.feed_display_view=="pagination"){d.feed_row.resort_after_load_more=0;if(d.feed_row.feed_type!="image_browser"){d.feed_row.load_more_number=parseInt(d.feed_row.pagination_per_page_number);d.feed_row.number_of_photos=(1+parseInt(d.feed_row.pagination_preload_number))*d.feed_row.load_more_number}else{d.feed_row.number_of_photos=1+parseInt(d.feed_row.image_browser_preload_number);d.feed_row.load_more_number=parseInt(d.feed_row.image_browser_load_number)}d.freeSpaces=(Math.floor(d.feed_row.pagination_per_page_number/d.feed_row.number_of_columns)+1)*d.feed_row.number_of_columns-d.feed_row.pagination_per_page_number}else{d.freeSpaces=0}d.galleryBox=function(e){wdi_spider_createpopup(wdi_url.ajax_url+"?gallery_id="+this.feed_row.id+"&image_id="+e,this.feed_row.wdi_feed_counter,this.feed_row.lightbox_width,this.feed_row.lightbox_height,1,"testpopup",5,this,e)};wdi_responsive.columnControl(d);if(d.feed_row.feed_type=="masonry"){jQuery(window).trigger("resize")}wdi_front.bindEvents(d);window["wdi_feed_"+b]=d;wdi_front.init(d)}};wdi_front.init=function(d){jQuery(".wdi_js_error").hide();d.photoCounter=d.feed_row.number_of_photos;if(d.feed_row.liked_feed=="liked"){d.feed_users=["self"]}else{if(wdi_front.isJsonString(d.feed_row.feed_users)){d.feed_users=JSON.parse(d.feed_row.feed_users)}else{wdi_front.show_alert(wdi_front_messages.invalid_users_format,false,d);return}}var e=[];if(typeof window.wdi_all_tags!=="undefined"){e=window.wdi_all_tags}for(var a=0;a<d.feed_users.length;a++){if(d.feed_users[a].username[0]==="#"&&typeof d.feed_users[a].tag_id!=="undefined"){e[d.feed_users[a].tag_id]=d.feed_users[a]}}window.wdi_all_tags=e;d.dataCount=d.feed_users.length;var b=wdi_front.getFeedItemResolution(d);d.feedImageResolution=b.image;d.feedVideoResolution=b.video;for(var c=0;c<d.dataCount;c++){wdi_front.instagramRequest(c,d)}if(d.feed_row.number_of_photos>0){wdi_front.ajaxLoader(d)}if(d.feed_row["display_header"]==="1"){wdi_front.show("header",d)}if(d.feed_row["show_usernames"]==="1"){wdi_front.show("users",d)}};wdi_front.getFeedItemResolution=function(g){var d={image:"standard_resolution",video:"standard_resolution"};if(g.feed_row.feed_resolution==="thumbnail"){return{image:"thumbnail",video:"low_bandwidth"}}else{if(g.feed_row.feed_resolution==="low"){return{image:"low_resolution",video:"low_resolution"}}else{if(g.feed_row.feed_resolution==="standard"){return{image:"standard_resolution",video:"standard_resolution"}}}}var c=jQuery("#wdi_feed_"+g.feed_row.wdi_feed_counter).find(".wdi_feed_wrapper");c.append('<div class="wdi_feed_item" id="wdi_feed_item_example"></div>');wdi_responsive.columnControl(g,1);var b=c.attr("wdi-res").split("wdi_col_");c.find("#wdi_feed_item_example").remove();if(b.length!==2){return d}var a=parseInt(b[1]);if(a<=0){return d}var f=(c.width()/a)-10;var e=d;if(f<=150){e.image="thumbnail";e.video="low_bandwidth"}else{if(f>150&&f<=320){e.image="low_resolution";e.video="low_resolution"}else{e.image="standard_resolution";e.video="standard_resolution"}}return e};wdi_front.isJsonString=function(b){try{JSON.parse(b)}catch(a){return false}return true};wdi_front.instagramRequest=function(d,b){var a=b.feed_users,c=this;if(typeof a[d]==="string"&&a[d]==="self"){b.instagram.getRecentLikedMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveSelfUserData(e,b)}}})}else{if(this.getInputType(a[d]["username"])=="hashtag"){b.instagram.getTagRecentMedia(this.stripHashtag(a[d]["username"]),{success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}},null,b.feed_row.hashtag_top_recent)}else{if(this.getInputType(a[d]["username"])=="user"){b.instagram.getSelfRecentMedia({success:function(e){if(typeof e.meta!="undefined"&&typeof e.meta.error_type!="undefined"){e.wdi_current_feed_name=a[d].username;wdi_front.show_alert(false,e,b)}b.mediaRequestsDone=true;e=c.checkMediaResponse(e,b);if(e!=false){c.saveUserData(e,b.feed_users[d],b)}}})}}}};wdi_front.isHashtag=function(a){return(a[0]==="#")};wdi_front.saveUserData=function(d,a,b){d.username=a.username;d.user_id=a.id;if(d.user_id[0]==="#"){d.data=wdi_front.appendRequestHashtag(d.data,d.user_id)}b.usersData.push(d);b.currentResponseLength=wdi_front.getArrayContentLength(b.usersData,"data");b.allResponseLength+=b.currentResponseLength;if(b.dataCount==b.usersData.length){if(b.currentResponseLength<b.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(b)){wdi_front.loadMore("initial-keep",b)}else{wdi_front.displayFeed(b);wdi_front.applyFilters(b);if(!wdi_front.activeUsersCount(b)){if(b.feed_row.feed_display_view=="load_more_btn"){var c=jQuery("#wdi_feed_"+b.feed_row.wdi_feed_counter);c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.saveSelfUserData=function(c,a){c.username="";c.user_id="";a.usersData.push(c);a.currentResponseLength=wdi_front.getArrayContentLength(a.usersData,"data");a.allResponseLength+=a.currentResponseLength;if(a.dataCount==a.usersData.length){if(a.currentResponseLength<a.feed_row.number_of_photos&&!wdi_front.userHasNoPhoto(a)){wdi_front.loadMore("initial-keep",a)}else{wdi_front.displayFeed(a);wdi_front.applyFilters(a);if(!wdi_front.activeUsersCount(a)){if(a.feed_row.feed_display_view=="load_more_btn"){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter);b.find(".wdi_load_more").addClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}}}}};wdi_front.userHasNoPhoto=function(c,e){var a=0;var d=c.usersData;if(typeof e!="undefined"){d=e}for(var b=0;b<d.length;b++){if(typeof d[b]["pagination"]=="undefined"){d[b]["pagination"]=[]}if(c.feed_row.liked_feed==="liked"){if(typeof d[b]["pagination"]["next_max_like_id"]=="undefined"){a++}}else{if(typeof d[b]["pagination"]["next_max_id"]=="undefined"){a++}}}if(a==d.length){return 1}else{return 0}};wdi_front.appendRequestHashtag=function(c,b){for(var a=0;a<c.length;a++){c[a]["wdi_hashtag"]=b}return c};wdi_front.displayFeed=function(c,b){if(c.customFilterChanged==false){var d=wdi_front.feedSort(c,b)}var a=c.customFilterChanged;if(c.customFilterChanged==true){var d=c.customFilteredData;c.parsedData=wdi_front.parseLighboxData(c,true)}if(c.feed_row.resort_after_load_more!="1"){if(c.customFilterChanged==false){c.dataStorageList=c.dataStorageList.concat(d)}}else{if(c.customFilterChanged==false){c.dataStorageList=d}}if(c.feed_row.feed_type=="masonry"){wdi_front.masonryDisplayFeedItems(d,c)}if(c.feed_row.feed_type=="thumbnails"||c.feed_row.feed_type=="blog_style"||c.feed_row.feed_type=="image_browser"){wdi_front.displayFeedItems(d,c)}var e=wdi_front.getDataLength(c);if(e<c.photoCounter&&!a&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount&&!wdi_front.allDataHasFinished(c)){wdi_front.loadMore("",c)}else{wdi_front.allImagesLoaded(c)}if(c.instagramRequestCounter>c.maxConditionalFiltersRequestCount){wdi_front.allImagesLoaded(c);if(d.length==0){c.stopInfiniteScrollFlag=true}}if(c.feed_row.feed_display_view=="pagination"&&c.currentPage<c.paginator){jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter).find("#wdi_last_page").removeClass("wdi_disabled")}c.instagramRequestCounter=0;c.conditionalFilterBuffer=[];wdi_front.updateUsersImages(c)};wdi_front.updateUsersImages=function(a){var b=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter).find(".wdi_single_user .wdi_user_img_wrap img");b.each(function(){if(jQuery(this).attr("src")==wdi_url.plugin_url+"images/missing.png"||jQuery(this).attr("src")==""){if(a.feed_row.liked_feed=="liked"){return}for(var c=0;c<a.usersData.length;c++){if(a.usersData[c]["username"]==jQuery(this).parent().parent().find("h3").text()){if(a.usersData[c]["data"].length!=0){jQuery(this).attr("src",a.usersData[c]["data"][0]["images"]["thumbnail"]["url"])}}}}})};wdi_front.masonryDisplayFeedItems=function(d,h){var b=[];var p=[];if(jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}jQuery("#wdi_feed_"+h.feed_row.wdi_feed_counter+" .wdi_masonry_column").each(function(){if(h.feed_row.resort_after_load_more==1){jQuery(this).html("");h.imageIndex=0}if(h.customFilterChanged==true){jQuery(this).html("");h.imageIndex=0}if(h.feed_row.feed_display_view=="pagination"){b.push(0)}else{b.push(jQuery(this).height())}p.push(jQuery(this))});if(h.customFilterChanged==true){h.customFilterChanged=false}for(var e=0;e<d.length;e++){h.displayedData.push(d[e]);if(d[e]["type"]=="image"){var n=wdi_front.getPhotoTemplate(h)}else{if(d[e].hasOwnProperty("videos")||d[e]["type"]=="video"){var n=wdi_front.getVideoTemplate(h)}else{var n=wdi_front.getSliderTemplate(h)}}var g=d[e];var o=wdi_front.createObject(g,h);var f=n(o);var m=wdi_front.array_min(b);var l=wdi_front.getImageResolution(d[e]);p[m.index].html(p[m.index].html()+f);b[m.index]+=p[m.index].width()*l;h.imageIndex++;if(h.feed_row.feed_display_view=="pagination"){if((e+1)%h.feed_row.pagination_per_page_number===0){h.resIndex+=h.freeSpaces+1}else{h.resIndex++}}}h.wdi_loadedImages=0;var j=false;h.wdi_load_count=e;var a=h.feed_row.wdi_feed_counter;var k=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){h.wdi_loadedImages++;c();if(j===false){wdi_responsive.columnControl(h,1);j=true}});c();function c(){if(h.wdi_load_count===h.wdi_loadedImages&&h.wdi_loadedImages!=0){h.loadedImages=0;h.wdi_load_count=0;wdi_front.allImagesLoaded(h)}}if(h.paginatorNextFlag==true){wdi_front.updatePagination(h,"next")}h.infiniteScrollFlag=false};wdi_front.getImageResolution=function(c){var d=c.images["standard_resolution"]["width"];var b=c.images["standard_resolution"]["height"];var a=b/d;return a};wdi_front.getDataLength=function(b,d){var c=0;if(typeof d==="undefined"){for(var a=0;a<b.dataStorage.length;a++){c+=b.dataStorage[a].length}}else{for(var a=0;a<d.length;a++){c+=d[a].length}}return c};wdi_front.getArrayContentLength=function(d,c){var b=0;for(var a=0;a<d.length;a++){if(d[a]["finished"]=="finished"){continue}b+=d[a][c].length}return b};wdi_front.displayFeedItems=function(d,j){if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" .wdi_feed_wrapper");if(j.feed_row.resort_after_load_more==="1"){l.html("");j.imageIndex=0}if(j.customFilterChanged==true){l.html("");j.imageIndex=0;j.customFilterChanged=false}var g=wdi_front.getImgCount(j)-d.length-1;if(j.feed_row.feed_display_view=="pagination"){var b=j.feed_row.load_more_number;if(j.feed_row.feed_type=="image_browser"){b=1}if(jQuery("#wdi_feed_"+j.feed_row.wdi_feed_counter+' [wdi_page="'+(j.currentPage-1)+'"]').length<b||d.length==0){j.currentPage=(--j.currentPage<=1)?1:j.currentPage}}for(var e=0;e<d.length;e++){if(d[e]["type"]=="image"){var m=wdi_front.getPhotoTemplate(j)}else{if(d[e].hasOwnProperty("videos")){var m=wdi_front.getVideoTemplate(j)}else{var m=wdi_front.getSliderTemplate(j)}}var h=d[e];var n=wdi_front.createObject(h,j);var f=m(n);l.html(l.html()+f);j.imageIndex++;if(j.feed_row.feed_display_view=="pagination"){if((e+1)%j.feed_row.pagination_per_page_number===0){j.resIndex+=j.freeSpaces+1}else{j.resIndex++}}}j.wdi_loadedImages=0;var k=false;j.wdi_load_count=e;var a=j.feed_row.wdi_feed_counter;var l=jQuery("#wdi_feed_"+a+" img.wdi_img").on("load",function(){j.wdi_loadedImages++;c();if(k===false){wdi_responsive.columnControl(j,1);k=true}});function c(){if(j.wdi_load_count===j.wdi_loadedImages&&j.wdi_loadedImages!=0){j.loadedImages=0;j.wdi_load_count=0;wdi_front.allImagesLoaded(j)}}if(j.paginatorNextFlag==true){wdi_front.updatePagination(j,"next")}j.infiniteScrollFlag=false};wdi_front.checkFeedFinished=function(b){for(var a=0;a<b.usersData.length;a++){if(typeof b.usersData[a]["finished"]=="undefined"){return false}}return true};wdi_front.sortingOperator=function(c,b){var a;switch(c){case"date":switch(b){case"asc":a=function(e,d){return(e.created_time>d.created_time)?1:-1};break;case"desc":a=function(e,d){return(e.created_time>d.created_time)?-1:1};break}break;case"likes":switch(b){case"asc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?-1:1};break;case"desc":a=function(e,d){return(e.likes["count"]<d.likes["count"])?1:-1};break}break;case"comments":switch(b){case"asc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?-1:1};break;case"desc":a=function(e,d){return(e.comments["count"]<d.comments["count"])?1:-1};break}break;case"random":a=function(e,d){var f=Math.random();return(f>0.5)?1:-1};break}return a};wdi_front.feedSort=function(e,b){var d=e.feed_row.sort_images_by;var c=e.feed_row.display_order;if(e.feed_row.resort_after_load_more==="1"){e.data=e.data.concat(wdi_front.smartPicker(e,b))}else{e.data=wdi_front.smartPicker(e,b)}var a=wdi_front.sortingOperator(d,c);e.data.sort(a);return e.data};wdi_front.smartPicker=function(l,c){var g=[];var a=0;var k=[];var f=Math.ceil(l.feed_row["number_of_photos"]/l.usersData.length);var b=parseInt(l.feed_row["number_of_photos"]);var n=0;if(c!=""&&typeof c!="undefined"&&c!=null){b=parseInt(c);f=Math.ceil(b/wdi_front.activeUsersCount(l))}var j=function(p,i){return(p.data.length>i.data.length)?1:-1};var e=function(p,i){return(p.length()>i.length())?1:-1};l.storeRawData(l.usersData,"dataStorageRaw");var o=l.dataStorageRaw.sort(e);var h=l.usersData.sort(j);for(var d=0;d<h.length;d++){n+=f;if(o[d].length()<=n){n-=o[d].length();g.push(o[d].getData(o[d].length()));a+=g[g.length-1].length}else{if(a+n>b){n=b-a}var m=[];if(l.auto_trigger===false){m=m.concat(o[d].getData(n))}else{if(m.length+wdi_front.getDataLength(l)+wdi_front.getDataLength(l,g)<l.feed_row["number_of_photos"]){m=m.concat(o[d].getData(n))}}n=0;a+=m.length;g.push(m)}}for(d=0;d<g.length;d++){if(typeof l.dataStorage[d]==="undefined"){l.dataStorage.push(g[d])}else{l.dataStorage[d]=l.dataStorage[d].concat(g[d])}}l.parsedData=wdi_front.parseLighboxData(l);for(d=0;d<g.length;d++){k=k.concat(g[d])}return k};wdi_front.createObject=function(e,i){var k=(e.caption!=null)?e.caption["text"]:" ";var j="";if(e.type=="video"){j=e.hasOwnProperty("videos")?e.videos[i.feedVideoResolution]["url"]:""}if(typeof e.images[i.feedImageResolution]=="undefined"){var f=wdi_url.plugin_url+"images/missing.png"}else{var f=e.images[i.feedImageResolution].url}var a=i.imageIndex;var b="square";var d=e.images["standard_resolution"]["height"];var h=e.images["standard_resolution"]["width"];if(d>h){b="portrait"}else{if(d<h){b="landscape"}}var g=e.user["username"];if(g===""){g="no_user"}var c={id:e.id,caption:wdi_front.escape_tags(k),image_url:f,likes:e.likes["count"],comments:e.comments["count"],wdi_index:a,wdi_res_index:i.resIndex,wdi_media_user:g,link:e.link,video_url:j,wdi_username:g,wdi_shape:b};return c};wdi_front.setPage=function(c){var b=c.feed_row.feed_display_view;var e=c.feed_row.feed_type;if(b!="pagination"){return""}var a=c.imageIndex;if(e=="image_browser"){var d=1}else{var d=Math.abs(c.feed_row.pagination_per_page_number)}c.paginator=Math.ceil((a+1)/d);return c.paginator};wdi_front.getPhotoTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-arrows-alt";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.getSliderTemplate=function(g){var e=wdi_front.setPage(g);var j="";var k="";var l="";var d="";var m="fa-clone";var c="";if(g.feed_row.feed_type=="blog_style"||g.feed_row.feed_type=="image_browser"){m=""}if(e!=""){k='wdi_page="'+e+'"';sourceAttr="src"}else{sourceAttr="src"}if(e!=""&&e!=1){j="wdi_hidden"}if(g.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(g.feed_row.show_full_description==1&&g.feed_row.feed_type=="masonry"){j+=" wdi_full_caption"}var f="";if(g.feed_row.feed_type!=="blog_style"){if(g.feed_row.feed_type=="masonry"){f="wdi_responsive.showMasonryCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}else{f="wdi_responsive.showCaption(jQuery(this),"+g.feed_row.wdi_feed_counter+");"}}switch(g.feed_row.feed_item_onclick){case"lightbox":l="onclick=wdi_feed_"+g.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":l="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";m="fa-clone";break;case"custom_redirect":l="onclick=\"window.open ('"+g.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";m="";break;case"none":l="";d="wdi_cursor_off wdi_hover_off";m=""}var h="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=g.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+j+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+k+' wdi_type="slideshow" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+h+'"><img class="wdi_img" '+sourceAttr+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" >'+c+'<div class="wdi_thumb_icon" '+l+' style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+m+'"></i></div></div></div></div></div></div>';if(g.feed_row["show_likes"]==="1"||g.feed_row["show_comments"]==="1"||g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(g.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(g.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(g.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+f+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var i=_.template(a);return i};wdi_front.replaceToVideo=function(b,a,c){overlayHtml="<video style='width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;' controls=''><source src='"+b+"' type='video/mp4'>Your browser does not support the video tag. </video>";jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner').html(overlayHtml);jQuery("#wdi_feed_"+c+' [wdi_index="'+a+'"] .wdi_photo_wrap_inner video').get(0).play()};wdi_front.getVideoTemplate=function(h){var f=wdi_front.setPage(h);var k="";var l="";var n="fa-play";var m="";var d="";var e;var c="";if(f!=""){l='wdi_page="'+f+'"';e="src"}else{e="src"}if(f!=""&&f!=1){k="wdi_hidden"}if(h.feed_row.show_username_on_thumb=="1"){c='<span class="wdi_media_user">@<%= wdi_username%></span>'}if(h.feed_row.show_full_description==1&&h.feed_row.feed_type=="masonry"){k+=" wdi_full_caption"}var g="";if(h.feed_row.feed_type!=="blog_style"){if(h.feed_row.feed_type=="masonry"){g="wdi_responsive.showMasonryCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}else{g="wdi_responsive.showCaption(jQuery(this),"+h.feed_row.wdi_feed_counter+");"}}switch(h.feed_row.feed_item_onclick){case"lightbox":m="onclick=wdi_feed_"+h.feed_row.wdi_feed_counter+".galleryBox('<%=id%>')";break;case"instagram":m="onclick=\"window.open ('<%= link%>','_blank')\"";d="wdi_hover_off";n="fa-play";break;case"custom_redirect":m="onclick=\"window.open ('"+h.feed_row.redirect_url+"','_self')\"";d="wdi_hover_off";n="";break;case"none":d="wdi_cursor_off wdi_hover_off";n="";if(h.feed_row.feed_type=="blog_style"||h.feed_row.feed_type=="image_browser"){m="onclick=wdi_front.replaceToVideo('<%= video_url%>','<%= wdi_index%>',"+h.feed_row.wdi_feed_counter+")";d="";n="fa-play"}}var i="<%= wdi_shape == 'square' ? 'wdi_shape_square' : (wdi_shape == 'portrait' ? 'wdi_shape_portrait' : (wdi_shape == 'landscape' ? 'wdi_shape_landscape' : 'wdi_shape_square') ) %>";var b=h.feed_row.wdi_feed_counter;var a='<div class="wdi_feed_item '+k+'" wdi_index=<%= wdi_index%> wdi_res_index=<%= wdi_res_index%> wdi_media_user=<%= wdi_media_user%> '+l+' wdi_type="image" id="wdi_'+b+'_<%=id%>"><div class="wdi_photo_wrap"><div class="wdi_photo_wrap_inner"><div class="wdi_photo_img '+i+'"><img class="wdi_img" '+e+'="<%=image_url%>" alt="feed_image" onerror="wdi_front.brokenImageHandler(this);"><div class="wdi_photo_overlay '+d+'" '+m+">"+c+'<div class="wdi_thumb_icon" style="display:table;width:100%;height:100%;"><div style="display:table-cell;vertical-align:middle;text-align:center;color:white;"><i class="fa '+n+'"></i></div></div></div></div></div></div>';if(h.feed_row["show_likes"]==="1"||h.feed_row["show_comments"]==="1"||h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_meta">';if(h.feed_row["show_likes"]==="1"){a+='<div class="wdi_thumb_likes"><i class="fa fa-heart-o"> <%= likes%></i></div>'}if(h.feed_row["show_comments"]==="1"){a+='<div class="wdi_thumb_comments"><i class="fa fa-comment-o"> <%= comments%></i></div>'}a+='<div class="wdi_clear"></div>';if(h.feed_row["show_description"]==="1"){a+='<div class="wdi_photo_title" onclick='+g+" ><%=caption%></div>"}a+="</div>"}a+="</div>";var j=_.template(a);return j};wdi_front.bindEvents=function(a){if(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").length==0){return}if(a.feed_row.feed_display_view=="load_more_btn"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_load_more_container").on(wdi_front.clickOrTouch,function(){wdi_front.loadMore(jQuery(this).find(".wdi_load_more_wrap"))})}if(a.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_next").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorNext(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_prev").on(wdi_front.clickOrTouch,function(){wdi_front.paginatorPrev(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_last_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationLastPage(jQuery(this),a)});jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_first_page").on(wdi_front.clickOrTouch,function(){wdi_front.paginationFirstPage(jQuery(this),a)});a.paginatorNextFlag=false}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery(window).on("scroll",function(){wdi_front.infiniteScroll(a)});a.infiniteScrollFlag=false}};wdi_front.infiniteScroll=function(a){if((jQuery(window).scrollTop()+jQuery(window).height()-100)>=jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll").offset().top){if(a.infiniteScrollFlag===false&&a.stopInfiniteScrollFlag==false){a.infiniteScrollFlag=true;wdi_front.loadMore(jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" #wdi_infinite_scroll"),a)}else{if(a.stopInfiniteScrollFlag){wdi_front.allImagesLoaded(a)}}}};wdi_front.paginationFirstPage=function(b,c){if(c.paginator==1||c.currentPage==1){b.addClass("wdi_disabled");return}var d=c.currentPage;c.currentPage=1;wdi_front.updatePagination(c,"custom",d);var a=b.parent().find("#wdi_last_page");a.removeClass("wdi_disabled");b.addClass("wdi_disabled")};wdi_front.paginationLastPage=function(a,b){if(b.paginator==1||b.currentPage==b.paginator){return}var d=b.currentPage;b.currentPage=b.paginator;wdi_front.updatePagination(b,"custom",d);a.addClass("wdi_disabled");var c=a.parent().find("#wdi_first_page");c.removeClass("wdi_disabled")};wdi_front.paginatorNext=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");c.paginatorNextFlag=true;if(c.paginator==c.currentPage&&!wdi_front.checkFeedFinished(c)){c.currentPage++;var e=c.feed_row.number_of_photos;wdi_front.loadMore(b,c,e);a.addClass("wdi_disabled")}else{if(c.paginator>c.currentPage){c.currentPage++;wdi_front.updatePagination(c,"next");if(c.paginator>c.currentPage){a.removeClass("wdi_disabled")}else{a.addClass("wdi_disabled")}}}d.removeClass("wdi_disabled")};wdi_front.paginatorPrev=function(b,c){var a=b.parent().find("#wdi_last_page");var d=b.parent().find("#wdi_first_page");if(c.currentPage==1){d.addClass("wdi_disabled");return}c.currentPage--;wdi_front.updatePagination(c,"prev");a.removeClass("wdi_disabled");if(c.currentPage==1){d.addClass("wdi_disabled")}};wdi_front.updatePagination=function(b,a,d){var c="#wdi_feed_"+b.feed_row.wdi_feed_counter;jQuery(c+' [wdi_page="'+b.currentPage+'"]').each(function(){jQuery(this).removeClass("wdi_hidden")});switch(a){case"next":var d=b.currentPage-1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"prev":var d=b.currentPage+1;jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")});break;case"custom":var d=d;if(d!=b.currentPage){jQuery(c+" .wdi_feed_wrapper").height(jQuery(".wdi_feed_wrapper").height());jQuery(c+' [wdi_page="'+d+'"]').each(function(){jQuery(this).addClass("wdi_hidden")})}break}b.paginatorNextFlag=false;jQuery(c+" .wdi_feed_wrapper").css("height","auto");jQuery(c+" #wdi_current_page").text(b.currentPage)};wdi_front.loadMore=function(f,k){var b=0;if(f!=""&&typeof f!="undefined"&&f!="initial"&&f!="initial-keep"){var l=window[f.parent().parent().parent().parent().attr("id")]}if(typeof k!="undefined"){var l=k}var n=0,g=0;for(var e=0;e<l.userSortFlags.length;e++){if(l.userSortFlags[e].flag===true){n++;for(var d=0;d<l.usersData.length;d++){if(l.userSortFlags[e]["id"]===l.usersData[d]["user_id"]){if(l.usersData[d]["finished"]==="finished"){g++}}}}}if(n===g&&n!=0){return}if(f===""){l.auto_trigger=true}else{l.auto_trigger=false}wdi_front.ajaxLoader(l);if(l.feed_row.feed_type==="masonry"&&l.feed_row.feed_display_view=="pagination"){jQuery("#wdi_feed_"+wdi_front.feed_counter+" .wdi_full_caption").each(function(){jQuery(this).find(".wdi_photo_title").trigger(wdi_front.clickOrTouch)})}for(var e=0;e<l.usersData.length;e++){if(l.usersData[e]["finished"]==="finished"){b++}}if(b===l.usersData.length){wdi_front.allImagesLoaded(l);jQuery("#wdi_feed_"+l.feed_row["wdi_feed_counter"]+" .wdi_load_more").remove()}var h=l.usersData;l.loadMoreDataCount=l.feed_users.length;for(var e=0;e<h.length;e++){var m=h[e]["pagination"];var c={user_id:h[e]["user_id"],username:h[e]["username"]};if(m.next_url!=""&&m.next_url!=null&&typeof m.next_url!="undefined"){var a=m.next_url;wdi_front.loadMoreRequest(c,a,l,f)}else{if(f=="initial-keep"){l.temproraryUsersData[e]=l.usersData[e]}l.loadMoreDataCount--;wdi_front.checkForLoadMoreDone(l,f);continue}}};wdi_front.loadMoreRequest=function(b,a,e,d){if(!e.mediaRequestsDone){return}var f=e.usersData;var c="";var g=function(h){if(typeof h.meta!="undefined"&&typeof h.meta.error_type!="undefined"){wdi_front.show_alert(false,h,e)}if(h===""||typeof h=="undefined"||h==null){c=wdi_front_messages.network_error;e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}if(h.meta["code"]!=200){c=h.meta["error_message"];e.loadMoreDataCount--;wdi_front.show_alert(c,h,e);return}h.user_id=b.user_id;h.username=b.username;for(var j=0;j<e.usersData.length;j++){if(h.user_id===e.usersData[j]["user_id"]){if(h.user_id[0]==="#"){h.data=wdi_front.appendRequestHashtag(h.data,h.user_id)}if(d=="initial-keep"){e.temproraryUsersData[j]=e.usersData[j]}e.usersData[j]=h;e.loadMoreDataCount--}}wdi_front.checkForLoadMoreDone(e,d)};if(b.username[0]!=="#"){e.instagram.requestByUrl(a,{success:g})}else{e.instagram.getTagRecentMedia(b.username,{success:g},a,e.feed_row.hashtag_top_recent)}};wdi_front.checkForLoadMoreDone=function(c,b){var a=c.feed_row.load_more_number;var e=c.feed_row.number_of_photos;if(c.loadMoreDataCount==0){c.temproraryUsersData=wdi_front.mergeData(c.temproraryUsersData,c.usersData);var d=wdi_front.getArrayContentLength(c.temproraryUsersData,"data");if(b=="initial-keep"){b="initial"}if(b=="initial"){if(d<e&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore("initial",c)}else{c.usersData=c.temproraryUsersData;wdi_front.displayFeed(c);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}else{if(d<a&&!wdi_front.userHasNoPhoto(c,c.temproraryUsersData)&&c.instagramRequestCounter<=c.maxConditionalFiltersRequestCount){wdi_front.loadMore(undefined,c)}else{c.usersData=c.temproraryUsersData;if(!wdi_front.activeUsersCount(c)){return}wdi_front.displayFeed(c,a);wdi_front.applyFilters(c);c.temproraryUsersData=[]}}}};wdi_front.allDataHasFinished=function(b){var d=0;for(var a=0;a<b.dataStorageRaw.length;a++){if(b.dataStorageRaw[a].length()==0&&b.dataStorageRaw[a].locked==true){d++}}return(d==b.dataStorageRaw.length)};wdi_front.mergeData=function(c,b){for(var a=0;a<b.length;a++){if(typeof c[a]!="undefined"){if(b[a]["finished"]=="finished"){continue}if(typeof c[a]["pagination"]["next_max_id"]=="undefined"&&typeof c[a]["pagination"]["next_max_like_id"]=="undefined"){continue}c[a]["data"]=c[a]["data"].concat(b[a]["data"]);c[a]["pagination"]=b[a]["pagination"];c[a]["user_id"]=b[a]["user_id"];c[a]["username"]=b[a]["username"];c[a]["meta"]=b[a]["meta"]}else{c.push(b[a])}}return c};wdi_front.brokenImageHandler=function(d){var b=d.src.split("/p/");if(typeof b[0]!=="undefined"&&typeof b[1]!=="undefined"&&b[0]!=="https://www.instagram.com"){var a=wdi_baseName(b[0]);var c=a+"/p/"+b[1];d.src=c}else{d.src=wdi_url.plugin_url+"images/missing.png"}d.onerror="";return true};function wdi_baseName(b){var a=b.substr(b.lastIndexOf("/"));return b.replace(a,"")}wdi_front.ajaxLoader=function(a){var d=a.feed_row.wdi_feed_counter;var c=jQuery("#wdi_feed_"+d);if(a.feed_row.feed_display_view=="load_more_btn"){c.find(".wdi_load_more").addClass("wdi_hidden");c.find(".wdi_spinner").removeClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){var b;if(c.find(".wdi_ajax_loading").length==0){b=jQuery('<div class="wdi_ajax_loading"><div><div><img class="wdi_load_more_spinner" src="'+wdi_url.plugin_url+'images/ajax_loader.png"></div></div></div>');c.append(b)}else{b=c.find(".wdi_ajax_loading")}b.removeClass("wdi_hidden")}};wdi_front.allImagesLoaded=function(a){var d=wdi_front.getDataLength(a);if(!a.mediaRequestsDone){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").remove("wdi_nomedia")}if(d==0&&a.mediaRequestsDone&&(a.feed_row.conditional_filters.length==0||a.feed_row.conditional_filter_enable==0)){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_feed_wrapper").append("<p class='wdi_nomedia'>"+wdi_front_messages.feed_nomedia+"</p>")}var c=a.feed_row.wdi_feed_counter;var b=jQuery("#wdi_feed_"+c);if(a.feed_row.feed_display_view=="load_more_btn"){b.find(".wdi_load_more").removeClass("wdi_hidden");b.find(".wdi_spinner").addClass("wdi_hidden")}if(a.feed_row.feed_display_view=="infinite_scroll"){jQuery("#wdi_feed_"+a.feed_row.wdi_feed_counter+" .wdi_ajax_loading").addClass("wdi_hidden")}b.trigger("wdi_feed_loaded")};wdi_front.show=function(b,c){var e=c.feed_row.wdi_feed_counter;var d=jQuery("#wdi_feed_"+e+" .wdi_feed_container");var g=this;switch(b){case"header":f();break;case"users":a(c);break}function f(){var i={feed_thumb:c.feed_row["feed_thumb"],feed_name:c.feed_row["feed_name"]};var k=wdi_front.getHeaderTemplate(),h=k(i),j=d.find(".wdi_feed_header").html();d.find(".wdi_feed_header").html(j+h)}function a(j){d.find(".wdi_feed_users").html("");var n=j.feed_users;var m=j.feed_row["access_token"];var h=0;j.headerUserinfo=[];k();function k(){if(j.headerUserinfo.length==n.length){l(j.headerUserinfo,j);return}var i=n[j.headerUserinfo.length];if(typeof i==="string"&&i==="self"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}else{if(false&&g.getInputType(i.username)=="hashtag"){j.instagram.searchForTagsByName(g.stripHashtag(i.username),{success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false){if(o.data.length==0){var p="";var q={media:""}}else{var p="";var q={media:o.data[0]["media_count"]}}var r={name:n[h]["username"],url:p,counts:q};h++;j.headerUserinfo.push(r);k()}},args:{ignoreFiltering:true}})}else{if(g.getInputType(i.username)=="user"){j.instagram.getSelfInfo({success:function(o){if(typeof o.meta!="undefined"&&typeof o.meta.error_type!="undefined"){wdi_front.show_alert(false,o,j)}o=g.checkMediaResponse(o,j);if(o!=false&&o.meta["code"]===400&&o.meta["error_type"]==="APINotAllowedError"){var p=null;j.headerUserinfo.push(p);h++;k()}if(o!=false&&o.meta["code"]===200){var p={id:o.data["id"],name:o.data["username"],url:o.data["profile_picture"],bio:wdi_front.escape_tags(o.data["bio"]),counts:o.data["counts"],website:wdi_front.escape_tags(o.data["website"]),full_name:wdi_front.escape_tags(o.data["full_name"])};j.headerUserinfo.push(p);h++;k()}},args:{ignoreFiltering:true}})}}}}function l(i,t){d.find(".wdi_feed_users").html("");for(var q=0;q<i.length;q++){if(i[q]===null){continue}var v={flag:false,id:i[q]["id"],name:i[q]["name"]};var p=(i[q]["name"][0]=="#")?"wdi_header_hashtag":"";var u=wdi_extractHostname(i[q]["website"]);var o={user_index:q,user_img_url:i[q]["url"],counts:i[q]["counts"],feed_counter:t.feed_row.wdi_feed_counter,user_name:i[q]["name"],bio:wdi_front.escape_tags(i[q]["bio"]),website:u,website_url:i[q]["website"],usersCount:t.feed_row.feed_users.length,hashtagClass:p};var x=wdi_front.getUserTemplate(t,i[q]["name"]),r=x(o),s=d.find(".wdi_feed_users").html();d.find(".wdi_feed_users").html(s+r);t.userSortFlags.push(v);var w=jQuery('<div class="wdi_clear"></div>')}d.find(".wdi_feed_users").append(w);wdi_front.updateUsersImages(t)}}};wdi_front.getUserTemplate=function(c,h){var a=c.dataCount,d,f,g;switch(h[0]){case"#":d="//instagram.com/explore/tags/"+h.substr(1,h.length);break;default:d="//instagram.com/"+h;break}g='window.open("'+d+'","_blank")';f="onclick='"+g+"'";var e='<div class="wdi_single_user" user_index="<%=user_index%>"><div class="wdi_header_user_text <%=hashtagClass%>"><div class="wdi_user_img_wrap"><img onerror="wdi_front.brokenImageHandler(this);" src="<%= user_img_url%>">';if(a>1){e+='<div title="'+wdi_front_messages.filter_title+'" class="wdi_filter_overlay"><div class="wdi_filter_icon"><span onclick="wdi_front.addFilter(<%=user_index%>,<%=feed_counter%>);" class="fa fa-filter"></span></div></div>'}e+="</div>";e+="<h3 "+f+"><%= user_name%></h3>";if(h[0]!=="#"){if(c.feed_row.follow_on_instagram_btn=="1"){e+='<div class="wdi_user_controls"><div class="wdi_follow_btn" onclick="window.open(\'//instagram.com/<%= user_name%>\',\'_blank\')"><span> '+wdi_front_messages.follow+"</span></div></div>"}e+='<div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span class="fa fa-user"></span><%= counts.followed_by%></p></div>'}else{e+='<div class="wdi_user_controls"></div><div class="wdi_media_info"><p class="wdi_posts"><span class="fa fa-camera-retro"></span><%= counts.media%></p><p class="wdi_followers"><span></span></p></div>'}e+='<div class="wdi_clear"></div>';if(a==1&&h[0]!=="#"&&c.feed_row.display_user_info=="1"){e+='<div class="wdi_bio"><%= bio%></div>';e+='<div class="wdi_website"><a target="_blank" href="<%= website_url%>" ><%= website%></a></div>'}e+="</div></div>";var b=_.template(e);return b};wdi_front.getHeaderTemplate=function(){var b='<div class="wdi_header_wrapper"><div class="wdi_header_img_wrap"><img src="<%=feed_thumb%>"></div><div class="wdi_header_text"><%=feed_name%></div><div class="wdi_clear"></div>';var a=_.template(b);return a};wdi_front.addFilter=function(e,g){var f=window["wdi_feed_"+g];var d=f.dataCount;if(d<2){return}if(f.nowLoadingImages!=false){return}else{var c=jQuery("#wdi_feed_"+f.feed_row.wdi_feed_counter+'_users [user_index="'+e+'"]');c.find(".wdi_filter_overlay").toggleClass("wdi_filter_active_bg");c.find(".wdi_header_user_text h3").toggleClass("wdi_filter_active_col");c.find(".wdi_media_info").toggleClass("wdi_filter_active_col");c.find(".wdi_follow_btn").toggleClass("wdi_filter_active_col");f.customFilterChanged=true;if(f.userSortFlags[e]["flag"]==false){f.userSortFlags[e]["flag"]=true}else{f.userSortFlags[e]["flag"]=false}var a=0;for(var b=0;b<f.userSortFlags.length;b++){if(f.userSortFlags[b]["flag"]==true){a++}}if(f.feed_row.feed_display_view=="pagination"){f.resIndex=0}if(a!=0){wdi_front.filterData(f);wdi_front.displayFeed(f)}else{f.customFilteredData=f.dataStorageList;wdi_front.displayFeed(f)}if(f.feed_row.feed_display_view=="pagination"){f.paginator=Math.ceil((f.imageIndex)/parseInt(f.feed_row.pagination_per_page_number));f.currentPage=f.paginator;wdi_front.updatePagination(f,"custom",1);jQuery("#wdi_first_page").removeClass("wdi_disabled");jQuery("#wdi_last_page").addClass("wdi_disabled")}}};wdi_front.filterData=function(c){var d=c.userSortFlags;c.customFilteredData=[];for(var b=0;b<c.dataStorageList.length;b++){for(var a=0;a<d.length;a++){if(((typeof c.dataStorageList[b]["user"]["id"]!="undefined"&&c.dataStorageList[b]["user"]["id"]==d[a]["id"])||c.dataStorageList[b]["wdi_hashtag"]==d[a]["name"])&&d[a]["flag"]==true){c.customFilteredData.push(c.dataStorageList[b])}}}};wdi_front.applyFilters=function(c){for(var b=0;b<c.userSortFlags.length;b++){if(c.userSortFlags[b]["flag"]==true){var a=jQuery("#wdi_feed_"+c.feed_row.wdi_feed_counter+'[user_index="'+b+'"]');wdi_front.addFilter(b,c.feed_row.wdi_feed_counter);wdi_front.addFilter(b,c.feed_row.wdi_feed_counter)}}};wdi_front.getImgCount=function(b){var d=b.dataStorage;var c=0;for(var a=0;a<d.length;a++){c+=d[a].length}return c};wdi_front.parseLighboxData=function(k,m){var g=k.dataStorage;var l=k.feed_row.sort_images_by;var a=k.feed_row.display_order;var h=wdi_front.sortingOperator(l,a);var f=[];var b=[];var e={};if(m==true){f=k.customFilteredData}else{for(var d=0;d<g.length;d++){for(var c=0;c<g[d].length;c++){f.push(g[d][c])}}f.sort(h)}for(d=0;d<f.length;d++){e={alt:"",avg_rating:"",comment_count:f[d]["comments"]["count"],date:wdi_front.convertUnixDate(f[d]["created_time"]),description:wdi_front.getDescription((f[d]["caption"]!==null)?wdi_front.escape_tags(f[d]["caption"]["text"]):""),filename:wdi_front.getFileName(f[d]),filetype:wdi_front.getFileType(f[d]),hit_count:"0",id:f[d]["id"],image_url:f[d]["link"],number:0,rate:"",rate_count:"0",username:f[d]["user"]["username"],profile_picture:f[d]["user"]["profile_picture"],thumb_url:f[d]["link"]+"media/?size=t",comments_data:f[d]["comments"]["data"],images:f[d]["images"],carousel_media:(typeof f[d]["carousel_media"]!=="undefined")?f[d]["carousel_media"]:null};b.push(e)}return b};wdi_front.convertUnixDate=function(b){var c=parseInt(b);var a=new Date(0);a.setUTCSeconds(c);var d=a.getFullYear()+"-"+a.getMonth()+"-"+a.getDate();d+=" "+a.getHours()+":"+a.getMinutes();return d};wdi_front.getDescription=function(a){a=a.replace(/\r?\n|\r/g," ");return a};wdi_front.getFileName=function(d){var c=d.link;var b=d.type;if(b==="video"&&d.hasOwnProperty("videos")){return d.videos["standard_resolution"]["url"]}else{var a=c.split("/");return a[a.length-2]}};wdi_front.getFileType=function(a){if(a.type=="video"&&a.hasOwnProperty("videos")){return"EMBED_OEMBED_INSTAGRAM_VIDEO"}else{return"EMBED_OEMBED_INSTAGRAM_IMAGE"}};wdi_front.array_max=function(d){var a=d[0];var b=0;for(var c=1;c<d.length;c++){if(a<d[c]){a=d[c];b=c}}return{value:a,index:b}};wdi_front.array_min=function(d){var c=d[0];var a=0;for(var b=1;b<d.length;b++){if(c>d[b]){c=d[b];a=b}}return{value:c,index:a}};wdi_front.activeUsersCount=function(c){var a=0;for(var b=0;b<c.usersData.length;b++){if(c.usersData[b].finished!="finished"){a++}}return a};wdi_front.checkMediaResponse=function(a,b){if(a!=""&&typeof a!="undefined"&&a!=null&&a.meta["code"]===400&&a.meta["error_type"]==="APINotAllowedError"){return a}if(a==""||typeof a=="undefined"||a==null){errorMessage=wdi_front_messages.connection_error;wdi_front.show_alert(errorMessage,a,b);return false}if(a.meta["code"]!=200){errorMessage=a.meta["error_message"];wdi_front.show_alert(errorMessage,a,b);return false}return a};wdi_front.stripHashtag=function(a){switch(a[0]){case"#":return a.substr(1,a.length);break;default:return a;break}};wdi_front.getInputType=function(a){switch(a[0]){case"#":return"hashtag";break;case"%":return"location";break;default:return"user";break}};wdi_front.regexpTestCaption=function(h,e){var d=false,b=false,f=[],g=e.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&"),c=new RegExp("(?:^|\\s)"+g+"(?:^|\\s)"),a=new RegExp("(?:^|\\s)"+g,"g");if(c.exec(h)!=null){d=true}while((match=a.exec(h))!=null){if(match.index==h.length-e.length-1){b=true}}if(d==true||b==true){return true}else{return false}};wdi_front.replaceNewLines=function(c){var b="vUkCJvN2ps3t",a=[],g;c=c.replace(/\r?\n|\r/g,b);g=new RegExp(b,"g");while((match=g.exec(c))!=null){a.push(match.index)}var f=c.split(b);var e=0;for(var d=0;d<f.length;d++){if(f[d]==""){e++}else{e=0}if(e>0){f.splice(d,1);e--;d--}}c=f.join(" ");return c};wdi_front.isEmptyObject=function(a){for(var b in a){if(a.hasOwnProperty(b)){return false}}return true};var WDIFeed=function(a){this["data"]=a.data;this["dataCount"]=a.dataCount;this["feed_row"]=a.feed_row;this["usersData"]=a.usersData;_this=this;this.set_images_loading_flag=function(b){window.addEventListener("load",function(){b.nowLoadingImages=false})};this.set_images_loading_flag(_this)};WDIFeed.prototype.conditionalFilter=function(a,c){var d=this,b=d.feed_row.conditional_filter_type,e=d.feed_row.conditional_filters;if(c.ignoreFiltering==true){}else{a=this.avoidDuplicateMedia(a)}if(!wdi_front.isJsonString(e)){return a}else{e=JSON.parse(e);if(e.length==0){return a}}if(d.feed_row.conditional_filter_enable=="0"){return a}d.instagramRequestCounter++;switch(b){case"AND":a=this.applyANDLogic(a,e,d);break;case"OR":a=this.applyORLogic(a,e,d);break;case"NOR":a=this.applyNORLogic(a,e,d);break;default:break}return a};WDIFeed.prototype.applyANDLogic=function(a,d){var c=this;for(var b=0;b<d.length;b++){a=this.filterResponse(a,d[b])}return a};WDIFeed.prototype.applyORLogic=function(d,c){var h=this;var a=[],g,j=[],f,b;for(var e=0;e<c.length;e++){g=this.filterResponse(d,c[e]);a=a.concat(g.data);g={}}for(e=0;e<a.length;e++){b=a[e];if(!this.mediaExists(b,j)&&!this.mediaExists(b,h.dataStorageList)){j.push(b)}}f={data:j,meta:d.meta,pagination:d.pagination};return f};WDIFeed.prototype.applyNORLogic=function(c,h){var f=c,g=this,b=this.applyORLogic(c,h,g),d=[],a;for(var e=0;e<f.data.length;e++){if(!this.mediaExists(f.data[e],b.data)){d.push(f.data[e])}}a={data:d,meta:f.meta,pagination:f.pagination};return a};WDIFeed.prototype.mediaExists=function(b,c){for(var a=0;a<c.length;a++){if(b.id==c[a]["id"]){return true}}return false};WDIFeed.prototype.filterResponse=function(a,b){switch(b.filter_type){case"hashtag":return this.filterByHashtag(a,b);break;case"username":return this.filterByUsername(a,b);break;case"mention":return this.filterByMention(a,b);break;case"description":return this.filterByDescription(a,b);break;case"location":return this.filterByLocation(a,b);break;case"url":return this.filterByUrl(a,b);break}};WDIFeed.prototype.filterByHashtag=function(b,g){var d=[],f,h,a;for(var e=0;e<b.data.length;e++){h=b.data[e];for(var c=0;c<h.tags.length;c++){tag=h.tags[c];if(tag.toLowerCase()==g.filter_by.toLowerCase()){d.push(h)}}}a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUsername=function(b,e){var c=[],f,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.user.username.toLowerCase()==e.filter_by.toLowerCase()){c.push(f)}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByMention=function(b,e){var c=[],f,g,a;for(var d=0;d<b.data.length;d++){f=b.data[d];if(f.caption!==null){g=f.caption["text"].toLowerCase();if(g.indexOf("@"+e.filter_by.toLowerCase())!=-1){c.push(f)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByDescription=function(c,f){var d=[],g,h,b;for(var e=0;e<c.data.length;e++){g=c.data[e];if(g.caption!==null){h=g.caption["text"].toLowerCase();h=wdi_front.replaceNewLines(h);var a=f.filter_by.toLowerCase();if(wdi_front.regexpTestCaption(h,a)){d.push(g)}}}b={data:d,meta:c.meta,pagination:c.pagination};return b};WDIFeed.prototype.filterByLocation=function(b,f){var c=[],g,e,a;for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.location!==null){e=g.location["id"];if(e==f.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.filterByUrl=function(b,e){var c=[],g,h,a,f;e.filter_by=this.getIdFromUrl(e.filter_by);for(var d=0;d<b.data.length;d++){g=b.data[d];if(g.link!==null){h=this.getIdFromUrl(g.link);if(h==e.filter_by){c.push(g)}}}a={data:c,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.getIdFromUrl=function(a){var c=a.split("/"),d=false;for(var b=0;b<c.length;b++){if(c[b]=="p"){if(typeof c[b+1]!="undefined"){d=c[b+1];break}}}return d};WDIFeed.prototype.avoidDuplicateMedia=function(b){var e=b.data,d=[],a={};if(typeof e=="undefined"){e=[]}for(var c=0;c<e.length;c++){if(!this.mediaExists(e[c],this.dataStorageList)&&!this.mediaExists(e[c],d)&&!this.mediaExists(e[c],this.conditionalFilterBuffer)){d.push(e[c])}}this.conditionalFilterBuffer=this.conditionalFilterBuffer.concat(d);a={data:d,meta:b.meta,pagination:b.pagination};return a};WDIFeed.prototype.storeRawData=function(c,a){var e=this;if(typeof this[a]=="object"&&typeof this[a].length=="number"){for(var b=0;b<c.length;b++){var d="";if(wdi_front.isHashtag(c[b].user_id)){if(typeof c[b].pagination.cursors!=="undefined"){d=c[b].pagination.cursors.after}}else{if(e.feed_row.liked_feed=="liked"){d=c[b].pagination.next_max_like_id;if(typeof d=="undefined"){d=""}}else{if(c[b].pagination==null){c[b].pagination=[]}d=c[b].pagination.next_max_id;if(typeof d=="undefined"){d=""}}}if(typeof this[a][b]=="undefined"){this[a].push({data:c[b].data,index:0,locked:false,hash_id:d,usersDataFinished:false,userId:c[b].user_id,length:function(){return this.data.length-this.index},getData:function(g){var h=this.data.slice(this.index,this.index+g);this.index+=Math.min(g,this.length());if(this.index==this.data.length&&this.locked==true&&this.usersDataFinished==false){for(var f=0;f<e.usersData.length;f++){if(e.usersData[f]["user_id"]==this.userId){e.usersData[f].finished="finished";this.usersDataFinished=true;break}}}return h}})}else{if(this[a][b].locked==false){if(d!=this[a][b].hash_id){this[a][b].data=this[a][b].data.concat(c[b].data);this[a][b].hash_id=d}else{this[a][b].locked=true}}}}}};wdi_front.updateUsersIfNecessary=function(c){var d=c.feed_users;var a=false;for(var b=0;b<d.length;b++){if("#"==d[b].username.substr(0,1)){d[b].id=d[b].username;continue}if(""==d[b].id||"username"==d[b].id){a=true;c.instagram.searchForUsersByName(d[b].username,{success:function(i){if(typeof i.meta!="undefined"&&typeof i.meta.error_type!="undefined"){wdi_front.show_alert(false,i,c)}if(i.meta.code==200&&i.data.length>0){var l=false;for(var g=0;g<i.data.length;g++){if(i.data[g].username==i.args.username){l=true;break}}if(l){for(var h=0;h<d.length;h++){if(i.data[g].username==d[h].username){d[h].id=i.data[g].id}}}}var f=false;for(var e=0;e<d.length;e++){if(d[e].id==""||d[e].id=="username"){f=true;break}}if(!f){c.feed_row.feed_users=JSON.stringify(d);wdi_front.init(c)}},username:d[b].username})}}return a};if(typeof wdi_ajax.ajax_response!="undefined"){jQuery(document).one("ajaxStop",function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}else{jQuery(document).ready(function(){if(wdi_front.type!="not_declared"){wdi_front.clickOrTouch=wdi_front.detectEvent();wdi_front.globalInit()}else{return}})}jQuery(document).ready(function(){setTimeout(function(){if(wdi_front_messages.show_alerts==="1"&&jQuery(".wdi_check_fontawesome .fa-instagram").prop("tagName")!=="I"){console.log("Font Awesome is not loaded properly. Please ask for support https://wordpress.org/support/plugin/wd-instagram-feed/")}},2000)});function wdi_extractHostname(b){if(typeof b==="undefined"||b===""){return""}var a=b.replace(/(^\w+:|^)\/\//,"");return a};
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: custom instagram feed, feed, instagram, hashtag, Instagram feed, instagram
|
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 1.3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -506,6 +506,14 @@ Please make sure you don't have any important information before you proceed.
|
|
506 |
|
507 |
== Changelog ==
|
508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
509 |
= 1.3.17 =
|
510 |
Added: Feed edit links for Elementor widget.
|
511 |
|
4 |
Requires at least: 3.9
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 1.3.19
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
506 |
|
507 |
== Changelog ==
|
508 |
|
509 |
+
= 1.3.19 =
|
510 |
+
Fixed: Security issues
|
511 |
+
|
512 |
+
= 1.3.18 =
|
513 |
+
Fixed: Error from Instagram after connecting a Personal account.
|
514 |
+
Fixed: Instagram Feed warning after deleting a feed.
|
515 |
+
Fixed: Pagination problem on hashtag feeds..
|
516 |
+
|
517 |
= 1.3.17 =
|
518 |
Added: Feed edit links for Elementor widget.
|
519 |
|
wd-instagram-feed.php
CHANGED
@@ -1,64 +1,40 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name:
|
4 |
Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
|
5 |
-
Description:
|
6 |
-
Version: 1.3.
|
7 |
Author: 10Web
|
8 |
Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
|
12 |
-
//define constants
|
13 |
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
14 |
define('WDI_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
|
|
15 |
define("WDI_VAR", "wdi_instagram");
|
16 |
-
define("WDI_OPT",WDI_VAR.'_options');
|
17 |
-
define("WDI_FSN",'wdi_feed_settings');
|
18 |
-
define("WDI_TSN",'wdi_theme_settings');
|
19 |
-
define("WDI_META", "_".WDI_VAR."_meta");
|
20 |
//define("wdi",'wdi');
|
21 |
-
define('WDI_FEED_TABLE','wdi_feeds');
|
22 |
-
define('WDI_THEME_TABLE','wdi_themes');
|
23 |
-
define('WDI_VERSION','1.3.
|
24 |
define('WD_WDI_PREFIX', 'wdi' );
|
25 |
define('WDI_IS_PRO', false );
|
26 |
$wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
|
27 |
define('WDI_MINIFY', $wdi_minify);
|
28 |
|
29 |
-
function wdi_use_home_url() {
|
30 |
-
$home_url = str_replace("http://", "", home_url());
|
31 |
-
$home_url = str_replace("https://", "", $home_url);
|
32 |
-
$pos = strpos($home_url, "/");
|
33 |
-
if ($pos) {
|
34 |
-
$home_url = substr($home_url, 0, $pos);
|
35 |
-
}
|
36 |
-
$site_url = str_replace("http://", "", WDI_URL);
|
37 |
-
$site_url = str_replace("https://", "", $site_url);
|
38 |
-
$pos = strpos($site_url, "/");
|
39 |
-
if ($pos) {
|
40 |
-
$site_url = substr($site_url, 0, $pos);
|
41 |
-
}
|
42 |
-
return $site_url != $home_url;
|
43 |
-
}
|
44 |
-
|
45 |
-
if (wdi_use_home_url()) {
|
46 |
-
define('WDI_FRONT_URL', home_url("wp-content/plugins/" . plugin_basename(dirname(__FILE__))));
|
47 |
-
}
|
48 |
-
else {
|
49 |
-
define('WDI_FRONT_URL', WDI_URL);
|
50 |
-
}
|
51 |
-
//////////////////////////////////////////////////////////////////
|
52 |
-
|
53 |
if(!empty($_GET['wdi_code'])) {
|
54 |
add_action('plugins_loaded', 'wdi_save_user_access_token');
|
55 |
}
|
56 |
|
57 |
function wdi_save_user_access_token(){
|
|
|
58 |
$options = wdi_get_options();
|
59 |
-
|
60 |
-
$token = $_GET['wdi_code'];
|
61 |
-
|
62 |
$accounts = null;
|
63 |
$url = "https://graph.facebook.com/me/accounts?fields=instagram_business_account&limit=500&access_token=" . $token;
|
64 |
$request = wp_remote_get($url);
|
@@ -132,6 +108,7 @@ function wdi_register_plugin_block($blocks) {
|
|
132 |
);
|
133 |
return $blocks;
|
134 |
}
|
|
|
135 |
function wdi_register_block_editor_assets($assets) {
|
136 |
$wd_bp_plugin_url = WDI_URL;
|
137 |
$version = '2.0.3';
|
@@ -158,7 +135,6 @@ function wdi_set_reset_cache(){
|
|
158 |
}
|
159 |
}
|
160 |
|
161 |
-
|
162 |
function wdi_get_cache_data(){
|
163 |
if(wp_verify_nonce($_POST["wdi_nonce"] , 'wdi_cache')){
|
164 |
if(isset($_POST["wdi_cache_name"])){
|
@@ -215,6 +191,7 @@ function wdi_get_cache_data(){
|
|
215 |
wdi_send_response(array("success"=>false));
|
216 |
}
|
217 |
}
|
|
|
218 |
function wdi_set_cache_data(){
|
219 |
global $wdi_options;
|
220 |
if(wp_verify_nonce($_POST["wdi_nonce"] , 'wdi_cache')){
|
@@ -257,11 +234,10 @@ function wdi_send_response($data){
|
|
257 |
die;
|
258 |
}
|
259 |
|
260 |
-
|
261 |
-
|
262 |
add_action('wp_ajax_WDIGalleryBox', 'wdi_ajax_frontend');
|
263 |
add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
|
264 |
add_action('admin_init', 'wdi_setup_redirect');
|
|
|
265 |
function wdi_ajax_frontend() {
|
266 |
|
267 |
/* reset from user to site locale*/
|
@@ -283,12 +259,6 @@ function wdi_ajax_frontend() {
|
|
283 |
}
|
284 |
}
|
285 |
|
286 |
-
|
287 |
-
|
288 |
-
///////////////////////////////End GALLERY BOX////////////////////////////////////////
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
//including admin functions
|
293 |
require_once(WDI_DIR .'/admin-functions.php');
|
294 |
//including shortcode file
|
@@ -316,8 +286,8 @@ function wdi_instagram_activate($networkwide) {
|
|
316 |
// wdi_activate();
|
317 |
wdi_install();
|
318 |
}
|
319 |
-
function wdi_setup_redirect() {
|
320 |
|
|
|
321 |
if (get_option('wdi_do_activation_set_up_redirect') ) {
|
322 |
update_option('wdi_do_activation_set_up_redirect',0);
|
323 |
//wp_safe_redirect( admin_url( 'index.php?page=gmwd_setup' ) );
|
@@ -355,7 +325,6 @@ function wdi_create_sample_feed($new_options) {
|
|
355 |
return $new_options;
|
356 |
}
|
357 |
|
358 |
-
|
359 |
if (!empty($wdi_options['wdi_access_token']) || empty($new_options['wdi_access_token'])) {
|
360 |
return $new_options;
|
361 |
}
|
@@ -406,16 +375,9 @@ function wdi_create_sample_feed($new_options) {
|
|
406 |
update_option('wdi_sample_feed_post_id', $post_id);
|
407 |
update_option('wdi_sample_feed_post_url', '1');
|
408 |
|
409 |
-
|
410 |
return $new_options;
|
411 |
}
|
412 |
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
add_action("admin_init",'wdi_register_settings');
|
420 |
|
421 |
function wdi_register_settings(){
|
@@ -463,8 +425,6 @@ function WDI_instagram_menu() {
|
|
463 |
$menu_icon = WDI_URL .'/images/menu_icon.png';
|
464 |
$min_feeds_capability = wdi_get_create_feeds_cap();
|
465 |
|
466 |
-
|
467 |
-
|
468 |
$parent_slug = null;
|
469 |
$wdi_uninstall = true;
|
470 |
$wdi_uninstall_success = get_option(WDI_OPT);
|
@@ -495,7 +455,6 @@ function WDI_instagram_menu() {
|
|
495 |
add_submenu_page($parent_slug,__('Premium Version',"wd-instagram-feed"),__('Premium Version',"wd-instagram-feed"),$min_feeds_capability,'wdi_licensing','WDI_instagram_licensing_page');
|
496 |
add_submenu_page("",__('Uninstall',"wd-instagram-feed"),__('Uninstall',"wd-instagram-feed"),'manage_options','wdi_uninstall','WDI_instagram_uninstall_page');
|
497 |
}
|
498 |
-
|
499 |
}
|
500 |
|
501 |
|
@@ -505,14 +464,10 @@ function WDI_add_uninstall(){
|
|
505 |
if( get_option( "wdi_subscribe_done" ) == 1 ){
|
506 |
$parent_slug = "wdi_feeds";
|
507 |
}
|
508 |
-
|
509 |
-
|
510 |
}
|
511 |
|
512 |
//Settings page callback
|
513 |
function WDI_instagram_settings_page(){
|
514 |
-
|
515 |
-
|
516 |
//check if user has already unistalled plugin from settings
|
517 |
wdi_check_uninstalled();
|
518 |
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
@@ -520,8 +475,8 @@ function WDI_instagram_settings_page(){
|
|
520 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
521 |
$controller = new $controller_class();
|
522 |
$controller->execute();
|
523 |
-
|
524 |
}
|
|
|
525 |
function WDI_instagram_feeds_page(){
|
526 |
//check if user has already unistalled plugin from settings
|
527 |
wdi_check_uninstalled();
|
@@ -540,6 +495,7 @@ function WDI_instagram_themes_page(){
|
|
540 |
$controller = new $controller_class();
|
541 |
$controller->execute();
|
542 |
}
|
|
|
543 |
function WDI_instagram_licensing_page(){
|
544 |
$controller_class = 'WDIControllerLicensing_wdi';
|
545 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
@@ -547,10 +503,7 @@ function WDI_instagram_licensing_page(){
|
|
547 |
$controller->execute();
|
548 |
}
|
549 |
|
550 |
-
|
551 |
-
|
552 |
function WDI_instagram_uninstall_page(){
|
553 |
-
|
554 |
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
555 |
$controller_class = 'WDIControllerUninstall_wdi';
|
556 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
@@ -778,12 +731,8 @@ function wdi_admin_ajax() {
|
|
778 |
}
|
779 |
}
|
780 |
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
add_action( 'init', 'wdi_load_textdomain' );
|
786 |
-
add_action('init', 'wdi_register_instagram_preview_cpt');
|
787 |
|
788 |
function wdi_register_instagram_preview_cpt() {
|
789 |
$args = array(
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: 10Web Social Photo Feed
|
4 |
Plugin URI: https://10web.io/plugins/wordpress-instagram-feed/?utm_source=instagram_feed&utm_medium=free_plugin
|
5 |
+
Description: 10Web Social Photo Feed is a user-friendly tool for displaying user or hashtag-based feeds on your website. You can create feeds with one of the available layouts. It allows displaying image metadata, open up images in lightbox, download them and even share in social networking websites.
|
6 |
+
Version: 1.3.19
|
7 |
Author: 10Web
|
8 |
Author URI: https://10Web.io/plugins/?utm_source=instagram_feed&utm_medium=free_plugin
|
9 |
License: GPLv2 or later
|
10 |
*/
|
11 |
|
12 |
+
// define constants
|
13 |
define('WDI_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
|
14 |
define('WDI_URL', plugins_url(plugin_basename(dirname(__FILE__))));
|
15 |
+
define('WDI_FRONT_URL', WDI_URL);
|
16 |
define("WDI_VAR", "wdi_instagram");
|
17 |
+
define("WDI_OPT", WDI_VAR . '_options');
|
18 |
+
define("WDI_FSN", 'wdi_feed_settings');
|
19 |
+
define("WDI_TSN", 'wdi_theme_settings');
|
20 |
+
define("WDI_META", "_" . WDI_VAR . "_meta");
|
21 |
//define("wdi",'wdi');
|
22 |
+
define('WDI_FEED_TABLE', 'wdi_feeds');
|
23 |
+
define('WDI_THEME_TABLE', 'wdi_themes');
|
24 |
+
define('WDI_VERSION', '1.3.19');
|
25 |
define('WD_WDI_PREFIX', 'wdi' );
|
26 |
define('WDI_IS_PRO', false );
|
27 |
$wdi_minify = ((isset($_GET['wdi_no_minify']) && $_GET['wdi_no_minify'] == "true") ? false : true);
|
28 |
define('WDI_MINIFY', $wdi_minify);
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
if(!empty($_GET['wdi_code'])) {
|
31 |
add_action('plugins_loaded', 'wdi_save_user_access_token');
|
32 |
}
|
33 |
|
34 |
function wdi_save_user_access_token(){
|
35 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
36 |
$options = wdi_get_options();
|
37 |
+
$token = WDILibrary::get('wdi_code');
|
|
|
|
|
38 |
$accounts = null;
|
39 |
$url = "https://graph.facebook.com/me/accounts?fields=instagram_business_account&limit=500&access_token=" . $token;
|
40 |
$request = wp_remote_get($url);
|
108 |
);
|
109 |
return $blocks;
|
110 |
}
|
111 |
+
|
112 |
function wdi_register_block_editor_assets($assets) {
|
113 |
$wd_bp_plugin_url = WDI_URL;
|
114 |
$version = '2.0.3';
|
135 |
}
|
136 |
}
|
137 |
|
|
|
138 |
function wdi_get_cache_data(){
|
139 |
if(wp_verify_nonce($_POST["wdi_nonce"] , 'wdi_cache')){
|
140 |
if(isset($_POST["wdi_cache_name"])){
|
191 |
wdi_send_response(array("success"=>false));
|
192 |
}
|
193 |
}
|
194 |
+
|
195 |
function wdi_set_cache_data(){
|
196 |
global $wdi_options;
|
197 |
if(wp_verify_nonce($_POST["wdi_nonce"] , 'wdi_cache')){
|
234 |
die;
|
235 |
}
|
236 |
|
|
|
|
|
237 |
add_action('wp_ajax_WDIGalleryBox', 'wdi_ajax_frontend');
|
238 |
add_action('wp_ajax_nopriv_WDIGalleryBox', 'wdi_ajax_frontend');
|
239 |
add_action('admin_init', 'wdi_setup_redirect');
|
240 |
+
|
241 |
function wdi_ajax_frontend() {
|
242 |
|
243 |
/* reset from user to site locale*/
|
259 |
}
|
260 |
}
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
//including admin functions
|
263 |
require_once(WDI_DIR .'/admin-functions.php');
|
264 |
//including shortcode file
|
286 |
// wdi_activate();
|
287 |
wdi_install();
|
288 |
}
|
|
|
289 |
|
290 |
+
function wdi_setup_redirect() {
|
291 |
if (get_option('wdi_do_activation_set_up_redirect') ) {
|
292 |
update_option('wdi_do_activation_set_up_redirect',0);
|
293 |
//wp_safe_redirect( admin_url( 'index.php?page=gmwd_setup' ) );
|
325 |
return $new_options;
|
326 |
}
|
327 |
|
|
|
328 |
if (!empty($wdi_options['wdi_access_token']) || empty($new_options['wdi_access_token'])) {
|
329 |
return $new_options;
|
330 |
}
|
375 |
update_option('wdi_sample_feed_post_id', $post_id);
|
376 |
update_option('wdi_sample_feed_post_url', '1');
|
377 |
|
|
|
378 |
return $new_options;
|
379 |
}
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
add_action("admin_init",'wdi_register_settings');
|
382 |
|
383 |
function wdi_register_settings(){
|
425 |
$menu_icon = WDI_URL .'/images/menu_icon.png';
|
426 |
$min_feeds_capability = wdi_get_create_feeds_cap();
|
427 |
|
|
|
|
|
428 |
$parent_slug = null;
|
429 |
$wdi_uninstall = true;
|
430 |
$wdi_uninstall_success = get_option(WDI_OPT);
|
455 |
add_submenu_page($parent_slug,__('Premium Version',"wd-instagram-feed"),__('Premium Version',"wd-instagram-feed"),$min_feeds_capability,'wdi_licensing','WDI_instagram_licensing_page');
|
456 |
add_submenu_page("",__('Uninstall',"wd-instagram-feed"),__('Uninstall',"wd-instagram-feed"),'manage_options','wdi_uninstall','WDI_instagram_uninstall_page');
|
457 |
}
|
|
|
458 |
}
|
459 |
|
460 |
|
464 |
if( get_option( "wdi_subscribe_done" ) == 1 ){
|
465 |
$parent_slug = "wdi_feeds";
|
466 |
}
|
|
|
|
|
467 |
}
|
468 |
|
469 |
//Settings page callback
|
470 |
function WDI_instagram_settings_page(){
|
|
|
|
|
471 |
//check if user has already unistalled plugin from settings
|
472 |
wdi_check_uninstalled();
|
473 |
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
475 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
476 |
$controller = new $controller_class();
|
477 |
$controller->execute();
|
|
|
478 |
}
|
479 |
+
|
480 |
function WDI_instagram_feeds_page(){
|
481 |
//check if user has already unistalled plugin from settings
|
482 |
wdi_check_uninstalled();
|
495 |
$controller = new $controller_class();
|
496 |
$controller->execute();
|
497 |
}
|
498 |
+
|
499 |
function WDI_instagram_licensing_page(){
|
500 |
$controller_class = 'WDIControllerLicensing_wdi';
|
501 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
503 |
$controller->execute();
|
504 |
}
|
505 |
|
|
|
|
|
506 |
function WDI_instagram_uninstall_page(){
|
|
|
507 |
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
508 |
$controller_class = 'WDIControllerUninstall_wdi';
|
509 |
require_once(WDI_DIR . '/admin/controllers/' . $controller_class . '.php');
|
731 |
}
|
732 |
}
|
733 |
|
|
|
|
|
|
|
|
|
734 |
add_action( 'init', 'wdi_load_textdomain' );
|
735 |
+
add_action( 'init', 'wdi_register_instagram_preview_cpt' );
|
736 |
|
737 |
function wdi_register_instagram_preview_cpt() {
|
738 |
$args = array(
|
wd/includes/deactivate.php
CHANGED
@@ -1,178 +1,145 @@
|
|
1 |
<?php
|
2 |
if (!defined('ABSPATH')) {
|
3 |
-
|
4 |
}
|
5 |
|
6 |
class TenWebLibDeactivate
|
7 |
{
|
8 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
// Events //
|
10 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
// Constants //
|
13 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
14 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
15 |
-
// Variables //
|
16 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
17 |
-
public $deactivate_reasons = array();
|
18 |
-
public $config;
|
19 |
-
// Reason IDs
|
20 |
-
const REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS = "reason_plugin_is_hard_to_use_technical_problems";
|
21 |
-
const REASON_FREE_VERSION_IS_LIMITED = "reason_free_version_limited";
|
22 |
-
const REASON_PRO_EXPENSIVE = "reason_premium_expensive";
|
23 |
-
const REASON_UPGRADING_TO_PAID_VERSION = "reason_upgrading_to_paid_version";
|
24 |
-
const REASON_TEMPORARY_DEACTIVATION = "reason_temporary_deactivation";
|
25 |
-
|
26 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
27 |
-
// Constructor & Destructor //
|
28 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
29 |
-
public function __construct($config = array())
|
30 |
-
{
|
31 |
-
$this->config = $config;
|
32 |
-
$wd_options = $this->config;
|
33 |
-
|
34 |
-
$this->deactivate_reasons = array(
|
35 |
-
1 => array(
|
36 |
-
'id' => self::REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS,
|
37 |
-
'text' => __('Technical problems / hard to use', $wd_options->prefix),
|
38 |
-
),
|
39 |
-
2 => array(
|
40 |
-
'id' => self::REASON_FREE_VERSION_IS_LIMITED,
|
41 |
-
'text' => __('Free version is limited', $wd_options->prefix),
|
42 |
-
),
|
43 |
-
3 => array(
|
44 |
-
'id' => self::REASON_UPGRADING_TO_PAID_VERSION,
|
45 |
-
'text' => __('Upgrading to paid version', $wd_options->prefix),
|
46 |
-
),
|
47 |
-
4 => array(
|
48 |
-
'id' => self::REASON_TEMPORARY_DEACTIVATION,
|
49 |
-
'text' => __('Temporary deactivation', $wd_options->prefix),
|
50 |
-
),
|
51 |
-
);
|
52 |
-
|
53 |
-
add_action('admin_footer', array($this, 'add_deactivation_feedback_dialog_box'));
|
54 |
-
add_action('admin_init', array($this, 'submit_and_deactivate'));
|
55 |
-
|
56 |
-
|
57 |
-
// add_action('admin_enqueue_scripts', array($this, 'scripts'));
|
58 |
-
// Just enqueue styles/scripts and they will be in the footer.
|
59 |
-
$this->scripts();
|
60 |
-
|
61 |
-
}
|
62 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
63 |
-
// Public Methods //
|
64 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
65 |
-
public function add_deactivation_feedback_dialog_box()
|
66 |
-
{
|
67 |
-
$deactivate_reasons = $this->deactivate_reasons;
|
68 |
-
$wd_options = $this->config;
|
69 |
-
|
70 |
-
?>
|
71 |
-
<script>
|
72 |
-
jQuery(document).ready(function () {
|
73 |
-
tenwebReady("<?php echo $wd_options->prefix; ?>");
|
74 |
-
});
|
75 |
-
</script>
|
76 |
-
<?php
|
77 |
-
|
78 |
-
$deactivate_url =
|
79 |
-
add_query_arg(
|
80 |
-
array(
|
81 |
-
'action' => 'deactivate',
|
82 |
-
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
83 |
-
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
84 |
-
),
|
85 |
-
admin_url('plugins.php')
|
86 |
-
);
|
87 |
-
|
88 |
-
require($wd_options->wd_dir_templates . '/display_deactivation_popup.php');
|
89 |
-
}
|
90 |
-
|
91 |
-
|
92 |
-
public function scripts()
|
93 |
-
{
|
94 |
-
$wd_options = $this->config;
|
95 |
-
wp_enqueue_style('tenweb-deactivate-popup', $wd_options->wd_url_css . '/deactivate_popup.css', array(), get_option($wd_options->prefix . "_version"));
|
96 |
-
wp_enqueue_script('tenweb-deactivate-popup', $wd_options->wd_url_js . '/deactivate_popup.js', array(), get_option($wd_options->prefix . "_version"));
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
$admin_data = wp_get_current_user();
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
-
|
|
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
$
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
$data["additional_details"] = isset($_POST[$wd_options->prefix . "_additional_details"]) ? $_POST[$wd_options->prefix . "_additional_details"] : "";
|
124 |
-
$admin_data = wp_get_current_user();
|
125 |
-
$data["email"] = isset($_POST[$wd_options->prefix . "_email"]) ? $_POST[$wd_options->prefix . "_email"] : $admin_data->data->user_email;
|
126 |
-
$user_first_name = get_user_meta($admin_data->ID, "first_name", true);
|
127 |
-
$user_last_name = get_user_meta($admin_data->ID, "last_name", true);
|
128 |
-
|
129 |
-
$data["name"] = $user_first_name || $user_last_name ? $user_first_name . " " . $user_last_name : $admin_data->data->user_login;
|
130 |
-
|
131 |
-
$response = wp_remote_post(TEN_WEB_LIB_DEACTIVATION_URL, array(
|
132 |
-
'method' => 'POST',
|
133 |
-
'timeout' => 45,
|
134 |
-
'redirection' => 5,
|
135 |
-
'httpversion' => '1.0',
|
136 |
-
'blocking' => true,
|
137 |
-
'headers' => array("Accept" => "application/x.10webcore.v1+json"),
|
138 |
-
'body' => $data,
|
139 |
-
'cookies' => array()
|
140 |
-
)
|
141 |
-
);
|
142 |
-
|
143 |
-
$response_body = (!is_wp_error($response) && isset($response["body"])) ? json_decode($response["body"], true) : null;
|
144 |
-
/*if (is_array($response_body) && $response_body["body"]["msg"] == "Access") {
|
145 |
-
|
146 |
-
}*/
|
147 |
-
|
148 |
-
}
|
149 |
-
if ($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 1) {
|
150 |
-
$deactivate_url =
|
151 |
-
add_query_arg(
|
152 |
-
array(
|
153 |
-
'action' => 'deactivate',
|
154 |
-
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
155 |
-
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
156 |
-
),
|
157 |
-
admin_url('plugins.php')
|
158 |
-
);
|
159 |
-
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
160 |
-
}
|
161 |
-
|
162 |
-
}
|
163 |
}
|
164 |
-
|
165 |
-
|
166 |
-
// Getters & Setters //
|
167 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
168 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
169 |
-
// Private Methods //
|
170 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
171 |
-
|
172 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
173 |
-
// Listeners //
|
174 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
175 |
-
|
176 |
-
}
|
177 |
-
|
178 |
-
|
1 |
<?php
|
2 |
if (!defined('ABSPATH')) {
|
3 |
+
exit;
|
4 |
}
|
5 |
|
6 |
class TenWebLibDeactivate
|
7 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
public $deactivate_reasons = array();
|
10 |
+
|
11 |
+
public $config;
|
12 |
+
// Reason IDs
|
13 |
+
const REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS = "reason_plugin_is_hard_to_use_technical_problems";
|
14 |
+
const REASON_FREE_VERSION_IS_LIMITED = "reason_free_version_limited";
|
15 |
+
const REASON_PRO_EXPENSIVE = "reason_premium_expensive";
|
16 |
+
const REASON_UPGRADING_TO_PAID_VERSION = "reason_upgrading_to_paid_version";
|
17 |
+
const REASON_TEMPORARY_DEACTIVATION = "reason_temporary_deactivation";
|
18 |
+
|
19 |
+
public function __construct($config = array())
|
20 |
+
{
|
21 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
22 |
+
$this->config = $config;
|
23 |
+
$wd_options = $this->config;
|
24 |
+
|
25 |
+
$this->deactivate_reasons = array(
|
26 |
+
1 => array(
|
27 |
+
'id' => self::REASON_PLUGIN_IS_HARD_TO_USE_TECHNICAL_PROBLEMS,
|
28 |
+
'text' => __('Technical problems / hard to use', $wd_options->prefix),
|
29 |
+
),
|
30 |
+
2 => array(
|
31 |
+
'id' => self::REASON_FREE_VERSION_IS_LIMITED,
|
32 |
+
'text' => __('Free version is limited', $wd_options->prefix),
|
33 |
+
),
|
34 |
+
3 => array(
|
35 |
+
'id' => self::REASON_UPGRADING_TO_PAID_VERSION,
|
36 |
+
'text' => __('Upgrading to paid version', $wd_options->prefix),
|
37 |
+
),
|
38 |
+
4 => array(
|
39 |
+
'id' => self::REASON_TEMPORARY_DEACTIVATION,
|
40 |
+
'text' => __('Temporary deactivation', $wd_options->prefix),
|
41 |
+
),
|
42 |
+
);
|
43 |
+
|
44 |
+
add_action('admin_footer', array($this, 'add_deactivation_feedback_dialog_box'));
|
45 |
+
add_action('admin_init', array($this, 'submit_and_deactivate'));
|
46 |
+
|
47 |
+
// add_action('admin_enqueue_scripts', array($this, 'scripts'));
|
48 |
+
// Just enqueue styles/scripts and they will be in the footer.
|
49 |
+
$this->scripts();
|
50 |
+
}
|
51 |
+
|
52 |
+
public function add_deactivation_feedback_dialog_box()
|
53 |
+
{
|
54 |
+
$deactivate_reasons = $this->deactivate_reasons;
|
55 |
+
$wd_options = $this->config;
|
56 |
+
|
57 |
+
?>
|
58 |
+
<script>
|
59 |
+
jQuery(document).ready(function () {
|
60 |
+
tenwebReady("<?php echo $wd_options->prefix; ?>");
|
61 |
+
});
|
62 |
+
</script>
|
63 |
+
<?php
|
64 |
+
|
65 |
+
$deactivate_url =
|
66 |
+
add_query_arg(
|
67 |
+
array(
|
68 |
+
'action' => 'deactivate',
|
69 |
+
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
70 |
+
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
71 |
+
),
|
72 |
+
admin_url('plugins.php')
|
73 |
+
);
|
74 |
+
|
75 |
+
require($wd_options->wd_dir_templates . '/display_deactivation_popup.php');
|
76 |
+
}
|
77 |
+
|
78 |
+
|
79 |
+
public function scripts()
|
80 |
+
{
|
81 |
+
$wd_options = $this->config;
|
82 |
+
wp_enqueue_style('tenweb-deactivate-popup', $wd_options->wd_url_css . '/deactivate_popup.css', array(), get_option($wd_options->prefix . "_version"));
|
83 |
+
wp_enqueue_script('tenweb-deactivate-popup', $wd_options->wd_url_js . '/deactivate_popup.js', array(), get_option($wd_options->prefix . "_version"));
|
84 |
+
|
85 |
+
$admin_data = wp_get_current_user();
|
86 |
+
wp_localize_script('tenweb-deactivate-popup', $wd_options->prefix . 'WDDeactivateVars', array(
|
87 |
+
"prefix" => $wd_options->prefix,
|
88 |
+
"deactivate_class" => $wd_options->prefix . '_deactivate_link',
|
89 |
+
"email" => $admin_data->data->user_email,
|
90 |
+
"plugin_wd_url" => $wd_options->plugin_wd_url,
|
91 |
+
));
|
92 |
+
}
|
93 |
+
|
94 |
+
public function submit_and_deactivate()
|
95 |
+
{
|
96 |
+
$wd_options = $this->config;
|
97 |
+
$submit_and_deactivate = WDILibrary::get($wd_options->prefix . "_submit_and_deactivate", '');
|
98 |
+
if ( isset($submit_and_deactivate) ) {
|
99 |
+
|
100 |
+
if ($submit_and_deactivate == 2 || $submit_and_deactivate == 3) {
|
101 |
+
$data = array();
|
102 |
+
$reasons = WDILibrary::get($wd_options->prefix . '_reasons', '');
|
103 |
+
$data["reason"] = $reasons;
|
104 |
+
$data["site_url"] = site_url();
|
105 |
+
$data["product_id"] = $wd_options->plugin_id;
|
106 |
+
|
107 |
+
$data["additional_details"] = WDILibrary::get($wd_options->prefix . '_additional_details', '');
|
108 |
$admin_data = wp_get_current_user();
|
109 |
+
$data["email"] = WDILibrary::get($wd_options->prefix . '_email', $admin_data->data->user_email);
|
110 |
+
$user_first_name = get_user_meta($admin_data->ID, "first_name", true);
|
111 |
+
$user_last_name = get_user_meta($admin_data->ID, "last_name", true);
|
112 |
+
|
113 |
+
$data["name"] = $user_first_name || $user_last_name ? $user_first_name . " " . $user_last_name : $admin_data->data->user_login;
|
114 |
+
|
115 |
+
$response = wp_remote_post(TEN_WEB_LIB_DEACTIVATION_URL, array(
|
116 |
+
'method' => 'POST',
|
117 |
+
'timeout' => 45,
|
118 |
+
'redirection' => 5,
|
119 |
+
'httpversion' => '1.0',
|
120 |
+
'blocking' => true,
|
121 |
+
'headers' => array("Accept" => "application/x.10webcore.v1+json"),
|
122 |
+
'body' => $data,
|
123 |
+
'cookies' => array()
|
124 |
+
)
|
125 |
+
);
|
126 |
|
127 |
+
$response_body = (!is_wp_error($response) && isset($response["body"])) ? json_decode($response["body"], true) : null;
|
128 |
+
}
|
129 |
|
130 |
+
$submit_and_deactivate = WDILibrary::get($wd_options->prefix . '_submit_and_deactivate', '');
|
131 |
+
if ( $submit_and_deactivate == 1 || $submit_and_deactivate == 2 ) {
|
132 |
+
$deactivate_url =
|
133 |
+
add_query_arg(
|
134 |
+
array(
|
135 |
+
'action' => 'deactivate',
|
136 |
+
'plugin' => plugin_basename($wd_options->plugin_main_file),
|
137 |
+
'_wpnonce' => wp_create_nonce('deactivate-plugin_' . plugin_basename($wd_options->plugin_main_file))
|
138 |
+
),
|
139 |
+
admin_url('plugins.php')
|
140 |
+
);
|
141 |
+
echo '<script>window.location.href="' . $deactivate_url . '";</script>';
|
142 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
+
}
|
145 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wd/includes/notices.php
CHANGED
@@ -13,6 +13,7 @@ class TenWebLibNotices {
|
|
13 |
|
14 |
// Basic actions to run
|
15 |
public function __construct( $config = array() ) {
|
|
|
16 |
$this->config = $config;
|
17 |
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
18 |
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
@@ -131,9 +132,10 @@ class TenWebLibNotices {
|
|
131 |
public function admin_notice_ignore() {
|
132 |
$wd_options = $this->config;
|
133 |
// If user clicks to ignore the notice, update the option to not show it again
|
134 |
-
|
|
|
135 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
136 |
-
$admin_notices_option[$
|
137 |
update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
|
138 |
$query_str = remove_query_arg( $wd_options->prefix . '_admin_notice_ignore' );
|
139 |
wp_redirect( $query_str );
|
@@ -145,16 +147,18 @@ class TenWebLibNotices {
|
|
145 |
public function admin_notice_temp_ignore() {
|
146 |
$wd_options = $this->config;
|
147 |
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
148 |
-
|
|
|
149 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
150 |
$current_date = current_time( "n/j/Y" );
|
151 |
$date_array = explode( '/', $current_date );
|
152 |
-
$interval = (
|
153 |
$date_array[1] += $interval;
|
154 |
$new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
155 |
|
156 |
-
$
|
157 |
-
$admin_notices_option[$
|
|
|
158 |
update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
|
159 |
$query_str = remove_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore', 'wd_int' ) );
|
160 |
wp_redirect( $query_str );
|
@@ -164,9 +168,11 @@ class TenWebLibNotices {
|
|
164 |
|
165 |
public function admin_notice_pages($pages) {
|
166 |
$wd_options = $this->config;
|
|
|
|
|
167 |
foreach ( $pages as $key => $page ) {
|
168 |
if (is_array($page)) {
|
169 |
-
if ( isset( $
|
170 |
return true;
|
171 |
}
|
172 |
}
|
@@ -177,7 +183,7 @@ class TenWebLibNotices {
|
|
177 |
if ( get_current_screen()->id === $page ) {
|
178 |
return true;
|
179 |
}
|
180 |
-
if ( isset($
|
181 |
return true;
|
182 |
}
|
183 |
}
|
13 |
|
14 |
// Basic actions to run
|
15 |
public function __construct( $config = array() ) {
|
16 |
+
require_once(WDI_DIR . '/framework/WDILibrary.php');
|
17 |
$this->config = $config;
|
18 |
// Runs the admin notice ignore function incase a dismiss button has been clicked
|
19 |
add_action( 'admin_init', array( $this, 'admin_notice_ignore' ) );
|
132 |
public function admin_notice_ignore() {
|
133 |
$wd_options = $this->config;
|
134 |
// If user clicks to ignore the notice, update the option to not show it again
|
135 |
+
$admin_notice_ignore = WDILibrary::get($wd_options->prefix . '_admin_notice_ignore', '');
|
136 |
+
if ( !empty( $admin_notice_ignore ) ) {
|
137 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
138 |
+
$admin_notices_option[$admin_notice_ignore]['dismissed'] = 1;
|
139 |
update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
|
140 |
$query_str = remove_query_arg( $wd_options->prefix . '_admin_notice_ignore' );
|
141 |
wp_redirect( $query_str );
|
147 |
public function admin_notice_temp_ignore() {
|
148 |
$wd_options = $this->config;
|
149 |
// If user clicks to temp ignore the notice, update the option to change the start date - default interval of 14 days
|
150 |
+
$admin_notice_temp_ignore = WDILibrary::get($wd_options->prefix . '_admin_notice_temp_ignore', '');
|
151 |
+
if ( !empty( $admin_notice_temp_ignore ) ) {
|
152 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
153 |
$current_date = current_time( "n/j/Y" );
|
154 |
$date_array = explode( '/', $current_date );
|
155 |
+
$interval = (int) WDILibrary::get('wd_int', 14);
|
156 |
$date_array[1] += $interval;
|
157 |
$new_start = date( "n/j/Y", mktime( 0, 0, 0, $date_array[0], $date_array[1], $date_array[2] ) );
|
158 |
|
159 |
+
$admin_notice_temp_ignore = WDILibrary::get($wd_options->prefix . '_admin_notice_temp_ignore', '');
|
160 |
+
$admin_notices_option[$admin_notice_temp_ignore]['start'] = $new_start;
|
161 |
+
$admin_notices_option[$admin_notice_temp_ignore]['dismissed'] = 0;
|
162 |
update_option( $wd_options->prefix . '_admin_notice', $admin_notices_option );
|
163 |
$query_str = remove_query_arg( array( $wd_options->prefix . '_admin_notice_temp_ignore', 'wd_int' ) );
|
164 |
wp_redirect( $query_str );
|
168 |
|
169 |
public function admin_notice_pages($pages) {
|
170 |
$wd_options = $this->config;
|
171 |
+
$get_page = WDILibrary::get('page', '');
|
172 |
+
$get_tab = WDILibrary::get('tab', '');
|
173 |
foreach ( $pages as $key => $page ) {
|
174 |
if (is_array($page)) {
|
175 |
+
if ( isset( $get_page ) && $get_page == $page[0] && isset($get_tab) && $get_tab == $page[1] ) {
|
176 |
return true;
|
177 |
}
|
178 |
}
|
183 |
if ( get_current_screen()->id === $page ) {
|
184 |
return true;
|
185 |
}
|
186 |
+
if ( isset($get_page) && $get_page == $page ) {
|
187 |
return true;
|
188 |
}
|
189 |
}
|
wd/includes/subscribe.php
CHANGED
@@ -5,41 +5,25 @@ if (!defined('ABSPATH')) {
|
|
5 |
|
6 |
class TenWebLibSubscribe
|
7 |
{
|
8 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
9 |
-
// Events //
|
10 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
11 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
12 |
-
// Constants //
|
13 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
14 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
15 |
-
// Variables //
|
16 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
17 |
public $config;
|
18 |
-
|
19 |
-
// Constructor & Destructor //
|
20 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function __construct($config = array())
|
22 |
{
|
23 |
$this->config = $config;
|
24 |
add_action('admin_init', array($this, 'after_subscribe'));
|
25 |
}
|
26 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
27 |
-
// Public Methods //
|
28 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
29 |
|
30 |
public function subscribe_scripts()
|
31 |
{
|
32 |
$wd_options = $this->config;
|
33 |
wp_register_script('subscribe_js', $wd_options->wd_url_js . '/subsribe.js');
|
34 |
wp_enqueue_script('subscribe_js');
|
35 |
-
|
36 |
}
|
37 |
|
38 |
public function subscribe_styles()
|
39 |
{
|
40 |
$wd_options = $this->config;
|
41 |
wp_enqueue_style($wd_options->prefix . 'subscribe', $wd_options->wd_url_css . '/subscribe.css');
|
42 |
-
|
43 |
}
|
44 |
|
45 |
public function subscribe_display_page()
|
@@ -51,9 +35,9 @@ class TenWebLibSubscribe
|
|
51 |
public function after_subscribe()
|
52 |
{
|
53 |
$wd_options = $this->config;
|
54 |
-
|
55 |
-
|
56 |
-
if ($
|
57 |
//$api = new TenWebLibApi($wd_options);
|
58 |
$all_plugins = array();
|
59 |
$plugins = get_plugins();
|
@@ -82,7 +66,6 @@ class TenWebLibSubscribe
|
|
82 |
$data["product_id"] = $wd_options->plugin_id;
|
83 |
$data["all_plugins"] = json_encode($all_plugins);
|
84 |
|
85 |
-
|
86 |
$response = wp_remote_post(TEN_WEB_LIB_SUBSCRIBE_URL, array(
|
87 |
'method' => 'POST',
|
88 |
'timeout' => 45,
|
@@ -98,27 +81,16 @@ class TenWebLibSubscribe
|
|
98 |
$response_body = (!is_wp_error($response) && isset($response["body"])) ? json_decode($response["body"], true) : null;
|
99 |
|
100 |
if (is_array($response_body) && $response_body["body"]["msg"] == "ok") {
|
101 |
-
|
102 |
}
|
103 |
-
|
104 |
}
|
|
|
105 |
if (get_option($wd_options->prefix . "_subscribe_done") != 1) {
|
106 |
update_option($wd_options->prefix . "_subscribe_done", 1);
|
107 |
} else {
|
108 |
add_option($wd_options->prefix . "_subscribe_done", "1", '', 'no');
|
109 |
}
|
110 |
|
111 |
-
wp_safe_redirect($wd_options->after_subscribe);
|
112 |
}
|
113 |
-
|
114 |
}
|
115 |
-
|
116 |
-
// Getters & Setters //
|
117 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
118 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
119 |
-
// Private Methods //
|
120 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
121 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
122 |
-
// Listeners //
|
123 |
-
// //////////////////////////////////////////////////////////////////////////////////////
|
124 |
-
}
|
5 |
|
6 |
class TenWebLibSubscribe
|
7 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
public $config;
|
9 |
+
|
|
|
|
|
10 |
public function __construct($config = array())
|
11 |
{
|
12 |
$this->config = $config;
|
13 |
add_action('admin_init', array($this, 'after_subscribe'));
|
14 |
}
|
|
|
|
|
|
|
15 |
|
16 |
public function subscribe_scripts()
|
17 |
{
|
18 |
$wd_options = $this->config;
|
19 |
wp_register_script('subscribe_js', $wd_options->wd_url_js . '/subsribe.js');
|
20 |
wp_enqueue_script('subscribe_js');
|
|
|
21 |
}
|
22 |
|
23 |
public function subscribe_styles()
|
24 |
{
|
25 |
$wd_options = $this->config;
|
26 |
wp_enqueue_style($wd_options->prefix . 'subscribe', $wd_options->wd_url_css . '/subscribe.css');
|
|
|
27 |
}
|
28 |
|
29 |
public function subscribe_display_page()
|
35 |
public function after_subscribe()
|
36 |
{
|
37 |
$wd_options = $this->config;
|
38 |
+
$sub_action = WDILibrary::get($wd_options->prefix . '_sub_action', '');
|
39 |
+
if ( !empty($sub_action) ) {
|
40 |
+
if ( $sub_action == 'allow' ) {
|
41 |
//$api = new TenWebLibApi($wd_options);
|
42 |
$all_plugins = array();
|
43 |
$plugins = get_plugins();
|
66 |
$data["product_id"] = $wd_options->plugin_id;
|
67 |
$data["all_plugins"] = json_encode($all_plugins);
|
68 |
|
|
|
69 |
$response = wp_remote_post(TEN_WEB_LIB_SUBSCRIBE_URL, array(
|
70 |
'method' => 'POST',
|
71 |
'timeout' => 45,
|
81 |
$response_body = (!is_wp_error($response) && isset($response["body"])) ? json_decode($response["body"], true) : null;
|
82 |
|
83 |
if (is_array($response_body) && $response_body["body"]["msg"] == "ok") {
|
|
|
84 |
}
|
|
|
85 |
}
|
86 |
+
|
87 |
if (get_option($wd_options->prefix . "_subscribe_done") != 1) {
|
88 |
update_option($wd_options->prefix . "_subscribe_done", 1);
|
89 |
} else {
|
90 |
add_option($wd_options->prefix . "_subscribe_done", "1", '', 'no');
|
91 |
}
|
92 |
|
93 |
+
//wp_safe_redirect($wd_options->after_subscribe);
|
94 |
}
|
|
|
95 |
}
|
96 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wd/wd.php
CHANGED
@@ -1,161 +1,124 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
// Constructor & Destructor //
|
24 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
25 |
-
public function __construct() {
|
26 |
-
// Add menu for Overview page
|
27 |
-
add_action( 'admin_menu', array( $this, 'wd_overview_menu_page' ), 10 );
|
28 |
-
|
29 |
-
}
|
30 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
31 |
-
// Public Methods //
|
32 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
33 |
-
|
34 |
-
// Init plugin data
|
35 |
-
public function wd_init( $options ) {
|
36 |
-
|
37 |
-
if(!is_array($options)){
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
$config = new TenWebLibConfig();
|
41 |
-
$config->set_options( $options );
|
42 |
-
$this->config = $config;
|
43 |
-
if( !class_exists("TenWebLibApi") ){
|
44 |
-
$this->wd_includes();
|
45 |
-
}
|
46 |
-
|
47 |
-
$this->init_classes();
|
48 |
-
$this->register_hooks();
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
-
// Create overview menu page
|
53 |
-
public function wd_overview_menu_page() {
|
54 |
-
$wd_options = $this->config;
|
55 |
-
|
56 |
-
$capability = $wd_options->menu_capability ? $wd_options->menu_capability : "manage_options";
|
57 |
-
if( get_option( $wd_options->prefix . "_subscribe_done" ) == 1 || $wd_options->subscribe === false ){
|
58 |
-
$parent_slug = $wd_options->custom_post;
|
59 |
-
}
|
60 |
-
else{
|
61 |
-
|
62 |
-
$subscribe_page = add_menu_page( $wd_options->plugin_menu_title, $wd_options->plugin_menu_title, "manage_options", $wd_options->prefix . '_subscribe' , array( $this, 'display_subscribew_page' ), $wd_options->plugin_menu_icon, $wd_options->menu_position );
|
63 |
-
|
64 |
-
$subscribe_instance = new TenWebLibSubscribe($this->config);
|
65 |
-
$this->subscribe_instance = $subscribe_instance;
|
66 |
-
add_action( 'admin_print_styles-' . $subscribe_page, array( $subscribe_instance, 'subscribe_styles' ) );
|
67 |
-
add_action( 'admin_print_scripts-' . $subscribe_page, array( $subscribe_instance, 'subscribe_scripts' ) );
|
68 |
-
|
69 |
-
$parent_slug = null;
|
70 |
-
}
|
71 |
-
if ($wd_options->display_overview) {
|
72 |
-
$title = __( 'Premium', $wd_options->prefix );
|
73 |
-
if ( FALSE && !get_transient( $wd_options->prefix . '_overview_visited' ) ) {
|
74 |
-
$title .= ' <span class="update-plugins count-2" > <span class="plugin-count">1</span></span>';
|
75 |
-
}
|
76 |
-
$overview_page = add_submenu_page( $parent_slug, __( 'Premium', $wd_options->prefix ), '<span style="color:#4481ea;">' . $title . '</span>', $capability, 'overview_' . $wd_options->prefix, array( $this, 'display_overview_page' ) );
|
77 |
-
|
78 |
-
|
79 |
-
$overview_instance = new TenWebLibOverview( $this->config );
|
80 |
-
$this->overview_instance = $overview_instance;
|
81 |
-
add_action( 'admin_print_styles-' . $overview_page, array( $overview_instance, 'overview_styles' ) );
|
82 |
-
add_action( 'admin_print_scripts-' . $overview_page, array( $overview_instance, 'overview_scripts' ) );
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
public function display_subscribew_page(){
|
87 |
-
$this->subscribe_instance->subscribe_display_page();
|
88 |
}
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
// Includs
|
97 |
-
public function wd_includes(){
|
98 |
-
$wd_options = $this->config;
|
99 |
-
|
100 |
-
require_once $wd_options->wd_dir_includes . '/deactivate.php' ;
|
101 |
-
// notices
|
102 |
-
require_once $wd_options->wd_dir_includes . '/api.php';
|
103 |
-
require_once $wd_options->wd_dir_includes . '/notices.php';
|
104 |
-
require_once $wd_options->wd_dir_includes . "/overview.php";
|
105 |
-
require_once $wd_options->wd_dir_includes . "/subscribe.php";
|
106 |
-
|
107 |
-
}
|
108 |
-
public function init_classes(){
|
109 |
-
$wd_options = $this->config;
|
110 |
-
|
111 |
-
$current_url = $_SERVER['REQUEST_URI'];
|
112 |
-
if( $wd_options->deactivate === true ){
|
113 |
-
if(strpos( $current_url, "plugins.php" ) !== false ){
|
114 |
-
new TenWebLibDeactivate( $this->config );
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
new TenWebLibNotices( $this->config );
|
119 |
-
|
120 |
-
}
|
121 |
-
|
122 |
-
public function register_hooks(){
|
123 |
-
$wd_options = $this->config;
|
124 |
-
if( $wd_options->deactivate === true ){
|
125 |
-
add_filter( 'plugin_action_links_' . plugin_basename( $wd_options->plugin_main_file ), array( $this, 'change_deactivation_link' ) );
|
126 |
-
}
|
127 |
-
|
128 |
}
|
|
|
|
|
|
|
129 |
|
|
|
|
|
|
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
add_query_arg(
|
135 |
-
array(
|
136 |
-
'action' => 'deactivate',
|
137 |
-
'plugin' => plugin_basename( $wd_options->plugin_main_file ),
|
138 |
-
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . plugin_basename( $wd_options->plugin_main_file ) )
|
139 |
-
),
|
140 |
-
admin_url( 'plugins.php' )
|
141 |
-
);
|
142 |
-
|
143 |
-
$links["deactivate"] = '<a href="'.$deactivate_url.'" class="' . $wd_options->prefix . '_deactivate_link">Deactivate</a>';
|
144 |
-
return $links;
|
145 |
}
|
146 |
-
|
147 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
148 |
-
// Getters & Setters //
|
149 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
150 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
151 |
-
// Private Methods //
|
152 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
153 |
-
|
154 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
155 |
-
// Listeners //
|
156 |
-
////////////////////////////////////////////////////////////////////////////////////////
|
157 |
|
158 |
-
|
159 |
|
|
|
|
|
|
|
|
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit;
|
4 |
+
}
|
5 |
+
|
6 |
+
class TenWebLib {
|
7 |
+
|
8 |
+
public static $instance;
|
9 |
+
public $overview_instance;
|
10 |
+
public $subscribe_instance;
|
11 |
+
public $config;
|
12 |
+
private $version = "1.1.1";
|
13 |
+
|
14 |
+
public function __construct() {
|
15 |
+
// Add menu for Overview page
|
16 |
+
add_action( 'admin_menu', array( $this, 'wd_overview_menu_page' ), 10 );
|
17 |
+
}
|
18 |
+
|
19 |
+
// Init plugin data
|
20 |
+
public function wd_init( $options ) {
|
21 |
+
if(!is_array($options)){
|
22 |
+
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
+
$config = new TenWebLibConfig();
|
25 |
+
$config->set_options( $options );
|
26 |
+
$this->config = $config;
|
27 |
+
if( !class_exists("TenWebLibApi") ){
|
28 |
+
$this->wd_includes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
+
$this->init_classes();
|
31 |
+
$this->register_hooks();
|
32 |
+
}
|
33 |
|
34 |
+
// Create overview menu page
|
35 |
+
public function wd_overview_menu_page() {
|
36 |
+
$wd_options = $this->config;
|
37 |
|
38 |
+
$capability = $wd_options->menu_capability ? $wd_options->menu_capability : "manage_options";
|
39 |
+
if( get_option( $wd_options->prefix . "_subscribe_done" ) == 1 || $wd_options->subscribe === false ){
|
40 |
+
$parent_slug = $wd_options->custom_post;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
+
else{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
$subscribe_page = add_menu_page( $wd_options->plugin_menu_title, $wd_options->plugin_menu_title, "manage_options", $wd_options->prefix . '_subscribe' , array( $this, 'display_subscribew_page' ), $wd_options->plugin_menu_icon, $wd_options->menu_position );
|
45 |
|
46 |
+
$subscribe_instance = new TenWebLibSubscribe($this->config);
|
47 |
+
$this->subscribe_instance = $subscribe_instance;
|
48 |
+
add_action( 'admin_print_styles-' . $subscribe_page, array( $subscribe_instance, 'subscribe_styles' ) );
|
49 |
+
add_action( 'admin_print_scripts-' . $subscribe_page, array( $subscribe_instance, 'subscribe_scripts' ) );
|
50 |
|
51 |
+
$parent_slug = null;
|
52 |
+
}
|
53 |
+
|
54 |
+
if ($wd_options->display_overview) {
|
55 |
+
$title = __( 'Premium', $wd_options->prefix );
|
56 |
+
if ( FALSE && !get_transient( $wd_options->prefix . '_overview_visited' ) ) {
|
57 |
+
$title .= ' <span class="update-plugins count-2" > <span class="plugin-count">1</span></span>';
|
58 |
+
}
|
59 |
+
$overview_page = add_submenu_page( $parent_slug, __( 'Premium', $wd_options->prefix ), '<span style="color:#4481ea;">' . $title . '</span>', $capability, 'overview_' . $wd_options->prefix, array( $this, 'display_overview_page' ) );
|
60 |
+
|
61 |
+
$overview_instance = new TenWebLibOverview( $this->config );
|
62 |
+
$this->overview_instance = $overview_instance;
|
63 |
+
add_action( 'admin_print_styles-' . $overview_page, array( $overview_instance, 'overview_styles' ) );
|
64 |
+
add_action( 'admin_print_scripts-' . $overview_page, array( $overview_instance, 'overview_scripts' ) );
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
public function display_subscribew_page(){
|
69 |
+
$this->subscribe_instance->subscribe_display_page();
|
70 |
+
}
|
71 |
+
|
72 |
+
// Display overview page
|
73 |
+
public function display_overview_page() {
|
74 |
+
$this->overview_instance->display_overview_page();
|
75 |
+
}
|
76 |
+
|
77 |
+
// Includs
|
78 |
+
public function wd_includes(){
|
79 |
+
$wd_options = $this->config;
|
80 |
+
|
81 |
+
require_once $wd_options->wd_dir_includes . '/deactivate.php' ;
|
82 |
+
// notices
|
83 |
+
require_once $wd_options->wd_dir_includes . '/api.php';
|
84 |
+
require_once $wd_options->wd_dir_includes . '/notices.php';
|
85 |
+
require_once $wd_options->wd_dir_includes . "/overview.php";
|
86 |
+
require_once $wd_options->wd_dir_includes . "/subscribe.php";
|
87 |
+
}
|
88 |
+
|
89 |
+
public function init_classes(){
|
90 |
+
$wd_options = $this->config;
|
91 |
+
|
92 |
+
$current_url = $_SERVER['REQUEST_URI'];
|
93 |
+
if( $wd_options->deactivate === true ){
|
94 |
+
if(strpos( $current_url, "plugins.php" ) !== false ){
|
95 |
+
new TenWebLibDeactivate( $this->config );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
new TenWebLibNotices( $this->config );
|
100 |
+
}
|
101 |
|
102 |
+
public function register_hooks(){
|
103 |
+
$wd_options = $this->config;
|
104 |
+
if( $wd_options->deactivate === true ){
|
105 |
+
add_filter( 'plugin_action_links_' . plugin_basename( $wd_options->plugin_main_file ), array( $this, 'change_deactivation_link' ) );
|
106 |
+
}
|
107 |
+
}
|
108 |
+
|
109 |
+
public function change_deactivation_link ( $links ) {
|
110 |
+
$wd_options = $this->config;
|
111 |
+
$deactivate_url =
|
112 |
+
add_query_arg(
|
113 |
+
array(
|
114 |
+
'action' => 'deactivate',
|
115 |
+
'plugin' => plugin_basename( $wd_options->plugin_main_file ),
|
116 |
+
'_wpnonce' => wp_create_nonce( 'deactivate-plugin_' . plugin_basename( $wd_options->plugin_main_file ) )
|
117 |
+
),
|
118 |
+
admin_url( 'plugins.php' )
|
119 |
+
);
|
120 |
+
|
121 |
+
$links["deactivate"] = '<a href="'.$deactivate_url.'" class="' . $wd_options->prefix . '_deactivate_link">Deactivate</a>';
|
122 |
+
return $links;
|
123 |
+
}
|
124 |
+
}
|