function display()
 {
     $template_path = appthemes_locate_template(basename($this->template));
     // retrieve the user meta for each gateway field
     foreach (self::get_fields_names() as $field) {
         $user_meta[$field] = get_user_option($field);
     }
     // prepare the vars to pass to the escrow settings template
     $vars = array('fields' => $this->fields, 'formdata' => $user_meta, 'user' => wp_get_current_user());
     ob_start();
     if (!$template_path) {
         extract($vars);
         require $this->template;
     } else {
         appthemes_load_template($template_path, $vars);
     }
     $output = ob_get_clean();
     $output .= html('input', array('type' => 'hidden', 'name' => 'action', 'value' => 'manage-escrow'));
     $output .= html('input', array('type' => 'submit', 'value' => esc_attr__('Save Changes', APP_TD), 'class' => 'button'));
     $output = scbForms::form_wrap($output, 'app-manage-escrow');
     echo apply_filters('appthemes_escrow_settings_form', $output, $vars);
     do_action('appthemes_escrow_after_settings_form', $vars);
 }
 function page_content()
 {
     $data = array('columns' => array(__('Name', P2P_TEXTDOMAIN), __('Information', P2P_TEXTDOMAIN), __('Connections', P2P_TEXTDOMAIN)));
     $connection_counts = $this->get_connection_counts();
     if (empty($connection_counts)) {
         $data['has-rows'] = false;
         $data['no-rows'] = __('No connection types registered.', P2P_TEXTDOMAIN);
         $data['no-rows2'] = sprintf(__('To register a connection type, see <a href="%s">the wiki</a>.', P2P_TEXTDOMAIN), 'https://github.com/scribu/wp-posts-to-posts/wiki/');
     } else {
         $data['has-rows'] = array(true);
         foreach ($connection_counts as $p2p_type => $count) {
             $row = array('p2p_type' => $p2p_type, 'count' => number_format_i18n($count));
             $ctype = p2p_type($p2p_type);
             if ($ctype) {
                 $row['desc'] = $ctype->get_desc();
             } else {
                 $row['desc'] = __('Convert to registered connection type:', P2P_TEXTDOMAIN) . scbForms::form_wrap($this->get_dropdown($p2p_type), $this->nonce);
                 $row['class'] = 'error';
             }
             $data['rows'][] = $row;
         }
     }
     echo P2P_Mustache::render('connection-types', $data);
 }
Beispiel #3
0
	function form_wrap( $content, $submit_button = true ) {
		if ( is_array( $submit_button ) ) {
			$content .= call_user_func( array( $this, 'submit_button' ), $submit_button );
		} elseif ( true === $submit_button ) {
			$content .= $this->submit_button();
		} elseif ( false !== strpos( $submit_button, '<input' ) ) {
			$content .= $submit_button;
		} elseif ( false !== $submit_button ) {
			$button_args = array_slice( func_get_args(), 1 );
			$content .= call_user_func_array( array( $this, 'submit_button' ), $button_args );
		}

		return scbForms::form_wrap( $content, $this->nonce );
	}