?> <!-- module gallery --> <div id="<?php echo esc_attr($module_ID); ?> " class="<?php echo esc_attr($container_class); ?> "> <?php if ($mod_title_gallery != '') { ?> <?php echo $mod_settings['before_title'] . wp_kses_post(apply_filters('themify_builder_module_title', $mod_title_gallery, $fields_args)) . $mod_settings['after_title']; ?> <?php } ?> <?php // render the template $this->retrieve_template('template-' . $mod_name . '-' . $layout_gallery . '.php', array('module_ID' => $module_ID, 'mod_name' => $mod_name, 'gallery_images' => $gallery_images, 'columns' => $columns, 'settings' => isset($fields_args) ? $fields_args : array()), '', '', true); ?> </div> <!-- /module gallery --> <?php } TFCache::end_cache();
public static function header_scripts() { self::$is_footer = 1; }
/** * Import files into the CSS, base64-ized. * * @url(image.jpg) images will be loaded and their content merged into the * original file, to save HTTP requests. * * @param string $source The file to import files for. * @param string $content The CSS content to import files for. * * @return string */ protected function importFiles($source, $content) { $extensions = array_keys($this->importExtensions); $regex = '/url\\((["\']?)((?!["\']?data:).*?\\.(' . implode('|', $extensions) . '))\\1\\)/i'; if ($extensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { $search = array(); $replace = array(); // loop the matches foreach ($matches as $match) { // get the path for the file that will be imported $path = $match[2]; $extension = $match[3]; // only replace the import with the content if we're able to get // the content of the file, and it's relatively small $path = TFCache::get_full_path($path); $import = is_file($path) && filesize($path) <= $this->maxImportSize * 1024; if (!$import) { continue; } // grab content && base64-ize $importContent = $this->load($path); $importContent = base64_encode($importContent); // build replacement $search[] = $match[0]; $replace[] = 'url(' . $this->importExtensions[$extension] . ';base64,' . $importContent . ')'; } // replace the import statements $content = str_replace($search, $replace, $content); } return $content; }
/** * Ajax Clear all builder caches. * * @since 2.4.2 * @access public * @return json */ public function clear_all_builder_caches() { check_ajax_referer('ajax-nonce', 'nonce'); // Clear the cache TFCache::removeDirectory(TFCache::get_cache_dir()); wp_send_json_success('success'); }
/** * Builder Setting cache * @param array $data * @return string * @since 2.0.0 */ function themify_manage_builder_cache($data = array()) { if (TFCache::check_version()) { $pre = 'setting-page_builder_'; $output = sprintf('<p><label for="%s"><input type="checkbox" id="%s" name="%s"%s> %s</label></p>', esc_attr($pre . 'cache'), esc_attr($pre . 'cache'), esc_attr($pre . 'cache'), checked(true, themify_check($pre . 'cache'), false), __('Disable Builder caching (keep caching enabled for faster performance)', 'themify')); $output .= sprintf('<p data-show-if-element="%s" data-show-if-value="false"><a href="#" data-clearing-text="%s" data-done-text="%s" data-default-text="%s" data-default-icon="ti-eraser" class="button button-outline js-clear-builder-cache"> <i class="ti-eraser"></i> <span>%s</span></a><br><small>%s</small></p>', esc_attr('#' . $pre . 'cache'), esc_html__('Clearing cache...', 'themify'), esc_html__('Done', 'themify'), esc_html__('Clear cache', 'themify'), esc_html__('Clear cache', 'themify'), esc_html__('Clear all Builder cache', 'themify')); } else { $output = __('Your server does not support Builder cache, thus it is disabled. It requires PHP 5.4+', 'themify'); } return $output; }
function run($options) { $defaults = array('package' => '', 'destination' => '', 'clear_destination' => false, 'clear_working' => true, 'is_multi' => false, 'hook_extra' => array()); $options = wp_parse_args($options, $defaults); extract($options); //Connect to the Filesystem first. $res = $this->fs_connect(array(WP_CONTENT_DIR, $destination)); if (!$res) { //Mainly for non-connected filesystem. return false; } if (is_wp_error($res)) { $this->skin->error($res); return $res; } if (!$is_multi) { // call $this->header separately if running multiple times $this->skin->header(); } $this->skin->before(); //Download the package (Note, This just returns the filename of the file if the package is a local file) $download = $this->download_package($package); if (is_wp_error($download)) { $this->skin->error($download); $this->skin->after(); return $download; } $delete_package = $download != $package; // Do not delete a "local" file //Unzip's the file into a temporary directory $working_dir = $this->unpack_package($download, $delete_package); if (is_wp_error($working_dir)) { $this->skin->error($working_dir); $this->skin->after(); return $working_dir; } //With the given options, this installs it to the destination directory. $result = $this->install_package(array('source' => $working_dir, 'destination' => $destination, 'clear_destination' => $clear_destination, 'clear_working' => $clear_working, 'hook_extra' => $hook_extra)); $this->skin->set_result($result); if (is_wp_error($result)) { $this->skin->error($result); $this->skin->feedback('process_failed'); } else { //Install Suceeded $this->skin->feedback('process_success'); printf(esc_html__('Deleting transient for %s', 'themify'), $hook_extra['type']); if ($hook_extra['type'] == 'framework') { delete_transient('themify_new_framework'); themify_set_update_cookie('framework'); } else { $theme = wp_get_theme(); $theme_name = $theme->get_template(); $theme_hash = md5($theme_name); delete_transient('themify_new_theme' . $theme_hash); themify_set_update_cookie('theme'); } TFCache::removeDirectory(TFCache::get_cache_dir()); } $this->skin->after(); if (!$is_multi) { $this->skin->footer(); } return $result; }