$content .= '

' . sprintf( __( 'Furthermore, you can override this option for a specific search bar via shortcode params. Learn more about shortcodes parameters.', 'ajax-search-for-woocommerce' ), $linkToShortcodesDoc ) . '

'; return $content; } /** * Create HTML question mark with tooltip * * @param string $id * @param string $content * @param string $template * @param string $placement * * @return string */ public static function createQuestionMark( $id, $content = '', $template = '', $placement = 'right' ) { return self::createTooltip( $id, $content, $template, $placement, 'dashicons dashicons-editor-help dgwt-wcas-questio-mark' ); } /** * Create HTML option override tooltip * * @param string $id * @param string $content * @param string $template * @param string $placement * * @return string */ public static function createOverrideTooltip( $id, $content = '', $template = '', $placement = 'right' ) { return self::createTooltip( $id, $content, $template, $placement, 'dashicons dashicons-lock dgwt-wcas-override-tooltip' ); } /** * Get list of 24 hours */ public static function getHours() { $hours = array(); $cycle12 = ( get_option( 'time_format' ) === 'H:i' ? false : true ); for ( $i = 0 ; $i < 24 ; $i++ ) { $label = ( $cycle12 ? $i . ':00 am' : $i . ':00' ); if ( $cycle12 && $i === 0 ) { $label = 12 . ':00 am'; } if ( $cycle12 && $i > 11 ) { if ( $i === 12 ) { $label = 12 . ':00 pm'; } else { $label = $i - 12 . ':00 pm'; } } $hours[$i] = $label; } return $hours; } /** * Get local date including timezone * * @param $timestamp * @param string $format * * @return string * @throws \Exception */ public static function localDate( $timestamp, $format = '' ) { if ( empty($timestamp) ) { return ''; } if ( empty($format) ) { $format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' ); } $date = new \WC_DateTime( "@{$timestamp}" ); $date->setTimezone( new \DateTimeZone( wc_timezone_string() ) ); return $date->date_i18n( $format ); } /** * Get labels * * @return array */ public static function getLabels() { $noResults = DGWT_WCAS()->settings->getOption( 'search_no_results_text', __( 'No results', 'ajax-search-for-woocommerce' ) ); $noResults = json_encode( Helpers::ksesNoResults( $noResults ), JSON_UNESCAPED_SLASHES ); $showMore = esc_html( DGWT_WCAS()->settings->getOption( 'search_see_all_results_text', __( 'See all products...', 'ajax-search-for-woocommerce' ) ) ); return apply_filters( 'dgwt/wcas/labels', array( 'post' => __( 'Post' ), 'page' => __( 'Page' ), 'vendor' => __( 'Vendor', 'ajax-search-for-woocommerce' ), 'product_plu' => __( 'Products', 'woocommerce' ), 'post_plu' => __( 'Posts' ), 'page_plu' => __( 'Pages' ), 'vendor_plu' => __( 'Vendors', 'ajax-search-for-woocommerce' ), 'sku_label' => __( 'SKU', 'woocommerce' ) . ':', 'sale_badge' => __( 'Sale', 'woocommerce' ), 'vendor_sold_by' => __( 'Sold by:', 'ajax-search-for-woocommerce' ), 'featured_badge' => __( 'Featured', 'woocommerce' ), 'in' => _x( 'in', 'in categories fe. in Books > Crime stories', 'ajax-search-for-woocommerce' ), 'read_more' => __( 'continue reading', 'ajax-search-for-woocommerce' ), 'no_results' => $noResults, 'no_results_default' => __( 'No results', 'ajax-search-for-woocommerce' ), 'show_more' => $showMore, 'show_more_details' => $showMore, 'search_placeholder' => DGWT_WCAS()->settings->getOption( 'search_placeholder', __( 'Search for products...', 'ajax-search-for-woocommerce' ) ), 'submit' => DGWT_WCAS()->settings->getOption( 'search_submit_text', '' ), 'search_hist' => __( 'Your search history', 'ajax-search-for-woocommerce' ), 'search_hist_clear' => __( 'Clear', 'ajax-search-for-woocommerce' ), ) ); } /** * Get labels * * @param string $key * * @return string */ public static function getLabel( $key ) { $label = ''; $labels = self::getLabels(); if ( array_key_exists( $key, $labels ) ) { $label = $labels[$key]; } return $label; } /** * Remove all HTML tags including