html() public method

Return the HTML markup pf controls layout array
public html ( ) : string
return string
Exemplo n.º 1
0
 /**
  * Display
  *
  * @brief Display
  */
 public function draw()
 {
     // Create a nonce key
     $nonce = md5($this->id);
     $input_hidden_nonce = new WPDKHTMLTagInput('', $nonce, $nonce);
     $input_hidden_nonce->type = WPDKHTMLTagInputType::HIDDEN;
     $input_hidden_nonce->value = wp_create_nonce($this->id);
     $input_hidden_class = new WPDKHTMLTagInput('', 'wpdk_preferences_class');
     $input_hidden_class->type = WPDKHTMLTagInputType::HIDDEN;
     $input_hidden_class->value = get_class($this->preferences);
     $input_hidden_branch = new WPDKHTMLTagInput('', 'wpdk_preferences_branch');
     $input_hidden_branch->type = WPDKHTMLTagInputType::HIDDEN;
     $input_hidden_branch->value = $this->branch_property;
     $layout = new WPDKUIControlsLayout($this->fields($this->branch));
     $form = new WPDKHTMLTagForm($input_hidden_nonce->html() . $input_hidden_class->html() . $input_hidden_branch->html() . $layout->html() . $this->buttonsUpdateReset());
     $form->name = 'wpdk_preferences_view_form-' . $this->branch_property;
     $form->id = $form->name;
     $form->class[] = 'wpdk-form wpdk-preferences-view-' . $this->branch_property;
     $form->method = 'post';
     $form->action = '';
     /**
      * Filter the form object for this branch view.
      *
      * @param WPDKHTMLTagForm $form An instance of WPDKHTMLTagForm class.
      */
     $form = apply_filters('wpdk_preferences_branch_form', $form);
     /**
      * Fires before display the view. You can add your custome feedback message.
      */
     do_action('wpdk_preferences_feedback-' . $this->branch_property);
     $form->display();
 }
Exemplo n.º 2
0
 /**
  * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
  *
  * The action only fires if the current user is editing their own profile.
  *
  * @since WP 2.0.0
  *
  * @param WP_User $profileuser The current WP_User object.
  */
 public function show_user_profile($profileuser)
 {
     echo '<br clear="all" /><a name="wpdk"></a>';
     $message = __('This view <strong>is enhanced</strong> by wpXtreme and WPDK framework. Please, have a look below for additional information.', WPDK_TEXTDOMAIN);
     $alert = new WPDKUIAlert('wpdk-alert-show_user_profile', $message, WPDKUIAlertType::INFORMATION);
     $alert->dismissPermanent = true;
     $alert->display();
     // Only the administrator can edit this extra information
     $disabled = !current_user_can('manage_options');
     // Sanitize values
     $last_time_success_login = $profileuser->get(WPDKUserMeta::LAST_TIME_SUCCESS_LOGIN);
     $last_time_wrong_login = $profileuser->get(WPDKUserMeta::LAST_TIME_WRONG_LOGIN);
     $last_time_logout = $profileuser->get(WPDKUserMeta::LAST_TIME_LOGOUT);
     $status_description = $profileuser->get(WPDKUserMeta::STATUS_DESCRIPTION);
     // Display WPDK user extends information
     $fields = array(__('Login information', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_SUCCESS_LOGIN, 'label' => __('Last success login', WPDK_TEXTDOMAIN), 'value' => empty($last_time_success_login) ? '' : WPDKDateTime::format($last_time_success_login, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled), array('type' => WPDKUIControlType::NUMBER, 'name' => WPDKUserMeta::COUNT_SUCCESS_LOGIN, 'label' => __('# success login', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::COUNT_SUCCESS_LOGIN), 'disabled' => true)), array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_WRONG_LOGIN, 'label' => __('Last wrong login', WPDK_TEXTDOMAIN), 'value' => empty($last_time_wrong_login) ? '' : WPDKDateTime::format($last_time_wrong_login, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled), array('type' => WPDKUIControlType::NUMBER, 'name' => WPDKUserMeta::COUNT_WRONG_LOGIN, 'label' => __('# wrong login', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::COUNT_WRONG_LOGIN), 'disabled' => $disabled))), __('Logout information', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::DATETIME, 'name' => WPDKUserMeta::LAST_TIME_LOGOUT, 'label' => __('Last logout', WPDK_TEXTDOMAIN), 'value' => empty($last_time_logout) ? '' : WPDKDateTime::format($last_time_logout, WPDKDateTime::DATETIME_SECONDS_LESS_FORMAT_PHP), 'disabled' => $disabled))), __('Status', WPDK_TEXTDOMAIN) => array(array(array('type' => WPDKUIControlType::SELECT, 'name' => WPDKUserMeta::STATUS, 'label' => __('Status', WPDK_TEXTDOMAIN), 'value' => $profileuser->get(WPDKUserMeta::STATUS), 'options' => WPDKUserStatus::statuses(), 'disabled' => $disabled)), array(array('type' => WPDKUIControlType::TEXTAREA, 'name' => WPDKUserMeta::STATUS_DESCRIPTION, 'rows' => 3, 'cols' => 40, 'label' => __('Description', WPDK_TEXTDOMAIN), 'placeholder' => __('eg: this user is disabled because...', WPDK_TEXTDOMAIN), 'value' => $status_description, 'disabled' => $disabled))));
     /**
      * Filter the layout control array with the extra WPDK fields.
      *
      * You can use this filter or `wpdk_users_show_user_profile` action to modify the default layout control array.
      *
      * @param array   $fields      Layout array fields.
      * @param WP_User $profileuser The current WP_User object.
      */
     $fields = apply_filters('wpdk_users_fields_profile', $fields, $profileuser);
     $layout = new WPDKUIControlsLayout($fields);
     /**
      * Fires after display the layout controls.
      *
      * You can use this action or `wpdk_users_fields_profile` filter to modify the default layout control array.
      *
      * @deprecated since 1.7.2 - Use `wpdk_user_profile_tabs` filter instead
      *
      * @param WP_User $profileuser The current WP_User object.
      */
     do_action('wpdk_users_show_user_profile', $profileuser);
     // Defaults
     $tabs = array();
     if (current_user_can('edit_users')) {
         // WPDK tabs
         $tabs = array(new WPDKjQueryTab('wpdk-user-profile', __('WPDK'), '<div id="wpdk-user-profile">' . $layout->html() . '</div>'));
     }
     /**
      * Filter the tabs list used to extends user profile edit.
      *
      * @since 1.7.2
      *
      * @param array   $tabs        The array tabs list.
      * @param WP_User $profileuser The current WP_User object.
      */
     $tabs = apply_filters('wpdk_user_profile_tabs', $tabs, $profileuser);
     $jquery_tabs = new WPDKjQueryTabsView('wpdk-users', $tabs, true);
     $jquery_tabs->display();
 }
Exemplo n.º 3
0
 /**
  * Display the content view with form, introduction, fields or custom content. You can override this method with your
  * own drawing.
  *
  * @brief Display the content view form
  *
  */
 public function draw()
 {
     /* Create a nonce key. */
     $nonce = md5($this->id);
     $input_hidden_nonce = new WPDKHTMLTagInput('', $nonce, $nonce);
     $input_hidden_nonce->type = WPDKHTMLTagInputType::HIDDEN;
     $input_hidden_nonce->value = wp_create_nonce($this->id);
     $layout = new WPDKUIControlsLayout($this->fields());
     $form = new WPDKHTMLTagForm($input_hidden_nonce->html() . $this->_introduction() . $layout->html() . $this->buttonsUpdateReset());
     $form->name = 'wpdk_configuration_view_form-' . $this->id;
     $form->id = $form->name;
     $form->class = 'wpdk-form wpdk-configuration-view-' . $this->id;
     $form->method = 'post';
     $form->action = '';
     $form->display();
 }