/** * 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(); }
/** * 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; }
/** * 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; }
/** * Return a string with complete list of CSS class * * @brief CSS Class * * @return string */ protected function classes() { $result = ''; if (isset($this->item['class']) && !empty($this->item['class'])) { $result = WPDKHTMLTag::classInline($this->item['class']); } return $result; }
/** * 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(); }
/** * 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 }