本文整理汇总了PHP中DUP_Util::CheckPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP DUP_Util::CheckPermissions方法的具体用法?PHP DUP_Util::CheckPermissions怎么用?PHP DUP_Util::CheckPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DUP_Util
的用法示例。
在下文中一共展示了DUP_Util::CheckPermissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: duplicator_package_delete
/**
* DUPLICATOR_PACKAGE_DELETE
* Deletes the files and database record entries
*
* @return json A json message about the action.
* Use console.log to debug from client
*/
function duplicator_package_delete()
{
DUP_Util::CheckPermissions('export');
check_ajax_referer('package_list', 'nonce');
try {
global $wpdb;
$json = array();
$post = stripslashes_deep($_POST);
$tblName = $wpdb->prefix . 'duplicator_packages';
$postIDs = isset($post['duplicator_delid']) ? $post['duplicator_delid'] : null;
$list = explode(",", $postIDs);
$delCount = 0;
if ($postIDs != null) {
foreach ($list as $id) {
$getResult = $wpdb->get_results($wpdb->prepare("SELECT name, hash FROM `{$tblName}` WHERE id = %d", $id), ARRAY_A);
if ($getResult) {
$row = $getResult[0];
$nameHash = "{$row['name']}_{$row['hash']}";
$delResult = $wpdb->query($wpdb->prepare("DELETE FROM `{$tblName}` WHERE id = %d", $id));
if ($delResult != 0) {
//Perms
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"), 0644);
@chmod(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"), 0644);
//Remove
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_database.sql"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_installer.php"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_archive.zip"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_database.sql"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_installer.php"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}_scan.json"));
@unlink(DUP_Util::SafePath(DUPLICATOR_SSDIR_PATH . "/{$nameHash}.log"));
//Unfinished Zip files
$tmpZip = DUPLICATOR_SSDIR_PATH_TMP . "/{$nameHash}_archive.zip.*";
if ($tmpZip !== false) {
array_map('unlink', glob($tmpZip));
}
@unlink(DUP_Util::SafePath());
$delCount++;
}
}
}
}
} catch (Exception $e) {
$json['error'] = "{$e}";
die(json_encode($json));
}
$json['ids'] = "{$postIDs}";
$json['removed'] = $delCount;
die(json_encode($json));
}
示例2: SaveViewStateByPost
/**
* Saves the state of a UI element via post params
* @return json result string
* <code>
* //JavaScript Ajax Request
* Duplicator.UI.SaveViewStateByPost('dup-pack-archive-panel', 1);
*
* //Call PHP Code
* $view_state = DUP_UI::GetViewStateValue('dup-pack-archive-panel');
* $ui_css_archive = ($view_state == 1) ? 'display:block' : 'display:none';
* </code>
*/
public static function SaveViewStateByPost()
{
DUP_Util::CheckPermissions('read');
$post = stripslashes_deep($_POST);
$key = esc_html($post['key']);
$value = esc_html($post['value']);
$success = self::SaveViewState($key, $value);
//Show Results as JSON
$json = array();
$json['key'] = $key;
$json['value'] = $value;
$json['update-success'] = $success;
die(json_encode($json));
}
示例3: isset
<?php
DUP_Util::CheckPermissions('manage_options');
global $wpdb;
//COMMON HEADER DISPLAY
require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'general';
?>
<style>
</style>
<div class="wrap">
<?php
duplicator_header(__("Settings", 'wpduplicator'));
?>
<!--h2 class="nav-tab-wrapper">
<a href="?page=duplicator-settings&tab=general" class="nav-tab <?php
echo $current_tab == 'general' ? 'nav-tab-active' : '';
?>
"> <?php
_e('General', 'wpduplicator');
?>
</a>
</h2-->
<?php
示例4: rgba
<?php
DUP_Util::CheckPermissions('read');
require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
?>
<style>
/*================================================
PAGE-SUPPORT:*/
div.dup-pro-area {
padding:10px 70px; max-width:750px; width:90%; margin:auto; text-align: center;
background: #fff; border-radius:20px;
box-shadow: inset 0px 0px 67px 20px rgba(241,241,241,1);
}
div.dup-compare-area {width:400px; float:left; border:1px solid #dfdfdf; border-radius:4px; margin:10px; line-height:18px;box-shadow: 0 8px 6px -6px #ccc;}
div.feature {background: #fff; padding:15px; margin: 2px; text-align: center; min-height: 20px}
div.feature a {font-size:18px; font-weight: bold;}
div.dup-compare-area div.feature div.info {display:none; padding:7px 7px 5px 7px; font-style: italic; color: #555; font-size: 14px}
div.dup-gopro-header {text-align: center; margin: 5px 0 15px 0; font-size:18px; line-height: 30px}
div.dup-gopro-header b {font-size: 35px}
a.dup-check-it-btn {box-shadow: 5px 5px 5px 0px #999 !important; font-size: 20px !important; height:45px !important; padding:7px 30px 0 30px !important;}
#comparison-table { margin-top:25px; border-spacing: 0px; width: 100%}
#comparison-table th { color: #E21906;}
#comparison-table td, #comparison-table th { font-size: 1.2rem; padding: 12px; }
#comparison-table .feature-column { text-align: left; width: 46%}
#comparison-table .check-column { text-align: center; width: 27% }
#comparison-table tr:nth-child(2n+2) {background-color: #f6f6f6; }
</style>
<script type="text/javascript">var switchTo5x = true;</script>
示例5: isset
<?php
DUP_Util::CheckPermissions('export');
global $wpdb;
//COMMON HEADER DISPLAY
require_once DUPLICATOR_PLUGIN_PATH . '/views/javascript.php';
require_once DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php';
$current_tab = isset($_REQUEST['tab']) ? esc_html($_REQUEST['tab']) : 'list';
?>
<style>
//TOOLBAR TABLE
table#dup-toolbar td {padding:0px; white-space:nowrap;}
table#dup-toolbar td.dup-toolbar-btns {width:100%; text-align: right; vertical-align: bottom}
table#dup-toolbar td.dup-toolbar-btns a {font-size:16px}
table#dup-toolbar td.dup-toolbar-btns span {font-size:16px; font-weight: bold}
table#dup-toolbar {width:100%; border:0px solid red; padding: 0; margin:0 0 10px 0; height: 35px}
/*WIZARD TABS */
div#dup-wiz {padding:0px; margin:0; }
div#dup-wiz-steps {margin:10px 0px 0px 10px; padding:0px; clear:both; font-size:12px; min-width:350px;}
div#dup-wiz-title {padding:2px 0px 0px 0px; font-size:18px;}
div#dup-wiz-steps a span {font-size:10px}
/* wiz-steps numbers */
#dup-wiz span {display:block;float:left; text-align:center; width:14px; margin:4px 5px 0px 0px; line-height:13px; color:#ccc; border:1px solid #CCCCCC; border-radius:5px; }
/* wiz-steps default*/
#dup-wiz a { position:relative; display:block; width:auto; min-width:55px; height:25px; margin-right:8px; padding:0px 10px 0px 10px; float:left; line-height:24px; color:#000; background:#E4E4E4; border-radius:5px }
/* wiz-steps active*/
#dup-wiz .active-step a {color:#fff; background:#BBBBBB;}
#dup-wiz .active-step span {color:#fff; border:1px solid #fff;}
/* wiz-steps completed */