: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if(!isset($html_atts['height'])&& $size['h']!==''){
$html_atts['height'] = $size['h'];
if(isset($html_atts['width'],$html_atts['height']) && $html_atts['width']>0 && $html_atts['height']>0){
$html_atts['style']='aspect-ratio:'.($html_atts['width']/$html_atts['height']);
$html = '<video ' . themify_get_element_attributes($html_atts) . '>'.$source. '</video>' . trim($content);
public static function media_shortcode_library($library):string {
public static function load_loop_css($class, $post_type, $layout, $type, $moduleArgs = array(), $slug = false) {
if (self::$themeVersion !== null) {//only in themify theme
if (!empty($themify->post_layout_type) && $themify->post_layout_type !== 'default') {
$class[] = $themify->post_layout_type;
if ($post_type === 'product' && themify_is_woocommerce_active()) {
global $woocommerce_loop;
if ((isset($woocommerce_loop['name']) && ($woocommerce_loop['name'] === 'related' || $woocommerce_loop['name'] === 'up-sells') ) || wc_get_loop_prop('is_shortcode')) {
$layout = (int) wc_get_loop_prop('columns');
$index = array_search('columns-' . $layout, $class, true);
$index = array_search('masonry', $class, true);
$index = array_search('infinite', $class, true);
$index = array_search('no-gutter', $class, true);
$layout = $layout === 1 ? 'list-post' : 'grid' . $layout;
self::loadGridCss($layout);
if (in_array('masonry', $class, true)) {
if (!in_array($layout, array('slider', 'auto_tiles'), true) || (!empty($themify->post_filter) && $themify->post_filter !== 'no')) {
if (in_array('tf_fluid', $class, true)) {
self::loadFluidMasonryCss();
$index = array_search('masonry', $class, true);
return array_keys( array_flip($class));
public static function get_css():array {
* Check if the file belongs to themify(plugin, FW, theme and etc.)
public static function is_themify_file(string $file, string $handler):bool {
return strpos($file, 'maps.google.com') === false && (strpos($handler, 'themify') !== false || strpos($handler, 'builder-') === 0 || strpos($handler, 'tf-') === 0 || strpos($handler, 'tb_builder') === 0|| strpos($handler, 'tbp') === 0 || (defined('THEME_URI') && strpos($file, THEME_URI) !== false) || preg_match('/themify[\.\-][^\/]*\.js/', $file));// match "themify.*.js" or "themify-*.js"
public static function loadGuttenbergCss($parsed_block, $source_block) {
remove_filter('render_block_data', array(__CLASS__, 'loadGuttenbergCss'), PHP_INT_MAX);
if (!empty(self::$guttenbergCss)) {
global $wp_styles, $wp_version;
foreach (self::$guttenbergCss as $k => $src) {
if (isset($wp_styles->registered[$k])) {
$ver = $wp_styles->registered[$k]->ver;
if (strpos($src, 'http') === false) {
$src = get_site_url(null, $src);
self::add_css($k, $src, $wp_styles->registered[$k]->deps, $ver, $wp_styles->registered[$k]->args);
self::$guttenbergCss = null;
public static function getCurrentVersionFolder($blog_id = false):string {
$object = wp_get_theme();
$globalKey = THEMIFY_VERSION . $wp_version . $object->get('Name');
$globalKey .= self::$themeVersion !== null ? self::$themeVersion : $object->get('Version');
if (themify_is_woocommerce_active()) {
$globalKey .= WC()->version;
$globalKey = (string) crc32($globalKey);
return themify_upload_dir('basedir') . '/themify-concate/' . $globalKey . '/';
/** Add schedule four_week
public static function cron_schedules(array $schedules):array {
$schedules['four_week'] = array(
'interval' => WEEK_IN_SECONDS * 4,
/** Cron job to remove old concate css files and customizer css files
public static function cron() {
$path = pathinfo(self::getCurrentVersionFolder());
$dir = $path['dirname'] . '/';
if(!class_exists('Themify_Filesystem',false)){
require_once THEMIFY_DIR . '/class-themify-filesystem.php';
if (Themify_Filesystem::is_dir($dir) && ($handle = opendir($dir))) {
$currentFolder = $path['filename'];
$globalKey = '-' . $currentFolder . '-'; //Need for Backward Compatibility, can be removed 11.05.2021
while (false !== ($f = readdir($handle))) {
if ($f !== '.' && $f !== '..' && $currentFolder !== $f && strpos($f, $globalKey, 5) === false) {
Themify_Filesystem::delete($dir . $f);
unset($currentFolder, $dir, $globalKey);
TFCache::clear_3rd_plugins_cache();
$upload_dir = themify_upload_dir('basedir').'/';
$deperecated=$upload_dir.'tf_images_sizes/';
if(Themify_Filesystem::is_dir($deperecated)){
Themify_Filesystem::delete($deperecated);
$deperecated=$upload_dir.'tf_image_ids/';
if(Themify_Filesystem::is_dir($deperecated)){
Themify_Filesystem::delete($deperecated);
if (self::$themeVersion !== null && Themify_Filesystem::is_dir($upload_dir) && ($handle = opendir($upload_dir))) {//remove old customizer css
$cssFile = THEMIFY_VERSION . '-' . self::$themeVersion;
while (false !== ($f = readdir($handle))) {
if ($f !== '.' && $f !== '..' && strpos($f, 'themify-customizer-') === 0 && strpos($f, $cssFile, 10) === false) {
Themify_Filesystem::delete($upload_dir . $f,'f');
Themify_Storage::cleanDb();
private static function getPreLoad():string {
if(!empty(self::$preLoadMedia)){
foreach (self::$preLoadMedia as $src => $arr) {
if ($type === 'style' && isset(self::$css[$src])) {
$src = $src . '?ver=' . $arr['v'];
$extra=' type="font/' . strtok(pathinfo($src, PATHINFO_EXTENSION), '?') . '" crossorigin';
elseif($type === 'image' && isset($arr['srcset'])){
$extra=' imagesrcset="'.$arr['srcset'].'" imagesizes="'.$arr['sizes'].'"';
$extra=' type="application/json" crossorigin="anonymous"';
$return .= sprintf('<link rel="%s" href="%s" as="%s"%s%s>',
(isset($arr['i']) ? ' fetchpriority="' . $arr['i'] . '"' : '')
public static function get_version($url, $ver) {
public static function load_search_form_css() {
remove_action('pre_get_search_form', array(__CLASS__, 'load_search_form_css'), 9);
self::add_css('tf_search_form', self::THEMIFY_CSS_MODULES_URI . 'search-form.css', null, THEMIFY_VERSION);
self::addLocalization('done', 'tf_search_form', true);
public static function body_open(){
echo '<!--tf_svg_holder-->','<script> </script>';
$ga=themify_get('setting-ga_m_id', '', true);
echo '<noscript><iframe data-no-script src="https://www.googletagmanager.com/ns.html?id=GTM-'.$ga.'" height="0" width="0" style="display:none"></iframe></noscript>',
'<script async data-no-optimize="1" data-noptimize="1" data-cfasync="false" data-ga="'.$ga.'" src="data:text/javascript;base64,KGE9PntmdW5jdGlvbiBlKCl7YS5kYXRhTGF5ZXIucHVzaChhcmd1bWVudHMpfWEuZGF0YUxheWVyPWEuZGF0YUxheWVyfHxbXSxlKCJqcyIsbmV3IERhdGUpLGUoImNvbmZpZyIsZG9jdW1lbnQuY3VycmVudFNjcmlwdC5kYXRhc2V0LmdhKSxlKCJldmVudCIsInBhZ2VfdmlldyIpfSkod2luZG93KTs="></script>',
'<script async data-no-optimize="1" data-noptimize="1" data-cfasync="false" src="https://www.googletagmanager.com/gtag/js?id='.$ga.'"></script>';
public static function add_theme_support_css($css) {
self::$theme_css_support[$css]=true;
public static function remove_theme_support_css($css) {
unset(self::$theme_css_support[$css]);
public static function has_theme_support_css($css) {
return isset(self::$theme_css_support[$css]);
public static function exclude_main_js( $exclude) {
if(current_filter()==='autoptimize_filter_js_consider_minified'){
if($exclude!=='' && is_array($exclude)){
elseif(is_array($exclude)){
$exclude[] = 'themify-main-script';
* Exclude Themify scripts from being concatenated in Page Optimize plugin
* @link https://wordpress.org/plugins/page-optimize/
public static function Automattic_page_optimize_js_exclude(bool $do_concat,string $handle ):bool {
if (strpos( $handle, 'themify' ) !== false|| strpos( $handle, 'tb_' ) !== false) {
Themify_Enqueue_Assets::init();