Version Description
- Fixed: Security issues
Download this release
Release Info
Developer | 10web |
Plugin | WD Facebook Feed – Custom Facebook Feed Plugin |
Version | 1.1.12 |
Comparing to | |
See all releases |
Code changes from version 1.1.11 to 1.1.12
- admin/controllers/FFWDControllerFFWDShortcode.php +1 -1
- admin/controllers/FFWDControllerInfo_ffwd.php +2 -2
- admin/controllers/FFWDControllerLicensing_ffwd.php +1 -1
- admin/controllers/FFWDControllerOptions_ffwd.php +9 -9
- admin/controllers/FFWDControllerThemes_ffwd.php +3 -3
- admin/controllers/FFWDControllerUninstall_ffwd.php +1 -1
- admin/models/FFWDModelInfo_ffwd.php +8 -8
- admin/models/FFWDModelThemes_ffwd.php +4 -4
- admin/views/FFWDViewFFWDShortcode.php +18 -6
- admin/views/FFWDViewInfo_ffwd.php +7 -8
- banner_class.php +1 -1
- facebook-feed-wd-notices.php +4 -4
- facebook-feed-wd.php +13 -8
- framework/WDFacebookFeed.php +136 -136
- framework/WDW_FFWD_Library.php +15 -15
- framework/facebook-sdk/base_facebook.php +1 -1
- frontend/controllers/FFWDControllerPopupBox.php +1 -1
- frontend/models/FFWDModelAlbum_compact.php +1 -1
- frontend/models/FFWDModelPopupBox.php +1 -1
- frontend/models/FFWDModelThumbnails_masonry.php +1 -1
- frontend/views/FFWDViewAlbum_compact.php +4 -4
- frontend/views/FFWDViewBlog_style.php +1 -1
- frontend/views/FFWDViewPopupBox.php +38 -38
- js/jquery.form.js +1277 -0
- readme.txt +5 -1
- wd/includes/deactivate.php +5 -5
- wd/includes/notices.php +4 -4
- wd/includes/subscribe.php +1 -1
admin/controllers/FFWDControllerFFWDShortcode.php
CHANGED
@@ -20,7 +20,7 @@ class FFWDControllerFFWDShortcode {
|
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
$task = WDW_FFWD_Library::get('task');
|
23 |
-
$from_menu = ((isset($_GET['page']) && (
|
24 |
if($task != '' && $from_menu){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('FFWDShortcode')){
|
26 |
die('Sorry, your nonce did not verify.');
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
$task = WDW_FFWD_Library::get('task');
|
23 |
+
$from_menu = ((isset($_GET['page']) && (sanitize_text_field($_GET['page']) == 'FFWDShortcode')) ? TRUE : FALSE);
|
24 |
if($task != '' && $from_menu){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('FFWDShortcode')){
|
26 |
die('Sorry, your nonce did not verify.');
|
admin/controllers/FFWDControllerInfo_ffwd.php
CHANGED
@@ -19,8 +19,8 @@ class FFWDControllerInfo_ffwd {
|
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
-
$task = ((isset($_REQUEST['task'])) ?
|
23 |
-
$id = ((isset($_REQUEST['current_id'])) ?
|
24 |
if($task != ''){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('info_ffwd')){
|
26 |
die('Sorry, your nonce did not verify.');
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
+
$task = ((isset($_REQUEST['task'])) ? sanitize_text_field(stripslashes($_REQUEST['task'])) : '');
|
23 |
+
$id = ((isset($_REQUEST['current_id'])) ? sanitize_text_field(stripslashes($_REQUEST['current_id'])) : 0);
|
24 |
if($task != ''){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('info_ffwd')){
|
26 |
die('Sorry, your nonce did not verify.');
|
admin/controllers/FFWDControllerLicensing_ffwd.php
CHANGED
@@ -19,7 +19,7 @@ class FFWDControllerLicensing_ffwd {
|
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
-
$task = ((isset($_POST['task'])) ?
|
23 |
|
24 |
if($task != ''){
|
25 |
if(!WDWLibrary::verify_nonce('licensing_bwg')){
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
+
$task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
|
23 |
|
24 |
if($task != ''){
|
25 |
if(!WDWLibrary::verify_nonce('licensing_bwg')){
|
admin/controllers/FFWDControllerOptions_ffwd.php
CHANGED
@@ -19,16 +19,16 @@ class FFWDControllerOptions_ffwd {
|
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
-
$task = ((isset($_POST['task'])) ?
|
23 |
-
$id = ((isset($_POST['current_id'])) ?
|
24 |
if($task != ''){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('options_ffwd')){
|
26 |
die('Sorry, your nonce did not verify.');
|
27 |
}
|
28 |
}
|
29 |
|
30 |
-
if(!empty($_GET['ffwd_code'])){
|
31 |
-
WDFacebookFeed::save_pages($_GET['ffwd_code']);
|
32 |
die('<script>window.location.href="admin.php?page=options_ffwd"</script>');
|
33 |
}
|
34 |
|
@@ -71,11 +71,11 @@ class FFWDControllerOptions_ffwd {
|
|
71 |
$autoupdate_interval = (isset($_POST['autoupdate_interval_hour']) && isset($_POST['autoupdate_interval_min']) ? ((int) $_POST['autoupdate_interval_hour'] * 60 + (int) $_POST['autoupdate_interval_min']) : 30);
|
72 |
/*minimum autoupdate interval is 1 min*/
|
73 |
$autoupdate_interval = ($autoupdate_interval >= 1 ? $autoupdate_interval : 1 );
|
74 |
-
$facebook_app_id = (isset($_POST[WD_FB_PREFIX . '_app_id']) ?
|
75 |
-
$facebook_app_secret = (isset($_POST[ WD_FB_PREFIX . '_app_secret']) ?
|
76 |
-
$date_timezone = (isset($_POST[ WD_FB_PREFIX . '_date_timezone']) ?
|
77 |
-
$post_date_format = (isset($_POST[ WD_FB_PREFIX . '_post_date_format']) ?
|
78 |
-
$event_date_format = (isset($_POST[ WD_FB_PREFIX . '_event_date_format']) ?
|
79 |
$save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
|
80 |
'autoupdate_interval' => $autoupdate_interval,
|
81 |
'app_id' => $facebook_app_id,
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
+
$task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
|
23 |
+
$id = ((isset($_POST['current_id'])) ? sanitize_text_field(stripslashes($_POST['current_id'])) : 0);
|
24 |
if($task != ''){
|
25 |
if(!WDW_FFWD_Library::verify_nonce('options_ffwd')){
|
26 |
die('Sorry, your nonce did not verify.');
|
27 |
}
|
28 |
}
|
29 |
|
30 |
+
if(isset($_GET['ffwd_code']) && !empty($_GET['ffwd_code'])){
|
31 |
+
WDFacebookFeed::save_pages(sanitize_text_field($_GET['ffwd_code']));
|
32 |
die('<script>window.location.href="admin.php?page=options_ffwd"</script>');
|
33 |
}
|
34 |
|
71 |
$autoupdate_interval = (isset($_POST['autoupdate_interval_hour']) && isset($_POST['autoupdate_interval_min']) ? ((int) $_POST['autoupdate_interval_hour'] * 60 + (int) $_POST['autoupdate_interval_min']) : 30);
|
72 |
/*minimum autoupdate interval is 1 min*/
|
73 |
$autoupdate_interval = ($autoupdate_interval >= 1 ? $autoupdate_interval : 1 );
|
74 |
+
$facebook_app_id = (isset($_POST[WD_FB_PREFIX . '_app_id']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_app_id'])) : '');
|
75 |
+
$facebook_app_secret = (isset($_POST[ WD_FB_PREFIX . '_app_secret']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_app_secret'])) : '');
|
76 |
+
$date_timezone = (isset($_POST[ WD_FB_PREFIX . '_date_timezone']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_date_timezone'])) : 'Pacific/Midway');
|
77 |
+
$post_date_format = (isset($_POST[ WD_FB_PREFIX . '_post_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_post_date_format'])) : 'Pacific/Midway');
|
78 |
+
$event_date_format = (isset($_POST[ WD_FB_PREFIX . '_event_date_format']) ? sanitize_text_field(stripslashes($_POST[WD_FB_PREFIX . '_event_date_format'])) : 'Pacific/Midway');
|
79 |
$save = $wpdb->update($wpdb->prefix . 'wd_fb_option', array(
|
80 |
'autoupdate_interval' => $autoupdate_interval,
|
81 |
'app_id' => $facebook_app_id,
|
admin/controllers/FFWDControllerThemes_ffwd.php
CHANGED
@@ -107,8 +107,8 @@ class FFWDControllerThemes_ffwd
|
|
107 |
{
|
108 |
global $wpdb;
|
109 |
$id = (int)WDW_FFWD_Library::get('current_id', 0);
|
110 |
-
$name = (isset($_POST['name']) ?
|
111 |
-
$default_theme = (isset($_POST['default_theme']) ?
|
112 |
|
113 |
$theme_params_keys = array('thumb_margin',
|
114 |
'thumb_padding',
|
@@ -384,7 +384,7 @@ class FFWDControllerThemes_ffwd
|
|
384 |
$params = array();
|
385 |
foreach ($theme_params_keys as $theme_param_key) {
|
386 |
|
387 |
-
$params[$theme_param_key] = (isset($_POST[$theme_param_key]) ?
|
388 |
}
|
389 |
|
390 |
|
107 |
{
|
108 |
global $wpdb;
|
109 |
$id = (int)WDW_FFWD_Library::get('current_id', 0);
|
110 |
+
$name = (isset($_POST['name']) ? sanitize_text_field(stripslashes($_POST['name'])) : 'exaple');
|
111 |
+
$default_theme = (isset($_POST['default_theme']) ? sanitize_text_field(stripslashes($_POST['default_theme'])) : 0);
|
112 |
|
113 |
$theme_params_keys = array('thumb_margin',
|
114 |
'thumb_padding',
|
384 |
$params = array();
|
385 |
foreach ($theme_params_keys as $theme_param_key) {
|
386 |
|
387 |
+
$params[$theme_param_key] = (isset($_POST[$theme_param_key]) ? sanitize_text_field(stripslashes($_POST[$theme_param_key])) : '');
|
388 |
}
|
389 |
|
390 |
|
admin/controllers/FFWDControllerUninstall_ffwd.php
CHANGED
@@ -36,7 +36,7 @@ class FFWDControllerUninstall_ffwd
|
|
36 |
////////////////////////////////////////////////////////////////////////////////////////
|
37 |
public function execute()
|
38 |
{
|
39 |
-
$task = ((isset($_POST['task'])) ?
|
40 |
$ffwd_uninstall = get_option("ffwd_uninstall");
|
41 |
if(isset($ffwd_uninstall) && $ffwd_uninstall ==="1"){
|
42 |
$task = 'uninstall';
|
36 |
////////////////////////////////////////////////////////////////////////////////////////
|
37 |
public function execute()
|
38 |
{
|
39 |
+
$task = ((isset($_POST['task'])) ? sanitize_text_field(stripslashes($_POST['task'])) : '');
|
40 |
$ffwd_uninstall = get_option("ffwd_uninstall");
|
41 |
if(isset($ffwd_uninstall) && $ffwd_uninstall ==="1"){
|
42 |
$task = 'uninstall';
|
admin/models/FFWDModelInfo_ffwd.php
CHANGED
@@ -172,10 +172,10 @@ class FFWDModelInfo_ffwd {
|
|
172 |
else {
|
173 |
$where = " WHERE author>=0 ";
|
174 |
}
|
175 |
-
$where .= ((isset($_POST['search_value'])) ? ' AND filename LIKE "%' .
|
176 |
-
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ?
|
177 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
178 |
-
$image_order_by = ' ORDER BY `' . ((isset($_POST['image_order_by']) &&
|
179 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
180 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
181 |
}
|
@@ -277,10 +277,10 @@ class FFWDModelInfo_ffwd {
|
|
277 |
|
278 |
public function get_rows_data() {
|
279 |
global $wpdb;
|
280 |
-
$where = ((isset($_POST['search_value'])) ? ' WHERE name LIKE "%' .
|
281 |
-
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ?
|
282 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
283 |
-
$order_by = ' ORDER BY `' . ((isset($_POST['order_by']) &&
|
284 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
285 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
286 |
}
|
@@ -411,7 +411,7 @@ $row->album_image_max_columns= 5;
|
|
411 |
|
412 |
public function page_nav() {
|
413 |
global $wpdb;
|
414 |
-
$where = ((isset($_POST['search_value']) && (
|
415 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "wd_fb_info " . $where;
|
416 |
$total = $wpdb->get_var($query);
|
417 |
$page_nav['total'] = $total;
|
@@ -433,7 +433,7 @@ $row->album_image_max_columns= 5;
|
|
433 |
else {
|
434 |
$where = " AND author>=0 ";
|
435 |
}
|
436 |
-
$where .= ((isset($_POST['search_value']) && (
|
437 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "bwg_image WHERE gallery_id='" . $gallery_id . "' " . $where;
|
438 |
$total = $wpdb->get_var($query);
|
439 |
$page_nav['total'] = $total;
|
172 |
else {
|
173 |
$where = " WHERE author>=0 ";
|
174 |
}
|
175 |
+
$where .= ((isset($_POST['search_value'])) ? ' AND filename LIKE "%' . sanitize_text_field(stripslashes($_POST['search_value'])) . '%"' : '');
|
176 |
+
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ? sanitize_text_field(stripslashes($_POST['asc_or_desc'])) : 'asc');
|
177 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
178 |
+
$image_order_by = ' ORDER BY `' . ((isset($_POST['image_order_by']) && sanitize_text_field(stripslashes($_POST['image_order_by'])) != '') ? sanitize_text_field(stripslashes($_POST['image_order_by'])) : 'order') . '` ' . $asc_or_desc;
|
179 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
180 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
181 |
}
|
277 |
|
278 |
public function get_rows_data() {
|
279 |
global $wpdb;
|
280 |
+
$where = ((isset($_POST['search_value'])) ? ' WHERE name LIKE "%' . sanitize_text_field(stripslashes($_POST['search_value'])) . '%"' : '');
|
281 |
+
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ? sanitize_text_field(stripslashes($_POST['asc_or_desc'])) : 'asc');
|
282 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
283 |
+
$order_by = ' ORDER BY `' . ((isset($_POST['order_by']) && sanitize_text_field(stripslashes($_POST['order_by'])) != '') ? sanitize_text_field(stripslashes($_POST['order_by'])) : 'order') . '` ' . $asc_or_desc;
|
284 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
285 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
286 |
}
|
411 |
|
412 |
public function page_nav() {
|
413 |
global $wpdb;
|
414 |
+
$where = ((isset($_POST['search_value']) && (sanitize_text_field(stripslashes($_POST['search_value'])) != '')) ? ' WHERE name LIKE "%' . sanitize_text_field(stripslashes($_POST['search_value'])) . '%"' : '');
|
415 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "wd_fb_info " . $where;
|
416 |
$total = $wpdb->get_var($query);
|
417 |
$page_nav['total'] = $total;
|
433 |
else {
|
434 |
$where = " AND author>=0 ";
|
435 |
}
|
436 |
+
$where .= ((isset($_POST['search_value']) && (sanitize_text_field(stripslashes($_POST['search_value'])) != '')) ? ' AND filename LIKE "%' . sanitize_text_field(stripslashes($_POST['search_value'])) . '%"' : '');
|
437 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "bwg_image WHERE gallery_id='" . $gallery_id . "' " . $where;
|
438 |
$total = $wpdb->get_var($query);
|
439 |
$page_nav['total'] = $total;
|
admin/models/FFWDModelThemes_ffwd.php
CHANGED
@@ -30,10 +30,10 @@ class FFWDModelThemes_ffwd {
|
|
30 |
////////////////////////////////////////////////////////////////////////////////////////
|
31 |
public function get_rows_data() {
|
32 |
global $wpdb;
|
33 |
-
$where = ((isset($_POST['search_value']) && (
|
34 |
-
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ?
|
35 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
36 |
-
$order_by = ' ORDER BY ' . ((isset($_POST['order_by']) &&
|
37 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
38 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
39 |
}
|
@@ -362,7 +362,7 @@ class FFWDModelThemes_ffwd {
|
|
362 |
|
363 |
public function page_nav() {
|
364 |
global $wpdb;
|
365 |
-
$where = ((isset($_POST['search_value']) && (
|
366 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "wd_fb_theme " . $where;
|
367 |
$total = $wpdb->get_var($query);
|
368 |
$page_nav['total'] = $total;
|
30 |
////////////////////////////////////////////////////////////////////////////////////////
|
31 |
public function get_rows_data() {
|
32 |
global $wpdb;
|
33 |
+
$where = ((isset($_POST['search_value']) && (sanitize_text_field($_POST['search_value']) != '')) ? 'WHERE name LIKE "%' . sanitize_text_field($_POST['search_value']) . '%"' : '');
|
34 |
+
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ? sanitize_text_field($_POST['asc_or_desc']) : 'asc');
|
35 |
$asc_or_desc = ($asc_or_desc != 'asc') ? 'desc' : 'asc';
|
36 |
+
$order_by = ' ORDER BY ' . ((isset($_POST['order_by']) && sanitize_text_field($_POST['order_by']) != '') ? sanitize_text_field($_POST['order_by']) : 'id') . ' ' . $asc_or_desc;
|
37 |
if (isset($_POST['page_number']) && $_POST['page_number']) {
|
38 |
$limit = ((int) $_POST['page_number'] - 1) * $this->per_page;
|
39 |
}
|
362 |
|
363 |
public function page_nav() {
|
364 |
global $wpdb;
|
365 |
+
$where = ((isset($_POST['search_value']) && (sanitize_text_field($_POST['search_value']) != '')) ? 'WHERE name LIKE "%' . sanitize_text_field($_POST['search_value']) . '%"' : '');
|
366 |
$query = "SELECT COUNT(*) FROM " . $wpdb->prefix . "wd_fb_theme " . $where;
|
367 |
$total = $wpdb->get_var($query);
|
368 |
$page_nav['total'] = $total;
|
admin/views/FFWDViewFFWDShortcode.php
CHANGED
@@ -20,10 +20,19 @@ class FFWDViewFFWDShortcode
|
|
20 |
public function __construct($model)
|
21 |
{
|
22 |
$this->model = $model;
|
|
|
23 |
}
|
24 |
////////////////////////////////////////////////////////////////////////////////////////
|
25 |
// Public Methods //
|
26 |
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
public function display()
|
28 |
{
|
29 |
$wd_fb_rows = $this->model->get_wd_fb_data();
|
@@ -31,19 +40,22 @@ class FFWDViewFFWDShortcode
|
|
31 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
32 |
<head>
|
33 |
<title>Facebook Feed by 10Web</title>
|
34 |
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
35 |
-
<link rel="stylesheet" href="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css" type="text/css" media="all">
|
36 |
<?php
|
|
|
37 |
wp_print_scripts('jquery');
|
38 |
wp_print_scripts('jquery-ui-core');
|
39 |
wp_print_scripts('jquery-ui-widget');
|
40 |
wp_print_scripts('jquery-ui-position');
|
41 |
wp_print_scripts('jquery-ui-tooltip');
|
|
|
|
|
|
|
|
|
|
|
42 |
?>
|
43 |
-
|
44 |
-
|
45 |
-
<script language="javascript" type="text/javascript" src="<?php echo WD_FFWD_URL . '/js/ffwd_shortcode.js?ver=' . ffwd_version(); ?>"></script>
|
46 |
-
<script language="javascript" type="text/javascript" src="<?php echo WD_FFWD_URL . '/js/jscolor/jscolor.js?ver=' . ffwd_version(); ?>"></script>
|
47 |
<base target="_self">
|
48 |
</head>
|
49 |
<body id="link" dir="ltr" class="forceColors">
|
20 |
public function __construct($model)
|
21 |
{
|
22 |
$this->model = $model;
|
23 |
+
|
24 |
}
|
25 |
////////////////////////////////////////////////////////////////////////////////////////
|
26 |
// Public Methods //
|
27 |
////////////////////////////////////////////////////////////////////////////////////////
|
28 |
+
public function ffwd_enqueue__shortcode_scripts(){
|
29 |
+
wp_register_script( 'ffwd_shortcode_js', WD_FFWD_URL . '/js/ffwd_shortcode.js', array(), ffwd_get_version() );
|
30 |
+
wp_register_script( 'ffwd_scolor_js', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), ffwd_get_version() );
|
31 |
+
wp_register_style( 'ffwd_shortcode_css', WD_FFWD_URL . '/css/ffwd_shortcode.css',array(), ffwd_get_version() );
|
32 |
+
wp_register_style( 'jquery_ui_custom_css', WD_FFWD_URL . '/css/jquery-ui-1.10.3.custom.css',array(), ffwd_get_version() );
|
33 |
+
$siteurl = get_option("siteurl");
|
34 |
+
wp_register_style( 'ffwd_dialog_css', $siteurl."/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css", array(), ffwd_get_version() );
|
35 |
+
}
|
36 |
public function display()
|
37 |
{
|
38 |
$wd_fb_rows = $this->model->get_wd_fb_data();
|
40 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
41 |
<head>
|
42 |
<title>Facebook Feed by 10Web</title>
|
43 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="<?php echo get_option("siteurl"); ?>/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css" type="text/css" media="all">
|
|
|
44 |
<?php
|
45 |
+
$this->ffwd_enqueue__shortcode_scripts();
|
46 |
wp_print_scripts('jquery');
|
47 |
wp_print_scripts('jquery-ui-core');
|
48 |
wp_print_scripts('jquery-ui-widget');
|
49 |
wp_print_scripts('jquery-ui-position');
|
50 |
wp_print_scripts('jquery-ui-tooltip');
|
51 |
+
wp_print_scripts('ffwd_scolor_js');
|
52 |
+
wp_print_scripts('ffwd_shortcode_js');
|
53 |
+
wp_print_styles('ffwd_dialog_css');
|
54 |
+
wp_print_styles('jquery_ui_custom_css');
|
55 |
+
wp_print_styles('ffwd_shortcode_css')
|
56 |
?>
|
57 |
+
|
58 |
+
|
|
|
|
|
59 |
<base target="_self">
|
60 |
</head>
|
61 |
<body id="link" dir="ltr" class="forceColors">
|
admin/views/FFWDViewInfo_ffwd.php
CHANGED
@@ -30,10 +30,10 @@ class FFWDViewInfo_ffwd
|
|
30 |
$rows_data = $this->model->get_rows_data();
|
31 |
$this->model->del_ffwd_objects();
|
32 |
$page_nav = $this->model->page_nav();
|
33 |
-
$search_value = ((isset($_POST['search_value'])) ?
|
34 |
$search_select_value = ((isset($_POST['search_select_value'])) ? (int)$_POST['search_select_value'] : 0);
|
35 |
-
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ?
|
36 |
-
$order_by = (isset($_POST['order_by']) ?
|
37 |
$order_class = 'manage-column column-title sorted ' . $asc_or_desc;
|
38 |
$ids_string = '';
|
39 |
$per_page = $this->model->per_page();
|
@@ -140,7 +140,7 @@ class FFWDViewInfo_ffwd
|
|
140 |
} ?>">
|
141 |
<a onclick="spider_set_input_value('task', '');
|
142 |
spider_set_input_value('order_by', 'id');
|
143 |
-
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (
|
144 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
145 |
<span>ID</span><span class="sorting-indicator"></span>
|
146 |
</a>
|
@@ -150,7 +150,7 @@ class FFWDViewInfo_ffwd
|
|
150 |
} ?>">
|
151 |
<a onclick="spider_set_input_value('task', '');
|
152 |
spider_set_input_value('order_by', 'name');
|
153 |
-
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (
|
154 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
155 |
<span>Name</span><span class="sorting-indicator"></span>
|
156 |
</a>
|
@@ -161,7 +161,7 @@ class FFWDViewInfo_ffwd
|
|
161 |
} ?>">
|
162 |
<a onclick="spider_set_input_value('task', '');
|
163 |
spider_set_input_value('order_by', 'order');
|
164 |
-
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (
|
165 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
166 |
<span>Order</span><span class="sorting-indicator"></span>
|
167 |
</a>
|
@@ -171,7 +171,7 @@ class FFWDViewInfo_ffwd
|
|
171 |
} ?>">
|
172 |
<a onclick="spider_set_input_value('task', '');
|
173 |
spider_set_input_value('order_by', 'published');
|
174 |
-
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (
|
175 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
176 |
<span>Published</span><span class="sorting-indicator"></span>
|
177 |
</a>
|
@@ -597,7 +597,6 @@ class FFWDViewInfo_ffwd
|
|
597 |
</div>
|
598 |
|
599 |
|
600 |
-
<script src="https://malsup.github.io/jquery.form.js"></script>
|
601 |
<form class="wrap" method="post" id="ffwd_info_form" action="admin.php?page=info_ffwd" style="width:99%;">
|
602 |
<h2></h2>
|
603 |
<?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
|
30 |
$rows_data = $this->model->get_rows_data();
|
31 |
$this->model->del_ffwd_objects();
|
32 |
$page_nav = $this->model->page_nav();
|
33 |
+
$search_value = ((isset($_POST['search_value'])) ? sanitize_text_field(stripslashes($_POST['search_value'])) : '');
|
34 |
$search_select_value = ((isset($_POST['search_select_value'])) ? (int)$_POST['search_select_value'] : 0);
|
35 |
+
$asc_or_desc = ((isset($_POST['asc_or_desc'])) ? sanitize_text_field(stripslashes($_POST['asc_or_desc'])) : 'asc');
|
36 |
+
$order_by = (isset($_POST['order_by']) ? sanitize_text_field(stripslashes($_POST['order_by'])) : 'order');
|
37 |
$order_class = 'manage-column column-title sorted ' . $asc_or_desc;
|
38 |
$ids_string = '';
|
39 |
$per_page = $this->model->per_page();
|
140 |
} ?>">
|
141 |
<a onclick="spider_set_input_value('task', '');
|
142 |
spider_set_input_value('order_by', 'id');
|
143 |
+
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'id') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
|
144 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
145 |
<span>ID</span><span class="sorting-indicator"></span>
|
146 |
</a>
|
150 |
} ?>">
|
151 |
<a onclick="spider_set_input_value('task', '');
|
152 |
spider_set_input_value('order_by', 'name');
|
153 |
+
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'name') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
|
154 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
155 |
<span>Name</span><span class="sorting-indicator"></span>
|
156 |
</a>
|
161 |
} ?>">
|
162 |
<a onclick="spider_set_input_value('task', '');
|
163 |
spider_set_input_value('order_by', 'order');
|
164 |
+
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'order') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
|
165 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
166 |
<span>Order</span><span class="sorting-indicator"></span>
|
167 |
</a>
|
171 |
} ?>">
|
172 |
<a onclick="spider_set_input_value('task', '');
|
173 |
spider_set_input_value('order_by', 'published');
|
174 |
+
spider_set_input_value('asc_or_desc', '<?php echo((isset($_POST['asc_or_desc']) && isset($_POST['order_by']) && (sanitize_text_field(stripslashes($_POST['order_by'])) == 'published') && sanitize_text_field(stripslashes($_POST['asc_or_desc'])) == 'asc') ? 'desc' : 'asc'); ?>');
|
175 |
spider_form_submit(event, 'ffwd_info_form')" href="">
|
176 |
<span>Published</span><span class="sorting-indicator"></span>
|
177 |
</a>
|
597 |
</div>
|
598 |
|
599 |
|
|
|
600 |
<form class="wrap" method="post" id="ffwd_info_form" action="admin.php?page=info_ffwd" style="width:99%;">
|
601 |
<h2></h2>
|
602 |
<?php wp_nonce_field('info_ffwd', 'ffwd_nonce'); ?>
|
banner_class.php
CHANGED
@@ -43,7 +43,7 @@ class TWBanner {
|
|
43 |
add_action('wp_ajax_tenweb_status', array( $this, 'change_status' ));
|
44 |
|
45 |
// Check the page to show banner.
|
46 |
-
if ( ( !isset($_GET['page']) || ( preg_match("/^$this->menu_postfix/",
|
47 |
|
48 |
return;
|
49 |
}
|
43 |
add_action('wp_ajax_tenweb_status', array( $this, 'change_status' ));
|
44 |
|
45 |
// Check the page to show banner.
|
46 |
+
if ( ( !isset($_GET['page']) || ( preg_match("/^$this->menu_postfix/", sanitize_text_field( $_GET['page'] )) === 0 && preg_match("/$this->menu_postfix$/", sanitize_text_field( $_GET['page'] )) === 0 )) || ( isset($_GET['task']) && !strpos(sanitize_text_field($_GET['task']), 'edit') === TRUE && !(strpos(sanitize_text_field($_GET['task']), 'display') > -1)) ) {
|
47 |
|
48 |
return;
|
49 |
}
|
facebook-feed-wd-notices.php
CHANGED
@@ -135,7 +135,7 @@ class FFWD_Notices {
|
|
135 |
// If user clicks to ignore the notice, update the option to not show it again
|
136 |
if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
|
137 |
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
138 |
-
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
|
139 |
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
140 |
$query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
|
141 |
wp_redirect($query_str);
|
@@ -150,12 +150,12 @@ class FFWD_Notices {
|
|
150 |
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
151 |
$current_date = current_time("n/j/Y");
|
152 |
$date_array = explode('/', $current_date);
|
153 |
-
$interval = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
|
154 |
$date_array[1] += $interval;
|
155 |
$new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
|
156 |
|
157 |
-
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
|
158 |
-
$admin_notices_option[$_GET[$this->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
|
159 |
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
160 |
$query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'wd_int'));
|
161 |
wp_redirect( $query_str );
|
135 |
// If user clicks to ignore the notice, update the option to not show it again
|
136 |
if (isset($_GET[$this->prefix . '_admin_notice_ignore'])) {
|
137 |
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
138 |
+
$admin_notices_option[sanitize_text_field($_GET[$this->prefix . '_admin_notice_ignore'])]['dismissed'] = 1;
|
139 |
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
140 |
$query_str = remove_query_arg($this->prefix . '_admin_notice_ignore');
|
141 |
wp_redirect($query_str);
|
150 |
$admin_notices_option = get_option($this->prefix . '_admin_notice', array());
|
151 |
$current_date = current_time("n/j/Y");
|
152 |
$date_array = explode('/', $current_date);
|
153 |
+
$interval = (isset($_GET['wd_int']) ? intval($_GET['wd_int']) : 14);
|
154 |
$date_array[1] += $interval;
|
155 |
$new_start = date("n/j/Y", mktime(0, 0, 0, $date_array[0], $date_array[1], $date_array[2]));
|
156 |
|
157 |
+
$admin_notices_option[sanitize_text_field($_GET[$this->prefix . '_admin_notice_temp_ignore'])]['start'] = $new_start;
|
158 |
+
$admin_notices_option[sanitize_text_field($_GET[$this->prefix . '_admin_notice_temp_ignore'])]['dismissed'] = 0;
|
159 |
update_option($this->prefix . '_admin_notice', $admin_notices_option);
|
160 |
$query_str = remove_query_arg(array($this->prefix . '_admin_notice_temp_ignore', 'wd_int'));
|
161 |
wp_redirect( $query_str );
|
facebook-feed-wd.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: 10Web Social Feed
|
5 |
* Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
|
6 |
* Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
|
7 |
-
* Version: 1.1.
|
8 |
* Author: 10Web
|
9 |
* Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -15,19 +15,19 @@ define( 'WD_FFWD_URL', plugins_url( plugin_basename( dirname( __FILE__ ) ) ) );
|
|
15 |
define( 'WD_FB_PREFIX', 'ffwd' );
|
16 |
define( 'WD_FB_IS_FREE', TRUE );
|
17 |
if (! defined( 'FFWD_VERSION' ) ){
|
18 |
-
define ('FFWD_VERSION',"1.1.
|
19 |
}
|
20 |
|
21 |
add_action('admin_notices', 'ffwd_login_notice');
|
22 |
|
23 |
function ffwd_login_notice() {
|
24 |
-
if (!isset($_GET['page']) || strpos(
|
25 |
return;
|
26 |
}
|
27 |
require_once 'framework/WDFacebookFeed.php';
|
28 |
$pages = get_option('ffwd_pages_list');
|
29 |
$ffwd_pages_list_success = get_option('ffwd_pages_list_success');
|
30 |
-
if($_GET['page']!="options_ffwd" && empty($pages)){
|
31 |
echo '<div class="notice notice-error is-dismissible" style="padding: 15px">
|
32 |
<span><b>Get access tokens to display Facebook feeds.</b></span>
|
33 |
<a style="margin: 0 0 0 15px" id="ffwd_login_button" class="ffwd_login_button" href="#">Log in and get my Access Token</a>
|
@@ -102,7 +102,7 @@ function ffwd_menu_panel() {
|
|
102 |
|
103 |
$parent_slug = null;
|
104 |
|
105 |
-
if ( get_option( "ffwd_subscribe_done" ) == 1 || ( isset( $_GET["page"] ) && $_GET["page"] == "uninstall_ffwd" ) ) {
|
106 |
$parent_slug = "info_ffwd";
|
107 |
if(isset($ffwd_uninstall) && $ffwd_uninstall ==="1"){
|
108 |
$parent_slug = 'uninstall_ffwd';
|
@@ -869,7 +869,7 @@ function ffwd_update_hook() {
|
|
869 |
return false;
|
870 |
}
|
871 |
|
872 |
-
if ( ! isset( $_GET['action'] ) || $_GET['action'] != 'deactivate' ) {
|
873 |
add_action( 'admin_init', 'ffwd_update_hook' );
|
874 |
}
|
875 |
|
@@ -938,6 +938,10 @@ function ffwd_set_option_themes( $status, $option, $value ) {
|
|
938 |
return $status;
|
939 |
}
|
940 |
|
|
|
|
|
|
|
|
|
941 |
function ffwd_admin_scripts() {
|
942 |
wp_enqueue_script( 'thickbox' );
|
943 |
wp_enqueue_script( 'ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version() );
|
@@ -960,7 +964,7 @@ function ffwd_admin_scripts() {
|
|
960 |
wp_enqueue_script( 'jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9' );
|
961 |
wp_enqueue_style( 'ffwd_font-awesome', WD_FFWD_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0' );
|
962 |
|
963 |
-
$page = isset( $_GET['page'] ) ? $_GET['page'] : '';
|
964 |
|
965 |
if ( $page == "uninstall_ffwd" ) {
|
966 |
|
@@ -1042,6 +1046,7 @@ function ffwd_front_end_scripts() {
|
|
1042 |
}
|
1043 |
|
1044 |
add_action( 'wp_enqueue_scripts', 'ffwd_front_end_scripts' );
|
|
|
1045 |
|
1046 |
add_action( 'wp_ajax_ffwd_autoupdate', 'wd_fb_update' );
|
1047 |
add_action( 'wp_ajax_nopriv_ffwd_autoupdate', 'wd_fb_update' );
|
@@ -1050,7 +1055,7 @@ add_filter( 'cron_schedules', 'wd_fb_add_autoupdate_interval' );
|
|
1050 |
function wd_fb_add_autoupdate_interval( $schedules ) {
|
1051 |
|
1052 |
require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
|
1053 |
-
$page = isset($_GET['page']) ? $_GET['page'] : '';
|
1054 |
|
1055 |
$autoupdate_interval=1;
|
1056 |
if($page!='uninstall_ffwd')
|
4 |
* Plugin Name: 10Web Social Feed
|
5 |
* Plugin URI: https://10web.io/plugins/wordpress-facebook-feed/?utm_source=facebook_feed&utm_medium=free_plugin
|
6 |
* Description: 10Web Social Feed is a completely customizable, responsive solution to help you display your Facebook feed on your WordPress website.
|
7 |
+
* Version: 1.1.12
|
8 |
* Author: 10Web
|
9 |
* Author URI: https://10web.io/plugins/?utm_source=facebook_feed&utm_medium=free_plugin
|
10 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
15 |
define( 'WD_FB_PREFIX', 'ffwd' );
|
16 |
define( 'WD_FB_IS_FREE', TRUE );
|
17 |
if (! defined( 'FFWD_VERSION' ) ){
|
18 |
+
define ('FFWD_VERSION',"1.1.12");
|
19 |
}
|
20 |
|
21 |
add_action('admin_notices', 'ffwd_login_notice');
|
22 |
|
23 |
function ffwd_login_notice() {
|
24 |
+
if (!isset($_GET['page']) || strpos(sanitize_text_field($_GET['page']), '_ffwd') === false || sanitize_text_field($_GET['page'])==="overview_ffwd") {
|
25 |
return;
|
26 |
}
|
27 |
require_once 'framework/WDFacebookFeed.php';
|
28 |
$pages = get_option('ffwd_pages_list');
|
29 |
$ffwd_pages_list_success = get_option('ffwd_pages_list_success');
|
30 |
+
if(sanitize_text_field($_GET['page'])!="options_ffwd" && empty($pages)){
|
31 |
echo '<div class="notice notice-error is-dismissible" style="padding: 15px">
|
32 |
<span><b>Get access tokens to display Facebook feeds.</b></span>
|
33 |
<a style="margin: 0 0 0 15px" id="ffwd_login_button" class="ffwd_login_button" href="#">Log in and get my Access Token</a>
|
102 |
|
103 |
$parent_slug = null;
|
104 |
|
105 |
+
if ( get_option( "ffwd_subscribe_done" ) == 1 || ( isset( $_GET["page"] ) && sanitize_text_field($_GET["page"]) == "uninstall_ffwd" ) ) {
|
106 |
$parent_slug = "info_ffwd";
|
107 |
if(isset($ffwd_uninstall) && $ffwd_uninstall ==="1"){
|
108 |
$parent_slug = 'uninstall_ffwd';
|
869 |
return false;
|
870 |
}
|
871 |
|
872 |
+
if ( ! isset( $_GET['action'] ) || sanitize_text_field($_GET['action']) != 'deactivate' ) {
|
873 |
add_action( 'admin_init', 'ffwd_update_hook' );
|
874 |
}
|
875 |
|
938 |
return $status;
|
939 |
}
|
940 |
|
941 |
+
function ffwd_enqueue__admin_scripts(){
|
942 |
+
wp_enqueue_script( 'ffwd_jquery_form_js', WD_FFWD_URL . '/js/jquery.form.js', array(), ffwd_get_version() );
|
943 |
+
}
|
944 |
+
|
945 |
function ffwd_admin_scripts() {
|
946 |
wp_enqueue_script( 'thickbox' );
|
947 |
wp_enqueue_script( 'ffwd_admin', WD_FFWD_URL . '/js/ffwd.js', array(), ffwd_get_version() );
|
964 |
wp_enqueue_script( 'jscolor', WD_FFWD_URL . '/js/jscolor/jscolor.js', array(), '1.3.9' );
|
965 |
wp_enqueue_style( 'ffwd_font-awesome', WD_FFWD_URL . '/css/font-awesome/font-awesome.css', array(), '4.4.0' );
|
966 |
|
967 |
+
$page = isset( $_GET['page'] ) ? sanitize_text_field($_GET['page']) : '';
|
968 |
|
969 |
if ( $page == "uninstall_ffwd" ) {
|
970 |
|
1046 |
}
|
1047 |
|
1048 |
add_action( 'wp_enqueue_scripts', 'ffwd_front_end_scripts' );
|
1049 |
+
add_action( 'admin_enqueue_scripts', 'ffwd_enqueue__admin_scripts' );
|
1050 |
|
1051 |
add_action( 'wp_ajax_ffwd_autoupdate', 'wd_fb_update' );
|
1052 |
add_action( 'wp_ajax_nopriv_ffwd_autoupdate', 'wd_fb_update' );
|
1055 |
function wd_fb_add_autoupdate_interval( $schedules ) {
|
1056 |
|
1057 |
require_once( WD_FFWD_DIR . '/framework/WDFacebookFeed.php' );
|
1058 |
+
$page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
|
1059 |
|
1060 |
$autoupdate_interval=1;
|
1061 |
if($page!='uninstall_ffwd')
|
framework/WDFacebookFeed.php
CHANGED
@@ -88,7 +88,7 @@ class WDFacebookFeed {
|
|
88 |
}
|
89 |
|
90 |
public static function save_facebook_feed() {
|
91 |
-
$id = (isset($_POST['current_id']) && $_POST['current_id'] != '') ? (int)
|
92 |
if($id) {
|
93 |
self::$fb_id = $id;
|
94 |
self::$edit_feed = true;
|
@@ -107,82 +107,82 @@ class WDFacebookFeed {
|
|
107 |
$row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE id="%d"', self::$fb_id));
|
108 |
///////////////////////Araqel
|
109 |
$ffwd_info_options=array();
|
110 |
-
$ffwd_info_options['theme']=((isset($_POST['theme'])) ?
|
111 |
-
$ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ?
|
112 |
-
$ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ?
|
113 |
-
$ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ?
|
114 |
-
$ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ?
|
115 |
-
$ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ?
|
116 |
-
$ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ?
|
117 |
-
$ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ?
|
118 |
-
$ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ?
|
119 |
-
$ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ?
|
120 |
-
$ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ?
|
121 |
-
$ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ?
|
122 |
-
$ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ?
|
123 |
-
$ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ?
|
124 |
-
$ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ?
|
125 |
-
$ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ?
|
126 |
-
$ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ?
|
127 |
-
$ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ?
|
128 |
-
$ffwd_info_options['blog_style_google']=((isset($_POST['blog_style_google'])) ?
|
129 |
-
$ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ?
|
130 |
-
$ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ?
|
131 |
-
$ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ?
|
132 |
-
$ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ?
|
133 |
-
$ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ?
|
134 |
-
$ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ?
|
135 |
-
$ffwd_info_options['album_title']=((isset($_POST['album_title'])) ?
|
136 |
-
$ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ?
|
137 |
-
$ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ?
|
138 |
-
$ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ?
|
139 |
-
$ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ?
|
140 |
-
$ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ?
|
141 |
-
$ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ?
|
142 |
-
$ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ?
|
143 |
-
$ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ?
|
144 |
-
$ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ?
|
145 |
-
$ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ?
|
146 |
-
$ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ?
|
147 |
-
$ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ?
|
148 |
-
$ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ?
|
149 |
-
$ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ?
|
150 |
-
$ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ?
|
151 |
-
$ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ?
|
152 |
-
$ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ?
|
153 |
-
$ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ?
|
154 |
-
$ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ?
|
155 |
-
$ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ?
|
156 |
-
$ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ?
|
157 |
-
$ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ?
|
158 |
-
$ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ?
|
159 |
-
$ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ?
|
160 |
-
$ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ?
|
161 |
-
$ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ?
|
162 |
-
$ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ?
|
163 |
-
$ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ?
|
164 |
-
$ffwd_info_options['popup_enable_google']=((isset($_POST['popup_enable_google'])) ?
|
165 |
-
$ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ?
|
166 |
-
$ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ?
|
167 |
|
168 |
$ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
|
169 |
|
170 |
foreach($ffwd_options_db as $ffwd_option_db)
|
171 |
{
|
172 |
|
173 |
-
$ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ?
|
174 |
}
|
175 |
|
176 |
////////////////////////
|
177 |
-
$name = ((isset($_POST['name'])) ?
|
178 |
-
$page_access_token = ((isset($_POST['page_access_token'])) ?
|
179 |
|
180 |
// $new_access_token = self::update_page_access_token($page_access_token);
|
181 |
// if($new_access_token["success"]){
|
182 |
// $page_access_token = $new_access_token["new_token"];
|
183 |
// }
|
184 |
-
$update_mode = ((isset($_POST['update_mode'])) ?
|
185 |
-
$published = ((isset($_POST['published'])) ? (int)
|
186 |
$content = implode(",", self::$content);
|
187 |
$from = self::$id;
|
188 |
$update_wd_fb_data = (
|
@@ -489,7 +489,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
489 |
}
|
490 |
|
491 |
public static function page() {
|
492 |
-
$page_id = $_POST['fb_page_id'];
|
493 |
$pages_list = get_option('ffwd_pages_list', array());
|
494 |
|
495 |
$fb_page = null;
|
@@ -509,8 +509,8 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
509 |
$_POST['page_access_token'] = $fb_page->access_token;
|
510 |
|
511 |
|
512 |
-
self::$content_url = ((isset($_POST['content_url'])) ?
|
513 |
-
self::$limit = ((isset($_POST['limit'])) ?
|
514 |
self::set_access_token();
|
515 |
self::check_fb_page_url();
|
516 |
// If user exists => set content.
|
@@ -537,8 +537,8 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
537 |
}
|
538 |
|
539 |
public static function group() {
|
540 |
-
self::$content_url = ((isset($_POST['content_url'])) ?
|
541 |
-
self::$limit = ((isset($_POST['limit'])) ?
|
542 |
self::check_fb_group_url();
|
543 |
self::set_content();
|
544 |
self::set_access_token();
|
@@ -547,7 +547,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
547 |
|
548 |
public static function profile() {
|
549 |
self::$content_url = '';
|
550 |
-
self::$limit = ((isset($_POST['limit'])) ?
|
551 |
self::check_fb_user();
|
552 |
self::set_content();
|
553 |
self::set_access_token();
|
@@ -582,7 +582,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
582 |
}
|
583 |
|
584 |
public static function set_content() {
|
585 |
-
$content_type = ((isset($_POST['content_type'])) ?
|
586 |
$content = (isset($_POST['content'])) ? $_POST['content'] : array();
|
587 |
self::$content_type = in_array($content_type, self::$valid_content_types) ? $content_type : false;
|
588 |
// If right content type
|
@@ -1080,15 +1080,15 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
1080 |
* Posts by owner and others (so edge is feed (but data must be filtered by from atribute not equal to owner ID)).
|
1081 |
*/
|
1082 |
if(self::$save || self::$edit_feed)
|
1083 |
-
self::$timeline_type = (isset($_POST['timeline_type']) && $_POST['timeline_type'] != '') ?
|
1084 |
return;
|
1085 |
}
|
1086 |
|
1087 |
public static function save_db() {
|
1088 |
global $wpdb;
|
1089 |
-
$name = ((isset($_POST['name'])) ?
|
1090 |
-
$page_access_token = ((isset($_POST['page_access_token'])) ?
|
1091 |
-
$update_mode = ((isset($_POST['update_mode'])) ?
|
1092 |
// Collapse content types (multiple when content type is timeline, one when specific)
|
1093 |
$content = implode(",", self::$content);
|
1094 |
$from = self::$id;
|
@@ -1100,70 +1100,70 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
1100 |
|
1101 |
///////////////////////Araqel
|
1102 |
$ffwd_info_options=array();
|
1103 |
-
$ffwd_info_options['theme']=((isset($_POST['theme'])) ?
|
1104 |
-
$ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ?
|
1105 |
-
$ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ?
|
1106 |
-
$ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ?
|
1107 |
-
$ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ?
|
1108 |
-
$ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ?
|
1109 |
-
$ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ?
|
1110 |
-
$ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ?
|
1111 |
-
$ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ?
|
1112 |
-
$ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ?
|
1113 |
-
$ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ?
|
1114 |
-
$ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ?
|
1115 |
-
$ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ?
|
1116 |
-
$ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ?
|
1117 |
-
$ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ?
|
1118 |
-
$ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ?
|
1119 |
-
$ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ?
|
1120 |
-
$ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ?
|
1121 |
-
$ffwd_info_options['blog_style_google']=((isset($_POST['blog_style_google'])) ?
|
1122 |
-
$ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ?
|
1123 |
-
$ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ?
|
1124 |
-
$ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ?
|
1125 |
-
$ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ?
|
1126 |
-
$ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ?
|
1127 |
-
$ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ?
|
1128 |
-
$ffwd_info_options['album_title']=((isset($_POST['album_title'])) ?
|
1129 |
-
$ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ?
|
1130 |
-
$ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ?
|
1131 |
-
$ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ?
|
1132 |
-
$ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ?
|
1133 |
-
$ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ?
|
1134 |
-
$ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ?
|
1135 |
-
$ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ?
|
1136 |
-
$ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ?
|
1137 |
-
$ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ?
|
1138 |
-
$ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ?
|
1139 |
-
$ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ?
|
1140 |
-
$ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ?
|
1141 |
-
$ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ?
|
1142 |
-
$ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ?
|
1143 |
-
$ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ?
|
1144 |
-
$ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ?
|
1145 |
-
$ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ?
|
1146 |
-
$ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ?
|
1147 |
-
$ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ?
|
1148 |
-
$ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ?
|
1149 |
-
$ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ?
|
1150 |
-
$ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ?
|
1151 |
-
$ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ?
|
1152 |
-
$ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ?
|
1153 |
-
$ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ?
|
1154 |
-
$ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ?
|
1155 |
-
$ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ?
|
1156 |
-
$ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ?
|
1157 |
-
$ffwd_info_options['popup_enable_google']=((isset($_POST['popup_enable_google'])) ?
|
1158 |
-
$ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ?
|
1159 |
-
$ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ?
|
1160 |
|
1161 |
$ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
|
1162 |
|
1163 |
foreach($ffwd_options_db as $ffwd_option_db)
|
1164 |
{
|
1165 |
|
1166 |
-
$ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ?
|
1167 |
}
|
1168 |
|
1169 |
|
@@ -1517,8 +1517,8 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
1517 |
|
1518 |
if(!class_exists('Facebook'))
|
1519 |
include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
|
1520 |
-
$app_id = ((isset($_POST['app_id'])) ?
|
1521 |
-
$app_secret = ((isset($_POST['app_secret'])) ?
|
1522 |
//prepare params for graph api call
|
1523 |
|
1524 |
|
@@ -1591,7 +1591,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
1591 |
|
1592 |
public static function dropp_objects() {
|
1593 |
global $wpdb;
|
1594 |
-
|
1595 |
$yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
|
1596 |
echo $yes;
|
1597 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX )
|
@@ -1636,7 +1636,7 @@ $ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? esc_htm
|
|
1636 |
}
|
1637 |
|
1638 |
public static function check_fb_type() {
|
1639 |
-
$fb_type = ((isset($_POST['fb_type'])) ?
|
1640 |
self::$fb_type = in_array($fb_type, self::$fb_valid_types) ? $fb_type : false;
|
1641 |
if(self::$fb_type)
|
1642 |
self::$fb_type();
|
88 |
}
|
89 |
|
90 |
public static function save_facebook_feed() {
|
91 |
+
$id = (isset($_POST['current_id']) && $_POST['current_id'] != '') ? (int) sanitize_text_field(stripslashes($_POST['current_id'])) : 0;
|
92 |
if($id) {
|
93 |
self::$fb_id = $id;
|
94 |
self::$edit_feed = true;
|
107 |
$row = $wpdb->get_row($wpdb->prepare('SELECT * FROM ' . $wpdb->prefix . 'wd_fb_info WHERE id="%d"', self::$fb_id));
|
108 |
///////////////////////Araqel
|
109 |
$ffwd_info_options=array();
|
110 |
+
$ffwd_info_options['theme']=((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
|
111 |
+
$ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
|
112 |
+
$ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
|
113 |
+
$ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
|
114 |
+
$ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
|
115 |
+
$ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
|
116 |
+
$ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
|
117 |
+
$ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
|
118 |
+
$ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
|
119 |
+
$ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
|
120 |
+
$ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
|
121 |
+
$ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
|
122 |
+
$ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
|
123 |
+
$ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
|
124 |
+
$ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
|
125 |
+
$ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
|
126 |
+
$ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
|
127 |
+
$ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
|
128 |
+
$ffwd_info_options['blog_style_google']=((isset($_POST['blog_style_google'])) ? sanitize_text_field(stripslashes($_POST['blog_style_google'])) : '');
|
129 |
+
$ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
|
130 |
+
$ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
|
131 |
+
$ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
|
132 |
+
$ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
|
133 |
+
$ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
|
134 |
+
$ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
|
135 |
+
$ffwd_info_options['album_title']=((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
|
136 |
+
$ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
|
137 |
+
$ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
|
138 |
+
$ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
|
139 |
+
$ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
|
140 |
+
$ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
|
141 |
+
$ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
|
142 |
+
$ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
|
143 |
+
$ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
|
144 |
+
$ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
|
145 |
+
$ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
|
146 |
+
$ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
|
147 |
+
$ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
|
148 |
+
$ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
|
149 |
+
$ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
|
150 |
+
$ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
|
151 |
+
$ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
|
152 |
+
$ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
|
153 |
+
$ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
|
154 |
+
$ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
|
155 |
+
$ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
|
156 |
+
$ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
|
157 |
+
$ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
|
158 |
+
$ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
|
159 |
+
$ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
|
160 |
+
$ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
|
161 |
+
$ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
|
162 |
+
$ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
|
163 |
+
$ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
|
164 |
+
$ffwd_info_options['popup_enable_google']=((isset($_POST['popup_enable_google'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_google'])) : '');
|
165 |
+
$ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
|
166 |
+
$ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
|
167 |
|
168 |
$ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
|
169 |
|
170 |
foreach($ffwd_options_db as $ffwd_option_db)
|
171 |
{
|
172 |
|
173 |
+
$ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
|
174 |
}
|
175 |
|
176 |
////////////////////////
|
177 |
+
$name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
|
178 |
+
$page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
|
179 |
|
180 |
// $new_access_token = self::update_page_access_token($page_access_token);
|
181 |
// if($new_access_token["success"]){
|
182 |
// $page_access_token = $new_access_token["new_token"];
|
183 |
// }
|
184 |
+
$update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
|
185 |
+
$published = ((isset($_POST['published'])) ? (int) sanitize_text_field(stripslashes($_POST['published'])) : 1);
|
186 |
$content = implode(",", self::$content);
|
187 |
$from = self::$id;
|
188 |
$update_wd_fb_data = (
|
489 |
}
|
490 |
|
491 |
public static function page() {
|
492 |
+
$page_id = isset($_POST['fb_page_id']) ? sanitize_text_field($_POST['fb_page_id']) : 0;
|
493 |
$pages_list = get_option('ffwd_pages_list', array());
|
494 |
|
495 |
$fb_page = null;
|
509 |
$_POST['page_access_token'] = $fb_page->access_token;
|
510 |
|
511 |
|
512 |
+
self::$content_url = ((isset($_POST['content_url'])) ? sanitize_text_field(stripslashes($_POST['content_url'])) : '');
|
513 |
+
self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
|
514 |
self::set_access_token();
|
515 |
self::check_fb_page_url();
|
516 |
// If user exists => set content.
|
537 |
}
|
538 |
|
539 |
public static function group() {
|
540 |
+
self::$content_url = ((isset($_POST['content_url'])) ? sanitize_text_field(stripslashes($_POST['content_url'])) : '');
|
541 |
+
self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
|
542 |
self::check_fb_group_url();
|
543 |
self::set_content();
|
544 |
self::set_access_token();
|
547 |
|
548 |
public static function profile() {
|
549 |
self::$content_url = '';
|
550 |
+
self::$limit = ((isset($_POST['limit'])) ? sanitize_text_field(stripslashes($_POST['limit'])) : '');
|
551 |
self::check_fb_user();
|
552 |
self::set_content();
|
553 |
self::set_access_token();
|
582 |
}
|
583 |
|
584 |
public static function set_content() {
|
585 |
+
$content_type = ((isset($_POST['content_type'])) ? sanitize_text_field(stripslashes($_POST['content_type'])) : '');
|
586 |
$content = (isset($_POST['content'])) ? $_POST['content'] : array();
|
587 |
self::$content_type = in_array($content_type, self::$valid_content_types) ? $content_type : false;
|
588 |
// If right content type
|
1080 |
* Posts by owner and others (so edge is feed (but data must be filtered by from atribute not equal to owner ID)).
|
1081 |
*/
|
1082 |
if(self::$save || self::$edit_feed)
|
1083 |
+
self::$timeline_type = (isset($_POST['timeline_type']) && $_POST['timeline_type'] != '') ? sanitize_text_field(stripcslashes($_POST['timeline_type'])) : 'posts';
|
1084 |
return;
|
1085 |
}
|
1086 |
|
1087 |
public static function save_db() {
|
1088 |
global $wpdb;
|
1089 |
+
$name = ((isset($_POST['name'])) ? sanitize_text_field(stripslashes($_POST['name'])) : '');
|
1090 |
+
$page_access_token = ((isset($_POST['page_access_token'])) ? sanitize_text_field(stripslashes($_POST['page_access_token'])) : '');
|
1091 |
+
$update_mode = ((isset($_POST['update_mode'])) ? sanitize_text_field(stripslashes($_POST['update_mode'])) : '');
|
1092 |
// Collapse content types (multiple when content type is timeline, one when specific)
|
1093 |
$content = implode(",", self::$content);
|
1094 |
$from = self::$id;
|
1100 |
|
1101 |
///////////////////////Araqel
|
1102 |
$ffwd_info_options=array();
|
1103 |
+
$ffwd_info_options['theme']=((isset($_POST['theme'])) ? sanitize_text_field(stripslashes($_POST['theme'])) : '');
|
1104 |
+
$ffwd_info_options['masonry_hor_ver']=((isset($_POST['masonry_hor_ver'])) ? sanitize_text_field(stripslashes($_POST['masonry_hor_ver'])) : '');
|
1105 |
+
$ffwd_info_options['image_max_columns']=((isset($_POST['image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['image_max_columns'])) : '');
|
1106 |
+
$ffwd_info_options['thumb_width']=((isset($_POST['thumb_width'])) ? sanitize_text_field(stripslashes($_POST['thumb_width'])) : '');
|
1107 |
+
$ffwd_info_options['thumb_height']=((isset($_POST['thumb_height'])) ? sanitize_text_field(stripslashes($_POST['thumb_height'])) : '');
|
1108 |
+
$ffwd_info_options['thumb_comments']=((isset($_POST['thumb_comments'])) ? sanitize_text_field(stripslashes($_POST['thumb_comments'])) : '');
|
1109 |
+
$ffwd_info_options['thumb_likes']=((isset($_POST['thumb_likes'])) ? sanitize_text_field(stripslashes($_POST['thumb_likes'])) : '');
|
1110 |
+
$ffwd_info_options['thumb_name']=((isset($_POST['thumb_name'])) ? sanitize_text_field(stripslashes($_POST['thumb_name'])) : '');
|
1111 |
+
$ffwd_info_options['blog_style_width']=((isset($_POST['blog_style_width'])) ? sanitize_text_field(stripslashes($_POST['blog_style_width'])) : '');
|
1112 |
+
$ffwd_info_options['blog_style_height']=((isset($_POST['blog_style_height'])) ? sanitize_text_field(stripslashes($_POST['blog_style_height'])) : '');
|
1113 |
+
$ffwd_info_options['blog_style_view_type']=((isset($_POST['blog_style_view_type'])) ? sanitize_text_field(stripslashes($_POST['blog_style_view_type'])) : '');
|
1114 |
+
$ffwd_info_options['blog_style_comments']=((isset($_POST['blog_style_comments'])) ? sanitize_text_field(stripslashes($_POST['blog_style_comments'])) : '');
|
1115 |
+
$ffwd_info_options['blog_style_likes']=((isset($_POST['blog_style_likes'])) ? sanitize_text_field(stripslashes($_POST['blog_style_likes'])) : '');
|
1116 |
+
$ffwd_info_options['blog_style_message_desc']=((isset($_POST['blog_style_message_desc'])) ? sanitize_text_field(stripslashes($_POST['blog_style_message_desc'])) : '');
|
1117 |
+
$ffwd_info_options['blog_style_shares']=((isset($_POST['blog_style_shares'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares'])) : '');
|
1118 |
+
$ffwd_info_options['blog_style_shares_butt']=((isset($_POST['blog_style_shares_butt'])) ? sanitize_text_field(stripslashes($_POST['blog_style_shares_butt'])) : '');
|
1119 |
+
$ffwd_info_options['blog_style_facebook']=((isset($_POST['blog_style_facebook'])) ? sanitize_text_field(stripslashes($_POST['blog_style_facebook'])) : '');
|
1120 |
+
$ffwd_info_options['blog_style_twitter']=((isset($_POST['blog_style_twitter'])) ? sanitize_text_field(stripslashes($_POST['blog_style_twitter'])) : '');
|
1121 |
+
$ffwd_info_options['blog_style_google']=((isset($_POST['blog_style_google'])) ? sanitize_text_field(stripslashes($_POST['blog_style_google'])) : '');
|
1122 |
+
$ffwd_info_options['blog_style_author']=((isset($_POST['blog_style_author'])) ? sanitize_text_field(stripslashes($_POST['blog_style_author'])) : '');
|
1123 |
+
$ffwd_info_options['blog_style_name']=((isset($_POST['blog_style_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_name'])) : '');
|
1124 |
+
$ffwd_info_options['blog_style_place_name']=((isset($_POST['blog_style_place_name'])) ? sanitize_text_field(stripslashes($_POST['blog_style_place_name'])) : '');
|
1125 |
+
$ffwd_info_options['fb_name']=((isset($_POST['fb_name'])) ? sanitize_text_field(stripslashes($_POST['fb_name'])) : '');
|
1126 |
+
$ffwd_info_options['fb_plugin']=((isset($_POST['fb_plugin'])) ? sanitize_text_field(stripslashes($_POST['fb_plugin'])) : '');
|
1127 |
+
$ffwd_info_options['album_max_columns']=((isset($_POST['album_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_max_columns'])) : '');
|
1128 |
+
$ffwd_info_options['album_title']=((isset($_POST['album_title'])) ? sanitize_text_field(stripslashes($_POST['album_title'])) : '');
|
1129 |
+
$ffwd_info_options['album_thumb_width']=((isset($_POST['album_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_width'])) : '');
|
1130 |
+
$ffwd_info_options['album_thumb_height']=((isset($_POST['album_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_thumb_height'])) : '');
|
1131 |
+
$ffwd_info_options['album_image_max_columns']=((isset($_POST['album_image_max_columns'])) ? sanitize_text_field(stripslashes($_POST['album_image_max_columns'])) : '');
|
1132 |
+
$ffwd_info_options['album_image_thumb_width']=((isset($_POST['album_image_thumb_width'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_width'])) : '');
|
1133 |
+
$ffwd_info_options['album_image_thumb_height']=((isset($_POST['album_image_thumb_height'])) ? sanitize_text_field(stripslashes($_POST['album_image_thumb_height'])) : '');
|
1134 |
+
$ffwd_info_options['pagination_type']=((isset($_POST['pagination_type'])) ? sanitize_text_field(stripslashes($_POST['pagination_type'])) : '');
|
1135 |
+
$ffwd_info_options['objects_per_page']=((isset($_POST['objects_per_page'])) ? sanitize_text_field(stripslashes($_POST['objects_per_page'])) : '');
|
1136 |
+
$ffwd_info_options['popup_fullscreen']=((isset($_POST['popup_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_fullscreen'])) : '');
|
1137 |
+
$ffwd_info_options['popup_height']=((isset($_POST['popup_height'])) ? sanitize_text_field(stripslashes($_POST['popup_height'])) : '');
|
1138 |
+
$ffwd_info_options['popup_width']=((isset($_POST['popup_width'])) ? sanitize_text_field(stripslashes($_POST['popup_width'])) : '');
|
1139 |
+
$ffwd_info_options['popup_effect']=((isset($_POST['popup_effect'])) ? sanitize_text_field(stripslashes($_POST['popup_effect'])) : '');
|
1140 |
+
$ffwd_info_options['popup_autoplay']=((isset($_POST['popup_autoplay'])) ? sanitize_text_field(stripslashes($_POST['popup_autoplay'])) : '');
|
1141 |
+
$ffwd_info_options['open_commentbox']=((isset($_POST['open_commentbox'])) ? sanitize_text_field(stripslashes($_POST['open_commentbox'])) : '');
|
1142 |
+
$ffwd_info_options['popup_interval']=((isset($_POST['popup_interval'])) ? sanitize_text_field(stripslashes($_POST['popup_interval'])) : '');
|
1143 |
+
$ffwd_info_options['popup_enable_filmstrip']=((isset($_POST['popup_enable_filmstrip'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_filmstrip'])) : '');
|
1144 |
+
$ffwd_info_options['popup_filmstrip_height']=((isset($_POST['popup_filmstrip_height'])) ? sanitize_text_field(stripslashes($_POST['popup_filmstrip_height'])) : '');
|
1145 |
+
$ffwd_info_options['popup_comments']=((isset($_POST['popup_comments'])) ? sanitize_text_field(stripslashes($_POST['popup_comments'])) : '');
|
1146 |
+
$ffwd_info_options['popup_likes']=((isset($_POST['popup_likes'])) ? sanitize_text_field(stripslashes($_POST['popup_likes'])) : '');
|
1147 |
+
$ffwd_info_options['popup_shares']=((isset($_POST['popup_shares'])) ? sanitize_text_field(stripslashes($_POST['popup_shares'])) : '');
|
1148 |
+
$ffwd_info_options['popup_author']=((isset($_POST['popup_author'])) ? sanitize_text_field(stripslashes($_POST['popup_author'])) : '');
|
1149 |
+
$ffwd_info_options['popup_name']=((isset($_POST['popup_name'])) ? sanitize_text_field(stripslashes($_POST['popup_name'])) : '');
|
1150 |
+
$ffwd_info_options['popup_place_name']=((isset($_POST['popup_place_name'])) ? sanitize_text_field(stripslashes($_POST['popup_place_name'])) : '');
|
1151 |
+
$ffwd_info_options['popup_enable_ctrl_btn']=((isset($_POST['popup_enable_ctrl_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_ctrl_btn'])) : '');
|
1152 |
+
$ffwd_info_options['popup_enable_fullscreen']=((isset($_POST['popup_enable_fullscreen'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_fullscreen'])) : '');
|
1153 |
+
$ffwd_info_options['popup_enable_info_btn']=((isset($_POST['popup_enable_info_btn'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_info_btn'])) : '');
|
1154 |
+
$ffwd_info_options['popup_message_desc']=((isset($_POST['popup_message_desc'])) ? sanitize_text_field(stripslashes($_POST['popup_message_desc'])) : '');
|
1155 |
+
$ffwd_info_options['popup_enable_facebook']=((isset($_POST['popup_enable_facebook'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_facebook'])) : '');
|
1156 |
+
$ffwd_info_options['popup_enable_twitter']=((isset($_POST['popup_enable_twitter'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_twitter'])) : '');
|
1157 |
+
$ffwd_info_options['popup_enable_google']=((isset($_POST['popup_enable_google'])) ? sanitize_text_field(stripslashes($_POST['popup_enable_google'])) : '');
|
1158 |
+
$ffwd_info_options['fb_view_type']=((isset($_POST['fb_view_type'])) ? sanitize_text_field(stripslashes($_POST['fb_view_type'])) : '');
|
1159 |
+
$ffwd_info_options['image_onclick_action']=((isset($_POST['image_onclick_action'])) ? sanitize_text_field(stripslashes($_POST['image_onclick_action'])) : 'lightbox');
|
1160 |
|
1161 |
$ffwd_options_db=array('view_on_fb','post_text_length','event_street','event_city','event_country','event_zip','event_map','event_date','event_desp_length','comments_replies','comments_filter','comments_order','page_plugin_pos','page_plugin_fans','page_plugin_cover','page_plugin_header','page_plugin_width', 'fb_page_id');
|
1162 |
|
1163 |
foreach($ffwd_options_db as $ffwd_option_db)
|
1164 |
{
|
1165 |
|
1166 |
+
$ffwd_info_options[$ffwd_option_db] =((isset($_POST[$ffwd_option_db])) ? sanitize_text_field(stripslashes($_POST[$ffwd_option_db])) : '');
|
1167 |
}
|
1168 |
|
1169 |
|
1517 |
|
1518 |
if(!class_exists('Facebook'))
|
1519 |
include WD_FFWD_DIR . "/framework/facebook-sdk/facebook.php";
|
1520 |
+
$app_id = ((isset($_POST['app_id'])) ? sanitize_text_field(stripslashes($_POST['app_id'])) : '');
|
1521 |
+
$app_secret = ((isset($_POST['app_secret'])) ? sanitize_text_field(stripslashes($_POST['app_secret'])) : '');
|
1522 |
//prepare params for graph api call
|
1523 |
|
1524 |
|
1591 |
|
1592 |
public static function dropp_objects() {
|
1593 |
global $wpdb;
|
1594 |
+
$dropped_id = (isset($_POST['ids']) && $_POST['ids'] != '') ? sanitize_text_field($_POST['ids']) : '';
|
1595 |
$yes = $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->prefix . 'wd_fb_data WHERE `id` = "%d"', $dropped_id));
|
1596 |
echo $yes;
|
1597 |
if (defined( 'DOING_AJAX' ) && DOING_AJAX )
|
1636 |
}
|
1637 |
|
1638 |
public static function check_fb_type() {
|
1639 |
+
$fb_type = ((isset($_POST['fb_type'])) ? sanitize_text_field(stripslashes($_POST['fb_type'])) : '');
|
1640 |
self::$fb_type = in_array($fb_type, self::$fb_valid_types) ? $fb_type : false;
|
1641 |
if(self::$fb_type)
|
1642 |
self::$fb_type();
|
framework/WDW_FFWD_Library.php
CHANGED
@@ -23,10 +23,10 @@ class WDW_FFWD_Library {
|
|
23 |
////////////////////////////////////////////////////////////////////////////////////////
|
24 |
public static function get($key, $default_value = '') {
|
25 |
if (isset($_GET[$key])) {
|
26 |
-
$value = $_GET[$key];
|
27 |
}
|
28 |
elseif (isset($_POST[$key])) {
|
29 |
-
$value = $_POST[$key];
|
30 |
}
|
31 |
else {
|
32 |
$value = '';
|
@@ -324,7 +324,7 @@ class WDW_FFWD_Library {
|
|
324 |
</div>
|
325 |
<?php if (!$pager) { ?>
|
326 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
|
327 |
-
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ?
|
328 |
<?php
|
329 |
}
|
330 |
}
|
@@ -474,7 +474,7 @@ class WDW_FFWD_Library {
|
|
474 |
</div>
|
475 |
<?php if (!$pager) { ?>
|
476 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
|
477 |
-
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ?
|
478 |
<?php
|
479 |
}
|
480 |
}
|
@@ -482,8 +482,8 @@ class WDW_FFWD_Library {
|
|
482 |
public static function ajax_html_frontend_page_nav($theme_row, $count_items, $page_number, $form_id, $items_per_page, $current_view, $id, $cur_alb_gal_id = 0, $type = 'album', $enable_seo = false, $pagination = 1) {
|
483 |
$limit = $items_per_page;
|
484 |
$limit = $limit ? $limit : 1;
|
485 |
-
$type = (isset($_POST['type_' . $current_view]) ?
|
486 |
-
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ?
|
487 |
if ($count_items) {
|
488 |
if ($count_items % $limit) {
|
489 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1;
|
@@ -654,9 +654,9 @@ class WDW_FFWD_Library {
|
|
654 |
|
655 |
|
656 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
657 |
-
$bwg_search = ((isset($_POST['bwg_search_' . $current_view]) &&
|
658 |
-
$type = (isset($_POST['type_' . $current_view]) ?
|
659 |
-
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ?
|
660 |
?>
|
661 |
<style>
|
662 |
.bwg_search_container_1 {
|
@@ -743,9 +743,9 @@ class WDW_FFWD_Library {
|
|
743 |
}
|
744 |
|
745 |
public static function ajax_html_frontend_sort_box($form_id, $current_view, $cur_gal_id, $sort_by = '', $search_box_width = 180) {
|
746 |
-
$bwg_search = ((isset($_POST['bwg_search_' . $current_view]) &&
|
747 |
-
$type = (isset($_POST['type_' . $current_view]) ?
|
748 |
-
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ?
|
749 |
?>
|
750 |
<style>
|
751 |
.bwg_order_cont_<?php echo $current_view; ?> {
|
@@ -828,10 +828,10 @@ class WDW_FFWD_Library {
|
|
828 |
|
829 |
public static function verify_nonce($page){
|
830 |
$nonce_verified = false;
|
831 |
-
if ( isset( $_GET['ffwd_nonce'] ) && wp_verify_nonce( $_GET['ffwd_nonce'], $page )) {
|
832 |
$nonce_verified = true;
|
833 |
}
|
834 |
-
elseif ( isset( $_POST['ffwd_nonce'] ) && wp_verify_nonce( $_POST['ffwd_nonce'], $page )) {
|
835 |
$nonce_verified = true;
|
836 |
}
|
837 |
return $nonce_verified;
|
@@ -840,7 +840,7 @@ class WDW_FFWD_Library {
|
|
840 |
public static function filter_params($params) {
|
841 |
global $wpdb;
|
842 |
$fb_id = isset($params['fb_id']) ? $params['fb_id'] : 0;
|
843 |
-
$from = (isset($params['from']) ?
|
844 |
$ffwd_info = $wpdb->get_row($wpdb->prepare("SELECT content_type,content FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $fb_id));
|
845 |
if($ffwd_info)
|
846 |
switch($ffwd_info->content_type) {
|
23 |
////////////////////////////////////////////////////////////////////////////////////////
|
24 |
public static function get($key, $default_value = '') {
|
25 |
if (isset($_GET[$key])) {
|
26 |
+
$value = sanitize_text_field($_GET[$key]);
|
27 |
}
|
28 |
elseif (isset($_POST[$key])) {
|
29 |
+
$value = sanitize_text_field($_POST[$key]);
|
30 |
}
|
31 |
else {
|
32 |
$value = '';
|
324 |
</div>
|
325 |
<?php if (!$pager) { ?>
|
326 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
|
327 |
+
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
|
328 |
<?php
|
329 |
}
|
330 |
}
|
474 |
</div>
|
475 |
<?php if (!$pager) { ?>
|
476 |
<input type="hidden" id="page_number" name="page_number" value="<?php echo ((isset($_POST['page_number'])) ? (int) $_POST['page_number'] : 1); ?>" />
|
477 |
+
<input type="hidden" id="search_or_not" name="search_or_not" value="<?php echo ((isset($_POST['search_or_not'])) ? sanitize_text_field($_POST['search_or_not']) : ''); ?>"/>
|
478 |
<?php
|
479 |
}
|
480 |
}
|
482 |
public static function ajax_html_frontend_page_nav($theme_row, $count_items, $page_number, $form_id, $items_per_page, $current_view, $id, $cur_alb_gal_id = 0, $type = 'album', $enable_seo = false, $pagination = 1) {
|
483 |
$limit = $items_per_page;
|
484 |
$limit = $limit ? $limit : 1;
|
485 |
+
$type = (isset($_POST['type_' . $current_view]) ? sanitize_text_field($_POST['type_' . $current_view]) : $type);
|
486 |
+
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ? sanitize_text_field($_POST['album_gallery_id_' . $current_view]) : $cur_alb_gal_id);
|
487 |
if ($count_items) {
|
488 |
if ($count_items % $limit) {
|
489 |
$items_county = ($count_items - $count_items % $limit) / $limit + 1;
|
654 |
|
655 |
|
656 |
public static function ajax_html_frontend_search_box($form_id, $current_view, $cur_gal_id, $images_count, $search_box_width = 180) {
|
657 |
+
$bwg_search = ((isset($_POST['bwg_search_' . $current_view]) && sanitize_text_field($_POST['bwg_search_' . $current_view]) != '') ? sanitize_text_field($_POST['bwg_search_' . $current_view]) : '');
|
658 |
+
$type = (isset($_POST['type_' . $current_view]) ? sanitize_text_field($_POST['type_' . $current_view]) : 'album');
|
659 |
+
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ? sanitize_text_field($_POST['album_gallery_id_' . $current_view]) : 0);
|
660 |
?>
|
661 |
<style>
|
662 |
.bwg_search_container_1 {
|
743 |
}
|
744 |
|
745 |
public static function ajax_html_frontend_sort_box($form_id, $current_view, $cur_gal_id, $sort_by = '', $search_box_width = 180) {
|
746 |
+
$bwg_search = ((isset($_POST['bwg_search_' . $current_view]) && sanitize_text_field($_POST['bwg_search_' . $current_view]) != '') ? sanitize_text_field($_POST['bwg_search_' . $current_view]) : '');
|
747 |
+
$type = (isset($_POST['type_' . $current_view]) ? sanitize_text_field($_POST['type_' . $current_view]) : 'album');
|
748 |
+
$album_gallery_id = (isset($_POST['album_gallery_id_' . $current_view]) ? sanitize_text_field($_POST['album_gallery_id_' . $current_view]) : 0);
|
749 |
?>
|
750 |
<style>
|
751 |
.bwg_order_cont_<?php echo $current_view; ?> {
|
828 |
|
829 |
public static function verify_nonce($page){
|
830 |
$nonce_verified = false;
|
831 |
+
if ( isset( $_GET['ffwd_nonce'] ) && wp_verify_nonce( sanitize_text_field($_GET['ffwd_nonce']), $page )) {
|
832 |
$nonce_verified = true;
|
833 |
}
|
834 |
+
elseif ( isset( $_POST['ffwd_nonce'] ) && wp_verify_nonce( sanitize_text_field($_POST['ffwd_nonce']), $page )) {
|
835 |
$nonce_verified = true;
|
836 |
}
|
837 |
return $nonce_verified;
|
840 |
public static function filter_params($params) {
|
841 |
global $wpdb;
|
842 |
$fb_id = isset($params['fb_id']) ? $params['fb_id'] : 0;
|
843 |
+
$from = (isset($params['from']) ? sanitize_text_field($params['from']) : 0);
|
844 |
$ffwd_info = $wpdb->get_row($wpdb->prepare("SELECT content_type,content FROM " . $wpdb->prefix . "wd_fb_info WHERE id='%d'", $fb_id));
|
845 |
if($ffwd_info)
|
846 |
switch($ffwd_info->content_type) {
|
framework/facebook-sdk/base_facebook.php
CHANGED
@@ -488,7 +488,7 @@ abstract class BaseFacebook
|
|
488 |
*/
|
489 |
public function getSignedRequest() {
|
490 |
if (!$this->signedRequest) {
|
491 |
-
if (!empty($_REQUEST['signed_request'])) {
|
492 |
$this->signedRequest = $this->parseSignedRequest(
|
493 |
$_REQUEST['signed_request']);
|
494 |
} else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
|
488 |
*/
|
489 |
public function getSignedRequest() {
|
490 |
if (!$this->signedRequest) {
|
491 |
+
if (isset($_REQUEST['signed_request']) && !empty($_REQUEST['signed_request'])) {
|
492 |
$this->signedRequest = $this->parseSignedRequest(
|
493 |
$_REQUEST['signed_request']);
|
494 |
} else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
|
frontend/controllers/FFWDControllerPopupBox.php
CHANGED
@@ -19,7 +19,7 @@ class FFWDControllerPopupBox {
|
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
-
$ajax_task = (isset($_POST['ajax_task']) ?
|
23 |
if (method_exists($this, $ajax_task)) {
|
24 |
$this->$ajax_task();
|
25 |
}
|
19 |
// Public Methods //
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function execute() {
|
22 |
+
$ajax_task = (isset($_POST['ajax_task']) ? sanitize_text_field($_POST['ajax_task']) : '');
|
23 |
if (method_exists($this, $ajax_task)) {
|
24 |
$this->$ajax_task();
|
25 |
}
|
frontend/models/FFWDModelAlbum_compact.php
CHANGED
@@ -20,7 +20,7 @@ class FFWDModelAlbum_compact extends FFWDModelMain {
|
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ', $pagination_type) {
|
22 |
global $wpdb;
|
23 |
-
$album_id = (isset($_REQUEST['album_id_' . $ffwd]) ?
|
24 |
if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
|
25 |
$limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
|
26 |
}
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ', $pagination_type) {
|
22 |
global $wpdb;
|
23 |
+
$album_id = (isset($_REQUEST['album_id_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_id_' . $ffwd]) : 0);
|
24 |
if (isset($_REQUEST['page_number_' . $ffwd]) && $_REQUEST['page_number_' . $ffwd]) {
|
25 |
$limit = ((int) $_REQUEST['page_number_' . $ffwd] - 1) * $objects_per_page;
|
26 |
}
|
frontend/models/FFWDModelPopupBox.php
CHANGED
@@ -240,7 +240,7 @@ class FFWDModelPopupBox {
|
|
240 |
}
|
241 |
|
242 |
public function ffwd_story($story, $place) {
|
243 |
-
$enable_place_name = (isset($_GET['enable_place_name']) ?
|
244 |
//$enable_author = (isset($_GET['enable_author']) ? esc_html($_GET['enable_author']) : 0);
|
245 |
$story = str_replace($this->page_user_group['name'], "", $story);
|
246 |
$place = json_decode($place);
|
240 |
}
|
241 |
|
242 |
public function ffwd_story($story, $place) {
|
243 |
+
$enable_place_name = (isset($_GET['enable_place_name']) ? sanitize_text_field($_GET['enable_place_name']) : 0);
|
244 |
//$enable_author = (isset($_GET['enable_author']) ? esc_html($_GET['enable_author']) : 0);
|
245 |
$story = str_replace($this->page_user_group['name'], "", $story);
|
246 |
$place = json_decode($place);
|
frontend/models/FFWDModelThumbnails_masonry.php
CHANGED
@@ -20,7 +20,7 @@ class FFWDModelThumbnails_masonry extends FFWDModelMain {
|
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ') {
|
22 |
global $wpdb;
|
23 |
-
$bwg_search = ((isset($_POST['bwg_search_' . $ffwd]) &&
|
24 |
if ($bwg_search != '') {
|
25 |
$where = 'AND alt LIKE "%%' . $bwg_search . '%%"';
|
26 |
}
|
20 |
////////////////////////////////////////////////////////////////////////////////////////
|
21 |
public function get_ffwd_data($id, $objects_per_page, $sort_by, $ffwd, $sort_direction = ' ASC ') {
|
22 |
global $wpdb;
|
23 |
+
$bwg_search = ((isset($_POST['bwg_search_' . $ffwd]) && sanitize_text_field($_POST['bwg_search_' . $ffwd]) != '') ? sanitize_text_field($_POST['bwg_search_' . $ffwd]) : '');
|
24 |
if ($bwg_search != '') {
|
25 |
$where = 'AND alt LIKE "%%' . $bwg_search . '%%"';
|
26 |
}
|
frontend/views/FFWDViewAlbum_compact.php
CHANGED
@@ -28,7 +28,7 @@ class FFWDViewAlbum_compact {
|
|
28 |
require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
|
29 |
//$options_row = $this->model->get_ffwd_options();
|
30 |
$from = (isset($ffwd_info['from']) ? esc_html($ffwd_info['from']) : 0);
|
31 |
-
$type = (isset($_REQUEST['type_' . $ffwd]) ?
|
32 |
// $bwg_search = ((isset($_POST['bwg_search_' . $ffwd]) && esc_html($_POST['bwg_search_' . $ffwd]) != '') ? esc_html($_POST['bwg_search_' . $ffwd]) : '');
|
33 |
$sort_direction = ' ASC ';
|
34 |
|
@@ -60,7 +60,7 @@ class FFWDViewAlbum_compact {
|
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
-
$album_id = (isset($_REQUEST['album_id_' . $ffwd]) ?
|
64 |
if ($type == 'gallery') {
|
65 |
$items_col_num = $ffwd_info['album_image_max_columns'];
|
66 |
$album_gallery_div_id = 'ffwd_album_compact_' . $ffwd;
|
@@ -82,8 +82,8 @@ class FFWDViewAlbum_compact {
|
|
82 |
$form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->album_compact_thumb_align . '; width:100%;';
|
83 |
|
84 |
}
|
85 |
-
$ffwd_previous_album_id = (isset($_REQUEST['ffwd_previous_album_id_' . $ffwd]) ?
|
86 |
-
$album_page_number_ = (isset($_REQUEST['album_page_number_' . $ffwd]) ?
|
87 |
|
88 |
$rgb_page_nav_font_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->page_nav_font_color);
|
89 |
$rgb_album_compact_thumbs_bg_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->album_compact_thumbs_bg_color);
|
28 |
require_once(WD_FFWD_DIR . '/framework/WDW_FFWD_Library.php');
|
29 |
//$options_row = $this->model->get_ffwd_options();
|
30 |
$from = (isset($ffwd_info['from']) ? esc_html($ffwd_info['from']) : 0);
|
31 |
+
$type = (isset($_REQUEST['type_' . $ffwd]) ? sanitize_text_field($_REQUEST['type_' . $ffwd]) : (isset($ffwd_info['type']) ? $ffwd_info['type'] : 'albums'));
|
32 |
// $bwg_search = ((isset($_POST['bwg_search_' . $ffwd]) && esc_html($_POST['bwg_search_' . $ffwd]) != '') ? esc_html($_POST['bwg_search_' . $ffwd]) : '');
|
33 |
$sort_direction = ' ASC ';
|
34 |
|
60 |
return;
|
61 |
}
|
62 |
|
63 |
+
$album_id = (isset($_REQUEST['album_id_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_id_' . $ffwd]) : 0);
|
64 |
if ($type == 'gallery') {
|
65 |
$items_col_num = $ffwd_info['album_image_max_columns'];
|
66 |
$album_gallery_div_id = 'ffwd_album_compact_' . $ffwd;
|
82 |
$form_child_div_style = 'background-color:rgba(0, 0, 0, 0); position:relative; text-align:' . $theme_row->album_compact_thumb_align . '; width:100%;';
|
83 |
|
84 |
}
|
85 |
+
$ffwd_previous_album_id = (isset($_REQUEST['ffwd_previous_album_id_' . $ffwd]) ? sanitize_text_field($_REQUEST['ffwd_previous_album_id_' . $ffwd]) : 0);
|
86 |
+
$album_page_number_ = (isset($_REQUEST['album_page_number_' . $ffwd]) ? sanitize_text_field($_REQUEST['album_page_number_' . $ffwd]) : 0);
|
87 |
|
88 |
$rgb_page_nav_font_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->page_nav_font_color);
|
89 |
$rgb_album_compact_thumbs_bg_color = WDW_FFWD_Library::spider_hex2rgb($theme_row->album_compact_thumbs_bg_color);
|
frontend/views/FFWDViewBlog_style.php
CHANGED
@@ -1133,7 +1133,7 @@ class FFWDViewBlog_style {
|
|
1133 |
<div class="blog_style_objects_cont_<?php echo $ffwd; ?>" id="ffwd_standart_objcets_cont_<?php echo $ffwd; ?>" >
|
1134 |
<?php
|
1135 |
foreach ($ffwd_data as $ffwd_data_row) {
|
1136 |
-
$ffwd_info_array['image_id'] = (isset($_POST['image_id']) ?
|
1137 |
$link = ($ffwd_data_row->type != 'events') ? $ffwd_data_row->link : 'https://facebook.com/events/' . $ffwd_data_row->object_id;
|
1138 |
?>
|
1139 |
<div class="blog_style_object_container_<?php echo $ffwd; ?>">
|
1133 |
<div class="blog_style_objects_cont_<?php echo $ffwd; ?>" id="ffwd_standart_objcets_cont_<?php echo $ffwd; ?>" >
|
1134 |
<?php
|
1135 |
foreach ($ffwd_data as $ffwd_data_row) {
|
1136 |
+
$ffwd_info_array['image_id'] = (isset($_POST['image_id']) ? sanitize_text_field($_POST['image_id']) : $ffwd_data_row->id);
|
1137 |
$link = ($ffwd_data_row->type != 'events') ? $ffwd_data_row->link : 'https://facebook.com/events/' . $ffwd_data_row->object_id;
|
1138 |
?>
|
1139 |
<div class="blog_style_object_container_<?php echo $ffwd; ?>">
|
frontend/views/FFWDViewPopupBox.php
CHANGED
@@ -26,33 +26,33 @@ class FFWDViewPopupBox {
|
|
26 |
public function display() {
|
27 |
global $wp;
|
28 |
require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
|
29 |
-
$current_url = (isset($_GET['current_url']) ? add_query_arg(
|
30 |
-
$tag_id = (isset($_GET['tag_id']) ?
|
31 |
-
$fb_id = (isset($_GET['fb_id']) ?
|
32 |
-
$ffwd = (isset($_GET['current_view']) ?
|
33 |
-
$current_image_id = (isset($_GET['image_id']) ?
|
34 |
$ffwd_album = (isset($_GET['ffwd_album']) ? stripslashes($_GET['ffwd_album']) : 0);
|
35 |
$from_album = (isset($ffwd_album) && $ffwd_album !== 0) ? 1 : 0;
|
36 |
//print_r(json_decode($ffwd_album));
|
37 |
//die();
|
38 |
-
$content_type = (isset($_GET['content_type']) ?
|
39 |
-
$theme_id = (isset($_GET['theme_id']) ?
|
40 |
-
$thumb_width = (isset($_GET['thumb_width']) ?
|
41 |
-
$thumb_height = (isset($_GET['thumb_height']) ?
|
42 |
-
$open_with_fullscreen = (isset($_GET['open_with_fullscreen']) ?
|
43 |
-
$open_with_autoplay = (isset($_GET['open_with_autoplay']) ?
|
44 |
-
$image_width = (isset($_GET['image_width']) ?
|
45 |
-
$image_height = (isset($_GET['image_height']) ?
|
46 |
-
$image_effect = ((isset($_GET['image_effect']) &&
|
47 |
-
$sort_by = (isset($_GET['wd_sor']) ?
|
48 |
-
$order_by = (isset($_GET['wd_ord']) ?
|
49 |
-
$enable_image_filmstrip = (isset($_GET['enable_image_filmstrip']) ?
|
50 |
-
|
51 |
-
|
52 |
-
$enable_image_fullscreen = (isset($_GET['enable_image_fullscreen']) ?
|
53 |
-
$enable_object_info = (isset($_GET['enable_object_info']) ?
|
54 |
if ($enable_image_filmstrip) {
|
55 |
-
$image_filmstrip_height = (isset($_GET['image_filmstrip_height']) ?
|
56 |
$thumb_ratio = $thumb_width / $thumb_height;
|
57 |
$image_filmstrip_width = round($thumb_ratio * $image_filmstrip_height);
|
58 |
}
|
@@ -61,20 +61,20 @@ class FFWDViewPopupBox {
|
|
61 |
$image_filmstrip_width = 0;
|
62 |
}
|
63 |
$slideshow_interval = (isset($_GET['slideshow_interval']) ? (int) $_GET['slideshow_interval'] : 5);
|
64 |
-
$enable_image_ctrl_btn = (isset($_GET['enable_image_ctrl_btn']) ?
|
65 |
-
$enable_comments = (isset($_GET['enable_comments']) ?
|
66 |
-
|
67 |
-
$enable_likes = (isset($_GET['enable_likes']) ?
|
68 |
-
$enable_shares = (isset($_GET['enable_shares']) ?
|
69 |
-
$enable_author = (isset($_GET['enable_author']) ?
|
70 |
-
$enable_name = (isset($_GET['enable_name']) ?
|
71 |
-
$enable_place_name = (isset($_GET['enable_place_name']) ?
|
72 |
-
$enable_message_desc = (isset($_GET['enable_message_desc']) ?
|
73 |
-
$enable_image_facebook = (isset($_GET['enable_image_facebook']) ?
|
74 |
-
$enable_image_twitter = (isset($_GET['enable_image_twitter']) ?
|
75 |
-
$enable_image_google = (isset($_GET['enable_image_google']) ?
|
76 |
-
$enable_image_pinterest = (isset($_GET['enable_image_pinterest']) ?
|
77 |
-
$enable_image_tumblr = (isset($_GET['enable_image_tumblr']) ?
|
78 |
|
79 |
$theme_row = $this->model->get_theme_row_data($theme_id);
|
80 |
$option_row = $this->model->get_option_row_data();
|
@@ -111,12 +111,12 @@ class FFWDViewPopupBox {
|
|
111 |
}
|
112 |
if ($enable_image_filmstrip) {
|
113 |
if ($filmstrip_direction == 'horizontal') {
|
114 |
-
$image_filmstrip_height = (isset($_GET['image_filmstrip_height']) ?
|
115 |
$thumb_ratio = $thumb_width / $thumb_height;
|
116 |
$image_filmstrip_width = round($thumb_ratio * $image_filmstrip_height);
|
117 |
}
|
118 |
else {
|
119 |
-
$image_filmstrip_width = (isset($_GET['image_filmstrip_height']) ?
|
120 |
$thumb_ratio = $thumb_height / $thumb_width;
|
121 |
$image_filmstrip_height = round($thumb_ratio * $image_filmstrip_width);
|
122 |
}
|
26 |
public function display() {
|
27 |
global $wp;
|
28 |
require_once(WD_FFWD_DIR . '/framework/WDFacebookFeed.php');
|
29 |
+
$current_url = (isset($_GET['current_url']) ? add_query_arg(sanitize_text_field($_GET['current_url']), '', home_url($wp->request)) : '');
|
30 |
+
$tag_id = (isset($_GET['tag_id']) ? sanitize_text_field($_GET['tag_id']) : 0);
|
31 |
+
$fb_id = (isset($_GET['fb_id']) ? sanitize_text_field($_GET['fb_id']) : 0);
|
32 |
+
$ffwd = (isset($_GET['current_view']) ? sanitize_text_field($_GET['current_view']) : 0);
|
33 |
+
$current_image_id = (isset($_GET['image_id']) ? sanitize_text_field($_GET['image_id']) : 0);
|
34 |
$ffwd_album = (isset($_GET['ffwd_album']) ? stripslashes($_GET['ffwd_album']) : 0);
|
35 |
$from_album = (isset($ffwd_album) && $ffwd_album !== 0) ? 1 : 0;
|
36 |
//print_r(json_decode($ffwd_album));
|
37 |
//die();
|
38 |
+
$content_type = (isset($_GET['content_type']) ? sanitize_text_field($_GET['content_type']) : 'specific');
|
39 |
+
$theme_id = (isset($_GET['theme_id']) ? sanitize_text_field($_GET['theme_id']) : 1);
|
40 |
+
$thumb_width = (isset($_GET['thumb_width']) ? sanitize_text_field($_GET['thumb_width']) : 120);
|
41 |
+
$thumb_height = (isset($_GET['thumb_height']) ? sanitize_text_field($_GET['thumb_height']) : 90);
|
42 |
+
$open_with_fullscreen = (isset($_GET['open_with_fullscreen']) ? sanitize_text_field($_GET['open_with_fullscreen']) : 0);
|
43 |
+
$open_with_autoplay = (isset($_GET['open_with_autoplay']) ? sanitize_text_field($_GET['open_with_autoplay']) : 0);
|
44 |
+
$image_width = (isset($_GET['image_width']) ? sanitize_text_field($_GET['image_width']) : 800);
|
45 |
+
$image_height = (isset($_GET['image_height']) ? sanitize_text_field($_GET['image_height']) : 500);
|
46 |
+
$image_effect = ((isset($_GET['image_effect']) && sanitize_text_field($_GET['image_effect'])) ? sanitize_text_field($_GET['image_effect']) : 'fade');
|
47 |
+
$sort_by = (isset($_GET['wd_sor']) ? sanitize_text_field($_GET['wd_sor']) : 'order');
|
48 |
+
$order_by = (isset($_GET['wd_ord']) ? sanitize_text_field($_GET['wd_ord']) : 'asc');
|
49 |
+
$enable_image_filmstrip = (isset($_GET['enable_image_filmstrip']) ? sanitize_text_field($_GET['enable_image_filmstrip']) : 0);
|
50 |
+
|
51 |
+
|
52 |
+
$enable_image_fullscreen = (isset($_GET['enable_image_fullscreen']) ? sanitize_text_field($_GET['enable_image_fullscreen']) : 0);
|
53 |
+
$enable_object_info = (isset($_GET['enable_object_info']) ? sanitize_text_field($_GET['enable_object_info']) : 0);
|
54 |
if ($enable_image_filmstrip) {
|
55 |
+
$image_filmstrip_height = (isset($_GET['image_filmstrip_height']) ? sanitize_text_field($_GET['image_filmstrip_height']) : '20');
|
56 |
$thumb_ratio = $thumb_width / $thumb_height;
|
57 |
$image_filmstrip_width = round($thumb_ratio * $image_filmstrip_height);
|
58 |
}
|
61 |
$image_filmstrip_width = 0;
|
62 |
}
|
63 |
$slideshow_interval = (isset($_GET['slideshow_interval']) ? (int) $_GET['slideshow_interval'] : 5);
|
64 |
+
$enable_image_ctrl_btn = (isset($_GET['enable_image_ctrl_btn']) ? sanitize_text_field($_GET['enable_image_ctrl_btn']) : 0);
|
65 |
+
$enable_comments = (isset($_GET['enable_comments']) ? sanitize_text_field($_GET['enable_comments']) : 0);
|
66 |
+
|
67 |
+
$enable_likes = (isset($_GET['enable_likes']) ? sanitize_text_field($_GET['enable_likes']) : 0);
|
68 |
+
$enable_shares = (isset($_GET['enable_shares']) ? sanitize_text_field($_GET['enable_shares']) : 0);
|
69 |
+
$enable_author = (isset($_GET['enable_author']) ? sanitize_text_field($_GET['enable_author']) : 0);
|
70 |
+
$enable_name = (isset($_GET['enable_name']) ? sanitize_text_field($_GET['enable_name']) : 0);
|
71 |
+
$enable_place_name = (isset($_GET['enable_place_name']) ? sanitize_text_field($_GET['enable_place_name']) : 0);
|
72 |
+
$enable_message_desc = (isset($_GET['enable_message_desc']) ? sanitize_text_field($_GET['enable_message_desc']) : 0);
|
73 |
+
$enable_image_facebook = (isset($_GET['enable_image_facebook']) ? sanitize_text_field($_GET['enable_image_facebook']) : 0);
|
74 |
+
$enable_image_twitter = (isset($_GET['enable_image_twitter']) ? sanitize_text_field($_GET['enable_image_twitter']) : 0);
|
75 |
+
$enable_image_google = (isset($_GET['enable_image_google']) ? sanitize_text_field($_GET['enable_image_google']) : 0);
|
76 |
+
$enable_image_pinterest = (isset($_GET['enable_image_pinterest']) ? sanitize_text_field($_GET['enable_image_pinterest']) : 0);
|
77 |
+
$enable_image_tumblr = (isset($_GET['enable_image_tumblr']) ? sanitize_text_field($_GET['enable_image_tumblr']) : 0);
|
78 |
|
79 |
$theme_row = $this->model->get_theme_row_data($theme_id);
|
80 |
$option_row = $this->model->get_option_row_data();
|
111 |
}
|
112 |
if ($enable_image_filmstrip) {
|
113 |
if ($filmstrip_direction == 'horizontal') {
|
114 |
+
$image_filmstrip_height = (isset($_GET['image_filmstrip_height']) ? sanitize_text_field($_GET['image_filmstrip_height']) : '20');
|
115 |
$thumb_ratio = $thumb_width / $thumb_height;
|
116 |
$image_filmstrip_width = round($thumb_ratio * $image_filmstrip_height);
|
117 |
}
|
118 |
else {
|
119 |
+
$image_filmstrip_width = (isset($_GET['image_filmstrip_height']) ? sanitize_text_field($_GET['image_filmstrip_height']) : '50');
|
120 |
$thumb_ratio = $thumb_height / $thumb_width;
|
121 |
$image_filmstrip_height = round($thumb_ratio * $image_filmstrip_width);
|
122 |
}
|
js/jquery.form.js
ADDED
@@ -0,0 +1,1277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery Form Plugin
|
3 |
+
* version: 3.51.0-2014.06.20
|
4 |
+
* Requires jQuery v1.5 or later
|
5 |
+
* Copyright (c) 2014 M. Alsup
|
6 |
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7 |
+
* Project repository: https://github.com/malsup/form
|
8 |
+
* Dual licensed under the MIT and GPL licenses.
|
9 |
+
* https://github.com/malsup/form#copyright-and-license
|
10 |
+
*/
|
11 |
+
/*global ActiveXObject */
|
12 |
+
|
13 |
+
// AMD support
|
14 |
+
(function (factory) {
|
15 |
+
"use strict";
|
16 |
+
if (typeof define === 'function' && define.amd) {
|
17 |
+
// using AMD; register as anon module
|
18 |
+
define(['jquery'], factory);
|
19 |
+
} else {
|
20 |
+
// no AMD; invoke directly
|
21 |
+
factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
(function($) {
|
26 |
+
"use strict";
|
27 |
+
|
28 |
+
/*
|
29 |
+
Usage Note:
|
30 |
+
-----------
|
31 |
+
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
32 |
+
functions are mutually exclusive. Use ajaxSubmit if you want
|
33 |
+
to bind your own submit handler to the form. For example,
|
34 |
+
|
35 |
+
$(document).ready(function() {
|
36 |
+
$('#myForm').on('submit', function(e) {
|
37 |
+
e.preventDefault(); // <-- important
|
38 |
+
$(this).ajaxSubmit({
|
39 |
+
target: '#output'
|
40 |
+
});
|
41 |
+
});
|
42 |
+
});
|
43 |
+
|
44 |
+
Use ajaxForm when you want the plugin to manage all the event binding
|
45 |
+
for you. For example,
|
46 |
+
|
47 |
+
$(document).ready(function() {
|
48 |
+
$('#myForm').ajaxForm({
|
49 |
+
target: '#output'
|
50 |
+
});
|
51 |
+
});
|
52 |
+
|
53 |
+
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
|
54 |
+
form does not have to exist when you invoke ajaxForm:
|
55 |
+
|
56 |
+
$('#myForm').ajaxForm({
|
57 |
+
delegation: true,
|
58 |
+
target: '#output'
|
59 |
+
});
|
60 |
+
|
61 |
+
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
62 |
+
at the appropriate time.
|
63 |
+
*/
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Feature detection
|
67 |
+
*/
|
68 |
+
var feature = {};
|
69 |
+
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
70 |
+
feature.formdata = window.FormData !== undefined;
|
71 |
+
|
72 |
+
var hasProp = !!$.fn.prop;
|
73 |
+
|
74 |
+
// attr2 uses prop when it can but checks the return type for
|
75 |
+
// an expected string. this accounts for the case where a form
|
76 |
+
// contains inputs with names like "action" or "method"; in those
|
77 |
+
// cases "prop" returns the element
|
78 |
+
$.fn.attr2 = function() {
|
79 |
+
if ( ! hasProp ) {
|
80 |
+
return this.attr.apply(this, arguments);
|
81 |
+
}
|
82 |
+
var val = this.prop.apply(this, arguments);
|
83 |
+
if ( ( val && val.jquery ) || typeof val === 'string' ) {
|
84 |
+
return val;
|
85 |
+
}
|
86 |
+
return this.attr.apply(this, arguments);
|
87 |
+
};
|
88 |
+
|
89 |
+
/**
|
90 |
+
* ajaxSubmit() provides a mechanism for immediately submitting
|
91 |
+
* an HTML form using AJAX.
|
92 |
+
*/
|
93 |
+
$.fn.ajaxSubmit = function(options) {
|
94 |
+
/*jshint scripturl:true */
|
95 |
+
|
96 |
+
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
97 |
+
if (!this.length) {
|
98 |
+
log('ajaxSubmit: skipping submit process - no element selected');
|
99 |
+
return this;
|
100 |
+
}
|
101 |
+
|
102 |
+
var method, action, url, $form = this;
|
103 |
+
|
104 |
+
if (typeof options == 'function') {
|
105 |
+
options = { success: options };
|
106 |
+
}
|
107 |
+
else if ( options === undefined ) {
|
108 |
+
options = {};
|
109 |
+
}
|
110 |
+
|
111 |
+
method = options.type || this.attr2('method');
|
112 |
+
action = options.url || this.attr2('action');
|
113 |
+
|
114 |
+
url = (typeof action === 'string') ? $.trim(action) : '';
|
115 |
+
url = url || window.location.href || '';
|
116 |
+
if (url) {
|
117 |
+
// clean url (don't include hash vaue)
|
118 |
+
url = (url.match(/^([^#]+)/)||[])[1];
|
119 |
+
}
|
120 |
+
|
121 |
+
options = $.extend(true, {
|
122 |
+
url: url,
|
123 |
+
success: $.ajaxSettings.success,
|
124 |
+
type: method || $.ajaxSettings.type,
|
125 |
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
126 |
+
}, options);
|
127 |
+
|
128 |
+
// hook for manipulating the form data before it is extracted;
|
129 |
+
// convenient for use with rich editors like tinyMCE or FCKEditor
|
130 |
+
var veto = {};
|
131 |
+
this.trigger('form-pre-serialize', [this, options, veto]);
|
132 |
+
if (veto.veto) {
|
133 |
+
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
134 |
+
return this;
|
135 |
+
}
|
136 |
+
|
137 |
+
// provide opportunity to alter form data before it is serialized
|
138 |
+
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
139 |
+
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
140 |
+
return this;
|
141 |
+
}
|
142 |
+
|
143 |
+
var traditional = options.traditional;
|
144 |
+
if ( traditional === undefined ) {
|
145 |
+
traditional = $.ajaxSettings.traditional;
|
146 |
+
}
|
147 |
+
|
148 |
+
var elements = [];
|
149 |
+
var qx, a = this.formToArray(options.semantic, elements);
|
150 |
+
if (options.data) {
|
151 |
+
options.extraData = options.data;
|
152 |
+
qx = $.param(options.data, traditional);
|
153 |
+
}
|
154 |
+
|
155 |
+
// give pre-submit callback an opportunity to abort the submit
|
156 |
+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
157 |
+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
158 |
+
return this;
|
159 |
+
}
|
160 |
+
|
161 |
+
// fire vetoable 'validate' event
|
162 |
+
this.trigger('form-submit-validate', [a, this, options, veto]);
|
163 |
+
if (veto.veto) {
|
164 |
+
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
165 |
+
return this;
|
166 |
+
}
|
167 |
+
|
168 |
+
var q = $.param(a, traditional);
|
169 |
+
if (qx) {
|
170 |
+
q = ( q ? (q + '&' + qx) : qx );
|
171 |
+
}
|
172 |
+
if (options.type.toUpperCase() == 'GET') {
|
173 |
+
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
174 |
+
options.data = null; // data is null for 'get'
|
175 |
+
}
|
176 |
+
else {
|
177 |
+
options.data = q; // data is the query string for 'post'
|
178 |
+
}
|
179 |
+
|
180 |
+
var callbacks = [];
|
181 |
+
if (options.resetForm) {
|
182 |
+
callbacks.push(function() { $form.resetForm(); });
|
183 |
+
}
|
184 |
+
if (options.clearForm) {
|
185 |
+
callbacks.push(function() { $form.clearForm(options.includeHidden); });
|
186 |
+
}
|
187 |
+
|
188 |
+
// perform a load on the target only if dataType is not provided
|
189 |
+
if (!options.dataType && options.target) {
|
190 |
+
var oldSuccess = options.success || function(){};
|
191 |
+
callbacks.push(function(data) {
|
192 |
+
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
193 |
+
$(options.target)[fn](data).each(oldSuccess, arguments);
|
194 |
+
});
|
195 |
+
}
|
196 |
+
else if (options.success) {
|
197 |
+
callbacks.push(options.success);
|
198 |
+
}
|
199 |
+
|
200 |
+
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
201 |
+
var context = options.context || this ; // jQuery 1.4+ supports scope context
|
202 |
+
for (var i=0, max=callbacks.length; i < max; i++) {
|
203 |
+
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
204 |
+
}
|
205 |
+
};
|
206 |
+
|
207 |
+
if (options.error) {
|
208 |
+
var oldError = options.error;
|
209 |
+
options.error = function(xhr, status, error) {
|
210 |
+
var context = options.context || this;
|
211 |
+
oldError.apply(context, [xhr, status, error, $form]);
|
212 |
+
};
|
213 |
+
}
|
214 |
+
|
215 |
+
if (options.complete) {
|
216 |
+
var oldComplete = options.complete;
|
217 |
+
options.complete = function(xhr, status) {
|
218 |
+
var context = options.context || this;
|
219 |
+
oldComplete.apply(context, [xhr, status, $form]);
|
220 |
+
};
|
221 |
+
}
|
222 |
+
|
223 |
+
// are there files to upload?
|
224 |
+
|
225 |
+
// [value] (issue #113), also see comment:
|
226 |
+
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
|
227 |
+
var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
|
228 |
+
|
229 |
+
var hasFileInputs = fileInputs.length > 0;
|
230 |
+
var mp = 'multipart/form-data';
|
231 |
+
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
232 |
+
|
233 |
+
var fileAPI = feature.fileapi && feature.formdata;
|
234 |
+
log("fileAPI :" + fileAPI);
|
235 |
+
var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
|
236 |
+
|
237 |
+
var jqxhr;
|
238 |
+
|
239 |
+
// options.iframe allows user to force iframe mode
|
240 |
+
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
241 |
+
if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
|
242 |
+
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
243 |
+
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
244 |
+
if (options.closeKeepAlive) {
|
245 |
+
$.get(options.closeKeepAlive, function() {
|
246 |
+
jqxhr = fileUploadIframe(a);
|
247 |
+
});
|
248 |
+
}
|
249 |
+
else {
|
250 |
+
jqxhr = fileUploadIframe(a);
|
251 |
+
}
|
252 |
+
}
|
253 |
+
else if ((hasFileInputs || multipart) && fileAPI) {
|
254 |
+
jqxhr = fileUploadXhr(a);
|
255 |
+
}
|
256 |
+
else {
|
257 |
+
jqxhr = $.ajax(options);
|
258 |
+
}
|
259 |
+
|
260 |
+
$form.removeData('jqxhr').data('jqxhr', jqxhr);
|
261 |
+
|
262 |
+
// clear element array
|
263 |
+
for (var k=0; k < elements.length; k++) {
|
264 |
+
elements[k] = null;
|
265 |
+
}
|
266 |
+
|
267 |
+
// fire 'notify' event
|
268 |
+
this.trigger('form-submit-notify', [this, options]);
|
269 |
+
return this;
|
270 |
+
|
271 |
+
// utility fn for deep serialization
|
272 |
+
function deepSerialize(extraData){
|
273 |
+
var serialized = $.param(extraData, options.traditional).split('&');
|
274 |
+
var len = serialized.length;
|
275 |
+
var result = [];
|
276 |
+
var i, part;
|
277 |
+
for (i=0; i < len; i++) {
|
278 |
+
// #252; undo param space replacement
|
279 |
+
serialized[i] = serialized[i].replace(/\+/g,' ');
|
280 |
+
part = serialized[i].split('=');
|
281 |
+
// #278; use array instead of object storage, favoring array serializations
|
282 |
+
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
|
283 |
+
}
|
284 |
+
return result;
|
285 |
+
}
|
286 |
+
|
287 |
+
// XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
|
288 |
+
function fileUploadXhr(a) {
|
289 |
+
var formdata = new FormData();
|
290 |
+
|
291 |
+
for (var i=0; i < a.length; i++) {
|
292 |
+
formdata.append(a[i].name, a[i].value);
|
293 |
+
}
|
294 |
+
|
295 |
+
if (options.extraData) {
|
296 |
+
var serializedData = deepSerialize(options.extraData);
|
297 |
+
for (i=0; i < serializedData.length; i++) {
|
298 |
+
if (serializedData[i]) {
|
299 |
+
formdata.append(serializedData[i][0], serializedData[i][1]);
|
300 |
+
}
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
options.data = null;
|
305 |
+
|
306 |
+
var s = $.extend(true, {}, $.ajaxSettings, options, {
|
307 |
+
contentType: false,
|
308 |
+
processData: false,
|
309 |
+
cache: false,
|
310 |
+
type: method || 'POST'
|
311 |
+
});
|
312 |
+
|
313 |
+
if (options.uploadProgress) {
|
314 |
+
// workaround because jqXHR does not expose upload property
|
315 |
+
s.xhr = function() {
|
316 |
+
var xhr = $.ajaxSettings.xhr();
|
317 |
+
if (xhr.upload) {
|
318 |
+
xhr.upload.addEventListener('progress', function(event) {
|
319 |
+
var percent = 0;
|
320 |
+
var position = event.loaded || event.position; /*event.position is deprecated*/
|
321 |
+
var total = event.total;
|
322 |
+
if (event.lengthComputable) {
|
323 |
+
percent = Math.ceil(position / total * 100);
|
324 |
+
}
|
325 |
+
options.uploadProgress(event, position, total, percent);
|
326 |
+
}, false);
|
327 |
+
}
|
328 |
+
return xhr;
|
329 |
+
};
|
330 |
+
}
|
331 |
+
|
332 |
+
s.data = null;
|
333 |
+
var beforeSend = s.beforeSend;
|
334 |
+
s.beforeSend = function(xhr, o) {
|
335 |
+
//Send FormData() provided by user
|
336 |
+
if (options.formData) {
|
337 |
+
o.data = options.formData;
|
338 |
+
}
|
339 |
+
else {
|
340 |
+
o.data = formdata;
|
341 |
+
}
|
342 |
+
if(beforeSend) {
|
343 |
+
beforeSend.call(this, xhr, o);
|
344 |
+
}
|
345 |
+
};
|
346 |
+
return $.ajax(s);
|
347 |
+
}
|
348 |
+
|
349 |
+
// private function for handling file uploads (hat tip to YAHOO!)
|
350 |
+
function fileUploadIframe(a) {
|
351 |
+
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
|
352 |
+
var deferred = $.Deferred();
|
353 |
+
|
354 |
+
// #341
|
355 |
+
deferred.abort = function(status) {
|
356 |
+
xhr.abort(status);
|
357 |
+
};
|
358 |
+
|
359 |
+
if (a) {
|
360 |
+
// ensure that every serialized input is still enabled
|
361 |
+
for (i=0; i < elements.length; i++) {
|
362 |
+
el = $(elements[i]);
|
363 |
+
if ( hasProp ) {
|
364 |
+
el.prop('disabled', false);
|
365 |
+
}
|
366 |
+
else {
|
367 |
+
el.removeAttr('disabled');
|
368 |
+
}
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
s = $.extend(true, {}, $.ajaxSettings, options);
|
373 |
+
s.context = s.context || s;
|
374 |
+
id = 'jqFormIO' + (new Date().getTime());
|
375 |
+
if (s.iframeTarget) {
|
376 |
+
$io = $(s.iframeTarget);
|
377 |
+
n = $io.attr2('name');
|
378 |
+
if (!n) {
|
379 |
+
$io.attr2('name', id);
|
380 |
+
}
|
381 |
+
else {
|
382 |
+
id = n;
|
383 |
+
}
|
384 |
+
}
|
385 |
+
else {
|
386 |
+
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
|
387 |
+
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
388 |
+
}
|
389 |
+
io = $io[0];
|
390 |
+
|
391 |
+
|
392 |
+
xhr = { // mock object
|
393 |
+
aborted: 0,
|
394 |
+
responseText: null,
|
395 |
+
responseXML: null,
|
396 |
+
status: 0,
|
397 |
+
statusText: 'n/a',
|
398 |
+
getAllResponseHeaders: function() {},
|
399 |
+
getResponseHeader: function() {},
|
400 |
+
setRequestHeader: function() {},
|
401 |
+
abort: function(status) {
|
402 |
+
var e = (status === 'timeout' ? 'timeout' : 'aborted');
|
403 |
+
log('aborting upload... ' + e);
|
404 |
+
this.aborted = 1;
|
405 |
+
|
406 |
+
try { // #214, #257
|
407 |
+
if (io.contentWindow.document.execCommand) {
|
408 |
+
io.contentWindow.document.execCommand('Stop');
|
409 |
+
}
|
410 |
+
}
|
411 |
+
catch(ignore) {}
|
412 |
+
|
413 |
+
$io.attr('src', s.iframeSrc); // abort op in progress
|
414 |
+
xhr.error = e;
|
415 |
+
if (s.error) {
|
416 |
+
s.error.call(s.context, xhr, e, status);
|
417 |
+
}
|
418 |
+
if (g) {
|
419 |
+
$.event.trigger("ajaxError", [xhr, s, e]);
|
420 |
+
}
|
421 |
+
if (s.complete) {
|
422 |
+
s.complete.call(s.context, xhr, e);
|
423 |
+
}
|
424 |
+
}
|
425 |
+
};
|
426 |
+
|
427 |
+
g = s.global;
|
428 |
+
// trigger ajax global events so that activity/block indicators work like normal
|
429 |
+
if (g && 0 === $.active++) {
|
430 |
+
$.event.trigger("ajaxStart");
|
431 |
+
}
|
432 |
+
if (g) {
|
433 |
+
$.event.trigger("ajaxSend", [xhr, s]);
|
434 |
+
}
|
435 |
+
|
436 |
+
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
437 |
+
if (s.global) {
|
438 |
+
$.active--;
|
439 |
+
}
|
440 |
+
deferred.reject();
|
441 |
+
return deferred;
|
442 |
+
}
|
443 |
+
if (xhr.aborted) {
|
444 |
+
deferred.reject();
|
445 |
+
return deferred;
|
446 |
+
}
|
447 |
+
|
448 |
+
// add submitting element to data if we know it
|
449 |
+
sub = form.clk;
|
450 |
+
if (sub) {
|
451 |
+
n = sub.name;
|
452 |
+
if (n && !sub.disabled) {
|
453 |
+
s.extraData = s.extraData || {};
|
454 |
+
s.extraData[n] = sub.value;
|
455 |
+
if (sub.type == "image") {
|
456 |
+
s.extraData[n+'.x'] = form.clk_x;
|
457 |
+
s.extraData[n+'.y'] = form.clk_y;
|
458 |
+
}
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
+
var CLIENT_TIMEOUT_ABORT = 1;
|
463 |
+
var SERVER_ABORT = 2;
|
464 |
+
|
465 |
+
function getDoc(frame) {
|
466 |
+
/* it looks like contentWindow or contentDocument do not
|
467 |
+
* carry the protocol property in ie8, when running under ssl
|
468 |
+
* frame.document is the only valid response document, since
|
469 |
+
* the protocol is know but not on the other two objects. strange?
|
470 |
+
* "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
|
471 |
+
*/
|
472 |
+
|
473 |
+
var doc = null;
|
474 |
+
|
475 |
+
// IE8 cascading access check
|
476 |
+
try {
|
477 |
+
if (frame.contentWindow) {
|
478 |
+
doc = frame.contentWindow.document;
|
479 |
+
}
|
480 |
+
} catch(err) {
|
481 |
+
// IE8 access denied under ssl & missing protocol
|
482 |
+
log('cannot get iframe.contentWindow document: ' + err);
|
483 |
+
}
|
484 |
+
|
485 |
+
if (doc) { // successful getting content
|
486 |
+
return doc;
|
487 |
+
}
|
488 |
+
|
489 |
+
try { // simply checking may throw in ie8 under ssl or mismatched protocol
|
490 |
+
doc = frame.contentDocument ? frame.contentDocument : frame.document;
|
491 |
+
} catch(err) {
|
492 |
+
// last attempt
|
493 |
+
log('cannot get iframe.contentDocument: ' + err);
|
494 |
+
doc = frame.document;
|
495 |
+
}
|
496 |
+
return doc;
|
497 |
+
}
|
498 |
+
|
499 |
+
// Rails CSRF hack (thanks to Yvan Barthelemy)
|
500 |
+
var csrf_token = $('meta[name=csrf-token]').attr('content');
|
501 |
+
var csrf_param = $('meta[name=csrf-param]').attr('content');
|
502 |
+
if (csrf_param && csrf_token) {
|
503 |
+
s.extraData = s.extraData || {};
|
504 |
+
s.extraData[csrf_param] = csrf_token;
|
505 |
+
}
|
506 |
+
|
507 |
+
// take a breath so that pending repaints get some cpu time before the upload starts
|
508 |
+
function doSubmit() {
|
509 |
+
// make sure form attrs are set
|
510 |
+
var t = $form.attr2('target'),
|
511 |
+
a = $form.attr2('action'),
|
512 |
+
mp = 'multipart/form-data',
|
513 |
+
et = $form.attr('enctype') || $form.attr('encoding') || mp;
|
514 |
+
|
515 |
+
// update form attrs in IE friendly way
|
516 |
+
form.setAttribute('target',id);
|
517 |
+
if (!method || /post/i.test(method) ) {
|
518 |
+
form.setAttribute('method', 'POST');
|
519 |
+
}
|
520 |
+
if (a != s.url) {
|
521 |
+
form.setAttribute('action', s.url);
|
522 |
+
}
|
523 |
+
|
524 |
+
// ie borks in some cases when setting encoding
|
525 |
+
if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
|
526 |
+
$form.attr({
|
527 |
+
encoding: 'multipart/form-data',
|
528 |
+
enctype: 'multipart/form-data'
|
529 |
+
});
|
530 |
+
}
|
531 |
+
|
532 |
+
// support timout
|
533 |
+
if (s.timeout) {
|
534 |
+
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
|
535 |
+
}
|
536 |
+
|
537 |
+
// look for server aborts
|
538 |
+
function checkState() {
|
539 |
+
try {
|
540 |
+
var state = getDoc(io).readyState;
|
541 |
+
log('state = ' + state);
|
542 |
+
if (state && state.toLowerCase() == 'uninitialized') {
|
543 |
+
setTimeout(checkState,50);
|
544 |
+
}
|
545 |
+
}
|
546 |
+
catch(e) {
|
547 |
+
log('Server abort: ' , e, ' (', e.name, ')');
|
548 |
+
cb(SERVER_ABORT);
|
549 |
+
if (timeoutHandle) {
|
550 |
+
clearTimeout(timeoutHandle);
|
551 |
+
}
|
552 |
+
timeoutHandle = undefined;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
// add "extra" data to form if provided in options
|
557 |
+
var extraInputs = [];
|
558 |
+
try {
|
559 |
+
if (s.extraData) {
|
560 |
+
for (var n in s.extraData) {
|
561 |
+
if (s.extraData.hasOwnProperty(n)) {
|
562 |
+
// if using the $.param format that allows for multiple values with the same name
|
563 |
+
if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
|
564 |
+
extraInputs.push(
|
565 |
+
$('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value)
|
566 |
+
.appendTo(form)[0]);
|
567 |
+
} else {
|
568 |
+
extraInputs.push(
|
569 |
+
$('<input type="hidden" name="'+n+'">').val(s.extraData[n])
|
570 |
+
.appendTo(form)[0]);
|
571 |
+
}
|
572 |
+
}
|
573 |
+
}
|
574 |
+
}
|
575 |
+
|
576 |
+
if (!s.iframeTarget) {
|
577 |
+
// add iframe to doc and submit the form
|
578 |
+
$io.appendTo('body');
|
579 |
+
}
|
580 |
+
if (io.attachEvent) {
|
581 |
+
io.attachEvent('onload', cb);
|
582 |
+
}
|
583 |
+
else {
|
584 |
+
io.addEventListener('load', cb, false);
|
585 |
+
}
|
586 |
+
setTimeout(checkState,15);
|
587 |
+
|
588 |
+
try {
|
589 |
+
form.submit();
|
590 |
+
} catch(err) {
|
591 |
+
// just in case form has element with name/id of 'submit'
|
592 |
+
var submitFn = document.createElement('form').submit;
|
593 |
+
submitFn.apply(form);
|
594 |
+
}
|
595 |
+
}
|
596 |
+
finally {
|
597 |
+
// reset attrs and remove "extra" input elements
|
598 |
+
form.setAttribute('action',a);
|
599 |
+
form.setAttribute('enctype', et); // #380
|
600 |
+
if(t) {
|
601 |
+
form.setAttribute('target', t);
|
602 |
+
} else {
|
603 |
+
$form.removeAttr('target');
|
604 |
+
}
|
605 |
+
$(extraInputs).remove();
|
606 |
+
}
|
607 |
+
}
|
608 |
+
|
609 |
+
if (s.forceSync) {
|
610 |
+
doSubmit();
|
611 |
+
}
|
612 |
+
else {
|
613 |
+
setTimeout(doSubmit, 10); // this lets dom updates render
|
614 |
+
}
|
615 |
+
|
616 |
+
var data, doc, domCheckCount = 50, callbackProcessed;
|
617 |
+
|
618 |
+
function cb(e) {
|
619 |
+
if (xhr.aborted || callbackProcessed) {
|
620 |
+
return;
|
621 |
+
}
|
622 |
+
|
623 |
+
doc = getDoc(io);
|
624 |
+
if(!doc) {
|
625 |
+
log('cannot access response document');
|
626 |
+
e = SERVER_ABORT;
|
627 |
+
}
|
628 |
+
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
|
629 |
+
xhr.abort('timeout');
|
630 |
+
deferred.reject(xhr, 'timeout');
|
631 |
+
return;
|
632 |
+
}
|
633 |
+
else if (e == SERVER_ABORT && xhr) {
|
634 |
+
xhr.abort('server abort');
|
635 |
+
deferred.reject(xhr, 'error', 'server abort');
|
636 |
+
return;
|
637 |
+
}
|
638 |
+
|
639 |
+
if (!doc || doc.location.href == s.iframeSrc) {
|
640 |
+
// response not received yet
|
641 |
+
if (!timedOut) {
|
642 |
+
return;
|
643 |
+
}
|
644 |
+
}
|
645 |
+
if (io.detachEvent) {
|
646 |
+
io.detachEvent('onload', cb);
|
647 |
+
}
|
648 |
+
else {
|
649 |
+
io.removeEventListener('load', cb, false);
|
650 |
+
}
|
651 |
+
|
652 |
+
var status = 'success', errMsg;
|
653 |
+
try {
|
654 |
+
if (timedOut) {
|
655 |
+
throw 'timeout';
|
656 |
+
}
|
657 |
+
|
658 |
+
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
659 |
+
log('isXml='+isXml);
|
660 |
+
if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
|
661 |
+
if (--domCheckCount) {
|
662 |
+
// in some browsers (Opera) the iframe DOM is not always traversable when
|
663 |
+
// the onload callback fires, so we loop a bit to accommodate
|
664 |
+
log('requeing onLoad callback, DOM not available');
|
665 |
+
setTimeout(cb, 250);
|
666 |
+
return;
|
667 |
+
}
|
668 |
+
// let this fall through because server response could be an empty document
|
669 |
+
//log('Could not access iframe DOM after mutiple tries.');
|
670 |
+
//throw 'DOMException: not available';
|
671 |
+
}
|
672 |
+
|
673 |
+
//log('response detected');
|
674 |
+
var docRoot = doc.body ? doc.body : doc.documentElement;
|
675 |
+
xhr.responseText = docRoot ? docRoot.innerHTML : null;
|
676 |
+
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
677 |
+
if (isXml) {
|
678 |
+
s.dataType = 'xml';
|
679 |
+
}
|
680 |
+
xhr.getResponseHeader = function(header){
|
681 |
+
var headers = {'content-type': s.dataType};
|
682 |
+
return headers[header.toLowerCase()];
|
683 |
+
};
|
684 |
+
// support for XHR 'status' & 'statusText' emulation :
|
685 |
+
if (docRoot) {
|
686 |
+
xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
|
687 |
+
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
|
688 |
+
}
|
689 |
+
|
690 |
+
var dt = (s.dataType || '').toLowerCase();
|
691 |
+
var scr = /(json|script|text)/.test(dt);
|
692 |
+
if (scr || s.textarea) {
|
693 |
+
// see if user embedded response in textarea
|
694 |
+
var ta = doc.getElementsByTagName('textarea')[0];
|
695 |
+
if (ta) {
|
696 |
+
xhr.responseText = ta.value;
|
697 |
+
// support for XHR 'status' & 'statusText' emulation :
|
698 |
+
xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
|
699 |
+
xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
|
700 |
+
}
|
701 |
+
else if (scr) {
|
702 |
+
// account for browsers injecting pre around json response
|
703 |
+
var pre = doc.getElementsByTagName('pre')[0];
|
704 |
+
var b = doc.getElementsByTagName('body')[0];
|
705 |
+
if (pre) {
|
706 |
+
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
|
707 |
+
}
|
708 |
+
else if (b) {
|
709 |
+
xhr.responseText = b.textContent ? b.textContent : b.innerText;
|
710 |
+
}
|
711 |
+
}
|
712 |
+
}
|
713 |
+
else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
|
714 |
+
xhr.responseXML = toXml(xhr.responseText);
|
715 |
+
}
|
716 |
+
|
717 |
+
try {
|
718 |
+
data = httpData(xhr, dt, s);
|
719 |
+
}
|
720 |
+
catch (err) {
|
721 |
+
status = 'parsererror';
|
722 |
+
xhr.error = errMsg = (err || status);
|
723 |
+
}
|
724 |
+
}
|
725 |
+
catch (err) {
|
726 |
+
log('error caught: ',err);
|
727 |
+
status = 'error';
|
728 |
+
xhr.error = errMsg = (err || status);
|
729 |
+
}
|
730 |
+
|
731 |
+
if (xhr.aborted) {
|
732 |
+
log('upload aborted');
|
733 |
+
status = null;
|
734 |
+
}
|
735 |
+
|
736 |
+
if (xhr.status) { // we've set xhr.status
|
737 |
+
status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
|
738 |
+
}
|
739 |
+
|
740 |
+
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
741 |
+
if (status === 'success') {
|
742 |
+
if (s.success) {
|
743 |
+
s.success.call(s.context, data, 'success', xhr);
|
744 |
+
}
|
745 |
+
deferred.resolve(xhr.responseText, 'success', xhr);
|
746 |
+
if (g) {
|
747 |
+
$.event.trigger("ajaxSuccess", [xhr, s]);
|
748 |
+
}
|
749 |
+
}
|
750 |
+
else if (status) {
|
751 |
+
if (errMsg === undefined) {
|
752 |
+
errMsg = xhr.statusText;
|
753 |
+
}
|
754 |
+
if (s.error) {
|
755 |
+
s.error.call(s.context, xhr, status, errMsg);
|
756 |
+
}
|
757 |
+
deferred.reject(xhr, 'error', errMsg);
|
758 |
+
if (g) {
|
759 |
+
$.event.trigger("ajaxError", [xhr, s, errMsg]);
|
760 |
+
}
|
761 |
+
}
|
762 |
+
|
763 |
+
if (g) {
|
764 |
+
$.event.trigger("ajaxComplete", [xhr, s]);
|
765 |
+
}
|
766 |
+
|
767 |
+
if (g && ! --$.active) {
|
768 |
+
$.event.trigger("ajaxStop");
|
769 |
+
}
|
770 |
+
|
771 |
+
if (s.complete) {
|
772 |
+
s.complete.call(s.context, xhr, status);
|
773 |
+
}
|
774 |
+
|
775 |
+
callbackProcessed = true;
|
776 |
+
if (s.timeout) {
|
777 |
+
clearTimeout(timeoutHandle);
|
778 |
+
}
|
779 |
+
|
780 |
+
// clean up
|
781 |
+
setTimeout(function() {
|
782 |
+
if (!s.iframeTarget) {
|
783 |
+
$io.remove();
|
784 |
+
}
|
785 |
+
else { //adding else to clean up existing iframe response.
|
786 |
+
$io.attr('src', s.iframeSrc);
|
787 |
+
}
|
788 |
+
xhr.responseXML = null;
|
789 |
+
}, 100);
|
790 |
+
}
|
791 |
+
|
792 |
+
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
|
793 |
+
if (window.ActiveXObject) {
|
794 |
+
doc = new ActiveXObject('Microsoft.XMLDOM');
|
795 |
+
doc.async = 'false';
|
796 |
+
doc.loadXML(s);
|
797 |
+
}
|
798 |
+
else {
|
799 |
+
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
800 |
+
}
|
801 |
+
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
802 |
+
};
|
803 |
+
var parseJSON = $.parseJSON || function(s) {
|
804 |
+
/*jslint evil:true */
|
805 |
+
return window['eval']('(' + s + ')');
|
806 |
+
};
|
807 |
+
|
808 |
+
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
809 |
+
|
810 |
+
var ct = xhr.getResponseHeader('content-type') || '',
|
811 |
+
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
812 |
+
data = xml ? xhr.responseXML : xhr.responseText;
|
813 |
+
|
814 |
+
if (xml && data.documentElement.nodeName === 'parsererror') {
|
815 |
+
if ($.error) {
|
816 |
+
$.error('parsererror');
|
817 |
+
}
|
818 |
+
}
|
819 |
+
if (s && s.dataFilter) {
|
820 |
+
data = s.dataFilter(data, type);
|
821 |
+
}
|
822 |
+
if (typeof data === 'string') {
|
823 |
+
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
824 |
+
data = parseJSON(data);
|
825 |
+
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
826 |
+
$.globalEval(data);
|
827 |
+
}
|
828 |
+
}
|
829 |
+
return data;
|
830 |
+
};
|
831 |
+
|
832 |
+
return deferred;
|
833 |
+
}
|
834 |
+
};
|
835 |
+
|
836 |
+
/**
|
837 |
+
* ajaxForm() provides a mechanism for fully automating form submission.
|
838 |
+
*
|
839 |
+
* The advantages of using this method instead of ajaxSubmit() are:
|
840 |
+
*
|
841 |
+
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
842 |
+
* is used to submit the form).
|
843 |
+
* 2. This method will include the submit element's name/value data (for the element that was
|
844 |
+
* used to submit the form).
|
845 |
+
* 3. This method binds the submit() method to the form for you.
|
846 |
+
*
|
847 |
+
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
848 |
+
* passes the options argument along after properly binding events for submit elements and
|
849 |
+
* the form itself.
|
850 |
+
*/
|
851 |
+
$.fn.ajaxForm = function(options) {
|
852 |
+
options = options || {};
|
853 |
+
options.delegation = options.delegation && $.isFunction($.fn.on);
|
854 |
+
|
855 |
+
// in jQuery 1.3+ we can fix mistakes with the ready state
|
856 |
+
if (!options.delegation && this.length === 0) {
|
857 |
+
var o = { s: this.selector, c: this.context };
|
858 |
+
if (!$.isReady && o.s) {
|
859 |
+
log('DOM not ready, queuing ajaxForm');
|
860 |
+
$(function() {
|
861 |
+
$(o.s,o.c).ajaxForm(options);
|
862 |
+
});
|
863 |
+
return this;
|
864 |
+
}
|
865 |
+
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
866 |
+
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
867 |
+
return this;
|
868 |
+
}
|
869 |
+
|
870 |
+
if ( options.delegation ) {
|
871 |
+
$(document)
|
872 |
+
.off('submit.form-plugin', this.selector, doAjaxSubmit)
|
873 |
+
.off('click.form-plugin', this.selector, captureSubmittingElement)
|
874 |
+
.on('submit.form-plugin', this.selector, options, doAjaxSubmit)
|
875 |
+
.on('click.form-plugin', this.selector, options, captureSubmittingElement);
|
876 |
+
return this;
|
877 |
+
}
|
878 |
+
|
879 |
+
return this.ajaxFormUnbind()
|
880 |
+
.bind('submit.form-plugin', options, doAjaxSubmit)
|
881 |
+
.bind('click.form-plugin', options, captureSubmittingElement);
|
882 |
+
};
|
883 |
+
|
884 |
+
// private event handlers
|
885 |
+
function doAjaxSubmit(e) {
|
886 |
+
/*jshint validthis:true */
|
887 |
+
var options = e.data;
|
888 |
+
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
889 |
+
e.preventDefault();
|
890 |
+
$(e.target).ajaxSubmit(options); // #365
|
891 |
+
}
|
892 |
+
}
|
893 |
+
|
894 |
+
function captureSubmittingElement(e) {
|
895 |
+
/*jshint validthis:true */
|
896 |
+
var target = e.target;
|
897 |
+
var $el = $(target);
|
898 |
+
if (!($el.is("[type=submit],[type=image]"))) {
|
899 |
+
// is this a child element of the submit el? (ex: a span within a button)
|
900 |
+
var t = $el.closest('[type=submit]');
|
901 |
+
if (t.length === 0) {
|
902 |
+
return;
|
903 |
+
}
|
904 |
+
target = t[0];
|
905 |
+
}
|
906 |
+
var form = this;
|
907 |
+
form.clk = target;
|
908 |
+
if (target.type == 'image') {
|
909 |
+
if (e.offsetX !== undefined) {
|
910 |
+
form.clk_x = e.offsetX;
|
911 |
+
form.clk_y = e.offsetY;
|
912 |
+
} else if (typeof $.fn.offset == 'function') {
|
913 |
+
var offset = $el.offset();
|
914 |
+
form.clk_x = e.pageX - offset.left;
|
915 |
+
form.clk_y = e.pageY - offset.top;
|
916 |
+
} else {
|
917 |
+
form.clk_x = e.pageX - target.offsetLeft;
|
918 |
+
form.clk_y = e.pageY - target.offsetTop;
|
919 |
+
}
|
920 |
+
}
|
921 |
+
// clear form vars
|
922 |
+
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
923 |
+
}
|
924 |
+
|
925 |
+
|
926 |
+
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
927 |
+
$.fn.ajaxFormUnbind = function() {
|
928 |
+
return this.unbind('submit.form-plugin click.form-plugin');
|
929 |
+
};
|
930 |
+
|
931 |
+
/**
|
932 |
+
* formToArray() gathers form element data into an array of objects that can
|
933 |
+
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
934 |
+
* Each object in the array has both a 'name' and 'value' property. An example of
|
935 |
+
* an array for a simple login form might be:
|
936 |
+
*
|
937 |
+
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
938 |
+
*
|
939 |
+
* It is this array that is passed to pre-submit callback functions provided to the
|
940 |
+
* ajaxSubmit() and ajaxForm() methods.
|
941 |
+
*/
|
942 |
+
$.fn.formToArray = function(semantic, elements) {
|
943 |
+
var a = [];
|
944 |
+
if (this.length === 0) {
|
945 |
+
return a;
|
946 |
+
}
|
947 |
+
|
948 |
+
var form = this[0];
|
949 |
+
var formId = this.attr('id');
|
950 |
+
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
951 |
+
var els2;
|
952 |
+
|
953 |
+
if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
|
954 |
+
els = $(els).get(); // convert to standard array
|
955 |
+
}
|
956 |
+
|
957 |
+
// #386; account for inputs outside the form which use the 'form' attribute
|
958 |
+
if ( formId ) {
|
959 |
+
els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet
|
960 |
+
if ( els2.length ) {
|
961 |
+
els = (els || []).concat(els2);
|
962 |
+
}
|
963 |
+
}
|
964 |
+
|
965 |
+
if (!els || !els.length) {
|
966 |
+
return a;
|
967 |
+
}
|
968 |
+
|
969 |
+
var i,j,n,v,el,max,jmax;
|
970 |
+
for(i=0, max=els.length; i < max; i++) {
|
971 |
+
el = els[i];
|
972 |
+
n = el.name;
|
973 |
+
if (!n || el.disabled) {
|
974 |
+
continue;
|
975 |
+
}
|
976 |
+
|
977 |
+
if (semantic && form.clk && el.type == "image") {
|
978 |
+
// handle image inputs on the fly when semantic == true
|
979 |
+
if(form.clk == el) {
|
980 |
+
a.push({name: n, value: $(el).val(), type: el.type });
|
981 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
982 |
+
}
|
983 |
+
continue;
|
984 |
+
}
|
985 |
+
|
986 |
+
v = $.fieldValue(el, true);
|
987 |
+
if (v && v.constructor == Array) {
|
988 |
+
if (elements) {
|
989 |
+
elements.push(el);
|
990 |
+
}
|
991 |
+
for(j=0, jmax=v.length; j < jmax; j++) {
|
992 |
+
a.push({name: n, value: v[j]});
|
993 |
+
}
|
994 |
+
}
|
995 |
+
else if (feature.fileapi && el.type == 'file') {
|
996 |
+
if (elements) {
|
997 |
+
elements.push(el);
|
998 |
+
}
|
999 |
+
var files = el.files;
|
1000 |
+
if (files.length) {
|
1001 |
+
for (j=0; j < files.length; j++) {
|
1002 |
+
a.push({name: n, value: files[j], type: el.type});
|
1003 |
+
}
|
1004 |
+
}
|
1005 |
+
else {
|
1006 |
+
// #180
|
1007 |
+
a.push({ name: n, value: '', type: el.type });
|
1008 |
+
}
|
1009 |
+
}
|
1010 |
+
else if (v !== null && typeof v != 'undefined') {
|
1011 |
+
if (elements) {
|
1012 |
+
elements.push(el);
|
1013 |
+
}
|
1014 |
+
a.push({name: n, value: v, type: el.type, required: el.required});
|
1015 |
+
}
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
if (!semantic && form.clk) {
|
1019 |
+
// input type=='image' are not found in elements array! handle it here
|
1020 |
+
var $input = $(form.clk), input = $input[0];
|
1021 |
+
n = input.name;
|
1022 |
+
if (n && !input.disabled && input.type == 'image') {
|
1023 |
+
a.push({name: n, value: $input.val()});
|
1024 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
1025 |
+
}
|
1026 |
+
}
|
1027 |
+
return a;
|
1028 |
+
};
|
1029 |
+
|
1030 |
+
/**
|
1031 |
+
* Serializes form data into a 'submittable' string. This method will return a string
|
1032 |
+
* in the format: name1=value1&name2=value2
|
1033 |
+
*/
|
1034 |
+
$.fn.formSerialize = function(semantic) {
|
1035 |
+
//hand off to jQuery.param for proper encoding
|
1036 |
+
return $.param(this.formToArray(semantic));
|
1037 |
+
};
|
1038 |
+
|
1039 |
+
/**
|
1040 |
+
* Serializes all field elements in the jQuery object into a query string.
|
1041 |
+
* This method will return a string in the format: name1=value1&name2=value2
|
1042 |
+
*/
|
1043 |
+
$.fn.fieldSerialize = function(successful) {
|
1044 |
+
var a = [];
|
1045 |
+
this.each(function() {
|
1046 |
+
var n = this.name;
|
1047 |
+
if (!n) {
|
1048 |
+
return;
|
1049 |
+
}
|
1050 |
+
var v = $.fieldValue(this, successful);
|
1051 |
+
if (v && v.constructor == Array) {
|
1052 |
+
for (var i=0,max=v.length; i < max; i++) {
|
1053 |
+
a.push({name: n, value: v[i]});
|
1054 |
+
}
|
1055 |
+
}
|
1056 |
+
else if (v !== null && typeof v != 'undefined') {
|
1057 |
+
a.push({name: this.name, value: v});
|
1058 |
+
}
|
1059 |
+
});
|
1060 |
+
//hand off to jQuery.param for proper encoding
|
1061 |
+
return $.param(a);
|
1062 |
+
};
|
1063 |
+
|
1064 |
+
/**
|
1065 |
+
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
1066 |
+
*
|
1067 |
+
* <form><fieldset>
|
1068 |
+
* <input name="A" type="text" />
|
1069 |
+
* <input name="A" type="text" />
|
1070 |
+
* <input name="B" type="checkbox" value="B1" />
|
1071 |
+
* <input name="B" type="checkbox" value="B2"/>
|
1072 |
+
* <input name="C" type="radio" value="C1" />
|
1073 |
+
* <input name="C" type="radio" value="C2" />
|
1074 |
+
* </fieldset></form>
|
1075 |
+
*
|
1076 |
+
* var v = $('input[type=text]').fieldValue();
|
1077 |
+
* // if no values are entered into the text inputs
|
1078 |
+
* v == ['','']
|
1079 |
+
* // if values entered into the text inputs are 'foo' and 'bar'
|
1080 |
+
* v == ['foo','bar']
|
1081 |
+
*
|
1082 |
+
* var v = $('input[type=checkbox]').fieldValue();
|
1083 |
+
* // if neither checkbox is checked
|
1084 |
+
* v === undefined
|
1085 |
+
* // if both checkboxes are checked
|
1086 |
+
* v == ['B1', 'B2']
|
1087 |
+
*
|
1088 |
+
* var v = $('input[type=radio]').fieldValue();
|
1089 |
+
* // if neither radio is checked
|
1090 |
+
* v === undefined
|
1091 |
+
* // if first radio is checked
|
1092 |
+
* v == ['C1']
|
1093 |
+
*
|
1094 |
+
* The successful argument controls whether or not the field element must be 'successful'
|
1095 |
+
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
1096 |
+
* The default value of the successful argument is true. If this value is false the value(s)
|
1097 |
+
* for each element is returned.
|
1098 |
+
*
|
1099 |
+
* Note: This method *always* returns an array. If no valid value can be determined the
|
1100 |
+
* array will be empty, otherwise it will contain one or more values.
|
1101 |
+
*/
|
1102 |
+
$.fn.fieldValue = function(successful) {
|
1103 |
+
for (var val=[], i=0, max=this.length; i < max; i++) {
|
1104 |
+
var el = this[i];
|
1105 |
+
var v = $.fieldValue(el, successful);
|
1106 |
+
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
1107 |
+
continue;
|
1108 |
+
}
|
1109 |
+
if (v.constructor == Array) {
|
1110 |
+
$.merge(val, v);
|
1111 |
+
}
|
1112 |
+
else {
|
1113 |
+
val.push(v);
|
1114 |
+
}
|
1115 |
+
}
|
1116 |
+
return val;
|
1117 |
+
};
|
1118 |
+
|
1119 |
+
/**
|
1120 |
+
* Returns the value of the field element.
|
1121 |
+
*/
|
1122 |
+
$.fieldValue = function(el, successful) {
|
1123 |
+
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
1124 |
+
if (successful === undefined) {
|
1125 |
+
successful = true;
|
1126 |
+
}
|
1127 |
+
|
1128 |
+
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
1129 |
+
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
1130 |
+
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
1131 |
+
tag == 'select' && el.selectedIndex == -1)) {
|
1132 |
+
return null;
|
1133 |
+
}
|
1134 |
+
|
1135 |
+
if (tag == 'select') {
|
1136 |
+
var index = el.selectedIndex;
|
1137 |
+
if (index < 0) {
|
1138 |
+
return null;
|
1139 |
+
}
|
1140 |
+
var a = [], ops = el.options;
|
1141 |
+
var one = (t == 'select-one');
|
1142 |
+
var max = (one ? index+1 : ops.length);
|
1143 |
+
for(var i=(one ? index : 0); i < max; i++) {
|
1144 |
+
var op = ops[i];
|
1145 |
+
if (op.selected) {
|
1146 |
+
var v = op.value;
|
1147 |
+
if (!v) { // extra pain for IE...
|
1148 |
+
v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
|
1149 |
+
}
|
1150 |
+
if (one) {
|
1151 |
+
return v;
|
1152 |
+
}
|
1153 |
+
a.push(v);
|
1154 |
+
}
|
1155 |
+
}
|
1156 |
+
return a;
|
1157 |
+
}
|
1158 |
+
return $(el).val();
|
1159 |
+
};
|
1160 |
+
|
1161 |
+
/**
|
1162 |
+
* Clears the form data. Takes the following actions on the form's input fields:
|
1163 |
+
* - input text fields will have their 'value' property set to the empty string
|
1164 |
+
* - select elements will have their 'selectedIndex' property set to -1
|
1165 |
+
* - checkbox and radio inputs will have their 'checked' property set to false
|
1166 |
+
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
1167 |
+
* - button elements will *not* be effected
|
1168 |
+
*/
|
1169 |
+
$.fn.clearForm = function(includeHidden) {
|
1170 |
+
return this.each(function() {
|
1171 |
+
$('input,select,textarea', this).clearFields(includeHidden);
|
1172 |
+
});
|
1173 |
+
};
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Clears the selected form elements.
|
1177 |
+
*/
|
1178 |
+
$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
|
1179 |
+
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
|
1180 |
+
return this.each(function() {
|
1181 |
+
var t = this.type, tag = this.tagName.toLowerCase();
|
1182 |
+
if (re.test(t) || tag == 'textarea') {
|
1183 |
+
this.value = '';
|
1184 |
+
}
|
1185 |
+
else if (t == 'checkbox' || t == 'radio') {
|
1186 |
+
this.checked = false;
|
1187 |
+
}
|
1188 |
+
else if (tag == 'select') {
|
1189 |
+
this.selectedIndex = -1;
|
1190 |
+
}
|
1191 |
+
else if (t == "file") {
|
1192 |
+
if (/MSIE/.test(navigator.userAgent)) {
|
1193 |
+
$(this).replaceWith($(this).clone(true));
|
1194 |
+
} else {
|
1195 |
+
$(this).val('');
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
else if (includeHidden) {
|
1199 |
+
// includeHidden can be the value true, or it can be a selector string
|
1200 |
+
// indicating a special test; for example:
|
1201 |
+
// $('#myForm').clearForm('.special:hidden')
|
1202 |
+
// the above would clean hidden inputs that have the class of 'special'
|
1203 |
+
if ( (includeHidden === true && /hidden/.test(t)) ||
|
1204 |
+
(typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
|
1205 |
+
this.value = '';
|
1206 |
+
}
|
1207 |
+
}
|
1208 |
+
});
|
1209 |
+
};
|
1210 |
+
|
1211 |
+
/**
|
1212 |
+
* Resets the form data. Causes all form elements to be reset to their original value.
|
1213 |
+
*/
|
1214 |
+
$.fn.resetForm = function() {
|
1215 |
+
return this.each(function() {
|
1216 |
+
// guard against an input with the name of 'reset'
|
1217 |
+
// note that IE reports the reset function as an 'object'
|
1218 |
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
1219 |
+
this.reset();
|
1220 |
+
}
|
1221 |
+
});
|
1222 |
+
};
|
1223 |
+
|
1224 |
+
/**
|
1225 |
+
* Enables or disables any matching elements.
|
1226 |
+
*/
|
1227 |
+
$.fn.enable = function(b) {
|
1228 |
+
if (b === undefined) {
|
1229 |
+
b = true;
|
1230 |
+
}
|
1231 |
+
return this.each(function() {
|
1232 |
+
this.disabled = !b;
|
1233 |
+
});
|
1234 |
+
};
|
1235 |
+
|
1236 |
+
/**
|
1237 |
+
* Checks/unchecks any matching checkboxes or radio buttons and
|
1238 |
+
* selects/deselects and matching option elements.
|
1239 |
+
*/
|
1240 |
+
$.fn.selected = function(select) {
|
1241 |
+
if (select === undefined) {
|
1242 |
+
select = true;
|
1243 |
+
}
|
1244 |
+
return this.each(function() {
|
1245 |
+
var t = this.type;
|
1246 |
+
if (t == 'checkbox' || t == 'radio') {
|
1247 |
+
this.checked = select;
|
1248 |
+
}
|
1249 |
+
else if (this.tagName.toLowerCase() == 'option') {
|
1250 |
+
var $sel = $(this).parent('select');
|
1251 |
+
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
1252 |
+
// deselect all other options
|
1253 |
+
$sel.find('option').selected(false);
|
1254 |
+
}
|
1255 |
+
this.selected = select;
|
1256 |
+
}
|
1257 |
+
});
|
1258 |
+
};
|
1259 |
+
|
1260 |
+
// expose debug var
|
1261 |
+
$.fn.ajaxSubmit.debug = false;
|
1262 |
+
|
1263 |
+
// helper fn for console logging
|
1264 |
+
function log() {
|
1265 |
+
if (!$.fn.ajaxSubmit.debug) {
|
1266 |
+
return;
|
1267 |
+
}
|
1268 |
+
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
1269 |
+
if (window.console && window.console.log) {
|
1270 |
+
window.console.log(msg);
|
1271 |
+
}
|
1272 |
+
else if (window.opera && window.opera.postError) {
|
1273 |
+
window.opera.postError(msg);
|
1274 |
+
}
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
}));
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: customizable facebook feed, facebook, facebook feed, facebook group, faceb
|
|
4 |
Requires at least: 3.4
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.2
|
7 |
-
Stable tag: 1.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -104,6 +104,10 @@ If you think you found a bug in 10Web Facebook Feed or have any problem/question
|
|
104 |
The plugin uses Facebook API to get public data from Facebook. All the received data is cached in WordPress database for some short customizable period to provide optimization. You can delete or update cached data. You can optionally enable like button for Facebook page. If you do so, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook privacy policy https://www.facebook.com/policy.php.
|
105 |
|
106 |
== Changelog ==
|
|
|
|
|
|
|
|
|
107 |
= 1.1.11 =
|
108 |
* Fixed: Single quote in owner info broke the lightbox.
|
109 |
|
4 |
Requires at least: 3.4
|
5 |
Requires PHP: 5.2
|
6 |
Tested up to: 5.2
|
7 |
+
Stable tag: 1.1.12
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
104 |
The plugin uses Facebook API to get public data from Facebook. All the received data is cached in WordPress database for some short customizable period to provide optimization. You can delete or update cached data. You can optionally enable like button for Facebook page. If you do so, Facebook will load some JS and embedded content which may track visitors. Facebook embeds are regulated under terms of Facebook privacy policy https://www.facebook.com/policy.php.
|
105 |
|
106 |
== Changelog ==
|
107 |
+
|
108 |
+
= 1.1.12 =
|
109 |
+
* Fixed: Security issues
|
110 |
+
|
111 |
= 1.1.11 =
|
112 |
* Fixed: Single quote in owner info broke the lightbox.
|
113 |
|
wd/includes/deactivate.php
CHANGED
@@ -111,18 +111,18 @@ class TenWebLibDeactivate
|
|
111 |
$wd_options = $this->config;
|
112 |
if (isset($_POST[$wd_options->prefix . "_submit_and_deactivate"])) {
|
113 |
|
114 |
-
if ($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 2 || $_POST[$wd_options->prefix . "_submit_and_deactivate"] == 3) {
|
115 |
//$api = new TenWebLibApi( $wd_options );
|
116 |
|
117 |
$data = array();
|
118 |
|
119 |
-
$data["reason"] = isset($_POST[$wd_options->prefix . "_reasons"]) ? $_POST[$wd_options->prefix . "_reasons"] : "";
|
120 |
$data["site_url"] = site_url();
|
121 |
$data["product_id"] = $wd_options->plugin_id;
|
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 |
|
@@ -146,7 +146,7 @@ class TenWebLibDeactivate
|
|
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(
|
111 |
$wd_options = $this->config;
|
112 |
if (isset($_POST[$wd_options->prefix . "_submit_and_deactivate"])) {
|
113 |
|
114 |
+
if ( intval($_POST[$wd_options->prefix . "_submit_and_deactivate"]) == 2 || intval($_POST[$wd_options->prefix . "_submit_and_deactivate"]) == 3) {
|
115 |
//$api = new TenWebLibApi( $wd_options );
|
116 |
|
117 |
$data = array();
|
118 |
|
119 |
+
$data["reason"] = isset($_POST[$wd_options->prefix . "_reasons"]) ? sanitize_text_field($_POST[$wd_options->prefix . "_reasons"]) : "";
|
120 |
$data["site_url"] = site_url();
|
121 |
$data["product_id"] = $wd_options->plugin_id;
|
122 |
|
123 |
+
$data["additional_details"] = isset($_POST[$wd_options->prefix . "_additional_details"]) ? sanitize_text_field($_POST[$wd_options->prefix . "_additional_details"]) : "";
|
124 |
$admin_data = wp_get_current_user();
|
125 |
+
$data["email"] = isset($_POST[$wd_options->prefix . "_email"]) ? sanitize_text_field($_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 |
|
146 |
}*/
|
147 |
|
148 |
}
|
149 |
+
if (isset($_POST[$wd_options->prefix . "_submit_and_deactivate"]) && (intval($_POST[$wd_options->prefix . "_submit_and_deactivate"]) == 2 || intval($_POST[$wd_options->prefix . "_submit_and_deactivate"] == 1))) {
|
150 |
$deactivate_url =
|
151 |
add_query_arg(
|
152 |
array(
|
wd/includes/notices.php
CHANGED
@@ -133,7 +133,7 @@ class TenWebLibNotices {
|
|
133 |
// If user clicks to ignore the notice, update the option to not show it again
|
134 |
if ( isset( $_GET[$wd_options->prefix . '_admin_notice_ignore'] ) ) {
|
135 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
136 |
-
$admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_ignore']]['dismissed'] = 1;
|
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 );
|
@@ -149,12 +149,12 @@ class TenWebLibNotices {
|
|
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 = (isset($_GET['wd_int']) ? $_GET['wd_int'] : 14);
|
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 |
-
$admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['start'] = $new_start;
|
157 |
-
$admin_notices_option[$_GET[$wd_options->prefix . '_admin_notice_temp_ignore']]['dismissed'] = 0;
|
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 );
|
133 |
// If user clicks to ignore the notice, update the option to not show it again
|
134 |
if ( isset( $_GET[$wd_options->prefix . '_admin_notice_ignore'] ) ) {
|
135 |
$admin_notices_option = get_option( $wd_options->prefix . '_admin_notice', array() );
|
136 |
+
$admin_notices_option[sanitize_text_field($_GET[$wd_options->prefix . '_admin_notice_ignore'])]['dismissed'] = 1;
|
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 );
|
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 = (isset($_GET['wd_int']) ? intval($_GET['wd_int']) : 14);
|
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 |
+
$admin_notices_option[sanitize_text_field($_GET[$wd_options->prefix . '_admin_notice_temp_ignore'])]['start'] = $new_start;
|
157 |
+
$admin_notices_option[sanitize_text_field($_GET[$wd_options->prefix . '_admin_notice_temp_ignore'])]['dismissed'] = 0;
|
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 );
|
wd/includes/subscribe.php
CHANGED
@@ -53,7 +53,7 @@ class TenWebLibSubscribe
|
|
53 |
$wd_options = $this->config;
|
54 |
if (isset($_GET[$wd_options->prefix . "_sub_action"])) {
|
55 |
|
56 |
-
if ($_GET[$wd_options->prefix . "_sub_action"] == "allow") {
|
57 |
//$api = new TenWebLibApi($wd_options);
|
58 |
$all_plugins = array();
|
59 |
$plugins = get_plugins();
|
53 |
$wd_options = $this->config;
|
54 |
if (isset($_GET[$wd_options->prefix . "_sub_action"])) {
|
55 |
|
56 |
+
if (sanitize_text_field($_GET[$wd_options->prefix . "_sub_action"]) == "allow") {
|
57 |
//$api = new TenWebLibApi($wd_options);
|
58 |
$all_plugins = array();
|
59 |
$plugins = get_plugins();
|