-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfunctions.php
More file actions
82 lines (69 loc) · 2.18 KB
/
Copy pathfunctions.php
File metadata and controls
82 lines (69 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
function presspermit() {
require_once(__DIR__ . '/classes/PublishPress/Permissions.php');
return \PublishPress\Permissions::instance();
}
/**
* Enqueue shared admin behavior.
*
* Dynamic values are exposed by the rendering PHP as data attributes. Keeping
* executable code in this file makes CSP enforcement and browser debugging
* straightforward.
*/
function presspermit_enqueue_admin_script()
{
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
wp_enqueue_script(
'presspermit-admin',
plugins_url("common/js/admin{$suffix}.js", __FILE__),
['jquery'],
PRESSPERMIT_VERSION,
true
);
}
/**
* Enqueue shared front-end behavior.
*/
function presspermit_enqueue_front_script()
{
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
wp_enqueue_script(
'presspermit-front',
plugins_url("common/js/frontend{$suffix}.js", __FILE__),
[],
PRESSPERMIT_VERSION,
true
);
}
function presspermitPluginPage()
{
static $pp_plugin_page = null;
if (is_null($pp_plugin_page)) {
$pp_plugin_page = (is_admin() && \PressShack\LibWP::REQUEST_key_match('page', 'presspermit-'))
? \PressShack\LibWP::REQUEST_key('page')
: false;
}
return $pp_plugin_page;
}
function presspermit_is_preview() {
global $wp_query;
if (isset($wp_query)) {
$is_preview = is_preview();
} else {
$is_preview = !\PressShack\LibWP::empty_REQUEST('preview');
}
if (!$is_preview) {
if (defined('ELEMENTOR_VERSION')) {
$is_preview = !\PressShack\LibWP::empty_REQUEST('elementor-preview');
} elseif (defined('ET_CORE')) {
$is_preview = !\PressShack\LibWP::empty_REQUEST('et_fb');
}
}
return apply_filters('presspermit_is_preview', $is_preview);
}
function publishpress_is_post_teaser($post_id = 0) {
return class_exists('PublishPress\Permissions\Teaser') && \PublishPress\Permissions\Teaser::isTeasedPost($post_id);
}
function publishpress_is_archive_teaser() {
return class_exists('PublishPress\Permissions\Teaser') && \PublishPress\Permissions\Teaser::isArchiveTeaser();
}