public static function addMenuItems() { $menu_label = CRED_NAME; //__( 'CRED','wp-cred' ); $url = CRED_CRED::getNewFormLink(false); //'post-new.php?post_type='.CRED_FORMS_CUSTOM_POST_NAME; $cf_url = CRED_CRED::getNewUserFormLink(false); //'post-new.php?post_type='.CRED_FORMS_CUSTOM_POST_NAME; $cred_index = 'CRED_Forms'; //CRED_VIEWS_PATH2.'/forms.php'; add_menu_page($menu_label, $menu_label, CRED_CAPABILITY, $cred_index, array(__CLASS__, 'FormsMenuPage'), 'none'); // allow 3rd-party menu items to be included do_action('cred_admin_menu_top', $cred_index); add_submenu_page($cred_index, __('Post Forms', 'wp-cred'), __('Post Forms', 'wp-cred'), CRED_CAPABILITY, 'CRED_Forms', array(__CLASS__, 'FormsMenuPage')); add_submenu_page($cred_index, __('New Post Form', 'wp-cred'), __('New Post Form', 'wp-cred'), CRED_CAPABILITY, $url); // CredUserForms add_submenu_page($cred_index, __('User Forms', 'wp-cred'), __('User Forms', 'wp-cred'), CRED_CAPABILITY, 'CRED_User_Forms', array(__CLASS__, 'UserFormsMenuPage')); add_submenu_page($cred_index, __('New User Form', 'wp-cred'), __('New User Form', 'wp-cred'), CRED_CAPABILITY, $cf_url); // allow 3rd-party menu items to be included do_action('cred_admin_menu_after_forms', $cred_index); add_submenu_page($cred_index, __('Custom Fields', 'wp-cred'), __('Custom Fields', 'wp-cred'), CRED_CAPABILITY, 'CRED_Fields', array(__CLASS__, 'FieldsMenuPage')); // allow 3rd-party menu items to be included do_action('cred_admin_menu_after_fields', $cred_index); add_submenu_page($cred_index, __('Settings/Import', 'wp-cred'), __('Settings/Import', 'wp-cred'), CRED_CAPABILITY, 'CRED_Settings', array(__CLASS__, 'SettingsMenuPage')); // allow 3rd-party menu items to be included do_action('cred_admin_menu_after_settings', $cred_index); $hook = add_submenu_page($cred_index, __('Help', 'wp-cred'), __('Help', 'wp-cred'), CRED_CAPABILITY, 'CRED_Help', array(__CLASS__, 'HelpMenuPage')); add_submenu_page($hook, __('Debug information', 'wp-cred'), __('Debug information', 'wp-cred'), CRED_CAPABILITY, 'cred-debug-information', array(__CLASS__, 'DebugMenuPage')); // allow 3rd-party menu items to be included do_action('cred_admin_menu_bottom', $cred_index); CRED_Helper::$screens = array('toplevel_page_CRED_Forms', 'toplevel_page_CRED_User_Forms', 'cred_page_CRED_Forms', 'cred_page_CRED_User_Forms', 'cred_page_CRED_Fields'); foreach (CRED_Helper::$screens as $screen) { add_action("load-" . $screen, array(__CLASS__, 'addScreenOptions')); } }
<?php if (!defined('ABSPATH')) { die('Security check'); } if (!current_user_can(CRED_CAPABILITY)) { die('Access Denied'); } // include needed files $wp_list_table = CRED_Loader::get('TABLE/UserForms'); $doaction = $wp_list_table->current_action(); $url = CRED_CRED::getNewUserFormLink(); $form_id = ''; $form_name = ''; $form_type = ''; $post_type = ''; $form_content = ''; $fields = ''; // Handle Table Action if ($doaction) { $forms_model = CRED_Loader::get('MODEL/UserForms'); switch ($doaction) { case 'delete-selected': if (isset($_REQUEST['checked']) && is_array($_REQUEST['checked'])) { if (check_admin_referer('cred-bulk-selected-action', 'cred-bulk-selected-field')) { foreach ($_REQUEST['checked'] as $form_id) { $forms_model->deleteForm((int) $form_id); } } } break;