| 1 |
<?php |
| 2 |
function presspermit() { |
| 3 |
require_once(__DIR__ . '/classes/PublishPress/Permissions.php'); |
| 4 |
return \PublishPress\Permissions::instance(); |
| 5 |
} |
| 6 |
|
| 7 |
function presspermitPluginPage() |
| 8 |
{ |
| 9 |
static $pp_plugin_page = null; |
| 10 |
|
| 11 |
if (is_null($pp_plugin_page)) { |
| 12 |
$pp_plugin_page = (is_admin() && \PressShack\LibWP::REQUEST_key_match('page', 'presspermit-')) |
| 13 |
? \PressShack\LibWP::REQUEST_key('page') |
| 14 |
: false; |
| 15 |
} |
| 16 |
|
| 17 |
return $pp_plugin_page; |
| 18 |
} |
| 19 |
|
| 20 |
function presspermit_is_preview() { |
| 21 |
global $wp_query; |
| 22 |
|
| 23 |
if (isset($wp_query)) { |
| 24 |
$is_preview = is_preview(); |
| 25 |
} else { |
| 26 |
$is_preview = !\PressShack\LibWP::empty_REQUEST('preview'); |
| 27 |
} |
| 28 |
|
| 29 |
if (!$is_preview) { |
| 30 |
if (defined('ELEMENTOR_VERSION')) { |
| 31 |
$is_preview = !\PressShack\LibWP::empty_REQUEST('elementor-preview'); |
| 32 |
} elseif (defined('ET_CORE')) { |
| 33 |
$is_preview = !\PressShack\LibWP::empty_REQUEST('et_fb'); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
return apply_filters('presspermit_is_preview', $is_preview); |
| 38 |
} |
| 39 |
|
| 40 |
function publishpress_is_post_teaser($post_id = 0) { |
| 41 |
return class_exists('PublishPress\Permissions\Teaser') && \PublishPress\Permissions\Teaser::isTeasedPost($post_id); |
| 42 |
} |
| 43 |
|
| 44 |
function publishpress_is_archive_teaser() { |
| 45 |
return class_exists('PublishPress\Permissions\Teaser') && \PublishPress\Permissions\Teaser::isArchiveTeaser(); |
| 46 |
} |
| 47 |
|