/**
* OceanWP Setup Wizard
*
* @package Ocean_Extra
* @category Core
* @author OceanWP
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// The Setup Wizard class
if ( ! class_exists( 'OE_Onboarding_Manager' ) ) {
/**
* Main class - OE_Onboarding_Manager.
*
* @since 2.4.8
* @access public
*/
class OE_Onboarding_Manager {
/**
* Class instance.
*
* @var object
* @access private
*/
private static $_instance = null;
/**
* Main OE_Onboarding_Wizard Instance
*
* @static
* @see OE_Onboarding_Wizard()
* @return Main OE_Onboarding_Wizard instance
*/
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Constructor
*/
public function __construct() {
$this->includes();
add_action( 'admin_enqueue_scripts', [$this, 'onboarding_scripts'] );
}
/**
* Load required files
*/
public function includes() {
$dir = OE_PATH . 'includes/onboarding/';
require_once $dir . 'options.php';
require_once $dir . 'class/child-theme.php';
require_once $dir . 'class/plugin-manager.php';
require_once $dir . 'class/site-template.php';
require_once $dir . 'class/install-template.php';
require_once $dir . 'class/parser.php';
require_once $dir . 'class/importer/wp-importer.php';
require_once $dir . 'class/importer/theme-settings.php';
require_once $dir . 'class/importer/widgets.php';
require_once $dir . 'class/importer/wpforms.php';
require_once $dir . 'class/import-data.php';
require_once $dir . 'class/rest.php';
require_once $dir . 'install-demo/start.php';
require_once $dir . 'setup-wizard/start.php';
}
/**
* Check if user need to upgrade.
*
* @return bool
*/
public function validate_license() {
global $owp_fs;
$status = false;
if ( ! empty( $owp_fs ) ) {
$status = $owp_fs->is_pricing_page_visible();
} else {
$status = false;
}
return $status;
}
/**
* Enqueque Scripts
*/
public function onboarding_scripts() {
$uri = OE_URL . 'includes/onboarding/assets/dist/';
$asset = require OE_PATH . 'includes/onboarding/assets/dist/index.asset.php';
$deps = $asset['dependencies'];
array_push($deps, 'wp-edit-post');
wp_enqueue_media();
wp_register_script(
'oe-onboarding',
$uri . 'index.js',
$deps,
filemtime( OE_PATH . 'includes/onboarding/assets/dist/index.js' ),
true
);
wp_enqueue_style(
'oe-onboarding',
$uri . 'style-index.css',
[],
filemtime( OE_PATH . 'includes/onboarding/assets/dist/style-index.css' )
);
wp_enqueue_style(
'oe-onboarding-component',
$uri . 'style-setup-wizard.css',
[],
filemtime( OE_PATH . 'includes/onboarding/assets/dist/style-setup-wizard.css' )
);
wp_enqueue_script( 'oe-onboarding' );
if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( 'oe-onboarding', 'ocean-extra' );
}
$loc_data = $this->localize_script();
if ( is_array( $loc_data ) ) {
wp_localize_script(
'oe-onboarding',
'oeOnboardingLoc',
$loc_data
);
}
}
/**
* Localize Script.
*
* @return mixed|void
*/
public function localize_script() {
$theme_slug = 'oceanwp-child-theme-master';
$child_theme_status = [
'installed' => wp_get_theme($theme_slug)->exists(),
'active' => get_option('stylesheet') === $theme_slug,
];
$colorMode = get_transient('oe_onboarding_color_mode');
$colorMode = $colorMode ? $colorMode : 'light';
return apply_filters(
'ocean_onboarding_localize',
[
'options' => oe_onboarding_wizard_options(),
'childThemeStatus' => $child_theme_status,
'siteUrl' => esc_url(site_url()),
'homeUrl' => esc_url(home_url()),
'adminUrl' => esc_url(admin_url()),
'nonce' => wp_create_nonce( 'owp-onboarding' ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'isPremium' => $this->validate_license(),
'admin_email' => wp_get_current_user()->user_email,
'colorMode' => $colorMode,
'upgradeImage' => esc_url(OE_URL . 'includes/onboarding/assets/img/onboarding-upgrade-banner.jpg'),
]
);
}
}
}
return OE_Onboarding_Manager::instance();
/**
* This class provides the list of system status values
*
*/
/**
* Show list of system critical data
*
* @since 1.0.0
* @ignore
* @access private
*/
if (!class_exists('OceanWP_Theme_Panel_System_Status')) {
class OceanWP_Theme_Panel_System_Status
{
/**
* OceanWP_Theme_Panel_System_Status constructor.
*
* @since 1.0.0
*/
public function __construct()
{
add_action('wp_ajax_oceanwp_cp_system_status', array($this, 'ajax_handler'));
}
/**
* Handles AJAX requests.
*
* @since 1.3.0
*/
public function ajax_handler()
{
OceanWP_Theme_Panel::check_ajax_access( $_REQUEST['nonce'], 'oceanwp_theme_panel' );
$type = $_POST['type'];
if (!$type) {
wp_send_json_error(esc_html__('Type param is missing.', 'ocean-extra'));
}
$this->$type();
wp_send_json_error(
sprintf(esc_html__('Type param (%s) is not valid.', 'ocean-extra'), $type)
);
}
/**
* Checks whether HTTP requests are blocked.
*
* @see test_http_requests() in Health Check plugin.
* @since 1.3.0
*/
private function http_requests()
{
$blocked = false;
$hosts = [];
if (defined('WP_HTTP_BLOCK_EXTERNAL')) {
$blocked = true;
}
if (defined('WP_ACCESSIBLE_HOSTS')) {
$hosts = explode(',', WP_ACCESSIBLE_HOSTS);
}
if ($blocked && 0 === sizeof($hosts)) {
wp_send_json_error(esc_html__('HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with no allowed hosts.', 'ocean-extra'));
}
if ($blocked && 0 < sizeof($hosts)) {
wp_send_json_error(
sprintf(
esc_html__('HTTP requests have been blocked by the WP_HTTP_BLOCK_EXTERNAL constant, with some hosts whitelisted: %s.', 'ocean-extra'),
implode(',', $hosts)
)
);
}
if (!$blocked) {
wp_send_json_success();
}
}
/**
* Checks whether artbees.net is accessible.
*
* @since 1.3.0
*/
private function oceanwp_server()
{
$response = wp_remote_get('https://oceanwp.org', array(
'timeout' => 10,
));
if (is_wp_error($response)) {
wp_send_json_error($response->get_error_message());
}
wp_send_json_success();
}
/**
* Create an array of system status
*
* @since 1.0.0
*
* @return array
*/
public static function compile_system_status()
{
global $wpdb;
$sysinfo = array();
$upload_dir = wp_upload_dir();
$sysinfo['home_url'] = esc_url(home_url('/'));
$sysinfo['site_url'] = esc_url(site_url('/'));
$sysinfo['wp_content_url'] = WP_CONTENT_URL;
$sysinfo['wp_upload_dir'] = $upload_dir['basedir'];
$sysinfo['wp_upload_url'] = $upload_dir['baseurl'];
$sysinfo['wp_ver'] = get_bloginfo('version');
$sysinfo['wp_multisite'] = is_multisite();
$sysinfo['front_page_display'] = get_option('show_on_front');
if ('page' === $sysinfo['front_page_display']) {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$sysinfo['front_page'] = 0 !== $front_page_id ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
$sysinfo['posts_page'] = 0 !== $blog_page_id ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
}
$sysinfo['wp_mem_limit']['raw'] = OceanWP_Theme_Panel_Helpers::let_to_num(WP_MEMORY_LIMIT);
$sysinfo['wp_mem_limit']['size'] = size_format($sysinfo['wp_mem_limit']['raw']);
$sysinfo['wp_debug'] = 'false';
if (defined('WP_DEBUG') && WP_DEBUG) {
$sysinfo['wp_debug'] = 'true';
}
$sysinfo['wp_writable'] = get_home_path();
$sysinfo['wp_content_writable'] = WP_CONTENT_DIR;
$sysinfo['wp_uploads_writable'] = $sysinfo['wp_upload_dir'];
$sysinfo['wp_plugins_writable'] = WP_PLUGIN_DIR;
$sysinfo['wp_themes_writable'] = get_theme_root();
$sysinfo['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
$sysinfo['localhost'] = OceanWP_Theme_Panel_Helpers::make_bool_string(OceanWP_Theme_Panel_Helpers::is_localhost());
$sysinfo['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
if (function_exists('ini_get')) {
$sysinfo['php_mem_limit']['raw'] = OceanWP_Theme_Panel_Helpers::let_to_num(ini_get('memory_limit'));
$sysinfo['php_mem_limit']['size'] = size_format($sysinfo['php_mem_limit']['raw']);
$sysinfo['php_post_max_size'] = size_format(OceanWP_Theme_Panel_Helpers::let_to_num(ini_get('post_max_size')));
$sysinfo['php_time_limit'] = ini_get('max_execution_time');
$sysinfo['php_upload_max_filesize'] = ini_get('upload_max_filesize');
$sysinfo['php_max_input_var'] = ini_get('max_input_vars');
$sysinfo['php_display_errors'] = OceanWP_Theme_Panel_Helpers::make_bool_string(ini_get('display_errors'));
}
$sysinfo['mysql_ver'] = $wpdb->db_version();
$sysinfo['max_upload_size'] = size_format(OceanWP_Theme_Panel_Helpers::let_to_num(ini_get('upload_max_filesize')));
if (is_multisite()) {
$sysinfo['network_upload_limit'] = get_site_option('fileupload_maxk') . ' KB';
}
$sysinfo['fsockopen_curl'] = 'false';
if (function_exists('fsockopen') || function_exists('curl_init')) {
$sysinfo['fsockopen_curl'] = 'true';
}
$sysinfo['soap_client'] = 'false';
if (class_exists('SoapClient')) {
$sysinfo['soap_client'] = 'true';
}
$sysinfo['dom_document'] = 'false';
if (class_exists('DOMDocument')) {
$sysinfo['dom_document'] = 'true';
}
$sysinfo['gzip'] = 'false';
if (is_callable('gzopen')) {
$sysinfo['gzip'] = 'true';
}
$sysinfo['mbstring'] = 'false';
if (extension_loaded('mbstring') && function_exists('mb_eregi') && function_exists('mb_ereg_match')) {
$sysinfo['mbstring'] = 'true';
}
$sysinfo['simplexml'] = 'false';
if (class_exists('SimpleXMLElement') && function_exists('simplexml_load_string')) {
$sysinfo['simplexml'] = 'true';
}
$sysinfo['phpxml'] = 'false';
if (function_exists('xml_parse')) {
$sysinfo['phpxml'] = 'true';
}
$active_plugins = (array) get_option('active_plugins', array());
if (is_multisite()) {
$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
}
$sysinfo['plugins'] = array();
foreach ($active_plugins as $plugin) {
$plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
$plugin_name = esc_html($plugin_data['Name']);
$sysinfo['plugins'][$plugin_name] = $plugin_data;
}
$active_theme = wp_get_theme();
$sysinfo['theme']['name'] = $active_theme->Name;
$sysinfo['theme']['version'] = $active_theme->Version;
$sysinfo['theme']['author_uri'] = $active_theme->{'Author URI'};
$sysinfo['theme']['is_child'] = OceanWP_Theme_Panel_Helpers::make_bool_string(is_child_theme());
if (is_child_theme()) {
$parent_theme = wp_get_theme($active_theme->Template);
$sysinfo['theme']['parent_name'] = $parent_theme->Name;
$sysinfo['theme']['parent_version'] = $parent_theme->Version;
$sysinfo['theme']['parent_author_uri'] = $parent_theme->{'Author URI'};
}
return $sysinfo;
}
}
new OceanWP_Theme_Panel_System_Status();
}
Azure Storage
.elementor-testimonial-wrapper{overflow:hidden;text-align:center}.elementor-testimonial-wrapper .elementor-testimonial-content{font-size:1.3em;margin-block-end:20px}.elementor-testimonial-wrapper .elementor-testimonial-name{display:block;line-height:1.5}.elementor-testimonial-wrapper .elementor-testimonial-job{display:block;font-size:.85em}.elementor-testimonial-wrapper .elementor-testimonial-meta{line-height:1;width:100%}.elementor-testimonial-wrapper .elementor-testimonial-meta-inner{display:inline-block}.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-details,.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-image{display:table-cell;vertical-align:middle}.elementor-testimonial-wrapper .elementor-testimonial-meta .elementor-testimonial-image img{border-radius:50%;height:60px;max-width:none;-o-object-fit:cover;object-fit:cover;width:60px}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-aside .elementor-testimonial-image{padding-inline-end:15px}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-aside .elementor-testimonial-details{text-align:start}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-details,.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-image{display:block}.elementor-testimonial-wrapper .elementor-testimonial-meta.elementor-testimonial-image-position-top .elementor-testimonial-image{margin-block-end:20px}/* global marketplace_suggestions, ajaxurl, Cookies */
( function( $, marketplace_suggestions, ajaxurl ) {
$( function() {
if ( 'undefined' === typeof marketplace_suggestions ) {
return;
}
// Stand-in wcTracks.recordEvent in case tracks is not available (for any reason).
window.wcTracks = window.wcTracks || {};
window.wcTracks.recordEvent = window.wcTracks.recordEvent || function() { };
// Tracks events sent in this file:
// - marketplace_suggestion_displayed
// - marketplace_suggestion_clicked
// - marketplace_suggestion_dismissed
// All are prefixed by {WC_Tracks::PREFIX}.
// All have one property for `suggestionSlug`, to identify the specific suggestion message.
// Dismiss the specified suggestion from the UI, and save the dismissal in settings.
function dismissSuggestion( context, product, promoted, url, suggestionSlug ) {
// hide the suggestion in the UI
var selector = '[data-suggestion-slug=' + suggestionSlug + ']';
$( selector ).fadeOut( function() {
$( this ).remove();
tidyProductEditMetabox();
} );
// save dismissal in user settings
jQuery.post(
ajaxurl,
{
'action': 'woocommerce_add_dismissed_marketplace_suggestion',
'_wpnonce': marketplace_suggestions.dismiss_suggestion_nonce,
'slug': suggestionSlug
}
);
// if this is a high-use area, delay new suggestion that area for a short while
var highUseSuggestionContexts = [ 'products-list-inline' ];
if ( _.contains( highUseSuggestionContexts, context ) ) {
// snooze suggestions in that area for 2 days
var contextSnoozeCookie = 'woocommerce_snooze_suggestions__' + context;
Cookies.set( contextSnoozeCookie, 'true', { expires: 2 } );
// keep track of how often this area gets dismissed in a cookie
var contextDismissalCountCookie = 'woocommerce_dismissed_suggestions__' + context;
var previousDismissalsInThisContext = parseInt( Cookies.get( contextDismissalCountCookie ), 10 ) || 0;
Cookies.set( contextDismissalCountCookie, previousDismissalsInThisContext + 1, { expires: 31 } );
}
window.wcTracks.recordEvent( 'marketplace_suggestion_dismissed', {
suggestion_slug: suggestionSlug,
context: context,
product: product || '',
promoted: promoted || '',
target: url || ''
} );
}
// Render DOM element for suggestion dismiss button.
function renderDismissButton( context, product, promoted, url, suggestionSlug ) {
var dismissButton = document.createElement( 'a' );
dismissButton.classList.add( 'suggestion-dismiss' );
dismissButton.setAttribute( 'title', marketplace_suggestions.i18n_marketplace_suggestions_dismiss_tooltip );
dismissButton.setAttribute( 'href', '#' );
dismissButton.onclick = function( event ) {
event.preventDefault();
dismissSuggestion( context, product, promoted, url, suggestionSlug );
};
return dismissButton;
}
function addURLParameters( context, url ) {
var urlParams = marketplace_suggestions.in_app_purchase_params;
urlParams.utm_source = 'unknown';
urlParams.utm_campaign = 'marketplacesuggestions';
urlParams.utm_medium = 'product';
var sourceContextMap = {
'productstable': [
'products-list-inline'
],
'productsempty': [
'products-list-empty-header',
'products-list-empty-footer',
'products-list-empty-body'
],
'ordersempty': [
'orders-list-empty-header',
'orders-list-empty-footer',
'orders-list-empty-body'
],
'editproduct': [
'product-edit-meta-tab-header',
'product-edit-meta-tab-footer',
'product-edit-meta-tab-body'
]
};
var utmSource = _.findKey( sourceContextMap, function( sourceInfo ) {
return _.contains( sourceInfo, context );
} );
if ( utmSource ) {
urlParams.utm_source = utmSource;
}
return url + '?' + jQuery.param( urlParams );
}
// Render DOM element for suggestion linkout, optionally with button style.
function renderLinkout( context, product, promoted, slug, url, text, isButton ) {
var linkoutButton = document.createElement( 'a' );
var utmUrl = addURLParameters( context, url );
linkoutButton.setAttribute( 'href', utmUrl );
// By default, CTA links should open in same tab (and feel integrated with Woo).
// Exception: when editing products, use new tab. User may have product edits
// that need to be saved.
var newTabContexts = [
'product-edit-meta-tab-header',
'product-edit-meta-tab-footer',
'product-edit-meta-tab-body'
];
if ( _.includes( newTabContexts, context ) ) {
linkoutButton.setAttribute( 'target', 'blank' );
}
linkoutButton.textContent = text;
linkoutButton.onclick = function() {
window.wcTracks.recordEvent( 'marketplace_suggestion_clicked', {
suggestion_slug: slug,
context: context,
product: product || '',
promoted: promoted || '',
target: url || ''
} );
};
if ( isButton ) {
linkoutButton.classList.add( 'button' );
} else {
linkoutButton.classList.add( 'linkout' );
var linkoutIcon = document.createElement( 'span' );
linkoutIcon.classList.add( 'dashicons', 'dashicons-external' );
linkoutButton.appendChild( linkoutIcon );
}
return linkoutButton;
}
// Render DOM element for suggestion icon image.
function renderSuggestionIcon( iconUrl ) {
if ( ! iconUrl ) {
return null;
}
var image = document.createElement( 'img' );
image.src = iconUrl;
image.classList.add( 'marketplace-suggestion-icon' );
return image;
}
// Render DOM elements for suggestion content.
function renderSuggestionContent( slug, title, copy ) {
var container = document.createElement( 'div' );
container.classList.add( 'marketplace-suggestion-container-content' );
if ( title ) {
var titleHeading = document.createElement( 'h4' );
titleHeading.textContent = title;
container.appendChild( titleHeading );
}
if ( copy ) {
var body = document.createElement( 'p' );
body.textContent = copy;
container.appendChild( body );
}
// Conditionally add in a Manage suggestions link to product edit
// metabox footer (based on suggestion slug).
var slugsWithManage = [
'product-edit-empty-footer-browse-all',
'product-edit-meta-tab-footer-browse-all'
];
if ( -1 !== slugsWithManage.indexOf( slug ) ) {
container.classList.add( 'has-manage-link' );
var manageSuggestionsLink = document.createElement( 'a' );
manageSuggestionsLink.classList.add( 'marketplace-suggestion-manage-link', 'linkout' );
manageSuggestionsLink.setAttribute(
'href',
marketplace_suggestions.manage_suggestions_url
);
manageSuggestionsLink.textContent = marketplace_suggestions.i18n_marketplace_suggestions_manage_suggestions;
container.appendChild( manageSuggestionsLink );
}
return container;
}
// Render DOM elements for suggestion call-to-action – button or link with dismiss 'x'.
function renderSuggestionCTA( context, product, promoted, slug, url, linkText, linkIsButton, allowDismiss ) {
var container = document.createElement( 'div' );
if ( ! linkText ) {
linkText = marketplace_suggestions.i18n_marketplace_suggestions_default_cta;
}
container.classList.add( 'marketplace-suggestion-container-cta' );
if ( url && linkText ) {
var linkoutElement = renderLinkout( context, product, promoted, slug, url, linkText, linkIsButton );
container.appendChild( linkoutElement );
}
if ( allowDismiss ) {
container.appendChild( renderDismissButton( context, product, promoted, url, slug ) );
}
return container;
}
// Render a "list item" style suggestion.
// These are used in onboarding style contexts, e.g. products list empty state.
function renderListItem( context, product, promoted, slug, iconUrl, title, copy, url, linkText, linkIsButton, allowDismiss ) {
var container = document.createElement( 'div' );
container.classList.add( 'marketplace-suggestion-container' );
container.dataset.suggestionSlug = slug;
var icon = renderSuggestionIcon( iconUrl );
if ( icon ) {
container.appendChild( icon );
}
container.appendChild(
renderSuggestionContent( slug, title, copy )
);
container.appendChild(
renderSuggestionCTA( context, product, promoted, slug, url, linkText, linkIsButton, allowDismiss )
);
return container;
}
// Filter suggestion data to remove less-relevant suggestions.
function getRelevantPromotions( marketplaceSuggestionsApiData, displayContext ) {
// select based on display context
var promos = _.filter( marketplaceSuggestionsApiData, function( promo ) {
if ( _.isArray( promo.context ) ) {
return _.contains( promo.context, displayContext );
}
return ( displayContext === promo.context );
} );
// hide promos the user has dismissed
promos = _.filter( promos, function( promo ) {
return ! _.contains( marketplace_suggestions.dismissed_suggestions, promo.slug );
} );
// hide promos for things the user already has installed
promos = _.filter( promos, function( promo ) {
return ! _.contains( marketplace_suggestions.active_plugins, promo.product );
} );
// hide promos that are not applicable based on user's installed extensions
promos = _.filter( promos, function( promo ) {
if ( ! promo['show-if-active'] ) {
// this promotion is relevant to all
return true;
}
// if the user has any of the prerequisites, show the promo
return ( _.intersection( marketplace_suggestions.active_plugins, promo['show-if-active'] ).length > 0 );
} );
return promos;
}
// Show and hide page elements dependent on suggestion state.
function hidePageElementsForSuggestionState( usedSuggestionsContexts ) {
var showingEmptyStateSuggestions = _.intersection(
usedSuggestionsContexts,
[ 'products-list-empty-body', 'orders-list-empty-body' ]
).length > 0;
// Streamline onboarding UI if we're in 'empty state' welcome mode.
if ( showingEmptyStateSuggestions ) {
$( '#screen-meta-links' ).hide();
$( '#wpfooter' ).hide();
}
// Hide the header & footer, they don't make sense without specific promotion content
if ( ! showingEmptyStateSuggestions ) {
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="products-list-empty-header"]' ).hide();
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="products-list-empty-footer"]' ).hide();
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="orders-list-empty-header"]' ).hide();
$( '.marketplace-suggestions-container[data-marketplace-suggestions-context="orders-list-empty-footer"]' ).hide();
}
}
// Streamline the product edit suggestions tab dependent on what's visible.
function tidyProductEditMetabox() {
var productMetaboxSuggestions = $(
'.marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-body"]'
).children();
if ( 0 >= productMetaboxSuggestions.length ) {
var metaboxSuggestionsUISelector =
'.marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-body"]';
metaboxSuggestionsUISelector +=
', .marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-header"]';
metaboxSuggestionsUISelector +=
', .marketplace-suggestions-container[data-marketplace-suggestions-context="product-edit-meta-tab-footer"]';
$( metaboxSuggestionsUISelector ).fadeOut( {
complete: function() {
$( '.marketplace-suggestions-metabox-nosuggestions-placeholder' ).fadeIn();
}
} );
}
}
function addManageSuggestionsTracksHandler() {
$( 'a.marketplace-suggestion-manage-link' ).on( 'click', function() {
window.wcTracks.recordEvent( 'marketplace_suggestions_manage_clicked' );
} );
}
function isContextHiddenOnPageLoad( context ) {
// Some suggestions are not visible on page load;
// e.g. the user reveals them by selecting a tab.
var revealableSuggestionsContexts = [
'product-edit-meta-tab-header',
'product-edit-meta-tab-body',
'product-edit-meta-tab-footer'
];
return _.includes( revealableSuggestionsContexts, context );
}
// track the current product data tab to avoid over-tracking suggestions
var currentTab = false;
// Render suggestion data in appropriate places in UI.
function displaySuggestions( marketplaceSuggestionsApiData ) {
var usedSuggestionsContexts = [];
// iterate over all suggestions containers, rendering promos
$( '.marketplace-suggestions-container' ).each( function() {
// determine the context / placement we're populating
var context = this.dataset.marketplaceSuggestionsContext;
// find promotions that target this context
var promos = getRelevantPromotions( marketplaceSuggestionsApiData, context );
// shuffle/randomly select five suggestions to display
var suggestionsToDisplay = _.sample( promos, 5 );
// render the promo content
for ( var i in suggestionsToDisplay ) {
var linkText = suggestionsToDisplay[ i ]['link-text'];
var linkoutIsButton = true;
if ( suggestionsToDisplay[ i ]['link-text'] ) {
linkText = suggestionsToDisplay[ i ]['link-text'];
linkoutIsButton = false;
}
// dismiss is allowed by default
var allowDismiss = true;
if ( suggestionsToDisplay[ i ]['allow-dismiss'] === false ) {
allowDismiss = false;
}
var content = renderListItem(
context,
suggestionsToDisplay[ i ].product,
suggestionsToDisplay[ i ].promoted,
suggestionsToDisplay[ i ].slug,
suggestionsToDisplay[ i ].icon,
suggestionsToDisplay[ i ].title,
suggestionsToDisplay[ i ].copy,
suggestionsToDisplay[ i ].url,
linkText,
linkoutIsButton,
allowDismiss
);
$( this ).append( content );
$( this ).addClass( 'showing-suggestion' );
usedSuggestionsContexts.push( context );
if ( ! isContextHiddenOnPageLoad( context ) ) {
// Fire 'displayed' tracks events for immediately visible suggestions.
window.wcTracks.recordEvent( 'marketplace_suggestion_displayed', {
suggestion_slug: suggestionsToDisplay[ i ].slug,
context: context,
product: suggestionsToDisplay[ i ].product || '',
promoted: suggestionsToDisplay[ i ].promoted || '',
target: suggestionsToDisplay[ i ].url || ''
} );
}
}
// Track when suggestions are displayed (and not already visible).
$( 'ul.product_data_tabs li.marketplace-suggestions_options a' ).click( function( e ) {
e.preventDefault();
if ( '#marketplace_suggestions' === currentTab ) {
return;
}
if ( ! isContextHiddenOnPageLoad( context ) ) {
// We've already fired 'displayed' event above.
return;
}
for ( var i in suggestionsToDisplay ) {
window.wcTracks.recordEvent( 'marketplace_suggestion_displayed', {
suggestion_slug: suggestionsToDisplay[ i ].slug,
context: context,
product: suggestionsToDisplay[ i ].product || '',
promoted: suggestionsToDisplay[ i ].promoted || '',
target: suggestionsToDisplay[ i ].url || ''
} );
}
} );
} );
hidePageElementsForSuggestionState( usedSuggestionsContexts );
tidyProductEditMetabox();
}
if ( marketplace_suggestions.suggestions_data ) {
displaySuggestions( marketplace_suggestions.suggestions_data );
// track the current product data tab to avoid over-reporting suggestion views
$( 'ul.product_data_tabs' ).on( 'click', 'li a', function( e ) {
e.preventDefault();
currentTab = $( this ).attr( 'href' );
} );
}
addManageSuggestionsTracksHandler();
});
})( jQuery, marketplace_suggestions, ajaxurl );
; /**
* @package Freemius
* @copyright Copyright (c) 2018, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plugin_Tag extends FS_Entity {
/**
* @var string
*/
public $version;
/**
* @var string
*/
public $url;
/**
* @var string
*/
public $requires_platform_version;
/**
* @var string
*/
public $requires_programming_language_version;
/**
* @var string
*/
public $tested_up_to_version;
/**
* @var bool
*/
public $has_free;
/**
* @var bool
*/
public $has_premium;
/**
* @var string One of the following: `pending`, `beta`, `unreleased`.
*/
public $release_mode;
/**
* @var string
*/
public $upgrade_notice;
function __construct( $tag = false ) {
parent::__construct( $tag );
}
static function get_type() {
return 'tag';
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @return bool
*/
function is_beta() {
return ( 'beta' === $this->release_mode );
}
}
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.9
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Subscription extends FS_Entity {
#region Properties
/**
* @var number
*/
public $user_id;
/**
* @var number
*/
public $install_id;
/**
* @var number
*/
public $plan_id;
/**
* @var number
*/
public $license_id;
/**
* @var float
*/
public $total_gross;
/**
* @var float
*/
public $amount_per_cycle;
/**
* @var int # of months
*/
public $billing_cycle;
/**
* @var float
*/
public $outstanding_balance;
/**
* @var int
*/
public $failed_payments;
/**
* @var string
*/
public $gateway;
/**
* @var string
*/
public $external_id;
/**
* @var string|null
*/
public $trial_ends;
/**
* @var string|null Datetime of the next payment, or null if cancelled.
*/
public $next_payment;
/**
* @since 2.3.1
*
* @var string|null Datetime of the cancellation.
*/
public $canceled_at;
/**
* @var string|null
*/
public $vat_id;
/**
* @var string Two characters country code
*/
public $country_code;
#endregion Properties
/**
* @param object|bool $subscription
*/
function __construct( $subscription = false ) {
parent::__construct( $subscription );
}
static function get_type() {
return 'subscription';
}
/**
* Check if subscription is active.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_active() {
if ( $this->is_canceled() ) {
return false;
}
return (
! empty( $this->next_payment ) &&
strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
);
}
/**
* @author Vova Feldman (@svovaf)
* @since 2.3.1
*
* @return bool
*/
function is_canceled() {
return ! is_null( $this->canceled_at );
}
/**
* Subscription considered to be new without any payments
* if the next payment should be made within less than 24 hours
* from the subscription creation.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_first_payment_pending() {
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.7
*/
function has_trial() {
return ! is_null( $this->trial_ends );
}
} /**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
/**
* Class FS_Security
*/
class FS_Security {
/**
* @var FS_Security
* @since 1.0.3
*/
private static $_instance;
/**
* @var FS_Logger
* @since 1.0.3
*/
private static $_logger;
/**
* @return \FS_Security
*/
public static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new FS_Security();
self::$_logger = FS_Logger::get_logger(
WP_FS__SLUG,
WP_FS__DEBUG_SDK,
WP_FS__ECHO_DEBUG_SDK
);
}
return self::$_instance;
}
private function __construct() {
}
/**
* @param \FS_Scope_Entity $entity
* @param int $timestamp
* @param string $action
*
* @return string
*/
function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
return md5(
$timestamp .
$entity->id .
$entity->secret_key .
$entity->public_key .
$action
);
}
/**
* @param \FS_Scope_Entity $entity
* @param int|bool $timestamp
* @param string $action
*
* @return array
*/
function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
if ( false === $timestamp ) {
$timestamp = time();
}
return array(
's_ctx_type' => $entity->get_type(),
's_ctx_id' => $entity->id,
's_ctx_ts' => $timestamp,
's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
);
}
/**
* Gets a sandbox trial token for a given plugin, plan, and trial timestamp.
*
* @param FS_Plugin $plugin
* @param FS_Plugin_Plan $plan
* @param int $trial_timestamp
*
* @return string
*/
function get_trial_token( FS_Plugin $plugin, FS_Plugin_Plan $plan, $trial_timestamp ) {
return md5(
$plugin->secret_key . $plugin->public_key .
$plan->trial_period .
$plan->id .
$trial_timestamp
);
}
}
function lae_get_all_post_type_options() {
$post_types = get_post_types(array('public' => true), 'objects');
$options = ['' => ''];
foreach ($post_types as $post_type) {
$options[$post_type->name] = $post_type->label;
}
return apply_filters('lae_post_type_options', $options);
}
/**
* Action to handle searching taxonomy terms.
*/
function lae_get_all_taxonomy_options() {
$taxonomies = lae_get_all_taxonomies();
$results = array();
foreach ($taxonomies as $taxonomy) {
$terms = get_terms(array('taxonomy' => $taxonomy));
foreach ($terms as $term)
$results[$term->taxonomy . ':' . $term->slug] = $term->taxonomy . ':' . $term->name;
}
return apply_filters('lae_taxonomy_options', $results);
}
function lae_build_query_args($settings) {
if ($settings['query_type'] == 'current_query') {
global $wp_query;
$query_args = $wp_query->query_vars;
$query_args = apply_filters('lae_current_query_args', $query_args, $settings);
}
elseif ($settings['query_type'] == 'related') {
$query_args = lae_default_query_args($settings);
$post_id = get_queried_object_id();
$related_post_id = is_singular() && ($post_id !== 0) ? $post_id : null;
$query_args['post_type'] = get_post_type($related_post_id);
if ($related_post_id) {
$post_not_in = isset($query_args['post__not_in']) ? $query_args['post__not_in'] : [];
$post_not_in[] = $related_post_id;
$query_args['post__not_in'] = $post_not_in;
}
$taxonomies = $settings['taxonomies'];
$terms = array();
if (is_array($taxonomies)) {
foreach ($taxonomies as $taxonomy) {
$terms[$taxonomy] = wp_get_post_terms($related_post_id, $taxonomy, ['fields' => 'tt_ids']);
}
}
else {
$taxonomy = $taxonomies; // it is a string representing single taxonomy
$terms[$taxonomy] = wp_get_post_terms($related_post_id, $taxonomy, ['fields' => 'tt_ids']);
}
foreach ($terms as $taxonomy => $ids) {
if (empty($ids))
continue;
$query = array(
'taxonomy' => $taxonomy,
'field' => 'term_taxonomy_id',
'terms' => $ids,
);
if (empty($query_args['tax_query']))
$query_args['tax_query'] = array();
else
$query_args['tax_query']['relation'] = 'OR';
$query_args['tax_query'][] = $query;
}
$query_args = apply_filters('lae_related_query_args', $query_args, $settings);
}
else {
$query_args = lae_default_query_args($settings);
if (!empty($settings['post_in'])) {
$query_args['post_type'] = 'any';
$query_args['post__in'] = explode(',', $settings['post_in']);
$query_args['post__in'] = array_map('intval', $query_args['post__in']);
}
else {
if (!empty($settings['post_types'])) {
$query_args['post_type'] = $settings['post_types'];
}
if (!empty($settings['tax_query'])) {
$tax_queries = $settings['tax_query'];
$query_args['tax_query'] = array();
$query_args['tax_query']['relation'] = 'OR';
foreach ($tax_queries as $tq) {
list($tax, $term) = explode(':', $tq);
if (empty($tax) || empty($term))
continue;
$query_args['tax_query'][] = array(
'taxonomy' => $tax,
'field' => 'slug',
'terms' => $term
);
}
}
}
$query_args = apply_filters('lae_custom_query_args', $query_args, $settings);
}
$query_args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
return apply_filters('lae_posts_query_args', $query_args, $settings);
}
function lae_default_query_args($settings) {
$query_args = [
'orderby' => $settings['orderby'],
'order' => $settings['order'],
'ignore_sticky_posts' => 1,
'post_status' => 'publish',
];
$query_args['posts_per_page'] = $settings['posts_per_page'];
$query_args['offset'] = isset($settings['offset']) ? intval($settings['offset']) : 0;
return apply_filters('lae_default_query_args', $query_args, $settings);
}/**
* Plugin Name: All-in-One WP Migration File Extension
* Plugin URI: https://import.wp-migration.com/
* Description: Extension for All-in-One WP Migration that enables using import from file
* Author: ServMask, Inc.
* Author URI: https://servmask.com/
* Version: 1.7
* Text Domain: all-in-one-wp-migration-file-extension
* Domain Path: /languages
* Network: True
*
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
// Check SSL Mode
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && ( $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) ) {
$_SERVER['HTTPS'] = 'on';
}
// Plugin Basename
define( 'AI1WMTE_PLUGIN_BASENAME', basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ) );
// Plugin Path
define( 'AI1WMTE_PATH', dirname( __FILE__ ) );
// Plugin URL
define( 'AI1WMTE_URL', plugins_url( '', AI1WMTE_PLUGIN_BASENAME ) );
// Include constants
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'constants.php';
// Include loader
require_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'loader.php';
// ===========================================================================
// = All app initialization is done in Ai1wmte_Main_Controller __constructor =
// ===========================================================================
$main_controller = new Ai1wmte_Main_Controller();
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
/**
* Get storage absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_storage_path( $params ) {
if ( empty( $params['storage'] ) ) {
throw new Ai1wm_Storage_Exception( __( 'Unable to locate storage path. Technical details ', AI1WM_PLUGIN_NAME ) );
}
// Get storage path
$storage = AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . basename( $params['storage'] );
if ( ! is_dir( $storage ) ) {
mkdir( $storage );
}
return $storage;
}
/**
* Get backup absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_path( $params ) {
if ( empty( $params['archive'] ) ) {
throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details ', AI1WM_PLUGIN_NAME ) );
}
// Validate archive path
if ( validate_file( $params['archive'] ) !== 0 ) {
throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details ', AI1WM_PLUGIN_NAME ) );
}
return AI1WM_BACKUPS_PATH . DIRECTORY_SEPARATOR . $params['archive'];
}
/**
* Get archive absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_path( $params ) {
if ( empty( $params['archive'] ) ) {
throw new Ai1wm_Archive_Exception( __( 'Unable to locate archive path. Technical details ', AI1WM_PLUGIN_NAME ) );
}
// Validate archive path
if ( validate_file( $params['archive'] ) !== 0 ) {
throw new Ai1wm_Archive_Exception( __( 'Invalid archive path. Technical details ', AI1WM_PLUGIN_NAME ) );
}
// Get archive path
if ( empty( $params['ai1wm_manual_restore'] ) ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . $params['archive'];
}
return ai1wm_backup_path( $params );
}
/**
* Get multipart.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_multipart_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTIPART_NAME;
}
/**
* Get content.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_content_list_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_CONTENT_LIST_NAME;
}
/**
* Get media.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_media_list_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MEDIA_LIST_NAME;
}
/**
* Get tables.list absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_tables_list_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_TABLES_LIST_NAME;
}
/**
* Get package.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_package_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_PACKAGE_NAME;
}
/**
* Get multisite.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_multisite_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_MULTISITE_NAME;
}
/**
* Get blogs.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_blogs_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_BLOGS_NAME;
}
/**
* Get settings.json absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_settings_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_SETTINGS_NAME;
}
/**
* Get database.sql absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_database_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_DATABASE_NAME;
}
/**
* Get cookies.txt absolute path
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_cookies_path( $params ) {
return ai1wm_storage_path( $params ) . DIRECTORY_SEPARATOR . AI1WM_COOKIES_NAME;
}
/**
* Get error log absolute path
*
* @return string
*/
function ai1wm_error_path() {
return AI1WM_STORAGE_PATH . DIRECTORY_SEPARATOR . AI1WM_ERROR_NAME;
}
/**
* Get archive name
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_name( $params ) {
return basename( $params['archive'] );
}
/**
* Get backup URL address
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_url( $params ) {
return AI1WM_BACKUPS_URL . '/' . ai1wm_replace_directory_separator_with_forward_slash( $params['archive'] );
}
/**
* Get archive size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_archive_bytes( $params ) {
return filesize( ai1wm_archive_path( $params ) );
}
/**
* Get backup size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_backup_bytes( $params ) {
return filesize( ai1wm_backup_path( $params ) );
}
/**
* Get database size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_database_bytes( $params ) {
return filesize( ai1wm_database_path( $params ) );
}
/**
* Get package size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_package_bytes( $params ) {
return filesize( ai1wm_package_path( $params ) );
}
/**
* Get multisite size in bytes
*
* @param array $params Request parameters
* @return integer
*/
function ai1wm_multisite_bytes( $params ) {
return filesize( ai1wm_multisite_path( $params ) );
}
/**
* Get archive size as text
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_archive_size( $params ) {
return ai1wm_size_format( filesize( ai1wm_archive_path( $params ) ) );
}
/**
* Get backup size as text
*
* @param array $params Request parameters
* @return string
*/
function ai1wm_backup_size( $params ) {
return ai1wm_size_format( filesize( ai1wm_backup_path( $params ) ) );
}
/**
* Parse file size
*
* @param string $size File size
* @param string $default Default size
* @return string
*/
function ai1wm_parse_size( $size, $default = null ) {
$suffixes = array(
'' => 1,
'k' => 1000,
'm' => 1000000,
'g' => 1000000000,
);
// Parse size format
if ( preg_match( '/([0-9]+)\s*(k|m|g)?(b?(ytes?)?)/i', $size, $matches ) ) {
return $matches[1] * $suffixes[ strtolower( $matches[2] ) ];
}
return $default;
}
/**
* Format file size into human-readable string
*
* Fixes the WP size_format bug: size_format( '0' ) => false
*
* @param int|string $bytes Number of bytes. Note max integer size for integers.
* @param int $decimals Optional. Precision of number of decimal places. Default 0.
* @return string|false False on failure. Number string on success.
*/
function ai1wm_size_format( $bytes, $decimals = 0 ) {
if ( strval( $bytes ) === '0' ) {
return size_format( 0, $decimals );
}
return size_format( $bytes, $decimals );
}
/**
* Get current site name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_site_name( $blog_id = null ) {
return parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
}
/**
* Get archive file name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_file( $blog_id = null ) {
$name = array();
// Add domain
$name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
// Add year, month and day
$name[] = date( 'Ymd' );
// Add hours, minutes and seconds
$name[] = date( 'His' );
// Add unique identifier
$name[] = ai1wm_generate_random_string( 6, false );
return sprintf( '%s.wpress', strtolower( implode( '-', $name ) ) );
}
/**
* Get archive folder name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_folder( $blog_id = null ) {
$name = array();
// Add domain
$name[] = parse_url( get_site_url( $blog_id ), PHP_URL_HOST );
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive bucket name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_bucket( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $subdomain ) ) ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $directory ) ) ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive vault name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_vault( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $subdomain ) ) ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $directory ) ) ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive project name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_project( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Get archive share name
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_archive_share( $blog_id = null ) {
$name = array();
// Add domain
if ( ( $domain = explode( '.', parse_url( get_site_url( $blog_id ), PHP_URL_HOST ) ) ) ) {
foreach ( $domain as $subdomain ) {
if ( $subdomain = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $subdomain ) ) ) {
$name[] = $subdomain;
}
}
}
// Add path
if ( ( $path = explode( '/', parse_url( get_site_url( $blog_id ), PHP_URL_PATH ) ) ) ) {
foreach ( $path as $directory ) {
if ( $directory = strtolower( preg_replace( '/[^A-Za-z0-9\-]/', '', $directory ) ) ) {
$name[] = $directory;
}
}
}
return strtolower( implode( '-', $name ) );
}
/**
* Generate random string
*
* @param integer $length String length
* @param boolean $mixed_chars Whether to include mixed characters
* @param boolean $special_chars Whether to include special characters
* @param boolean $extra_special_chars Whether to include extra special characters
* @return string
*/
function ai1wm_generate_random_string( $length = 12, $mixed_chars = true, $special_chars = false, $extra_special_chars = false ) {
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
if ( $mixed_chars ) {
$chars .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
}
if ( $special_chars ) {
$chars .= '!@#$%^&*()';
}
if ( $extra_special_chars ) {
$chars .= '-_ []{}<>~`+=,.;:/?|';
}
$str = '';
for ( $i = 0; $i < $length; $i++ ) {
$str .= substr( $chars, wp_rand( 0, strlen( $chars ) - 1 ), 1 );
}
return $str;
}
/**
* Get storage folder name
*
* @return string
*/
function ai1wm_storage_folder() {
return uniqid();
}
/**
* Check whether blog ID is main site
*
* @param integer $blog_id Blog ID
* @return boolean
*/
function ai1wm_is_mainsite( $blog_id = null ) {
return $blog_id === null || $blog_id === 0 || $blog_id === 1;
}
/**
* Get files absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_files_abspath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return ai1wm_get_uploads_dir();
}
return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'blogs.dir' . DIRECTORY_SEPARATOR . $blog_id . DIRECTORY_SEPARATOR . 'files';
}
/**
* Get blogs.dir absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_blogsdir_abspath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return ai1wm_get_uploads_dir();
}
return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'blogs.dir' . DIRECTORY_SEPARATOR . $blog_id;
}
/**
* Get sites absolute path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_sites_abspath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return ai1wm_get_uploads_dir();
}
return ai1wm_get_uploads_dir() . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $blog_id;
}
/**
* Get files relative path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_files_relpath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return 'uploads';
}
return 'blogs.dir' . DIRECTORY_SEPARATOR . $blog_id . DIRECTORY_SEPARATOR . 'files';
}
/**
* Get blogs.dir relative path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_blogsdir_relpath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return 'uploads';
}
return 'blogs.dir' . DIRECTORY_SEPARATOR . $blog_id;
}
/**
* Get sites relative path by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_sites_relpath( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return 'uploads';
}
return 'uploads' . DIRECTORY_SEPARATOR . 'sites' . DIRECTORY_SEPARATOR . $blog_id;
}
/**
* Get files URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_files_url( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return '/wp-content/uploads/';
}
return sprintf( '/wp-content/blogs.dir/%d/files/', $blog_id );
}
/**
* Get blogs.dir URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_blogsdir_url( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return '/wp-content/uploads/';
}
return sprintf( '/wp-content/blogs.dir/%d/', $blog_id );
}
/**
* Get sites URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_sites_url( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return '/wp-content/uploads/';
}
return sprintf( '/wp-content/uploads/sites/%d/', $blog_id );
}
/**
* Get uploads URL by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_blog_uploads_url( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return sprintf( '/%s/', ai1wm_get_uploads_path() );
}
return sprintf( '/%s/sites/%d/', ai1wm_get_uploads_path(), $blog_id );
}
/**
* Get ServMask table prefix by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_servmask_prefix( $blog_id = null ) {
if ( ai1wm_is_mainsite( $blog_id ) ) {
return AI1WM_TABLE_PREFIX;
}
return AI1WM_TABLE_PREFIX . $blog_id . '_';
}
/**
* Get WordPress table prefix by blog ID
*
* @param integer $blog_id Blog ID
* @return string
*/
function ai1wm_table_prefix( $blog_id = null ) {
global $wpdb;
// Set base table prefix
if ( ai1wm_is_mainsite( $blog_id ) ) {
return $wpdb->base_prefix;
}
return $wpdb->base_prefix . $blog_id . '_';
}
/**
* Get default content filters
*
* @param array $filters List of files and directories
* @return array
*/
function ai1wm_content_filters( $filters = array() ) {
return array_merge(
$filters,
array(
AI1WM_BACKUPS_NAME,
AI1WM_PACKAGE_NAME,
AI1WM_MULTISITE_NAME,
AI1WM_DATABASE_NAME,
)
);
}
/**
* Get default plugin filters
*
* @param array $filters List of plugins
* @return array
*/
function ai1wm_plugin_filters( $filters = array() ) {
// WP Migration Plugin
if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WM_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration';
}
// Microsoft Azure Extension
if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMZE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-azure-storage-extension';
}
// Backblaze B2 Extension
if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMAE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-b2-extension';
}
// Backup Plugin
if ( defined( 'AI1WMVE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMVE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-backup';
}
// Box Extension
if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMBE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-box-extension';
}
// DigitalOcean Spaces Extension
if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMIE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-digitalocean-extension';
}
// Direct Extension
if ( defined( 'AI1WMXE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMXE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-direct-extension';
}
// Dropbox Extension
if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMDE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-dropbox-extension';
}
// File Extension
if ( defined( 'AI1WMTE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMTE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-file-extension';
}
// FTP Extension
if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMFE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-ftp-extension';
}
// Google Cloud Storage Extension
if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMCE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gcloud-storage-extension';
}
// Google Drive Extension
if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMGE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-gdrive-extension';
}
// Amazon Glacier Extension
if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMRE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-glacier-extension';
}
// Mega Extension
if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMEE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-mega-extension';
}
// Multisite Extension
if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMME_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-multisite-extension';
}
// OneDrive Extension
if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMOE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-onedrive-extension';
}
// pCloud Extension
if ( defined( 'AI1WMPE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMPE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-pcloud-extension';
}
// Pro Plugin
if ( defined( 'AI1WMKE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMKE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-pro';
}
// S3 Client Extension
if ( defined( 'AI1WNE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMNE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-client-extension';
}
// Amazon S3 Extension
if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMSE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-s3-extension';
}
// Unlimited Extension
if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMUE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-unlimited-extension';
}
// URL Extension
if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMLE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-url-extension';
}
// WebDAV Extension
if ( defined( 'AI1WMWE_PLUGIN_BASENAME' ) ) {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . dirname( AI1WMWE_PLUGIN_BASENAME );
} else {
$filters[] = 'plugins' . DIRECTORY_SEPARATOR . 'all-in-one-wp-migration-webdav-extension';
}
return $filters;
}
/**
* Get active ServMask plugins
*
* @return array
*/
function ai1wm_active_servmask_plugins( $plugins = array() ) {
// WP Migration Plugin
if ( defined( 'AI1WM_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WM_PLUGIN_BASENAME;
}
// Microsoft Azure Extension
if ( defined( 'AI1WMZE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMZE_PLUGIN_BASENAME;
}
// Backblaze B2 Extension
if ( defined( 'AI1WMAE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMAE_PLUGIN_BASENAME;
}
// Backup Plugin
if ( defined( 'AI1WMVE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMVE_PLUGIN_BASENAME;
}
// Box Extension
if ( defined( 'AI1WMBE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMBE_PLUGIN_BASENAME;
}
// DigitalOcean Spaces Extension
if ( defined( 'AI1WMIE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMIE_PLUGIN_BASENAME;
}
// Direct Extension
if ( defined( 'AI1WMXE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMXE_PLUGIN_BASENAME;
}
// Dropbox Extension
if ( defined( 'AI1WMDE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMDE_PLUGIN_BASENAME;
}
// File Extension
if ( defined( 'AI1WMTE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMTE_PLUGIN_BASENAME;
}
// FTP Extension
if ( defined( 'AI1WMFE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMFE_PLUGIN_BASENAME;
}
// Google Cloud Storage Extension
if ( defined( 'AI1WMCE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMCE_PLUGIN_BASENAME;
}
// Google Drive Extension
if ( defined( 'AI1WMGE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMGE_PLUGIN_BASENAME;
}
// Amazon Glacier Extension
if ( defined( 'AI1WMRE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMRE_PLUGIN_BASENAME;
}
// Mega Extension
if ( defined( 'AI1WMEE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMEE_PLUGIN_BASENAME;
}
// Multisite Extension
if ( defined( 'AI1WMME_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMME_PLUGIN_BASENAME;
}
// OneDrive Extension
if ( defined( 'AI1WMOE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMOE_PLUGIN_BASENAME;
}
// pCloud Extension
if ( defined( 'AI1WMPE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMPE_PLUGIN_BASENAME;
}
// Pro Plugin
if ( defined( 'AI1WMKE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMKE_PLUGIN_BASENAME;
}
// S3 Client Extension
if ( defined( 'AI1WMNE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMNE_PLUGIN_BASENAME;
}
// Amazon S3 Extension
if ( defined( 'AI1WMSE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMSE_PLUGIN_BASENAME;
}
// Unlimited Extension
if ( defined( 'AI1WMUE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMUE_PLUGIN_BASENAME;
}
// URL Extension
if ( defined( 'AI1WMLE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMLE_PLUGIN_BASENAME;
}
// WebDAV Extension
if ( defined( 'AI1WMWE_PLUGIN_BASENAME' ) ) {
$plugins[] = AI1WMWE_PLUGIN_BASENAME;
}
return $plugins;
}
/**
* Get active sitewide plugins
*
* @return array
*/
function ai1wm_active_sitewide_plugins() {
return array_keys( get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() ) );
}
/**
* Get active plugins
*
* @return array
*/
function ai1wm_active_plugins() {
return array_values( get_option( AI1WM_ACTIVE_PLUGINS, array() ) );
}
/**
* Set active sitewide plugins (inspired by WordPress activate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_activate_sitewide_plugins( $plugins ) {
$current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( ! isset( $current[ $plugin ] ) && ! is_wp_error( validate_plugin( $plugin ) ) ) {
$current[ $plugin ] = time();
}
}
return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current );
}
/**
* Set active plugins (inspired by WordPress activate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_activate_plugins( $plugins ) {
$current = get_option( AI1WM_ACTIVE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( ! in_array( $plugin, $current ) && ! is_wp_error( validate_plugin( $plugin ) ) ) {
$current[] = $plugin;
}
}
return update_option( AI1WM_ACTIVE_PLUGINS, $current );
}
/**
* Get active template
*
* @return string
*/
function ai1wm_active_template() {
return get_option( AI1WM_ACTIVE_TEMPLATE );
}
/**
* Get active stylesheet
*
* @return string
*/
function ai1wm_active_stylesheet() {
return get_option( AI1WM_ACTIVE_STYLESHEET );
}
/**
* Set active template
*
* @param string $template Template name
* @return boolean
*/
function ai1wm_activate_template( $template ) {
return update_option( AI1WM_ACTIVE_TEMPLATE, $template );
}
/**
* Set active stylesheet
*
* @param string $stylesheet Stylesheet name
* @return boolean
*/
function ai1wm_activate_stylesheet( $stylesheet ) {
return update_option( AI1WM_ACTIVE_STYLESHEET, $stylesheet );
}
/**
* Set inactive sitewide plugins (inspired by WordPress deactivate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_deactivate_sitewide_plugins( $plugins ) {
$current = get_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, array() );
// Add plugins
foreach ( $plugins as $plugin ) {
if ( isset( $current[ $plugin ] ) ) {
unset( $current[ $plugin ] );
}
}
return update_site_option( AI1WM_ACTIVE_SITEWIDE_PLUGINS, $current );
}
/**
* Set inactive plugins (inspired by WordPress deactivate_plugins() function)
*
* @param array $plugins List of plugins
* @return boolean
*/
function ai1wm_deactivate_plugins( $plugins ) {
$current = get_option( AI1WM_ACTIVE_PLUGINS, array() );
// Remove plugins
foreach ( $plugins as $plugin ) {
if ( ( $key = array_search( $plugin, $current ) ) !== false ) {
unset( $current[ $key ] );
}
}
return update_option( AI1WM_ACTIVE_PLUGINS, $current );
}
/**
* Deactivate Jetpack modules
*
* @param array $modules List of modules
* @return boolean
*/
function ai1wm_deactivate_jetpack_modules( $modules ) {
$current = get_option( AI1WM_JETPACK_ACTIVE_MODULES, array() );
// Remove modules
foreach ( $modules as $module ) {
if ( ( $key = array_search( $module, $current ) ) !== false ) {
unset( $current[ $key ] );
}
}
return update_option( AI1WM_JETPACK_ACTIVE_MODULES, $current );
}
/**
* Deactivate Swift Optimizer rules
*
* @param array $rules List of rules
* @return boolean
*/
function ai1wm_deactivate_swift_optimizer_rules( $rules ) {
$current = get_option( AI1WM_SWIFT_OPTIMIZER_PLUGIN_ORGANIZER, array() );
// Remove rules
foreach ( $rules as $rule ) {
unset( $current['rules'][ $rule ] );
}
return update_option( AI1WM_SWIFT_OPTIMIZER_PLUGIN_ORGANIZER, $current );
}
/**
* Deactivate sitewide Revolution Slider
*
* @param string $basename Plugin basename
* @return boolean
*/
function ai1wm_deactivate_sitewide_revolution_slider( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
if ( isset( $plugins[ $basename ]['Version'] ) && ( $version = $plugins[ $basename ]['Version'] ) ) {
if ( version_compare( PHP_VERSION, '7.3', '>=' ) && version_compare( $version, '5.4.8.3', '<' ) ) {
return ai1wm_deactivate_sitewide_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.2', '>=' ) && version_compare( $version, '5.4.6', '<' ) ) {
return ai1wm_deactivate_sitewide_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.1', '>=' ) && version_compare( $version, '5.4.1', '<' ) ) {
return ai1wm_deactivate_sitewide_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.0', '>=' ) && version_compare( $version, '4.6.5', '<' ) ) {
return ai1wm_deactivate_sitewide_plugins( array( $basename ) );
}
}
}
return false;
}
/**
* Deactivate Revolution Slider
*
* @param string $basename Plugin basename
* @return boolean
*/
function ai1wm_deactivate_revolution_slider( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
if ( isset( $plugins[ $basename ]['Version'] ) && ( $version = $plugins[ $basename ]['Version'] ) ) {
if ( version_compare( PHP_VERSION, '7.3', '>=' ) && version_compare( $version, '5.4.8.3', '<' ) ) {
return ai1wm_deactivate_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.2', '>=' ) && version_compare( $version, '5.4.6', '<' ) ) {
return ai1wm_deactivate_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.1', '>=' ) && version_compare( $version, '5.4.1', '<' ) ) {
return ai1wm_deactivate_plugins( array( $basename ) );
}
if ( version_compare( PHP_VERSION, '7.0', '>=' ) && version_compare( $version, '4.6.5', '<' ) ) {
return ai1wm_deactivate_plugins( array( $basename ) );
}
}
}
return false;
}
/**
* Initial DB version
*
* @return boolean
*/
function ai1wm_initial_db_version() {
if ( ! get_option( AI1WM_DB_VERSION ) ) {
return update_option( AI1WM_DB_VERSION, get_option( AI1WM_INITIAL_DB_VERSION ) );
}
return false;
}
/**
* Discover plugin basename
*
* @param string $basename Plugin basename
* @return string
*/
function ai1wm_discover_plugin_basename( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
foreach ( $plugins as $plugin => $info ) {
if ( strpos( dirname( $plugin ), dirname( $basename ) ) !== false ) {
if ( basename( $plugin ) === basename( $basename ) ) {
return $plugin;
}
}
}
}
return $basename;
}
/**
* Validate plugin basename
*
* @param string $basename Plugin basename
* @return boolean
*/
function ai1wm_validate_plugin_basename( $basename ) {
if ( ( $plugins = get_plugins() ) ) {
foreach ( $plugins as $plugin => $info ) {
if ( $plugin === $basename ) {
return true;
}
}
}
return false;
}
/**
* Validate theme basename
*
* @param string $basename Theme basename
* @return boolean
*/
function ai1wm_validate_theme_basename( $basename ) {
if ( ( $themes = search_theme_directories() ) ) {
foreach ( $themes as $theme => $info ) {
if ( $info['theme_file'] === $basename ) {
return true;
}
}
}
return false;
}
/**
* Flush WP options cache
*
* @return void
*/
function ai1wm_cache_flush() {
wp_cache_init();
wp_cache_flush();
// Reset WP options cache
wp_cache_set( 'alloptions', array(), 'options' );
wp_cache_set( 'notoptions', array(), 'options' );
// Reset WP sitemeta cache
wp_cache_set( '1:notoptions', array(), 'site-options' );
wp_cache_set( '1:ms_files_rewriting', false, 'site-options' );
wp_cache_set( '1:active_sitewide_plugins', false, 'site-options' );
// Delete WP options cache
wp_cache_delete( 'alloptions', 'options' );
wp_cache_delete( 'notoptions', 'options' );
// Delete WP sitemeta cache
wp_cache_delete( '1:notoptions', 'site-options' );
wp_cache_delete( '1:ms_files_rewriting', 'site-options' );
wp_cache_delete( '1:active_sitewide_plugins', 'site-options' );
// Remove WP options filter
remove_all_filters( 'sanitize_option_home' );
remove_all_filters( 'sanitize_option_siteurl' );
remove_all_filters( 'default_site_option_ms_files_rewriting' );
}
/**
* Flush Elementor cache
*
* @return void
*/
function ai1wm_elementor_cache_flush() {
delete_post_meta_by_key( '_elementor_css' );
delete_option( '_elementor_global_css' );
delete_option( 'elementor-custom-breakpoints-files' );
}
/**
* Set WooCommerce Force SSL checkout
*
* @param boolean $yes Force SSL checkout
* @return void
*/
function ai1wm_woocommerce_force_ssl( $yes = true ) {
if ( get_option( 'woocommerce_force_ssl_checkout' ) ) {
if ( $yes ) {
update_option( 'woocommerce_force_ssl_checkout', 'yes' );
} else {
update_option( 'woocommerce_force_ssl_checkout', 'no' );
}
}
}
/**
* Set URL scheme
*
* @param string $url URL value
* @param string $scheme URL scheme
* @return string
*/
function ai1wm_url_scheme( $url, $scheme = '' ) {
if ( empty( $scheme ) ) {
return preg_replace( '#^\w+://#', '//', $url );
}
return preg_replace( '#^\w+://#', $scheme . '://', $url );
}
/**
* Opens a file in specified mode
*
* @param string $file Path to the file to open
* @param string $mode Mode in which to open the file
* @return resource
* @throws Ai1wm_Not_Accessible_Exception
*/
function ai1wm_open( $file, $mode ) {
$file_handle = @fopen( $file, $mode );
if ( false === $file_handle ) {
throw new Ai1wm_Not_Accessible_Exception( sprintf( __( 'Unable to open %s with mode %s. Technical details ', AI1WM_PLUGIN_NAME ), $file, $mode ) );
}
return $file_handle;
}
/**
* Write contents to a file
*
* @param resource $handle File handle to write to
* @param string $content Contents to write to the file
* @return integer
* @throws Ai1wm_Not_Writable_Exception
* @throws Ai1wm_Quota_Exceeded_Exception
*/
function ai1wm_write( $handle, $content ) {
$write_result = @fwrite( $handle, $content );
if ( false === $write_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Writable_Exception( sprintf( __( 'Unable to write to: %s. Technical details ', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
} elseif ( strlen( $content ) !== $write_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Quota_Exceeded_Exception( sprintf( __( 'Out of disk space. Unable to write to: %s. Technical details ', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $write_result;
}
/**
* Read contents from a file
*
* @param resource $handle File handle to read from
* @param string $filesize File size
* @return integer
* @throws Ai1wm_Not_Readable_Exception
*/
function ai1wm_read( $handle, $filesize ) {
$read_result = @fread( $handle, $filesize );
if ( false === $read_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Readable_Exception( sprintf( __( 'Unable to read file: %s. Technical details ', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $read_result;
}
/**
* Seeks on a file pointer
*
* @param string $handle File handle to seeks
* @return integer
*/
function ai1wm_seek( $handle, $offset, $mode = SEEK_SET ) {
$seek_result = @fseek( $handle, $offset, $mode );
if ( -1 === $seek_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Seekable_Exception( sprintf( __( 'Unable to seek to offset %d on %s. Technical details ', AI1WM_PLUGIN_NAME ), $offset, $meta['uri'] ) );
}
}
return $seek_result;
}
/**
* Tells on a file pointer
*
* @param string $handle File handle to tells
* @return integer
*/
function ai1wm_tell( $handle ) {
$tell_result = @ftell( $handle );
if ( false === $tell_result ) {
if ( ( $meta = stream_get_meta_data( $handle ) ) ) {
throw new Ai1wm_Not_Tellable_Exception( sprintf( __( 'Unable to get current pointer position of %s. Technical details ', AI1WM_PLUGIN_NAME ), $meta['uri'] ) );
}
}
return $tell_result;
}
/**
* Closes a file handle
*
* @param resource $handle File handle to close
* @return boolean
*/
function ai1wm_close( $handle ) {
return @fclose( $handle );
}
/**
* Deletes a file
*
* @param string $file Path to file to delete
* @return boolean
*/
function ai1wm_unlink( $file ) {
return @unlink( $file );
}
/**
* Sets modification time of a file
*
* @param string $file Path to file to change modification time
* @param integer $time File modification time
* @return boolean
*/
function ai1wm_touch( $file, $mtime ) {
return @touch( $file, $mtime );
}
/**
* Changes file mode
*
* @param string $file Path to file to change mode
* @param integer $time File mode
* @return boolean
*/
function ai1wm_chmod( $file, $mode ) {
return @chmod( $file, $mode );
}
/**
* Copies one file's contents to another
*
* @param string $source_file File to copy the contents from
* @param string $destination_file File to copy the contents to
*/
function ai1wm_copy( $source_file, $destination_file ) {
$source_handle = ai1wm_open( $source_file, 'rb' );
$destination_handle = ai1wm_open( $destination_file, 'ab' );
while ( $buffer = ai1wm_read( $source_handle, 4096 ) ) {
ai1wm_write( $destination_handle, $buffer );
}
ai1wm_close( $source_handle );
ai1wm_close( $destination_handle );
}
/**
* Check whether file size is supported by current PHP version
*
* @param string $file Path to file
* @param integer $php_int_size Size of PHP integer
* @return boolean $php_int_max Max value of PHP integer
*/
function ai1wm_is_filesize_supported( $file, $php_int_size = PHP_INT_SIZE, $php_int_max = PHP_INT_MAX ) {
$size_result = true;
// Check whether file size is less than 2GB in PHP 32bits
if ( $php_int_size === 4 ) {
if ( ( $file_handle = @fopen( $file, 'r' ) ) ) {
if ( @fseek( $file_handle, $php_int_max, SEEK_SET ) !== -1 ) {
if ( @fgetc( $file_handle ) !== false ) {
$size_result = false;
}
}
@fclose( $file_handle );
}
}
return $size_result;
}
/**
* Check whether file name is supported by All-in-One WP Migration
*
* @param string $file Path to file
* @param array $extensions File extensions
* @return boolean
*/
function ai1wm_is_filename_supported( $file, $extensions = array( 'wpress' ) ) {
if ( in_array( pathinfo( $file, PATHINFO_EXTENSION ), $extensions ) ) {
return true;
}
return false;
}
/**
* Verify secret key
*
* @param string $secret_key Secret key
* @return boolean
* @throws Ai1wm_Not_Valid_Secret_Key_Exception
*/
function ai1wm_verify_secret_key( $secret_key ) {
if ( $secret_key !== get_option( AI1WM_SECRET_KEY ) ) {
throw new Ai1wm_Not_Valid_Secret_Key_Exception( __( 'Unable to authenticate the secret key. Technical details ', AI1WM_PLUGIN_NAME ) );
}
return true;
}
/**
* Is scheduled backup?
*
* @return boolean
*/
function ai1wm_is_scheduled_backup() {
if ( isset( $_GET['ai1wm_manual_export'] ) || isset( $_POST['ai1wm_manual_export'] ) ) {
return false;
}
if ( isset( $_GET['ai1wm_manual_import'] ) || isset( $_POST['ai1wm_manual_import'] ) ) {
return false;
}
if ( isset( $_GET['ai1wm_manual_restore'] ) || isset( $_POST['ai1wm_manual_restore'] ) ) {
return false;
}
return true;
}
/**
* PHP setup environment
*
* @return void
*/
function ai1wm_setup_environment() {
// Set whether a client disconnect should abort script execution
@ignore_user_abort( true );
// Set maximum execution time
@set_time_limit( 0 );
// Set maximum time in seconds a script is allowed to parse input data
@ini_set( 'max_input_time', '-1' );
// Set maximum backtracking steps
@ini_set( 'pcre.backtrack_limit', PHP_INT_MAX );
// Set binary safe encoding
if ( @function_exists( 'mb_internal_encoding' ) && ( @ini_get( 'mbstring.func_overload' ) & 2 ) ) {
@mb_internal_encoding( 'ISO-8859-1' );
}
// Clean (erase) the output buffer and turn off output buffering
if ( @ob_get_length() ) {
@ob_end_clean();
}
// Set error handler
@set_error_handler( 'Ai1wm_Handler::error' );
// Set shutdown handler
@register_shutdown_function( 'Ai1wm_Handler::shutdown' );
}
/**
* Get WordPress time zone string
*
* @return string
*/
function ai1wm_get_timezone_string() {
if ( ( $timezone_string = get_option( 'timezone_string' ) ) ) {
return $timezone_string;
}
if ( ( $gmt_offset = get_option( 'gmt_offset' ) ) ) {
if ( $gmt_offset > 0 ) {
return sprintf( 'UTC+%s', abs( $gmt_offset ) );
} elseif ( $gmt_offset < 0 ) {
return sprintf( 'UTC-%s', abs( $gmt_offset ) );
}
}
return 'UTC';
}
/**
* Get WordPress filter hooks
*
* @param string $tag The name of the filter hook
* @return array
*/
function ai1wm_get_filters( $tag ) {
global $wp_filter;
// Get WordPress filter hooks
$filters = array();
if ( isset( $wp_filter[ $tag ] ) ) {
if ( ( $filters = $wp_filter[ $tag ] ) ) {
// WordPress 4.7 introduces new class for working with filters/actions called WP_Hook
// which adds another level of abstraction and we need to address it.
if ( isset( $filters->callbacks ) ) {
$filters = $filters->callbacks;
}
}
ksort( $filters );
}
return $filters;
}
/**
* Get WordPress uploads directory
*
* @return string
*/
function ai1wm_get_uploads_dir() {
if ( ( $upload_dir = wp_upload_dir() ) ) {
if ( isset( $upload_dir['basedir'] ) ) {
return untrailingslashit( $upload_dir['basedir'] );
}
}
}
/**
* Get WordPress uploads URL
*
* @return string
*/
function ai1wm_get_uploads_url() {
if ( ( $upload_dir = wp_upload_dir() ) ) {
if ( isset( $upload_dir['baseurl'] ) ) {
return trailingslashit( $upload_dir['baseurl'] );
}
}
}
/**
* Get WordPress uploads path
*
* @return string
*/
function ai1wm_get_uploads_path() {
if ( ( $upload_dir = wp_upload_dir() ) ) {
if ( isset( $upload_dir['basedir'] ) ) {
return str_replace( ABSPATH, '', $upload_dir['basedir'] );
}
}
}
/**
* i18n friendly version of basename()
*
* @param string $path File path
* @param string $suffix If the filename ends in suffix this will also be cut off
* @return string
*/
function ai1wm_basename( $path, $suffix = '' ) {
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}
/**
* i18n friendly version of dirname()
*
* @param string $path File path
* @return string
*/
function ai1wm_dirname( $path ) {
return urldecode( dirname( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ) ) );
}
/**
* Replace forward slash with current directory separator
*
* @param string $path Path
* @return string
*/
function ai1wm_replace_forward_slash_with_directory_separator( $path ) {
return str_replace( '/', DIRECTORY_SEPARATOR, $path );
}
/**
* Replace current directory separator with forward slash
*
* @param string $path Path
* @return string
*/
function ai1wm_replace_directory_separator_with_forward_slash( $path ) {
return str_replace( DIRECTORY_SEPARATOR, '/', $path );
}
/**
* Escape Windows directory separator
*
* @param string $path Path
* @return string
*/
function ai1wm_escape_windows_directory_separator( $path ) {
return preg_replace( '/[\\\\]+/', '\\\\\\\\', $path );
}
/**
* Should reset WordPress permalinks?
*
* @param array $params Request parameters
* @return boolean
*/
function ai1wm_should_reset_permalinks( $params ) {
global $wp_rewrite, $is_apache;
// Permalinks are not supported
if ( empty( $params['using_permalinks'] ) ) {
if ( $wp_rewrite->using_permalinks() ) {
if ( $is_apache ) {
if ( ! apache_mod_loaded( 'mod_rewrite', false ) ) {
return true;
}
}
}
}
return false;
}
/**
* Get .htaccess file content
*
* @return string
*/
function ai1wm_get_htaccess() {
if ( is_file( AI1WM_WORDPRESS_HTACCESS ) ) {
return @file_get_contents( AI1WM_WORDPRESS_HTACCESS );
}
}
/**
* Get web.config file content
*
* @return string
*/
function ai1wm_get_webconfig() {
if ( is_file( AI1WM_WORDPRESS_WEBCONFIG ) ) {
return @file_get_contents( AI1WM_WORDPRESS_WEBCONFIG );
}
}
/**
* Get available space on filesystem or disk partition
*
* @param string $path Directory of the filesystem or disk partition
* @return mixed
*/
function ai1wm_disk_free_space( $path ) {
if ( function_exists( 'disk_free_space' ) ) {
return @disk_free_space( $path );
}
}
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Backups_Controller {
public static function index() {
Ai1wm_Template::render(
'backups/index',
array(
'backups' => Ai1wm_Backups::get_files(),
'labels' => Ai1wm_Backups::get_labels(),
'username' => get_option( AI1WM_AUTH_USER ),
'password' => get_option( AI1WM_AUTH_PASSWORD ),
)
);
}
public static function delete( $params = array() ) {
ai1wm_setup_environment();
// Set params
if ( empty( $params ) ) {
$params = stripslashes_deep( $_POST );
}
// Set secret key
$secret_key = null;
if ( isset( $params['secret_key'] ) ) {
$secret_key = trim( $params['secret_key'] );
}
// Set archive
$archive = null;
if ( isset( $params['archive'] ) ) {
$archive = trim( $params['archive'] );
}
try {
// Ensure that unauthorized people cannot access delete action
ai1wm_verify_secret_key( $secret_key );
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
exit;
}
try {
Ai1wm_Backups::delete_file( $archive );
Ai1wm_Backups::delete_label( $archive );
} catch ( Ai1wm_Backups_Exception $e ) {
echo json_encode( array( 'errors' => array( $e->getMessage() ) ) );
exit;
}
echo json_encode( array( 'errors' => array() ) );
exit;
}
public static function add_label( $params = array() ) {
ai1wm_setup_environment();
// Set params
if ( empty( $params ) ) {
$params = stripslashes_deep( $_POST );
}
// Set secret key
$secret_key = null;
if ( isset( $params['secret_key'] ) ) {
$secret_key = trim( $params['secret_key'] );
}
// Set archive
$archive = null;
if ( isset( $params['archive'] ) ) {
$archive = trim( $params['archive'] );
}
// Set backup label
$label = null;
if ( isset( $params['label'] ) ) {
$label = trim( $params['label'] );
}
try {
// Ensure that unauthorized people cannot access add label action
ai1wm_verify_secret_key( $secret_key );
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
exit;
}
try {
Ai1wm_Backups::set_label( $archive, $label );
} catch ( Ai1wm_Backups_Exception $e ) {
echo json_encode( array( 'errors' => array( $e->getMessage() ) ) );
exit;
}
echo json_encode( array( 'errors' => array() ) );
exit;
}
public static function backup_list( $params = array() ) {
ai1wm_setup_environment();
// Set params
if ( empty( $params ) ) {
$params = stripslashes_deep( $_GET );
}
// Set secret key
$secret_key = null;
if ( isset( $params['secret_key'] ) ) {
$secret_key = trim( $params['secret_key'] );
}
try {
// Ensure that unauthorized people cannot access backups list action
ai1wm_verify_secret_key( $secret_key );
} catch ( Ai1wm_Not_Valid_Secret_Key_Exception $e ) {
exit;
}
Ai1wm_Template::render(
'backups/backups-list',
array(
'backups' => Ai1wm_Backups::get_files(),
'labels' => Ai1wm_Backups::get_labels(),
)
);
exit;
}
}
.elementor-animation-grow{transition-duration:.3s;transition-property:transform}.elementor-animation-grow:active,.elementor-animation-grow:focus,.elementor-animation-grow:hover{transform:scale(1.1)}.elementor-animation-shrink{transition-duration:.3s;transition-property:transform}.elementor-animation-shrink:active,.elementor-animation-shrink:focus,.elementor-animation-shrink:hover{transform:scale(0.9)}@keyframes elementor-animation-pulse{25%{transform:scale(1.1)}75%{transform:scale(0.9)}}.elementor-animation-pulse:active,.elementor-animation-pulse:focus,.elementor-animation-pulse:hover{animation-name:elementor-animation-pulse;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes elementor-animation-pulse-grow{to{transform:scale(1.1)}}.elementor-animation-pulse-grow:active,.elementor-animation-pulse-grow:focus,.elementor-animation-pulse-grow:hover{animation-name:elementor-animation-pulse-grow;animation-duration:.3s;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:alternate}@keyframes elementor-animation-pulse-shrink{to{transform:scale(0.9)}}.elementor-animation-pulse-shrink:active,.elementor-animation-pulse-shrink:focus,.elementor-animation-pulse-shrink:hover{animation-name:elementor-animation-pulse-shrink;animation-duration:.3s;animation-timing-function:linear;animation-iteration-count:infinite;animation-direction:alternate}@keyframes elementor-animation-push{50%{transform:scale(0.8)}100%{transform:scale(1)}}.elementor-animation-push:active,.elementor-animation-push:focus,.elementor-animation-push:hover{animation-name:elementor-animation-push;animation-duration:.3s;animation-timing-function:linear;animation-iteration-count:1}@keyframes elementor-animation-pop{50%{transform:scale(1.2)}}.elementor-animation-pop:active,.elementor-animation-pop:focus,.elementor-animation-pop:hover{animation-name:elementor-animation-pop;animation-duration:.3s;animation-timing-function:linear;animation-iteration-count:1}.elementor-animation-bounce-in{transition-duration:.5s}.elementor-animation-bounce-in:active,.elementor-animation-bounce-in:focus,.elementor-animation-bounce-in:hover{transform:scale(1.2);transition-timing-function:cubic-bezier(0.47,2.02,.31,-.36)}.elementor-animation-bounce-out{transition-duration:.5s}.elementor-animation-bounce-out:active,.elementor-animation-bounce-out:focus,.elementor-animation-bounce-out:hover{transform:scale(0.8);transition-timing-function:cubic-bezier(0.47,2.02,.31,-.36)}.elementor-animation-rotate{transition-duration:.3s;transition-property:transform}.elementor-animation-rotate:active,.elementor-animation-rotate:focus,.elementor-animation-rotate:hover{transform:rotate(4deg)}.elementor-animation-grow-rotate{transition-duration:.3s;transition-property:transform}.elementor-animation-grow-rotate:active,.elementor-animation-grow-rotate:focus,.elementor-animation-grow-rotate:hover{transform:scale(1.1) rotate(4deg)}.elementor-animation-float{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}.elementor-animation-float:active,.elementor-animation-float:focus,.elementor-animation-float:hover{transform:translateY(-8px)}.elementor-animation-sink{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}.elementor-animation-sink:active,.elementor-animation-sink:focus,.elementor-animation-sink:hover{transform:translateY(8px)}@keyframes elementor-animation-bob{0%{transform:translateY(-8px)}50%{transform:translateY(-4px)}100%{transform:translateY(-8px)}}@keyframes elementor-animation-bob-float{100%{transform:translateY(-8px)}}.elementor-animation-bob:active,.elementor-animation-bob:focus,.elementor-animation-bob:hover{animation-name:elementor-animation-bob-float,elementor-animation-bob;animation-duration:.3s,1.5s;animation-delay:0s,.3s;animation-timing-function:ease-out,ease-in-out;animation-iteration-count:1,infinite;animation-fill-mode:forwards;animation-direction:normal,alternate}@keyframes elementor-animation-hang{0%{transform:translateY(8px)}50%{transform:translateY(4px)}100%{transform:translateY(8px)}}@keyframes elementor-animation-hang-sink{100%{transform:translateY(8px)}}.elementor-animation-hang:active,.elementor-animation-hang:focus,.elementor-animation-hang:hover{animation-name:elementor-animation-hang-sink,elementor-animation-hang;animation-duration:.3s,1.5s;animation-delay:0s,.3s;animation-timing-function:ease-out,ease-in-out;animation-iteration-count:1,infinite;animation-fill-mode:forwards;animation-direction:normal,alternate}.elementor-animation-skew{transition-duration:.3s;transition-property:transform}.elementor-animation-skew:active,.elementor-animation-skew:focus,.elementor-animation-skew:hover{transform:skew(-10deg)}.elementor-animation-skew-forward{transition-duration:.3s;transition-property:transform;transform-origin:0 100%}.elementor-animation-skew-forward:active,.elementor-animation-skew-forward:focus,.elementor-animation-skew-forward:hover{transform:skew(-10deg)}.elementor-animation-skew-backward{transition-duration:.3s;transition-property:transform;transform-origin:0 100%}.elementor-animation-skew-backward:active,.elementor-animation-skew-backward:focus,.elementor-animation-skew-backward:hover{transform:skew(10deg)}@keyframes elementor-animation-wobble-vertical{16.65%{transform:translateY(8px)}33.3%{transform:translateY(-6px)}49.95%{transform:translateY(4px)}66.6%{transform:translateY(-2px)}83.25%{transform:translateY(1px)}100%{transform:translateY(0)}}.elementor-animation-wobble-vertical:active,.elementor-animation-wobble-vertical:focus,.elementor-animation-wobble-vertical:hover{animation-name:elementor-animation-wobble-vertical;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-horizontal{16.65%{transform:translateX(8px)}33.3%{transform:translateX(-6px)}49.95%{transform:translateX(4px)}66.6%{transform:translateX(-2px)}83.25%{transform:translateX(1px)}100%{transform:translateX(0)}}.elementor-animation-wobble-horizontal:active,.elementor-animation-wobble-horizontal:focus,.elementor-animation-wobble-horizontal:hover{animation-name:elementor-animation-wobble-horizontal;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-to-bottom-right{16.65%{transform:translate(8px,8px)}33.3%{transform:translate(-6px,-6px)}49.95%{transform:translate(4px,4px)}66.6%{transform:translate(-2px,-2px)}83.25%{transform:translate(1px,1px)}100%{transform:translate(0,0)}}.elementor-animation-wobble-to-bottom-right:active,.elementor-animation-wobble-to-bottom-right:focus,.elementor-animation-wobble-to-bottom-right:hover{animation-name:elementor-animation-wobble-to-bottom-right;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-to-top-right{16.65%{transform:translate(8px,-8px)}33.3%{transform:translate(-6px,6px)}49.95%{transform:translate(4px,-4px)}66.6%{transform:translate(-2px,2px)}83.25%{transform:translate(1px,-1px)}100%{transform:translate(0,0)}}.elementor-animation-wobble-to-top-right:active,.elementor-animation-wobble-to-top-right:focus,.elementor-animation-wobble-to-top-right:hover{animation-name:elementor-animation-wobble-to-top-right;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-top{16.65%{transform:skew(-12deg)}33.3%{transform:skew(10deg)}49.95%{transform:skew(-6deg)}66.6%{transform:skew(4deg)}83.25%{transform:skew(-2deg)}100%{transform:skew(0)}}.elementor-animation-wobble-top{transform-origin:0 100%}.elementor-animation-wobble-top:active,.elementor-animation-wobble-top:focus,.elementor-animation-wobble-top:hover{animation-name:elementor-animation-wobble-top;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-bottom{16.65%{transform:skew(-12deg)}33.3%{transform:skew(10deg)}49.95%{transform:skew(-6deg)}66.6%{transform:skew(4deg)}83.25%{transform:skew(-2deg)}100%{transform:skew(0)}}.elementor-animation-wobble-bottom{transform-origin:100% 0}.elementor-animation-wobble-bottom:active,.elementor-animation-wobble-bottom:focus,.elementor-animation-wobble-bottom:hover{animation-name:elementor-animation-wobble-bottom;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-wobble-skew{16.65%{transform:skew(-12deg)}33.3%{transform:skew(10deg)}49.95%{transform:skew(-6deg)}66.6%{transform:skew(4deg)}83.25%{transform:skew(-2deg)}100%{transform:skew(0)}}.elementor-animation-wobble-skew:active,.elementor-animation-wobble-skew:focus,.elementor-animation-wobble-skew:hover{animation-name:elementor-animation-wobble-skew;animation-duration:1s;animation-timing-function:ease-in-out;animation-iteration-count:1}@keyframes elementor-animation-buzz{50%{transform:translateX(3px) rotate(2deg)}100%{transform:translateX(-3px) rotate(-2deg)}}.elementor-animation-buzz:active,.elementor-animation-buzz:focus,.elementor-animation-buzz:hover{animation-name:elementor-animation-buzz;animation-duration:.15s;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes elementor-animation-buzz-out{10%{transform:translateX(3px) rotate(2deg)}20%{transform:translateX(-3px) rotate(-2deg)}30%{transform:translateX(3px) rotate(2deg)}40%{transform:translateX(-3px) rotate(-2deg)}50%{transform:translateX(2px) rotate(1deg)}60%{transform:translateX(-2px) rotate(-1deg)}70%{transform:translateX(2px) rotate(1deg)}80%{transform:translateX(-2px) rotate(-1deg)}90%{transform:translateX(1px) rotate(0)}100%{transform:translateX(-1px) rotate(0)}}.elementor-animation-buzz-out:active,.elementor-animation-buzz-out:focus,.elementor-animation-buzz-out:hover{animation-name:elementor-animation-buzz-out;animation-duration:.75s;animation-timing-function:linear;animation-iteration-count:1}var type = self.data.type,
bin = self.data.bin,
hashOpts = self.data.hashOpts;
self.res = {};
if (type === 'md5') {
let sp = new self.SparkMD5.ArrayBuffer();
sp.append(bin);
self.res.hash = sp.end();
} else {
let sha = new jsSHA('SHA' + (type.length === 5? type : ('-' + type)).toUpperCase(), 'ARRAYBUFFER'),
opts = {};
if (type === 'ke128') {
opts.shakeLen = hashOpts.shake128len;
} else if (type === 'ke256') {
opts.shakeLen = hashOpts.shake256len;
}
sha.update(bin);
self.res.hash = sha.getHash('HEX', opts);
}
[
{
"key": "group_65f84bafe0536",
"title": "Taxonomy Extras",
"fields": [
{
"key": "field_65f84bb059d4d",
"label": "Custom Text",
"name": "custom_text",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_65f84be959d4e",
"label": "Taxonomy Image",
"name": "taxonomy_image",
"aria-label": "",
"type": "image",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "array",
"library": "all",
"min_width": "",
"min_height": "",
"min_size": "",
"max_width": "",
"max_height": "",
"max_size": "",
"mime_types": "",
"preview_size": "medium"
}
],
"location": [
[
{
"param": "taxonomy",
"operator": "==",
"value": "all"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 1
}
]
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Export_Content {
public static function execute( $params ) {
// Set archive bytes offset
if ( isset( $params['archive_bytes_offset'] ) ) {
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
} else {
$archive_bytes_offset = ai1wm_archive_bytes( $params );
}
// Set file bytes offset
if ( isset( $params['file_bytes_offset'] ) ) {
$file_bytes_offset = (int) $params['file_bytes_offset'];
} else {
$file_bytes_offset = 0;
}
// Set content bytes offset
if ( isset( $params['content_bytes_offset'] ) ) {
$content_bytes_offset = (int) $params['content_bytes_offset'];
} else {
$content_bytes_offset = 0;
}
// Get processed files size
if ( isset( $params['processed_files_size'] ) ) {
$processed_files_size = (int) $params['processed_files_size'];
} else {
$processed_files_size = 0;
}
// Get total content files size
if ( isset( $params['total_content_files_size'] ) ) {
$total_content_files_size = (int) $params['total_content_files_size'];
} else {
$total_content_files_size = 1;
}
// Get total content files count
if ( isset( $params['total_content_files_count'] ) ) {
$total_content_files_count = (int) $params['total_content_files_count'];
} else {
$total_content_files_count = 1;
}
// What percent of files have we processed?
if ( empty( $total_content_files_size ) ) {
$progress = 100;
} else {
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
}
// Set progress
Ai1wm_Status::info( sprintf( __( 'Archiving %d content files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
// Flag to hold if file data has been processed
$completed = true;
// Start time
$start = microtime( true );
// Get content list file
$content_list = ai1wm_open( ai1wm_content_list_path( $params ), 'r' );
// Set content pointer at the current index
if ( fseek( $content_list, $content_bytes_offset ) !== -1 ) {
// Open the archive file for writing
$archive = new Ai1wm_Compressor( ai1wm_archive_path( $params ) );
// Set the file pointer to the one that we have saved
$archive->set_file_pointer( $archive_bytes_offset );
// Loop over files
while ( $file_path = trim( fgets( $content_list ) ) ) {
$file_bytes_written = 0;
// Add file to archive
if ( ( $completed = $archive->add_file( WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $file_path, $file_path, $file_bytes_written, $file_bytes_offset ) ) ) {
$file_bytes_offset = 0;
// Get content bytes offset
$content_bytes_offset = ftell( $content_list );
}
// Increment processed files size
$processed_files_size += $file_bytes_written;
// What percent of files have we processed?
if ( empty( $total_content_files_size ) ) {
$progress = 100;
} else {
$progress = (int) min( ( $processed_files_size / $total_content_files_size ) * 100, 100 );
}
// Set progress
Ai1wm_Status::info( sprintf( __( 'Archiving %d content files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_content_files_count, $progress ) );
// More than 10 seconds have passed, break and do another request
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
if ( ( microtime( true ) - $start ) > $timeout ) {
$completed = false;
break;
}
}
}
// Get archive bytes offset
$archive_bytes_offset = $archive->get_file_pointer();
// Truncate the archive file
$archive->truncate();
// Close the archive file
$archive->close();
}
// End of the content list?
if ( feof( $content_list ) ) {
// Unset archive bytes offset
unset( $params['archive_bytes_offset'] );
// Unset file bytes offset
unset( $params['file_bytes_offset'] );
// Unset content bytes offset
unset( $params['content_bytes_offset'] );
// Unset processed files size
unset( $params['processed_files_size'] );
// Unset total content files size
unset( $params['total_content_files_size'] );
// Unset total content files count
unset( $params['total_content_files_count'] );
// Unset completed flag
unset( $params['completed'] );
} else {
// Set archive bytes offset
$params['archive_bytes_offset'] = $archive_bytes_offset;
// Set file bytes offset
$params['file_bytes_offset'] = $file_bytes_offset;
// Set content bytes offset
$params['content_bytes_offset'] = $content_bytes_offset;
// Set processed files size
$params['processed_files_size'] = $processed_files_size;
// Set total content files size
$params['total_content_files_size'] = $total_content_files_size;
// Set total content files count
$params['total_content_files_count'] = $total_content_files_count;
// Set completed flag
$params['completed'] = $completed;
}
// Close the content list file
ai1wm_close( $content_list );
return $params;
}
}
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Export_Clean {
public static function execute( $params ) {
// Delete storage files
Ai1wm_Directory::delete( ai1wm_storage_path( $params ) );
// Exit in console
if ( defined( 'WP_CLI' ) ) {
return $params;
}
exit;
}
}
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Import_Blogs {
public static function execute( $params ) {
// Set progress
Ai1wm_Status::info( __( 'Preparing blogs...', AI1WM_PLUGIN_NAME ) );
$blogs = array();
// Check multisite.json file
if ( true === is_file( ai1wm_multisite_path( $params ) ) ) {
// Read multisite.json file
$handle = ai1wm_open( ai1wm_multisite_path( $params ), 'r' );
// Parse multisite.json file
$multisite = ai1wm_read( $handle, filesize( ai1wm_multisite_path( $params ) ) );
$multisite = json_decode( $multisite, true );
// Close handle
ai1wm_close( $handle );
// Validate
if ( empty( $multisite['Network'] ) ) {
if ( isset( $multisite['Sites'] ) && ( $sites = $multisite['Sites'] ) ) {
if ( count( $sites ) === 1 && ( $subsite = current( $sites ) ) ) {
// Set internal Site URL (backward compatibility)
if ( empty( $subsite['InternalSiteURL'] ) ) {
$subsite['InternalSiteURL'] = null;
}
// Set internal Home URL (backward compatibility)
if ( empty( $subsite['InternalHomeURL'] ) ) {
$subsite['InternalHomeURL'] = null;
}
// Set active plugins (backward compatibility)
if ( empty( $subsite['Plugins'] ) ) {
$subsite['Plugins'] = array();
}
// Set active template (backward compatibility)
if ( empty( $subsite['Template'] ) ) {
$subsite['Template'] = null;
}
// Set active stylesheet (backward compatibility)
if ( empty( $subsite['Stylesheet'] ) ) {
$subsite['Stylesheet'] = null;
}
// Set uploads path (backward compatibility)
if ( empty( $subsite['Uploads'] ) ) {
$subsite['Uploads'] = null;
}
// Set uploads URL path (backward compatibility)
if ( empty( $subsite['UploadsURL'] ) ) {
$subsite['UploadsURL'] = null;
}
// Set uploads path (backward compatibility)
if ( empty( $subsite['WordPress']['Uploads'] ) ) {
$subsite['WordPress']['Uploads'] = null;
}
// Set uploads URL path (backward compatibility)
if ( empty( $subsite['WordPress']['UploadsURL'] ) ) {
$subsite['WordPress']['UploadsURL'] = null;
}
// Set blog items
$blogs[] = array(
'Old' => array(
'BlogID' => $subsite['BlogID'],
'SiteURL' => $subsite['SiteURL'],
'HomeURL' => $subsite['HomeURL'],
'InternalSiteURL' => $subsite['InternalSiteURL'],
'InternalHomeURL' => $subsite['InternalHomeURL'],
'Plugins' => $subsite['Plugins'],
'Template' => $subsite['Template'],
'Stylesheet' => $subsite['Stylesheet'],
'Uploads' => $subsite['Uploads'],
'UploadsURL' => $subsite['UploadsURL'],
'WordPress' => $subsite['WordPress'],
),
'New' => array(
'BlogID' => null,
'SiteURL' => site_url(),
'HomeURL' => home_url(),
'InternalSiteURL' => site_url(),
'InternalHomeURL' => home_url(),
'Plugins' => $subsite['Plugins'],
'Template' => $subsite['Template'],
'Stylesheet' => $subsite['Stylesheet'],
'Uploads' => get_option( 'upload_path' ),
'UploadsURL' => get_option( 'upload_url_path' ),
'WordPress' => array(
'UploadsURL' => ai1wm_get_uploads_url(),
),
),
);
} else {
throw new Ai1wm_Import_Exception( __( 'The archive should contain Single WordPress site! Please revisit your export settings.', AI1WM_PLUGIN_NAME ) );
}
} else {
throw new Ai1wm_Import_Exception( __( 'At least one WordPress site should be presented in the archive.', AI1WM_PLUGIN_NAME ) );
}
} else {
throw new Ai1wm_Import_Exception( __( 'Unable to import WordPress Network into WordPress Single site.', AI1WM_PLUGIN_NAME ) );
}
}
// Write blogs.json file
$handle = ai1wm_open( ai1wm_blogs_path( $params ), 'w' );
ai1wm_write( $handle, json_encode( $blogs ) );
ai1wm_close( $handle );
// Set progress
Ai1wm_Status::info( __( 'Done preparing blogs.', AI1WM_PLUGIN_NAME ) );
return $params;
}
}
/**
* Copyright (C) 2014-2020 ServMask Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* ███████╗███████╗██████╗ ██╗ ██╗███╗ ███╗ █████╗ ███████╗██╗ ██╗
* ██╔════╝██╔════╝██╔══██╗██║ ██║████╗ ████║██╔══██╗██╔════╝██║ ██╔╝
* ███████╗█████╗ ██████╔╝██║ ██║██╔████╔██║███████║███████╗█████╔╝
* ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚██╔╝██║██╔══██║╚════██║██╔═██╗
* ███████║███████╗██║ ██║ ╚████╔╝ ██║ ╚═╝ ██║██║ ██║███████║██║ ██╗
* ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Kangaroos cannot jump here' );
}
class Ai1wm_Import_Content {
public static function execute( $params ) {
// Set archive bytes offset
if ( isset( $params['archive_bytes_offset'] ) ) {
$archive_bytes_offset = (int) $params['archive_bytes_offset'];
} else {
$archive_bytes_offset = 0;
}
// Set file bytes offset
if ( isset( $params['file_bytes_offset'] ) ) {
$file_bytes_offset = (int) $params['file_bytes_offset'];
} else {
$file_bytes_offset = 0;
}
// Get processed files size
if ( isset( $params['processed_files_size'] ) ) {
$processed_files_size = (int) $params['processed_files_size'];
} else {
$processed_files_size = 0;
}
// Get total files size
if ( isset( $params['total_files_size'] ) ) {
$total_files_size = (int) $params['total_files_size'];
} else {
$total_files_size = 1;
}
// Get total files count
if ( isset( $params['total_files_count'] ) ) {
$total_files_count = (int) $params['total_files_count'];
} else {
$total_files_count = 1;
}
// Read blogs.json file
$handle = ai1wm_open( ai1wm_blogs_path( $params ), 'r' );
// Parse blogs.json file
$blogs = ai1wm_read( $handle, filesize( ai1wm_blogs_path( $params ) ) );
$blogs = json_decode( $blogs, true );
// Close handle
ai1wm_close( $handle );
// What percent of files have we processed?
$progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 );
// Set progress
Ai1wm_Status::info( sprintf( __( 'Restoring %d files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) );
// Flag to hold if file data has been processed
$completed = true;
// Start time
$start = microtime( true );
// Open the archive file for reading
$archive = new Ai1wm_Extractor( ai1wm_archive_path( $params ) );
// Set the file pointer to the one that we have saved
$archive->set_file_pointer( $archive_bytes_offset );
$old_paths = array();
$new_paths = array();
// Set extract paths
foreach ( $blogs as $blog ) {
if ( ai1wm_is_mainsite( $blog['Old']['BlogID'] ) === false ) {
if ( defined( 'UPLOADBLOGSDIR' ) ) {
// Old files dir style
$old_paths[] = ai1wm_blog_files_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_files_abspath( $blog['New']['BlogID'] );
// Old blogs.dir style
$old_paths[] = ai1wm_blog_blogsdir_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_blogsdir_abspath( $blog['New']['BlogID'] );
// New sites dir style
$old_paths[] = ai1wm_blog_sites_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_files_abspath( $blog['New']['BlogID'] );
} else {
// Old files dir style
$old_paths[] = ai1wm_blog_files_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
// Old blogs.dir style
$old_paths[] = ai1wm_blog_blogsdir_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
// New sites dir style
$old_paths[] = ai1wm_blog_sites_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
}
}
}
// Set base site extract paths (should be added at the end of arrays)
foreach ( $blogs as $blog ) {
if ( ai1wm_is_mainsite( $blog['Old']['BlogID'] ) === true ) {
if ( defined( 'UPLOADBLOGSDIR' ) ) {
// Old files dir style
$old_paths[] = ai1wm_blog_files_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_files_abspath( $blog['New']['BlogID'] );
// Old blogs.dir style
$old_paths[] = ai1wm_blog_blogsdir_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_blogsdir_abspath( $blog['New']['BlogID'] );
// New sites dir style
$old_paths[] = ai1wm_blog_sites_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_files_abspath( $blog['New']['BlogID'] );
} else {
// Old files dir style
$old_paths[] = ai1wm_blog_files_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
// Old blogs.dir style
$old_paths[] = ai1wm_blog_blogsdir_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
// New sites dir style
$old_paths[] = ai1wm_blog_sites_relpath( $blog['Old']['BlogID'] );
$new_paths[] = ai1wm_blog_sites_abspath( $blog['New']['BlogID'] );
}
}
}
$old_paths[] = ai1wm_blog_sites_relpath();
$new_paths[] = ai1wm_blog_sites_abspath();
while ( $archive->has_not_reached_eof() ) {
$file_bytes_written = 0;
// Exclude WordPress files
$exclude_files = array_keys( _get_dropins() );
// Exclude plugin files
$exclude_files = array_merge(
$exclude_files,
array(
AI1WM_PACKAGE_NAME,
AI1WM_MULTISITE_NAME,
AI1WM_DATABASE_NAME,
AI1WM_MUPLUGINS_NAME,
)
);
// Exclude Elementor files
$exclude_files = array_merge( $exclude_files, array( AI1WM_ELEMENTOR_CSS_NAME ) );
// Exclude content extensions
$exclude_extensions = array( AI1WM_LESS_CACHE_NAME );
// Extract a file from archive to WP_CONTENT_DIR
if ( ( $completed = $archive->extract_one_file_to( WP_CONTENT_DIR, $exclude_files, $exclude_extensions, $old_paths, $new_paths, $file_bytes_written, $file_bytes_offset ) ) ) {
$file_bytes_offset = 0;
}
// Get archive bytes offset
$archive_bytes_offset = $archive->get_file_pointer();
// Increment processed files size
$processed_files_size += $file_bytes_written;
// What percent of files have we processed?
$progress = (int) min( ( $processed_files_size / $total_files_size ) * 100, 100 );
// Set progress
Ai1wm_Status::info( sprintf( __( 'Restoring %d files... %d%% complete', AI1WM_PLUGIN_NAME ), $total_files_count, $progress ) );
// More than 10 seconds have passed, break and do another request
if ( ( $timeout = apply_filters( 'ai1wm_completed_timeout', 10 ) ) ) {
if ( ( microtime( true ) - $start ) > $timeout ) {
$completed = false;
break;
}
}
}
// End of the archive?
if ( $archive->has_reached_eof() ) {
// Unset archive bytes offset
unset( $params['archive_bytes_offset'] );
// Unset file bytes offset
unset( $params['file_bytes_offset'] );
// Unset processed files size
unset( $params['processed_files_size'] );
// Unset total files size
unset( $params['total_files_size'] );
// Unset total files count
unset( $params['total_files_count'] );
// Unset completed flag
unset( $params['completed'] );
} else {
// Set archive bytes offset
$params['archive_bytes_offset'] = $archive_bytes_offset;
// Set file bytes offset
$params['file_bytes_offset'] = $file_bytes_offset;
// Set processed files size
$params['processed_files_size'] = $processed_files_size;
// Set total files size
$params['total_files_size'] = $total_files_size;
// Set total files count
$params['total_files_count'] = $total_files_count;
// Set completed flag
$params['completed'] = $completed;
}
// Close the archive file
$archive->close();
return $params;
}
}
export const PAYMENT_METHOD_NAME = 'bacs';
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh
* @license MIT
*/
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// External dependencies.
import React from 'react';
// Internal dependencies.
import Tooltip from '../../../../components/tooltip/tooltip';
import { __ } from '@wordpress/i18n';
import { useStateValue } from '../../../../store/store';
import ICONS from '../../../../../icons';
import './style.scss';
import { initialState } from '../../../../store/reducer';
import { getStepIndex } from '../../../../utils/functions';
const MyFavorite = ( { isDisabled } ) => {
const [ stateValue, dispatch ] = useStateValue();
const { onMyFavorite } = stateValue;
if (
getStepIndex( 'page-builder' ) === stateValue.currentIndex ||
getStepIndex( 'classic-page-builder' ) === stateValue.currentIndex
) {
return null;
}
const handleClick = ( event ) => {
event.stopPropagation();
dispatch( {
type: 'set',
onMyFavorite: ! onMyFavorite,
siteType: '',
siteOrder: initialState.siteOrder,
siteBusinessType: initialState.siteBusinessType,
selectedMegaMenu: initialState.selectedMegaMenu,
siteSearchTerm: '',
} );
};
return (
{ ICONS.favorite }
{ isDisabled && (
) }
);
};
export default MyFavorite;
/**
* Typography Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Typography_Customizer' ) ) :
class OceanWP_Typography_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'load_fonts' ) );
// CSS output
if ( is_customize_preview() ) {
add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
add_action( 'wp_head', array( $this, 'live_preview_styles' ), 999 );
} else {
add_filter( 'ocean_head_css', array( $this, 'head_css' ), 99 );
}
}
/**
* Array of Typography settings to add to the customizer
*
* @since 1.0.0
*/
public function elements() {
// Return settings
return apply_filters( 'ocean_typography_settings', array(
'body' => array(
'label' => esc_html__( 'Body', 'oceanwp' ),
'target' => 'body',
'defaults' => array(
'font-size' => '14px',
'color' => '#929292',
'line-height' => '1.8',
),
),
'headings' => array(
'label' => esc_html__( 'All Headings', 'oceanwp' ),
'target' => 'h1,h2,h3,h4,h5,h6,.theme-heading,.widget-title,.oceanwp-widget-recent-posts-title,.comment-reply-title,.entry-title,.sidebar-box .widget-title',
'exclude' => array( 'font-size' ),
'defaults' => array(
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h1' => array(
'label' => esc_html__( 'Heading 1 (H1)', 'oceanwp' ),
'target' => 'h1',
'defaults' => array(
'font-size' => '23px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h2' => array(
'label' => esc_html__( 'Heading 2 (H2)', 'oceanwp' ),
'target' => 'h2',
'defaults' => array(
'font-size' => '20px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h3' => array(
'label' => esc_html__( 'Heading 3 (H3)', 'oceanwp' ),
'target' => 'h3',
'defaults' => array(
'font-size' => '18px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h4' => array(
'label' => esc_html__( 'Heading 4 (H4)', 'oceanwp' ),
'target' => 'h4',
'defaults' => array(
'font-size' => '17px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'logo' => array(
'label' => esc_html__( 'Logo', 'oceanwp' ),
'target' => '#site-logo a.site-logo-text',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '24px',
'line-height' => '1.8',
),
),
'top_menu' => array(
'label' => esc_html__( 'Top Bar', 'oceanwp' ),
'target' => '#top-bar-content,#top-bar-social-alt',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1.8',
),
'active_callback' => 'oceanwp_cac_has_topbar',
),
'menu' => array(
'label' => esc_html__( 'Main Menu', 'oceanwp' ),
'target' => '#site-navigation-wrap .dropdown-menu > li > a,#site-header.full_screen-header .fs-dropdown-menu > li > a,#site-header.top-header #site-navigation-wrap .dropdown-menu > li > a,#site-header.center-header #site-navigation-wrap .dropdown-menu > li > a,#site-header.medium-header #site-navigation-wrap .dropdown-menu > li > a,.oceanwp-mobile-menu-icon a',
'exclude' => array( 'font-color', 'line-height' ),
'defaults' => array(
'font-size' => '13px',
'letter-spacing' => '0.6',
),
),
'menu_dropdown' => array(
'label' => esc_html__( 'Main Menu: Dropdowns', 'oceanwp' ),
'target' => '.dropdown-menu ul li a.menu-link,#site-header.full_screen-header .fs-dropdown-menu ul.sub-menu li a',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1.2',
'letter-spacing' => '0.6',
),
),
'mobile_menu_dropdown' => array(
'label' => esc_html__( 'Mobile Menu', 'oceanwp' ),
'target' => '.sidr-class-dropdown-menu li a, a.sidr-class-toggle-sidr-close, #mobile-dropdown ul li a, body #mobile-fullscreen ul li a',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '15px',
'line-height' => '1.8',
),
),
'page_title' => array(
'label' => esc_html__( 'Page Title', 'oceanwp' ),
'target' => '.page-header .page-header-title, .page-header.background-image-page-header .page-header-title',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '32px',
'line-height' => '1.4',
),
'active_callback' => 'oceanwp_cac_has_page_header',
),
'page_subheading' => array(
'label' => esc_html__( 'Page Title Subheading', 'oceanwp' ),
'target' => '.page-header .page-subheading',
'defaults' => array(
'font-size' => '15px',
'color' => '#929292',
'line-height' => '1.8',
),
'active_callback' => 'oceanwp_cac_has_page_header',
),
'breadcrumbs' => array(
'label' => esc_html__( 'Breadcrumbs', 'oceanwp' ),
'target' => '.site-breadcrumbs',
'exclude' => array( 'font-color', 'line-height' ),
'defaults' => array(
'font-size' => '13px',
),
'active_callback' => 'oceanwp_cac_has_breadcrumbs',
),
'blog_entry_title' => array(
'label' => esc_html__( 'Blog Entry Title', 'oceanwp' ),
'target' => '.blog-entry.post .blog-entry-header .entry-title a',
'defaults' => array(
'font-size' => '24px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'blog_post_title' => array(
'label' => esc_html__( 'Blog Post Title', 'oceanwp' ),
'target' => '.single-post .entry-title',
'defaults' => array(
'font-size' => '34px',
'color' => '#333333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
),
'sidebar_widget_title' => array(
'label' => esc_html__( 'Sidebar Widget Heading', 'oceanwp' ),
'target' => '.sidebar-box .widget-title',
'defaults' => array(
'font-size' => '13px',
'color' => '#333333',
'line-height' => '1',
'letter-spacing' => '1',
),
),
'widgets' => array(
'label' => esc_html__( 'Widgets', 'oceanwp' ),
'target' => '.sidebar-box, .footer-box',
),
'footer_widget_title' => array(
'label' => esc_html__( 'Footer Widget Heading', 'oceanwp' ),
'target' => '#footer-widgets .footer-box .widget-title',
'defaults' => array(
'font-size' => '13px',
'color' => '#ffffff',
'line-height' => '1',
'letter-spacing' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
),
'copyright' => array(
'label' => esc_html__( 'Footer Copyright', 'oceanwp' ),
'target' => '#footer-bottom #copyright',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_bottom',
),
'footer_menu' => array(
'label' => esc_html__( 'Footer Menu', 'oceanwp' ),
'target' => '#footer-bottom #footer-bottom-menu',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_bottom',
),
) );
}
/**
* Customizer options
*
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
// Get elements
$elements = self::elements();
// Return if elements are empty
if ( empty( $elements ) ) {
return;
}
// Panel
$wp_customize->add_panel( 'ocean_typography_panel' , array(
'title' => esc_html__( 'Typography', 'oceanwp' ),
'priority' => 210,
) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_typography_general' , array(
'title' => esc_html__( 'General', 'oceanwp' ),
'priority' => 1,
'panel' => 'ocean_typography_panel',
) );
/**
* Disable Google Fonts
*/
$wp_customize->add_setting( 'ocean_disable_google_font', array(
'transport' => 'postMessage',
'default' => false,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_disable_google_font', array(
'label' => esc_html__( 'Disable Google Fonts', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_typography_general',
'settings' => 'ocean_disable_google_font',
'priority' => 10,
) ) );
/**
* Font Subsets
*/
$wp_customize->add_setting( 'ocean_google_font_subsets' , array(
'default' => array( 'latin' ),
'sanitize_callback' => 'oceanwp_sanitize_multicheck',
) );
$wp_customize->add_control( new OceanWP_Customize_Multicheck_Control( $wp_customize, 'ocean_google_font_subsets', array(
'label' => esc_html__( 'Font Subsets', 'oceanwp' ),
'section' => 'ocean_typography_general',
'settings' => 'ocean_google_font_subsets',
'priority' => 10,
'choices' => array(
'latin' => 'latin',
'latin-ext' => 'latin-ext',
'cyrillic' => 'cyrillic',
'cyrillic-ext' => 'cyrillic-ext',
'greek' => 'greek',
'greek-ext' => 'greek-ext',
'vietnamese' => 'vietnamese',
),
) ) );
// Lopp through elements
$count = '1';
foreach( $elements as $element => $array ) {
$count++;
// Get label
$label = ! empty( $array['label'] ) ? $array['label'] : null;
$exclude_attributes = ! empty( $array['exclude'] ) ? $array['exclude'] : false;
$active_callback = isset( $array['active_callback'] ) ? $array['active_callback'] : null;
$transport = 'postMessage';
// Get attributes
if ( ! empty ( $array['attributes'] ) ) {
$attributes = $array['attributes'];
} else {
$attributes = array(
'font-family',
'font-weight',
'font-style',
'text-transform',
'font-size',
'line-height',
'letter-spacing',
'font-color',
);
}
// Set keys equal to vals
$attributes = array_combine( $attributes, $attributes );
// Exclude attributes for specific options
if ( $exclude_attributes ) {
foreach ( $exclude_attributes as $key => $val ) {
unset( $attributes[ $val ] );
}
}
// Register new setting if label isn't empty
if ( $label ) {
/**
* Section
*/
$wp_customize->add_section( 'ocean_typography_'. $element , array(
'title' => $label,
'priority' => $count,
'panel' => 'ocean_typography_panel',
) );
/**
* Font Family
*/
if ( in_array( 'font-family', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-family]', array(
'type' => 'theme_mod',
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new OceanWP_Customizer_Typography_Control( $wp_customize, $element .'_typography[font-family]', array(
'label' => esc_html__( 'Font Family', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-family]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
) ) );
}
/**
* Font Weight
*/
if ( in_array( 'font-weight', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-weight]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[font-weight]', array(
'label' => esc_html__( 'Font Weight', 'oceanwp' ),
'description' => esc_html__( 'Important: Not all fonts support every font-weight.', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-weight]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'100' => esc_html__( 'Thin: 100', 'oceanwp' ),
'200' => esc_html__( 'Light: 200', 'oceanwp' ),
'300' => esc_html__( 'Book: 300', 'oceanwp' ),
'400' => esc_html__( 'Normal: 400', 'oceanwp' ),
'500' => esc_html__( 'Medium: 500', 'oceanwp' ),
'600' => esc_html__( 'Semibold: 600', 'oceanwp' ),
'700' => esc_html__( 'Bold: 700', 'oceanwp' ),
'800' => esc_html__( 'Extra Bold: 800', 'oceanwp' ),
'900' => esc_html__( 'Black: 900', 'oceanwp' ),
),
) );
}
/**
* Font Style
*/
if ( in_array( 'font-style', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-style]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[font-style]', array(
'label' => esc_html__( 'Font Style', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-style]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'normal' => esc_html__( 'Normal', 'oceanwp' ),
'italic' => esc_html__( 'Italic', 'oceanwp' ),
),
) );
}
/**
* Text Transform
*/
if ( in_array( 'text-transform', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[text-transform]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[text-transform]', array(
'label' => esc_html__( 'Text Transform', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[text-transform]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'capitalize' => esc_html__( 'Capitalize', 'oceanwp' ),
'lowercase' => esc_html__( 'Lowercase', 'oceanwp' ),
'uppercase' => esc_html__( 'Uppercase', 'oceanwp' ),
'none' => esc_html__( 'None', 'oceanwp' ),
),
) );
}
/**
* Font Size
*/
if ( in_array( 'font-size', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['font-size'] ) ? $array['defaults']['font-size'] : NULL;
$wp_customize->add_setting( $element .'_typography[font-size]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_text_field',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[font-size]', array(
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_setting( $element .'_mobile_typography[font-size]', array(
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new OceanWP_Customizer_Text_Control( $wp_customize, $element .'_typography[font-size]', array(
'label' => esc_html__( 'Font Size', 'oceanwp' ),
'description' => esc_html__( 'You can add: px-em-%', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[font-size]',
'tablet' => $element .'_tablet_typography[font-size]',
'mobile' => $element .'_mobile_typography[font-size]',
),
'priority' => 10,
'active_callback' => $active_callback,
) ) );
}
/**
* Line Height
*/
if ( in_array( 'line-height', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['line-height'] ) ? $array['defaults']['line-height'] : NULL;
$wp_customize->add_setting( $element .'_typography[line-height]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_number',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[line-height]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( $element .'_mobile_typography[line-height]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, $element .'_typography[line-height]', array(
'label' => esc_html__( 'Line Height', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[line-height]',
'tablet' => $element .'_tablet_typography[line-height]',
'mobile' => $element .'_mobile_typography[line-height]',
),
'priority' => 10,
'active_callback' => $active_callback,
'input_attrs' => array(
'min' => 0,
'max' => 4,
'step' => 0.1,
),
) ) );
}
/**
* Letter Spacing
*/
if ( in_array( 'letter-spacing', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['letter-spacing'] ) ? $array['defaults']['letter-spacing'] : NULL;
$wp_customize->add_setting( $element .'_typography[letter-spacing]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_number',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[letter-spacing]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( $element .'_mobile_typography[letter-spacing]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, $element .'_typography[letter-spacing]', array(
'label' => esc_html__( 'Letter Spacing (px)', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[letter-spacing]',
'tablet' => $element .'_tablet_typography[letter-spacing]',
'mobile' => $element .'_mobile_typography[letter-spacing]',
),
'priority' => 10,
'active_callback' => $active_callback,
'input_attrs' => array(
'min' => 0,
'max' => 10,
'step' => 0.1,
),
) ) );
}
/**
* Font Color
*/
if ( in_array( 'font-color', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['color'] ) ? $array['defaults']['color'] : NULL;
$wp_customize->add_setting( $element .'_typography[color]', array(
'type' => 'theme_mod',
'default' => '',
'sanitize_callback' => 'oceanwp_sanitize_color',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, $element .'_typography[color]', array(
'label' => esc_html__( 'Font Color', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[color]',
'priority' => 10,
'active_callback' => $active_callback,
) ) );
}
}
}
}
/**
* Loads js file for customizer preview
*
* @since 1.0.0
*/
public function customize_preview_init() {
wp_enqueue_script( 'oceanwp-typography-customize-preview', OCEANWP_INC_DIR_URI . 'customizer/assets/js/typography-customize-preview.min.js', array( 'customize-preview' ), OCEANWP_THEME_VERSION, true );
wp_localize_script( 'oceanwp-typography-customize-preview', 'oceanwp', array(
'googleFontsUrl' => '//fonts.googleapis.com',
'googleFontsWeight' => '100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i',
) );
if ( OCEANWP_WOOCOMMERCE_ACTIVE ) {
wp_enqueue_script( 'oceanwp-woo-typography-customize-preview', OCEANWP_INC_DIR_URI . 'customizer/assets/js/woo-typography-customize-preview.min.js', array( 'customize-preview' ), OCEANWP_THEME_VERSION, true );
wp_localize_script( 'oceanwp-woo-typography-customize-preview', 'oceanwp', array(
'googleFontsUrl' => '//fonts.googleapis.com',
'googleFontsWeight' => '100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i',
) );
}
}
/**
* Loop through settings
*
* @since 1.0.0
*/
public function loop( $return = 'css' ) {
// Define Vars
$css = '';
$fonts = array();
$elements = self::elements();
$preview_styles = array();
// Loop through each elements that need typography styling applied to them
foreach( $elements as $element => $array ) {
// Add empty css var
$add_css = '';
$tablet_css = '';
$mobile_css = '';
// Get target and current mod
$target = isset( $array['target'] ) ? $array['target'] : '';
$get_mod = get_theme_mod( $element .'_typography' );
$tablet_get_mod = get_theme_mod( $element .'_tablet_typography' );
$mobile_get_mod = get_theme_mod( $element .'_mobile_typography' );
// Attributes to loop through
if ( ! empty( $array['attributes'] ) ) {
$attributes = $array['attributes'];
} else {
$attributes = array(
'font-family',
'font-weight',
'font-style',
'font-size',
'color',
'line-height',
'letter-spacing',
'text-transform',
);
}
// Loop through attributes
foreach ( $attributes as $attribute ) {
// Define val
$default = isset( $array['defaults'][$attribute] ) ? $array['defaults'][$attribute] : NULL;
$val = isset( $get_mod[$attribute] ) ? $get_mod[$attribute] : $default;
$tablet_val = isset( $tablet_get_mod[$attribute] ) ? $tablet_get_mod[$attribute] : '';
$mobile_val = isset( $mobile_get_mod[$attribute] ) ? $mobile_get_mod[$attribute] : '';
// If there is a value lets do something
if ( $val && $default != $val ) {
// Sanitize
$val = str_replace( '"', '', $val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add quotes around font-family && font family to scripts array
if ( 'font-family' == $attribute ) {
$fonts[] = $val;
// No brackets can be added as it cause issue with sans serif fonts
$val = $val;
}
// Add to inline CSS
if ( 'css' == $return ) {
$add_css .= $attribute .':'. $val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-'. $attribute] = $target .'{'. $attribute .':'. $val . $px .';}';
}
}
// If there is a value lets do something
if ( $tablet_val
&& ( 'font-size' == $attribute
|| 'line-height' == $attribute
|| 'letter-spacing' == $attribute ) ) {
// Sanitize
$tablet_val = str_replace( '"', '', $tablet_val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $tablet_val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add to inline CSS
if ( 'css' == $return ) {
$tablet_css .= $attribute .':'. $tablet_val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-tablet-'. $attribute] = '@media (max-width: 768px){'. $target .'{'. $attribute .':'. $tablet_val . $px .';}}';
}
}
// If there is a value lets do something
if ( $mobile_val
&& ( 'font-size' == $attribute
|| 'line-height' == $attribute
|| 'letter-spacing' == $attribute ) ) {
// Sanitize
$mobile_val = str_replace( '"', '', $mobile_val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $mobile_val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add to inline CSS
if ( 'css' == $return ) {
$mobile_css .= $attribute .':'. $mobile_val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-mobile-'. $attribute] = '@media (max-width: 480px){'. $target .'{'. $attribute .':'. $mobile_val . $px .';}}';
}
}
}
// Front-end inline CSS
if ( $add_css && 'css' == $return ) {
$css .= $target .'{'. $add_css .'}';
}
// Front-end inline tablet CSS
if ( $tablet_css && 'css' == $return ) {
$css .= '@media (max-width: 768px){'. $target .'{'. $tablet_css .'}}';
}
// Front-end inline mobile CSS
if ( $mobile_css && 'css' == $return ) {
$css .= '@media (max-width: 480px){'. $target .'{'. $mobile_css .'}}';
}
}
// Return CSS
if ( 'css' == $return && ! empty( $css ) ) {
$css = '/* Typography CSS */'. $css;
return $css;
}
// Return styles
if ( 'preview_styles' == $return && ! empty( $preview_styles ) ) {
return $preview_styles;
}
// Return Fonts Array
if ( 'fonts' == $return && ! empty( $fonts ) ) {
return array_unique( $fonts );
}
}
/**
* Get CSS
*
* @since 1.0.0
*/
public function head_css( $output ) {
// Get CSS
$typography_css = self::loop( 'css' );
// Loop css
if ( $typography_css ) {
$output .= $typography_css;
}
// Return output css
return $output;
}
/**
* Returns correct CSS to output to wp_head
*
* @since 1.0.0
*/
public function live_preview_styles() {
$live_preview_styles = self::loop( 'preview_styles' );
if ( $live_preview_styles ) {
foreach ( $live_preview_styles as $key => $val ) {
if ( ! empty( $val ) ) {
echo '';
}
}
}
}
/**
* Loads Google fonts
*
* @since 1.0.0
*/
public function load_fonts() {
// Get fonts
$fonts = self::loop( 'fonts' );
// Loop through and enqueue fonts
if ( ! empty( $fonts ) && is_array( $fonts ) ) {
foreach ( $fonts as $font ) {
oceanwp_enqueue_google_font( $font );
}
}
}
}
endif;
return new OceanWP_Typography_Customizer();/**
* Top Bar Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Top_Bar_Customizer' ) ) :
class OceanWP_Top_Bar_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Panel
*/
$panel = 'ocean_topbar_panel';
$wp_customize->add_panel( $panel , array(
'title' => esc_html__( 'Top Bar', 'oceanwp' ),
'priority' => 210,
) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_general' , array(
'title' => esc_html__( 'General', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar
*/
$wp_customize->add_setting( 'ocean_top_bar', array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar', array(
'label' => esc_html__( 'Enable Top Bar', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar',
'priority' => 10,
) ) );
/**
* Top Bar Full Width
*/
$wp_customize->add_setting( 'ocean_top_bar_full_width', array(
'transport' => 'postMessage',
'default' => false,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_full_width', array(
'label' => esc_html__( 'Top Bar Full Width', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_full_width',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Visibility
*/
$wp_customize->add_setting( 'ocean_top_bar_visibility', array(
'transport' => 'postMessage',
'default' => 'all-devices',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_visibility', array(
'label' => esc_html__( 'Visibility', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_visibility',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => array(
'all-devices' => esc_html__( 'Show On All Devices', 'oceanwp' ),
'hide-tablet' => esc_html__( 'Hide On Tablet', 'oceanwp' ),
'hide-mobile' => esc_html__( 'Hide On Mobile', 'oceanwp' ),
'hide-tablet-mobile' => esc_html__( 'Hide On Tablet & Mobile', 'oceanwp' ),
),
) ) );
/**
* Top Bar Style
*/
$wp_customize->add_setting( 'ocean_top_bar_style', array(
'default' => 'one',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_style', array(
'label' => esc_html__( 'Style', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_style',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => array(
'one' => esc_html__( 'Left Content & Right Social', 'oceanwp' ),
'two' => esc_html__( 'Left Social & Right Content', 'oceanwp' ),
'three' => esc_html__( 'Centered Content & Social', 'oceanwp' ),
),
) ) );
/**
* Top Bar Padding
*/
$wp_customize->add_setting( 'ocean_top_bar_top_padding', array(
'transport' => 'postMessage',
'default' => '8',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_right_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_bottom_padding', array(
'transport' => 'postMessage',
'default' => '8',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_left_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_top_bar_padding', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => array(
'desktop_top' => 'ocean_top_bar_top_padding',
'desktop_right' => 'ocean_top_bar_right_padding',
'desktop_bottom' => 'ocean_top_bar_bottom_padding',
'desktop_left' => 'ocean_top_bar_left_padding',
'tablet_top' => 'ocean_top_bar_tablet_top_padding',
'tablet_right' => 'ocean_top_bar_tablet_right_padding',
'tablet_bottom' => 'ocean_top_bar_tablet_bottom_padding',
'tablet_left' => 'ocean_top_bar_tablet_left_padding',
'mobile_top' => 'ocean_top_bar_mobile_top_padding',
'mobile_right' => 'ocean_top_bar_mobile_right_padding',
'mobile_bottom' => 'ocean_top_bar_mobile_bottom_padding',
'mobile_left' => 'ocean_top_bar_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
/**
* Top Bar Background Color
*/
$wp_customize->add_setting( 'ocean_top_bar_bg', array(
'transport' => 'postMessage',
'default' => '#ffffff',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_bg', array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_bg',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Border Color
*/
$wp_customize->add_setting( 'ocean_top_bar_border_color', array(
'transport' => 'postMessage',
'default' => '#f1f1f1',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_border_color', array(
'label' => esc_html__( 'Border Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_border_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Text Color
*/
$wp_customize->add_setting( 'ocean_top_bar_text_color', array(
'transport' => 'postMessage',
'default' => '#929292',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_text_color', array(
'label' => esc_html__( 'Text Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_text_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Link Color
*/
$wp_customize->add_setting( 'ocean_top_bar_link_color', array(
'transport' => 'postMessage',
'default' => '#555555',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_link_color', array(
'label' => esc_html__( 'Link Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_link_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Link Color Hover
*/
$wp_customize->add_setting( 'ocean_top_bar_link_color_hover', array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_link_color_hover', array(
'label' => esc_html__( 'Link Color: Hover', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_link_color_hover',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_content' , array(
'title' => esc_html__( 'Content', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar Template
*/
$wp_customize->add_setting( 'ocean_top_bar_template', array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_template', array(
'label' => esc_html__( 'Select Template', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library to replace the content.', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_content',
'settings' => 'ocean_top_bar_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => oceanwp_customizer_helpers( 'library' ),
) ) );
/**
* Top Bar Content
*/
$wp_customize->add_setting( 'ocean_top_bar_content', array(
'transport' => 'postMessage',
'default' => esc_html__( 'Place your content here', 'oceanwp' ),
'sanitize_callback' => 'wp_kses_post',
) );
$wp_customize->add_control( new OceanWP_Customizer_Textarea_Control( $wp_customize, 'ocean_top_bar_content', array(
'label' => esc_html__( 'Content', 'oceanwp' ),
'description' => sprintf( esc_html__( 'Shortcodes allowed, %1$ssee the list%2$s.', 'oceanwp' ), '', ' ' ),
'section' => 'ocean_topbar_content',
'settings' => 'ocean_top_bar_content',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_social' , array(
'title' => esc_html__( 'Social', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar Social
*/
$wp_customize->add_setting( 'ocean_top_bar_social', array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social', array(
'label' => esc_html__( 'Enable Social', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Social Alternative
*/
$wp_customize->add_setting( 'ocean_top_bar_social_alt_template', array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_alt_template', array(
'label' => esc_html__( 'Social Alternative', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_alt_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'choices' => oceanwp_customizer_helpers( 'library' ),
) ) );
/**
* Top Bar Social Link Target
*/
$wp_customize->add_setting( 'ocean_top_bar_social_target', array(
'transport' => 'postMessage',
'default' => 'blank',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_target', array(
'label' => esc_html__( 'Social Link Target', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_target',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'choices' => array(
'blank' => esc_html__( 'New Window', 'oceanwp' ),
'self' => esc_html__( 'Same Window', 'oceanwp' ),
),
) ) );
/**
* Top Bar Social Font Size
*/
$wp_customize->add_setting( 'ocean_top_bar_social_font_size', array(
'transport' => 'postMessage',
'default' => '14',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_font_size', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_font_size', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, 'ocean_top_bar_social_font_size', array(
'label' => esc_html__( 'Font Size (px)', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => array(
'desktop' => 'ocean_top_bar_social_font_size',
'tablet' => 'ocean_top_bar_social_tablet_font_size',
'mobile' => 'ocean_top_bar_social_mobile_font_size',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
/**
* Top Bar Social Padding
*/
$wp_customize->add_setting( 'ocean_top_bar_social_right_padding', array(
'transport' => 'postMessage',
'default' => '6',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_left_padding', array(
'transport' => 'postMessage',
'default' => '6',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_top_bar_social_padding', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => array(
'desktop_right' => 'ocean_top_bar_social_right_padding',
'desktop_left' => 'ocean_top_bar_social_left_padding',
'tablet_right' => 'ocean_top_bar_social_tablet_right_padding',
'tablet_left' => 'ocean_top_bar_social_tablet_left_padding',
'mobile_right' => 'ocean_top_bar_social_mobile_right_padding',
'mobile_left' => 'ocean_top_bar_social_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'input_attrs' => array(
'min' => 0,
'max' => 60,
'step' => 1,
),
) ) );
/**
* Top Bar Social Link Color
*/
$wp_customize->add_setting( 'ocean_top_bar_social_links_color', array(
'transport' => 'postMessage',
'default' => '#bbbbbb',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_social_links_color', array(
'label' => esc_html__( 'Social Links Color', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_links_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
/**
* Top Bar Social Link Color Hover
*/
$wp_customize->add_setting( 'ocean_top_bar_social_hover_links_color', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_social_hover_links_color', array(
'label' => esc_html__( 'Social Links Color: Hover', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_hover_links_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
/**
* Top Bar Social Settings
*/
$social_options = oceanwp_social_options();
foreach ( $social_options as $key => $val ) {
if ( 'skype' == $key ) {
$sanitize = 'wp_filter_nohtml_kses';
} else if ( 'email' == $key ) {
$sanitize = 'sanitize_email';
} else {
$sanitize = 'esc_url_raw';
}
$wp_customize->add_setting( 'ocean_top_bar_social_profiles[' . $key .']', array(
'sanitize_callback' => $sanitize,
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_profiles[' . $key .']', array(
'label' => esc_html( $val['label'] ),
'type' => 'text',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_profiles[' . $key .']',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
}
}
/**
* Get CSS
*
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars
$top_padding = get_theme_mod( 'ocean_top_bar_top_padding', '8' );
$right_padding = get_theme_mod( 'ocean_top_bar_right_padding', '0' );
$bottom_padding = get_theme_mod( 'ocean_top_bar_bottom_padding', '8' );
$left_padding = get_theme_mod( 'ocean_top_bar_left_padding', '0' );
$tablet_top_padding = get_theme_mod( 'ocean_top_bar_tablet_top_padding' );
$tablet_right_padding = get_theme_mod( 'ocean_top_bar_tablet_right_padding' );
$tablet_bottom_padding = get_theme_mod( 'ocean_top_bar_tablet_bottom_padding' );
$tablet_left_padding = get_theme_mod( 'ocean_top_bar_tablet_left_padding' );
$mobile_top_padding = get_theme_mod( 'ocean_top_bar_mobile_top_padding' );
$mobile_right_padding = get_theme_mod( 'ocean_top_bar_mobile_right_padding' );
$mobile_bottom_padding = get_theme_mod( 'ocean_top_bar_mobile_bottom_padding' );
$mobile_left_padding = get_theme_mod( 'ocean_top_bar_mobile_left_padding' );
$background = get_theme_mod( 'ocean_top_bar_bg', '#ffffff' );
$border_color = get_theme_mod( 'ocean_top_bar_border_color', '#f1f1f1' );
$text_color = get_theme_mod( 'ocean_top_bar_text_color', '#929292' );
$link_color = get_theme_mod( 'ocean_top_bar_link_color', '#555555' );
$link_color_hover = get_theme_mod( 'ocean_top_bar_link_color_hover', '#13aff0' );
$social_font_size = get_theme_mod( 'ocean_top_bar_social_font_size' );
$social_tablet_font_size = get_theme_mod( 'ocean_top_bar_social_tablet_font_size' );
$social_mobile_font_size = get_theme_mod( 'ocean_top_bar_social_mobile_font_size' );
$social_right_padding = get_theme_mod( 'ocean_top_bar_social_right_padding' );
$social_left_padding = get_theme_mod( 'ocean_top_bar_social_left_padding' );
$social_tablet_right_padding = get_theme_mod( 'ocean_top_bar_social_tablet_right_padding' );
$social_tablet_left_padding = get_theme_mod( 'ocean_top_bar_social_tablet_left_padding' );
$social_mobile_right_padding = get_theme_mod( 'ocean_top_bar_social_mobile_right_padding' );
$social_mobile_left_padding = get_theme_mod( 'ocean_top_bar_social_mobile_left_padding' );
$social_links_color = get_theme_mod( 'ocean_top_bar_social_links_color', '#bbbbbb' );
$social_hover_links_color = get_theme_mod( 'ocean_top_bar_social_hover_links_color' );
// Define css var
$css = '';
// Top bar padding
if ( isset( $top_padding ) && '8' != $top_padding && '' != $top_padding
|| isset( $right_padding ) && '0' != $right_padding && '' != $right_padding
|| isset( $bottom_padding ) && '8' != $bottom_padding && '' != $bottom_padding
|| isset( $left_padding ) && '0' != $left_padding && '' != $left_padding ) {
$css .= '#top-bar{padding:'. oceanwp_spacing_css( $top_padding, $right_padding, $bottom_padding, $left_padding ) .'}';
}
// Tablet top bar padding
if ( isset( $tablet_top_padding ) && '' != $tablet_top_padding
|| isset( $tablet_right_padding ) && '' != $tablet_right_padding
|| isset( $tablet_bottom_padding ) && '' != $tablet_bottom_padding
|| isset( $tablet_left_padding ) && '' != $tablet_left_padding ) {
$css .= '@media (max-width: 768px){#top-bar{padding:'. oceanwp_spacing_css( $tablet_top_padding, $tablet_right_padding, $tablet_bottom_padding, $tablet_left_padding ) .'}}';
}
// Mobile top bar padding
if ( isset( $mobile_top_padding ) && '' != $mobile_top_padding
|| isset( $mobile_right_padding ) && '' != $mobile_right_padding
|| isset( $mobile_bottom_padding ) && '' != $mobile_bottom_padding
|| isset( $mobile_left_padding ) && '' != $mobile_left_padding ) {
$css .= '@media (max-width: 480px){#top-bar{padding:'. oceanwp_spacing_css( $mobile_top_padding, $mobile_right_padding, $mobile_bottom_padding, $mobile_left_padding ) .'}}';
}
// Top bar background color
if ( ! empty( $background ) && '#ffffff' != $background ) {
$css .= '#top-bar-wrap,.oceanwp-top-bar-sticky{background-color:'. $background .';}';
}
// Top bar border color
if ( ! empty( $border_color ) && '#f1f1f1' != $border_color ) {
$css .= '#top-bar-wrap{border-color:'. $border_color .';}';
}
// Top bar text color
if ( ! empty( $text_color ) && '#929292' != $text_color ) {
$css .= '#top-bar-wrap,#top-bar-content strong{color:'. $text_color .';}';
}
// Top bar link color
if ( ! empty( $link_color ) && '#555555' != $link_color ) {
$css .= '#top-bar-content a,#top-bar-social-alt a{color:'. $link_color .';}';
}
// Top bar link color hover
if ( ! empty( $link_color_hover ) && '#13aff0' != $link_color_hover ) {
$css .= '#top-bar-content a:hover,#top-bar-social-alt a:hover{color:'. $link_color_hover .';}';
}
// Add top bar social font size
if ( ! empty( $social_font_size ) && '14' != $social_font_size ) {
$css .= '#top-bar-social li a{font-size:'. $social_font_size .'px;}';
}
// Add top bar social tablet font size
if ( ! empty( $social_tablet_font_size ) ) {
$css .= '@media (max-width: 768px){#top-bar-social li a{font-size:'. $social_tablet_font_size .'px;}}';
}
// Add top bar social mobile font size
if ( ! empty( $social_mobile_font_size ) ) {
$css .= '@media (max-width: 480px){#top-bar-social li a{font-size:'. $social_mobile_font_size .'px;}}';
}
// Top bar padding
if ( isset( $social_right_padding ) && '6' != $social_right_padding && '' != $social_right_padding
|| isset( $social_left_padding ) && '6' != $social_left_padding && '' != $social_left_padding ) {
$css .= '#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_right_padding, '', $social_left_padding ) .'}';
}
// Tablet top bar padding
if ( isset( $social_tablet_right_padding ) && '' != $social_tablet_right_padding
|| isset( $social_tablet_left_padding ) && '' != $social_tablet_left_padding ) {
$css .= '@media (max-width: 768px){#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_tablet_right_padding, '', $social_tablet_left_padding ) .'}}';
}
// Mobile top bar padding
if ( isset( $social_mobile_right_padding ) && '' != $social_mobile_right_padding
|| isset( $social_mobile_left_padding ) && '' != $social_mobile_left_padding ) {
$css .= '@media (max-width: 480px){#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_mobile_right_padding, '', $social_mobile_left_padding ) .'}}';
}
// Top bar social link color
if ( ! empty( $social_links_color ) && '#bbbbbb' != $social_links_color ) {
$css .= '#top-bar-social li a{color:'. $social_links_color .';}';
}
// Top bar social link color hover
if ( ! empty( $social_hover_links_color ) ) {
$css .= '#top-bar-social li a:hover{color:'. $social_hover_links_color .'!important;}';
}
// Return CSS
if ( ! empty( $css ) ) {
$output .= '/* Top Bar CSS */'. $css;
}
// Return output css
return $output;
}
}
endif;
return new OceanWP_Top_Bar_Customizer();/**
* Footer Widgets Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Footer_Widgets_Customizer' ) ) :
/**
* Settings for footer widgets
*/
class OceanWP_Footer_Widgets_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @param WP_Customize_Manager $wp_customize Reference to WP_Customize_Manager.
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Section
*/
$section = 'ocean_footer_widgets_section';
$wp_customize->add_section(
$section,
array(
'title' => esc_html__( 'Footer Widgets', 'oceanwp' ),
'priority' => 210,
)
);
/**
* Enable Footer Widgets
*/
$wp_customize->add_setting(
'ocean_footer_widgets',
array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets',
array(
'label' => esc_html__( 'Enable Footer Widgets', 'oceanwp' ),
'type' => 'checkbox',
'section' => $section,
'settings' => 'ocean_footer_widgets',
'priority' => 10,
)
)
);
/**
* Footer Widgets Visibility
*/
$wp_customize->add_setting(
'ocean_footer_widgets_visibility',
array(
'transport' => 'postMessage',
'default' => 'all-devices',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets_visibility',
array(
'label' => esc_html__( 'Visibility', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_footer_widgets_visibility',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'choices' => array(
'all-devices' => esc_html__( 'Show On All Devices', 'oceanwp' ),
'hide-tablet' => esc_html__( 'Hide On Tablet', 'oceanwp' ),
'hide-mobile' => esc_html__( 'Hide On Mobile', 'oceanwp' ),
'hide-tablet-mobile' => esc_html__( 'Hide On Tablet & Mobile', 'oceanwp' ),
),
)
)
);
/**
* Fixed Footer
*/
$wp_customize->add_setting(
'ocean_fixed_footer',
array(
'default' => 'off',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Buttonset_Control(
$wp_customize,
'ocean_fixed_footer',
array(
'label' => esc_html__( 'Fixed Footer', 'oceanwp' ),
'description' => esc_html__( 'This option add a height to your content to keep your footer at the bottom of your page.', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_fixed_footer',
'priority' => 10,
'choices' => array(
'on' => esc_html__( 'On', 'oceanwp' ),
'off' => esc_html__( 'Off', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Parallax Footer Effect
*/
$wp_customize->add_setting(
'ocean_parallax_footer',
array(
'default' => 'off',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Buttonset_Control(
$wp_customize,
'ocean_parallax_footer',
array(
'label' => esc_html__( 'Parallax Footer Effect', 'oceanwp' ),
'description' => esc_html__( 'Add a parallax effect to your footer.', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_parallax_footer',
'priority' => 10,
'choices' => array(
'on' => esc_html__( 'On', 'oceanwp' ),
'off' => esc_html__( 'Off', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Template
*/
$wp_customize->add_setting(
'ocean_footer_widgets_template',
array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets_template',
array(
'label' => esc_html__( 'Select Template', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_footer_widgets_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'choices' => oceanwp_customizer_helpers( 'library' ),
)
)
);
/**
* Footer Widgets Columns
*/
$wp_customize->add_setting(
'ocean_footer_widgets_columns',
array(
'default' => '4',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_widgets_tablet_columns',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_widgets_mobile_columns',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Slider_Control(
$wp_customize,
'ocean_footer_widgets_columns',
array(
'label' => esc_html__( 'Columns', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop' => 'ocean_footer_widgets_columns',
'tablet' => 'ocean_footer_widgets_tablet_columns',
'mobile' => 'ocean_footer_widgets_mobile_columns',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets_and_no_page_id',
'input_attrs' => array(
'min' => 1,
'max' => 4,
'step' => 1,
),
)
)
);
/**
* Sidebar widget Title Heading Tag
*/
$wp_customize->add_setting(
'ocean_footer_widget_heading_tag',
array(
'default' => 'h4',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widget_heading_tag',
array(
'label' => esc_html__( 'Heading Tag', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_footer_widget_heading_tag',
'priority' => 10,
'choices' => array(
'h1' => esc_html__( 'H1', 'oceanwp' ),
'h2' => esc_html__( 'H2', 'oceanwp' ),
'h3' => esc_html__( 'H3', 'oceanwp' ),
'h4' => esc_html__( 'H4', 'oceanwp' ),
'h5' => esc_html__( 'H5', 'oceanwp' ),
'h6' => esc_html__( 'H6', 'oceanwp' ),
'div' => esc_html__( 'div', 'oceanwp' ),
'span' => esc_html__( 'span', 'oceanwp' ),
'p' => esc_html__( 'p', 'oceanwp' ),
),
)
)
);
/**
* Footer Widgets Add Container
*/
$wp_customize->add_setting(
'ocean_add_footer_container',
array(
'transport' => 'postMessage',
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_add_footer_container',
array(
'label' => esc_html__( 'Add Container', 'oceanwp' ),
'type' => 'checkbox',
'section' => $section,
'settings' => 'ocean_add_footer_container',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Padding
*/
$wp_customize->add_setting(
'ocean_footer_top_padding',
array(
'transport' => 'postMessage',
'default' => '30',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_right_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_bottom_padding',
array(
'transport' => 'postMessage',
'default' => '30',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_left_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Dimensions_Control(
$wp_customize,
'ocean_footer_padding_dimensions',
array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop_top' => 'ocean_footer_top_padding',
'desktop_right' => 'ocean_footer_right_padding',
'desktop_bottom' => 'ocean_footer_bottom_padding',
'desktop_left' => 'ocean_footer_left_padding',
'tablet_top' => 'ocean_footer_tablet_top_padding',
'tablet_right' => 'ocean_footer_tablet_right_padding',
'tablet_bottom' => 'ocean_footer_tablet_bottom_padding',
'tablet_left' => 'ocean_footer_tablet_left_padding',
'mobile_top' => 'ocean_footer_mobile_top_padding',
'mobile_right' => 'ocean_footer_mobile_right_padding',
'mobile_bottom' => 'ocean_footer_mobile_bottom_padding',
'mobile_left' => 'ocean_footer_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'input_attrs' => array(
'min' => 0,
'max' => 500,
'step' => 1,
),
)
)
);
/**
* Footer Widgets Background
*/
$wp_customize->add_setting(
'ocean_footer_background',
array(
'transport' => 'postMessage',
'default' => '#222222',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_background',
array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_background',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Color
*/
$wp_customize->add_setting(
'ocean_footer_color',
array(
'transport' => 'postMessage',
'default' => '#929292',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_color',
array(
'label' => esc_html__( 'Text Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Borders Color
*/
$wp_customize->add_setting(
'ocean_footer_borders',
array(
'transport' => 'postMessage',
'default' => '#555555',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_borders',
array(
'label' => esc_html__( 'Borders Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_borders',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Links Color
*/
$wp_customize->add_setting(
'ocean_footer_link_color',
array(
'transport' => 'postMessage',
'default' => '#ffffff',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_link_color',
array(
'label' => esc_html__( 'Links Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_link_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Links Hover Color
*/
$wp_customize->add_setting(
'ocean_footer_link_color_hover',
array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_link_color_hover',
array(
'label' => esc_html__( 'Links Color: Hover', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_link_color_hover',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
}
/**
* Get CSS
*
* @param obj $output css output.
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars.
$footer_top_padding = get_theme_mod( 'ocean_footer_top_padding', '30' );
$footer_right_padding = get_theme_mod( 'ocean_footer_right_padding', '0' );
$footer_bottom_padding = get_theme_mod( 'ocean_footer_bottom_padding', '30' );
$footer_left_padding = get_theme_mod( 'ocean_footer_left_padding', '0' );
$tablet_footer_top_padding = get_theme_mod( 'ocean_footer_tablet_top_padding' );
$tablet_footer_right_padding = get_theme_mod( 'ocean_footer_tablet_right_padding' );
$tablet_footer_bottom_padding = get_theme_mod( 'ocean_footer_tablet_bottom_padding' );
$tablet_footer_left_padding = get_theme_mod( 'ocean_footer_tablet_left_padding' );
$mobile_footer_top_padding = get_theme_mod( 'ocean_footer_mobile_top_padding' );
$mobile_footer_right_padding = get_theme_mod( 'ocean_footer_mobile_right_padding' );
$mobile_footer_bottom_padding = get_theme_mod( 'ocean_footer_mobile_bottom_padding' );
$mobile_footer_left_padding = get_theme_mod( 'ocean_footer_mobile_left_padding' );
$footer_background = get_theme_mod( 'ocean_footer_background', '#222222' );
$footer_color = get_theme_mod( 'ocean_footer_color', '#929292' );
$footer_borders = get_theme_mod( 'ocean_footer_borders', '#555555' );
$footer_link_color = get_theme_mod( 'ocean_footer_link_color', '#ffffff' );
$footer_link_color_hover = get_theme_mod( 'ocean_footer_link_color_hover', '#13aff0' );
// Define css var.
$css = '';
// Footer padding.
if ( isset( $footer_top_padding ) && '30' != $footer_top_padding && '' != $footer_top_padding
|| isset( $footer_right_padding ) && '0' != $footer_right_padding && '' != $footer_right_padding
|| isset( $footer_bottom_padding ) && '30' != $footer_bottom_padding && '' != $footer_bottom_padding
|| isset( $footer_left_padding ) && '0' != $footer_left_padding && '' != $footer_left_padding ) {
$css .= '#footer-widgets{padding:' . oceanwp_spacing_css( $footer_top_padding, $footer_right_padding, $footer_bottom_padding, $footer_left_padding ) . '}';
}
// Tablet footer padding.
if ( isset( $tablet_footer_top_padding ) && '' != $tablet_footer_top_padding
|| isset( $tablet_footer_right_padding ) && '' != $tablet_footer_right_padding
|| isset( $tablet_footer_bottom_padding ) && '' != $tablet_footer_bottom_padding
|| isset( $tablet_footer_left_padding ) && '' != $tablet_footer_left_padding ) {
$css .= '@media (max-width: 768px){#footer-widgets{padding:' . oceanwp_spacing_css( $tablet_footer_top_padding, $tablet_footer_right_padding, $tablet_footer_bottom_padding, $tablet_footer_left_padding ) . '}}';
}
// Mobile footer padding.
if ( isset( $mobile_footer_top_padding ) && '' != $mobile_footer_top_padding
|| isset( $mobile_footer_right_padding ) && '' != $mobile_footer_right_padding
|| isset( $mobile_footer_bottom_padding ) && '' != $mobile_footer_bottom_padding
|| isset( $mobile_footer_left_padding ) && '' != $mobile_footer_left_padding ) {
$css .= '@media (max-width: 480px){#footer-widgets{padding:' . oceanwp_spacing_css( $mobile_footer_top_padding, $mobile_footer_right_padding, $mobile_footer_bottom_padding, $mobile_footer_left_padding ) . '}}';
}
// Footer background.
if ( ! empty( $footer_background ) && '#222222' != $footer_background ) {
$css .= '#footer-widgets{background-color:' . $footer_background . ';}';
}
// Footer color.
if ( ! empty( $footer_color ) && '#929292' != $footer_color ) {
$css .= '#footer-widgets,#footer-widgets p,#footer-widgets li a:before,#footer-widgets .contact-info-widget span.oceanwp-contact-title,#footer-widgets .recent-posts-date,#footer-widgets .recent-posts-comments,#footer-widgets .widget-recent-posts-icons li .fa{color:' . $footer_color . ';}';
}
// Footer borders color.
if ( ! empty( $footer_borders ) && '#555555' != $footer_borders ) {
$css .= '#footer-widgets li,#footer-widgets #wp-calendar caption,#footer-widgets #wp-calendar th,#footer-widgets #wp-calendar tbody,#footer-widgets .contact-info-widget i,#footer-widgets .oceanwp-newsletter-form-wrap input[type="email"],#footer-widgets .posts-thumbnails-widget li,#footer-widgets .social-widget li a{border-color:' . $footer_borders . ';}';
}
// Footer link color.
if ( ! empty( $footer_link_color ) && '#ffffff' != $footer_link_color ) {
$css .= '#footer-widgets .footer-box a,#footer-widgets a{color:' . $footer_link_color . ';}';
}
// Footer link hover color.
if ( ! empty( $footer_link_color_hover ) && '#13aff0' != $footer_link_color_hover ) {
$css .= '#footer-widgets .footer-box a:hover,#footer-widgets a:hover{color:' . $footer_link_color_hover . ';}';
}
// Return CSS.
if ( ! empty( $css ) ) {
$output .= '/* Footer Widgets CSS */' . $css;
}
// Return output css.
return $output;
}
}
endif;
return new OceanWP_Footer_Widgets_Customizer();
/**
* PA Elements.
*/
use PremiumAddons\Includes\Helper_Functions;
$prefix = Helper_Functions::get_prefix();
$elements = array(
'cat-1' => array(
'icon' => 'all',
'title' => __( 'All Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-lottie-widget',
'title' => __( 'Lottie Animations', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-lottie-animations-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/lottie-animations-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=0QWzUpF57dw',
),
array(
'key' => 'premium-carousel',
'title' => __( 'Carousel', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/carousel-widget-for-elementor-page-builder', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/carousel/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=ZMgprLKvq24',
),
array(
'key' => 'premium-blog',
'title' => __( 'Blog', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/blog-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/blog/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-maps',
'title' => __( 'Google Maps', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/google-maps-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/google-maps/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=z4taEeCY77Q',
),
array(
'key' => 'premium-person',
'title' => __( 'Team Members', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/persons-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/persons-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-tabs',
'title' => __( 'Tabs', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-tabs-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/tabs-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-content-toggle',
'title' => __( 'Content Switcher', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/content-switcher-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-content-switcher/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-fancytext',
'title' => __( 'Fancy Text', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/fancy-text-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/fancy-text-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-title',
'title' => __( 'Heading', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/heading-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/heading-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-dual-header',
'title' => __( 'Dual Heading', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/dual-header-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/dual-heading-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-divider',
'title' => __( 'Divider', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/divider-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/divider-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-grid',
'title' => __( 'Media Grid', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/grid-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/grid/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-scroll',
'title' => __( 'Image Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-image-scroll-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-separator',
'title' => __( 'Image Separator', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-separator-widget-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-separator-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-comparison',
'title' => __( 'Image Comparison', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-comparison-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-image-comparison-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-image-hotspots',
'title' => __( 'Image Hotspots', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-hotspots-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-hotspots-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-img-layers',
'title' => __( 'Image Layers', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-layers-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/image-layers/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=D3INxWw_jKI',
'is_pro' => true,
),
array(
'key' => 'premium-image-accordion',
'title' => __( 'Image Accordion', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-image-accordion-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-accordion-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-videobox',
'title' => __( 'Video Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/video-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/video-box/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-hscroll',
'title' => __( 'Horizontal Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-horizontal-scroll-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/horizontal-scroll/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=4HqT_3s-ZXg',
'is_pro' => true,
),
array(
'key' => 'premium-vscroll',
'title' => __( 'Vertical Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/vertical-scroll-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/vertical-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=MuLaIn1QXfQ',
),
array(
'key' => 'premium-color-transition',
'title' => __( 'Background Transition', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-background-transition-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/background-transition-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-multi-scroll',
'title' => __( 'Multi Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/multi-scroll-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/multi-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=IzYnD6oDYXw',
'is_pro' => true,
),
array(
'key' => 'premium-lottie',
'title' => __( 'Lottie Animations', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-lottie-animations-section-addon/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/lottie-background/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=KVrenWNEdkY',
'is_pro' => true,
),
array(
'key' => 'premium-parallax',
'title' => __( 'Parallax', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/parallax-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/parallax-section-addon-tutorial-2/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=hkMNjxLoZ2w',
'is_pro' => true,
),
array(
'key' => 'premium-particles',
'title' => __( 'Particles', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/particles-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/particles/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=bPmWKv4VWrI',
'is_pro' => true,
),
array(
'key' => 'premium-gradient',
'title' => __( 'Animated Gradient', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/animated-section-gradients-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/animated-gradient-section-addon-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=IL4USvwR6K4',
'is_pro' => true,
),
array(
'key' => 'premium-kenburns',
'title' => __( 'Animated Ken Burns', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/ken-burns-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/ken-burns-section-addon-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=DUNFjWphZfs',
'is_pro' => true,
),
array(
'key' => 'premium-modalbox',
'title' => __( 'Modal Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/modal-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/modal-box/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=3lLxSyf2nyk',
),
array(
'key' => 'premium-notbar',
'title' => __( 'Alert Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/alert-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/alert-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-magic-section',
'title' => __( 'Magic Section', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/magic-section-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/magic-section-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-prev-img',
'title' => __( 'Preview Window', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/preview-window-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/preview-window-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=EmptjFjrc4E',
'is_pro' => true,
),
array(
'key' => 'premium-testimonials',
'title' => __( 'Testimonials', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/testimonials-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/testimonials-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-facebook-reviews',
'title' => __( 'Facebook Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/facebook-reviews-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/facebook-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=zl-OFo3IFd8',
'is_pro' => true,
),
array(
'key' => 'premium-google-reviews',
'title' => __( 'Google Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/google-reviews-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/google-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=Z0EeGyD34Zk',
'is_pro' => true,
),
array(
'key' => 'premium-yelp-reviews',
'title' => __( 'Yelp Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-yelp-reviews-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/yelp-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=5T-MveVFvns',
'is_pro' => true,
),
array(
'key' => 'premium-countdown',
'title' => __( 'Countdown', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/countdown-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/countdown-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-banner',
'title' => __( 'Banner', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/banner-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-banner-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-button',
'title' => __( 'Button', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/button-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/button/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=w4NuCUkCIV4',
),
array(
'key' => 'premium-image-button',
'title' => __( 'Image Button', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-button-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/image-button/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-flipbox',
'title' => __( 'Hover Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/flip-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/flip-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-iconbox',
'title' => __( 'Icon Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/icon-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/icon-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-ihover',
'title' => __( 'iHover', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/ihover-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-ihover-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-unfold',
'title' => __( 'Unfold', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/unfold-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-unfold-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-icon-list',
'title' => __( 'Bullet List', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-bullet-list-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/bullet-list-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-facebook-feed',
'title' => __( 'Facebook Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-facebook-feed-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/facebook-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-twitter-feed',
'title' => __( 'Twitter Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/twitter-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/twitter-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=wsurRDuR6pg',
'is_pro' => true,
),
array(
'key' => 'premium-instagram-feed',
'title' => __( 'Instagram Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/instagram-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/instagram-feed/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-behance',
'title' => __( 'Behance Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/behance-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/behance-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=AXATK3oIXl0',
'is_pro' => true,
),
array(
'key' => 'premium-progressbar',
'title' => __( 'Progress Bar', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/progress-bar-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-progress-bar-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=Y7xqwhgDQJg',
),
array(
'key' => 'premium-pricing-table',
'title' => __( 'Pricing Table', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pricing-table-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/pricing-table-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-charts',
'title' => __( 'Charts', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/charts-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/charts-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=lZZvslQ2UYU',
'is_pro' => true,
),
array(
'key' => 'premium-tables',
'title' => __( 'Table', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/table-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/table-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-counter',
'title' => __( 'Counter', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/counter-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/counter-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-contactform',
'title' => __( 'Contact Form 7', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/contact-form-7-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/contact-form-7-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-fb-chat',
'title' => __( 'Facebook Messenger Chat', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/facebook-messenger-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/facebook-messenger/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-whatsapp-chat',
'title' => __( 'Whatsapp Chat', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/whatsapp-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/whatsapp-chat-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
),
),
'cat-2' => array(
'icon' => 'content',
'title' => __( 'Content Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-carousel',
'title' => __( 'Carousel', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/carousel-widget-for-elementor-page-builder', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/carousel/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=ZMgprLKvq24',
),
array(
'key' => 'premium-blog',
'title' => __( 'Blog', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/blog-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/blog/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-maps',
'title' => __( 'Google Maps', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/google-maps-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/google-maps/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=z4taEeCY77Q',
),
array(
'key' => 'premium-person',
'title' => __( 'Team Members', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/persons-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/persons-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-tabs',
'title' => __( 'Tabs', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-tabs-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/tabs-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-content-toggle',
'title' => __( 'Content Switcher', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/content-switcher-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-content-switcher/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-fancytext',
'title' => __( 'Fancy Text', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/fancy-text-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/fancy-text-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-title',
'title' => __( 'Heading', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/heading-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/heading-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-dual-header',
'title' => __( 'Dual Heading', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/dual-header-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/dual-heading-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-divider',
'title' => __( 'Divider', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/divider-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/divider-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
),
),
'cat-3' => array(
'icon' => 'images',
'title' => __( 'Image & Video Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-grid',
'title' => __( 'Media Grid', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/grid-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/grid-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-scroll',
'title' => __( 'Image Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-image-scroll-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-separator',
'title' => __( 'Image Separator', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-separator-widget-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-separator-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-image-comparison',
'title' => __( 'Image Comparison', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-comparison-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-image-comparison-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-image-hotspots',
'title' => __( 'Image Hotspots', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-hotspots-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-hotspots-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-img-layers',
'title' => __( 'Image Layers', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-layers-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/image-layers/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=D3INxWw_jKI',
'is_pro' => true,
),
array(
'key' => 'premium-image-accordion',
'title' => __( 'Image Accordion', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-image-accordion-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/image-accordion-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-videobox',
'title' => __( 'Video Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/video-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/video-box/', 'settings-page', 'wp-dash', 'dashboard' ),
),
),
),
'cat-4' => array(
'icon' => 'section',
'title' => __( 'Section Addons & Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-hscroll',
'title' => __( 'Horizontal Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-horizontal-scroll-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/horizontal-scroll/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=4HqT_3s-ZXg',
'is_pro' => true,
),
array(
'key' => 'premium-vscroll',
'title' => __( 'Vertical Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/vertical-scroll-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/vertical-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=MuLaIn1QXfQ',
),
array(
'key' => 'premium-color-transition',
'title' => __( 'Background Transition', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-background-transition-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/background-transition-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-multi-scroll',
'title' => __( 'Multi Scroll', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/multi-scroll-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/multi-scroll-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=IzYnD6oDYXw',
'is_pro' => true,
),
array(
'key' => 'premium-lottie',
'title' => __( 'Lottie Animations', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-lottie-animations-section-addon/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/lottie-background/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=KVrenWNEdkY',
'is_pro' => true,
),
array(
'key' => 'premium-parallax',
'title' => __( 'Parallax', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/parallax-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/parallax-section-addon-tutorial-2/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=hkMNjxLoZ2w',
'is_pro' => true,
),
array(
'key' => 'premium-particles',
'title' => __( 'Particles', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/particles-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/particles/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=bPmWKv4VWrI',
'is_pro' => true,
),
array(
'key' => 'premium-gradient',
'title' => __( 'Animated Gradient', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/animated-section-gradients-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/animated-gradient-section-addon-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=IL4USvwR6K4',
'is_pro' => true,
),
array(
'key' => 'premium-kenburns',
'title' => __( 'Animated Ken Burns', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/ken-burns-section-addon-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/ken-burns-section-addon-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=DUNFjWphZfs',
'is_pro' => true,
),
),
),
'cat-5' => array(
'icon' => 'off-grid',
'title' => __( 'Off-Grid Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-modalbox',
'title' => __( 'Modal Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/modal-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/modal-box/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=3lLxSyf2nyk',
),
array(
'key' => 'premium-notbar',
'title' => __( 'Alert Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/alert-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/alert-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-magic-section',
'title' => __( 'Magic Section', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/magic-section-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/magic-section-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-prev-img',
'title' => __( 'Preview Window', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/preview-window-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/preview-window-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=EmptjFjrc4E',
'is_pro' => true,
),
),
),
'cat-6' => array(
'icon' => 'social',
'title' => __( 'Reviews & Testimonials Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-testimonials',
'title' => __( 'Testimonials', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/testimonials-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/testimonials-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-facebook-reviews',
'title' => __( 'Facebook Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/facebook-reviews-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/facebook-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=zl-OFo3IFd8',
'is_pro' => true,
),
array(
'key' => 'premium-google-reviews',
'title' => __( 'Google Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/google-reviews-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/google-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=Z0EeGyD34Zk',
'is_pro' => true,
),
array(
'key' => 'premium-yelp-reviews',
'title' => __( 'Yelp Reviews', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-yelp-reviews-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/yelp-reviews/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=5T-MveVFvns',
'is_pro' => true,
),
// array(
// 'key' => 'premium-trustpilot-reviews',
// 'title' => __( 'Trustpilot Reviews', 'premium-addons-for-elementor' ) ,
// 'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/', 'settings-page', 'wp-dash', 'dashboard' ),
// 'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/', 'settings-page', 'wp-dash', 'dashboard' ),
// 'tutorial' => '',
// 'is_pro' => true,
// ),
),
),
'cat-7' => array(
'icon' => 'blurbs',
'title' => __( 'Blurbs & CTA Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-countdown',
'title' => __( 'Countdown', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/countdown-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/countdown-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-banner',
'title' => __( 'Banner', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/banner-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-banner-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-button',
'title' => __( 'Button', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/button-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/button/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=w4NuCUkCIV4',
),
array(
'key' => 'premium-image-button',
'title' => __( 'Image Button', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/image-button-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/image-button/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-flipbox',
'title' => __( 'Hover Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/flip-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/flip-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-iconbox',
'title' => __( 'Icon Box', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/icon-box-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/icon-box-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-ihover',
'title' => __( 'iHover', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/ihover-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-ihover-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-unfold',
'title' => __( 'Unfold', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/unfold-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-unfold-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-icon-list',
'title' => __( 'Bullet List', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-bullet-list-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/bullet-list-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
),
),
'cat-8' => array(
'icon' => 'feed',
'title' => __( 'Social Feed Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-facebook-feed',
'title' => __( 'Facebook Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-facebook-feed-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/facebook-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-twitter-feed',
'title' => __( 'Twitter Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/twitter-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/twitter-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=wsurRDuR6pg',
'is_pro' => true,
),
array(
'key' => 'premium-instagram-feed',
'title' => __( 'Instagram Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/instagram-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/instagram-feed/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-behance',
'title' => __( 'Behance Feed', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/behance-feed-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/behance-feed-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=AXATK3oIXl0',
'is_pro' => true,
),
),
),
'cat-9' => array(
'icon' => 'data',
'title' => __( 'Tables, Charts & Anything Data Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-progressbar',
'title' => __( 'Progress Bar', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/progress-bar-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/premium-progress-bar-widget/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=Y7xqwhgDQJg',
),
array(
'key' => 'premium-pricing-table',
'title' => __( 'Pricing Table', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/pricing-table-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/pricing-table-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-charts',
'title' => __( 'Charts', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/charts-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/charts-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'tutorial' => 'https://www.youtube.com/watch?v=lZZvslQ2UYU',
'is_pro' => true,
),
array(
'key' => 'premium-tables',
'title' => __( 'Table', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/table-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/table-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-counter',
'title' => __( 'Counter', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/counter-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/counter-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
),
),
'cat-10' => array(
'icon' => 'contact',
'title' => __( 'Contact Widgets', 'premium-addons-for-elementor' ),
'elements' => array(
array(
'key' => 'premium-contactform',
'title' => __( 'Contact Form 7', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/contact-form-7-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/contact-form-7-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
),
array(
'key' => 'premium-fb-chat',
'title' => __( 'Facebook Messenger Chat', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/facebook-messenger-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs-category/using-widgets/facebook-messenger/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
array(
'key' => 'premium-whatsapp-chat',
'title' => __( 'Whatsapp Chat', 'premium-addons-for-elementor' ),
'demo' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/whatsapp-widget-for-elementor-page-builder/', 'settings-page', 'wp-dash', 'dashboard' ),
'doc' => Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/whatsapp-chat-widget-tutorial/', 'settings-page', 'wp-dash', 'dashboard' ),
'is_pro' => true,
),
),
),
'cat-11' => array(
'icon' => 'extensions',
'elements' => array(
array(
'key' => 'premium-templates',
),
array(
'key' => 'premium-cross-domain',
),
array(
'key' => 'premium-equal-height',
),
array(
'key' => 'premium-duplicator',
),
),
),
);
return $elements;
/*!
* Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
*/
@font-face {
font-family: 'Font Awesome 5 Free';
font-style: normal;
font-weight: 400;
font-display: block;
src: url("../webfonts/fa-regular-400.eot");
src: url("../webfonts/fa-regular-400.eot?#iefix") format("embedded-opentype"), url("../webfonts/fa-regular-400.woff2") format("woff2"), url("../webfonts/fa-regular-400.woff") format("woff"), url("../webfonts/fa-regular-400.ttf") format("truetype"), url("../webfonts/fa-regular-400.svg#fontawesome") format("svg"); }
.far {
font-family: 'Font Awesome 5 Free';
font-weight: 400; }
namespace ElementsKit_Lite\Modules\ElementsKit_Icon_Pack;
defined( 'ABSPATH' ) || exit;
class Init{
public static function get_url(){
return \ElementsKit_Lite::module_url() . 'elementskit-icon-pack/';
}
public static function get_dir(){
return \ElementsKit_Lite::module_dir() . 'elementskit-icon-pack/';
}
public function __construct() {
add_action( 'wp_enqueue_scripts', [$this, 'enqueue_frontend'] );
add_filter( 'elementor/icons_manager/additional_tabs', [ $this, 'register_icon_pack_to_elementor']);
}
public function enqueue_frontend(){
wp_enqueue_style( 'elementor-icons-ekiticons', self::get_url() . 'assets/css/ekiticons.css', \ElementsKit_Lite::version() );
}
public function register_icon_pack_to_elementor( $font){
$font_new['ekiticons'] = [
'name' => 'ekiticons',
'label' => esc_html__( 'ElementsKit Icon Pack', 'elementskit-lite' ),
'url' => self::get_url() . 'assets/css/ekiticons.css',
'prefix' => 'icon-',
'displayPrefix' => 'icon',
'labelIcon' => 'icon icon-ekit',
'ver' => \ElementsKit_Lite::version(),
'fetchJson' => self::get_url() . 'assets/js/ekiticons.json',
'native' => true,
];
return array_merge($font, $font_new);
}
}
namespace ElementsKit_Lite\Modules\HeaderFooterBuilder;
defined( 'ABSPATH' ) || exit;
class Cpt{
public function __construct() {
$this->post_type();
add_action('admin_menu', [$this, 'cpt_menu']);
add_filter( 'single_template', [ $this, 'load_canvas_template' ] );
}
public function post_type() {
$labels = array(
'name' => esc_html__( 'Templates', 'elementskit-lite' ),
'singular_name' => esc_html__( 'Template', 'elementskit-lite' ),
'menu_name' => esc_html__( 'Header Footer', 'elementskit-lite' ),
'name_admin_bar' => esc_html__( 'Header Footer', 'elementskit-lite' ),
'add_new' => esc_html__( 'Add New', 'elementskit-lite' ),
'add_new_item' => esc_html__( 'Add New Template', 'elementskit-lite' ),
'new_item' => esc_html__( 'New Template', 'elementskit-lite' ),
'edit_item' => esc_html__( 'Edit Template', 'elementskit-lite' ),
'view_item' => esc_html__( 'View Template', 'elementskit-lite' ),
'all_items' => esc_html__( 'All Templates', 'elementskit-lite' ),
'search_items' => esc_html__( 'Search Templates', 'elementskit-lite' ),
'parent_item_colon' => esc_html__( 'Parent Templates:', 'elementskit-lite' ),
'not_found' => esc_html__( 'No Templates found.', 'elementskit-lite' ),
'not_found_in_trash' => esc_html__( 'No Templates found in Trash.', 'elementskit-lite' ),
);
$args = array(
'labels' => $labels,
'public' => true,
'rewrite' => false,
'show_ui' => true,
'show_in_menu' => false,
'show_in_nav_menus' => false,
'exclude_from_search' => true,
'capability_type' => 'page',
'hierarchical' => false,
'supports' => array( 'title', 'thumbnail', 'elementor' ),
);
register_post_type( 'elementskit_template', $args );
}
public function cpt_menu(){
$link_our_new_cpt = 'edit.php?post_type=elementskit_template';
add_submenu_page('elementskit', esc_html__('Header Footer', 'elementskit-lite'), esc_html__('Header Footer', 'elementskit-lite'), 'manage_options', $link_our_new_cpt);
}
function load_canvas_template( $single_template ) {
global $post;
if ( 'elementskit_template' == $post->post_type ) {
$elementor_2_0_canvas = ELEMENTOR_PATH . '/modules/page-templates/templates/canvas.php';
if ( file_exists( $elementor_2_0_canvas ) ) {
return $elementor_2_0_canvas;
} else {
return ELEMENTOR_PATH . '/includes/page-templates/canvas.php';
}
}
return $single_template;
}
}
new Cpt();(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[59],{114:function(t,e,c){"use strict";c.d(e,"a",(function(){return o})),c(103);var n=c(44);const o=()=>n.m>1},136:function(t,e,c){"use strict";c.d(e,"c",(function(){return i})),c.d(e,"d",(function(){return l})),c.d(e,"b",(function(){return u})),c.d(e,"a",(function(){return d}));var n=c(70),o=c(114),r=c(52),s=c(61);const a=t=>Object(r.a)(t)?JSON.parse(t)||{}:Object(s.a)(t)?t:{},i=t=>{if(!Object(o.a)()||"function"!=typeof n.__experimentalGetSpacingClassesAndStyles)return{style:{}};const e=Object(s.a)(t)?t:{},c=a(e.style);return Object(n.__experimentalGetSpacingClassesAndStyles)({...e,style:c})},l=t=>{const e=Object(s.a)(t)?t:{},c=a(e.style),n=Object(s.a)(c.typography)?c.typography:{};return{style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:e.fontFamily}}},u=t=>{if(!Object(o.a)())return{className:"",style:{}};const e=Object(s.a)(t)?t:{},c=a(e.style);return Object(n.__experimentalUseColorProps)({...e,style:c})},d=t=>{if(!Object(o.a)())return{className:"",style:{}};const e=Object(s.a)(t)?t:{},c=a(e.style);return Object(n.__experimentalUseBorderProps)({...e,style:c})}},348:function(t,e){},349:function(t,e,c){"use strict";c.d(e,"a",(function(){return l}));var n=c(0),o=c(7),r=c(5),s=c(18),a=c(31);const i=(t,e)=>{const c=t.find(t=>{let{id:c}=t;return c===e});return c?c.quantity:0},l=t=>{const{addItemToCart:e}=Object(o.useDispatch)(r.CART_STORE_KEY),{cartItems:c,cartIsLoading:l}=Object(a.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(n.useState)(!1),y=Object(n.useRef)(i(c,t));return Object(n.useEffect)(()=>{const e=i(c,t);e!==y.current&&(y.current=e)},[c,t]),{cartQuantity:Number.isFinite(y.current)?y.current:0,addingToCart:b,cartIsLoading:l,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),e(t,c).then(()=>{d("add-to-cart")}).catch(t=>{u(Object(s.decodeEntities)(t.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},401:function(t,e,c){"use strict";c.r(e);var n=c(11),o=c.n(n),r=c(0),s=c(4),a=c.n(s),i=c(1),l=c(40),u=c(349),d=c(18),b=c(44),p=c(2),y=c(43),f=c(120),O=(c(348),c(136));const j=t=>{let{product:e,colorStyles:c,borderStyles:n,typographyStyles:s,spacingStyles:y}=t;const{id:f,permalink:O,add_to_cart:j,has_options:m,is_purchasable:_,is_in_stock:g}=e,{dispatchStoreEvent:S}=Object(l.a)(),{cartQuantity:h,addingToCart:w,addToCart:k}=Object(u.a)(f,"woocommerce/single-product/"+(f||0)),N=Number.isFinite(h)&&h>0,C=!m&&_&&g,E=Object(d.decodeEntities)((null==j?void 0:j.description)||""),v=N?Object(i.sprintf)(
/* translators: %s number of products in cart. */
Object(i._n)("%d in cart","%d in cart",h,"woocommerce"),h):Object(d.decodeEntities)((null==j?void 0:j.text)||Object(i.__)("Add to cart","woocommerce")),x=C?"button":"a",T={};return C?T.onClick=()=>{k(),S("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=Object(p.getSetting)("productsSettings");t&&(window.location.href=b.c)}:(T.href=O,T.rel="nofollow",T.onClick=()=>{S("product-view-link",{product:e})}),Object(r.createElement)(x,o()({"aria-label":E,className:a()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,n.className,{loading:w,added:N}),style:{...c.style,...n.style,...s.style,...y.style},disabled:w},T),v)},m=t=>{let{colorStyles:e,borderStyles:c,typographyStyles:n,spacingStyles:o}=t;return Object(r.createElement)("button",{className:a()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",e.className,c.className),style:{...e.style,...c.style,...n.style,...o.style},disabled:!0})};e.default=Object(f.withProductDataContext)(t=>{const{className:e}=t,{parentClassName:c}=Object(y.useInnerBlockLayoutContext)(),{product:n}=Object(y.useProductDataContext)(),o=Object(O.b)(t),s=Object(O.a)(t),i=Object(O.d)(t),l=Object(O.c)(t);return Object(r.createElement)("div",{className:a()(e,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},n.id?Object(r.createElement)(j,{product:n,colorStyles:o,borderStyles:s,typographyStyles:i,spacingStyles:l}):Object(r.createElement)(m,{colorStyles:o,borderStyles:s,typographyStyles:i,spacingStyles:l}))})},61:function(t,e,c){"use strict";c.d(e,"a",(function(){return n})),c.d(e,"b",(function(){return o}));const n=t=>!(t=>null===t)(t)&&t instanceof Object&&t.constructor===Object;function o(t,e){return n(t)&&e in t}}}]);namespace ElementsKit_Lite\Modules\Widget_Builder;
use ElementsKit_Lite\Modules\Widget_Builder\Controls\Widget_Writer;
defined( 'ABSPATH' ) || exit;
class Init{
private $dir;
private $url;
public function __construct(){
// get current directory path
$this->dir = dirname(__FILE__) . '/';
// get current module's url
$this->url = \ElementsKit_Lite::plugin_url() . 'modules/widget-builder/';
// include all necessary files
$this->include_files();
//hooks
add_action('admin_enqueue_scripts', [$this, 'load_scripts']);
add_action('add_meta_boxes', [$this, 'register_meta_boxes']);
// add_action('elementor/init', [$this, 'elementor_widget_category']);
add_action( 'elementor/widgets/widgets_registered', [$this, 'register_widgets']);
add_action( 'elementor/editor/before_enqueue_scripts', [$this, 'editor_css']);
add_action( 'elementor/frontend/after_enqueue_styles', [$this, 'frontend_css']);
add_action('admin_init', [$this, 'on_empty_trash_delete_files']);
//add_action('wp_trash_post', [$this, 'on_trash_delete_files']);
// calling necessary classess
new Api\Common();
new Cpt();
new Live_Action();
}
public function include_files(){
// include $this->dir . 'extend-controls.php';
}
public function register_widgets($widgets_manager){
$widgets = get_posts([
'post_type' => 'elementskit_widget',
'post_status' => 'publish',
'numberposts' => -1
]);
$upload = wp_upload_dir();
foreach($widgets as $widget){
$slug = 'ekit_wb_' . $widget->ID;
$dir = $upload['basedir'] . '/elementskit/custom_widgets/' . $slug . '/';
$file = $dir . 'widget.php';
$class_name = '\Elementor\Ekit_Wb_' . $widget->ID;
if(file_exists($file)){
include $file;
$widgets_manager->register_widget_type(new $class_name());
}
}
}
public function elementor_widget_category($widgets_manager){
\Elementor\Plugin::$instance->elements_manager->add_category(
'elementskit-lite',
[
'title' =>esc_html__( 'ElementsKit Custom', 'elementskit-lite' ),
'icon' => 'fa fa-plug',
],
1
);
}
public function frontend_css() {
if ( !is_singular('elementskit_widget') ) {
return;
}
wp_enqueue_style( 'elementskit-widget-builder-common-css', $this->url . 'assets/css/ekit-widget-builder-common.css', [], \ElementsKit_Lite::version() );
}
public function editor_css() {
$screen = get_current_screen();
if($screen->id != 'elementskit_widget'){
return;
}
wp_enqueue_style( 'elementskit-widget-builder-common-css', $this->url . 'assets/css/ekit-widget-builder-common.css', [], \ElementsKit_Lite::version() );
}
public function load_scripts(){
$screen = get_current_screen();
if($screen->id != 'elementskit_widget'){
return;
}
wp_enqueue_style( 'google-fonts-roboto', 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700', [], null );
wp_enqueue_style( 'font-awesome', ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css', [], null );
wp_enqueue_style( 'elementskit-widget-builder-editor-css', $this->url . 'assets/css/ekit-widget-builder-editor.css', [], \ElementsKit_Lite::version() );
wp_enqueue_style( 'elementskit-widget-builder-common-css', $this->url . 'assets/css/ekit-widget-builder-common.css', [], \ElementsKit_Lite::version() );
wp_enqueue_script( 'elementskit-widget-builder-editor-js', $this->url . 'assets/js/ekit-widget-builder-editor.js', [], \ElementsKit_Lite::version(), true );
}
public function register_meta_boxes() {
add_meta_box( 'elementskit-widget-builder-markup', __( 'Builder', 'elementskit-lite' ), [$this, 'metabox_display_callback'], 'elementskit_widget' );
}
public function metabox_display_callback( $post ) {
include $this->dir . 'views/builder.php';
}
public function on_empty_trash_delete_files() {
if(isset($_GET['action']) && $_GET['action'] == 'delete') {
$post_id = intval($_GET['post']);
$post_type = get_post_type( $post_id );
if($post_type == 'elementskit_widget') {
Widget_Writer::delete_widget($post_id);
}
} elseif(
isset($_GET['post_type']) && $_GET['post_type'] == 'elementskit_widget' &&
isset($_GET['action']) && $_GET['action'] == -1 &&
isset($_GET['post_status']) && $_GET['post_status'] == 'trash') {
}
}
}
/**
* OceanWP Post Metabox
*
* @package Ocean_Extra
* @category Core
* @author OceanWP
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// The Metabox class
if ( ! class_exists( 'OceanWP_Post_Settings' ) ) {
/**
* Main Post Settings class.
*
* @since 2.2.0
* @access public
*/
final class OceanWP_Post_Settings {
/**
* Namespace.
*
* @var string
*/
protected $namespace = 'oceanwp/v';
/**
* Version.
*
* @var string
*/
protected $version = '1';
/**
* Ocean_Extra The single instance of Ocean_Extra.
*
* @var object
* @access private
*/
private static $_instance = null;
/**
* Main OceanWP_Post_Settings Instance
*
* @static
* @see OceanWP_Post_Settings()
* @return Main OceanWP_Post_Settings instance
*/
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Constructor
*/
public function __construct() {
$this->includes();
$capabilities = apply_filters('ocean_main_metaboxes_capabilities', 'manage_options');
add_action( 'init', array( $this, 'register_meta_settings' ), 15 );
if ( current_user_can($capabilities) ) {
add_action( 'enqueue_block_editor_assets', array( $this, 'editor_enqueue_script' ), 21 );
add_filter('update_post_metadata', array( $this, 'handle_updating_post_meta' ), 20, 5);
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
add_filter('register_post_type_args', array( $this, 'post_args' ), 10, 2 );
}
add_action( 'current_screen', array( $this, 'butterbean_loader' ), 20 );
}
/**
* Load required files
*/
public function includes() {
require_once OE_PATH . 'includes/post-settings/defaults.php';
require_once OE_PATH . 'includes/post-settings/functions.php';
require_once OE_PATH . 'includes/post-settings/sanitize.php';
}
/**
* Register Post Meta options.
*
* @return void
*/
public function register_meta_settings() {
$settings = ocean_post_setting_data();
foreach ( $settings as $key => $value ) {
$sanitize_callback = isset($value['sanitize']) ? $value['sanitize'] : null;
$args = array(
'object_subtype' => $value['subType'],
'single' => $value['single'],
'type' => $value['type'],
'default' => $value['value'],
'show_in_rest' => $value['rest'],
'sanitize_callback' => $sanitize_callback,
'auth_callback' => '__return_true',
);
// Register meta.
register_meta( 'post', $key, $args );
}
}
/**
* Modify post type arguments to add 'custom-fields' support for specific post types.
*
* This function hooks into the 'register_post_type_args' filter to check if the current
* post type is in the list of post types that should receive 'custom-fields' support. If
* the support is not already present, it's added to the post type's arguments.
*
* @param array $args The original post type arguments.
* @param string $post_type The slug of the current post type.
*
* @return array Modified post type arguments.
*/
public function post_args( $args, $post_type ) {
// Array of post types to check for 'custom-fields' support.
$post_types_to_check = oe_metabox_support_post_types();
if ( ! is_array( $post_types_to_check ) ) {
$post_types_to_check = [];
}
// Check if the current post type is in the list to check.
if ( in_array( $post_type, $post_types_to_check ) ) {
// Check if 'custom-fields' support already exists.
if ( ! isset( $args['supports'] ) || ! in_array( 'custom-fields', $args['supports'] ) ) {
$args['supports'][] = 'custom-fields';
}
}
return $args;
}
/**
* Filter callback to fix the WP REST API meta error when sending updated encoded JSON with no change.
*
* @param mixed $value The new value of the user metadata to be updated.
* @param int $object_id The ID of the user object whose metadata is being updated.
* @param mixed $meta_value The new meta value to be stored.
* @param mixed $prev_value The previous meta value before the update.
* @param string $meta_key Optional. The meta key for which the value is being updated. Defaults to false.
*
* @return mixed The filtered value. If the function returns true, it prevents the update from occurring.
*/
public function handle_updating_post_meta( $value, $object_id, $meta_key, $meta_value, $prev_value ) {
$meta_type = 'post';
$serialized_meta_keys = get_all_meta_key();
// Check if it's a REST API request and the meta key is in the serialized meta keys array.
if ( defined( 'REST_REQUEST' ) && REST_REQUEST && in_array( $meta_key, $serialized_meta_keys ) ) {
// Get the meta cache for the user.
$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
// If meta cache doesn't exist, update the meta cache for the user.
if ( ! $meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
$meta_cache = $meta_cache[$object_id];
}
// Check if the meta key exists in the meta cache.
if ( isset( $meta_cache[$meta_key] ) ) {
// If the new meta value is the same as the one in the meta cache, return true to prevent update.
if ( $meta_value === $meta_cache[$meta_key][0] ) {
return true;
}
}
}
// If not a REST API request or the meta key is not in the serialized meta keys array, proceed with the update.
return $value;
}
/**
* Enqueque Editor Scripts
*/
public function editor_enqueue_script() {
if ( false === oe_check_post_types_settings() ) {
return;
}
if ( is_customize_preview() ) {
return;
}
if ( get_current_screen()->base === 'widgets' ) {
return;
}
$uri = OE_URL . 'includes/post-settings/assets/';
$asset = require OE_PATH . 'includes/post-settings/assets/index.asset.php';
$deps = $asset['dependencies'];
array_push( $deps, 'updates' );
wp_register_script(
'owp-post-settings',
$uri . 'index.js',
$deps,
filemtime( OE_PATH . 'includes/post-settings/assets/index.js' ),
true
);
wp_enqueue_style(
'owp-post-settings',
$uri . 'style-index.css',
array(),
filemtime( OE_PATH . 'includes/post-settings/assets/style-index.css' )
);
wp_enqueue_script( 'owp-post-settings' );
if ( function_exists( 'wp_set_script_translations' ) ) {
wp_set_script_translations( 'owp-post-settings', 'ocean-extra' );
}
$editor_loc_data = $this->localize_editor_script();
if ( is_array( $editor_loc_data ) ) {
wp_localize_script(
'owp-post-settings',
'owpPostSettings',
$editor_loc_data
);
}
}
/**
* Localize Script.
*
* @return mixed|void
*/
public function localize_editor_script() {
return apply_filters(
'ocean_post_settings_localize',
array(
'choices' => oe_get_choices(),
'postTypes' => oe_metabox_support_post_types(),
'isPremium' => ocean_check_pro_license()
)
);
}
/**
* Remove Butterbean metabox when block editor.
*/
public function butterbean_loader() {
if ( false === oe_is_block_editor() ) {
add_action( 'current_screen', 'butterbean_loader_100', 9999 );
require_once OE_PATH . '/includes/metabox/gallery-metabox/gallery-metabox.php';
}
}
/**
* Register rest routes.
*/
public function register_routes() {
register_rest_route(
$this->namespace . $this->version,
'/option-reset-current/(?P\d+)',
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'current_reset_options_callback' ),
'permission_callback' => array( $this, 'settings_permission' ),
)
);
}
/**
* Ocean Migration metabox for current page/post only.
*
* @param WP_REST_Request $request Request object.
*
* @return mixed
*/
public function current_reset_options_callback( WP_REST_Request $request ) {
$newMetaData = ocean_post_setting_data();
$post_id = $request->get_param('post_id');
if ( $post_id > 0 ) {
$post = get_post( $post_id );
if ( $post && in_array( $post->post_type, get_post_types() ) ) {
$oldMetaData = get_post_custom( $post_id );
foreach ( $newMetaData as $key => $value ) {
if ( isset( $oldMetaData[ $key ][0] ) && $oldMetaData[ $key ][0] !== $value['value'] ) {
update_post_meta( $post_id, $key, $value['value'] );
}
}
return $this->success( ' ' );
}
}
}
/**
* Get edit options permissions.
*
* @return bool
*/
public function settings_permission() {
return current_user_can( 'manage_options' );
}
/**
* Success
*
* @param mixed $response response data.
* @return mixed
*/
public function success( $response ) {
return new WP_REST_Response(
array(
'success' => true,
'response' => $response,
),
200
);
}
}
}
/**
* Returns the main instance of OceanWP_Post_Settings to prevent the need to use globals.
*
* @return object OceanWP_Post_Settings
*/
function OceanWP_Post_Settings() {
if ( ! defined( 'OCEAN_METABOX_LOADER' ) ) {
define( 'OCEAN_METABOX_LOADER', true );
return OceanWP_Post_Settings::instance();
}
}
OceanWP_Post_Settings();
/**
* Title : Aqua Resizer
* Description : Resizes WordPress images on the fly
* Version : 1.2.1
* Author : Syamil MJ
* Author URI : http://aquagraphite.com
* License : WTFPL - http://sam.zoy.org/wtfpl/
* Documentation : https://github.com/sy4mil/Aqua-Resizer/
*
* @param string $url - (required) must be uploaded using wp media uploader
* @param int $width - (required)
* @param int $height - (optional)
* @param bool $crop - (optional) default to soft crop
* @param bool $single - (optional) returns an array if false
* @param bool $upscale - (optional) resizes smaller images
* @uses wp_upload_dir()
* @uses image_resize_dimensions()
* @uses wp_get_image_editor()
*
* @return str|array
*/
if ( ! class_exists( 'Ocean_Extra_Resize' ) ) {
class Ocean_Extra_Exception extends Exception {}
class Ocean_Extra_Resize {
/**
* The singleton instance
*/
static private $instance = null;
/**
* Should an Ocean_Extra_Exception be thrown on error?
* If false (default), then the error will just be logged.
*/
public $throwOnError = false;
/**
* No initialization allowed
*/
private function __construct() {}
/**
* No cloning allowed
*/
private function __clone() {}
/**
* For your custom default usage you may want to initialize an Ocean_Extra_Resize object by yourself and then have own defaults
*/
static public function getInstance() {
if ( self::$instance == null ) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Run, forest.
*/
public function process( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
try {
// Validate inputs.
if ( ! $url )
throw new Ocean_Extra_Exception('$url parameter is required');
if ( ! $width )
throw new Ocean_Extra_Exception('$width parameter is required');
if ( ! $height )
throw new Ocean_Extra_Exception('$height parameter is required');
// Caipt'n, ready to hook.
if ( true === $upscale ) add_filter( 'image_resize_dimensions', array($this, 'aq_upscale'), 10, 6 );
// Define upload path & dir.
$upload_info = wp_upload_dir();
$upload_dir = $upload_info['basedir'];
$upload_url = $upload_info['baseurl'];
$http_prefix = "http://";
$https_prefix = "https://";
$relative_prefix = "//"; // The protocol-relative URL
/* if the $url scheme differs from $upload_url scheme, make them match
if the schemes differe, images don't show up. */
if ( ! strncmp( $url, $https_prefix, strlen( $https_prefix ) ) ) { //if url begins with https:// make $upload_url begin with https:// as well
$upload_url = str_replace( $http_prefix, $https_prefix, $upload_url );
}
elseif ( ! strncmp( $url, $http_prefix, strlen( $http_prefix ) ) ) { //if url begins with http:// make $upload_url begin with http:// as well
$upload_url = str_replace( $https_prefix, $http_prefix, $upload_url );
}
elseif ( ! strncmp( $url, $relative_prefix, strlen( $relative_prefix ) ) ){ //if url begins with // make $upload_url begin with // as well
$upload_url = str_replace( array( 0 => "$http_prefix", 1 => "$https_prefix" ), $relative_prefix, $upload_url );
}
// Check if $img_url is local.
if ( false === strpos( $url, $upload_url ) )
throw new Ocean_Extra_Exception( 'Image must be local: ' . $url );
// Define path of image.
$rel_path = str_replace( $upload_url, '', $url );
$img_path = $upload_dir . $rel_path;
// Check if img path exists, and is an image indeed.
if ( ! file_exists( $img_path ) or ! getimagesize( $img_path ) )
throw new Ocean_Extra_Exception( 'Image file does not exist (or is not an image): ' . $img_path );
// Get image info.
$info = pathinfo( $img_path );
$ext = $info['extension'];
list( $orig_w, $orig_h ) = getimagesize( $img_path );
// Get image size after cropping.
$dims = image_resize_dimensions( $orig_w, $orig_h, $width, $height, $crop );
$dst_w = $dims[4];
$dst_h = $dims[5];
// Return the original image only if it exactly fits the needed measures.
if ( ! $dims && ( ( ( null === $height && $orig_w == $width ) xor ( null === $width && $orig_h == $height ) ) xor ( $height == $orig_h && $width == $orig_w ) ) ) {
$img_url = $url;
$dst_w = $orig_w;
$dst_h = $orig_h;
} else {
// Use this to check if cropped image already exists, so we can return that instead.
$suffix = "{$dst_w}x{$dst_h}";
$dst_rel_path = str_replace( '.' . $ext, '', $rel_path );
$destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
if ( ! $dims || ( true == $crop && false == $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
// Can't resize, so return false saying that the action to do could not be processed as planned.
throw new Ocean_Extra_Exception('Unable to resize image because image_resize_dimensions() failed');
}
// Else check if cache exists.
elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
}
// Else, we resize the image and return the new resized image url.
else {
$editor = wp_get_image_editor( $img_path );
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
throw new Ocean_Extra_Exception('Unable to get WP_Image_Editor: ' .
$editor->get_error_message() . ' (is GD or ImageMagick installed?)');
}
$resized_file = $editor->save();
if ( ! is_wp_error( $resized_file ) ) {
$resized_rel_path = str_replace( $upload_dir, '', $resized_file['path'] );
$img_url = $upload_url . $resized_rel_path;
} else {
throw new Ocean_Extra_Exception( 'Unable to save resized image file: ' . $editor->get_error_message() );
}
}
}
// Okay, leave the ship.
if ( true === $upscale ) remove_filter( 'image_resize_dimensions', array( $this, 'aq_upscale' ) );
// Return the output.
if ( $single ) {
// str return.
$image = $img_url;
} else {
// array return.
$image = array (
0 => $img_url,
1 => $dst_w,
2 => $dst_h
);
}
return $image;
}
catch ( Ocean_Extra_Exception $ex ) {
error_log( 'Ocean_Extra_Resize.process() error: ' . $ex->getMessage() );
if ( $this->throwOnError ) {
// Bubble up exception.
throw $ex;
}
else {
// Return false, so that this patch is backwards-compatible.
return false;
}
}
}
/**
* Callback to overwrite WP computing of thumbnail measures
*/
public function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
if ( ! $crop ) return null; // Let the wordpress default function handle this.
// Here is the point we allow to use larger image size than the original one.
$aspect_ratio = $orig_w / $orig_h;
$new_w = $dest_w;
$new_h = $dest_h;
if ( ! $new_w ) {
$new_w = intval( $new_h * $aspect_ratio );
}
if ( ! $new_h ) {
$new_h = intval( $new_w / $aspect_ratio );
}
$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
$crop_w = round( $new_w / $size_ratio );
$crop_h = round( $new_h / $size_ratio );
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
}
}
}
if ( ! function_exists( 'ocean_extra_resize' ) ) {
/**
* This is just a tiny wrapper function for the class above so that there is no
* need to change any code in your own WP themes. Usage is still the same :)
*/
function ocean_extra_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
/* WPML Fix */
if ( defined( 'ICL_SITEPRESS_VERSION' ) ){
global $sitepress;
$url = $sitepress->convert_url( $url, $sitepress->get_default_language() );
}
/* WPML Fix */
$ocean_extra_resize = Ocean_Extra_Resize::getInstance();
return $ocean_extra_resize->process( $url, $width, $height, $crop, $single, $upscale );
}
}
if ( ! function_exists( 'ocean_extra_image_attributes' ) ) {
/**
* Build our image attributes
*/
function ocean_extra_image_attributes( $og_width = '', $og_height = '', $new_width = '', $new_height = '' ) {
$ignore_crop = array( '', '0', '9999' );
$img_atts = array();
$img_atts = array(
'width' => ( in_array( $new_width, $ignore_crop ) ) ? 9999 : intval( $new_width ),
'height' => ( in_array( $new_height, $ignore_crop ) ) ? 9999 : intval( $new_height ),
'crop' => ( in_array( $new_width, $ignore_crop ) || in_array( $new_height, $ignore_crop ) ) ? false : true
);
// If there's no height or width, empty the array
if ( 9999 == $img_atts[ 'width' ]
&& 9999 == $img_atts[ 'height' ] ) {
$img_atts = array();
}
if ( ! empty( $img_atts ) ) :
// Is our width larger than the OG img and not proportional?
$width_upscale = $img_atts[ 'width' ] > $og_width && $img_atts[ 'width' ] < 9999 ? true : false;
// Is our height larger than the OG img and not proportional?
$height_upscale = $img_atts[ 'height' ] > $og_height && $img_atts[ 'height' ] < 9999 ? true : false;
// If both the height and width are larger than the OG image, upscale
$img_atts[ 'upscale' ] = $width_upscale && $height_upscale ? true : false;
// If the width is larger than the OG img and the height isn't proportional, upscale
$img_atts[ 'upscale' ] = $width_upscale && $img_atts[ 'height' ] < 9999 ? true : $img_atts[ 'upscale' ];
// If the height is larger than the OG image and width isn't proportional, upscale
$img_atts[ 'upscale' ] = $height_upscale && $img_atts[ 'width' ] < 9999 ? true : $img_atts[ 'upscale' ];
// If we're upscaling, set crop to true
$img_atts[ 'crop' ] = $img_atts[ 'upscale' ] ? true : $img_atts[ 'crop' ];
// If one of our sizes is upscaling but the other is proportional, show the full image
if ( $width_upscale
&& $img_atts[ 'height' ] == 9999
|| $height_upscale
&& $img_atts[ 'width' ] == 9999 ) {
$img_atts = array();
}
endif;
return apply_filters( 'ocean_extra_image_attributes', $img_atts );
}
}
/**
* Delete custom resized images when an attachment is deleted
*/
function oe_delete_custom_resized_images($post_id) {
// Get the attachment URL
$attachment_url = wp_get_attachment_url($post_id);
if (!$attachment_url) {
return;
}
// Get the path of the attachment
$upload_dir = wp_upload_dir();
$attachment_path = str_replace($upload_dir['baseurl'], $upload_dir['basedir'], $attachment_url);
// Get the file info
$file_info = pathinfo($attachment_path);
$dir = $file_info['dirname'];
$filename = $file_info['filename'];
$extension = $file_info['extension'];
// Find and delete custom resized images
$custom_images = glob("{$dir}/{$filename}-*x*.{$extension}");
if (is_array($custom_images)) {
foreach ($custom_images as $image) {
@unlink($image);
}
}
}
add_action('delete_attachment', 'oe_delete_custom_resized_images');
.elementor-widget-image-carousel .swiper{position:static}.elementor-widget-image-carousel .swiper .swiper-slide figure{line-height:inherit}.elementor-widget-image-carousel .swiper-slide{text-align:center}.elementor-image-carousel-wrapper:not(.swiper-initialized) .swiper-slide{max-width:calc(100% / var(--e-image-carousel-slides-to-show, 3))}/**
* Custom wp_nav_menu walker for the Custom Menu widget.
*
* @package Ocean_Extra
* @category Core
* @author OceanWP
*/
if ( ! class_exists( 'Ocean_Extra_Nav_Walker' ) ) {
class Ocean_Extra_Nav_Walker extends Walker_Nav_Menu {
/**
* Middle logo menu breaking point
*
* @access private
* @var init
*/
private $break_point = null;
/**
* Middle logo menu number of top level items displayed
*
* @access private
* @var init
*/
private $displayed = 0;
/**
* Starts the list before the elements are added.
*
* @param string $output Passed by reference. Used to append additional content.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args An array of arguments. @see wp_nav_menu()
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent\n";
}
/**
* Icon if sub menu.
*/
public function display_element( $element, &$children_elements = array(), $max_depth = 0, $depth = 0, $args = array(), &$output = '' ) {
// Define vars
$id_field = $this->db_fields['id'];
$header_style = oceanwp_header_style();
if ( is_object( $args[0] ) ) {
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
}
// Down Arrows
if ( ! empty( $children_elements[ $element->$id_field ] ) && ( $depth == 0 )
|| $element->category_post != '' && $element->object == 'category' ) {
$element->classes[] = 'dropdown';
if ( true == get_theme_mod( 'ocean_menu_arrow_down', true ) ) {
$element->title .= ' ';
}
}
// Right/Left Arrows
if ( ! empty( $children_elements[ $element->$id_field ] ) && ( $depth > 0 ) ) {
$element->classes[] = 'dropdown';
if ( true == get_theme_mod( 'ocean_menu_arrow_side', true ) ) {
if ( is_rtl() ) {
$element->title .= ' ';
} else {
$element->title .= ' ';
}
}
}
// Define walker
Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
}
}
/**
* Ocean Extra plugin translation strings
*
* @package OceanWP WordPress theme
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'oe_lang_strings' ) ) {
/**
* Ocean Extra plugin Strings
*
* @author OceanWP
* @since 1.7.8
*
* @param string $value String key.
* @param boolean $echo Print string.
* @return mixed Return string or nothing.
*/
function oe_lang_strings( $value, $echo = true ) {
$oe_txt_strings = apply_filters(
'oe_lang_strings',
array(
// Mailchimp Widget.
'oe-string-mc-email' => apply_filters( 'oe_wai_mc_email', __( 'Enter your email address to subscribe', 'ocean-extra' ) ),
'oe-string-mc-submit' => apply_filters( 'oe_wai_mc_submit', __( 'Submit email address', 'ocean-extra' ) ),
'oe-string-mc-email-req-alert' => apply_filters( 'oe_mc_email_req', __( 'Email is required', 'ocean-extra' ) ),
'oe-string-mc-email-inv-alert' => apply_filters( 'oe_mc_email_inv', __( 'Email is not valid', 'ocean-extra' ) ),
'oe-string-mc-gdpr-check' => apply_filters( 'oe_mc_gdpr_check', __( 'This field is required', 'ocean-extra' ) ),
'oe-string-mc-msg-succ' => apply_filters( 'oe_mc_msg_succ', __( 'Thanks for your subscription.', 'ocean-extra' ) ),
'oe-string-mc-msg-fail' => apply_filters( 'oe_mc_msg_fail', __( 'Failed to subscribe, please contact admin.', 'ocean-extra' ) ),
// Aria.
'oe-string-search-form-label' => apply_filters( 'oe_wai_search_form_label', __( 'Search this website', 'ocean-extra' ) ),
'oe-string-search-field' => apply_filters( 'oe_wai_search_field', __( 'Insert search query', 'ocean-extra' ) ),
'oe_string_search_submit' => apply_filters( 'oe_wai_search_submit', __( 'Submit your search', 'ocean-extra' ) ),
)
);
if ( is_rtl() ) {
// do your stuff.
}
$oet_string = isset( $oe_txt_strings[ $value ] ) ? $oe_txt_strings[ $value ] : '';
/**
* Print or return strings
*/
if ( $echo ) {
echo $oet_string; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $oet_string;
}
}
}