thorization' => 'Bearer YOUR_API_TOKEN',
),
),
)
);
new WPCOM_JSON_API_Update_Post_v1_1_Endpoint(
array(
'description' => 'Restore a post or page from the trash to its previous status.',
'group' => 'posts',
'stat' => 'posts:1:restore',
'min_version' => '1.1',
'max_version' => '1.1',
'method' => 'POST',
'path' => '/sites/%s/posts/%d/restore',
'path_labels' => array(
'$site' => '(int|string) Site ID or domain',
'$post_ID' => '(int) The post ID',
),
'example_request' => 'https://public-api.wordpress.com/rest/v1.1/sites/82974409/posts/$post_ID/restore/',
'example_request_data' => array(
'headers' => array(
'authorization' => 'Bearer YOUR_API_TOKEN',
),
),
)
);
// phpcs:disable PEAR.NamingConventions.ValidClassName.Invalid
/**
* Update post v1.1 endpoint class.
*/
class WPCOM_JSON_API_Update_Post_v1_1_Endpoint extends WPCOM_JSON_API_Post_v1_1_Endpoint {
/**
* WPCOM_JSON_API_Update_Post_v1_1_Endpoint constructor.
*
* @param array $args Args.
*/
public function __construct( $args ) {
parent::__construct( $args );
if ( $this->api->ends_with( $this->path, '/delete' ) ) {
$this->post_object_format['status']['deleted'] = 'The post has been deleted permanently.';
}
}
/**
* Update post API v1.1 callback.
*
* /sites/%s/posts/new -> $blog_id
* /sites/%s/posts/%d -> $blog_id, $post_id
* /sites/%s/posts/%d/delete -> $blog_id, $post_id
* /sites/%s/posts/%d/restore -> $blog_id, $post_id
*
* @param string $path API path.
* @param int $blog_id Blog ID.
* @param int $post_id Post ID.
*
* @return array|bool|WP_Error
*/
public function callback( $path = '', $blog_id = 0, $post_id = 0 ) {
$blog_id = $this->api->switch_to_blog_and_validate_user( $this->api->get_blog_id( $blog_id ) );
if ( is_wp_error( $blog_id ) ) {
return $blog_id;
}
if ( $this->api->ends_with( $path, '/delete' ) ) {
return $this->delete_post( $path, $blog_id, $post_id );
} elseif ( $this->api->ends_with( $path, '/restore' ) ) {
return $this->restore_post( $path, $blog_id, $post_id );
} else {
return $this->write_post( $path, $blog_id, $post_id );
}
}
/**
* Create or update a post.
*
* /sites/%s/posts/new -> $blog_id
* /sites/%s/posts/%d -> $blog_id, $post_id
*
* @param string $path API path.
* @param int $blog_id Blog ID.
* @param int $post_id Post ID.
*/
public function write_post( $path, $blog_id, $post_id ) {
$delete_featured_image = null;
$media_results = array();
$post = null;
global $wpdb;
$new = $this->api->ends_with( $path, '/new' );
$args = $this->query_args();
// unhook publicize, it's hooked again later -- without this, skipping services is impossible.
if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
remove_action( 'save_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ), 100, 2 );
add_action( 'rest_api_inserted_post', array( $GLOBALS['publicize_ui']->publicize, 'async_publicize_post' ) );
if ( $this->should_load_theme_functions( $post_id ) ) {
$this->load_theme_functions();
}
}
if ( $new ) {
$input = $this->input( true );
// 'future' is an alias for 'publish' for now
if ( 'future' === $input['status'] ) {
$input['status'] = 'publish';
}
// default to post.
if ( empty( $input['type'] ) ) {
$input['type'] = 'post';
}
if ( 'revision' === $input['type'] ) {
if ( ! isset( $input['parent'] ) ) {
return new WP_Error( 'invalid_input', 'Invalid request input', 400 );
}
$input['status'] = 'inherit'; // force inherit for revision t
Investing in Commercial Real Estate -
Investing in Commercial Real Estate
Investing in Commercial Real Estate
Are you investing in commercial Real Estate? Investing can be crucial to one’s financial goal. Real Estate provides security. With the help of EJR Group, you can begin building your real estate portfolio. We help navigate the pros and cons of purchasing, redevelopment, repositioning, and development.
Pros
Provide solid and predictable returns on investment over time
Provides a tangible asset
Builds equity
Tax benefits
Availability to leverage
Provide cash flow and more income
Cons
If not researched, unforeseen market situations
Specific market cycles are constantly changing and do not last