PATH:
home
/
lab2454c
/
fcxpro.com
/
wp-content
/
themes
/
webon
/
helpers
<?php if ( ! function_exists( 'webon_is_installed' ) ) { /** * Function that checks if forward plugin installed * * @param string $plugin - plugin name * * @return bool */ function webon_is_installed( $plugin ) { switch ( $plugin ) { case 'framework'; return class_exists( 'QodeFramework' ); break; case 'core'; return class_exists( 'WebOnCore' ); break; case 'woocommerce'; return class_exists( 'WooCommerce' ); break; case 'gutenberg-page'; $current_screen = function_exists( 'get_current_screen' ) ? get_current_screen() : array(); return method_exists( $current_screen, 'is_block_editor' ) && $current_screen->is_block_editor(); break; case 'gutenberg-editor': return class_exists( 'WP_Block_Type' ); break; default: return false; } } } if ( ! function_exists( 'webon_include_theme_is_installed' ) ) { /** * Function that set case is installed element for framework functionality * * @param bool $installed * @param string $plugin - plugin name * * @return bool */ function webon_include_theme_is_installed( $installed, $plugin ) { if ( $plugin === 'theme' ) { return class_exists( 'WebonHandler' ); } return $installed; } add_filter( 'qode_framework_filter_is_plugin_installed', 'webon_include_theme_is_installed', 10, 2 ); } if ( ! function_exists( 'webon_template_part' ) ) { /** * Function that echo module template part. * * @param string $module name of the module from inc folder * @param string $template full path of the template to load * @param string $slug * @param array $params array of parameters to pass to template */ function webon_template_part( $module, $template, $slug = '', $params = array() ) { echo webon_get_template_part( $module, $template, $slug, $params ); } } if ( ! function_exists( 'webon_get_template_part' ) ) { /** * Function that load module template part. * * @param string $module name of the module from inc folder * @param string $template full path of the template to load * @param string $slug * @param array $params array of parameters to pass to template * * @return string - string containing html of template */ function webon_get_template_part( $module, $template, $slug = '', $params = array() ) { //HTML Content from template $html = ''; $template_path = WEBON_INC_ROOT_DIR . '/' . $module; $temp = $template_path . '/' . $template; if ( is_array( $params ) && count( $params ) ) { extract( $params ); } $template = ''; if ( ! empty( $temp ) ) { if ( ! empty( $slug ) ) { $template = "{$temp}-{$slug}.php"; if ( ! file_exists( $template ) ) { $template = $temp . '.php'; } } else { $template = $temp . '.php'; } } if ( $template ) { ob_start(); include( $template ); $html = ob_get_clean(); } return $html; } } if ( ! function_exists( 'webon_get_page_id' ) ) { /** * Function that returns current page id * Additional conditional is to check if current page is any wp archive page (archive, category, tag, date etc.) and returns -1 * * @return int */ function webon_get_page_id() { $page_id = get_queried_object_id(); if ( webon_is_wp_template() ) { $page_id = -1; } return apply_filters( 'webon_filter_page_id', $page_id ); } } if ( ! function_exists( 'webon_is_wp_template' ) ) { /** * Function that checks if current page default wp page * * @return bool */ function webon_is_wp_template() { return is_archive() || is_search() || is_404() || ( is_front_page() && is_home() ); } } if ( ! function_exists( 'webon_get_ajax_status' ) ) { /** * Function that return status from ajax functions * * @param string $status - success or error * @param string $message - ajax message value * @param string|array $data - returned value * @param string $redirect - url address */ function webon_get_ajax_status( $status, $message, $data = null, $redirect = '' ) { $response = array( 'status' => esc_attr( $status ), 'message' => esc_html( $message ), 'data' => $data, 'redirect' => ! empty( $redirect ) ? esc_url( $redirect ) : '', ); $output = json_encode( $response ); exit( $output ); } } if ( ! function_exists( 'webon_get_icon' ) ) { /** * Function that return icon html * * @param string $icon - icon class name * @param string $icon_pack - icon pack name * @param string $backup_text - backup text label if framework is not installed * @param array $params - icon parameters * * @return string|mixed */ function webon_get_icon( $icon, $icon_pack, $backup_text, $params = array() ) { $value = webon_is_installed( 'framework' ) && webon_is_installed( 'core' ) ? qode_framework_icons()->render_icon( $icon, $icon_pack, $params ) : $backup_text; return $value; } } if ( ! function_exists( 'webon_render_icon' ) ) { /** * Function that render icon html * * @param string $icon - icon class name * @param string $icon_pack - icon pack name * @param string $backup_text - backup text label if framework is not installed * @param array $params - icon parameters */ function webon_render_icon( $icon, $icon_pack, $backup_text, $params = array() ) { echo webon_get_icon( $icon, $icon_pack, $backup_text, $params ); } } if ( ! function_exists( 'webon_get_button_element' ) ) { /** * Function that returns button with provided params * * @param array $params - array of parameters * * @return string - string representing button html */ function webon_get_button_element( $params ) { if ( class_exists( 'WebOnCoreButtonShortcode' ) ) { return WebOnCoreButtonShortcode::call_shortcode( $params ); } else { $link = isset( $params['link'] ) ? $params['link'] : '#'; $target = isset( $params['target'] ) ? $params['target'] : '_self'; $text = isset( $params['text'] ) ? $params['text'] : ''; return '<a itemprop="url" class="qodef-theme-button" href="' . esc_url( $link ) . '" target="' . esc_attr( $target ) . '">' . esc_html( $text ) . '</a>'; } } } if ( ! function_exists( 'webon_render_button_element' ) ) { /** * Function that render button with provided params * * @param array $params - array of parameters */ function webon_render_button_element( $params ) { echo webon_get_button_element( $params ); } } if ( ! function_exists( 'webon_class_attribute' ) ) { /** * Function that render class attribute * * @param string|array $class */ function webon_class_attribute( $class ) { echo webon_get_class_attribute( $class ); } } if ( ! function_exists( 'webon_get_class_attribute' ) ) { /** * Function that return class attribute * * @param string|array $class * * @return string|mixed */ function webon_get_class_attribute( $class ) { $value = webon_is_installed( 'framework' ) ? qode_framework_get_class_attribute( $class ) : ''; return $value; } } if ( ! function_exists( 'webon_get_post_value_through_levels' ) ) { /** * Function that returns meta value if exists * * @param string $name name of option * @param int $post_id id of * * @return string value of option */ function webon_get_post_value_through_levels( $name, $post_id = null ) { return webon_is_installed( 'framework' ) && webon_is_installed( 'core' ) ? webon_core_get_post_value_through_levels( $name, $post_id ) : ''; } } if ( ! function_exists( 'webon_get_space_value' ) ) { /** * Function that returns spacing value based on selected option * * @param string $text_value - textual value of spacing * * @return int */ function webon_get_space_value( $text_value ) { return webon_is_installed( 'core' ) ? webon_core_get_space_value( $text_value ) : 0; } } if ( ! function_exists( 'webon_wp_kses_html' ) ) { /** * Function that does escaping of specific html. * It uses wp_kses function with predefined attributes array. * * @see wp_kses() * * @param string $type - type of html element * @param string $content - string to escape * * @return string escaped output */ function webon_wp_kses_html( $type, $content ) { return webon_is_installed( 'framework' ) ? qode_framework_wp_kses_html( $type, $content ) : $content; } } if ( ! function_exists( 'webon_render_svg_icon' ) ) { /** * Function that print svg html icon * * @param string $name - icon name * @param string $class_name - custom html tag class name */ function webon_render_svg_icon( $name, $class_name = '' ) { echo webon_get_svg_icon( $name, $class_name ); } } if ( ! function_exists( 'webon_get_svg_icon' ) ) { /** * Returns svg html * * @param string $name - icon name * @param string $class_name - custom html tag class name * * @return string|html */ function webon_get_svg_icon( $name, $class_name = '' ) { $html = ''; $class = isset( $class_name ) && ! empty( $class_name ) ? 'class="' . esc_attr( $class_name ) . '"' : ''; switch ( $name ) { case 'menu': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve"><line x1="12" y1="21" x2="52" y2="21"/><line x1="12" y1="33" x2="52" y2="33"/><line x1="12" y1="45" x2="52" y2="45"/></svg>'; break; case 'search': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="14px" height="14px" viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve"><path fill="currentColor" d="M14,13.28l-3.22-3.22c2.03-2.41,1.94-6-0.32-8.27C9.26,0.6,7.69,0,6.13,0S2.99,0.6,1.79,1.79c-2.39,2.39-2.39,6.27,0,8.66c1.2,1.2,2.76,1.79,4.33,1.79c1.41,0,2.8-0.51,3.93-1.47L13.28,14L14,13.28z M2.52,9.73c-1.99-1.99-1.99-5.23,0-7.22c0.96-0.96,2.25-1.49,3.61-1.49s2.65,0.53,3.61,1.49c1.99,1.99,1.99,5.23,0,7.22c-0.96,0.96-2.25,1.5-3.61,1.5S3.48,10.7,2.52,9.73z"/></svg>'; break; case 'star': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><g><path d="M 20.756,11.768L 15.856,1.84L 10.956,11.768L0,13.36L 7.928,21.088L 6.056,32L 15.856,26.848L 25.656,32L 23.784,21.088L 31.712,13.36 z"></path></g></svg>'; break; case 'arrow': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="34px" height="16px" viewBox="0 0 34.53 16" xml:space="preserve"><rect class="qodef-button-line" y="7.6" width="34" height=".4"></rect><g class="qodef-button-cap-fake"><path class="qodef-button-cap" d="M25.83.7l.7-.7,8,8-.7.71Zm0,14.6,8-8,.71.71-8,8Z"/></g></svg>'; break; case 'menu-arrow-right': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" viewBox="0 0 32 32"><g><path d="M 13.8,24.196c 0.39,0.39, 1.024,0.39, 1.414,0l 6.486-6.486c 0.196-0.196, 0.294-0.454, 0.292-0.71 c0-0.258-0.096-0.514-0.292-0.71L 15.214,9.804c-0.39-0.39-1.024-0.39-1.414,0c-0.39,0.39-0.39,1.024,0,1.414L 19.582,17 L 13.8,22.782C 13.41,23.172, 13.41,23.806, 13.8,24.196z"></path></g></svg>'; break; case 'arrow-left': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="53" height="28" viewBox="0 0 53.02 27"><rect class="qodef-button-line" y="13.5" width="52.05" height="1"/><polygon class="qodef-button-cap" points="51.65 14 38.35 27.3 39.05 28 52.35 14.7 53.05 14 52.35 13.3 39.05 0 38.35 0.7 51.65 14"/></svg>'; break; case 'arrow-right': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="53" height="28" viewBox="0 0 53.02 27"><rect class="qodef-button-line" y="13.5" width="52.05" height="1"/><polygon class="qodef-button-cap" points="51.65 14 38.35 27.3 39.05 28 52.35 14.7 53.05 14 52.35 13.3 39.05 0 38.35 0.7 51.65 14"/></svg>'; break; case 'arrow-up': $html = '<svg ' . $class . ' width="20" height="20" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="currentColor"><g><path d="M 11.218,20.2L 17,14.418l 5.782,5.782c 0.39,0.39, 1.024,0.39, 1.414,0c 0.39-0.39, 0.39-1.024,0-1.414 L 17.71,12.3C 17.514,12.104, 17.258,12.008, 17,12.008c-0.258,0-0.514,0.096-0.71,0.292L 9.804,18.786c-0.39,0.39-0.39,1.024,0,1.414 C 10.194,20.59, 10.828,20.59, 11.218,20.2z"></path></g></svg>'; break; case 'arrow-down': $html = '<svg ' . $class . ' width="20" height="20" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="currentColor"><g><path d="M 22.782,13.8L 17,19.582L 11.218,13.8c-0.39-0.39-1.024-0.39-1.414,0c-0.39,0.39-0.39,1.024,0,1.414 l 6.486,6.486c 0.196,0.196, 0.454,0.294, 0.71,0.292c 0.258,0, 0.514-0.096, 0.71-0.292l 6.486-6.486c 0.39-0.39, 0.39-1.024,0-1.414 C 23.806,13.41, 23.172,13.41, 22.782,13.8z"></path></g></svg>'; break; case 'back-to-top': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="34px" height="16px" viewBox="0 0 34.53 16" xml:space="preserve"><rect class="qodef-button-line" y="7.6" width="34" height=".4"></rect><path class="qodef-button-cap" d="M25.83.7l.7-.7,8,8-.7.71Zm0,14.6,8-8,.71.71-8,8Z"/></svg>'; break; case 'quote': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="63px" height="50px" viewBox="0 0 63 50" style="enable-background:new 0 0 63 50;" xml:space="preserve"><g><g><path d="M62.5,50H38.68c-0.22,0-0.41-0.14-0.48-0.35c-2.43-7.39-3.66-14.71-3.66-21.75c0-8.31,2.21-15.11,6.58-20.2C45.5,2.59,52.02,0,60.49,0C60.77,0,61,0.23,61,0.5v11.43c0,0.28-0.23,0.5-0.5,0.5c-6.02,0-8.95,3.87-8.95,11.83v2.22H62.5c0.28,0,0.5,0.23,0.5,0.5v22.5C63,49.77,62.77,50,62.5,50z M39.05,48.99h22.94V27.5H51.04c-0.28,0-0.5-0.23-0.5-0.5v-2.72c0-8.3,3.18-12.62,9.45-12.83V1.01c-7.92,0.1-14.01,2.57-18.11,7.35c-4.2,4.9-6.33,11.48-6.33,19.54C35.55,34.73,36.73,41.82,39.05,48.99z M28.14,50H4.32c-0.22,0-0.41-0.14-0.48-0.34C1.29,42.38,0,35.06,0,27.9c0-8.31,2.24-15.11,6.67-20.2C11.11,2.59,17.66,0,26.14,0c0.28,0,0.5,0.23,0.5,0.5v11.43c0,0.28-0.23,0.5-0.5,0.5c-6.14,0-9.13,3.87-9.13,11.83v2.22h11.13c0.28,0,0.5,0.23,0.5,0.5v22.5C28.64,49.77,28.42,50,28.14,50z M4.68,48.99h22.95V27.5H16.5c-0.28,0-0.5-0.23-0.5-0.5v-2.72c0-8.31,3.24-12.62,9.63-12.83V1.01c-7.92,0.1-14.05,2.57-18.2,7.35c-4.26,4.9-6.42,11.48-6.42,19.54C1.01,34.84,2.24,41.93,4.68,48.99z"/></g></g></svg>'; break; } return $html; } }
[+]
..
[-] helper.php
[edit]