| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* All Dashboard handler |
| 5 |
* |
| 6 |
* @package ULTP\Dashboard |
| 7 |
* @since 4.1.11 |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace ULTP; |
| 11 |
|
| 12 |
defined( 'ABSPATH' ) || exit; |
| 13 |
|
| 14 |
use ULTP\Includes\Durbin\DurbinClient; |
| 15 |
|
| 16 |
/** |
| 17 |
* Dashboard class. |
| 18 |
* |
| 19 |
* Handles the admin dashboard for Ultimate Post plugin. |
| 20 |
* |
| 21 |
* @package ULTP\Dashboard |
| 22 |
* @since 4.0.0 |
| 23 |
*/ |
| 24 |
class Dashboard { |
| 25 |
/** |
| 26 |
* Setup class. |
| 27 |
* |
| 28 |
* @since 4.0.0 |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
public function __construct() { |
| 32 |
add_action( 'rest_api_init', array( $this, 'ultp_register_route' ) ); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* REST API Action |
| 37 |
* |
| 38 |
* @since 4.1.11 |
| 39 |
* @return void |
| 40 |
*/ |
| 41 |
public function ultp_register_route() { |
| 42 |
register_rest_route( |
| 43 |
'ultp/v2', |
| 44 |
'/addon_block_action/', |
| 45 |
array( |
| 46 |
array( |
| 47 |
'methods' => 'POST', |
| 48 |
'callback' => array( $this, 'addon_block_action' ), |
| 49 |
'permission_callback' => function () { |
| 50 |
return current_user_can( 'manage_options' ); |
| 51 |
}, |
| 52 |
'args' => array(), |
| 53 |
), |
| 54 |
) |
| 55 |
); |
| 56 |
register_rest_route( |
| 57 |
'ultp/v2', |
| 58 |
'/save_plugin_settings/', |
| 59 |
array( |
| 60 |
array( |
| 61 |
'methods' => 'POST', |
| 62 |
'callback' => array( $this, 'save_plugin_settings' ), |
| 63 |
'permission_callback' => function () { |
| 64 |
return current_user_can( 'manage_options' ); |
| 65 |
}, |
| 66 |
'args' => array(), |
| 67 |
), |
| 68 |
) |
| 69 |
); |
| 70 |
register_rest_route( |
| 71 |
'ultp/v2', |
| 72 |
'/get_all_settings/', |
| 73 |
array( |
| 74 |
array( |
| 75 |
'methods' => 'POST', |
| 76 |
'callback' => array( $this, 'get_all_settings' ), |
| 77 |
'permission_callback' => function () { |
| 78 |
return current_user_can( 'manage_options' ); |
| 79 |
}, |
| 80 |
'args' => array(), |
| 81 |
), |
| 82 |
) |
| 83 |
); |
| 84 |
register_rest_route( |
| 85 |
'ultp/v2', |
| 86 |
'/dashborad/', |
| 87 |
array( |
| 88 |
array( |
| 89 |
'methods' => 'POST', |
| 90 |
'callback' => array( $this, 'get_dashboard_callback' ), |
| 91 |
'permission_callback' => function () { |
| 92 |
return current_user_can( 'manage_options' ); |
| 93 |
}, |
| 94 |
'args' => array(), |
| 95 |
), |
| 96 |
) |
| 97 |
); |
| 98 |
register_rest_route( |
| 99 |
'ultp/v2', |
| 100 |
'/wizard_site_status/', |
| 101 |
array( |
| 102 |
array( |
| 103 |
'methods' => 'POST', |
| 104 |
'callback' => array( $this, 'wizard_site_status_callback' ), |
| 105 |
'permission_callback' => function () { |
| 106 |
return current_user_can( 'manage_options' ); |
| 107 |
}, |
| 108 |
'args' => array(), |
| 109 |
), |
| 110 |
) |
| 111 |
); |
| 112 |
register_rest_route( |
| 113 |
'ultp/v2', |
| 114 |
'/send_initial_plugin_data/', |
| 115 |
array( |
| 116 |
array( |
| 117 |
'methods' => 'POST', |
| 118 |
'callback' => array( $this, 'send_initial_plugin_data_callback' ), |
| 119 |
'permission_callback' => function () { |
| 120 |
return current_user_can( 'manage_options' ); |
| 121 |
}, |
| 122 |
'args' => array(), |
| 123 |
), |
| 124 |
) |
| 125 |
); |
| 126 |
register_rest_route( |
| 127 |
'ultp/v2', |
| 128 |
'/initial_setup_complete/', |
| 129 |
array( |
| 130 |
array( |
| 131 |
'methods' => 'POST', |
| 132 |
'callback' => array( $this, 'initial_setup_complete_callback' ), |
| 133 |
'permission_callback' => function () { |
| 134 |
return current_user_can( 'manage_options' ); |
| 135 |
}, |
| 136 |
'args' => array(), |
| 137 |
), |
| 138 |
) |
| 139 |
); |
| 140 |
|
| 141 |
register_rest_route( |
| 142 |
'ultp/v2', |
| 143 |
'/template_action/', |
| 144 |
array( |
| 145 |
array( |
| 146 |
'methods' => 'POST', |
| 147 |
'callback' => array( $this, 'template_page_action' ), |
| 148 |
'permission_callback' => function () { |
| 149 |
return current_user_can( 'manage_options' ); |
| 150 |
}, |
| 151 |
'args' => array(), |
| 152 |
), |
| 153 |
) |
| 154 |
); |
| 155 |
} |
| 156 |
|
| 157 |
/** |
| 158 |
* Save addon/blocks on/off data. |
| 159 |
* |
| 160 |
* @since v.3.0.0 |
| 161 |
* @param OBJECT $server The REST server request object. |
| 162 |
* @return ARRAY. Inserted post URL and status. |
| 163 |
*/ |
| 164 |
public function addon_block_action( $server ) { |
| 165 |
$post = $server->get_params(); |
| 166 |
$addon_name = isset( $post['key'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['key'] ) : ''; |
| 167 |
$addon_value = isset( $post['value'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['value'] ) : ''; |
| 168 |
if ( $addon_name ) { |
| 169 |
$addon_data = ultimate_post()->get_setting(); |
| 170 |
$addon_data[ $addon_name ] = $addon_value; |
| 171 |
$GLOBALS['ultp_settings'][ $addon_name ] = $addon_value; |
| 172 |
update_option( 'ultp_options', $addon_data ); |
| 173 |
} |
| 174 |
return array( |
| 175 |
'success' => true, |
| 176 |
'message' => ( $addon_value == 'true' || $addon_value == 'false' ) ? ( $addon_value == 'true' ? __( 'The addon has been enabled.', 'ultimate-post' ) : __( 'The addon has been disabled.', 'ultimate-post' ) ) : ( $addon_value == 'yes' ? __( 'The block has been enabled.', 'ultimate-post' ) : __( 'The block has been disabled.', 'ultimate-post' ) ), |
| 177 |
); |
| 178 |
} |
| 179 |
|
| 180 |
/** |
| 181 |
* Save settings of option panel. |
| 182 |
* |
| 183 |
* @since v.3.0.0 |
| 184 |
* @param OBJECT $server The REST server request object. |
| 185 |
* @return OBJECT REST response object. |
| 186 |
*/ |
| 187 |
public function save_plugin_settings( $server ) { |
| 188 |
$post = $server->get_params(); |
| 189 |
$data = ultimate_post()->ultp_rest_sanitize_params( $post['settings'] ); |
| 190 |
if ( count( $data ) > 0 ) { |
| 191 |
foreach ( $data as $key => $val ) { |
| 192 |
ultimate_post()->set_setting( $key, $val ); |
| 193 |
} |
| 194 |
do_action( 'ultimate_post_after_setting_save' ); |
| 195 |
} |
| 196 |
return rest_ensure_response( |
| 197 |
array( |
| 198 |
'success' => true, |
| 199 |
'message' => __( 'You have successfully saved the settings data.', 'ultimate-post' ), |
| 200 |
'wishListArr' => wp_json_encode( $data ), |
| 201 |
) |
| 202 |
); |
| 203 |
} |
| 204 |
|
| 205 |
/** |
| 206 |
* Get all settings of option panel. |
| 207 |
* |
| 208 |
* @since v.3.0.0 |
| 209 |
* @param OBJECT $server The REST server request object. |
| 210 |
* @return OBJECT REST response object. |
| 211 |
*/ |
| 212 |
public function get_all_settings( $server ) { |
| 213 |
return rest_ensure_response( |
| 214 |
array( |
| 215 |
'success' => true, |
| 216 |
'settings' => ultimate_post()->get_setting(), |
| 217 |
) |
| 218 |
); |
| 219 |
} |
| 220 |
|
| 221 |
/** |
| 222 |
* Saved template & custom font actions. |
| 223 |
* |
| 224 |
* @since v.3.0.0 |
| 225 |
* @param OBJECT $server The REST server request object. |
| 226 |
* @return ARRAY Inserted post URL and status. |
| 227 |
*/ |
| 228 |
public function get_dashboard_callback( $server ) { |
| 229 |
$post = $server->get_params(); |
| 230 |
$request_type = isset( $post['type'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['type'] ) : ''; |
| 231 |
$pType = isset( $post['pType'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['pType'] ) : ''; |
| 232 |
switch ( $request_type ) { |
| 233 |
|
| 234 |
case 'saved_templates': |
| 235 |
$post_per_page = 10; |
| 236 |
$data = array(); |
| 237 |
$args = array( |
| 238 |
'post_type' => $pType, |
| 239 |
'post_status' => array( 'publish', 'draft' ), |
| 240 |
'posts_per_page' => $post_per_page, |
| 241 |
'paged' => isset( $post['pages'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['pages'] ) : 1, |
| 242 |
); |
| 243 |
|
| 244 |
if ( isset( $post['search'] ) ) { |
| 245 |
$args['paged'] = 1; |
| 246 |
$args['s'] = ultimate_post()->ultp_rest_sanitize_params( $post['search'] ); |
| 247 |
} |
| 248 |
|
| 249 |
$the_query = new \WP_Query( $args ); |
| 250 |
if ( $the_query->have_posts() ) { |
| 251 |
while ( $the_query->have_posts() ) { |
| 252 |
$the_query->the_post(); |
| 253 |
$final = array( |
| 254 |
'id' => get_the_ID(), |
| 255 |
'title' => get_the_title(), |
| 256 |
'date' => get_the_modified_date( 'Y/m/d h:i a' ), |
| 257 |
'status' => get_post_status(), |
| 258 |
'edit' => get_edit_post_link(), |
| 259 |
); |
| 260 |
|
| 261 |
if ( $pType == 'ultp_custom_font' ) { |
| 262 |
$final = array_merge( |
| 263 |
$final, |
| 264 |
array( |
| 265 |
'woff' => false, |
| 266 |
'woff2' => false, |
| 267 |
'ttf' => false, |
| 268 |
'svg' => false, |
| 269 |
'eot' => false, |
| 270 |
) |
| 271 |
); |
| 272 |
$settings = get_post_meta( get_the_ID(), '__font_settings', true ); |
| 273 |
foreach ( $settings as $key => $value ) { |
| 274 |
if ( $value['ttf'] ) { |
| 275 |
$final['ttf'] = true; |
| 276 |
} |
| 277 |
if ( $value['svg'] ) { |
| 278 |
$final['svg'] = true; |
| 279 |
} |
| 280 |
if ( $value['eot'] ) { |
| 281 |
$final['eot'] = true; |
| 282 |
} |
| 283 |
if ( $value['woff'] ) { |
| 284 |
$final['woff'] = true; |
| 285 |
} |
| 286 |
if ( $value['woff2'] ) { |
| 287 |
$final['woff2'] = true; |
| 288 |
} |
| 289 |
} |
| 290 |
$final['font_settings'] = $settings; |
| 291 |
} |
| 292 |
$data[] = $final; |
| 293 |
} |
| 294 |
} |
| 295 |
wp_reset_postdata(); |
| 296 |
return array( |
| 297 |
'success' => true, |
| 298 |
'data' => $data, |
| 299 |
'new' => ( $pType == 'ultp_custom_font' ? admin_url( 'post-new.php?post_type=ultp_custom_font' ) : admin_url( 'post-new.php?post_type=ultp_templates' ) ), |
| 300 |
'found' => $the_query->found_posts, |
| 301 |
'pages' => $the_query->max_num_pages, |
| 302 |
); |
| 303 |
break; |
| 304 |
|
| 305 |
case 'action_draft': |
| 306 |
case 'action_publish': |
| 307 |
if ( isset( $post['ids'] ) && is_array( $post['ids'] ) ) { |
| 308 |
$post_ids = ultimate_post()->ultp_rest_sanitize_params( $post['ids'] ); |
| 309 |
foreach ( $post_ids as $id ) { |
| 310 |
wp_update_post( |
| 311 |
array( |
| 312 |
'ID' => $id, |
| 313 |
'post_status' => str_replace( 'action_', '', $request_type ), |
| 314 |
) |
| 315 |
); |
| 316 |
} |
| 317 |
return array( |
| 318 |
'success' => true, |
| 319 |
'message' => __( 'Status changed for selected items.', 'ultimate-post' ), |
| 320 |
); |
| 321 |
} |
| 322 |
break; |
| 323 |
|
| 324 |
case 'action_delete': |
| 325 |
if ( isset( $post['ids'] ) && is_array( $post['ids'] ) ) { |
| 326 |
$post_ids = ultimate_post()->ultp_rest_sanitize_params( $post['ids'] ); |
| 327 |
foreach ( $post_ids as $id ) { |
| 328 |
wp_delete_post( $id, true ); |
| 329 |
} |
| 330 |
} |
| 331 |
return array( |
| 332 |
'success' => true, |
| 333 |
'message' => __( 'The selected item is deleted.', 'ultimate-post' ), |
| 334 |
); |
| 335 |
|
| 336 |
case 'support_data': |
| 337 |
$user_info = get_userdata( get_current_user_id() ); |
| 338 |
$name = $user_info->first_name . ( $user_info->last_name ? ' ' . $user_info->last_name : '' ); |
| 339 |
return array( |
| 340 |
'success' => true, |
| 341 |
'data' => array( |
| 342 |
'name' => $name ? $name : $user_info->user_login, |
| 343 |
'email' => $user_info->user_email, |
| 344 |
), |
| 345 |
); |
| 346 |
|
| 347 |
case 'support_action': |
| 348 |
$api_params = array( |
| 349 |
'user_name' => isset( $post['name'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['name'] ) : '', |
| 350 |
'user_email' => isset( $post['email'] ) ? sanitize_email( $post['email'] ) : '', |
| 351 |
'subject' => isset( $post['subject'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['subject'] ) : '', |
| 352 |
'desc' => isset( $post['desc'] ) ? sanitize_textarea_field( $post['desc'] ) : '', |
| 353 |
); |
| 354 |
$response = wp_remote_get( |
| 355 |
'https://wpxpo.com/wp-json/v2/support_mail', |
| 356 |
array( |
| 357 |
'method' => 'POST', |
| 358 |
'timeout' => 120, |
| 359 |
'body' => $api_params, |
| 360 |
) |
| 361 |
); |
| 362 |
$response_data = json_decode( $response['body'] ); |
| 363 |
$success = ( isset( $response_data->success ) && $response_data->success ) ? true : false; |
| 364 |
|
| 365 |
return array( |
| 366 |
'success' => $success, |
| 367 |
'message' => $success ? __( 'New Support Ticket has been Created.', 'ultimate-post' ) : __( 'New Support Ticket is not Created Due to Some Issues.', 'ultimate-post' ), |
| 368 |
); |
| 369 |
break; |
| 370 |
|
| 371 |
case 'helloBarAction': |
| 372 |
set_transient( 'ultp_helloBar' . ULTP_HELLOBAR, 'hide', 1296000 ); |
| 373 |
return array( |
| 374 |
'success' => true, |
| 375 |
'message' => __( 'Notice is removed.', 'ultimate-post' ), |
| 376 |
); |
| 377 |
break; |
| 378 |
case 'generalDiscountAction': |
| 379 |
set_transient( 'ultp_generalDiscount', 'hide', 60 * DAY_IN_SECONDS ); |
| 380 |
return array( |
| 381 |
'success' => true, |
| 382 |
'message' => __( 'Notice is removed.', 'ultimate-post' ), |
| 383 |
); |
| 384 |
break; |
| 385 |
|
| 386 |
default: |
| 387 |
// code... |
| 388 |
break; |
| 389 |
} |
| 390 |
} |
| 391 |
|
| 392 |
/** |
| 393 |
* Wizard site status callback. |
| 394 |
* |
| 395 |
* @since v.3.0.0 |
| 396 |
* @return OBJECT. REST response object. |
| 397 |
*/ |
| 398 |
public static function wizard_site_status_callback() { |
| 399 |
if ( ! ( isset( $_POST['wpnonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST['wpnonce'] ) ), 'ultp-nonce' ) ) ) { |
| 400 |
die(); |
| 401 |
} |
| 402 |
if ( isset( $_POST['siteType'] ) ) { |
| 403 |
$site_type = ultimate_post()->ultp_rest_sanitize_params( $_POST['siteType'] ); |
| 404 |
update_option( '__ultp_site_type', $site_type ); |
| 405 |
} |
| 406 |
DurbinClient::send( DurbinClient::WIZARD_ACTION ); |
| 407 |
|
| 408 |
return rest_ensure_response( array( 'success' => true ) ); |
| 409 |
} |
| 410 |
|
| 411 |
/** |
| 412 |
* Send plugin data when initial setup. |
| 413 |
* |
| 414 |
* @since v.2.8.1 |
| 415 |
* @param OBJECT $server The REST server request object. |
| 416 |
*/ |
| 417 |
public function send_initial_plugin_data_callback( $server ) { |
| 418 |
$post = $server->get_params(); |
| 419 |
if ( ! ( isset( $post['wpnonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $post['wpnonce'] ) ), 'ultp-nonce' ) ) ) { |
| 420 |
die(); |
| 421 |
} |
| 422 |
|
| 423 |
$site = isset( $post['site'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['site'] ) : ''; |
| 424 |
|
| 425 |
DurbinClient::send( DurbinClient::WIZARD_ACTION ); |
| 426 |
} |
| 427 |
|
| 428 |
/** |
| 429 |
* Initial plugin setup complete callback. |
| 430 |
* |
| 431 |
* @since v.2.8.1 |
| 432 |
* @param OBJECT $server The REST server request object. |
| 433 |
* @return OBJECT REST response object. |
| 434 |
*/ |
| 435 |
public static function initial_setup_complete_callback( $server ) { |
| 436 |
$post = $server->get_params(); |
| 437 |
if ( ! ( isset( $post['wpnonce'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $post['wpnonce'] ) ), 'ultp-nonce' ) ) ) { |
| 438 |
die(); |
| 439 |
} |
| 440 |
ultimate_post()->set_setting( 'init_setup', 'yes' ); |
| 441 |
return rest_ensure_response( |
| 442 |
array( |
| 443 |
'success' => true, |
| 444 |
'redirect' => admin_url( 'admin.php?page=ultp-settings#home' ), |
| 445 |
) |
| 446 |
); |
| 447 |
} |
| 448 |
|
| 449 |
/** |
| 450 |
* Delete template page and handle builder, saved templates, custom font actions. |
| 451 |
* |
| 452 |
* @since v.2.6.6 Shifted from RequestAPI since v4.0.3 |
| 453 |
* @param OBJECT $server The REST server request object. |
| 454 |
* @return ARRAY Success message. |
| 455 |
*/ |
| 456 |
public function template_page_action( $server ) { |
| 457 |
$post = $server->get_params(); |
| 458 |
$message = ''; |
| 459 |
$s_Type = isset( $post['type'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['type'] ) : ''; |
| 460 |
$s_id = isset( $post['id'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['id'] ) : ''; |
| 461 |
$s_status = isset( $post['status'] ) ? ultimate_post()->ultp_rest_sanitize_params( $post['status'] ) : ''; |
| 462 |
|
| 463 |
if ( $s_Type && $s_id ) { |
| 464 |
if ( $s_Type == 'delete' ) { |
| 465 |
if ( isset( $post['section'] ) && $post['section'] == 'builder' ) { // phpcs:ignore WordPress.Security |
| 466 |
$conditions = get_option( 'ultp_builder_conditions', array() ); |
| 467 |
$builder_type = get_post_meta( $s_id, '__ultp_builder_type', true ); |
| 468 |
if ( isset( $conditions[ $builder_type ][ $s_id ] ) ) { |
| 469 |
unset( $conditions[ $builder_type ][ $s_id ] ); |
| 470 |
update_option( 'ultp_builder_conditions', $conditions ); |
| 471 |
} |
| 472 |
} |
| 473 |
wp_delete_post( $s_id, true ); |
| 474 |
$message = __( 'Template has been deleted.', 'ultimate-post' ); |
| 475 |
} elseif ( $s_Type == 'duplicate' ) { |
| 476 |
$fromBuilder = ( isset( $post['section'] ) && $post['section'] == 'builder' ) ? true : false; // phpcs:ignore WordPress.Security |
| 477 |
$post_id = $s_id; |
| 478 |
$r_post = get_post( $post_id ); |
| 479 |
$current_user = wp_get_current_user(); |
| 480 |
$new_post_author = $current_user->ID; |
| 481 |
if ( isset( $r_post ) && $r_post != null ) { |
| 482 |
$args = array( |
| 483 |
'post_author' => $new_post_author, |
| 484 |
'post_content' => str_replace( array( 'u0022', 'u002d' ), array( '\u0022', '\u002d' ), $r_post->post_content ), |
| 485 |
'post_excerpt' => $r_post->post_excerpt, |
| 486 |
'post_name' => $r_post->post_name, |
| 487 |
'post_status' => $fromBuilder ? 'draft' : $r_post->post_status, |
| 488 |
'post_title' => $r_post->post_title, |
| 489 |
'post_type' => $r_post->post_type, |
| 490 |
); |
| 491 |
} |
| 492 |
$new_post_id = wp_insert_post( $args ); |
| 493 |
|
| 494 |
$css = get_post_meta( $post_id, '_ultp_css', true ); |
| 495 |
update_post_meta( $new_post_id, '_ultp_css', $css ); |
| 496 |
update_post_meta( $new_post_id, '_ultp_active', 'yes' ); |
| 497 |
|
| 498 |
if ( $fromBuilder ) { |
| 499 |
$type = get_post_meta( $post_id, '__ultp_builder_type', true ); |
| 500 |
update_post_meta( $new_post_id, '__ultp_builder_type', $type ); |
| 501 |
|
| 502 |
$width = get_post_meta( $post_id, '__container_width', true ); |
| 503 |
update_post_meta( $new_post_id, '__container_width', $width ); |
| 504 |
|
| 505 |
$sidebar = get_post_meta( $post_id, '__builder_sidebar', true ); |
| 506 |
update_post_meta( $new_post_id, '__builder_sidebar', $sidebar ); |
| 507 |
|
| 508 |
$widget_area = get_post_meta( $post_id, '__builder_widget_area', true ); |
| 509 |
update_post_meta( $new_post_id, '__builder_widget_area', $widget_area ); |
| 510 |
|
| 511 |
$conditions = get_option( 'ultp_builder_conditions', array() ); |
| 512 |
if ( $conditions && $type ) { |
| 513 |
if ( isset( $conditions[ $type ][ $post_id ] ) ) { |
| 514 |
$conditions[ $type ][ $new_post_id ] = $conditions[ $type ][ $post_id ]; |
| 515 |
update_option( 'ultp_builder_conditions', $conditions ); |
| 516 |
} |
| 517 |
} |
| 518 |
} |
| 519 |
$message = __( 'Template has been duplicated.', 'ultimate-post' ); |
| 520 |
} elseif ( $s_Type == 'status' ) { |
| 521 |
if ( $s_status ) { |
| 522 |
wp_update_post( |
| 523 |
array( |
| 524 |
'ID' => $s_id, |
| 525 |
'post_status' => $s_status, |
| 526 |
) |
| 527 |
); |
| 528 |
} |
| 529 |
$message = __( 'Status has been changed.', 'ultimate-post' ); |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
return array( |
| 534 |
'success' => true, |
| 535 |
'message' => $message, |
| 536 |
); |
| 537 |
} |
| 538 |
} |
| 539 |
|