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: class-themify-enqueue.php
}
[1500] Fix | Delete
}
[1501] Fix | Delete
}
[1502] Fix | Delete
if(!empty($arr['src'])){
[1503] Fix | Delete
if(strpos($arr['src'],'fonts.gstatic')!==false){
[1504] Fix | Delete
$fkey=$arr['font-family'];
[1505] Fix | Delete
if(isset($arr['font-style'])){
[1506] Fix | Delete
$fkey.=$arr['font-style'];
[1507] Fix | Delete
}
[1508] Fix | Delete
if(isset($arr['font-weight'])){
[1509] Fix | Delete
$fkey.=$arr['font-weight'];
[1510] Fix | Delete
}
[1511] Fix | Delete
if(isset($arr['unicode-range'])){
[1512] Fix | Delete
$fkey.=$arr['unicode-range'];
[1513] Fix | Delete
}
[1514] Fix | Delete
$googleFontsUrl='https:'.$arr['src'];
[1515] Fix | Delete
$slug=Themify_Storage::getHash($fkey);
[1516] Fix | Delete
global $wpdb;
[1517] Fix | Delete
$query = "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_parent=0 AND %s LIMIT 1";
[1518] Fix | Delete
$attachment=$wpdb->get_row(sprintf($query,'post_name="'.esc_sql($slug).'"'));
[1519] Fix | Delete
if(empty($attachment)){
[1520] Fix | Delete
$filename=basename($googleFontsUrl);
[1521] Fix | Delete
$attachment=$wpdb->get_row( sprintf($query, 'guid LIKE "%'.esc_sql($filename).'"'));
[1522] Fix | Delete
}
[1523] Fix | Delete
$url=!empty($attachment)?wp_get_attachment_url($attachment->ID):false;
[1524] Fix | Delete
if($url!==false && !is_file(get_attached_file($attachment->ID))){
[1525] Fix | Delete
$url=false;
[1526] Fix | Delete
wp_delete_attachment($attachment->ID,true);
[1527] Fix | Delete
}
[1528] Fix | Delete
unset($attachment);
[1529] Fix | Delete
if($url===false && $i<$maximum && !Themify_Storage::get($slug)){
[1530] Fix | Delete
Themify_Storage::set($slug,1,MINUTE_IN_SECONDS*2);//set a value to block others threads
[1531] Fix | Delete
$tmp = download_url($googleFontsUrl,10,false );
[1532] Fix | Delete
[1533] Fix | Delete
if(!is_wp_error( $tmp )){
[1534] Fix | Delete
$file = array(
[1535] Fix | Delete
'size' => filesize($tmp),
[1536] Fix | Delete
'name'=> $filename,
[1537] Fix | Delete
'error'=>0,
[1538] Fix | Delete
'tmp_name' => $tmp
[1539] Fix | Delete
);
[1540] Fix | Delete
$desc=array(trim(str_replace(array('"',"'"),'',$arr['font-family'])));
[1541] Fix | Delete
if(!empty($arr['subset'])){
[1542] Fix | Delete
$desc[]=trim(str_replace(array('/','*'),'',$arr['subset']));
[1543] Fix | Delete
}
[1544] Fix | Delete
$desc[]=$arr['font-style'];
[1545] Fix | Delete
$desc[]=$arr['font-weight'];
[1546] Fix | Delete
$attach_id=media_handle_sideload( $file, 0,$filename,array(
[1547] Fix | Delete
'post_mime_type'=>'font/woff2',
[1548] Fix | Delete
'post_content'=>'Google Font: '.implode('-',$desc),
[1549] Fix | Delete
'post_name'=>$slug
[1550] Fix | Delete
) );
[1551] Fix | Delete
if(!is_wp_error($attach_id)){
[1552] Fix | Delete
$url=wp_get_attachment_url($attach_id);
[1553] Fix | Delete
$gfFonts[$googleFontsUrl]=$url;
[1554] Fix | Delete
}
[1555] Fix | Delete
unset($desc,$file,$attach_id);
[1556] Fix | Delete
}
[1557] Fix | Delete
Themify_Storage::delete($slug);
[1558] Fix | Delete
Themify_Filesystem::delete($tmp,'f');
[1559] Fix | Delete
}
[1560] Fix | Delete
elseif($url!==false){
[1561] Fix | Delete
$gfFonts[$googleFontsUrl]=$url;
[1562] Fix | Delete
}
[1563] Fix | Delete
$arr['src']=$url===false?$googleFontsUrl:$url;
[1564] Fix | Delete
}
[1565] Fix | Delete
$css.='@font-face{';
[1566] Fix | Delete
foreach($arr as $prop=>$vv){
[1567] Fix | Delete
if($prop!=='subset'){
[1568] Fix | Delete
if($prop==='src'){
[1569] Fix | Delete
$vv='url('.$vv.') format("woff2")';
[1570] Fix | Delete
}
[1571] Fix | Delete
$css.=$prop.':'.$vv.';';
[1572] Fix | Delete
}
[1573] Fix | Delete
}
[1574] Fix | Delete
$css.='}';
[1575] Fix | Delete
}
[1576] Fix | Delete
}
[1577] Fix | Delete
}
[1578] Fix | Delete
unset($split);
[1579] Fix | Delete
remove_filter('wp_handle_sideload_overrides',array(__CLASS__,'sideload_overrides_google_fonts'),9999);
[1580] Fix | Delete
}
[1581] Fix | Delete
if(($isNew===true && !$donwload) || !empty($gfFonts)){
[1582] Fix | Delete
if(!empty($gfFonts)){
[1583] Fix | Delete
$tmp =Themify_Storage::get($_key,'tf_fg_css_');//maybe another thread has changed it
[1584] Fix | Delete
if($tmp){
[1585] Fix | Delete
$css=strtr($tmp,$gfFonts);
[1586] Fix | Delete
}
[1587] Fix | Delete
unset($gfFonts,$tmp);
[1588] Fix | Delete
}
[1589] Fix | Delete
if($css!==''){
[1590] Fix | Delete
if($isNew===true){
[1591] Fix | Delete
$css = str_replace(array("\r\n","\n","\r","\t"),'',$css);
[1592] Fix | Delete
$css = preg_replace('!\s+!',' ',$css);
[1593] Fix | Delete
$css = str_replace(array(' {',' }','{ ','; ',': ',', '),array('{','}','{',';',':',','),$css);
[1594] Fix | Delete
$css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css);
[1595] Fix | Delete
}
[1596] Fix | Delete
$css=str_replace(array('font-style:normal;','font-weight:400;'),'',$css);
[1597] Fix | Delete
Themify_Storage::set($_key, $css, MONTH_IN_SECONDS * 6,'tf_fg_css_');
[1598] Fix | Delete
}
[1599] Fix | Delete
else{
[1600] Fix | Delete
Themify_Storage::delete($_key,'tf_fg_css_');
[1601] Fix | Delete
}
[1602] Fix | Delete
}
[1603] Fix | Delete
}
[1604] Fix | Delete
if(!$css){
[1605] Fix | Delete
$path = ( is_ssl() ? 'https' : 'http' ) . $path;
[1606] Fix | Delete
$css='<link rel="preload" fetchpriority="high" as="style" href="' . $path . '"><link fetchpriority="high" id="themify-google-fonts-css" rel="stylesheet" href="' . $path . '">';
[1607] Fix | Delete
}
[1608] Fix | Delete
else{
[1609] Fix | Delete
$css='<style id="tf_gf_fonts_style">'.$css.'</style>';
[1610] Fix | Delete
}
[1611] Fix | Delete
return $css;
[1612] Fix | Delete
}
[1613] Fix | Delete
}
[1614] Fix | Delete
return null;
[1615] Fix | Delete
}
[1616] Fix | Delete
[1617] Fix | Delete
public static function sideload_overrides_google_fonts(array $overrides):array{
[1618] Fix | Delete
$overrides['test_size']=$overrides['test_type']=false;
[1619] Fix | Delete
return $overrides;
[1620] Fix | Delete
}
[1621] Fix | Delete
[1622] Fix | Delete
public static function addGoogleFont(array $fonts) {
[1623] Fix | Delete
foreach ($fonts as $v) {
[1624] Fix | Delete
if(!in_array($v,self::$googleFonts,true)){
[1625] Fix | Delete
self::$googleFonts[] = $v;
[1626] Fix | Delete
}
[1627] Fix | Delete
}
[1628] Fix | Delete
}
[1629] Fix | Delete
[1630] Fix | Delete
public static function addMobileMenuCss(string $handler, string $src) {
[1631] Fix | Delete
if (!isset(self::$css['mobile_concate'][$handler]) && !isset(self::$done[$src])) {
[1632] Fix | Delete
self::$done[$src] = true;
[1633] Fix | Delete
self::$css['mobile_concate'][$handler] = $src;
[1634] Fix | Delete
}
[1635] Fix | Delete
}
[1636] Fix | Delete
[1637] Fix | Delete
public static function preLoadAnimtion(bool $only_css = false) {
[1638] Fix | Delete
static $is = false;
[1639] Fix | Delete
if ($is === false) {
[1640] Fix | Delete
self::addPreLoadCss(self::THEMIFY_CSS_MODULES_URI . 'animate.min.css');
[1641] Fix | Delete
if ($only_css === false) {
[1642] Fix | Delete
$is = true;
[1643] Fix | Delete
self::addPreLoadJs(THEMIFY_URI . '/js/modules/animate.js');
[1644] Fix | Delete
}
[1645] Fix | Delete
}
[1646] Fix | Delete
}
[1647] Fix | Delete
[1648] Fix | Delete
public static function preLoadSwiperJs(string $type = 'prefetch',string $only = 'all') {
[1649] Fix | Delete
$url = THEMIFY_URI . '/js/modules/themify-carousel.js';
[1650] Fix | Delete
$sw_url = THEMIFY_URI . '/js/modules/swiper/swiper.min.js';
[1651] Fix | Delete
$sw_css = self::THEMIFY_CSS_MODULES_URI . 'swiper/swiper.css';
[1652] Fix | Delete
if ($type === 'prefetch') {
[1653] Fix | Delete
if ($only === 'all' || $only === 'css') {
[1654] Fix | Delete
self::addPrefetchCss($sw_css);
[1655] Fix | Delete
}
[1656] Fix | Delete
if ($only === 'all' || $only === 'js') {
[1657] Fix | Delete
self::addPrefetchJs($url);
[1658] Fix | Delete
self::addPrefetchJs($sw_url);
[1659] Fix | Delete
}
[1660] Fix | Delete
} else {
[1661] Fix | Delete
if ($only === 'all' || $only === 'css') {
[1662] Fix | Delete
self::addPreLoadCss($sw_css);
[1663] Fix | Delete
}
[1664] Fix | Delete
if ($only === 'all' || $only === 'js') {
[1665] Fix | Delete
self::addPreLoadJs($url);
[1666] Fix | Delete
self::addPreLoadJs($sw_url);
[1667] Fix | Delete
}
[1668] Fix | Delete
}
[1669] Fix | Delete
}
[1670] Fix | Delete
[1671] Fix | Delete
public static function preFetchFixedHeaderJs(string $type = 'prefetch') {
[1672] Fix | Delete
$url = THEMIFY_URI . '/js/modules/fixedheader.js';
[1673] Fix | Delete
if ($type === 'prefetch') {
[1674] Fix | Delete
self::addPrefetchJs($url);
[1675] Fix | Delete
} else {
[1676] Fix | Delete
self::addPreLoadJs($url);
[1677] Fix | Delete
}
[1678] Fix | Delete
}
[1679] Fix | Delete
[1680] Fix | Delete
public static function preFetchSideMenuJs(string $type = 'prefetch') {
[1681] Fix | Delete
$url = THEMIFY_URI . '/js/modules/themify-sidemenu.js';
[1682] Fix | Delete
if ($type === 'prefetch') {
[1683] Fix | Delete
self::addPrefetchJs($url);
[1684] Fix | Delete
} else {
[1685] Fix | Delete
self::addPreLoadJs($url);
[1686] Fix | Delete
}
[1687] Fix | Delete
}
[1688] Fix | Delete
[1689] Fix | Delete
public static function preFetchAnimtion(bool $only_css = false) {
[1690] Fix | Delete
static $is = false;
[1691] Fix | Delete
if ($is === false) {
[1692] Fix | Delete
self::addPrefetchCss(self::THEMIFY_CSS_MODULES_URI . 'animate.min.css');
[1693] Fix | Delete
if ($only_css === false) {
[1694] Fix | Delete
$is = true;
[1695] Fix | Delete
self::addPrefetchJs(THEMIFY_URI . '/js/modules/animate.js');
[1696] Fix | Delete
}
[1697] Fix | Delete
}
[1698] Fix | Delete
}
[1699] Fix | Delete
[1700] Fix | Delete
public static function clearConcateCss($blog_id = false) {
[1701] Fix | Delete
$cache_type = $blog_id === 'all' && is_multisite()? 'all' : 'blog';
[1702] Fix | Delete
$dir = self::getCurrentVersionFolder(($cache_type === 'all' ? false : $blog_id));
[1703] Fix | Delete
clearstatcache();
[1704] Fix | Delete
if ($cache_type === 'all') {
[1705] Fix | Delete
$concate_dir = '/themify-concate/';
[1706] Fix | Delete
$dir=dirname(str_replace($concate_dir, '', $dir));
[1707] Fix | Delete
if(strpos($dir,'/blogs.dir/')!==false){
[1708] Fix | Delete
$dir=dirname($dir);
[1709] Fix | Delete
$concate_dir='/files'.$concate_dir;
[1710] Fix | Delete
}
[1711] Fix | Delete
$dir = rtrim($dir, '/') . '/';
[1712] Fix | Delete
if (Themify_Filesystem::is_dir($dir) && ($handle = opendir($dir))) {
[1713] Fix | Delete
set_time_limit(0);
[1714] Fix | Delete
while (false !== ($f = readdir($handle))) {
[1715] Fix | Delete
if ($f !== '.' && $f !== '..') {
[1716] Fix | Delete
$f = $dir . $f . $concate_dir;
[1717] Fix | Delete
if (Themify_Filesystem::is_dir($f)) {
[1718] Fix | Delete
self::markAsDeleteCssFile($f);
[1719] Fix | Delete
}
[1720] Fix | Delete
}
[1721] Fix | Delete
}
[1722] Fix | Delete
closedir($handle);
[1723] Fix | Delete
}
[1724] Fix | Delete
} else {
[1725] Fix | Delete
self::markAsDeleteCssFile($dir);
[1726] Fix | Delete
}
[1727] Fix | Delete
TFCache::remove_cache($cache_type, false, $blog_id);
[1728] Fix | Delete
TFCache::clear_3rd_plugins_cache();
[1729] Fix | Delete
}
[1730] Fix | Delete
[1731] Fix | Delete
private static function markAsDeleteCssFile(string $dir) {
[1732] Fix | Delete
if (is_dir($dir) && ($handle = opendir($dir))) {
[1733] Fix | Delete
$dir = rtrim($dir, '/') . '/';
[1734] Fix | Delete
while (false !== ($f = readdir($handle))) {
[1735] Fix | Delete
if ($f !== '.' && $f !== '..') {
[1736] Fix | Delete
if (is_dir($dir . $f)) {
[1737] Fix | Delete
self::markAsDeleteCssFile($dir . $f);
[1738] Fix | Delete
} else {
[1739] Fix | Delete
$ext = pathinfo($f, PATHINFO_EXTENSION);
[1740] Fix | Delete
$f = $dir . $f . 'del';
[1741] Fix | Delete
if ($ext !== 'cssdel' && strpos($ext, 'cssdel') === false && !Themify_Filesystem::is_file($f)) {
[1742] Fix | Delete
$fd = fopen($f, 'w');
[1743] Fix | Delete
fclose($fd);
[1744] Fix | Delete
}
[1745] Fix | Delete
}
[1746] Fix | Delete
}
[1747] Fix | Delete
}
[1748] Fix | Delete
closedir($handle);
[1749] Fix | Delete
}
[1750] Fix | Delete
}
[1751] Fix | Delete
[1752] Fix | Delete
public static function wp_media_playlist(string $html,array $attr, $instance):string {
[1753] Fix | Delete
if (!isset($attr['type']) || $attr['type'] === 'audio') {
[1754] Fix | Delete
return self::audio_playlist($attr);
[1755] Fix | Delete
}
[1756] Fix | Delete
if($attr['type']==='video' && themify_is_ajax()){
[1757] Fix | Delete
remove_filter('post_playlist', array(__CLASS__, 'wp_media_playlist'), 100);
[1758] Fix | Delete
$html= themify_make_lazy(wp_playlist_shortcode($attr));
[1759] Fix | Delete
add_filter('post_playlist', array(__CLASS__, 'wp_media_playlist'), 100,3);
[1760] Fix | Delete
}
[1761] Fix | Delete
return $html;
[1762] Fix | Delete
}
[1763] Fix | Delete
[1764] Fix | Delete
public static function audio_playlist(array $attr):string {
[1765] Fix | Delete
[1766] Fix | Delete
$post = get_post();
[1767] Fix | Delete
$atts = shortcode_atts(
[1768] Fix | Delete
array(
[1769] Fix | Delete
'order' => 'ASC',
[1770] Fix | Delete
'orderby' => 'menu_order ID',
[1771] Fix | Delete
'id' => $post ? $post->ID : 0,
[1772] Fix | Delete
'include' => '',
[1773] Fix | Delete
'exclude' => '',
[1774] Fix | Delete
'tracklist' => true,
[1775] Fix | Delete
'tracknumbers' => true,
[1776] Fix | Delete
'images' => true,
[1777] Fix | Delete
'artists' => true
[1778] Fix | Delete
),
[1779] Fix | Delete
$attr,
[1780] Fix | Delete
'playlist'
[1781] Fix | Delete
);
[1782] Fix | Delete
$atts['type'] = 'audio';
[1783] Fix | Delete
unset($post);
[1784] Fix | Delete
$showImages = !empty($atts['images']);
[1785] Fix | Delete
if (empty($attr['tracks'])) {
[1786] Fix | Delete
$id = (int) $atts['id'];
[1787] Fix | Delete
$args = array(
[1788] Fix | Delete
'post_status' => 'inherit',
[1789] Fix | Delete
'post_type' => 'attachment',
[1790] Fix | Delete
'post_mime_type' => $atts['type'],
[1791] Fix | Delete
'order' => $atts['order'],
[1792] Fix | Delete
'orderby' => $atts['orderby'],
[1793] Fix | Delete
'no_found_rows' => true
[1794] Fix | Delete
);
[1795] Fix | Delete
[1796] Fix | Delete
if (!empty($atts['include'])) {
[1797] Fix | Delete
$args['include'] = $atts['include'];
[1798] Fix | Delete
$_attachments = get_posts($args);
[1799] Fix | Delete
$attachments = array();
[1800] Fix | Delete
foreach ($_attachments as $val) {
[1801] Fix | Delete
$attachments[$val->ID] = $val;
[1802] Fix | Delete
}
[1803] Fix | Delete
unset($_attachments);
[1804] Fix | Delete
} else {
[1805] Fix | Delete
$args['post_parent'] = $id;
[1806] Fix | Delete
if (!empty($atts['exclude'])) {
[1807] Fix | Delete
$args['exclude'] = $atts['exclude'];
[1808] Fix | Delete
}
[1809] Fix | Delete
$attachments = get_children($args);
[1810] Fix | Delete
}
[1811] Fix | Delete
unset($args);
[1812] Fix | Delete
if (empty($attachments)) {
[1813] Fix | Delete
return '<div></div>';
[1814] Fix | Delete
}
[1815] Fix | Delete
[1816] Fix | Delete
if (is_feed()) {
[1817] Fix | Delete
$output = "\n";
[1818] Fix | Delete
foreach ($attachments as $att_id => $attachment) {
[1819] Fix | Delete
$output .= wp_get_attachment_link($att_id) . "\n";
[1820] Fix | Delete
}
[1821] Fix | Delete
return $output;
[1822] Fix | Delete
}
[1823] Fix | Delete
[1824] Fix | Delete
$tracks = array();
[1825] Fix | Delete
$mime_types = wp_get_mime_types();
[1826] Fix | Delete
$metaArr = array('artist', 'album', 'length_formatted');
[1827] Fix | Delete
foreach ($attachments as $attachment) {
[1828] Fix | Delete
$url = wp_get_attachment_url($attachment->ID);
[1829] Fix | Delete
$ftype = wp_check_filetype($url, $mime_types);
[1830] Fix | Delete
$track = array(
[1831] Fix | Delete
'src' => trim($url),
[1832] Fix | Delete
'type' => $ftype['type'],
[1833] Fix | Delete
'title' => $attachment->post_title,
[1834] Fix | Delete
'caption' => $attachment->post_excerpt
[1835] Fix | Delete
);
[1836] Fix | Delete
$meta = wp_get_attachment_metadata($attachment->ID);
[1837] Fix | Delete
if (!empty($meta)) {
[1838] Fix | Delete
$track['meta'] = array();
[1839] Fix | Delete
foreach ($metaArr as $m) {
[1840] Fix | Delete
if (!empty($meta[$m])) {
[1841] Fix | Delete
$track['meta'][$m] = $meta[$m];
[1842] Fix | Delete
}
[1843] Fix | Delete
}
[1844] Fix | Delete
}
[1845] Fix | Delete
if ($showImages === true) {
[1846] Fix | Delete
$thumb_id = get_post_thumbnail_id($attachment->ID);
[1847] Fix | Delete
if (!empty($thumb_id)) {
[1848] Fix | Delete
list( $src, $width, $height ) = wp_get_attachment_image_src($thumb_id, 'thumbnail');
[1849] Fix | Delete
} else {
[1850] Fix | Delete
$src = wp_mime_type_icon($attachment->ID);
[1851] Fix | Delete
$width = 48;
[1852] Fix | Delete
$height = 64;
[1853] Fix | Delete
}
[1854] Fix | Delete
$track['thumb'] = array('src' => $src, 'width' => $width, 'height' => $height);
[1855] Fix | Delete
}
[1856] Fix | Delete
[1857] Fix | Delete
$tracks[] = $track;
[1858] Fix | Delete
}
[1859] Fix | Delete
$mime_types = $metaArr = $attachments = null;
[1860] Fix | Delete
} else {
[1861] Fix | Delete
$tracks = $attr['tracks'];
[1862] Fix | Delete
}
[1863] Fix | Delete
$data = array(
[1864] Fix | Delete
'type' => 'audio',
[1865] Fix | Delete
'tracklist' => $atts['tracklist'] ? 1 : 0,
[1866] Fix | Delete
'tracknumbers' => $atts['tracknumbers'] ? 1 : 0,
[1867] Fix | Delete
'images' => $showImages === true ? 1 : 0,
[1868] Fix | Delete
'artists' => $atts['artists'] ? 1 : 0,
[1869] Fix | Delete
'tracks' => $tracks
[1870] Fix | Delete
);
[1871] Fix | Delete
$autoplay = !empty($attr['autoplay']) ? ' data-autoplay="1"' : '';
[1872] Fix | Delete
$loop = !empty($attr['loop']) ? ' data-loop' : '';
[1873] Fix | Delete
$loop .= !empty($attr['muted']) ? ' muted' : '';
[1874] Fix | Delete
$tracks = $atts = null;
[1875] Fix | Delete
$output = '<div class="wp-audio-playlist">' . themify_make_lazy('<audio controls="controls" preload="none"' . $autoplay . $loop . '></audio>');
[1876] Fix | Delete
$output .= '<script type="application/json" class="tf-playlist-script">' . wp_json_encode($data) . '</script></div>';
[1877] Fix | Delete
return $output;
[1878] Fix | Delete
}
[1879] Fix | Delete
[1880] Fix | Delete
public static function widget_css($instance, $thiz, $args) {
[1881] Fix | Delete
$id = $thiz->id_base;
[1882] Fix | Delete
if ($id) {
[1883] Fix | Delete
if ($id === 'themify-most-commented') {
[1884] Fix | Delete
$id = 'themify-feature-posts';
[1885] Fix | Delete
}
[1886] Fix | Delete
elseif ($id === 'themify-social-links') {
[1887] Fix | Delete
self::add_css('tf_theme_social_links', self::THEMIFY_CSS_MODULES_URI . 'social-links.css', null, THEMIFY_VERSION);
[1888] Fix | Delete
self::addLocalization('done', 'tf_theme_social_links', true);
[1889] Fix | Delete
}
[1890] Fix | Delete
if(isset(self::$theme_css_support['widget_'.$id])){
[1891] Fix | Delete
$k = 'tf_theme_widget_' . str_replace('-', '_', $id);
[1892] Fix | Delete
if (!isset(self::$css[$k])) {
[1893] Fix | Delete
self::add_css($k, self::$THEME_CSS_MODULES_URI . 'widgets/' . $id . '.css', null, self::$themeVersion);
[1894] Fix | Delete
self::addLocalization('done', $k, true);
[1895] Fix | Delete
}
[1896] Fix | Delete
}
[1897] Fix | Delete
}
[1898] Fix | Delete
return $instance;
[1899] Fix | Delete
}
[1900] Fix | Delete
[1901] Fix | Delete
public static function allow_lazy_protocols(array $protocols):array {
[1902] Fix | Delete
$protocols[] = 'data';
[1903] Fix | Delete
return $protocols;
[1904] Fix | Delete
}
[1905] Fix | Delete
[1906] Fix | Delete
public static function audio_shortcode(string $html, array $attr, $media, $post_id, $library):string {
[1907] Fix | Delete
return $library === 'tf_lazy' ? themify_make_lazy($html) : $html;
[1908] Fix | Delete
}
[1909] Fix | Delete
[1910] Fix | Delete
public static function embed(string $cached_html, $url, $attr, $post_id):string {
[1911] Fix | Delete
return str_replace('data-secret','data-lazy data-secret',$cached_html);
[1912] Fix | Delete
}
[1913] Fix | Delete
[1914] Fix | Delete
public static function disable_playlist_template($type){
[1915] Fix | Delete
remove_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
[1916] Fix | Delete
}
[1917] Fix | Delete
[1918] Fix | Delete
public static function video_shortcode(string $html,array $attr, string $content, $instance):string {
[1919] Fix | Delete
if (apply_filters('wp_video_shortcode_library', 'mediaelement') === 'tf_lazy') {
[1920] Fix | Delete
$html_atts = array(
[1921] Fix | Delete
'preload' => 'none',
[1922] Fix | Delete
'playsinline'=>1,
[1923] Fix | Delete
'webkit-playsinline'=>1
[1924] Fix | Delete
);
[1925] Fix | Delete
if (!empty($attr['src'])) {
[1926] Fix | Delete
$video_url = parse_url($attr['src']);
[1927] Fix | Delete
if (isset($video_url['host']) && ($video_url['host'] === 'www.youtube.com' || $video_url['host'] === 'youtube.com' || $video_url['host'] === 'youtu.be' || $video_url['host'] === 'www.vimeo.com' || $video_url['host'] === 'vimeo.com' || $video_url['host'] === 'player.vimeo.com')) {
[1928] Fix | Delete
return $html;
[1929] Fix | Delete
}
[1930] Fix | Delete
unset($video_url);
[1931] Fix | Delete
$html_atts['src'] = esc_url($attr['src']);
[1932] Fix | Delete
}
[1933] Fix | Delete
if(!empty($attr['disable_lazy'])){
[1934] Fix | Delete
$html_atts['data-skip'] = 1;
[1935] Fix | Delete
}
[1936] Fix | Delete
if (!empty($attr['id'])) {
[1937] Fix | Delete
$html_atts['id'] = $attr['id'];
[1938] Fix | Delete
}
[1939] Fix | Delete
if (!empty($attr['loop'])) {
[1940] Fix | Delete
$html_atts['loop'] = 1;
[1941] Fix | Delete
}
[1942] Fix | Delete
if (!empty($attr['autoplay'])) {
[1943] Fix | Delete
$html_atts['data-autoplay'] = 1;
[1944] Fix | Delete
}
[1945] Fix | Delete
if (!empty($attr['class'])) {
[1946] Fix | Delete
$cl = trim(str_replace('wp-video-shortcode', '', $attr['class']));
[1947] Fix | Delete
if ($cl !== '') {
[1948] Fix | Delete
$html_atts['class'] = $cl;
[1949] Fix | Delete
}
[1950] Fix | Delete
}
[1951] Fix | Delete
if (!empty($attr['width'])) {
[1952] Fix | Delete
$html_atts['width'] = $attr['width'];
[1953] Fix | Delete
}
[1954] Fix | Delete
if (!empty($attr['height'])) {
[1955] Fix | Delete
$html_atts['height'] = $attr['height'];
[1956] Fix | Delete
}
[1957] Fix | Delete
if (!empty($attr['poster'])) {
[1958] Fix | Delete
$html_atts['data-poster'] = esc_url($attr['poster']);
[1959] Fix | Delete
}
[1960] Fix | Delete
$muted = isset( $attr['muted'] ) ? wp_validate_boolean( $attr['muted'] ) : false;
[1961] Fix | Delete
if ( $muted ) {
[1962] Fix | Delete
$html_atts['muted'] = 1;
[1963] Fix | Delete
}
[1964] Fix | Delete
$source='';
[1965] Fix | Delete
$default_types = wp_get_video_extensions();
[1966] Fix | Delete
$default_types[] = 'mov';
[1967] Fix | Delete
$mimes=array();
[1968] Fix | Delete
foreach ( $default_types as $ext ) {
[1969] Fix | Delete
if (isset($attr[$ext])) {
[1970] Fix | Delete
if(empty($mimes)){
[1971] Fix | Delete
$mimes = wp_get_mime_types();
[1972] Fix | Delete
}
[1973] Fix | Delete
if(!isset($html_atts['src']) || !isset($mimes[$ext])){
[1974] Fix | Delete
$type=wp_check_filetype($attr[$ext], $mimes);
[1975] Fix | Delete
}
[1976] Fix | Delete
if (isset($mimes[$ext])) {
[1977] Fix | Delete
$m = $mimes[$ext];
[1978] Fix | Delete
}
[1979] Fix | Delete
else {
[1980] Fix | Delete
$m = isset($type['type'])?$type['type']:null;
[1981] Fix | Delete
}
[1982] Fix | Delete
if ($m) {
[1983] Fix | Delete
$source .= sprintf('<source type="%s" src="%s"/>', $m, esc_url($attr[$ext]));
[1984] Fix | Delete
}
[1985] Fix | Delete
if (!isset($html_atts['src']) && isset($type['ext']) && strtolower( $type['ext'] ) === $ext ) {
[1986] Fix | Delete
$html_atts['src'] = $attr[ $ext ];
[1987] Fix | Delete
}
[1988] Fix | Delete
}
[1989] Fix | Delete
}
[1990] Fix | Delete
if (!empty( $html_atts['src'] ) ) {
[1991] Fix | Delete
unset($mimes,$default_types);
[1992] Fix | Delete
if(!isset($html_atts['width']) || !isset($html_atts['height'])){
[1993] Fix | Delete
/* find video by their media type attribute */
[1994] Fix | Delete
$size=themify_get_video_size($html_atts['src']);
[1995] Fix | Delete
if($size!==null){
[1996] Fix | Delete
if(!isset($html_atts['width']) && $size['w']!==''){
[1997] Fix | Delete
$html_atts['width'] = $size['w'];
[1998] Fix | Delete
}
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function