Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 2ded0f3

Browse files
update framework
1 parent d24ffe2 commit 2ded0f3

File tree

4 files changed

+38
-17
lines changed

4 files changed

+38
-17
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/installed.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,17 @@
371371
},
372372
{
373373
"name": "wp-content-framework/custom_post",
374-
"version": "v0.0.35",
375-
"version_normalized": "0.0.35.0",
374+
"version": "v0.0.36",
375+
"version_normalized": "0.0.36.0",
376376
"source": {
377377
"type": "git",
378378
"url": "https://github.com/wp-content-framework/custom_post.git",
379-
"reference": "f2f3e1df994df6418df1fd237624738af083586c"
379+
"reference": "b6a852cab7810bdffb965cb5e59d71515d634992"
380380
},
381381
"dist": {
382382
"type": "zip",
383-
"url": "https://api.github.com/repos/wp-content-framework/custom_post/zipball/f2f3e1df994df6418df1fd237624738af083586c",
384-
"reference": "f2f3e1df994df6418df1fd237624738af083586c",
383+
"url": "https://api.github.com/repos/wp-content-framework/custom_post/zipball/b6a852cab7810bdffb965cb5e59d71515d634992",
384+
"reference": "b6a852cab7810bdffb965cb5e59d71515d634992",
385385
"shasum": ""
386386
},
387387
"require": {
@@ -395,7 +395,7 @@
395395
"phake/phake": "~2.0",
396396
"phpunit/phpunit": "~5.7"
397397
},
398-
"time": "2019-05-18T08:03:56+00:00",
398+
"time": "2019-05-26T12:38:53+00:00",
399399
"type": "library",
400400
"installation-source": "dist",
401401
"notification-url": "https://packagist.org/downloads/",

vendor/wp-content-framework/custom_post/src/interfaces/custom_post.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* WP_Framework_Custom_Post Interfaces Custom Post
44
*
5-
* @version 0.0.34
5+
* @version 0.0.36
66
* @author Technote
77
* @copyright Technote All Rights Reserved
88
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2
@@ -359,6 +359,11 @@ public function get_post_type_link();
359359
*/
360360
public function get_edit_post_link( $post_id );
361361

362+
/**
363+
* @return array
364+
*/
365+
public function get_exclude_from_search_post_status();
366+
362367
/**
363368
* @return int
364369
*/

vendor/wp-content-framework/custom_post/src/traits/custom_post.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* WP_Framework_Custom_Post Traits Custom Post
44
*
5-
* @version 0.0.35
5+
* @version 0.0.36
66
* @author Technote
77
* @copyright Technote All Rights Reserved
88
* @license http://www.opensource.org/licenses/gpl-2.0.php GNU General Public License, version 2
@@ -516,7 +516,16 @@ public function setup_posts_orderby( $wp_query ) {
516516
* @return bool
517517
*/
518518
public function is_support_io() {
519-
return $this->compare_wp_version( '4.7', '>=' ) && ! empty( $this->app->get_config( 'io', $this->get_post_type_slug() ) ) && $this->user_can( 'edit_others_posts' );
519+
return $this->compare_wp_version( '4.7', '>=' ) && ! empty( $this->app->get_config( 'io', $this->get_post_type_slug() ) ) && $this->user_can( 'edit_others_posts' ) && $this->is_valid_export_post_status();
520+
}
521+
522+
/**
523+
* @return bool
524+
*/
525+
private function is_valid_export_post_status() {
526+
$post_status = ! empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
527+
528+
return ! in_array( $post_status, $this->get_exclude_from_search_post_status() );
520529
}
521530

522531
/**
@@ -652,10 +661,10 @@ private function export( $post_ids ) {
652661
$export_data = [];
653662
$setting = $this->app->get_config( 'io', $this->get_post_type_slug() );
654663
foreach (
655-
$this->get_list_data( function ( $query ) use ( $post_ids ) {
664+
$this->app->array->get( $this->get_list_data( function ( $query ) use ( $post_ids ) {
656665
/** @var Builder $query */
657666
$query->where_in( 'p.ID', $post_ids );
658-
} )['data'] as $d
667+
}, false ), 'data' ) as $d
659668
) {
660669
$data = [];
661670
if ( in_array( 'title', $this->get_post_type_supports() ) ) {
@@ -1001,7 +1010,7 @@ public function get_list_data( $callback = null, $is_valid = true, $per_page = n
10011010
if ( $is_valid ) {
10021011
$query->where( 'p.post_status', 'publish' );
10031012
}
1004-
$exclude = get_post_stati( [ 'exclude_from_search' => true ] );
1013+
$exclude = $this->get_exclude_from_search_post_status();
10051014
if ( ! empty( $exclude ) ) {
10061015
$query->where_not_in( 'p.post_status', $exclude );
10071016
}
@@ -1588,6 +1597,13 @@ public function get_edit_post_link( $post_id ) {
15881597
return admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
15891598
}
15901599

1600+
/**
1601+
* @return array
1602+
*/
1603+
public function get_exclude_from_search_post_status() {
1604+
return get_post_stati( [ 'exclude_from_search' => true ] );
1605+
}
1606+
15911607
/**
15921608
* @return int
15931609
*/

0 commit comments

Comments
 (0)