/** @inheritdoc */ protected function init() { $this->setShortcodeTag('op-overview'); $this->defaultAttributes = array('before_title' => '<h3 class="op-overview-title">', 'after_title' => '</h3>', 'before_widget' => '<div class="op-overview-shortcode">', 'after_widget' => '</div>', 'set_id' => 0, 'title' => null, 'show_closed_days' => false, 'show_description' => true, 'highlight' => 'nothing', 'compress' => false, 'short' => false, 'include_io' => false, 'include_holidays' => false, 'caption_closed' => __('Closed', I18n::TEXTDOMAIN), 'table_classes' => null, 'row_classes' => null, 'cell_classes' => null, 'cell_heading_classes' => null, 'cell_periods_classes' => null, 'cell_description_classes' => 'op-set-description', 'highlighted_period_class' => 'highlighted', 'highlighted_day_class' => 'highlighted', 'table_id_prefix' => 'op-table-set-', 'time_format' => Dates::getTimeFormat(), 'hide_io_date' => false); $this->validAttributeValues = array('highlight' => array('nothing', 'period', 'day'), 'show_closed_day' => array(false, true), 'show_description' => array(true, false), 'include_io' => array(false, true), 'include_holidays' => array(false, true), 'hide_io_date' => array(false, true)); $this->templatePath = 'shortcode/overview.php'; }
/** @inheritdoc */ protected function init() { $this->setShortcodeTag('op-is-open'); $this->defaultAttributes = array('set_id' => null, 'open_text' => __('We\'re currently open.', self::TEXTDOMAIN), 'closed_text' => __('We\'re currently closed.', self::TEXTDOMAIN), 'show_next' => false, 'next_format' => __('We\'re open again on %2$s (%1$s) from %3$s to %4$s', self::TEXTDOMAIN), 'before_widget' => null, 'after_widget' => null, 'before_title' => null, 'after_title' => null, 'title' => null, 'classes' => null, 'next_period_classes' => null, 'open_class' => 'op-open', 'closed_class' => 'op-closed', 'date_format' => Dates::getDateFormat(), 'time_format' => Dates::getTimeFormat()); $this->validAttributeValues = array('show_next' => array(false, true)); $this->templatePath = 'shortcode/is-open.php'; }
/** @inheritdoc */ protected function init() { $this->setShortcodeTag('op-irregular-openings'); $this->defaultAttributes = array('title' => null, 'set_id' => null, 'highlight' => false, 'before_widget' => null, 'after_widget' => null, 'before_title' => null, 'after_title' => null, 'class_io' => 'op-irregular-opening', 'class_highlighted' => 'highlighted', 'date_format' => Dates::getDateFormat(), 'time_format' => Dates::getTimeFormat()); $this->templatePath = 'shortcode/irregular-openings.php'; }
/** * Returns the formatted string with start and end time for this Period * * @param string $timeFormat Custom time format * @return string */ public function getFormattedTimeRange($timeFormat = null) { if ($timeFormat == null) { $timeFormat = Dates::getTimeFormat(); } return $this->timeStart->format($timeFormat) . ' - ' . $this->timeEnd->format($timeFormat); }
public function testAttributes() { $this->assertEquals('H:i', Dates::getTimeFormat()); $this->assertEquals('d.m.Y', Dates::getDateFormat()); $this->assertEquals('Europe/Berlin', Dates::getTimezone()->getName()); }
/** * Returns a string representing the Irregular Opening time range * * @param string $timeFormat Custom time format * @param string $outputFormat Custom output format. First variable: start time, second variable: end time * * @return string The time range as string */ public function getFormattedTimeRange($timeFormat = null, $outputFormat = "%s - %s") { if ($timeFormat == null) { $timeFormat = Dates::getTimeFormat(); } return sprintf($outputFormat, $this->timeStart->format($timeFormat), $this->timeEnd->format($timeFormat)); }