|<\/p>|
|(( * *)|(\s{2,}))|\\r|\\n/", ' ', $text );
if ( mb_strlen( $text ) > $cut ) {
$text = mb_substr( $text, 0, $cut, 'UTF-8' );
return mb_substr( $text, 0, mb_strripos( $text, ' ', 0, 'UTF-8' ), 'UTF-8' ) . $aft;
} else {
return $text;
}
}
}
if ( !function_exists('lte_enable_extended_upload') ) {
function lte_enable_extended_upload ( $mime_types =array() ) {
$mime_types['ttf'] = 'application/x-font-ttf';
$mime_types['woff'] = 'application/x-font-woff';
$mime_types['woff2'] = 'application/x-font-woff2';
$mime_types['svg'] = 'image/svg+xml';
$mime_types['eot'] = 'application/vnd.ms-fontobject';
$mime_types['css'] = 'text/plain';
return $mime_types;
}
if ( is_admin() ) {
add_filter('upload_mimes', 'lte_enable_extended_upload');
}
}
/**
* Enqueue file with latest version from filemtime
*/
if ( !function_exists('lte_wp_enqueue')) {
function lte_wp_enqueue($type = null, $handle = null, $src = null, $deps = array()) {
if ( empty($type) OR empty($handle) OR empty($src) ) {
return false;
}
if ( $type == 'script' ) {
wp_enqueue_script( $handle, lteGetPluginUrl($src), $deps, filemtime(lteGetLocalPath('/'.$src)), true );
}
else
if ( $type == 'style' ) {
wp_enqueue_style( $handle, lteGetPluginUrl($src), $deps, filemtime(lteGetLocalPath('/'.$src)) );
}
}
}
/**
* Checking active status of plugin
*/
if ( !function_exists( 'lte_plugin_is_active' ) ) {
function lte_plugin_is_active( $plugin_var, $plugin_dir = null ) {
if ( empty( $plugin_dir ) ) {
$plugin_dir = $plugin_var;
}
return in_array( $plugin_dir . '/' . $plugin_var . '.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
}
}
/**
* Decodes multistring array
*/
if (!function_exists('lte_html_decode')) {
function lte_html_decode($string) {
if ( is_array($string) && count($string) > 0 ) {
foreach ($string as $key => &$value) {
if (is_string($value)) {
$value = htmlspecialchars_decode($value, ENT_QUOTES);
}
}
}
return $string;
}
}
add_filter( 'big_image_size_threshold', '__return_false' );
if ( !function_exists('lte_get_font_pack') ) {
function lte_get_font_pack( $file ) {
if ( !empty( $file ) ) {
return explode( "\n", file_get_contents( $file ) );
}
}
}
/**
* Get option from Redux database
*/
if ( !function_exists('lte_get_option') ) {
function lte_get_option( $opt ) {
if ( !class_exists( 'Redux' ) ) {
return;
}
return Redux::get_option( 'tofit', $opt );
}
}
/**
* Get Post Metabox value from Redux database
*/
if ( !function_exists('lte_get_meta') ) {
function lte_get_meta( $meta = '', $postId = '' ) {
global $wp_query;
if ( empty($postId) ) {
$postId = get_the_ID();
}
if ( !empty($postId) ) {
if ( !function_exists('redux_post_meta') ) {
if ( !empty($meta) ) {
$var = get_post_meta($postId, $meta);
if ( empty($var) ) return null;
if ( is_array($var) AND !empty($var[0]) ) {
return $var[0];
}
else
if ( is_array($var) AND empty($var[0]) ) {
return null;
}
else {
return $var;
}
}
else {
$array = [];
$vars = get_post_meta($postId);
foreach ( $vars as $k => $var ) {
if ( !empty($var[0]) ) $array[$k] = $var[0];
}
return $array;
}
}
else
if ( function_exists('redux_post_meta') ) {
$opts = redux_post_meta( 'tofit', $postId );
if ( empty($meta) ) {
return $opts;
}
else
if ( !empty($opts[$meta]) ) {
return $opts[$meta];
}
}
}
return;
}
}
if ( !function_exists('lte_get_repeater_array') ) {
function lte_get_repeater_array( $array ) {
$array_out = [];
if ( !empty($array['redux_repeater_data'] ) ) {
foreach ( $array as $key => $items ){
if ( !empty($items) AND $key != 'redux_repeater_data' ) {
foreach ( $items as $k => $v ) {
$array_out[$k][$key] = $v;
}
}
}
return $array_out;
}
return;
}
}
if ( !function_exists('lte_get_meta_array') ) {
function lte_get_meta_array( $opt_array, $postId = '' ) {
if ( is_array($opt_array) ) {
$items = [];
foreach ( $opt_array as $opt ) {
$items[$opt] = lte_get_meta($opt, $postId);
}
return $items;
}
return;
}
}