Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../themify
File: themify-utils.php
return $data[$var];
[500] Fix | Delete
} elseif ($data_only !== true) {
[501] Fix | Delete
global $post;
[502] Fix | Delete
[503] Fix | Delete
if (themify_is_shop() && !in_the_loop()) {
[504] Fix | Delete
$id = themify_shop_pageId();
[505] Fix | Delete
} elseif (is_object($post)) {
[506] Fix | Delete
$id = $post->ID;
[507] Fix | Delete
} else {
[508] Fix | Delete
$id = false;
[509] Fix | Delete
}
[510] Fix | Delete
[511] Fix | Delete
$val = ( $id !== false && $id !== 0 ) ? get_post_meta($id, $var, true) : '';
[512] Fix | Delete
[513] Fix | Delete
if ($val !== '') {
[514] Fix | Delete
return $val;
[515] Fix | Delete
}
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
return $default;
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
/**
[522] Fix | Delete
* Returns a value referenced by $meta,$var checking in theme settings or post meta data.
[523] Fix | Delete
* @param $meta - post meta
[524] Fix | Delete
* @param $var - theme settings
[525] Fix | Delete
* @param $default
[526] Fix | Delete
* @return mixed
[527] Fix | Delete
*/
[528] Fix | Delete
function themify_get_both(string $meta, string $var, $default = null) {
[529] Fix | Delete
$val = themify_get($meta);
[530] Fix | Delete
if ($val === null || $val === 'default') {
[531] Fix | Delete
$val = themify_get($var, $default, true);
[532] Fix | Delete
}
[533] Fix | Delete
return $val;
[534] Fix | Delete
}
[535] Fix | Delete
[536] Fix | Delete
/**
[537] Fix | Delete
* Get a color value, uses themify_get and sanitizes the value
[538] Fix | Delete
*
[539] Fix | Delete
* @return string
[540] Fix | Delete
*/
[541] Fix | Delete
function themify_get_color_both(string $meta, string $var, $default = null) {
[542] Fix | Delete
$val = themify_get_color($meta);
[543] Fix | Delete
if ($val === null || $val === 'default') {
[544] Fix | Delete
$val = themify_get_color($var, $default, true);
[545] Fix | Delete
}
[546] Fix | Delete
return $val;
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
/**
[550] Fix | Delete
* Returns a value referenced by $meta,$var checking in theme settings or post meta data.
[551] Fix | Delete
* @param $meta - post meta
[552] Fix | Delete
* @param $var - theme settings
[553] Fix | Delete
* @return mixed
[554] Fix | Delete
*/
[555] Fix | Delete
function themify_check_both(string $meta, string $var):bool {
[556] Fix | Delete
$val = themify_get($meta, null);
[557] Fix | Delete
if ($val === null || $val === 'default') {
[558] Fix | Delete
$val = themify_get($var, null, true);
[559] Fix | Delete
}
[560] Fix | Delete
return $val !== null && $val !== '' && $val !== 'off';
[561] Fix | Delete
}
[562] Fix | Delete
[563] Fix | Delete
function themify_shop_pageId() {
[564] Fix | Delete
static $id = null;
[565] Fix | Delete
if ($id === null) {
[566] Fix | Delete
if (themify_is_woocommerce_active()) {
[567] Fix | Delete
$id = wc_get_page_id('shop');
[568] Fix | Delete
if ($id <= 0) {//wc bug, page id isn't from wc settings,the default should be page with slug 'shop'
[569] Fix | Delete
$page = get_page_by_path('shop');
[570] Fix | Delete
$id = !empty($page) ? (int) $page->ID : false;
[571] Fix | Delete
}
[572] Fix | Delete
} else {
[573] Fix | Delete
$id = false;
[574] Fix | Delete
}
[575] Fix | Delete
}
[576] Fix | Delete
return $id;
[577] Fix | Delete
}
[578] Fix | Delete
[579] Fix | Delete
/**
[580] Fix | Delete
* Get a color value, uses themify_get and sanitizes the value
[581] Fix | Delete
*
[582] Fix | Delete
* @return string
[583] Fix | Delete
*/
[584] Fix | Delete
function themify_get_color(string $var, $default = null, bool $data_only = false) {
[585] Fix | Delete
return themify_sanitize_hex_color(themify_get($var, $default, $data_only));
[586] Fix | Delete
}
[587] Fix | Delete
[588] Fix | Delete
/**
[589] Fix | Delete
* Sanitize a string to ensure it's valid hex color code
[590] Fix | Delete
*
[591] Fix | Delete
* @since 3.1.2
[592] Fix | Delete
*/
[593] Fix | Delete
function themify_sanitize_hex_color($value) {
[594] Fix | Delete
if ($value===null || false === $value) {
[595] Fix | Delete
return $value;
[596] Fix | Delete
}
[597] Fix | Delete
$value = ltrim($value, '#');
[598] Fix | Delete
/* match 3 to 6 hex digits */
[599] Fix | Delete
if (preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', $value)) {
[600] Fix | Delete
$value = '#' . $value;
[601] Fix | Delete
}
[602] Fix | Delete
[603] Fix | Delete
return $value;
[604] Fix | Delete
}
[605] Fix | Delete
[606] Fix | Delete
if (!function_exists('themify_get_image_sizes_list')) {
[607] Fix | Delete
[608] Fix | Delete
/**
[609] Fix | Delete
* Return list of image sizes with labels for translation.
[610] Fix | Delete
* @param bool $nested
[611] Fix | Delete
* @return mixed|void
[612] Fix | Delete
* @since 1.6.8
[613] Fix | Delete
*/
[614] Fix | Delete
function themify_get_image_sizes_list(bool $nested = true) {
[615] Fix | Delete
$size_names = apply_filters('image_size_names_choose',
[616] Fix | Delete
array(
[617] Fix | Delete
'thumbnail' => __('Thumbnail', 'themify'),
[618] Fix | Delete
'medium' => __('Medium', 'themify'),
[619] Fix | Delete
'large' => __('Large', 'themify'),
[620] Fix | Delete
'full' => __('Original Image', 'themify')
[621] Fix | Delete
)
[622] Fix | Delete
);
[623] Fix | Delete
$out = array(
[624] Fix | Delete
array('value' => 'blank', 'name' => ''),
[625] Fix | Delete
);
[626] Fix | Delete
foreach ($size_names as $size => $label) {
[627] Fix | Delete
$out[] = array('value' => $size, 'name' => $label);
[628] Fix | Delete
}
[629] Fix | Delete
return apply_filters('themify_get_image_sizes_list', $nested ? $out : $size_names, $nested);
[630] Fix | Delete
}
[631] Fix | Delete
[632] Fix | Delete
}
[633] Fix | Delete
[634] Fix | Delete
/**
[635] Fix | Delete
* Check if the site is using an HTTPS scheme and returns the proper url
[636] Fix | Delete
* @param String $url requested url
[637] Fix | Delete
* @return String
[638] Fix | Delete
* @since 1.1.5
[639] Fix | Delete
*/
[640] Fix | Delete
function themify_https_esc(string $url = ''):string {
[641] Fix | Delete
if (is_ssl()) {
[642] Fix | Delete
$url = str_replace('http:', 'https:', $url);
[643] Fix | Delete
}
[644] Fix | Delete
return $url;
[645] Fix | Delete
}
[646] Fix | Delete
[647] Fix | Delete
/**
[648] Fix | Delete
* Returns an array with the post types managed by Themify,
[649] Fix | Delete
* where the Themify Custom Panel is initialized.
[650] Fix | Delete
* Filterable using themify_post_types
[651] Fix | Delete
* @param Array $types additional post types
[652] Fix | Delete
* @return Array
[653] Fix | Delete
* @since 1.1.5
[654] Fix | Delete
*/
[655] Fix | Delete
function themify_post_types(array $types = array()):array {
[656] Fix | Delete
$defaults = array_merge(array('post', 'page'), apply_filters('themify_specific_post_types', array('menu', 'slider', 'highlight', 'portfolio', 'testimonial', 'section')), $types);
[657] Fix | Delete
if (themify_is_themify_theme() && themify_is_woocommerce_active() && is_file(THEME_DIR . '/admin/post-type-product.php')) {
[658] Fix | Delete
$defaults[] = 'product';
[659] Fix | Delete
}
[660] Fix | Delete
return array_keys(array_flip(apply_filters('themify_post_types', $defaults)));
[661] Fix | Delete
}
[662] Fix | Delete
[663] Fix | Delete
if (!function_exists('themify_options_module')) {
[664] Fix | Delete
[665] Fix | Delete
/**
[666] Fix | Delete
* Returns list of <option>
[667] Fix | Delete
* @param array $options List of options
[668] Fix | Delete
* @param string $key
[669] Fix | Delete
* @param bool $associative
[670] Fix | Delete
* @param string $default
[671] Fix | Delete
* @return string
[672] Fix | Delete
* @since 1.3.5
[673] Fix | Delete
*/
[674] Fix | Delete
function themify_options_module($options = array(), $key = '', $associative = true, $default = ''):string {
[675] Fix | Delete
$data = themify_get_data();
[676] Fix | Delete
$sel = isset($data[$key]) ? $data[$key] : $default;
[677] Fix | Delete
$data = null;
[678] Fix | Delete
$output = '';
[679] Fix | Delete
if (true === $associative) {
[680] Fix | Delete
foreach ($options as $option) {
[681] Fix | Delete
$output .= '<option ' . selected($option['value'], $sel, false) . ' value="' . esc_attr($option['value']) . '">' . esc_html($option['name']) . '</option>';
[682] Fix | Delete
}
[683] Fix | Delete
} else {
[684] Fix | Delete
foreach ($options as $option) {
[685] Fix | Delete
$option = esc_attr($option);
[686] Fix | Delete
$selected = $sel === $option ? ' selected="selected"' : '';
[687] Fix | Delete
$output .= '<option value="' . $option . '"' . $selected . '>' . esc_html($option) . '</option>';
[688] Fix | Delete
}
[689] Fix | Delete
}
[690] Fix | Delete
return $output;
[691] Fix | Delete
}
[692] Fix | Delete
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
if (!function_exists('themify_lightbox_vars_init')) {
[696] Fix | Delete
[697] Fix | Delete
/**
[698] Fix | Delete
* Post Gallery lightbox/fullscreen and single lightbox definition
[699] Fix | Delete
* @return array Lightbox/Fullscreen galleries initialization parameters
[700] Fix | Delete
*/
[701] Fix | Delete
function themify_lightbox_vars_init():array {
[702] Fix | Delete
$gallery_lightbox = themify_get('setting-gallery_lightbox', 'lightbox', true);
[703] Fix | Delete
// Lightbox default settings
[704] Fix | Delete
$overlay_args = array();
[705] Fix | Delete
if (themify_check('setting-lightbox_content_images', true)) {
[706] Fix | Delete
$overlay_args['contentImagesAreas'] = '.post, .type-page, .type-highlight, .type-slider';
[707] Fix | Delete
}
[708] Fix | Delete
if (themify_check('setting-lightbox_disable_share', true)) {
[709] Fix | Delete
$overlay_args['disable_sharing'] = true;
[710] Fix | Delete
}
[711] Fix | Delete
if ($gallery_lightbox === 'none') {
[712] Fix | Delete
$overlay_args['gallerySelector'] = '';
[713] Fix | Delete
}
[714] Fix | Delete
[715] Fix | Delete
$overlay_args = apply_filters('themify_gallery_plugins_args', $overlay_args);
[716] Fix | Delete
// sanitize contentImagesAreas, ensure it's a valid CSS selector
[717] Fix | Delete
if (isset($overlay_args['contentImagesAreas'])) {
[718] Fix | Delete
$overlay_args['contentImagesAreas'] = trim($overlay_args['contentImagesAreas'], ',');
[719] Fix | Delete
}
[720] Fix | Delete
$overlay_args['i18n'] = array(
[721] Fix | Delete
'tCounter' => __('%curr% of %total%', 'themify'),
[722] Fix | Delete
);
[723] Fix | Delete
[724] Fix | Delete
return $overlay_args;
[725] Fix | Delete
}
[726] Fix | Delete
[727] Fix | Delete
}
[728] Fix | Delete
[729] Fix | Delete
if (!function_exists('themify_get_shortcode_template')) {
[730] Fix | Delete
[731] Fix | Delete
/**
[732] Fix | Delete
* Returns markup
[733] Fix | Delete
* @param $posts
[734] Fix | Delete
* @param string $slug
[735] Fix | Delete
* @param string $name
[736] Fix | Delete
* @return mixed|void
[737] Fix | Delete
*/
[738] Fix | Delete
function themify_get_shortcode_template($posts, string $slug = 'includes/loop', string $name = 'index', array $args = array()):string {
[739] Fix | Delete
global $post, $themify;
[740] Fix | Delete
Themify_Enqueue_Assets::loadGridCss($themify->post_layout);
[741] Fix | Delete
[742] Fix | Delete
if (is_object($post)){
[743] Fix | Delete
$saved_post = clone $post;
[744] Fix | Delete
}
[745] Fix | Delete
if(property_exists($themify, 'is_shortcode')){
[746] Fix | Delete
$isShortcode = $themify->is_shortcode === true;
[747] Fix | Delete
$themify->is_shortcode = true;
[748] Fix | Delete
}
[749] Fix | Delete
[750] Fix | Delete
// Add flag that template loop is in builder loop
[751] Fix | Delete
if (class_exists('\Themify_Builder',false)) {
[752] Fix | Delete
$isLoop = Themify_Builder::$is_loop;
[753] Fix | Delete
Themify_Builder::$is_loop = true;
[754] Fix | Delete
}
[755] Fix | Delete
[756] Fix | Delete
// get_template_part, defined in wp-includes/general-template.php
[757] Fix | Delete
$templates = array();
[758] Fix | Delete
if ('' !== $name) {
[759] Fix | Delete
$templates[] = "{$slug}-{$name}.php";
[760] Fix | Delete
}
[761] Fix | Delete
$templates[] = "{$slug}.php";
[762] Fix | Delete
$template_file = apply_filters('themify_get_shortcode_template_file', locate_template($templates, false, false), $slug, $name);
[763] Fix | Delete
$isSlider = $themify->post_layout === 'slider' || (isset($args['isSlider']) && $args['isSlider'] === true);
[764] Fix | Delete
ob_start();
[765] Fix | Delete
if (!empty($template_file)) {
[766] Fix | Delete
$before = isset($args['before_post']) ? $args['before_post'] : '';
[767] Fix | Delete
$after = isset($args['after_post']) ? $args['after_post'] : '';
[768] Fix | Delete
foreach ($posts as $p) {
[769] Fix | Delete
$post=$p;
[770] Fix | Delete
setup_postdata($post);
[771] Fix | Delete
if ($isSlider === true) {
[772] Fix | Delete
echo '<div class="tf_lazy tf_swiper-slide">';
[773] Fix | Delete
}
[774] Fix | Delete
echo $before;
[775] Fix | Delete
include $template_file;
[776] Fix | Delete
echo $after;
[777] Fix | Delete
if ($isSlider === true) {
[778] Fix | Delete
echo '</div>';
[779] Fix | Delete
}
[780] Fix | Delete
}
[781] Fix | Delete
$posts = null;
[782] Fix | Delete
}
[783] Fix | Delete
[784] Fix | Delete
if (isset($saved_post)) {
[785] Fix | Delete
$post = $saved_post;
[786] Fix | Delete
setup_postdata($saved_post);
[787] Fix | Delete
unset($saved_post);
[788] Fix | Delete
}
[789] Fix | Delete
// Add flag that template loop is in builder loop
[790] Fix | Delete
if (isset($isLoop)) {
[791] Fix | Delete
Themify_Builder::$is_loop = $isLoop;
[792] Fix | Delete
}
[793] Fix | Delete
if(isset($isShortcode)){
[794] Fix | Delete
$themify->is_shortcode = $isShortcode;
[795] Fix | Delete
}
[796] Fix | Delete
$res=ob_get_clean();
[797] Fix | Delete
return $res?$res:'';
[798] Fix | Delete
}
[799] Fix | Delete
[800] Fix | Delete
}
[801] Fix | Delete
[802] Fix | Delete
if (!function_exists('themify_get_gallery_shortcode')) {
[803] Fix | Delete
[804] Fix | Delete
/**
[805] Fix | Delete
* Get images from gallery shortcode
[806] Fix | Delete
* @return object
[807] Fix | Delete
*/
[808] Fix | Delete
function themify_get_gallery_shortcode(?string $shortcode):array {
[809] Fix | Delete
if ($shortcode) {
[810] Fix | Delete
preg_match('/\[gallery.*ids.*?=.(.*).\]/si', $shortcode, $ids);
[811] Fix | Delete
if (isset($ids[1])) {
[812] Fix | Delete
$ids = trim($ids[1], '\\');
[813] Fix | Delete
$ids = trim($ids, '"');
[814] Fix | Delete
$image_ids = explode(',', $ids);
[815] Fix | Delete
[816] Fix | Delete
// Check if post has more than one image in gallery
[817] Fix | Delete
return get_posts(array(
[818] Fix | Delete
'post__in' => $image_ids,
[819] Fix | Delete
'post_type' => 'attachment',
[820] Fix | Delete
'post_mime_type' => 'image',
[821] Fix | Delete
'numberposts' => -1,
[822] Fix | Delete
'no_found_rows' => true,
[823] Fix | Delete
'cache_results' => false,
[824] Fix | Delete
'update_post_term_cache' => false,
[825] Fix | Delete
'update_post_meta_cache' => false,
[826] Fix | Delete
'orderby' => themify_get_gallery_shortcode_params($shortcode, 'orderby', 'post__in'),
[827] Fix | Delete
'order' => themify_get_gallery_shortcode_params($shortcode, 'order', 'ASC')
[828] Fix | Delete
));
[829] Fix | Delete
}
[830] Fix | Delete
}
[831] Fix | Delete
return array();
[832] Fix | Delete
}
[833] Fix | Delete
[834] Fix | Delete
}
[835] Fix | Delete
[836] Fix | Delete
if (!function_exists('themify_get_gallery_shortcode_params')) {
[837] Fix | Delete
[838] Fix | Delete
/**
[839] Fix | Delete
* Get gallery shortcode options
[840] Fix | Delete
* @param $shortcode
[841] Fix | Delete
* @param $param
[842] Fix | Delete
*/
[843] Fix | Delete
function themify_get_gallery_shortcode_params(string $shortcode, string $param = 'link', $default = '') {
[844] Fix | Delete
$pattern = '/\[gallery .*?(?=' . $param . ')' . $param . '=.([^\']+)./si';
[845] Fix | Delete
preg_match($pattern, $shortcode, $out);
[846] Fix | Delete
$out = isset($out[1]) ? explode('"', $out[1]) : array('');
[847] Fix | Delete
return $out[0] !== '' ? $out[0] : $default;
[848] Fix | Delete
}
[849] Fix | Delete
[850] Fix | Delete
}
[851] Fix | Delete
[852] Fix | Delete
function themify_get_additional_image_sizes(string $size = 'all', $default = false) {
[853] Fix | Delete
$allSizes = wp_get_additional_image_sizes();
[854] Fix | Delete
if ($size === 'all') {
[855] Fix | Delete
return $allSizes;
[856] Fix | Delete
}
[857] Fix | Delete
return isset($allSizes[$size]) ? $allSizes[$size] : $default;
[858] Fix | Delete
}
[859] Fix | Delete
[860] Fix | Delete
if (!function_exists('themify_get_all_terms_ids')) {
[861] Fix | Delete
[862] Fix | Delete
/**
[863] Fix | Delete
* Returns all IDs from the given taxonomy
[864] Fix | Delete
* @param string $tax Taxonomy to retrieve terms from.
[865] Fix | Delete
* @return array $term_ids Array of all taxonomy terms
[866] Fix | Delete
* @since 1.5.6
[867] Fix | Delete
*/
[868] Fix | Delete
function themify_get_all_terms_ids(string $tax = 'category') {
[869] Fix | Delete
if (!$term_ids = wp_cache_get('all_' . $tax . '_ids', $tax)) {
[870] Fix | Delete
$term_ids = get_terms(array('taxonomy' => $tax, 'fields' => 'ids', 'get' => 'all'));
[871] Fix | Delete
wp_cache_add('all_' . $tax . '_ids', $term_ids, $tax);
[872] Fix | Delete
}
[873] Fix | Delete
return $term_ids;
[874] Fix | Delete
}
[875] Fix | Delete
[876] Fix | Delete
}
[877] Fix | Delete
[878] Fix | Delete
if (!function_exists('themify_is_touch')) {
[879] Fix | Delete
[880] Fix | Delete
/**
[881] Fix | Delete
* According to what $check parameter specifies to check, returns true if it's a phone, tablet, or both.
[882] Fix | Delete
* @param string $check
[883] Fix | Delete
* @return mixed
[884] Fix | Delete
* @since 1.6.8
[885] Fix | Delete
*/
[886] Fix | Delete
function themify_is_touch($check = 'all') {
[887] Fix | Delete
static $arr = array();
[888] Fix | Delete
[889] Fix | Delete
if (!isset($arr[$check])) {
[890] Fix | Delete
if (!class_exists('Themify_Mobile_Detect',false)) {
[891] Fix | Delete
require_once 'class-themify-mobile-detect.php';
[892] Fix | Delete
}
[893] Fix | Delete
$detect = new Themify_Mobile_Detect();
[894] Fix | Delete
$is_tablet = isset($arr['tablet']) ? $arr['tablet'] : $detect->isTablet();
[895] Fix | Delete
$is_mobile = isset($arr['phone']) ? $arr['phone'] : (wp_is_mobile() || $detect->isMobile());
[896] Fix | Delete
$arr = array(
[897] Fix | Delete
'phone' => $is_mobile && !$is_tablet,
[898] Fix | Delete
'tablet' => $is_tablet,
[899] Fix | Delete
'all' => $is_mobile
[900] Fix | Delete
);
[901] Fix | Delete
$detect = null;
[902] Fix | Delete
}
[903] Fix | Delete
[904] Fix | Delete
return $arr[$check];
[905] Fix | Delete
}
[906] Fix | Delete
[907] Fix | Delete
}
[908] Fix | Delete
[909] Fix | Delete
/**
[910] Fix | Delete
* Checks that status of the image script.
[911] Fix | Delete
* @return bool
[912] Fix | Delete
* @since 1.7.4
[913] Fix | Delete
*/
[914] Fix | Delete
function themify_is_image_script_disabled():bool {
[915] Fix | Delete
static $is = null;
[916] Fix | Delete
if ($is === null) {
[917] Fix | Delete
$is = wp_image_editor_supports() ? themify_check('setting-img_settings_use', true) : false;
[918] Fix | Delete
}
[919] Fix | Delete
[920] Fix | Delete
return $is;
[921] Fix | Delete
}
[922] Fix | Delete
[923] Fix | Delete
[924] Fix | Delete
if (!function_exists('themify_get_available_menus')) {
[925] Fix | Delete
[926] Fix | Delete
/**
[927] Fix | Delete
* Returns available navigation menus.
[928] Fix | Delete
*
[929] Fix | Delete
* @since 1.9.5
[930] Fix | Delete
*
[931] Fix | Delete
* @return array
[932] Fix | Delete
*/
[933] Fix | Delete
function themify_get_available_menus():array {
[934] Fix | Delete
$out = array(array('name' => '', 'value' => '', 'selected' => true));
[935] Fix | Delete
$menus = get_terms(array(
[936] Fix | Delete
'taxonomy' => 'nav_menu',
[937] Fix | Delete
'hide_empty' => false,
[938] Fix | Delete
));
[939] Fix | Delete
if (!empty($menus) && !is_wp_error($menus)) {
[940] Fix | Delete
foreach ($menus as $menu) {
[941] Fix | Delete
$out[] = array('name' => $menu->name, 'value' => $menu->slug);
[942] Fix | Delete
}
[943] Fix | Delete
}
[944] Fix | Delete
return apply_filters('themify_get_available_menus', $out);
[945] Fix | Delete
}
[946] Fix | Delete
[947] Fix | Delete
}
[948] Fix | Delete
[949] Fix | Delete
/**
[950] Fix | Delete
* Returns true if the active theme is using Themify framework
[951] Fix | Delete
*
[952] Fix | Delete
* @since 2.2.5
[953] Fix | Delete
* @return bool
[954] Fix | Delete
*/
[955] Fix | Delete
function themify_is_themify_theme():bool {
[956] Fix | Delete
static $is = null;
[957] Fix | Delete
if ($is === null) {
[958] Fix | Delete
$is = is_file(trailingslashit(get_template_directory()) . 'themify/themify-utils.php');
[959] Fix | Delete
}
[960] Fix | Delete
[961] Fix | Delete
return $is;
[962] Fix | Delete
}
[963] Fix | Delete
[964] Fix | Delete
if (!function_exists('themify_is_woocommerce_active')) {
[965] Fix | Delete
[966] Fix | Delete
/**
[967] Fix | Delete
* Checks if Woocommerce plugin is active and returns the proper value
[968] Fix | Delete
* @return bool
[969] Fix | Delete
* @since 1.4.6
[970] Fix | Delete
*/
[971] Fix | Delete
function themify_is_woocommerce_active():bool {
[972] Fix | Delete
static $is = null;
[973] Fix | Delete
if ($is === null) {
[974] Fix | Delete
$plugin = 'woocommerce/woocommerce.php';
[975] Fix | Delete
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
[976] Fix | Delete
return is_plugin_active($plugin)
[977] Fix | Delete
// validate if $plugin actually exists, the plugin might be active however not installed.
[978] Fix | Delete
&& is_file(trailingslashit(WP_PLUGIN_DIR) . $plugin);
[979] Fix | Delete
}
[980] Fix | Delete
return $is;
[981] Fix | Delete
}
[982] Fix | Delete
[983] Fix | Delete
}
[984] Fix | Delete
[985] Fix | Delete
/**
[986] Fix | Delete
* Calls is_shop() in a safe manner
[987] Fix | Delete
*
[988] Fix | Delete
* @note: this function should not be called before template_redirect.
[989] Fix | Delete
*
[990] Fix | Delete
* @since 2.9.0
[991] Fix | Delete
*/
[992] Fix | Delete
function themify_is_shop($pageId = false):bool {
[993] Fix | Delete
static $is = null;
[994] Fix | Delete
if ($is === null) {
[995] Fix | Delete
$is = themify_is_woocommerce_active();
[996] Fix | Delete
if ($is === true) {
[997] Fix | Delete
$is = is_post_type_archive('product') || ($pageId > 0 && $pageId === themify_shop_pageId()); //don't use shop function will give error
[998] Fix | Delete
if ($is === false) {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function