本文整理汇总了PHP中FrmAppHelper::json_to_array方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper::json_to_array方法的具体用法?PHP FrmAppHelper::json_to_array怎么用?PHP FrmAppHelper::json_to_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmAppHelper
的用法示例。
在下文中一共展示了FrmAppHelper::json_to_array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
public static function route()
{
$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$vars = false;
if (isset($_POST['frm_compact_fields'])) {
if (!current_user_can('frm_edit_forms') && !current_user_can('administrator')) {
global $frm_settings;
wp_die($frm_settings->admin_permission);
}
$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);
if ('edit' == $action) {
$action = 'update';
}
add_filter('frm_validate_form', array(__CLASS__, 'json_error'));
} else {
$vars = FrmAppHelper::json_to_array($json_vars);
$action = $vars[$action];
}
} else {
$action = FrmAppHelper::get_param($action);
}
if ($action == 'new' or $action == 'new-selection') {
return self::new_form($vars);
} else {
if ($action == 'create') {
return self::create($vars);
} else {
if ($action == 'edit') {
return self::edit($vars);
} else {
if ($action == 'update') {
return self::update($vars);
} else {
if ($action == 'duplicate') {
return self::duplicate();
} else {
if ($action == 'destroy') {
return self::destroy();
} else {
if ($action == 'list-form') {
return self::list_form();
} else {
if ($action == 'settings') {
return self::settings();
} else {
if ($action == 'update_settings') {
return self::update_settings();
} else {
do_action('frm_form_action_' . $action);
if (apply_filters('frm_form_stop_action_' . $action, false)) {
return;
}
$action = FrmAppHelper::get_param('action');
if ($action == -1) {
$action = FrmAppHelper::get_param('action2');
}
if (strpos($action, 'bulk_') === 0) {
if (isset($_GET) and isset($_GET['action'])) {
$_SERVER['REQUEST_URI'] = str_replace('&action=' . $_GET['action'], '', $_SERVER['REQUEST_URI']);
}
if (isset($_GET) and isset($_GET['action2'])) {
$_SERVER['REQUEST_URI'] = str_replace('&action=' . $_GET['action2'], '', $_SERVER['REQUEST_URI']);
}
return self::list_form();
} else {
return self::display_forms_list();
}
}
}
}
}
}
}
}
}
}
}
示例2: 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();
}
}