PK ! OB 8 themes/clenix/wc-template-parts/content-product-meta.phpnu [ array(
array(
'title' => esc_html__( 'Speed Optimization', 'metro' ),
'id' => 'rt_speed_optimization',
'icon' => 'el el-shopping-cart',
'subsections' => array(
array(
'title' => esc_html__( 'Fonts Preload', 'metro' ),
'id' => 'rt_so_fonts_preload',
'subsection' => true,
'fields' => array(
array(
'id' => 'rt_so_fonts_preload_csv',
'type' => 'textarea',
'title' => esc_html__( 'URL(s)', 'metro'),
'placeholder' => 'https://font-css-url/...,
https://font-css-url/...',
'default' => '
http://localhost/wordpress/products/metro/wp-content/plugins/yith-woocommerce-wishlist/assets/css/font-awesome.css,
http://localhost/wordpress/products/metro/wp-content/plugins/elementor/assets/lib/font-awesome/css/all.min.css,
http://localhost/wordpress/products/metro/wp-content/plugins/elementor/assets/lib/font-awesome/css/v4-shims.min.css,
http://localhost/wordpress/products/metro/wp-content/plugins/elementor/assets/lib/font-awesome/css/font-awesome.min.css
',
),
)
),
)
)
)
);
class RTReduxFontPreloader{
public $option, $settings;
function __construct($option, $settings){
$this->option = $option;
$this->settings = $settings;
$this->section();
// add_filter( 'style_loader_tag', array(&$this, 'preload_style'), 10, 4 );
add_filter( 'wp_head', array(&$this, 'preload_font'), 9);
}
function preload_font(){
$urls = array_map('trim', explode(',', ( ClenixTheme::$options['rt_so_fonts_preload_csv'] ) ) );
foreach($urls as $url)
echo "";
}
function section(){
foreach($this->settings['sections'] as $section){
$section_setting = array();
foreach($section as $key => $value){
if( $key == 'subsections' ) continue;
$section_setting[$key] = $value;
}
Redux::setSection( $this->option, $section_setting );
$this->add_subsection($section['subsections']);
}
}
function add_subsection($subsections){
foreach($subsections as $subsec){
Redux::setSection($this->option, $subsec);
}
}
}
new RTReduxFontPreloader('clenix', $optimization_settings);
endif;PK ! 8 + themes/clenix/lib/font-preload/__init__.phpnu [
jQuery( function ( $ ) {
if ( ! ( window.Waypoint ) ) {
// if Waypoint is not available, then we MUST remove our class from all elements because otherwise BGs will never show
$('.elementor-section.lazyelementorbackgroundimages,.elementor-column-wrap.lazyelementorbackgroundimages').removeClass('lazyelementorbackgroundimages');
if ( window.console && console.warn ) {
console.warn( 'Waypoint library is not loaded so backgrounds lazy loading is turned OFF' );
}
return;
}
$('.lazyelementorbackgroundimages').each( function () {
var $section = $( this );
new Waypoint({
element: $section.get( 0 ),
handler: function( direction ) {
//console.log( [ 'waypoint hit', $section.get( 0 ), $(window).scrollTop(), $section.offset() ] );
$section.removeClass('lazyelementorbackgroundimages');
},
offset: $(window).height()*1.5 // when item is within 1.5x the viewport size, start loading it
});
} );
});
wp_version = $GLOBALS['wp_version'];
// Announce that the class is ready, and pass the object (for advanced use).
do_action_ref_array( 'tgmpa_init', array( $this ) );
// When the rest of WP has loaded, kick-start the rest of the class.
add_action( 'init', array( $this, 'init' ) );
}
/**
* Magic method to (not) set protected properties from outside of this class.
*
* {@internal hackedihack... There is a serious bug in v2.3.2 - 2.3.6 where the `menu` property
* is being assigned rather than tested in a conditional, effectively rendering it useless.
* This 'hack' prevents this from happening.}}
*
* @see https://github.com/TGMPA/TGM-Plugin-Activation/blob/2.3.6/tgm-plugin-activation/class-tgm-plugin-activation.php#L1593
*
* @since 2.5.2
*
* @param string $name Name of an inaccessible property.
* @param mixed $value Value to assign to the property.
* @return void Silently fail to set the property when this is tried from outside of this class context.
* (Inside this class context, the __set() method if not used as there is direct access.)
*/
public function __set( $name, $value ) {
return;
}
/**
* Magic method to get the value of a protected property outside of this class context.
*
* @since 2.5.2
*
* @param string $name Name of an inaccessible property.
* @return mixed The property value.
*/
public function __get( $name ) {
return $this->{$name};
}
/**
* Initialise the interactions between this class and WordPress.
*
* Hooks in three new methods for the class: admin_menu, notices and styles.
*
* @since 2.0.0
*
* @see TGM_Plugin_Activation::admin_menu()
* @see TGM_Plugin_Activation::notices()
* @see TGM_Plugin_Activation::styles()
*/
public function init() {
/**
* By default TGMPA only loads on the WP back-end and not in an Ajax call. Using this filter
* you can overrule that behaviour.
*
* @since 2.5.0
*
* @param bool $load Whether or not TGMPA should load.
* Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`.
*/
if ( true !== apply_filters( 'tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) {
return;
}
// Load class strings.
$this->strings = array(
'page_title' => esc_html__( 'Install Required Plugins', 'clenix' ),
'menu_title' => esc_html__( 'Install Plugins', 'clenix' ),
/* translators: %s: plugin name. */
'installing' => esc_html__( 'Installing Plugin: %s', 'clenix' ),
/* translators: %s: plugin name. */
'updating' => esc_html__( 'Updating Plugin: %s', 'clenix' ),
'oops' => esc_html__( 'Something went wrong with the plugin API.', 'clenix' ),
'notice_can_install_required' => _n_noop(
/* translators: 1: plugin name(s). */
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'clenix'
),
'notice_can_install_recommended' => _n_noop(
/* translators: 1: plugin name(s). */
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'clenix'
),
'notice_ask_to_update' => _n_noop(
/* translators: 1: plugin name(s). */
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'clenix'
),
'notice_ask_to_update_maybe' => _n_noop(
/* translators: 1: plugin name(s). */
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'clenix'
),
'notice_can_activate_required' => _n_noop(
/* translators: 1: plugin name(s). */
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'clenix'
),
'notice_can_activate_recommended' => _n_noop(
/* translators: 1: plugin name(s). */
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'clenix'
),
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'clenix'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'clenix'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'clenix'
),
'return' => esc_html__( 'Return to Required Plugins Installer', 'clenix' ),
'dashboard' => esc_html__( 'Return to the Dashboard', 'clenix' ),
'plugin_activated' => esc_html__( 'Plugin activated successfully.', 'clenix' ),
'activated_successfully' => esc_html__( 'The following plugin was activated successfully:', 'clenix' ),
/* translators: 1: plugin name. */
'plugin_already_active' => esc_html__( 'No action taken. Plugin %1$s was already active.', 'clenix' ),
/* translators: 1: plugin name. */
'plugin_needs_higher_version' => esc_html__( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'clenix' ),
/* translators: 1: dashboard link. */
'complete' => esc_html__( 'All plugins installed and activated successfully. %1$s', 'clenix' ),
'dismiss' => esc_html__( 'Dismiss this notice', 'clenix' ),
'notice_cannot_install_activate' => esc_html__( 'There are one or more required or recommended plugins to install, update or activate.', 'clenix' ),
'contact_admin' => esc_html__( 'Please contact the administrator of this site for help.', 'clenix' ),
);
do_action( 'tgmpa_register' );
/* After this point, the plugins should be registered and the configuration set. */
// Proceed only if we have plugins to handle.
if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) {
return;
}
// Set up the menu and notices if we still have outstanding actions.
if ( true !== $this->is_tgmpa_complete() ) {
// Sort the plugins.
array_multisort( $this->sort_order, SORT_ASC, $this->plugins );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'admin_head', array( $this, 'dismiss' ) );
// Prevent the normal links from showing underneath a single install/update page.
add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) );
add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) );
if ( $this->has_notices ) {
add_action( 'admin_notices', array( $this, 'notices' ) );
add_action( 'admin_init', array( $this, 'admin_init' ), 1 );
add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) );
}
}
// If needed, filter plugin action links.
add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 );
// Make sure things get reset on switch theme.
add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) );
if ( $this->has_notices ) {
add_action( 'switch_theme', array( $this, 'update_dismiss' ) );
}
// Setup the force activation hook.
if ( true === $this->has_forced_activation ) {
add_action( 'admin_init', array( $this, 'force_activation' ) );
}
// Setup the force deactivation hook.
if ( true === $this->has_forced_deactivation ) {
add_action( 'switch_theme', array( $this, 'force_deactivation' ) );
}
}
/**
* Hook in plugin action link filters for the WP native plugins page.
*
* - Prevent activation of plugins which don't meet the minimum version requirements.
* - Prevent deactivation of force-activated plugins.
* - Add update notice if update available.
*
* @since 2.5.0
*/
public function add_plugin_action_link_filters() {
foreach ( $this->plugins as $slug => $plugin ) {
if ( false === $this->can_plugin_activate( $slug ) ) {
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 );
}
if ( true === $plugin['force_activation'] ) {
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 );
}
if ( false !== $this->does_plugin_require_update( $slug ) ) {
add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 );
}
}
}
/**
* Remove the 'Activate' link on the WP native plugins page if the plugin does not meet the
* minimum version requirements.
*
* @since 2.5.0
*
* @param array $actions Action links.
* @return array
*/
public function filter_plugin_action_links_activate( $actions ) {
unset( $actions['activate'] );
return $actions;
}
/**
* Remove the 'Deactivate' link on the WP native plugins page if the plugin has been set to force activate.
*
* @since 2.5.0
*
* @param array $actions Action links.
* @return array
*/
public function filter_plugin_action_links_deactivate( $actions ) {
unset( $actions['deactivate'] );
return $actions;
}
/**
* Add a 'Requires update' link on the WP native plugins page if the plugin does not meet the
* minimum version requirements.
*
* @since 2.5.0
*
* @param array $actions Action links.
* @return array
*/
public function filter_plugin_action_links_update( $actions ) {
$actions['update'] = sprintf(
'%3$s',
esc_url( $this->get_tgmpa_status_url( 'update' ) ),
esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'clenix' ),
esc_html__( 'Update Required', 'clenix' )
);
return $actions;
}
/**
* Handles calls to show plugin information via links in the notices.
*
* We get the links in the admin notices to point to the TGMPA page, rather
* than the typical plugin-install.php file, so we can prepare everything
* beforehand.
*
* WP does not make it easy to show the plugin information in the thickbox -
* here we have to require a file that includes a function that does the
* main work of displaying it, enqueue some styles, set up some globals and
* finally call that function before exiting.
*
* Down right easy once you know how...
*
* Returns early if not the TGMPA page.
*
* @since 2.1.0
*
* @global string $tab Used as iframe div class names, helps with styling
* @global string $body_id Used as the iframe body ID, helps with styling
*
* @return null Returns early if not the TGMPA page.
*/
public function admin_init() {
if ( ! $this->is_tgmpa_page() ) {
return;
}
if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) {
// Needed for install_plugin_information().
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
wp_enqueue_style( 'plugin-install' );
global $tab, $body_id;
$body_id = 'plugin-information';
// @codingStandardsIgnoreStart
$tab = 'plugin-information';
// @codingStandardsIgnoreEnd
install_plugin_information();
exit;
}
}
/**
* Enqueue thickbox scripts/styles for plugin info.
*
* Thickbox is not automatically included on all admin pages, so we must
* manually enqueue it for those pages.
*
* Thickbox is only loaded if the user has not dismissed the admin
* notice or if there are any plugins left to install and activate.
*
* @since 2.1.0
*/
public function thickbox() {
if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) {
add_thickbox();
}
}
/**
* Adds submenu page if there are plugin actions to take.
*
* This method adds the submenu page letting users know that a required
* plugin needs to be installed.
*
* This page disappears once the plugin has been installed and activated.
*
* @since 1.0.0
*
* @see TGM_Plugin_Activation::init()
* @see TGM_Plugin_Activation::install_plugins_page()
*
* @return null Return early if user lacks capability to install a plugin.
*/
public function admin_menu() {
// Make sure privileges are correct to see the page.
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
$args = apply_filters(
'tgmpa_admin_menu_args',
array(
'parent_slug' => $this->parent_slug, // Parent Menu slug.
'page_title' => $this->strings['page_title'], // Page title.
'menu_title' => $this->strings['menu_title'], // Menu title.
'capability' => $this->capability, // Capability.
'menu_slug' => $this->menu, // Menu slug.
'function' => array( $this, 'install_plugins_page' ), // Callback.
)
);
$this->add_admin_menu( $args );
}
/**
* Add the menu item.
*
* {@internal IMPORTANT! If this function changes, review the regex in the custom TGMPA
* generator on the website.}}
*
* @since 2.5.0
*
* @param array $args Menu item configuration.
*/
protected function add_admin_menu( array $args ) {
$this->page_hook = add_theme_page( $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] );
}
/**
* Echoes plugin installation form.
*
* This method is the callback for the admin_menu method function.
* This displays the admin page and form area where the user can select to install and activate the plugin.
* Aborts early if we're processing a plugin installation action.
*
* @since 1.0.0
*
* @return null Aborts early if we're processing a plugin installation action.
*/
public function install_plugins_page() {
// Store new instance of plugin table in object.
$plugin_table = new TGMPA_List_Table;
// Return early if processing a plugin installation action.
if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) {
return;
}
// Force refresh of available plugin information so we'll know about manual updates/deletes.
wp_clean_plugins_cache( false );
?>
';
}
return true;
} elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) {
// Activate action link was clicked.
check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' );
if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) {
return true; // Finish execution of the function early as we encountered an error.
}
}
return false;
}
/**
* Inject information into the 'update_plugins' site transient as WP checks that before running an update.
*
* @since 2.5.0
*
* @param array $plugins The plugin information for the plugins which are to be updated.
*/
public function inject_update_info( $plugins ) {
$repo_updates = get_site_transient( 'update_plugins' );
if ( ! is_object( $repo_updates ) ) {
$repo_updates = new stdClass;
}
foreach ( $plugins as $slug => $plugin ) {
$file_path = $plugin['file_path'];
if ( empty( $repo_updates->response[ $file_path ] ) ) {
$repo_updates->response[ $file_path ] = new stdClass;
}
// We only really need to set package, but let's do all we can in case WP changes something.
$repo_updates->response[ $file_path ]->slug = $slug;
$repo_updates->response[ $file_path ]->plugin = $file_path;
$repo_updates->response[ $file_path ]->new_version = $plugin['version'];
$repo_updates->response[ $file_path ]->package = $plugin['source'];
if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) {
$repo_updates->response[ $file_path ]->url = $plugin['external_url'];
}
}
set_site_transient( 'update_plugins', $repo_updates );
}
/**
* Adjust the plugin directory name if necessary.
*
* The final destination directory of a plugin is based on the subdirectory name found in the
* (un)zipped source. In some cases - most notably GitHub repository plugin downloads -, this
* subdirectory name is not the same as the expected slug and the plugin will not be recognized
* as installed. This is fixed by adjusting the temporary unzipped source subdirectory name to
* the expected plugin slug.
*
* @since 2.5.0
*
* @param string $source Path to upgrade/zip-file-name.tmp/subdirectory/.
* @param string $remote_source Path to upgrade/zip-file-name.tmp.
* @param \WP_Upgrader $upgrader Instance of the upgrader which installs the plugin.
* @return string $source
*/
public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) {
if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) {
return $source;
}
// Check for single file plugins.
$source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) );
if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) {
return $source;
}
// Multi-file plugin, let's see if the directory is correctly named.
$desired_slug = '';
// Figure out what the slug is supposed to be.
if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) {
$desired_slug = $upgrader->skin->options['extra']['slug'];
} else {
// Bulk installer contains less info, so fall back on the info registered here.
foreach ( $this->plugins as $slug => $plugin ) {
if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) {
$desired_slug = $slug;
break;
}
}
unset( $slug, $plugin );
}
if ( ! empty( $desired_slug ) ) {
$subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) );
if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) {
$from_path = untrailingslashit( $source );
$to_path = trailingslashit( $remote_source ) . $desired_slug;
if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) {
return trailingslashit( $to_path );
} else {
return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'clenix' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'clenix' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
}
} elseif ( empty( $subdir_name ) ) {
return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'clenix' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'clenix' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) );
}
}
return $source;
}
/**
* Activate a single plugin and send feedback about the result to the screen.
*
* @since 2.5.0
*
* @param string $file_path Path within wp-plugins/ to main plugin file.
* @param string $slug Plugin slug.
* @param bool $automatic Whether this is an automatic activation after an install. Defaults to false.
* This determines the styling of the output messages.
* @return bool False if an error was encountered, true otherwise.
*/
protected function activate_single_plugin( $file_path, $slug, $automatic = false ) {
if ( $this->can_plugin_activate( $slug ) ) {
$activate = activate_plugin( $file_path );
if ( is_wp_error( $activate ) ) {
echo '
';
return false; // End it here if there is an error with activation.
} else {
if ( ! $automatic ) {
// Make sure message doesn't display again if bulk activation is performed
// immediately after a single activation.
if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
echo '
';
}
}
} elseif ( $this->is_plugin_active( $slug ) ) {
// No simpler message format provided as this message should never be encountered
// on the plugin install page.
echo '
';
} elseif ( $this->does_plugin_require_update( $slug ) ) {
if ( ! $automatic ) {
// Make sure message doesn't display again if bulk activation is performed
// immediately after a single activation.
if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK.
echo '
'ul', 'callback' => 'ClenixTheme_Helper::comments_callback', 'reply_text' => esc_html__( 'Reply', 'clenix' ), 'avatar_size' => 105, 'format' => 'html5', ) ); ?>
1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>', 'title_reply_after' => '
', 'fields' => apply_filters( 'comment_form_default_fields', $clenix_fields ), ); ?>