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
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../classes
File: class-themify-builder-model.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Class for interact with DB or data resource and state.
[3] Fix | Delete
*
[4] Fix | Delete
* @package Themify_Builder
[5] Fix | Delete
* @subpackage Themify_Builder/classes
[6] Fix | Delete
*/
[7] Fix | Delete
final class Themify_Builder_Model {
[8] Fix | Delete
[9] Fix | Delete
/**
[10] Fix | Delete
* Feature Image Size
[11] Fix | Delete
* @var array
[12] Fix | Delete
*/
[13] Fix | Delete
public static $featured_image_size = array();
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Image Width
[17] Fix | Delete
* @var array
[18] Fix | Delete
*/
[19] Fix | Delete
public static $image_width = array();
[20] Fix | Delete
[21] Fix | Delete
/**
[22] Fix | Delete
* Image Height
[23] Fix | Delete
* @var array
[24] Fix | Delete
*/
[25] Fix | Delete
public static $image_height = array();
[26] Fix | Delete
[27] Fix | Delete
/**
[28] Fix | Delete
* External Link
[29] Fix | Delete
* @var array
[30] Fix | Delete
*/
[31] Fix | Delete
public static $external_link = array();
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Lightbox Link
[35] Fix | Delete
* @var array
[36] Fix | Delete
*/
[37] Fix | Delete
public static $lightbox_link = array();
[38] Fix | Delete
public static $modules = array();//deprecated use Themify_Builder_Component_Module::load_modules
[39] Fix | Delete
private const TRANSIENT_NAME = 'tb_edit_';
[40] Fix | Delete
[41] Fix | Delete
/**
[42] Fix | Delete
* Active custom post types registered by Builder.
[43] Fix | Delete
*
[44] Fix | Delete
* @var array
[45] Fix | Delete
*/
[46] Fix | Delete
public static $builder_cpt = array();
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Directory Registry
[50] Fix | Delete
*/
[51] Fix | Delete
private static $modules_registry = array();
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* Hook Content cache, used by Post modules
[55] Fix | Delete
*/
[56] Fix | Delete
private static $hook_contents=array();
[57] Fix | Delete
[58] Fix | Delete
private function __construct() {
[59] Fix | Delete
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Get favorite option to module instance
[64] Fix | Delete
* @return array
[65] Fix | Delete
*/
[66] Fix | Delete
public static function get_favorite_modules():array {
[67] Fix | Delete
$fv = get_user_option('themify_module_favorite', get_current_user_id());
[68] Fix | Delete
if(!empty($fv)){
[69] Fix | Delete
$fv=json_decode($fv,true);
[70] Fix | Delete
if(!array_key_exists(0, $fv)){
[71] Fix | Delete
$fv=array_keys($fv);
[72] Fix | Delete
}
[73] Fix | Delete
}
[74] Fix | Delete
else{
[75] Fix | Delete
$fv=array();
[76] Fix | Delete
}
[77] Fix | Delete
return $fv;
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Check whether builder is active or not
[82] Fix | Delete
* @return bool
[83] Fix | Delete
*/
[84] Fix | Delete
public static function builder_check():bool {
[85] Fix | Delete
static $is = NULL;
[86] Fix | Delete
if ($is === null) {
[87] Fix | Delete
$is = apply_filters('themify_enable_builder', themify_builder_get('setting-page_builder_is_active', 'builder_is_active'))!=='disable';
[88] Fix | Delete
}
[89] Fix | Delete
return $is;
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* Check is the frontend editor page
[95] Fix | Delete
*/
[96] Fix | Delete
public static function is_frontend_editor_page(?int $post_id = null):bool {
[97] Fix | Delete
$post_id = $post_id ??self::get_ID();
[98] Fix | Delete
return apply_filters('themify_builder_is_frontend_editor', Themify_Access_Role::check_access_frontend($post_id), $post_id);
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
/**
[102] Fix | Delete
* Check if builder frontend edit being invoked
[103] Fix | Delete
*/
[104] Fix | Delete
public static function is_front_builder_activate():bool {
[105] Fix | Delete
static $is = NULL;
[106] Fix | Delete
if ($is === null) {
[107] Fix | Delete
$is = Themify_Builder::$frontedit_active === true || ((isset($_GET['tb-preview']) || (isset($_COOKIE['tb_active']) && !is_admin() && !themify_is_ajax()) && self::is_frontend_editor_page()));
[108] Fix | Delete
if ($is === true) {
[109] Fix | Delete
add_filter('lazyload_is_enabled', '__return_false', 1, 100); //disable jetpack lazy load
[110] Fix | Delete
add_filter('rocket_use_native_lazyload', '__return_false', 1, 100);
[111] Fix | Delete
}
[112] Fix | Delete
}
[113] Fix | Delete
return $is;
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
[117] Fix | Delete
/**
[118] Fix | Delete
* Load general metabox fields
[119] Fix | Delete
*/
[120] Fix | Delete
public static function load_general_metabox():void {
[121] Fix | Delete
// Featured Image Size
[122] Fix | Delete
self::$featured_image_size = apply_filters('themify_builder_metabox_featured_image_size', array(
[123] Fix | Delete
'name' => 'feature_size',
[124] Fix | Delete
'title' => __('Image Size', 'themify'),
[125] Fix | Delete
'description' => sprintf(__('Image sizes can be set at <a href="%s">Media Settings</a>', 'themify'), admin_url('options-media.php')),
[126] Fix | Delete
'type' => 'featimgdropdown'
[127] Fix | Delete
));
[128] Fix | Delete
// Image Width
[129] Fix | Delete
self::$image_width = apply_filters('themify_builder_metabox_image_width', array(
[130] Fix | Delete
'name' => 'image_width',
[131] Fix | Delete
'title' => __('Image Width', 'themify'),
[132] Fix | Delete
'description' => '',
[133] Fix | Delete
'type' => 'textbox',
[134] Fix | Delete
'meta' => array('size' => 'small')
[135] Fix | Delete
));
[136] Fix | Delete
// Image Height
[137] Fix | Delete
self::$image_height = apply_filters('themify_builder_metabox_image_height', array(
[138] Fix | Delete
'name' => 'image_height',
[139] Fix | Delete
'title' => __('Image Height', 'themify'),
[140] Fix | Delete
'description' => '',
[141] Fix | Delete
'type' => 'textbox',
[142] Fix | Delete
'meta' => array('size' => 'small'),
[143] Fix | Delete
'class' => self::is_img_php_disabled() ? 'builder_show_if_enabled_img_php' : '',
[144] Fix | Delete
));
[145] Fix | Delete
// External Link
[146] Fix | Delete
self::$external_link = apply_filters('themify_builder_metabox_external_link', array(
[147] Fix | Delete
'name' => 'external_link',
[148] Fix | Delete
'title' => __('External Link', 'themify'),
[149] Fix | Delete
'description' => __('Link Featured Image and Post Title to external URL', 'themify'),
[150] Fix | Delete
'type' => 'textbox',
[151] Fix | Delete
'meta' => array()
[152] Fix | Delete
));
[153] Fix | Delete
// Lightbox Link
[154] Fix | Delete
self::$lightbox_link = apply_filters('themify_builder_metabox_lightbox_link', array(
[155] Fix | Delete
'name' => 'lightbox_link',
[156] Fix | Delete
'title' => __('Lightbox Link', 'themify'),
[157] Fix | Delete
'description' => __('Link Featured Image to lightbox image, video or external iframe', 'themify'),
[158] Fix | Delete
'type' => 'textbox',
[159] Fix | Delete
'meta' => array()
[160] Fix | Delete
));
[161] Fix | Delete
}
[162] Fix | Delete
[163] Fix | Delete
[164] Fix | Delete
[165] Fix | Delete
/**
[166] Fix | Delete
* Return frame layout
[167] Fix | Delete
*/
[168] Fix | Delete
public static function get_frame_layout():array {
[169] Fix | Delete
$path = THEMIFY_BUILDER_URI . '/img/row-frame/';
[170] Fix | Delete
return array(
[171] Fix | Delete
array('value' => 'none', 'label' => 'none', 'img' => $path . 'none.png'),
[172] Fix | Delete
array('value' => 'corner1', 'label' => 'Rounded Corners', 'img' => $path . 'corner1.svg'),
[173] Fix | Delete
array('value' => 'corner2', 'label' => 'Bracket Corners', 'img' => $path . 'corner2.svg'),
[174] Fix | Delete
array('value' => 'corner3', 'label' => 'Flower Corners', 'img' => $path . 'corner3.svg'),
[175] Fix | Delete
array('value' => 'corner4', 'label' => 'Slant Corners', 'img' => $path . 'corner4.svg'),
[176] Fix | Delete
array('value' => 'slant1', 'label' => 'Slant 1', 'img' => $path . 'slant1.svg'),
[177] Fix | Delete
array('value' => 'slant2', 'label' => 'Slant 2', 'img' => $path . 'slant2.svg'),
[178] Fix | Delete
array('value' => 'slant3', 'label' => 'Slant 3', 'img' => $path . 'slant3.svg'),
[179] Fix | Delete
array('value' => 'arrow1', 'label' => 'Arrow 1', 'img' => $path . 'arrow1.svg'),
[180] Fix | Delete
array('value' => 'arrow2', 'label' => 'Arrow 2', 'img' => $path . 'arrow2.svg'),
[181] Fix | Delete
array('value' => 'arrow3', 'label' => 'Arrow 3', 'img' => $path . 'arrow3.svg'),
[182] Fix | Delete
array('value' => 'arrow4', 'label' => 'Arrow 4', 'img' => $path . 'arrow4.svg'),
[183] Fix | Delete
array('value' => 'arrow5', 'label' => 'Arrow 5', 'img' => $path . 'arrow5.svg'),
[184] Fix | Delete
array('value' => 'arrow6', 'label' => 'Arrow 6', 'img' => $path . 'arrow6.svg'),
[185] Fix | Delete
array('value' => 'cloud1', 'label' => 'Cloud 1', 'img' => $path . 'cloud1.svg'),
[186] Fix | Delete
array('value' => 'cloud2', 'label' => 'Cloud 2', 'img' => $path . 'cloud2.svg'),
[187] Fix | Delete
array('value' => 'curve1', 'label' => 'Curve 1', 'img' => $path . 'curve1.svg'),
[188] Fix | Delete
array('value' => 'curve2', 'label' => 'Curve 2', 'img' => $path . 'curve2.svg'),
[189] Fix | Delete
array('value' => 'mountain1', 'label' => 'Mountain 1', 'img' => $path . 'mountain1.svg'),
[190] Fix | Delete
array('value' => 'mountain2', 'label' => 'Mountain 2', 'img' => $path . 'mountain2.svg'),
[191] Fix | Delete
array('value' => 'mountain3', 'label' => 'Mountain 3', 'img' => $path . 'mountain3.svg'),
[192] Fix | Delete
array('value' => 'wave1', 'label' => 'Wave 1', 'img' => $path . 'wave1.svg'),
[193] Fix | Delete
array('value' => 'wave2', 'label' => 'Wave 2', 'img' => $path . 'wave2.svg'),
[194] Fix | Delete
array('value' => 'wave3', 'label' => 'Wave 3', 'img' => $path . 'wave3.svg'),
[195] Fix | Delete
array('value' => 'wave4', 'label' => 'Wave 4', 'img' => $path . 'wave4.svg'),
[196] Fix | Delete
array('value' => 'ink-splash1', 'label' => 'Ink Splash 1', 'img' => $path . 'ink-splash1.svg'),
[197] Fix | Delete
array('value' => 'ink-splash2', 'label' => 'Ink Splash 2', 'img' => $path . 'ink-splash2.svg'),
[198] Fix | Delete
array('value' => 'zig-zag', 'label' => 'Zig Zag', 'img' => $path . 'zig-zag.svg'),
[199] Fix | Delete
array('value' => 'grass', 'label' => 'Grass', 'img' => $path . 'grass.svg'),
[200] Fix | Delete
array('value' => 'melting', 'label' => 'Melting', 'img' => $path . 'melting.svg'),
[201] Fix | Delete
array('value' => 'lace', 'label' => 'Lace', 'img' => $path . 'lace.svg'),
[202] Fix | Delete
);
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
[206] Fix | Delete
/**
[207] Fix | Delete
* Get Post Types, which ready for an operation
[208] Fix | Delete
* @return array
[209] Fix | Delete
*/
[210] Fix | Delete
public static function get_post_types():array {
[211] Fix | Delete
[212] Fix | Delete
// If it's not a product search, proceed: retrieve the post types.
[213] Fix | Delete
$types = get_post_types(array('exclude_from_search' => false));
[214] Fix | Delete
if (themify_is_themify_theme()) {
[215] Fix | Delete
// Exclude pages /////////////////
[216] Fix | Delete
$exclude_pages = themify_builder_get('setting-search_settings_exclude');
[217] Fix | Delete
if (!empty($exclude_pages)) {
[218] Fix | Delete
unset($types['page']);
[219] Fix | Delete
}
[220] Fix | Delete
// Exclude posts /////////////////
[221] Fix | Delete
$exclude_posts = themify_builder_get('setting-search_exclude_post');
[222] Fix | Delete
if (!empty($exclude_posts)) {
[223] Fix | Delete
unset($types['post']);
[224] Fix | Delete
}
[225] Fix | Delete
// Exclude custom post types /////
[226] Fix | Delete
$exclude_types = apply_filters('themify_types_excluded_in_search', get_post_types(array(
[227] Fix | Delete
'_builtin' => false,
[228] Fix | Delete
'public' => true,
[229] Fix | Delete
'exclude_from_search' => false
[230] Fix | Delete
)));
[231] Fix | Delete
[232] Fix | Delete
foreach (array_keys($exclude_types) as $type) {
[233] Fix | Delete
$check = \themify_builder_get('setting-search_exclude_' . $type);
[234] Fix | Delete
if (!empty($check)) {
[235] Fix | Delete
unset($types[$type]);
[236] Fix | Delete
}
[237] Fix | Delete
}
[238] Fix | Delete
}
[239] Fix | Delete
// Exclude Layout and Layout Part custom post types /////
[240] Fix | Delete
unset($types['section'], $types[Themify_Builder_Layouts::LAYOUT_SLUG], $types[Themify_Builder_Layouts::LAYOUT_PART_SLUG], $types['elementor_library']);
[241] Fix | Delete
[242] Fix | Delete
return $types;
[243] Fix | Delete
}
[244] Fix | Delete
[245] Fix | Delete
/**
[246] Fix | Delete
* Check whether builder animation is active
[247] Fix | Delete
* @return boolean|string
[248] Fix | Delete
*/
[249] Fix | Delete
public static function is_animation_active() {
[250] Fix | Delete
static $is = NULL;
[251] Fix | Delete
if ($is === null) {
[252] Fix | Delete
$val = \themify_builder_get('setting-page_builder_animation_appearance', 'builder_animation_appearance');
[253] Fix | Delete
$is = $val === 'all' || self::is_front_builder_activate()? false : ('mobile' === $val ? 'm' : true);
[254] Fix | Delete
}
[255] Fix | Delete
return $is;
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Check whether builder parallax is active
[260] Fix | Delete
* @return boolean|string
[261] Fix | Delete
*/
[262] Fix | Delete
public static function is_parallax_active() {
[263] Fix | Delete
static $is = NULL;
[264] Fix | Delete
if ($is === null) {
[265] Fix | Delete
$val = \themify_builder_get('setting-page_builder_animation_parallax_bg', 'builder_animation_parallax_bg');
[266] Fix | Delete
$is = self::is_front_builder_activate() ? true : ($val === 'all'? false : ('mobile' === $val ? 'm' : true));
[267] Fix | Delete
}
[268] Fix | Delete
return $is;
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
/**
[272] Fix | Delete
* Check whether builder scroll effect is active
[273] Fix | Delete
* @return boolean|string
[274] Fix | Delete
*/
[275] Fix | Delete
public static function is_scroll_effect_active() {
[276] Fix | Delete
static $is = NULL;
[277] Fix | Delete
if ($is === null) {
[278] Fix | Delete
// check if mobile excludes disabled OR disabled all transitions
[279] Fix | Delete
$val = \themify_builder_get('setting-page_builder_animation_scroll_effect', 'builder_animation_scroll_effect');
[280] Fix | Delete
$is = $val === 'all' || self::is_front_builder_activate()? false : ('mobile' === $val ? 'm' : true);
[281] Fix | Delete
}
[282] Fix | Delete
return $is;
[283] Fix | Delete
}
[284] Fix | Delete
[285] Fix | Delete
/**
[286] Fix | Delete
* Check whether builder sticky scroll is active
[287] Fix | Delete
* @return boolean|string
[288] Fix | Delete
*/
[289] Fix | Delete
public static function is_sticky_scroll_active() {
[290] Fix | Delete
static $is = NULL;
[291] Fix | Delete
if ($is === null) {
[292] Fix | Delete
$val = \themify_builder_get('setting-page_builder_animation_sticky_scroll', 'builder_animation_sticky_scroll');
[293] Fix | Delete
$is = $val === 'all' || self::is_front_builder_activate()? false : ('mobile' === $val ? 'm' : true);
[294] Fix | Delete
$is = apply_filters('tb_sticky_scroll_active', $is);
[295] Fix | Delete
}
[296] Fix | Delete
return $is;
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
[300] Fix | Delete
/**
[301] Fix | Delete
* Returns list of colors and thumbnails
[302] Fix | Delete
*
[303] Fix | Delete
* @return array
[304] Fix | Delete
*/
[305] Fix | Delete
public static function get_gutters(bool $def=true):array {
[306] Fix | Delete
$gutters=array(
[307] Fix | Delete
'gutter'=>3.2,
[308] Fix | Delete
'narrow'=>1.6,
[309] Fix | Delete
'none'=>0
[310] Fix | Delete
);
[311] Fix | Delete
foreach($gutters as $k=>$v){
[312] Fix | Delete
$val=\themify_builder_get( 'setting-'.$k,'setting-'.$k);
[313] Fix | Delete
if($val!==null && $val!==''){
[314] Fix | Delete
if($v!=$val){
[315] Fix | Delete
$gutters[$k]=$val;
[316] Fix | Delete
}
[317] Fix | Delete
elseif($def===false){
[318] Fix | Delete
unset($gutters[$k]);
[319] Fix | Delete
}
[320] Fix | Delete
}
[321] Fix | Delete
}
[322] Fix | Delete
return $gutters;
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
[326] Fix | Delete
[327] Fix | Delete
/**
[328] Fix | Delete
* Check whether an image script is use or not
[329] Fix | Delete
*
[330] Fix | Delete
* @since 2.4.2 Check if it's a Themify theme or not. If it's not, it's Builder standalone plugin.
[331] Fix | Delete
*
[332] Fix | Delete
* @return boolean
[333] Fix | Delete
*/
[334] Fix | Delete
public static function is_img_php_disabled():bool {
[335] Fix | Delete
static $is = NULL;
[336] Fix | Delete
if ($is === null) {
[337] Fix | Delete
$is = \themify_builder_get('setting-img_settings_use', 'image_setting-img_settings_use') ? true : false;
[338] Fix | Delete
}
[339] Fix | Delete
return $is;
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
public static function is_fullwidth_layout_supported():bool {
[343] Fix | Delete
return apply_filters('themify_builder_fullwidth_layout_support', false);
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
/**
[347] Fix | Delete
* Get alt text defined in WP Media attachment by a given URL
[348] Fix | Delete
*
[349] Fix | Delete
* @since 2.2.5
[350] Fix | Delete
*
[351] Fix | Delete
* @param string $image_url
[352] Fix | Delete
*
[353] Fix | Delete
* @return string
[354] Fix | Delete
*/
[355] Fix | Delete
public static function get_alt_by_url(string $image_url):string {
[356] Fix | Delete
$attachment_id = themify_get_attachment_id_from_url($image_url);
[357] Fix | Delete
if ($attachment_id && ($alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true))) {
[358] Fix | Delete
return $alt;
[359] Fix | Delete
}
[360] Fix | Delete
return '';
[361] Fix | Delete
}
[362] Fix | Delete
[363] Fix | Delete
/**
[364] Fix | Delete
* Get all modules settings for used in localize script.
[365] Fix | Delete
*
[366] Fix | Delete
* @access public
[367] Fix | Delete
* @return array
[368] Fix | Delete
*/
[369] Fix | Delete
public static function get_modules_localize_settings():array {
[370] Fix | Delete
$return = array();
[371] Fix | Delete
$modules=Themify_Builder_Component_Module::load_modules();
[372] Fix | Delete
foreach ($modules as $id=>$module) {
[373] Fix | Delete
$return[$id]=array();
[374] Fix | Delete
[375] Fix | Delete
if(is_string($module)){
[376] Fix | Delete
$icon = $module::get_module_icon();
[377] Fix | Delete
$name= $module::get_module_name();
[378] Fix | Delete
}else{
[379] Fix | Delete
$icon = $module->get_icon();
[380] Fix | Delete
$name= $module->get_name();
[381] Fix | Delete
}
[382] Fix | Delete
$return[$id]['name']=$name;
[383] Fix | Delete
if ($icon !== '-1') {
[384] Fix | Delete
if ($icon === '') {
[385] Fix | Delete
$icon = $id;
[386] Fix | Delete
}
[387] Fix | Delete
$return[$id]['icon'] = $icon;
[388] Fix | Delete
\themify_get_icon($icon, 'ti');
[389] Fix | Delete
}
[390] Fix | Delete
}
[391] Fix | Delete
[392] Fix | Delete
return $return;
[393] Fix | Delete
}
[394] Fix | Delete
[395] Fix | Delete
[396] Fix | Delete
public static function format_text(string $content):string {
[397] Fix | Delete
global $wp_embed;
[398] Fix | Delete
[399] Fix | Delete
$isLoop = Themify_Builder::$is_loop;
[400] Fix | Delete
Themify_Builder::$is_loop = true;
[401] Fix | Delete
$content = wptexturize($content);
[402] Fix | Delete
[403] Fix | Delete
$pattern = '|<p>\s*(https?://[^\s"]+)\s*</p>|im'; // pattern to check embed url
[404] Fix | Delete
$to = '<p>' . PHP_EOL . '$1' . PHP_EOL . '</p>'; // add line break
[405] Fix | Delete
$content = $wp_embed->run_shortcode($content);
[406] Fix | Delete
$content = preg_replace($pattern, $to, $content);
[407] Fix | Delete
$content = $wp_embed->autoembed($content);
[408] Fix | Delete
$content = do_shortcode(shortcode_unautop($content));
[409] Fix | Delete
Themify_Builder::$is_loop = $isLoop;
[410] Fix | Delete
$content = convert_smilies($content);
[411] Fix | Delete
return self::generate_read_more($content);
[412] Fix | Delete
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
/*
[416] Fix | Delete
* Generate read more link for text module
[417] Fix | Delete
*
[418] Fix | Delete
* @param string $content
[419] Fix | Delete
* @return string generated load more link in the text.
[420] Fix | Delete
*/
[421] Fix | Delete
[422] Fix | Delete
public static function generate_read_more(string $content):string {
[423] Fix | Delete
if (!empty($content) && \strpos($content, '!--more') !== false && \preg_match('/(<|&lt;)!--more(.*?)?--(>|&gt;)/', $content, $matches)) {
[424] Fix | Delete
$text = \trim($matches[2]);
[425] Fix | Delete
$read_more_text = !empty($text) ? $text : apply_filters('themify_builder_more_text', __('More ', 'themify'));
[426] Fix | Delete
$content = \str_replace($matches[0], '<div class="more-text" style="display: none">', $content);
[427] Fix | Delete
$content .= '</div><a href="#" class="module-text-more">' . $read_more_text . '</a>';
[428] Fix | Delete
}
[429] Fix | Delete
return $content;
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
[433] Fix | Delete
public static function is_module_active(string $mod_name):bool {
[434] Fix | Delete
if (themify_is_themify_theme()) {
[435] Fix | Delete
$data = \themify_get_data();
[436] Fix | Delete
$pre = 'setting-page_builder_exc_';
[437] Fix | Delete
} else {
[438] Fix | Delete
$pre = 'builder_exclude_module_';
[439] Fix | Delete
$data = self::get_builder_settings();
[440] Fix | Delete
}
[441] Fix | Delete
return empty($data[$pre . $mod_name]);
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
/**
[445] Fix | Delete
* Get module php files data
[446] Fix | Delete
*/
[447] Fix | Delete
public static function get_modules(string $type = 'active',bool $ignore=false) {
[448] Fix | Delete
$directories = self::$modules_registry;
[449] Fix | Delete
$defaultModules=array(
[450] Fix | Delete
'accordion'=>true,
[451] Fix | Delete
'alert'=>true,
[452] Fix | Delete
'box'=>true,
[453] Fix | Delete
'buttons'=>true,
[454] Fix | Delete
'callout'=>true,
[455] Fix | Delete
'code'=>true,
[456] Fix | Delete
'copyright'=>true,
[457] Fix | Delete
'divider'=>true,
[458] Fix | Delete
'fancy-heading'=>true,
[459] Fix | Delete
'feature'=>true,
[460] Fix | Delete
'gallery'=>true,
[461] Fix | Delete
'icon'=>true,
[462] Fix | Delete
'image'=>true,
[463] Fix | Delete
'layout-part'=>true,
[464] Fix | Delete
'link-block'=>true,
[465] Fix | Delete
'login'=>true,
[466] Fix | Delete
'lottie'=>true,
[467] Fix | Delete
'map'=>true,
[468] Fix | Delete
'menu'=>true,
[469] Fix | Delete
'optin'=>true,
[470] Fix | Delete
'overlay-content'=>true,
[471] Fix | Delete
'page-break'=>true,
[472] Fix | Delete
'plain-text'=>true,
[473] Fix | Delete
'post'=>true,
[474] Fix | Delete
'service-menu'=>true,
[475] Fix | Delete
'signup-form'=>true,
[476] Fix | Delete
'slider'=>true,
[477] Fix | Delete
'social-share'=>true,
[478] Fix | Delete
'star'=>true,
[479] Fix | Delete
'tab'=>true,
[480] Fix | Delete
'testimonial-slider'=>true,
[481] Fix | Delete
'text'=>true,
[482] Fix | Delete
'toc'=>true,
[483] Fix | Delete
'video'=>true,
[484] Fix | Delete
'widget'=>true,
[485] Fix | Delete
'widgetized'=>true
[486] Fix | Delete
);
[487] Fix | Delete
$deprecated=array(
[488] Fix | Delete
'highlight'=>true,
[489] Fix | Delete
'portfolio'=>true,
[490] Fix | Delete
'testimonial'=>true
[491] Fix | Delete
);
[492] Fix | Delete
$isNotSingle=$type === 'active' || $type === 'all';
[493] Fix | Delete
if($isNotSingle===true || isset($deprecated[$type])){
[494] Fix | Delete
foreach($deprecated as $id=>$dir){
[495] Fix | Delete
if(self::is_cpt_active( $id )){
[496] Fix | Delete
$defaultModules[$id]=$dir;
[497] Fix | Delete
}
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function