wpCentral - Version 1.4.6

Version Description

  • wpCentral Post Management support
Download this release

Release Info

Developer softacpriya
Plugin Icon 128x128 wpCentral
Version 1.4.6
Comparing to
See all releases

Code changes from version 1.4.5 to 1.4.6

Files changed (5) hide show
  1. actions.php +21 -0
  2. get_site_data.php +11 -0
  3. readme.txt +5 -2
  4. wpc_functions.php +75 -0
  5. wpcentral.php +3 -2
actions.php CHANGED
@@ -74,6 +74,27 @@ function wpc_site_actions(){
74
75
$return['updatedto'] = wpc_version_wp();
76
}
77
78
if(wpc_optGET('plugins') || wpc_optGET('plugin')){
79
$plugins = urldecode(wpc_optREQ('plugins'));
74
75
$return['updatedto'] = wpc_version_wp();
76
}
77
+
78
+ if($request == 'create_post'){
79
+ // Create post object
80
+ $my_post = array(
81
+ 'post_title' => wp_strip_all_tags($_POST['post_title']),
82
+ 'post_content' => $_POST['post_content'],
83
+ 'post_status' => 'publish',
84
+ 'post_author' => 1
85
+ );
86
+
87
+ // Insert the post into the database
88
+ $return['create_post_response'] = wp_insert_post($my_post);
89
+ }
90
+
91
+ if($request == 'delete_post'){
92
+
93
+ $post_id = wpc_optREQ('del_post');
94
+
95
+ // Delete the post from the database
96
+ $return['delete_post_response'] = wp_delete_post($post_id);
97
+ }
98
99
if(wpc_optGET('plugins') || wpc_optGET('plugin')){
100
$plugins = urldecode(wpc_optREQ('plugins'));
get_site_data.php CHANGED
@@ -37,6 +37,17 @@ function wpc_get_site_data(){
37
$return['active_theme'] = array_keys(wpc_get_active_theme());
38
$return['all_themes'] = wpc_get_installed_themes();
39
40
}else{
41
$return['error'] = $l['invalid_params'];
42
}
37
$return['active_theme'] = array_keys(wpc_get_active_theme());
38
$return['all_themes'] = wpc_get_installed_themes();
39
40
+ }elseif($type == 'posts'){
41
+
42
+ $all_posts = get_posts(array('post_status' => 'any', 'numberposts' => -1));
43
+
44
+ foreach($all_posts as $postk => $postv){
45
+ $user_data = get_user_by('id', $postv->post_author);
46
+ $all_posts[$postk]->post_author = $user_data->data->display_name;
47
+ }
48
+
49
+ $return['all_posts'] = $all_posts;
50
+
51
}else{
52
$return['error'] = $l['invalid_params'];
53
}
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
Contributors: softaculous
3
Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, manage wordpress,
4
Requires at least: 4.4
5
- Tested up to: 5.2
6
Requires PHP: 5.3
7
- Stable tag: 1.4.5
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -40,6 +40,9 @@ Should you have any suggestions to improve wpcentral, want to see some related f
40
41
== Changelog ==
42
43
= 1.4.5 =
44
* wpCentral promotional notice on admin panel to be displayed only when the website is connected to wpCentral panel.
45
2
Contributors: softaculous
3
Tags: wpcentral, softaculous, sites, manage sites, backup, plugins, themes, manage wordpress,
4
Requires at least: 4.4
5
+ Tested up to: 5.2.4
6
Requires PHP: 5.3
7
+ Stable tag: 1.4.6
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
40
41
== Changelog ==
42
43
+ = 1.4.6 =
44
+ * wpCentral Post Management support
45
+
46
= 1.4.5 =
47
* wpCentral promotional notice on admin panel to be displayed only when the website is connected to wpCentral panel.
48
wpc_functions.php CHANGED
@@ -629,6 +629,31 @@ global $error;
629
630
}
631
632
/**
633
* OPTIONAL GET of the given GET Key i.e. dont throw a error if not there
634
*
@@ -2437,9 +2462,59 @@ function my_wpc_actions_init(){
2437
case 'wpcentral_version':
2438
wpc_fetch_version();
2439
break;
2440
}
2441
}
2442
2443
function wpc_can_createdir($path = ''){
2444
global $wp_config;
2445
629
630
}
631
632
+ /**
633
+ * OPTIONAL POST of the given POST Key
634
+ *
635
+ * @param string $name The key of the $_POST array i.e. the name of the input / textarea text
636
+ * @param string $default The value to return if the $_POST[$name] is NOT SET
637
+ * @return string Returns the string if the POST is there otherwise the default value given.
638
+ * @since 1.4.6
639
+ */
640
+ function wpc_optPOST($name, $default = ''){
641
+
642
+ global $error;
643
+
644
+ //Check the POSTED NAME was posted
645
+ if(isset($_POST[$name])){
646
+
647
+ return wpc_inputsec(wpc_htmlizer(trim($_POST[$name])));
648
+
649
+ }else{
650
+
651
+ return $default;
652
+
653
+ }
654
+
655
+ }
656
+
657
/**
658
* OPTIONAL GET of the given GET Key i.e. dont throw a error if not there
659
*
2462
case 'wpcentral_version':
2463
wpc_fetch_version();
2464
break;
2465
+
2466
+ case 'edit_post':
2467
+ case 'preview_post':
2468
+ wpc_post_redirect($wpc_act);
2469
+ break;
2470
+
2471
+ case 'preview_post':
2472
+ wpc_preview_post();
2473
+ break;
2474
+ }
2475
+ }
2476
+
2477
+ /**
2478
+ * Directs to the edit/preview post page of the specified post
2479
+ *
2480
+ * @since 1.4.6
2481
+ */
2482
+ function wpc_post_redirect($post_act){
2483
+ global $l, $error;
2484
+
2485
+ $user_info = get_userdata(1);
2486
+
2487
+ $post_id = wpc_optREQ('post_id');
2488
+
2489
+ // Automatic login //
2490
+ $username = $user_info->user_login;
2491
+ $user = get_user_by('login', $username );
2492
+
2493
+ // Redirect URL //
2494
+ if (!is_wp_error($user)){
2495
+ wp_clear_auth_cookie();
2496
+ wp_set_current_user($user->ID);
2497
+ wp_set_auth_cookie($user->ID);
2498
+
2499
+ if($post_act == 'edit_post'){
2500
+ $redirect_to = get_edit_post_link($post_id, '');
2501
+
2502
+ }elseif($post_act == 'preview_post'){
2503
+ $redirect_to = get_preview_post_link($post_id);
2504
+ }
2505
+
2506
+ wp_safe_redirect($redirect_to);
2507
+
2508
+ exit();
2509
}
2510
}
2511
2512
+ /**
2513
+ * Check if we have the permission to create a directory on the user server
2514
+ *
2515
+ * @returns bool
2516
+ * @since 1.4.1
2517
+ */
2518
function wpc_can_createdir($path = ''){
2519
global $wp_config;
2520
wpcentral.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: wpCentral
4
Plugin URI: https://wpcentral.co
5
Description: wpCentral provides a centralized area where you can manage all your WordPress websites singularly, unitedly as well as efficiently.
6
- Version: 1.4.5
7
Author: Softaculous Ltd.
8
Author URI: https://wpcentral.co
9
License: GPL2
@@ -54,12 +54,13 @@ if(is_plugin_active($wpc_slug)){
54
add_action('admin_notices', 'wpc_admin_notice');
55
}
56
add_action('wp_ajax_wpc_dismissnotice', 'wpc_dismiss_notice');
57
- add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
58
59
if(is_user_logged_in()){
60
add_action('wp_ajax_my_wpc_signon', 'my_wpc_signon');
61
add_action('wp_ajax_my_wpc_fetch_authkey', 'wpc_fetch_authkey');
62
}else{
63
add_action('wp_ajax_nopriv_my_wpc_signon', 'my_wpc_signon');
64
}
65
3
Plugin Name: wpCentral
4
Plugin URI: https://wpcentral.co
5
Description: wpCentral provides a centralized area where you can manage all your WordPress websites singularly, unitedly as well as efficiently.
6
+ Version: 1.4.6
7
Author: Softaculous Ltd.
8
Author URI: https://wpcentral.co
9
License: GPL2
54
add_action('admin_notices', 'wpc_admin_notice');
55
}
56
add_action('wp_ajax_wpc_dismissnotice', 'wpc_dismiss_notice');
57
58
if(is_user_logged_in()){
59
+ add_action('wp_ajax_my_wpc_actions', 'my_wpc_actions_init');
60
add_action('wp_ajax_my_wpc_signon', 'my_wpc_signon');
61
add_action('wp_ajax_my_wpc_fetch_authkey', 'wpc_fetch_authkey');
62
}else{
63
+ add_action('wp_ajax_nopriv_my_wpc_actions', 'my_wpc_actions_init');
64
add_action('wp_ajax_nopriv_my_wpc_signon', 'my_wpc_signon');
65
}
66