Remeber to add this tag in WPDKHTMLTagName
Author: =undo= (info@wpxtre.me)
Inheritance: extends WPDKHTMLTag
 /**
  * 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();
 }
Exemple #2
0
 /**
  * Return the HTML markup for an input type hidden with a nonce value.
  *
  * @brief Input nonce
  * @since 1.0.0.b4
  *
  * @param string $id ID used for nonce code
  *
  * @return string
  */
 public static function inputNonce($id)
 {
     $nonce = md5($id);
     $input_hidden_nonce = new WPDKHTMLTagInput('', $nonce, $nonce);
     $input_hidden_nonce->type = WPDKHTMLTagInputType::HIDDEN;
     $input_hidden_nonce->value = wp_create_nonce($id);
     return $input_hidden_nonce->html();
 }
Exemple #3
0
    /**
     * Drawing control
     */
    public function draw()
    {
        // Prepare popover
        /**
         * @var WPDKUIPopover $popover
         */
        $popover = null;
        // since 1.5.0 - check for popover
        if (isset($this->item['popover']) && is_a($this->item['popover'], 'WPDKUIPopover')) {
            $popover = $this->item['popover'];
            ?>

      <div class='wpdk-has-popover wpdk-popover-container'
      data-title='<?php 
            echo $popover->title();
            ?>
'
      data-content='<?php 
            echo esc_attr($popover->content());
            ?>
'
      data-placement='<?php 
            echo $popover->placement;
            ?>
'
      data-trigger='<?php 
            echo $popover->trigger;
            ?>
'
      data-html='<?php 
            echo $popover->html ? 'true' : 'false';
            ?>
'
      data-animation='<?php 
            echo $popover->animation ? 'true' : 'false';
            ?>
'
      data-container='<?php 
            echo $popover->container;
            ?>
'
      data-delay='<?php 
            echo empty($popover->delay) ? 0 : json_encode($popover->delay);
            ?>
'>
    <?php 
        }
        echo $this->contentWithKey('prepend');
        // Create the label
        $label = $this->label();
        // Display left label
        if (!isset($this->item['label_placement']) || 'left' == $this->item['label_placement']) {
            echo is_null($label) ? '' : $label->html();
        }
        $input_hidden = new WPDKHTMLTagInput('', $this->name, 'wpdk-swipe-' . $this->id);
        $input_hidden->type = WPDKHTMLTagInputType::HIDDEN;
        $input_hidden->value = isset($this->item['value']) ? $this->item['value'] : '';
        $status = wpdk_is_bool($this->item['value']) ? 'wpdk-form-swipe-on' : '';
        $swipe = new WPDKHTMLTagSpan('<span></span>' . $input_hidden->html());
        $class = isset($this->item['class']) ? $this->item['class'] : '';
        $swipe->class = WPDKHTMLTag::mergeClasses($class, 'wpdk-form-swipe wpdk-ui-control ' . $status);
        $swipe->id = $this->id;
        $swipe->data = isset($this->item['data']) ? $this->item['data'] : array();
        // since 1.7.0
        if (isset($this->item['on_swipe'])) {
            $swipe->data['on_swipe'] = $this->item['on_swipe'];
        }
        if (isset($this->item['userdata'])) {
            $swipe->data['userdata'] = esc_attr($this->item['userdata']);
        }
        // Title and tooltip
        $swipe->title = isset($this->item['title']) ? $this->item['title'] : '';
        if (!empty($swipe->title)) {
            $swipe->class[] = 'wpdk-has-tooltip';
        }
        $swipe->setPropertiesByArray(isset($this->item['attrs']) ? $this->item['attrs'] : '');
        $swipe->display();
        // Display right label
        if (isset($this->item['label_placement']) && 'right' == $this->item['label_placement']) {
            echo is_null($label) ? '' : $label->html();
        }
        echo $this->contentWithKey('append');
        if (!empty($popover)) {
            echo '</div>';
        }
    }
Exemple #4
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();
 }