コード例 #1
1
 /**
  * prints the form open tag and all hidden fields
  * 
  * The incoming hidden fields are merged with the default fields
  * 
  * @param array $hidden array of hidden fields to print
  * @return null
  */
 protected function _print_form_head($hidden = '')
 {
     $uri_components = parse_url($_SERVER['REQUEST_URI']);
     echo '<form method="post" enctype="multipart/form-data"  autocomplete="' . $this->shortcode_atts['autocomplete'] . '" action="' . $_SERVER['REQUEST_URI'] . '" >';
     $default_hidden_fields = array('action' => $this->module, 'subsource' => Participants_Db::PLUGIN_NAME, 'shortcode_page' => $uri_components['path'] . (isset($uri_components['query']) ? '?' . $uri_components['query'] : ''), 'thanks_page' => $this->submission_page, 'instance_index' => $this->instance_index, 'pdb_data_keys' => $this->_form_data_keys(), 'session_hash' => Participants_Db::nonce(Participants_Db::$main_submission_nonce_key));
     if ($this->get_form_status() === 'multipage') {
         $default_hidden_fields['previous_multipage'] = $default_hidden_fields['shortcode_page'];
     }
     $hidden = is_array($hidden) ? $hidden : array();
     $hidden_fields = $this->hidden_fields + $hidden + $default_hidden_fields;
     PDb_FormElement::print_hidden_fields($hidden_fields);
 }
コード例 #2
0
 /**
  * prints the top of the search/sort form
  *
  * @param string $target set the action attribute of the search form to another 
  *                       page, giving the ability to have the search on a 
  *                       different page than the list, defaults to the same page
  * @global object $post
  */
 public function search_sort_form_top($target = false, $class = false, $print = true)
 {
     $this->shortcode_atts['target_page'] = trim($this->shortcode_atts['target_page']);
     if (!empty($this->shortcode_atts['action']) && empty($this->shorcode_atts['target_page'])) {
         $this->shorcode_atts['target_page'] = $this->shortcode_atts['action'];
     }
     global $post;
     $output = array();
     $ref = 'update';
     if ($target === false && !empty($this->shortcode_atts['target_page']) && $this->module == 'search') {
         $target = Participants_Db::find_permalink($this->shortcode_atts['target_page']);
     }
     if ($target) {
         $ref = 'remote';
     }
     $action = $target !== false ? $target : get_permalink($post->ID) . '#' . $this->list_anchor;
     $class_att = $class ? 'class="' . $class . '"' : '';
     $output[] = '<form method="post" class="sort_filter_form" action="' . $action . '"' . $class_att . ' data-ref="' . $ref . '" >';
     $hidden_fields = array('action' => 'pdb_list_filter', 'target_instance' => $this->shortcode_atts['target_instance'], 'instance_index' => $this->instance_index, 'pagelink' => $this->prepare_page_link($_SERVER['REQUEST_URI']), 'sortstring' => $this->filter['sortstring'], 'orderstring' => $this->filter['orderstring'], 'filterNonce' => Participants_Db::nonce(self::$list_filter_nonce_key));
     if ($ref === 'remote') {
         $hidden_fields['submit_button'] = 'search';
     }
     $output[] = PDb_FormElement::print_hidden_fields($hidden_fields, false);
     if ($print) {
         echo $this->output_HTML($output);
     } else {
         return $this->output_HTML($output);
     }
 }