本文整理汇总了PHP中FrmForm::get_admin_params方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmForm::get_admin_params方法的具体用法?PHP FrmForm::get_admin_params怎么用?PHP FrmForm::get_admin_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmForm
的用法示例。
在下文中一共展示了FrmForm::get_admin_params方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy_all
public static function destroy_all()
{
if (!current_user_can('frm_delete_entries')) {
$frm_settings = FrmAppHelper::get_settings();
wp_die($frm_settings->admin_permission);
}
global $wpdb;
$params = FrmForm::get_admin_params();
$message = '';
$errors = array();
$form_id = (int) $params['form'];
if ($form_id) {
$entry_ids = FrmDb::get_col('frm_items', array('form_id' => $form_id));
$action = FrmFormAction::get_action_for_form($form_id, 'wppost', 1);
if ($action) {
// this action takes a while, so only trigger it if there are posts to delete
foreach ($entry_ids as $entry_id) {
do_action('frm_before_destroy_entry', $entry_id);
unset($entry_id);
}
}
$wpdb->query($wpdb->prepare("DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id));
$results = $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id));
if ($results) {
$message = __('Entries were Successfully Destroyed', 'formidable');
}
} else {
$errors = __('No entries were specified', 'formidable');
}
self::display_list($message, $errors);
}
示例2: bulk_actions
public static function bulk_actions($action = 'list-form')
{
$params = FrmForm::get_admin_params();
$errors = array();
$bulkaction = '-1';
if ($action == 'list-form') {
if ($_REQUEST['bulkaction'] != '-1') {
$bulkaction = sanitize_text_field($_REQUEST['bulkaction']);
} else {
if ($_POST['bulkaction2'] != '-1') {
$bulkaction = sanitize_text_field($_REQUEST['bulkaction2']);
}
}
} else {
$bulkaction = str_replace('bulk_', '', $action);
}
$items = FrmAppHelper::get_param('item-action', '');
if (empty($items)) {
$errors[] = __('No entries were specified', 'formidable');
} else {
$frm_settings = FrmAppHelper::get_settings();
if (!is_array($items)) {
$items = explode(',', $items);
}
if ($bulkaction == 'delete') {
if (!current_user_can('frm_delete_entries')) {
$errors[] = $frm_settings->admin_permission;
} else {
if (is_array($items)) {
foreach ($items as $item_id) {
FrmEntry::destroy($item_id);
}
}
}
} else {
if ($bulkaction == 'csv') {
FrmAppHelper::permission_check('frm_view_entries');
$form_id = $params['form'];
if (!$form_id) {
$form = FrmForm::get_published_forms(array(), 1);
if (!empty($form)) {
$form_id = $form->id;
} else {
$errors[] = __('No form was found', 'formidable');
}
}
if ($form_id && is_array($items)) {
echo '<script type="text/javascript">window.onload=function(){location.href="' . esc_url_raw(admin_url('admin-ajax.php') . '?form=' . $form_id . '&action=frm_entries_csv&item_id=' . implode(',', $items)) . '";}</script>';
}
}
}
}
FrmEntriesController::display_list('', $errors);
}