| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin boot |
| 4 |
* |
| 5 |
* @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv |
| 6 |
* |
| 7 |
* @copyright Webcraftic 25.05.2017 |
| 8 |
*/ |
| 9 |
|
| 10 |
// Exit if accessed directly |
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Получает список отключенны� |
| 17 |
типов записей |
| 18 |
* |
| 19 |
* @return array|bool|mixed|void |
| 20 |
*/ |
| 21 |
function wbcr_cmp_get_disabled_post_types() { |
| 22 |
|
| 23 |
$post_types = WCM_Plugin::app()->getPopulateOption( 'disable_comments_for_post_types' ); |
| 24 |
|
| 25 |
if ( WCM_Plugin::app()->getPopulateOption( 'disable_comments', 'enable_comments' ) == 'disable_comments' ) { |
| 26 |
|
| 27 |
$args = [ 'public' => true ]; |
| 28 |
|
| 29 |
if ( WCM_Plugin::app()->isNetworkActive() ) { |
| 30 |
$args['_builtin'] = true; |
| 31 |
} |
| 32 |
|
| 33 |
$all_post_types = get_post_types( $args, 'objects' ); |
| 34 |
|
| 35 |
return array_keys( $all_post_types ); |
| 36 |
} |
| 37 |
|
| 38 |
// Not all extra_post_types might be registered on this particular site |
| 39 |
/*if( $this->networkactive ) { |
| 40 |
foreach( (array) $this->options['extra_post_types'] as $extra ) { |
| 41 |
if( post_type_exists( $extra ) ) { |
| 42 |
$types[] = $extra; |
| 43 |
} |
| 44 |
} |
| 45 |
}*/ |
| 46 |
|
| 47 |
if ( is_array( $post_types ) ) { |
| 48 |
return $post_types; |
| 49 |
} |
| 50 |
|
| 51 |
return explode( ',', $post_types ); |
| 52 |
} |