本文整理汇总了PHP中FrmAppHelper::permission_check方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::permission_check方法的具体用法?PHP FrmAppHelper::permission_check怎么用?PHP FrmAppHelper::permission_check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::permission_check方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public static function show()
{
FrmAppHelper::permission_check('frm_view_reports');
remove_action('frm_form_action_reports', 'FrmStatisticsController::list_reports');
add_filter('frm_form_stop_action_reports', '__return_true');
global $wpdb;
$form = false;
if (isset($_REQUEST['form'])) {
$form = FrmForm::getOne($_REQUEST['form']);
}
if (!$form) {
require FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/select.php';
return;
}
$exclude_types = FrmField::no_save_fields();
$exclude_types = array_merge($exclude_types, array('rte', 'textarea', 'file', 'grid', 'signature', 'form', 'table'));
$fields = FrmField::getAll(array('fi.form_id' => (int) $form->id, 'fi.type not' => $exclude_types), 'field_order');
$js = '';
$data = array();
$colors = '#21759B,#EF8C08,#C6C6C6';
$data['time'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors, 'bg_color' => 'transparent'));
$data['month'] = self::get_daily_entries($form, array('is3d' => true, 'colors' => $colors, 'bg_color' => 'transparent', 'width' => '100%'), 'MONTH');
foreach ($fields as $field) {
$this_data = self::graph_shortcode(array('id' => $field->id, 'field' => $field, 'is3d' => true, 'min' => 0, 'colors' => $colors, 'width' => 650, 'bg_color' => 'transparent'));
if (strpos($this_data, 'frm_no_data_graph') === false) {
$data[$field->id] = $this_data;
}
unset($field, $this_data);
}
$entries = FrmDb::get_col($wpdb->prefix . 'frm_items', array('form_id' => $form->id), 'created_at');
// trigger the scripts to load
global $frm_vars;
$frm_vars['forms_loaded'][] = true;
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-statistics/show.php';
}
示例2: get_licenses
public static function get_licenses()
{
FrmAppHelper::permission_check('frm_change_settings');
check_ajax_referer('frm_ajax', 'nonce');
$license = get_option('frmpro-credentials');
if ($license && is_array($license) && isset($license['license'])) {
$url = 'http://formidablepro.com/frm-edd-api/licenses?l=' . urlencode(base64_encode($license['license']));
$licenses = self::send_api_request($url, array('name' => 'frm_api_licence', 'expires' => 60 * 60 * 5));
echo json_encode($licenses);
}
wp_die();
}
示例3: destroy
public static function destroy()
{
FrmAppHelper::permission_check('frm_delete_entries');
$params = FrmForm::get_admin_params();
if (isset($params['keep_post']) && $params['keep_post']) {
//unlink entry from post
global $wpdb;
$wpdb->update($wpdb->prefix . 'frm_items', array('post_id' => ''), array('id' => $params['id']));
}
$message = '';
if (FrmEntry::destroy($params['id'])) {
$message = __('Entry was Successfully Destroyed', 'formidable');
}
self::display_list($message);
}
示例4: route
public static function route()
{
$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$vars = array();
if (isset($_POST['frm_compact_fields'])) {
FrmAppHelper::permission_check('frm_edit_forms');
$json_vars = htmlspecialchars_decode(nl2br(stripslashes(str_replace('"', '\\\\"', $_POST['frm_compact_fields']))));
$json_vars = json_decode($json_vars, true);
if (empty($json_vars)) {
// json decoding failed so we should return an error message
$action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title');
if ('edit' == $action) {
$action = 'update';
}
add_filter('frm_validate_form', 'FrmFormsController::json_error');
} else {
$vars = FrmAppHelper::json_to_array($json_vars);
$action = $vars[$action];
unset($_REQUEST['frm_compact_fields'], $_POST['frm_compact_fields']);
$_REQUEST = array_merge($_REQUEST, $vars);
$_POST = array_merge($_POST, $_REQUEST);
}
} else {
$action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title');
if (isset($_REQUEST['delete_all'])) {
// override the action for this page
$action = 'delete_all';
}
}
add_action('frm_load_form_hooks', 'FrmHooksController::trigger_load_form_hooks');
FrmAppHelper::trigger_hook_load('form');
switch ($action) {
case 'new':
return self::new_form($vars);
case 'create':
case 'edit':
case 'update':
case 'duplicate':
case 'trash':
case 'untrash':
case 'destroy':
case 'delete_all':
case 'settings':
case 'update_settings':
return self::$action($vars);
default:
do_action('frm_form_action_' . $action);
if (apply_filters('frm_form_stop_action_' . $action, false)) {
return;
}
$action = FrmAppHelper::get_param('action', '', 'get', 'sanitize_text_field');
if ($action == -1) {
$action = FrmAppHelper::get_param('action2', '', 'get', 'sanitize_title');
}
if (strpos($action, 'bulk_') === 0) {
FrmAppHelper::remove_get_action();
return self::list_form();
}
return self::display_forms_list();
}
}
示例5: csv
/**
* Export to CSV
* @since 2.0.19
*/
public static function csv($form_id = false, $search = '', $fid = '')
{
FrmAppHelper::permission_check('frm_view_entries');
if (!$form_id) {
$form_id = FrmAppHelper::get_param('form', '', 'get', 'sanitize_text_field');
$search = FrmAppHelper::get_param(isset($_REQUEST['s']) ? 's' : 'search', '', 'get', 'sanitize_text_field');
$fid = FrmAppHelper::get_param('fid', '', 'get', 'sanitize_text_field');
}
if (!ini_get('safe_mode')) {
set_time_limit(0);
//Remove time limit to execute this function
$mem_limit = str_replace('M', '', ini_get('memory_limit'));
if ((int) $mem_limit < 256) {
ini_set('memory_limit', '256M');
}
}
global $wpdb;
$form = FrmForm::getOne($form_id);
$form_id = $form->id;
$form_cols = self::get_fields_for_csv_export($form_id, $form);
$item_id = FrmAppHelper::get_param('item_id', 0, 'get', 'sanitize_text_field');
if (!empty($item_id)) {
$item_id = explode(',', $item_id);
}
$query = array('form_id' => $form_id);
if ($item_id) {
$query['id'] = $item_id;
}
/**
* Allows the query to be changed for fetching the entry ids to include in the export
*
* $query is the array of options to be filtered. It includes form_id, and maybe id (array of entry ids),
* and the search query. This should return an array, but it can be handled as a string as well.
*/
$query = apply_filters('frm_csv_where', $query, compact('form_id', 'search', 'fid', 'item_id'));
$entry_ids = FrmDb::get_col($wpdb->prefix . 'frm_items it', $query);
unset($query);
if (empty($entry_ids)) {
esc_html_e('There are no entries for that form.', 'formidable');
} else {
FrmCSVExportHelper::generate_csv(compact('form', 'entry_ids', 'form_cols'));
}
wp_die();
}
示例6: deactivate
public static function deactivate()
{
FrmAppHelper::permission_check('frm_change_settings');
check_ajax_referer('frm_ajax', 'nonce');
$plugin_slug = sanitize_text_field($_POST['plugin']);
$this_plugin = self::get_addon($plugin_slug);
$license = $this_plugin->get_license();
$response = array('success' => false, 'message' => '');
try {
// $license_data->license will be either "deactivated" or "failed"
$license_data = $this_plugin->send_mothership_request('deactivate_license', $license);
if (is_array($license_data) && $license_data['license'] == 'deactivated') {
$response['success'] = true;
$response['message'] = __('That license was removed successfully', 'formidable');
} else {
$response['message'] = __('There was an error deactivating your license.', 'formidable');
}
} catch (Exception $e) {
$response['message'] = $e->getMessage();
}
$this_plugin->clear_license();
echo json_encode($response);
wp_die();
}
示例7: fill_action
public static function fill_action()
{
FrmAppHelper::permission_check('frm_edit_forms');
check_ajax_referer('frm_ajax', 'nonce');
$action_key = absint($_POST['action_id']);
$action_type = sanitize_text_field($_POST['action_type']);
$action_control = self::get_form_actions($action_type);
if (empty($action_control)) {
wp_die();
}
$form_action = $action_control->get_single_action($action_key);
$values = array();
$form = self::fields_to_values($form_action->menu_order, $values);
include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_action_inside.php';
wp_die();
}
示例8: _logic_row
public static function _logic_row()
{
check_ajax_referer('frm_ajax', 'nonce');
FrmAppHelper::permission_check('frm_edit_forms', 'show');
$meta_name = FrmAppHelper::get_post_param('meta_name', '', 'absint');
$field_id = FrmAppHelper::get_post_param('field_id', '', 'absint');
$form_id = FrmAppHelper::get_post_param('form_id', '', 'absint');
$hide_field = '';
$field = FrmField::getOne($field_id);
$field = FrmFieldsHelper::setup_edit_vars($field);
$form_fields = FrmField::get_all_for_form($form_id);
if (!isset($field['hide_field_cond'][$meta_name])) {
$field['hide_field_cond'][$meta_name] = '==';
}
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/_logic_row.php';
wp_die();
}
示例9: update_order
public static function update_order()
{
FrmAppHelper::permission_check('frm_edit_forms');
check_ajax_referer('frm_ajax', 'nonce');
$fields = FrmAppHelper::get_post_param('frm_field_id');
foreach ((array) $fields as $position => $item) {
FrmField::update(absint($item), array('field_order' => absint($position)));
}
wp_die();
}
示例10: reset_styling
public static function reset_styling()
{
FrmAppHelper::permission_check('frm_change_settings');
check_ajax_referer('frm_ajax', 'nonce');
$frm_style = new FrmStyle();
$defaults = $frm_style->get_defaults();
echo json_encode($defaults);
wp_die();
}
示例11: deauthorize
public static function deauthorize()
{
FrmAppHelper::permission_check('frm_change_settings');
check_ajax_referer('frm_ajax', 'nonce');
delete_option('frmpro-credentials');
delete_option('frmpro-authorized');
delete_site_option('frmpro-credentials');
delete_site_option('frmpro-authorized');
wp_die();
}
示例12: import_csv_entries
public static function import_csv_entries()
{
check_ajax_referer('frm_ajax', 'nonce');
FrmAppHelper::permission_check('frm_create_entries');
$opts = get_option('frm_import_options');
if (!$opts) {
$opts = array();
}
$vars = $_POST;
$file_id = $vars['frm_import_file'];
$current_path = get_attached_file($file_id);
$start_row = isset($opts[$file_id]) ? $opts[$file_id]['imported'] : 1;
$imported = FrmProXMLHelper::import_csv($current_path, $vars['form_id'], $vars['data_array'], 0, $start_row + 1, $vars['csv_del'], $vars['max']);
$opts[$file_id] = array('row' => $vars['row'], 'imported' => $imported);
echo $remaining = (int) $vars['row'] - (int) $imported;
// check if the import is complete
if (!$remaining) {
unset($opts[$file_id]);
// since we are finished with this csv, delete it
wp_delete_attachment($file_id, true);
}
update_option('frm_import_options', $opts);
wp_die();
}