File manager - Edit - /home/carfac/public_html/moabmonsters.com/wordpress/wp-content/themes/kamperen/helpers/helper.php
Back
<?php if ( ! function_exists( 'kamperen_is_installed' ) ) { /** * Function that checks if forward plugin installed * * @param string $plugin - plugin name * * @return bool */ function kamperen_is_installed( $plugin ) { switch ( $plugin ) { case 'framework': return class_exists( 'QodeFramework' ); case 'core': return class_exists( 'KamperenCore' ); case 'woocommerce': return class_exists( 'WooCommerce' ); 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(); case 'gutenberg-editor': return class_exists( 'WP_Block_Type' ); default: return false; } } } if ( ! function_exists( 'kamperen_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 kamperen_include_theme_is_installed( $installed, $plugin ) { if ( 'theme' === $plugin ) { return class_exists( 'Kamperen_Handler' ); } return $installed; } add_filter( 'qode_framework_filter_is_plugin_installed', 'kamperen_include_theme_is_installed', 10, 2 ); } if ( ! function_exists( 'kamperen_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 kamperen_template_part( $module, $template, $slug = '', $params = array() ) { echo kamperen_get_template_part( $module, $template, $slug, $params ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! function_exists( 'kamperen_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 kamperen_get_template_part( $module, $template, $slug = '', $params = array() ) { $available_characters = '/[^A-Za-z0-9\_\-\/]/'; if ( is_scalar( $module ) ) { $module = preg_replace( $available_characters, '', $module ); } else { $module = ''; } if ( is_scalar( $template ) ) { $template = preg_replace( $available_characters, '', $template ); } else { $template = ''; } if ( is_scalar( $slug ) ) { $slug = preg_replace( $available_characters, '', $slug ); } else { $slug = ''; } // HTML Content from template. $html = ''; $template_path = KAMPEREN_INC_ROOT_DIR . '/' . $module; $temp = $template_path . '/' . $template; // The array of parameters to pass to the template. if ( is_array( $params ) && count( $params ) ) { extract( $params, EXTR_SKIP ); // @codingStandardsIgnoreLine } $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; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound $html = ob_get_clean(); } return $html; } } if ( ! function_exists( 'kamperen_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 kamperen_get_page_id() { $page_id = get_queried_object_id(); if ( kamperen_is_wp_template() ) { $page_id = - 1; } return apply_filters( 'kamperen_filter_page_id', $page_id ); } } if ( ! function_exists( 'kamperen_is_wp_template' ) ) { /** * Function that checks if current page default wp page * * @return bool */ function kamperen_is_wp_template() { return is_archive() || is_search() || is_404() || ( is_front_page() && is_home() ); } } if ( ! function_exists( 'kamperen_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 kamperen_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 ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! function_exists( 'kamperen_get_button_element' ) ) { /** * Function that returns button with provided params * * @param array $params - array of parameters * * @return string - string representing button html */ function kamperen_get_button_element( $params ) { if ( class_exists( 'KamperenCore_Button_Shortcode' ) ) { return KamperenCore_Button_Shortcode::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 ) . '"><span class="qodef-m-text">' . esc_html( $text ) . '</span><span class="qodef-m-icon"><svg xmlns="http://www.w3.org/2000/svg" width="20.053" height="10.039" viewBox="0 0 20.053 10.039"><path d="M17.474,11.444a.683.683,0,0,0-.005.962l3.179,3.184H3.549a.68.68,0,0,0,0,1.359H20.643l-3.179,3.184a.688.688,0,0,0,.005.962.677.677,0,0,0,.957-.005l4.308-4.34h0a.763.763,0,0,0,.141-.214.649.649,0,0,0,.052-.261.681.681,0,0,0-.193-.476l-4.308-4.34A.666.666,0,0,0,17.474,11.444Z" transform="translate(-2.875 -11.252)"/></svg></span></a>'; } } } if ( ! function_exists( 'kamperen_render_button_element' ) ) { /** * Function that render button with provided params * * @param array $params - array of parameters */ function kamperen_render_button_element( $params ) { echo kamperen_get_button_element( $params ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! function_exists( 'kamperen_class_attribute' ) ) { /** * Function that render class attribute * * @param string|array $class */ function kamperen_class_attribute( $class ) { echo kamperen_get_class_attribute( $class ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! function_exists( 'kamperen_get_class_attribute' ) ) { /** * Function that return class attribute * * @param string|array $class * * @return string|mixed */ function kamperen_get_class_attribute( $class ) { return kamperen_is_installed( 'framework' ) ? qode_framework_get_class_attribute( $class ) : ''; } } if ( ! function_exists( 'kamperen_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 kamperen_get_post_value_through_levels( $name, $post_id = null ) { return kamperen_is_installed( 'framework' ) && kamperen_is_installed( 'core' ) ? kamperen_core_get_post_value_through_levels( $name, $post_id ) : ''; } } if ( ! function_exists( 'kamperen_get_space_value' ) ) { /** * Function that returns spacing value based on selected option * * @param string $text_value - textual value of spacing * * @return int */ function kamperen_get_space_value( $text_value ) { return kamperen_is_installed( 'core' ) ? kamperen_core_get_space_value( $text_value ) : 0; } } if ( ! function_exists( 'kamperen_wp_kses_html' ) ) { /** * Function that does escaping of specific html. * It uses wp_kses function with predefined attributes array. * * @param string $type - type of html element * @param string $content - string to escape * * @return string escaped output * @see wp_kses() * */ function kamperen_wp_kses_html( $type, $content ) { return kamperen_is_installed( 'framework' ) ? qode_framework_wp_kses_html( $type, $content ) : $content; } } if ( ! function_exists( 'kamperen_render_svg_icon' ) ) { /** * Function that print svg html icon * * @param string $name - icon name * @param string $class_name - custom html tag class name */ function kamperen_render_svg_icon( $name, $class_name = '' ) { echo kamperen_get_svg_icon( $name, $class_name ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } if ( ! function_exists( 'kamperen_get_svg_icon' ) ) { /** * Returns svg html * * @param string $name - icon name * @param string $class_name - custom html tag class name * * @return string - string containing svg html */ function kamperen_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" width="21.543" height="21.543" viewBox="0 0 21.543 21.543"><path d="M19.9,18.049h-.973l-.345-.333a8.018,8.018,0,1,0-.862.862l.333.345V19.9l6.159,6.146,1.835-1.835Zm-7.39,0a5.543,5.543,0,1,1,5.543-5.543A5.535,5.535,0,0,1,12.506,18.049Z" transform="translate(-4.5 -4.5)"/></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 '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 'slider-arrow-left': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="30.256" height="25.243" viewBox="0 0 30.256 25.243"><g transform="translate(30.621 30.621) rotate(180)"><path d="M7.5,18H31.159" transform="translate(-5.635)" fill="none" stroke="#fff" stroke-linecap="square" stroke-linejoin="round" stroke-width="3"/><path d="M18,7.5,28.5,18,18,28.5" fill="none" stroke="#fff" stroke-linecap="square" stroke-width="3"/></g></svg>'; break; case 'slider-arrow-right': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="30.256" height="25.243" viewBox="0 0 30.256 25.243"><g transform="translate(-0.365 -5.379)"><path d="M7.5,18H31.159" transform="translate(-5.635)" fill="none" stroke="#fff" stroke-linecap="square" stroke-linejoin="round" stroke-width="3"/><path d="M18,7.5,28.5,18,18,28.5" fill="none" stroke="#fff" stroke-linecap="square" stroke-width="3"/></g></svg>'; break; case 'pagination-arrow-left': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="20.053" height="10.04" viewBox="0 0 20.053 10.04"><path d="M17.474,11.444a.683.683,0,0,0-.005.962l3.179,3.184H3.549a.68.68,0,0,0,0,1.359H20.643l-3.179,3.184a.688.688,0,0,0,.005.962.677.677,0,0,0,.957-.005l4.308-4.34h0a.763.763,0,0,0,.141-.214.649.649,0,0,0,.052-.261.681.681,0,0,0-.193-.476l-4.308-4.34A.666.666,0,0,0,17.474,11.444Z" transform="translate(22.928 21.291) rotate(180)"/></svg>'; break; case 'pagination-arrow-right': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="20.053" height="10.039" viewBox="0 0 20.053 10.039"><path d="M17.474,11.444a.683.683,0,0,0-.005.962l3.179,3.184H3.549a.68.68,0,0,0,0,1.359H20.643l-3.179,3.184a.688.688,0,0,0,.005.962.677.677,0,0,0,.957-.005l4.308-4.34h0a.763.763,0,0,0,.141-.214.649.649,0,0,0,.052-.261.681.681,0,0,0-.193-.476l-4.308-4.34A.666.666,0,0,0,17.474,11.444Z" transform="translate(-2.875 -11.252)"></path></svg>'; break; case 'close': $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 10.050,23.95c 0.39,0.39, 1.024,0.39, 1.414,0L 17,18.414l 5.536,5.536c 0.39,0.39, 1.024,0.39, 1.414,0 c 0.39-0.39, 0.39-1.024,0-1.414L 18.414,17l 5.536-5.536c 0.39-0.39, 0.39-1.024,0-1.414c-0.39-0.39-1.024-0.39-1.414,0 L 17,15.586L 11.464,10.050c-0.39-0.39-1.024-0.39-1.414,0c-0.39,0.39-0.39,1.024,0,1.414L 15.586,17l-5.536,5.536 C 9.66,22.926, 9.66,23.56, 10.050,23.95z"></path></g></svg>'; break; case 'spinner': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512"><path d="M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"></path></svg>'; break; case 'link': $html = '<svg ' . $class . ' xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32.06999969482422" height="33.58000183105469" viewBox="0 0 32.06999969482422 33.58000183105469"><g><path d="M 7.54,15.77c 1.278,1.278, 3.158,1.726, 4.868,1.216L 2.96,7.54C 2.652,7.232, 2.49,6.786, 2.49,6.254 c0-0.88, 0.46-2.004, 1.070-2.614c 0.8-0.8, 2.97-1.686, 3.98-0.682l 9.446,9.448c 0.138-0.462, 0.208-0.942, 0.208-1.422 c0-1.304-0.506-2.526-1.424-3.446L 9.364,1.134C 7.44-0.79, 3.616-0.068, 1.734,1.814C 0.642,2.906-0.036,4.598-0.036,6.23 c0,1.268, 0.416,2.382, 1.17,3.136L 7.54,15.77zM 24.46,16.23c-1.278-1.278-3.158-1.726-4.868-1.216l 9.448,9.448c 0.308,0.308, 0.47,0.752, 0.47,1.286 c0,0.88-0.46,2.004-1.070,2.614c-0.8,0.8-2.97,1.686-3.98,0.682L 15.014,19.594c-0.138,0.462-0.208,0.942-0.208,1.422 c0,1.304, 0.506,2.526, 1.424,3.446l 6.404,6.404c 1.924,1.924, 5.748,1.202, 7.63-0.68c 1.092-1.092, 1.77-2.784, 1.77-4.416 c0-1.268-0.416-2.382-1.17-3.136L 24.46,16.23zM 9.164,9.162C 8.908,9.416, 8.768,9.756, 8.768,10.116s 0.14,0.698, 0.394,0.952l 11.768,11.77 c 0.526,0.524, 1.38,0.524, 1.906,0c 0.256-0.254, 0.394-0.594, 0.394-0.954s-0.14-0.698-0.394-0.952L 11.068,9.162 C 10.544,8.638, 9.688,8.638, 9.164,9.162z"></path></g></svg>'; break; } return apply_filters( 'kamperen_filter_svg_icon', $html, $name ); } } if ( ! function_exists( 'kamperen_escape_title_tag' ) ) { /** * Function that escape title tag variable for modules * * @param string $title_tag * * @return string */ function kamperen_escape_title_tag( $title_tag ) { $allowed_tags = array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'ul', 'ol', ); $escaped_title_tag = ''; $title_tag = strtolower( sanitize_key( $title_tag ) ); if ( in_array( $title_tag, $allowed_tags, true ) ) { $escaped_title_tag = $title_tag; } return $escaped_title_tag; } }
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0.41 |
proxy
|
phpinfo
|
Settings