示例#1
0
 protected function is_page($page_name)
 {
     return $page_name == GFForms::get_page();
 }
 /**
  * Loads the screen options for the entry detail page.
  *
  * @since 2.0
  * @access public
  * @static
  * @see GFEntryDetail::add_meta_boxes
  */
 public static function load_screen_options()
 {
     $screen = get_current_screen();
     if (!is_object($screen)) {
         return;
     }
     $page = GFForms::get_page();
     if ($page == 'form_list') {
         $args = array('label' => __('Forms per page', 'gravityforms'), 'default' => 20, 'option' => 'gform_forms_per_page');
         add_screen_option('per_page', $args);
     } elseif (in_array($page, array('entry_detail', 'entry_detail_edit'))) {
         require_once GFCommon::get_base_path() . '/entry_detail.php';
         GFEntryDetail::add_meta_boxes();
     }
 }
 public function restrict_form_list($query)
 {
     $page = GFForms::get_page();
     if (in_array($page, array('form_list', 'form_editor', 'form_settings', 'entry_list', 'export_entry', 'export_form')) && strpos($query, $this->form_from_key) !== false) {
         $query = $this->filter_form_list_gf_pages($query);
         return $query;
     }
     if (is_blog_admin()) {
         // if not admin dashboard - nothing to change
         $uri = trim($_SERVER['REQUEST_URI']);
         $question_pos = strpos($uri, '?');
         if ($question_pos !== false) {
             $uri = substr($uri, 0, $question_pos);
         }
         $uri_len = strlen($uri);
         $compare1 = substr($uri, $uri_len - 19);
         if ($compare1 !== '/wp-admin/index.php') {
             $compare2 = substr($uri, $uri_len - 10);
             if ($compare2 !== '/wp-admin/') {
                 return $query;
             }
         }
         // set filter for dashboard GF widget queries at forms_model.php, v. 1.8.3 get_form_summary(), line # 170
         if (substr(trim($query), 0, 17) === 'SELECT l.form_id,') {
             $query = $this->dashboard_widget_query_injection($query, 'l.form_id', 'GROUP');
         } elseif (substr(trim($query), 0, 17) === 'SELECT id, title,') {
             $query = $this->dashboard_widget_query_injection($query, 'id', 'ORDER');
         }
     }
     return $query;
 }
 public static function is_entry_detail_edit()
 {
     $is_entry_detail_edit = GFForms::get_page() == 'entry_detail_edit';
     return apply_filters('gform_is_entry_detail_edit', $is_entry_detail_edit);
 }
示例#5
0
 /**
  * Returns the markup for the screen options.
  *
  * @since 2.0
  *
  * @param $status
  * @param $args
  *
  * @return string
  */
 public static function get_screen_options_markup($status, $args)
 {
     $return = $status;
     if (!GFForms::get_page() == 'entry_list') {
         return $return;
     }
     $screen_options = self::get_screen_options_values();
     $per_page = $screen_options['per_page'];
     $forms = GFFormsModel::get_forms(null, 'title');
     $form_id = rgget('id');
     if (sizeof($forms) == 0) {
         return '';
     } else {
         if (empty($form_id)) {
             $form_id = $forms[0]->id;
         }
     }
     $form = GFAPI::get_form($form_id);
     $filters = self::get_filter_links($form, false);
     $option_values = self::get_screen_options_values();
     // If the filter is not available for the form then use 'all'
     $selected_filter = 'all';
     foreach ($filters as $filter) {
         if ($option_values['default_filter'] == $filter['id']) {
             $selected_filter = $option_values['default_filter'];
             break;
         }
     }
     $radios_arr = array();
     foreach ($filters as $filter) {
         $id = esc_attr($filter['id']);
         $label = esc_attr($filter['label']);
         $checked = checked($filter['id'], $selected_filter, false);
         $radios_arr[] = sprintf('<input type="radio" name="gform_default_filter" value="%s" id="gform_default_filter_%s" %s /><label for="gform_default_filter_%s">%s</label>', $id, $id, $checked, $id, $label);
     }
     $radios_str = join("\n", $radios_arr);
     $filter_title = esc_html__('Default Filter', 'gravityforms');
     $pagination_title = esc_html__('Pagination', 'gravityforms');
     $entries_label = esc_html__('Number of entries per page:', 'gravityforms');
     $button = get_submit_button(esc_html__('Apply', 'gravityforms'), 'button button-primary', 'screen-options-apply', false);
     $return .= "\r\n\t\t\t<fieldset class='screen-options'>\r\n            <legend>{$filter_title}</legend>\r\n            <div>\r\n\t\t\t\t{$radios_str}\r\n            </div>\r\n            </fieldset>\r\n            <fieldset class='screen-options'>\r\n\t\t\t<h5>{$pagination_title}</h5>\r\n\r\n            \t<label for='gform_per_page%s'>{$entries_label}</label>\r\n            \t<input type='number' step='1' min='1' max='100' class='screen-per-page' name='gform_per_page'\r\n\t\t\t\t\tid='gform_per_page' maxlength='3' value='{$per_page}' />\r\n            \t<input type='hidden' name='wp_screen_options[option]' value='gform_entries_screen_options' />\r\n            \t<input type='hidden' name='wp_screen_options[value]' value='yes' />\r\n\t\t\t</fieldset>\r\n\t\t\t<p class='submit'>\r\n\t\t\t{$button}\r\n\t\t\t</p>";
     return $return;
 }
 public static function is_entry_detail_edit()
 {
     return GFForms::get_page() == 'entry_detail_edit';
 }
/**
 * [gf_notification_attachment_attach_script description]
 * @return null
 */
function gf_notification_attachment_attach_script()
{
    global $gf_notification_attachment;
    $plugin = $gf_notification_attachment;
    if (class_exists('GFForms')) {
        if (GFForms::get_page() == 'notification_edit') {
            $script = $plugin->plugin_url . 'script';
            $script .= WP_DEBUG ? '.js' : '.min.js';
            wp_enqueue_script($plugin->text_domain, $script, array('gform_gravityforms'), $plugin->version, true);
            wp_enqueue_style($plugin->text_domain, $plugin->plugin_url . 'style.css', array(), $plugin->version);
        }
    }
}
示例#8
0
文件: custom.php 项目: smark73/eagle
 public function enable_notifications()
 {
     if (!class_exists('GW_Notification_Event')) {
         _doing_it_wrong('GW_Inventory::$enable_notifications', __('Inventory notifications require the \'GW_Notification_Event\' class.'), '1.0');
     } else {
         $event_slug = implode(array_filter(array("gw_submission_limit_limit_reached", $this->_args['form_id'])));
         $event_name = GFForms::get_page() == 'notification_edit' ? __('Submission limit reached') : __('Event name is only populated on Notification Edit view; saves a DB call to get the form on every ');
         $this->_notification_event = new GW_Notification_Event(array('form_id' => $this->_args['form_id'], 'event_name' => $event_name, 'event_slug' => $event_slug));
     }
 }
 function add_scripts_and_styles($hook)
 {
     if (!class_exists('RGForms')) {
         do_action('gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.');
         return;
     }
     // enqueue styles & scripts gf_entries
     // But only if we're on the main Entries page, not on reports pages
     if (GFForms::get_page() !== 'entry_list') {
         return;
     }
     $form_id = $this->get_form_id();
     // Things are broken; no forms were found
     if (empty($form_id)) {
         return;
     }
     wp_enqueue_style('gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version);
     $script_debug = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_script('gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE), array('jquery'), GravityView_Plugin::version);
     wp_localize_script('gravityview_gf_entries_scripts', 'gvGlobals', array('nonce' => wp_create_nonce('gravityview_ajaxgfentries'), 'form_id' => $form_id, 'show_column' => (int) $this->show_approve_entry_column($form_id), 'add_bulk_action' => (int) GVCommon::has_cap('gravityview_moderate_entries'), 'bulk_actions' => $this->get_bulk_actions($form_id), 'bulk_message' => $this->bulk_update_message, 'approve_title' => __('Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'), 'unapprove_title' => __('Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'), 'column_title' => __('Show entry in directory view?', 'gravityview'), 'column_link' => esc_url(add_query_arg(array('sort' => self::get_approved_column($form_id))))));
 }