@@ -24,8 +24,11 @@ discard block |
||
| 24 | 24 | global $current_tab; |
| 25 | 25 | geodir_redirect_to_admin_panel_on_installed(); |
| 26 | 26 | $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings'; |
| 27 | - if (!(isset($_REQUEST['action']))) // this will avoid Ajax requests |
|
| 28 | - geodir_handle_option_form_submit($current_tab); // located in admin function.php |
|
| 27 | + if (!(isset($_REQUEST['action']))) { |
|
| 28 | + // this will avoid Ajax requests |
|
| 29 | + geodir_handle_option_form_submit($current_tab); |
|
| 30 | + } |
|
| 31 | + // located in admin function.php |
|
| 29 | 32 | /** |
| 30 | 33 | * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area. |
| 31 | 34 | * |
@@ -314,8 +317,9 @@ discard block |
||
| 314 | 317 | if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
|
| 315 | 318 | |
| 316 | 319 | foreach ($notification as $key => $value) {
|
| 317 | - if ($value['type'] == 'textarea') |
|
| 318 | - $notification[$key]['type'] = 'editor'; |
|
| 320 | + if ($value['type'] == 'textarea') { |
|
| 321 | + $notification[$key]['type'] = 'editor'; |
|
| 322 | + } |
|
| 319 | 323 | } |
| 320 | 324 | |
| 321 | 325 | } |
@@ -340,8 +344,9 @@ discard block |
||
| 340 | 344 | if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
|
| 341 | 345 | |
| 342 | 346 | foreach ($design_setting as $key => $value) {
|
| 343 | - if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') |
|
| 344 | - $design_setting[$key]['type'] = 'editor'; |
|
| 347 | + if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') { |
|
| 348 | + $design_setting[$key]['type'] = 'editor'; |
|
| 349 | + } |
|
| 345 | 350 | } |
| 346 | 351 | |
| 347 | 352 | } |
@@ -716,8 +721,9 @@ discard block |
||
| 716 | 721 | |
| 717 | 722 | if (!get_option('geodir_remove_unnecessary_fields')) {
|
| 718 | 723 | |
| 719 | - if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
|
|
| 720 | - $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
|
|
| 724 | + if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) { |
|
| 725 | + $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`"); |
|
| 726 | + } |
|
| 721 | 727 | |
| 722 | 728 | update_option('geodir_remove_unnecessary_fields', '1');
|
| 723 | 729 | |
@@ -743,15 +749,17 @@ discard block |
||
| 743 | 749 | $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action']; |
| 744 | 750 | switch ($geodir_admin_ajax_action) {
|
| 745 | 751 | case 'diagnosis' : |
| 746 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 747 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 752 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 753 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 754 | + } |
|
| 748 | 755 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 749 | 756 | exit(); |
| 750 | 757 | break; |
| 751 | 758 | |
| 752 | 759 | case 'diagnosis-fix' : |
| 753 | - if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') |
|
| 754 | - $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 760 | + if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') { |
|
| 761 | + $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']); |
|
| 762 | + } |
|
| 755 | 763 | call_user_func('geodir_diagnose_' . $diagnose_this);
|
| 756 | 764 | exit(); |
| 757 | 765 | break; |
@@ -1309,11 +1317,11 @@ discard block |
||
| 1309 | 1317 | ////////////////////////////////// |
| 1310 | 1318 | $option_value = get_option('geodir_home_page');
|
| 1311 | 1319 | $page = get_post($option_value); |
| 1312 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1320 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1313 | 1321 | |
| 1314 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1315 | - $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1316 | - else {
|
|
| 1322 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1323 | + $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1324 | + } else {
|
|
| 1317 | 1325 | $is_error_during_diagnose = true; |
| 1318 | 1326 | $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
|
| 1319 | 1327 | if ($fix) {
|
@@ -1334,11 +1342,11 @@ discard block |
||
| 1334 | 1342 | ////////////////////////////////// |
| 1335 | 1343 | $option_value = get_option('geodir_add_listing_page');
|
| 1336 | 1344 | $page = get_post($option_value); |
| 1337 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1345 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1338 | 1346 | |
| 1339 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1340 | - $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1341 | - else {
|
|
| 1347 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1348 | + $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1349 | + } else {
|
|
| 1342 | 1350 | $is_error_during_diagnose = true; |
| 1343 | 1351 | $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
|
| 1344 | 1352 | if ($fix) {
|
@@ -1360,11 +1368,11 @@ discard block |
||
| 1360 | 1368 | ////////////////////////////////// |
| 1361 | 1369 | $option_value = get_option('geodir_preview_page');
|
| 1362 | 1370 | $page = get_post($option_value); |
| 1363 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1371 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1364 | 1372 | |
| 1365 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1366 | - $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1367 | - else {
|
|
| 1373 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1374 | + $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1375 | + } else {
|
|
| 1368 | 1376 | $is_error_during_diagnose = true; |
| 1369 | 1377 | $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
|
| 1370 | 1378 | if ($fix) {
|
@@ -1385,11 +1393,11 @@ discard block |
||
| 1385 | 1393 | ////////////////////////////////// |
| 1386 | 1394 | $option_value = get_option('geodir_success_page');
|
| 1387 | 1395 | $page = get_post($option_value); |
| 1388 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1396 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1389 | 1397 | |
| 1390 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1391 | - $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1392 | - else {
|
|
| 1398 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1399 | + $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1400 | + } else {
|
|
| 1393 | 1401 | $is_error_during_diagnose = true; |
| 1394 | 1402 | $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
|
| 1395 | 1403 | if ($fix) {
|
@@ -1410,11 +1418,11 @@ discard block |
||
| 1410 | 1418 | ////////////////////////////////// |
| 1411 | 1419 | $option_value = get_option('geodir_info_page');
|
| 1412 | 1420 | $page = get_post($option_value); |
| 1413 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1421 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1414 | 1422 | |
| 1415 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1416 | - $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1417 | - else {
|
|
| 1423 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1424 | + $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1425 | + } else {
|
|
| 1418 | 1426 | $is_error_during_diagnose = true; |
| 1419 | 1427 | $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
|
| 1420 | 1428 | if ($fix) {
|
@@ -1435,11 +1443,11 @@ discard block |
||
| 1435 | 1443 | ////////////////////////////////// |
| 1436 | 1444 | $option_value = get_option('geodir_login_page');
|
| 1437 | 1445 | $page = get_post($option_value); |
| 1438 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1446 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1439 | 1447 | |
| 1440 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1441 | - $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1442 | - else {
|
|
| 1448 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1449 | + $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1450 | + } else {
|
|
| 1443 | 1451 | $is_error_during_diagnose = true; |
| 1444 | 1452 | $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
|
| 1445 | 1453 | if ($fix) {
|
@@ -1460,11 +1468,11 @@ discard block |
||
| 1460 | 1468 | ////////////////////////////////// |
| 1461 | 1469 | $option_value = get_option('geodir_location_page');
|
| 1462 | 1470 | $page = get_post($option_value); |
| 1463 | - if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
|
|
| 1471 | + if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
|
|
| 1464 | 1472 | |
| 1465 | - if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') |
|
| 1466 | - $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
|
|
| 1467 | - else {
|
|
| 1473 | + if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') { |
|
| 1474 | + $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>"; |
|
| 1475 | + } else {
|
|
| 1468 | 1476 | $is_error_during_diagnose = true; |
| 1469 | 1477 | $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
|
| 1470 | 1478 | if ($fix) {
|
@@ -1908,8 +1916,9 @@ discard block |
||
| 1908 | 1916 | ); |
| 1909 | 1917 | |
| 1910 | 1918 | $post_location_info = $request_info['post_location']; |
| 1911 | - if ($location_id = geodir_add_new_location($post_location_info)) |
|
| 1912 | - $post_location_id = $location_id; |
|
| 1919 | + if ($location_id = geodir_add_new_location($post_location_info)) { |
|
| 1920 | + $post_location_id = $location_id; |
|
| 1921 | + } |
|
| 1913 | 1922 | } else {
|
| 1914 | 1923 | $post_location_id = 0; |
| 1915 | 1924 | } |
@@ -1972,8 +1981,9 @@ discard block |
||
| 1972 | 1981 | $attachment_set = ''; |
| 1973 | 1982 | |
| 1974 | 1983 | foreach ($attachment as $key => $val) {
|
| 1975 | - if ($val != '') |
|
| 1976 | - $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1984 | + if ($val != '') { |
|
| 1985 | + $attachment_set .= $key . " = '" . $val . "', "; |
|
| 1986 | + } |
|
| 1977 | 1987 | } |
| 1978 | 1988 | $attachment_set = trim($attachment_set, ", "); |
| 1979 | 1989 | |
@@ -2069,8 +2079,7 @@ discard block |
||
| 2069 | 2079 | |
| 2070 | 2080 | $parts = json_decode($response['body']); |
| 2071 | 2081 | //print_r($parts); |
| 2072 | - if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
|
|
| 2073 | - else{
|
|
| 2082 | + if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
|
|
| 2074 | 2083 | |
| 2075 | 2084 | update_option('gd_ga_access_token', $parts->access_token);
|
| 2076 | 2085 | update_option('gd_ga_refresh_token', $parts->refresh_token);
|
@@ -2078,17 +2087,16 @@ discard block |
||
| 2078 | 2087 | } |
| 2079 | 2088 | |
| 2080 | 2089 | |
| 2081 | - } |
|
| 2082 | - elseif(!empty($response['response']['code'])) {
|
|
| 2090 | + } elseif(!empty($response['response']['code'])) {
|
|
| 2083 | 2091 | $parts = json_decode($response['body']); |
| 2084 | 2092 | |
| 2085 | 2093 | if(isset($parts->error)){
|
| 2086 | 2094 | echo $parts->error.": ".$parts->error_description;exit; |
| 2087 | - }else{
|
|
| 2095 | + } else{
|
|
| 2088 | 2096 | echo $error_msg." - #2";exit; |
| 2089 | 2097 | } |
| 2090 | 2098 | |
| 2091 | - }else{
|
|
| 2099 | + } else{
|
|
| 2092 | 2100 | |
| 2093 | 2101 | echo $error_msg." - #3";exit; |
| 2094 | 2102 | |