array
*/
public function verrtical_align_attr() {
return array(
'baseline' => esc_html__( 'Baseline', 'jet-blog' ),
'top' => esc_html__( 'Top', 'jet-blog' ),
'middle' => esc_html__( 'Middle', 'jet-blog' ),
'bottom' => esc_html__( 'Bottom', 'jet-blog' ),
'sub' => esc_html__( 'Sub', 'jet-blog' ),
'super' => esc_html__( 'Super', 'jet-blog' ),
'text-top' => esc_html__( 'Text Top', 'jet-blog' ),
'text-bottom' => esc_html__( 'Text Bottom', 'jet-blog' ),
);
}
/**
* Returns array with numbers in $index => $name format for numeric selects
*
* @param integer $to Max numbers
* @return array
*/
public function get_select_range( $to = 10, $exclude = array(), $from_zero = false ) {
$from = ( true === $from_zero ) ? 0 : 1;
$range = range( $from, $to );
if ( ! empty( $exclude ) ) {
$range = array_diff( $range, $exclude );
}
return array_combine( $range, $range );
}
/**
* Returns badge placeholder URL
*
* @return void
*/
public function get_badge_placeholder() {
return jet_blog()->plugin_url( 'assets/images/placeholder-badge.svg' );
}
/**
* Rturns image tag or raw SVG
*
* @param string $url image URL.
* @param array $attr [description]
* @return string
*/
public function get_image_by_url( $url = null, $attr = array() ) {
$url = esc_url( $url );
if ( empty( $url ) ) {
return;
}
$ext = pathinfo( $url, PATHINFO_EXTENSION );
$attr = array_merge( array( 'alt' => '' ), $attr );
if ( 'svg' !== $ext ) {
return sprintf( '
', $url, $this->get_attr_string( $attr ) );
}
$base_url = network_site_url( '/' );
$svg_path = str_replace( $base_url, ABSPATH, $url );
$key = md5( $svg_path );
$svg = get_transient( $key );
if ( ! $svg ) {
$svg = file_get_contents( $svg_path );
}
if ( ! $svg ) {
return sprintf( '
', $url, $this->get_attr_string( $attr ) );
}
set_transient( $key, $svg, DAY_IN_SECONDS );
unset( $attr['alt'] );
return sprintf( '
%1$s
', $svg, $this->get_attr_string( $attr ) ); ;
}
/**
* Return attributes string from attributes array.
*
* @param array $attr Attributes string.
* @return string
*/
public function get_attr_string( $attr = array() ) {
if ( empty( $attr ) || ! is_array( $attr ) ) {
return;
}
$result = '';
foreach ( $attr as $key => $value ) {
$result .= sprintf( ' %s="%s"', esc_attr( $key ), esc_attr( $value ) );
}
return $result;
}
/**
* Get post types options list
*
* @return array
*/
public function get_post_types() {
$post_types = get_post_types( array( 'public' => true ), 'objects' );
$deprecated = apply_filters(
'jet-blog/post-types-list/deprecated',
array( 'attachment', 'elementor_library' )
);
$result = array();
if ( empty( $post_types ) ) {
return $result;
}
foreach ( $post_types as $slug => $post_type ) {
if ( in_array( $slug, $deprecated ) ) {
continue;
}
$result[ $slug ] = $post_type->label;
}
return $result;
}
/**
* Get post taxonomies options list
*
* @return array
*/
public function get_post_taxonomies() {
$post_types = $this->get_post_types();
$result = array();
$deprecated = apply_filters(
'jet-blog/post-taxonomies-list/deprecated',
array( 'product_shipping_class' )
);
foreach ( $post_types as $type => $label ) {
$taxonomies = get_object_taxonomies( $type, 'objects' );
if ( ! empty( $taxonomies ) ) {
foreach ( $taxonomies as $tax ) {
if ( $tax->public && ! in_array( $tax->name, $deprecated ) ) {
$result[ $tax->name ] = $tax->label;
}
}
}
}
return $result;
}
/**
* Return availbale arrows list
* @return [type] [description]
*/
public static function get_available_prev_arrows_list() {
return apply_filters(
'jet-blog/carousel/available-arrows/prev',
array(
'fa fa-angle-left' => __( 'Angle', 'jet-blog' ),
'fa fa-chevron-left' => __( 'Chevron', 'jet-blog' ),
'fa fa-angle-double-left' => __( 'Angle Double', 'jet-blog' ),
'fa fa-arrow-left' => __( 'Arrow', 'jet-blog' ),
'fa fa-caret-left' => __( 'Caret', 'jet-blog' ),
'fa fa-long-arrow-left' => __( 'Long Arrow', 'jet-blog' ),
'fa fa-arrow-circle-left' => __( 'Arrow Circle', 'jet-blog' ),
'fa fa-chevron-circle-left' => __( 'Chevron Circle', 'jet-blog' ),
'fa fa-caret-square-o-left' => __( 'Caret Square', 'jet-blog' ),
)
);
}
public static function get_svg_arrows( $arrow_type ) {
$arrow = [];
switch( $arrow_type ){
case 'fa fa-angle-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-chevron-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-angle-double-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-arrow-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-caret-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-long-arrow-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-arrow-circle-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-chevron-circle-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
case 'fa fa-caret-square-o-left':
$arrow['prev'] = '';
$arrow['next'] = '';
break;
}
$arrow = apply_filters( 'jet-blog/carousel/nav-arrow', $arrow, $arrow_type );
return $arrow;
}
/**
* Get terms from passed taxonomy
*
* @param string $tax Taxonomy name.
* @return array.
*/
public function get_terms( $tax = 'category' ) {
$terms = get_terms( array( 'taxonomy' => $tax ) );
$default = array( esc_html__( 'From All', 'jet-blog' ) );
if ( empty( $terms ) ) {
return $default;
}
$filtered_terms = wp_list_pluck( $terms, 'name', 'term_id' );
$filtered_terms[0] = $default[0];
ksort( $filtered_terms );
return $filtered_terms;
}
/**
* Returns carousel arrow
*
* @param array $classes Arrow additional classes list.
* @return string
*/
public function get_carousel_arrow( $icon = '', $direction = 'next' ) {
if ( '' === $icon ) {
return;
}
$arrows = $this->get_svg_arrows( $icon );
$format = apply_filters(
'jet-blog/carousel/arrows-format',
'%1$s'
);
return sprintf( $format, $arrows[$direction], $direction );
}
public function get_archive_control_desc() {
$link = sprintf(
'%2$s',
esc_url( admin_url( 'options-reading.php#posts_per_page' ) ),
esc_html__( 'here', 'jet-blog' )
);
return sprintf( esc_html__( 'Note: posts number per page will be inherited from Reading Settings. You can change it %s', 'jet-blog' ), $link );
}
/**
* Is script debug.
*
* @return bool
*/
public function is_script_debug() {
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG;
}
/**
* Check if is valid timestamp
*
* @param $timestamp
* @return boolean
*/
public function is_valid_timestamp( $timestamp ) {
return ( ( string ) ( int ) $timestamp === $timestamp || ( int ) $timestamp === $timestamp )
&& ( $timestamp <= PHP_INT_MAX )
&& ( $timestamp >= ~PHP_INT_MAX );
}
/**
* Is FA5 migration.
*
* @return bool
*/
public function is_fa5_migration() {
if ( defined( 'ELEMENTOR_VERSION' )
&& version_compare( ELEMENTOR_VERSION, '2.6.0', '>=' )
&& Elementor\Icons_Manager::is_migration_allowed()
) {
return true;
}
return false;
}
public function validate_html_tag( $tag ) {
$allowed_tags = array(
'article',
'aside',
'div',
'footer',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'header',
'main',
'nav',
'p',
'section',
'span',
);
return in_array( strtolower( $tag ), $allowed_tags ) ? $tag : 'div';
}
public function allowed_meta_callbacks() {
$callbacks = apply_filters( 'jet-blog/base/meta-callbacks', array(
'' => esc_html__( 'Clean', 'jet-blog' ),
'get_permalink' => 'get_permalink',
'get_the_title' => 'get_the_title',
'wp_get_attachment_url' => 'wp_get_attachment_url',
'wp_get_attachment_image' => 'wp_get_attachment_image',
'date' => esc_html__( 'Format date', 'jet-blog' ),
'date_i18n' => esc_html__( 'Format date (localized)', 'jet-blog' ),
) );
return $callbacks;
}
/**
* Returns the instance.
*
* @since 1.0.0
* @return Jet_Blog_Tools
*/
public static function get_instance( $shortcodes = array() ) {
// If the single instance hasn't been set, set it now.
if ( null == self::$instance ) {
self::$instance = new self( $shortcodes );
}
return self::$instance;
}
}
}
/**
* Returns instance of Jet_Blog_Tools
*
* @return Jet_Blog_Tools
*/
function jet_blog_tools() {
return Jet_Blog_Tools::get_instance();
}
Pagina niet gevonden – Opi 's BakHuis
Skip to content
It looks like nothing was found at this location. Maybe try one of the links below or a search?