Thanks to http://www.w3schools.com/tags/default.asp for definitions
Author: =undo= (info@wpxtre.me)
Inheritance: extends WPDKObject
Esempio n. 1
0
    /**
     * Return HTML markup for a input type
     *
     * @brief Simple button
     *
     * @param string $label Optional. Button label. If empty default is 'Update'
     * @param array  $args  Optional. A keys value array for additional settings
     *
     *     'type'                  => 'submit',
     *     'name'                  => 'button-update',
     *     'classes'               => ' button-primary',
     *     'additional_classes'    => '',
     *     'data'                  => ''
     *
     * @return string HTML input type submit
     */
    public static function button($label = '', $args = array())
    {
        $default_args = array('type' => 'submit', 'name' => 'button-update', 'classes' => ' button button-primary alignright', 'additional_classes' => '', 'data' => array());
        $args = wp_parse_args($args, $default_args);
        // Label
        if (empty($label)) {
            $label = __('Update', WPDK_TEXTDOMAIN);
        }
        // Name attribute
        if (empty($args['name'])) {
            $name = '';
        } else {
            $name = sprintf('name="%s"', $args['name']);
        }
        // Build data
        $data = WPDKHTMLTag::dataInline($args['data']);
        // Build classes
        $classes = WPDKHTMLTag::classInline($args['classes'], $args['additional_classes']);
        WPDKHTML::startCompress();
        ?>

    <input type="<?php 
        echo $args['type'];
        ?>
" <?php 
        echo $name;
        ?>
      <?php 
        echo $data;
        ?>
           class="<?php 
        echo $classes;
        ?>
"
           value="<?php 
        echo $label;
        ?>
" />

    <?php 
        return WPDKHTML::endHTMLCompress();
    }
Esempio n. 2
0
    /**
     * Return the HTML markup button for dismiss
     *
     * @brief Dismiss button
     *
     * @return string
     */
    private function _dismissButton()
    {
        $result = '';
        // Title
        $title = '';
        // Classes
        $classes = array('close');
        // Custom title/tooltip in button close
        if (!empty($this->dismissToolTip)) {
            $classes[] = 'wpdk-has-tooltip';
            $title = sprintf('title="%s"', $this->dismissToolTip);
        }
        // Permanent dismiss by user logged in
        if (true === $this->dismissPermanent) {
            $classes[] = 'wpdk-alert-permanent-dismiss';
            $title = sprintf('title="%s"', __('By clicking on the X button, this alert won\'t appear'));
        }
        if ($this->dismissButton) {
            WPDKHTML::startCompress();
            ?>
      <button
        type="button"
        class="<?php 
            echo WPDKHTMLTag::classInline($classes);
            ?>
"
        <?php 
            echo $title;
            ?>
        data-dismiss="wpdkAlert"><?php 
            echo $this->dismissButtonGlyph;
            ?>
</button>
      <?php 
            $result = WPDKHTML::endHTMLCompress();
        }
        return $result;
    }
Esempio n. 3
0
 /**
  * Return the HTML markup for top right dismiss button [x]
  *
  * @brief Dismiss button
  *
  * @return string
  */
 private function dismissButton()
 {
     // Prepare classes
     $classes = array('close');
     // Title
     $title = '';
     // Permanent dismiss by user logged in
     if (true === $this->permanent_dismiss) {
         $classes[] = 'wpdk-modal-permanent-dismiss';
         $title = sprintf('title="%s"', __('By clicking on the X button, this dialog won\'t appear'));
     }
     $result = '';
     if ($this->dismissButton) {
         $result = sprintf('<button %s type="button" class="%s" data-dismiss="wpdkModal" aria-hidden="true">%s</button>', $title, WPDKHTMLTag::classInline($classes), $this->dismiss_button_glyph);
     }
     return $result;
 }
Esempio n. 4
0
 /**
  * Create an instance of WPDKHTMLTagTextarea class
  *
  * @brief Construct
  *
  * @param string         $content  HTML inner (or adjacent) content
  * @param string         $name     Attribute name
  * @param string         $id       Attribute id
  *
  * @return WPDKHTMLTagTextarea
  */
 public function __construct($content = '', $name = '', $id = '')
 {
     /* Create an WPDKHTMLTag instance. */
     parent::__construct(WPDKHTMLTagName::TEXTAREA);
     /* The content. */
     $this->content = $content;
     /* Set name. */
     if (!empty($name)) {
         $this->name = $name;
     }
     /* To default, if $name exists and $id not exists, then $id = $name. */
     if (!empty($name) && empty($id)) {
         /* Check if field is an array. */
         if ('[]' == substr($name, -2)) {
             /* Sanitize id. */
             $this->id = substr($name, 0, strlen($name) - 2);
         } else {
             $this->id = $name;
         }
     } elseif (!empty($id)) {
         $this->id = $id;
     }
     /* Setting. */
     $this->open = '<textarea';
     $this->close = '</textarea>';
     $this->attributes = array('autofocus', 'cols', 'disabled', 'form', 'maxlength', 'name', 'placeholder', 'readonly', 'required', 'rows', 'wrap');
 }
Esempio n. 5
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>';
        }
    }
Esempio n. 6
0
 /**
  * Return the inline attributes for the column.
  *
  * @brief Column attrobutes
  *
  * @param string $column_key The column key.
  *
  * @return string
  */
 protected function get_atts($column_key)
 {
     return isset($this->column_atts[$column_key]) ? WPDKHTMLTag::attributeInline($this->column_atts[$column_key]) : '';
 }
Esempio n. 7
0
    /**
     * Return the HTML markup of Popover
     *
     * @brief Popover
     *
     * @return string
     */
    public function html()
    {
        // Get title
        $title = $this->title();
        $title = empty($title) ? '' : sprintf('<h3 class="popover-title">%s</h3>', $title);
        WPDKHTML::startCompress();
        ?>

    <div id="<?php 
        echo $this->id;
        ?>
"
      class="<?php 
        echo WPDKHTMLTag::classInline(array('wpdk-popover', $this->placement, $this->class, empty($this->static) ? '' : 'fade'));
        ?>
">
      <?php 
        echo self::dataInline($this->data);
        ?>
      <div class="arrow"></div>
      <?php 
        echo $title;
        ?>
      <div class="popover-content">
        <?php 
        echo $this->content();
        ?>
      </div>
    </div>

   <?php 
        return WPDKHTML::endCompress();
    }
Esempio n. 8
0
    /**
     * Display the HTML markup content for this view.
     *
     * @brief Display view content
     *
     * @return string
     */
    public function display()
    {
        $classes = WPDKHTMLTag::classInline($this->class);
        $style = WPDKHTMLTag::styleInline($this->style);
        $data = WPDKHTMLTag::dataInline($this->data);
        ?>
    <div data-type="wpdk-view"
         style="<?php 
        echo $style;
        ?>
"
         id="<?php 
        echo $this->id;
        ?>
"
         <?php 
        echo $data;
        ?>
         class="<?php 
        echo $classes;
        ?>
">

    <?php 
        /**
         * Fires before start drawing content for this {id} view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_will_draw_content-' . $this->id, $this);
        ?>

    <?php 
        /**
         * Fires before start drawing content for this view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_will_draw_content', $this);
        ?>

    <?php 
        $this->draw();
        ?>

    <?php 
        if (is_array($this->subviews)) {
            ?>
      <?php 
            /**
             * @var WPDKView $view
             */
            foreach ($this->subviews as $view) {
                ?>
        <?php 
                $view->display();
                ?>
      <?php 
            }
            ?>
    <?php 
        }
        ?>

    <?php 
        /**
         * Fires after drawing content for this view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_did_draw_content', $this);
        ?>

    <?php 
        /**
         * Fires after drawing content for this {id} view.
         *
         * @param WPDKView $view This view
         */
        do_action('wpdk_view_did_draw_content-' . $this->id, $this);
        ?>

  </div>

  <?php 
    }