PK #\q?5 " class-cartflows-landing-markup.phpnu W+A CARTFLOWS_STEP_POST_TYPE,
'numberposts' => 100,
'meta_query' => array( //phpcs:ignore
'relation' => 'OR',
array(
'key' => 'wcf-step-type',
'value' => 'landing',
),
array(
'key' => 'wcf-step-type',
'value' => 'checkout',
),
array(
'key' => 'wcf-step-type',
'value' => 'optin',
),
),
);
$landing_pages = get_posts( $args );
if ( is_array( $landing_pages ) && ! empty( $landing_pages ) ) {
$cartflows_custom_option = '';
$front_page_id = get_option( 'page_on_front' );
foreach ( $landing_pages as $key => $landing_page ) {
$selected = selected( $front_page_id, $landing_page->ID, false );
$cartflows_custom_option .= "ID}\"{$selected}>{$landing_page->post_title} ( #{$landing_page->ID} - CartFlows ) ";
}
$cartflows_custom_option .= '';
$output = str_replace( '', $cartflows_custom_option, $output );
}
}
return $output;
}
/**
* Set post query.
*
* @param string $query post query.
*/
public function wcf_pre_get_posts( $query ) {
if ( $query->is_main_query() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
$post_type = $query->get( 'post_type' );
$page_id = $query->get( 'page_id' );
if ( empty( $post_type ) && ! empty( $page_id ) ) {
$query->set( 'post_type', get_post_type( $page_id ) );
}
}
}
/**
* Redirect to homepage if landing page set as home page.
*/
public function template_redirect() {
$compatibiliy = Cartflows_Compatibility::get_instance();
// Do not redirect for page builder preview.
if ( $compatibiliy->is_page_builder_preview() ) {
return;
}
global $post;
if ( is_singular() && ! is_front_page() && get_option( 'page_on_front' ) == $post->ID ) {
wp_safe_redirect( site_url(), 301 );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Landing_Markup::get_instance();
PK #\O0 class-cartflows-landing-meta.phpnu W+A utils->get_step_post_type(), // Post_type.
'normal', // Context.
'high' // Priority.
);
}
}
/**
* Landing Metabox Markup
*
* @param object $post Post object.
* @return void
*/
public function landing_meta_box( $post ) {
wp_nonce_field( 'save-nonce-landing-step-meta', 'nonce-landing-step-meta' );
$stored = get_post_meta( $post->ID );
$checkout_meta = self::get_meta_option( $post->ID );
// Set stored and override defaults.
foreach ( $stored as $key => $value ) {
if ( array_key_exists( $key, $checkout_meta ) ) {
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : '';
} else {
self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : '';
}
}
// Get defaults.
$meta = self::get_meta_option( $post->ID );
/**
* Get options
*/
$landing_data = array();
foreach ( $meta as $key => $value ) {
$landing_data[ $key ] = $meta[ $key ]['default'];
}
do_action( 'wcf_landing_settings_markup_before', $meta );
$this->page_header_tab( $landing_data, $post->ID );
do_action( 'wcf_landing_settings_markup_after', $meta );
}
/**
* Page Header Tabs
*
* @param array $options Post meta.
* @param int $post_id Post ID.
*/
public function page_header_tab( $options, $post_id ) {
$active_tab = get_post_meta( $post_id, 'wcf_active_tab', true );
if ( empty( $active_tab ) ) {
$active_tab = 'wcf-landing-shortcodes';
}
$tabs = array(
array(
'title' => __( 'Shortcodes', 'cartflows' ),
'id' => 'wcf-landing-shortcodes',
'class' => 'wcf-landing-shortcodes' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
'icon' => 'dashicons-info',
),
array(
'title' => __( 'Custom Script', 'cartflows' ),
'id' => 'wcf-landing-custom-script-header',
'class' => 'wcf-landing-custom-script-header' === $active_tab ? 'wcf-tab wp-ui-text-highlight active' : 'wcf-tab',
'icon' => 'dashicons-format-aside',
),
);
?>
options->get_landing_fields( $post_id );
}
return self::$meta_option;
}
/**
* Metabox Save
*
* @param number $post_id Post ID.
* @return void
*/
public function save_meta_box( $post_id ) {
// Checks save status.
$is_autosave = wp_is_post_autosave( $post_id );
$is_revision = wp_is_post_revision( $post_id );
$is_valid_nonce = ( isset( $_POST['nonce-landing-step-meta'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce-landing-step-meta'] ) ), 'save-nonce-landing-step-meta' ) ) ? true : false;
// Exits script depending on save status.
if ( $is_autosave || $is_revision || ! $is_valid_nonce ) {
return;
}
wcf()->options->save_landing_fields( $post_id );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Landing_Meta::get_instance();
PK [+\ $K / / 9 batch-process/class-cartflows-importer-beaver-builder.phpnu W+A get_import_data( $data );
// Update page builder data.
update_post_meta( $post_id, '_fl_builder_data', $data );
update_post_meta( $post_id, '_fl_builder_draft', $data );
// Clear all cache.
FLBuilderModel::delete_asset_cache_for_all_posts();
} else {
wcf()->logger->import_log( '(✕) Not have "Beaver Builder" Data. Post meta _fl_builder_data is empty!' );
}
}
/**
* Update post meta.
*
* @param array $data Page builder data.
* @return mixed
*/
public function get_import_data( $data ) {
if ( empty( $data ) ) {
return array();
}
foreach ( $data as $key => $el ) {
// Import 'row' images.
if ( 'row' === $el->type ) {
$data[ $key ]->settings = self::import_row_images( $el->settings );
}
// Import 'module' images.
if ( 'module' === $el->type ) {
$data[ $key ]->settings = self::import_module_images( $el->settings );
}
// Import 'column' images.
if ( 'column' === $el->type ) {
$data[ $key ]->settings = self::import_column_images( $el->settings );
}
}
return $data;
}
/**
* Import Module Images.
*
* @param object $settings Module settings object.
* @return object
*/
public static function import_module_images( $settings ) {
/**
* 1) Set photos.
*/
$settings = self::import_photo( $settings );
/**
* 2) Set `$settings->data` for Only type 'image-icon'
*
* @todo Remove the condition `'image-icon' === $settings->type` if `$settings->data` is used only for the Image Icon.
*/
if (
isset( $settings->data ) &&
isset( $settings->photo ) && ! empty( $settings->photo ) &&
'image-icon' === $settings->type
) {
$settings->data = FLBuilderPhoto::get_attachment_data( $settings->photo );
}
/**
* 3) Set `list item` module images
*/
if ( isset( $settings->add_list_item ) ) {
foreach ( $settings->add_list_item as $key => $value ) {
$settings->add_list_item[ $key ] = self::import_photo( $value );
}
}
return $settings;
}
/**
* Import Column Images.
*
* @param object $settings Column settings object.
* @return object
*/
public static function import_column_images( $settings ) {
// 1) Set BG Images.
$settings = self::import_bg_image( $settings );
return $settings;
}
/**
* Import Row Images.
*
* @param object $settings Row settings object.
* @return object
*/
public static function import_row_images( $settings ) {
// 1) Set BG Images.
$settings = self::import_bg_image( $settings );
return $settings;
}
/**
* Helper: Import BG Images.
*
* @param object $settings Row settings object.
* @return object
*/
public static function import_bg_image( $settings ) {
if (
( ! empty( $settings->bg_image ) && ! empty( $settings->bg_image_src ) )
) {
$image = array(
'url' => $settings->bg_image_src,
'id' => $settings->bg_image,
);
$downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
$settings->bg_image_src = $downloaded_image['url'];
$settings->bg_image = $downloaded_image['id'];
}
return $settings;
}
/**
* Helper: Import Photo.
*
* @param object $settings Row settings object.
* @return object
*/
public static function import_photo( $settings ) {
if ( ! empty( $settings->photo ) && ! empty( $settings->photo_src ) ) {
$image = array(
'url' => $settings->photo_src,
'id' => $settings->photo,
);
$downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
$settings->photo_src = $downloaded_image['url'];
$settings->photo = $downloaded_image['id'];
}
return $settings;
}
}
/**
* Initialize class object with 'get_instance()' method
*/
CartFlows_Importer_Beaver_Builder::get_instance();
endif;
PK [+\** * 5 batch-process/helpers/class-wp-background-process.phpnu W+A cron_hook_identifier = $this->identifier . '_cron';
$this->cron_interval_identifier = $this->identifier . '_cron_interval';
add_action( $this->cron_hook_identifier, array( $this, 'handle_cron_healthcheck' ) );
add_filter( 'cron_schedules', array( $this, 'schedule_cron_healthcheck' ) );
}
/**
* Dispatch
*
* @return mixed dispatch event.
*/
public function dispatch() {
// Schedule the cron healthcheck.
$this->schedule_event();
// Perform remote post.
return parent::dispatch();
}
/**
* Push to queue
*
* @param mixed $data Data.
*
* @return $this
*/
public function push_to_queue( $data ) {
$this->data[] = $data;
return $this;
}
/**
* Save queue
*
* @return $this
*/
public function save() {
$key = $this->generate_key();
if ( ! empty( $this->data ) ) {
update_site_option( $key, $this->data );
}
return $this;
}
/**
* Update queue
*
* @param string $key Key.
* @param array $data Data.
*
* @return $this
*/
public function update( $key, $data ) {
if ( ! empty( $data ) ) {
update_site_option( $key, $data );
}
return $this;
}
/**
* Delete queue
*
* @param string $key Key.
*
* @return $this
*/
public function delete( $key ) {
delete_site_option( $key );
return $this;
}
/**
* Generate key
*
* Generates a unique key based on microtime. Queue items are
* given a unique key so that they can be merged upon save.
*
* @param int $length Length.
*
* @return string
*/
protected function generate_key( $length = 64 ) {
$unique = md5( microtime() . rand() );
$prepend = $this->identifier . '_batch_';
return substr( $prepend . $unique, 0, $length );
}
/**
* Maybe process queue
*
* Checks whether data exists within the queue and that
* the process is not already running.
*/
public function maybe_handle() {
// Don't lock up other requests while processing.
session_write_close();
if ( $this->is_process_running() ) {
// Background process already running.
wp_die();
}
if ( $this->is_queue_empty() ) {
// No data to process.
wp_die();
}
check_ajax_referer( $this->identifier, 'nonce' );
$this->handle();
wp_die();
}
/**
* Is queue empty
*
* @return bool
*/
protected function is_queue_empty() {
global $wpdb;
$table = $wpdb->options;
$column = 'option_name';
if ( is_multisite() ) {
$table = $wpdb->sitemeta;
$column = 'meta_key';
}
$key = $this->identifier . '_batch_%';
$count = $wpdb->get_var(
$wpdb->prepare(
"
SELECT COUNT(*)
FROM {$table}
WHERE {$column} LIKE %s
",
$key
)
);
return ( $count > 0 ) ? false : true;
}
/**
* Is process running
*
* Check whether the current process is already running
* in a background process.
*/
protected function is_process_running() {
if ( get_site_transient( $this->identifier . '_process_lock' ) ) {
// Process already running.
return true;
}
return false;
}
/**
* Lock process
*
* Lock the process so that multiple instances can't run simultaneously.
* Override if applicable, but the duration should be greater than that
* defined in the time_exceeded() method.
*/
protected function lock_process() {
$this->start_time = time(); // Set start time of current process.
$lock_duration = ( property_exists( $this, 'queue_lock_time' ) ) ? $this->queue_lock_time : 60; // 1 minute
$lock_duration = apply_filters( $this->identifier . '_queue_lock_time', $lock_duration );
set_site_transient( $this->identifier . '_process_lock', microtime(), $lock_duration );
}
/**
* Unlock process
*
* Unlock the process so that other instances can spawn.
*
* @return $this
*/
protected function unlock_process() {
delete_site_transient( $this->identifier . '_process_lock' );
return $this;
}
/**
* Get batch
*
* @return stdClass Return the first batch from the queue
*/
protected function get_batch() {
global $wpdb;
$table = $wpdb->options;
$column = 'option_name';
$key_column = 'option_id';
$value_column = 'option_value';
if ( is_multisite() ) {
$table = $wpdb->sitemeta;
$column = 'meta_key';
$key_column = 'meta_id';
$value_column = 'meta_value';
}
$key = $this->identifier . '_batch_%';
$query = $wpdb->get_row(
$wpdb->prepare(
"
SELECT *
FROM {$table}
WHERE {$column} LIKE %s
ORDER BY {$key_column} ASC
LIMIT 1
",
$key
)
);
$batch = new stdClass();
$batch->key = $query->$column;
$batch->data = maybe_unserialize( $query->$value_column );
return $batch;
}
/**
* Handle
*
* Pass each queue item to the task handler, while remaining
* within server memory and time limit constraints.
*/
protected function handle() {
$this->lock_process();
do {
$batch = $this->get_batch();
foreach ( $batch->data as $key => $value ) {
$task = $this->task( $value );
if ( false !== $task ) {
$batch->data[ $key ] = $task;
} else {
unset( $batch->data[ $key ] );
}
if ( $this->time_exceeded() || $this->memory_exceeded() ) {
// Batch limits reached.
break;
}
}
// Update or delete current batch.
if ( ! empty( $batch->data ) ) {
$this->update( $batch->key, $batch->data );
} else {
$this->delete( $batch->key );
}
} while ( ! $this->time_exceeded() && ! $this->memory_exceeded() && ! $this->is_queue_empty() );
$this->unlock_process();
// Start next batch or complete process.
if ( ! $this->is_queue_empty() ) {
$this->dispatch();
} else {
$this->complete();
}
wp_die();
}
/**
* Memory exceeded
*
* Ensures the batch process never exceeds 90%
* of the maximum WordPress memory.
*
* @return bool
*/
protected function memory_exceeded() {
$memory_limit = $this->get_memory_limit() * 0.9; // 90% of max memory
$current_memory = memory_get_usage( true );
$return = false;
if ( $current_memory >= $memory_limit ) {
$return = true;
}
return apply_filters( $this->identifier . '_memory_exceeded', $return );
}
/**
* Get memory limit
*
* @return int
*/
protected function get_memory_limit() {
if ( function_exists( 'ini_get' ) ) {
$memory_limit = ini_get( 'memory_limit' );
} else {
// Sensible default.
$memory_limit = '128M';
}
if ( ! $memory_limit || -1 === $memory_limit ) {
// Unlimited, set to 32GB.
$memory_limit = '32000M';
}
return intval( $memory_limit ) * 1024 * 1024;
}
/**
* Time exceeded.
*
* Ensures the batch never exceeds a sensible time limit.
* A timeout limit of 30s is common on shared hosting.
*
* @return bool
*/
protected function time_exceeded() {
$finish = $this->start_time + apply_filters( $this->identifier . '_default_time_limit', 20 ); // 20 seconds
$return = false;
if ( time() >= $finish ) {
$return = true;
}
return apply_filters( $this->identifier . '_time_exceeded', $return );
}
/**
* Complete.
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
protected function complete() {
// Unschedule the cron healthcheck.
$this->clear_scheduled_event();
}
/**
* Schedule cron healthcheck
*
* @access public
* @param mixed $schedules Schedules.
* @return mixed
*/
public function schedule_cron_healthcheck( $schedules ) {
$interval = apply_filters( $this->identifier . '_cron_interval', 5 );
if ( property_exists( $this, 'cron_interval' ) ) {
$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval_identifier );
}
// Adds every 5 minutes to the existing schedules.
$schedules[ $this->identifier . '_cron_interval' ] = array(
'interval' => MINUTE_IN_SECONDS * $interval,
'display' => sprintf( __( 'Every %d Minutes', 'cartflows' ), $interval ),
);
return $schedules;
}
/**
* Handle cron healthcheck
*
* Restart the background process if not already running
* and data exists in the queue.
*/
public function handle_cron_healthcheck() {
if ( $this->is_process_running() ) {
// Background process already running.
exit;
}
if ( $this->is_queue_empty() ) {
// No data to process.
$this->clear_scheduled_event();
exit;
}
$this->handle();
exit;
}
/**
* Schedule event
*/
protected function schedule_event() {
if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) {
wp_schedule_event( time(), $this->cron_interval_identifier, $this->cron_hook_identifier );
}
}
/**
* Clear scheduled event
*/
protected function clear_scheduled_event() {
$timestamp = wp_next_scheduled( $this->cron_hook_identifier );
if ( $timestamp ) {
wp_unschedule_event( $timestamp, $this->cron_hook_identifier );
}
}
/**
* Cancel Process
*
* Stop processing queue items, clear cronjob and delete batch.
*/
public function cancel_process() {
if ( ! $this->is_queue_empty() ) {
$batch = $this->get_batch();
$this->delete( $batch->key );
wp_clear_scheduled_hook( $this->cron_hook_identifier );
}
}
/**
* Task
*
* Override this method to perform any actions required on each
* queue item. Return the modified item for further processing
* in the next pass through. Or, return false to remove the
* item from the queue.
*
* @param mixed $item Queue item to iterate over.
*
* @return mixed
*/
abstract protected function task( $item );
}
}
PK [+\Q 0 batch-process/helpers/class-wp-async-request.phpnu W+A identifier = $this->prefix . '_' . $this->action;
add_action( 'wp_ajax_' . $this->identifier, array( $this, 'maybe_handle' ) );
add_action( 'wp_ajax_nopriv_' . $this->identifier, array( $this, 'maybe_handle' ) );
}
/**
* Set data used during the request
*
* @param array $data Data.
*
* @return $this
*/
public function data( $data ) {
$this->data = $data;
return $this;
}
/**
* Dispatch the async request
*
* @return array|WP_Error
*/
public function dispatch() {
$url = add_query_arg( $this->get_query_args(), $this->get_query_url() );
$args = $this->get_post_args();
return wp_remote_post( esc_url_raw( $url ), $args );
}
/**
* Get query args
*
* @return array
*/
protected function get_query_args() {
if ( property_exists( $this, 'query_args' ) ) {
return $this->query_args;
}
return array(
'action' => $this->identifier,
'nonce' => wp_create_nonce( $this->identifier ),
);
}
/**
* Get query URL
*
* @return string
*/
protected function get_query_url() {
if ( property_exists( $this, 'query_url' ) ) {
return $this->query_url;
}
return admin_url( 'admin-ajax.php' );
}
/**
* Get post args
*
* @return array
*/
protected function get_post_args() {
if ( property_exists( $this, 'post_args' ) ) {
return $this->post_args;
}
return array(
'timeout' => 0.01,
'blocking' => false,
'body' => $this->data,
'cookies' => $_COOKIE,
'sslverify' => apply_filters( 'https_local_ssl_verify', false ),
);
}
/**
* Maybe handle
*
* Check for correct nonce and pass to handler.
*/
public function maybe_handle() {
// Don't lock up other requests while processing.
session_write_close();
check_ajax_referer( $this->identifier, 'nonce' );
$this->handle();
wp_die();
}
/**
* Handle
*
* Override this method to perform any actions required
* during the async request.
*/
abstract protected function handle();
}
}
PK [+\'_ 8 batch-process/helpers/class-cartflows-importer-image.phpnu W+A How to use?
*
* $image = array(
* 'url' => '',
* 'id' => '',
* );
*
* $downloaded_image = CartFlows_Import_Image::get_instance()->import( $image );
*
* @package CartFlows
*
* @since 1.1.1
*/
if ( ! class_exists( 'CartFlows_Import_Image' ) ) :
/**
* CartFlows Importer
*
* @since 1.1.1
*/
class CartFlows_Import_Image {
/**
* Instance
*
* @since 1.1.1
* @var object Class object.
* @access private
*/
private static $instance;
/**
* Images IDs
*
* @var array The Array of already image IDs.
* @since 1.1.1
*/
private $already_imported_ids = array();
/**
* Initiator
*
* @since 1.1.1
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.1.1
*/
public function __construct() {
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
WP_Filesystem();
}
/**
* Process Image Download
*
* @since 1.1.1
* @param array $attachments Attachment array.
* @return array Attachment array.
*/
public function process( $attachments ) {
$downloaded_images = array();
foreach ( $attachments as $key => $attachment ) {
$downloaded_images[] = $this->import( $attachment );
}
return $downloaded_images;
}
/**
* Get Hash Image.
*
* @since 1.1.1
* @param string $attachment_url Attachment URL.
* @return string Hash string.
*/
private function get_hash_image( $attachment_url ) {
return sha1( $attachment_url );
}
/**
* Get Saved Image.
*
* @since 1.1.1
* @param string $attachment Attachment Data.
* @return string Hash string.
*/
private function get_saved_image( $attachment ) {
wcf()->logger->import_log( 'importer-image.php File' );
if ( apply_filters( 'cartflows_image_importer_skip_image', false, $attachment ) ) {
wcf()->logger->import_log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
return $attachment;
}
global $wpdb;
// Already imported? Then return!
if ( isset( $this->already_imported_ids[ $attachment['id'] ] ) ) {
wcf()->logger->import_log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
return $this->already_imported_ids[ $attachment['id'] ];
}
// 1. Is already imported in Batch Import Process?
$post_id = $wpdb->get_var(
$wpdb->prepare(
"
SELECT post_id FROM {$wpdb->postmeta}
WHERE meta_key = '_cartflows_image_hash'
AND meta_value = %s
",
$this->get_hash_image( $attachment['url'] )
)
);
// 2. Is image already imported though XML?
if ( empty( $post_id ) ) {
// Get file name without extension.
// To check it exist in attachment.
$filename = basename( $attachment['url'] );
wcf()->logger->import_log( 'File Basename - ' . $filename );
$post_id = $wpdb->get_var( $wpdb->prepare( "
SELECT post_id FROM {$wpdb->postmeta}
WHERE meta_key = '_wp_attached_file'
AND meta_value LIKE %s
", '%/' . $filename . '%' ) );
wcf()->logger->import_log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
}
if ( $post_id ) {
$new_attachment = array(
'id' => $post_id,
'url' => wp_get_attachment_url( $post_id ),
);
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
return $new_attachment;
}
return false;
}
/**
* Import Image
*
* @since 1.1.1
* @param array $attachment Attachment array.
* @return array Attachment array.
*/
public function import( $attachment ) {
$saved_image = $this->get_saved_image( $attachment );
if ( $saved_image ) {
return $saved_image;
}
$file_content = wp_remote_retrieve_body( wp_safe_remote_get( $attachment['url'], array( 'timeout' => '60', 'sslverify' => false) ) );
// Empty file content?
if ( empty( $file_content ) ) {
wcf()->logger->import_log( 'Download (✕) Replace (✕) - ' . $attachment['url'] );
wcf()->logger->import_log( 'Error: Failed wp_remote_retrieve_body().' );
return $attachment;
}
// Extract the file name and extension from the URL.
$filename = basename( $attachment['url'] );
$upload = wp_upload_bits(
$filename,
null,
$file_content
);
$post = array(
'post_title' => $filename,
'guid' => $upload['url'],
);
$info = wp_check_filetype( $upload['file'] );
if ( $info ) {
$post['post_mime_type'] = $info['type'];
} else {
// For now just return the origin attachment.
return $attachment;
}
$post_id = wp_insert_attachment( $post, $upload['file'] );
wp_update_attachment_metadata(
$post_id,
wp_generate_attachment_metadata( $post_id, $upload['file'] )
);
update_post_meta( $post_id, '_cartflows_image_hash', $this->get_hash_image( $attachment['url'] ) );
$new_attachment = array(
'id' => $post_id,
'url' => $upload['url'],
);
wcf()->logger->import_log( 'Download (✓) Replace (✓) - ' . $attachment['url'] );
$this->already_imported_ids[ $attachment['id'] ] = $new_attachment;
return $new_attachment;
}
}
/**
* Initialize class object with 'get_instance()' method
*/
CartFlows_Import_Image::get_instance();
endif;PK [+\:# / batch-process/class-cartflows-batch-process.phpnu W+A is_divi_enabled() ) ) {
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi.php';
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-importer-divi-batch.php';
self::$batch_instance_divi = new Cartflows_Importer_Divi_Batch();
}
// Start image importing after site import complete.
add_action( 'cartflows_after_template_import', array( $this, 'start_batch_process' ) );
add_action( 'cartflows_import_complete', array( $this, 'complete_batch_import' ) );
add_filter( 'upload_mimes', array( $this, 'custom_upload_mimes' ) );
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
}
/**
* Added .svg files as supported format in the uploader.
*
* @since 1.1.4
*
* @param array $mimes Already supported mime types.
*/
public function custom_upload_mimes( $mimes ) {
// Allow SVG files.
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
// Allow XML files.
$mimes['xml'] = 'text/xml';
return $mimes;
}
/**
* Add SVG image support
*
* @since 1.1.4
*
* @param array $response Attachment response.
* @param object $attachment Attachment object.
* @param array $meta Attachment meta data.
*/
public function add_svg_image_support( $response, $attachment, $meta ) {
if ( ! function_exists( 'simplexml_load_file' ) ) {
return $response;
}
if ( ! empty( $response['sizes'] ) ) {
return $response;
}
if ( 'image/svg+xml' !== $response['mime'] ) {
return $response;
}
$svg_path = get_attached_file( $attachment->ID );
$dimensions = self::get_svg_dimensions( $svg_path );
$response['sizes'] = array(
'full' => array(
'url' => $response['url'],
'width' => $dimensions->width,
'height' => $dimensions->height,
'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
),
);
return $response;
}
/**
* Get SVG Dimensions
*
* @since 1.1.4.
*
* @param string $svg SVG file path.
* @return array Return SVG file height & width for valid SVG file.
*/
public static function get_svg_dimensions( $svg ) {
$svg = simplexml_load_file( $svg );
if ( false === $svg ) {
$width = '0';
$height = '0';
} else {
$attributes = $svg->attributes();
$width = (string) $attributes->width;
$height = (string) $attributes->height;
}
return (object) array(
'width' => $width,
'height' => $height,
);
}
/**
* Batch Process Complete.
*
* @return void
*/
public function complete_batch_import() {
wcf()->logger->import_log( '(✓) BATCH Process Complete!' );
}
/**
* Start Image Import
*
* @param integer $post_id Post Id.
*
* @return void
*/
public function start_batch_process( $post_id = '' ) {
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
wcf()->logger->import_log( '(✓) BATCH Started!' );
wcf()->logger->import_log( '(✓) Step ID ' . $post_id );
// Add "elementor" in import [queue].
if ( 'beaver-builder' === $default_page_builder && self::$batch_instance_bb ) {
// Add to queue.
self::$batch_instance_bb->push_to_queue( $post_id );
// Dispatch Queue.
self::$batch_instance_bb->save()->dispatch();
wcf()->logger->import_log( '(✓) Dispatch "Beaver Builder" Request..' );
} elseif ( 'elementor' === $default_page_builder && self::$batch_instance_elementor ) {
// Add to queue.
self::$batch_instance_elementor->push_to_queue( $post_id );
// Dispatch Queue.
self::$batch_instance_elementor->save()->dispatch();
wcf()->logger->import_log( '(✓) Dispatch "Elementor" Request..' );
} elseif ( 'divi' === $default_page_builder && self::$batch_instance_divi ) {
// Add to queue.
self::$batch_instance_divi->push_to_queue( $post_id );
// Dispatch Queue.
self::$batch_instance_divi->save()->dispatch();
wcf()->logger->import_log( '(✓) Dispatch "Divi" Request..' );
} else {
wcf()->logger->import_log( '(✕) Could not import image due to allow_url_fopen() is disabled!' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
CartFlows_Batch_Process::get_instance();
endif;
PK [+\љ 5 batch-process/class-cartflows-importer-divi-batch.phpnu W+A import_single_post( $post_id );
return false;
}
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*
* @since 1.1.1
*/
protected function complete() {
parent::complete();
do_action( 'cartflows_import_complete' );
}
}
endif;
PK [+\}f f 7 batch-process/class-cartflows-change-template-batch.phpnu W+A logger->log( '(✓) Step ID ' . $post_id );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( 'Processed:' . $post_id ); //phpcs:ignore
}
update_post_meta( $post_id, '_wp_page_template', 'cartflows-default' );
return false;
}
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
protected function complete() {
parent::complete();
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( 'Process Complete' );//phpcs:ignore
}
}
}
endif;
PK [+\.V ? batch-process/class-cartflows-importer-beaver-builder-batch.phpnu W+A import_single_post( $post_id );
return false;
}
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*
* @since 1.1.1
*/
protected function complete() {
parent::complete();
do_action( 'cartflows_import_complete' );
}
}
endif;
PK [+\X 4 batch-process/class-cartflows-importer-elementor.phpnu W+A logger->import_log( '(✕) ' . $data );
}
$rest_content = add_magic_quotes( $rest_content );
$content = json_decode( $rest_content, true );
if ( ! is_array( $content ) ) {
$data = __( 'Invalid content. Expected an array.', 'cartflows' );
wcf()->logger->import_log( '(✕) ' . $data );
wcf()->logger->import_log( $content );
} else {
wcf()->logger->import_log( '(✓) Processing Request..' );
// Import the data.
$content = $this->process_export_import_content( $content, 'on_import' );
// Update content.
update_metadata( 'post', $post_id, '_elementor_data', $content );
wcf()->logger->import_log( '(✓) Process Complete' );
}
}
}
PK [+\ : batch-process/class-cartflows-importer-elementor-batch.phpnu W+A import_single_template( $post_id );
return false;
}
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*
* @since 1.0.0
*/
protected function complete() {
parent::complete();
do_action( 'cartflows_import_complete' );
}
}
endif;
PK [+\ V
/ batch-process/class-cartflows-importer-divi.phpnu W+A tag and attributes.
$allowedposttags['style'] = array();
}
return $allowedposttags;
}
/**
* Update post meta.
*
* @param integer $post_id Post ID.
* @return void
*/
public function import_single_post( $post_id = 0 ) {
// Allow the SVG tags in batch update process.
add_filter( 'wp_kses_allowed_html', array( $this, 'allowed_tags_and_attributes' ), 10, 2 );
// Download and replace images.
$content = get_post_meta( $post_id, 'divi_content', true );
if ( empty( $content ) ) {
wcf()->logger->import_log( '(✕) Not have "Divi" Data. Post content is empty!' );
} else {
wcf()->logger->import_log( '(✓) Processing Request..' );
// Update hotlink images.
$content = CartFlows_Importer::get_instance()->get_content( $content );
// Update post content.
wp_update_post(
array(
'ID' => $post_id,
'post_content' => $content,
)
);
// Delete temporary meta key.
delete_post_meta( $post_id, 'divi_content' );
wcf()->logger->import_log( '(✓) Process Complete' );
}
}
}
/**
* Initialize class object with 'get_instance()' method
*/
CartFlows_Importer_Divi::get_instance();
endif;
PK [+\lI lI class-cartflows-admin.phpnu W+A Settings',
'Docs ',
);
if ( ! _is_cartflows_pro() ) {
array_push( $mylinks, ' Go Pro ' );
}
return array_merge( $links, $mylinks );
}
/**
* Initialises the Plugin Name.
*
* @since 1.0.0
* @return void
*/
public static function initialise_plugin() {
$name = 'Cartflows';
$short_name = 'Cflows';
define( 'CARTFLOWS_PLUGIN_NAME', $name );
define( 'CARTFLOWS_PLUGIN_SHORT_NAME', $short_name );
}
/**
* Renders the admin settings menu.
*
* @since 1.0.0
* @return void
*/
public static function menu() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
add_menu_page(
'CartFlows',
'CartFlows',
'manage_options',
CARTFLOWS_SLUG,
__CLASS__ . '::render',
'data:image/svg+xml;base64,' . base64_encode( file_get_contents( CARTFLOWS_DIR . 'assets/images/cartflows-icon.svg' ) ),//phpcs:ignore
39.7
);
}
/**
* Add submenu to admin menu.
*
* @since 1.0.0
*/
public static function submenu() {
$parent_slug = CARTFLOWS_SLUG;
$page_title = __( 'Settings', 'cartflows' );
$menu_title = __( 'Settings', 'cartflows' );
$capability = 'manage_options';
$menu_slug = 'cartflows_settings';
$callback = __CLASS__ . '::render';
add_submenu_page(
$parent_slug,
$page_title,
$menu_title,
$capability,
$menu_slug,
$callback
);
}
/**
* Renders the admin settings.
*
* @since 1.0.0
* @return void
*/
public static function render() {
$action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; //phpcs:ignore
$action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
$action = str_replace( '_', '-', $action );
// Enable header icon filter below.
$header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
include_once CARTFLOWS_DIR . 'includes/admin/cartflows-admin.php';
}
/**
* Renders the admin settings content.
*
* @since 1.0.0
* @return void
*/
public static function render_content() {
$action = ( isset( $_GET['action'] ) ) ? sanitize_text_field( wp_unslash( $_GET['action'] ) ) : ''; //phpcs:ignore
$action = ( ! empty( $action ) && '' != $action ) ? $action : 'general';
$action = str_replace( '_', '-', $action );
$action = 'general';
$header_wrapper_class = apply_filters( 'cartflows_header_wrapper_class', array( $action ) );
include_once CARTFLOWS_DIR . 'includes/admin/cartflows-general.php';
}
/**
* Save Global Setting options.
*
* @since 1.0.0
*/
public static function save_common_settings() {
if ( isset( $_POST['cartflows-common-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-common-settings-nonce'] ) ), 'cartflows-common-settings' ) ) {
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$new_settings = array();
if ( isset( $_POST['_cartflows_common'] ) ) {
// Loop through the input and sanitize each of the values.
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_common'] ) ); //phpcs:ignore
}
Cartflows_Helper::update_admin_settings_option( '_cartflows_common', $new_settings, false );
$query = array(
'message' => 'saved',
);
$redirect_to = add_query_arg( $query, $url );
wp_safe_redirect( $redirect_to );
exit;
} // End if statement.
}
/**
* Save Debug Setting options.
*
* @since 1.1.14
*/
public static function save_debug_settings() {
if ( isset( $_POST['cartflows-debug-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-debug-settings-nonce'] ) ), 'cartflows-debug-settings' ) ) {
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$new_settings = array();
if ( isset( $_POST['_cartflows_debug_data'] ) ) {
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_debug_data'] ) ); //phpcs:ignore
}
Cartflows_Helper::update_admin_settings_option( '_cartflows_debug_data', $new_settings, false );
$query = array(
'message' => 'saved',
);
$redirect_to = add_query_arg( $query, $url );
wp_safe_redirect( $redirect_to );
exit;
}
}
/**
* Save permalink Setting options.
*
* @since 1.1.14
*/
public static function save_permalink_settings() {
if ( isset( $_POST['cartflows-permalink-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-permalink-settings-nonce'] ) ), 'cartflows-permalink-settings' ) ) {
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$new_settings = array();
if ( isset( $_POST['reset'] ) ) {
$_POST['_cartflows_permalink'] = array(
'permalink' => CARTFLOWS_STEP_POST_TYPE,
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
'permalink_structure' => '',
);
}
if ( isset( $_POST['_cartflows_permalink'] ) ) {
$cartflows_permalink_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_permalink'] ) ); //phpcs:ignore
if ( empty( $cartflows_permalink_settings['permalink'] ) ) {
$new_settings['permalink'] = CARTFLOWS_STEP_POST_TYPE;
} else {
$new_settings['permalink'] = $cartflows_permalink_settings['permalink'];
}
if ( empty( $cartflows_permalink_settings['permalink_flow_base'] ) ) {
$new_settings['permalink_flow_base'] = CARTFLOWS_FLOW_POST_TYPE;
} else {
$new_settings['permalink_flow_base'] = $cartflows_permalink_settings['permalink_flow_base'];
}
$new_settings['permalink_structure'] = $cartflows_permalink_settings['permalink_structure'];
}
Cartflows_Helper::update_admin_settings_option( '_cartflows_permalink', $new_settings, false );
$query = array(
'message' => 'saved',
);
$redirect_to = add_query_arg( $query, $url );
update_option( 'cartflows_permalink_saved', true );
wp_safe_redirect( $redirect_to );
exit;
}
}
/**
* Save google analytics Setting options.
*
* @since 1.1.14
*/
public static function save_google_analytics_settings() {
if ( isset( $_POST['cartflows-google-analytics-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-google-analytics-settings-nonce'] ) ), 'cartflows-google-analytics-settings' ) ) {
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$new_settings = array();
if ( isset( $_POST['_cartflows_google_analytics'] ) ) {
$new_settings = self::sanitize_form_inputs( $_POST['_cartflows_google_analytics'] ); //phpcs:ignore
}
Cartflows_Helper::update_admin_settings_option( '_cartflows_google_analytics', $new_settings, true );
$query = array(
'message' => 'saved',
);
$redirect_to = add_query_arg( $query, $url );
wp_safe_redirect( $redirect_to );
exit;
}
}
/**
* Loop through the input and sanitize each of the values.
*
* @param array $input_settings input settings.
* @return array
*/
public static function sanitize_form_inputs( $input_settings = array() ) {
$new_settings = array();
foreach ( $input_settings as $key => $val ) {
if ( is_array( $val ) ) {
foreach ( $val as $k => $v ) {
$new_settings[ $key ][ $k ] = ( isset( $val[ $k ] ) ) ? sanitize_text_field( $v ) : '';
}
} else {
$new_settings[ $key ] = ( isset( $input_settings[ $key ] ) ) ? sanitize_text_field( $val ) : '';
}
}
return $new_settings;
}
/**
* Check is cartflows admin.
*
* @since 1.0.0
* @return boolean
*/
public static function is_global_admin() {
$current_screen = get_current_screen();
if (
is_object( $current_screen ) &&
isset( $current_screen->post_type ) &&
( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ||
CARTFLOWS_STEP_POST_TYPE === $current_screen->post_type
)
) {
return true;
}
return false;
}
/**
* Check is flow admin.
*
* @since 1.0.0
* @return boolean
*/
public static function is_flow_edit_admin() {
$current_screen = get_current_screen();
if (
is_object( $current_screen ) &&
isset( $current_screen->post_type ) &&
( CARTFLOWS_FLOW_POST_TYPE === $current_screen->post_type ) &&
isset( $current_screen->base ) &&
( 'post' === $current_screen->base )
) {
return true;
}
return false;
}
/**
* Global Admin Scripts.
*
* @since 1.0.0
*/
public static function global_admin_scripts() {
$installed_plugins = get_plugins();
$is_wc_installed = isset( $installed_plugins['woocommerce/woocommerce.php'] ) ? true : false;
$edit_test_mode = filter_input( INPUT_GET, 'edit_test_mode', FILTER_SANITIZE_STRING );
$edit_test_mode = 'yes' === $edit_test_mode ? true : false;
$localize = array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'ajax_nonce' => wp_create_nonce( 'cartflows-nonce' ),
'wc_status' => array(
'installed' => $is_wc_installed,
'active' => wcf()->is_woo_active,
),
'wc_activating_message' => __( 'Installing and activating..', 'cartflows' ),
'wc_install_error' => __( 'There was an error with the installation of plugin.', 'cartflows' ),
'wcf_edit_test_mode' => $edit_test_mode,
);
wp_localize_script( 'jquery', 'cartflows_admin', apply_filters( 'cartflows_admin_js_localize', $localize ) );
if ( self::is_global_admin() ) {
// Styles.
wp_enqueue_style( 'cartflows-global-admin', CARTFLOWS_URL . 'admin/assets/css/global-admin.css', array(), CARTFLOWS_VER );
wp_style_add_data( 'cartflows-global-admin', 'rtl', 'replace' );
wp_enqueue_script(
'wcf-global-admin',
CARTFLOWS_URL . 'admin/assets/js/global-admin.js',
array( 'jquery' ),
CARTFLOWS_VER,
true
);
do_action( 'cartflows_global_admin_scripts' );
}
}
/**
* Global Admin Data.
*
* @since 1.0.0
*/
public static function global_admin_data() {
$current_screen = get_current_screen();
if ( ! $current_screen ) {
return;
}
if ( 'edit-' . CARTFLOWS_FLOW_POST_TYPE != $current_screen->id ) {
return;
}
$default_page_builder = Cartflows_Helper::get_common_setting( 'default_page_builder' );
?>
wp_create_nonce( 'cartflows-widget-nonce' ),
);
wp_localize_script( 'cartflows-admin-settings', 'cartflows', apply_filters( 'cartflows_js_localize', $localize ) );
do_action( 'cartflows_admin_settings_after_enqueue_scripts' );
}
/**
* Save All admin settings here
*/
public static function save_settings() {
// Only admins can save settings.
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
self::save_common_settings();
self::save_debug_settings();
self::save_permalink_settings();
self::save_google_analytics_settings();
self::save_facebook_settings();
// Let extensions hook into saving.
do_action( 'cartflows_admin_settings_save' );
}
/**
* Get and return page URL
*
* @param string $menu_slug Menu name.
* @since 1.0.0
* @return string page url
*/
public static function get_page_url( $menu_slug ) {
$parent_page = self::$default_menu_position;
if ( strpos( $parent_page, '?' ) !== false ) {
$query_var = '&page=' . self::$plugin_slug;
} else {
$query_var = '?page=' . self::$plugin_slug;
}
$parent_page_url = admin_url( $parent_page . $query_var );
$url = $parent_page_url . '&action=' . $menu_slug;
return esc_url( $url );
}
/**
* Admin body classes.
*
* Body classes to be added to tag in admin page
*
* @param String $classes body classes returned from the filter.
* @return String body classes to be added to tag in admin page
*/
public static function add_admin_body_class( $classes ) {
$classes .= ' cartflows-' . CARTFLOWS_VER;
return $classes;
}
/**
* Save Global Setting options.
*
* @since 1.0.0
*/
public static function save_facebook_settings() {
if ( isset( $_POST['cartflows-facebook-settings-nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cartflows-facebook-settings-nonce'] ) ), 'cartflows-facebook-settings' ) ) {
$url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
$new_settings = array();
if ( isset( $_POST['_cartflows_facebook'] ) ) {
$new_settings = self::sanitize_form_inputs( wp_unslash( $_POST['_cartflows_facebook'] ) ); //phpcs:ignore
}
Cartflows_Helper::update_admin_settings_option( '_cartflows_facebook', $new_settings, false );
$query = array(
'message' => 'saved',
);
$redirect_to = add_query_arg( $query, $url );
wp_safe_redirect( $redirect_to );
exit;
}
}
}
Cartflows_Admin::init();
PK [+\=N class-cartflows-utils.phpnu W+A get_step_post_type() === $this->current_post_type( $post_type ) ) {
return true;
}
return false;
}
/**
* Check if post type is of flow.
*
* @param string $post_type post type.
* @return bool
*/
public function is_flow_post_type( $post_type = '' ) {
if ( $this->get_flow_post_type() === $this->current_post_type( $post_type ) ) {
return true;
}
return false;
}
/**
* Get post type of step.
*
* @return string
*/
public function get_step_post_type() {
return CARTFLOWS_STEP_POST_TYPE;
}
/**
* Get post type of flow.
*
* @return string
*/
public function get_flow_post_type() {
return CARTFLOWS_FLOW_POST_TYPE;
}
/**
* Get flow id
*
* @return int
*/
public function get_flow_id() {
global $post;
return get_post_meta( $post->ID, 'wcf-flow-id', true );
}
/**
* Get flow id by step
*
* @param int $step_id step ID.
* @return int
*/
public function get_flow_id_from_step_id( $step_id ) {
return get_post_meta( $step_id, 'wcf-flow-id', true );
}
/**
* Get flow steps by id
*
* @param int $flow_id flow ID.
* @return int
*/
public function get_flow_steps( $flow_id ) {
$steps = get_post_meta( $flow_id, 'wcf-steps', true );
if ( is_array( $steps ) && ! empty( $steps ) ) {
return $steps;
}
return false;
}
/**
* Get template type of step
*
* @param int $step_id step ID.
* @return int
*/
public function get_step_type( $step_id ) {
return get_post_meta( $step_id, 'wcf-step-type', true );
}
/**
* Get next id for step
*
* @param int $flow_id flow ID.
* @param int $step_id step ID.
* @return bool
*/
public function get_next_step_id( $flow_id, $step_id ) {
$steps = $this->get_flow_steps( $flow_id );
$step_id = intval( $step_id );
if ( ! $steps ) {
return false;
}
foreach ( $steps as $i => $step ) {
if ( intval( $step['id'] ) === $step_id ) {
$next_i = $i + 1;
if ( isset( $steps[ $next_i ] ) ) {
$navigation = $steps[ $next_i ];
return intval( $navigation['id'] );
}
break;
}
}
return false;
}
/**
* Get next id for step
*
* @param int $order_id order ID.
* @return int
*/
public function get_flow_id_from_order( $order_id ) {
$flow_id = get_post_meta( $order_id, '_wcf_flow_id', true );
return intval( $flow_id );
}
/**
* Get checkout id for order
*
* @param int $order_id order ID.
* @return int
*/
public function get_checkout_id_from_order( $order_id ) {
$checkout_id = get_post_meta( $order_id, '_wcf_checkout_id', true );
return intval( $checkout_id );
}
/**
* We are using this function mostly in ajax on checkout page
*
* @return bool
*/
public function get_checkout_id_from_post_data() {
if ( isset( $_POST['_wcf_checkout_id'] ) ) { //phpcs:ignore
$checkout_id = filter_var( wp_unslash( $_POST['_wcf_checkout_id'] ), FILTER_SANITIZE_NUMBER_INT ); //phpcs:ignore
return intval( $checkout_id );
}
return false;
}
/**
* We are using this function mostly in ajax on checkout page
*
* @return bool
*/
public function get_flow_id_from_post_data() {
if ( isset( $_POST['_wcf_flow_id'] ) ) { //phpcs:ignore
$flow_id = filter_var( wp_unslash( $_POST['_wcf_flow_id'] ), FILTER_SANITIZE_NUMBER_INT ); //phpcs:ignore
return intval( $flow_id );
}
return false;
}
/**
* Get optin id for order
*
* @param int $order_id order ID.
* @return int
*/
public function get_optin_id_from_order( $order_id ) {
$optin_id = get_post_meta( $order_id, '_wcf_optin_id', true );
return intval( $optin_id );
}
/**
* We are using this function mostly in ajax on checkout page
*
* @return bool
*/
public function get_optin_id_from_post_data() {
if ( isset( $_POST['_wcf_optin_id'] ) ) { //phpcs:ignore
$optin_id = filter_var( wp_unslash( $_POST['_wcf_optin_id'] ), FILTER_SANITIZE_NUMBER_INT ); //phpcs:ignore
return intval( $optin_id );
}
return false;
}
/**
* Check for thank you page
*
* @param int $step_id step ID.
* @return bool
*/
public function check_is_thankyou_page( $step_id ) {
$step_type = $this->get_step_type( $step_id );
if ( 'thankyou' === $step_type ) {
return true;
}
return false;
}
/**
* Check for offer page
*
* @param int $step_id step ID.
* @return bool
*/
public function check_is_offer_page( $step_id ) {
$step_type = $this->get_step_type( $step_id );
if ( 'upsell' === $step_type || 'downsell' === $step_type ) {
return true;
}
return false;
}
/**
* Check if loaded page requires woo.
*
* @return bool
*/
public function check_is_woo_required_page() {
global $post;
$step_id = $post->ID;
$woo_not_required_type = array( 'landing' );
$step_type = $this->get_step_type( $step_id );
return ( ! in_array( $step_type, $woo_not_required_type, true ) );
}
/**
* Define constant for cache
*
* @return void
*/
public function do_not_cache() {
wcf_maybe_define_constant( 'DONOTCACHEPAGE', true );
wcf_maybe_define_constant( 'DONOTCACHEOBJECT', true );
wcf_maybe_define_constant( 'DONOTCACHEDB', true );
nocache_headers();
}
/**
* Get linking url
*
* @param array $args query args.
* @return string
*/
public function get_linking_url( $args = array() ) {
$url = get_home_url();
$url = add_query_arg( $args, $url );
return $url;
}
/**
* Get assets urls
*
* @return array
* @since 1.1.6
*/
public function get_assets_path() {
$rtl = '';
if ( is_rtl() ) {
$rtl = '-rtl';
}
$file_prefix = '';
$dir_name = '';
$is_min = apply_filters( 'cartflows_load_min_assets', false );
if ( $is_min ) {
$file_prefix = '.min';
$dir_name = 'min-';
}
$js_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'js/';
$css_gen_path = CARTFLOWS_URL . 'assets/' . $dir_name . 'css/';
return array(
'css' => $css_gen_path,
'js' => $js_gen_path,
'file_prefix' => $file_prefix,
'rtl' => $rtl,
);
}
/**
* Get assets css url
*
* @param string $file file name.
* @return string
* @since 1.1.6
*/
public function get_css_url( $file ) {
$assets_vars = wcf()->assets_vars;
$url = $assets_vars['css'] . $file . $assets_vars['rtl'] . $assets_vars['file_prefix'] . '.css';
return $url;
}
/**
* Get assets js url
*
* @param string $file file name.
* @return string
* @since 1.1.6
*/
public function get_js_url( $file ) {
$assets_vars = wcf()->assets_vars;
$url = $assets_vars['js'] . $file . $assets_vars['file_prefix'] . '.js';
return $url;
}
}
/**
* Get a specific property of an array without needing to check if that property exists.
*
* Provide a default value if you want to return a specific value if the property is not set.
*
* @param array $array Array from which the property's value should be retrieved.
* @param string $prop Name of the property to be retrieved.
* @param string $default Optional. Value that should be returned if the property is not set or empty. Defaults to null.
*
* @return null|string|mixed The value
*/
function wcf_get_prop( $array, $prop, $default = null ) {
if ( ! is_array( $array ) && ! ( is_object( $array ) && $array instanceof ArrayAccess ) ) {
return $default;
}
if ( isset( $array[ $prop ] ) ) {
$value = $array[ $prop ];
} else {
$value = '';
}
return empty( $value ) && null !== $default ? $default : $value;
}
PK [+\o
o
+ class-cartflows-learndash-compatibility.phpnu W+A ' ) ) {
$template = learndash_get_course_meta_setting( get_the_id(), 'wcf_course_template' );
} else {
$template = get_course_meta_setting( get_the_id(), 'wcf_course_template' );
}
if ( 'none' !== $template && $template ) {
$link = get_permalink( $template );
wp_safe_redirect( $link );
}
}
/**
* Add settings inside learndash settings.
*
* @param array $fields fields.
* @return mixed
*/
public function cartflows_course_setting_fields( $fields ) {
global $post;
$all_posts = array(
'none' => __( 'None', 'cartflows' ),
);
$landing_steps = get_posts(
array(
'posts_per_page' => -1,
'post_type' => CARTFLOWS_STEP_POST_TYPE,
'post_status' => 'publish',
'orderby' => 'ID',
'order' => 'DESC',
'meta_query' => array( //phpcs:ignore
array(
'key' => 'wcf-step-type',
'value' => array( 'landing', 'checkout', 'optin' ),
'compare' => 'IN',
),
),
)
);
foreach ( $landing_steps as $landing_step ) {
$all_posts[ $landing_step->ID ] = get_the_title( $landing_step->ID ) . ' ( #' . $landing_step->ID . ')';
}
$selected = get_post_meta( get_the_ID(), 'wcf_course_template', true );
$description = sprintf(
/* translators: 1: anchor start, 2: anchor close */
__( 'Non-enrolled students will redirect to the selected CartFlows template. If you have not created any Flow already, add new Flow from %1$shere%2$s.', 'cartflows' ),
'',
' '
);
$fields['sfwd-courses']['fields']['wcf_course_template'] = array(
'name' => __( 'Select CartFlows Template for this Course', 'cartflows' ),
'type' => 'select',
'initial_options' => $all_posts,
'default' => 'none',
'help_text' => $description,
'show_in_rest' => true,
'rest_args' => array(
'schema' => array(
'type' => 'string',
),
),
);
return $fields;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Learndash_Compatibility::get_instance();
PK [+\u%B %B class-cartflows-frontend.phpnu W+A logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
wcf()->logger->log( 'Only for thank you page' );
if ( wcf()->flow->is_thankyou_page_exists( $order ) ) {
if ( _is_wcf_doing_checkout_ajax() ) {
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
if ( ! $checkout_id ) {
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
}
} else {
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
}
wcf()->logger->log( 'Checkout ID : ' . $checkout_id );
if ( $checkout_id ) {
$thankyou_step_id = wcf()->flow->get_thankyou_page_id( $order );
if ( $thankyou_step_id ) {
$order_recieve_url = get_permalink( $thankyou_step_id );
$order_recieve_url = add_query_arg(
array(
'wcf-key' => $order->get_order_key(),
'wcf-order' => $order->get_id(),
),
$order_recieve_url
);
}
}
}
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
Cartflows_Helper::send_fb_response_if_enabled( $order->get_id() );
Cartflows_Tracking::send_ga_data_if_enabled( $order->get_id() );
return $order_recieve_url;
}
/**
* Cancel and redirect to checkout
*
* @param string $return_url url.
* @since 1.0.0
*/
public function redirect_to_checkout_on_cancel( $return_url ) {
if ( _is_wcf_doing_checkout_ajax() ) {
$checkout_id = wcf()->utils->get_checkout_id_from_post_data();
if ( ! $checkout_id ) {
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
}
} else {
$checkout_id = wcf()->utils->get_checkout_id_from_order( $order->get_id() );
}
if ( $checkout_id ) {
$return_url = add_query_arg(
array(
'cancel_order' => 'true',
'_wpnonce' => wp_create_nonce( 'woocommerce-cancel_order' ),
),
get_permalink( $checkout_id )
);
}
return $return_url;
}
/**
* Remove theme styles.
*
* @since 1.0.0
*/
public function remove_theme_styles() {
if ( Cartflows_Compatibility::get_instance()->is_compatibility_theme_enabled() ) {
return;
}
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
$page_template = apply_filters( 'cartflows_page_template', $page_template );
if ( 'default' === $page_template ) {
return;
}
// get all styles data.
global $wp_styles;
global $wp_scripts;
$get_stylesheet = 'themes/' . get_stylesheet() . '/';
$get_template = 'themes/' . get_template() . '/';
$remove_styles = apply_filters( 'cartflows_remove_theme_styles', true );
if ( $remove_styles ) {
// loop over all of the registered scripts..
foreach ( $wp_styles->registered as $handle => $data ) {
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
// remove it.
wp_deregister_style( $handle );
wp_dequeue_style( $handle );
}
}
}
$remove_scripts = apply_filters( 'cartflows_remove_theme_scripts', true );
if ( $remove_scripts ) {
// loop over all of the registered scripts.
foreach ( $wp_scripts->registered as $handle => $data ) {
if ( strpos( $data->src, $get_template ) !== false || strpos( $data->src, $get_stylesheet ) !== false ) {
// remove it.
wp_deregister_script( $handle );
wp_dequeue_script( $handle );
}
}
}
}
/**
* Update main order data in transient.
*
* @param array $woo_styles new styles array.
* @since 1.0.0
* @return array.
*/
public function woo_default_css( $woo_styles ) {
$woo_styles = array(
'woocommerce-layout' => array(
'src' => plugins_url( 'assets/css/woocommerce-layout.css', WC_PLUGIN_FILE ),
'deps' => '',
'version' => WC_VERSION,
'media' => 'all',
'has_rtl' => true,
),
'woocommerce-smallscreen' => array(
'src' => plugins_url( 'assets/css/woocommerce-smallscreen.css', WC_PLUGIN_FILE ),
'deps' => 'woocommerce-layout',
'version' => WC_VERSION,
'media' => 'only screen and (max-width: ' . apply_filters( 'woocommerce_style_smallscreen_breakpoint', '768px' ) . ')',
'has_rtl' => true,
),
'woocommerce-general' => array(
'src' => plugins_url( 'assets/css/woocommerce.css', WC_PLUGIN_FILE ),
'deps' => '',
'version' => WC_VERSION,
'media' => 'all',
'has_rtl' => true,
),
);
return $woo_styles;
}
/**
* Init Actions.
*
* @since 1.0.0
*/
public function init_actions() {
$this->set_flow_session();
}
/**
* Set flow session.
*
* @since 1.0.0
*/
public function set_flow_session() {
if ( wcf()->utils->is_step_post_type() ) {
global $wp;
add_action( 'wp_head', array( $this, 'noindex_flow' ) );
wcf()->utils->do_not_cache();
if ( _is_wcf_thankyou_type() ) {
/* Set key to support pixel */
if ( isset( $_GET['wcf-key'] ) ) { //phpcs:ignore
$wcf_key = sanitize_text_field( wp_unslash( $_GET['wcf-key'] ) ); //phpcs:ignore
$_GET['key'] = $wcf_key;
$_REQUEST['key'] = $wcf_key;
}
if ( isset( $_GET['wcf-order'] ) ) { //phpcs:ignore
$wcf_order = intval( wp_unslash( $_GET['wcf-order'] ) ); //phpcs:ignore
$_GET['order'] = $wcf_order;
$_REQUEST['order'] = $wcf_order;
$_GET['order-received'] = $wcf_order;
$_REQUEST['order-received'] = $wcf_order;
$wp->set_query_var( 'order-received', $wcf_order );
}
}
}
}
/**
* Add noindex, nofollow.
*
* @since 1.0.0
*/
public function noindex_flow() {
$common = Cartflows_Helper::get_common_settings();
if ( 'enable' === $common['disallow_indexing'] ) {
echo ' ';
}
}
/**
* WP Actions.
*
* @since 1.0.0
*/
public function wp_actions() {
if ( wcf()->utils->is_step_post_type() ) {
if ( ! wcf()->is_woo_active && wcf()->utils->check_is_woo_required_page() ) {
wp_die( ' This page requires WooCommerce plugin installed and activated!', 'WooCommerce Required' );
}
/* CSS Compatibility for All theme */
add_filter( 'woocommerce_enqueue_styles', array( $this, 'woo_default_css' ), 9999 );
add_action( 'wp_enqueue_scripts', array( $this, 'remove_theme_styles' ), 9999 );
add_action( 'wp_enqueue_scripts', array( $this, 'global_flow_scripts' ), 20 );
/* Load woo templates from plugin */
add_filter( 'woocommerce_locate_template', array( $this, 'override_woo_template' ), 20, 3 );
/* Add version class to body in frontend. */
add_filter( 'body_class', array( $this, 'add_cartflows_lite_version_to_body' ) );
/* Custom Script Option */
add_action( 'wp_head', array( $this, 'custom_script_option' ) );
/* Remove the action applied by the Flatsome theme */
if ( Cartflows_Compatibility::get_instance()->is_flatsome_enabled() ) {
$this->remove_flatsome_action();
}
}
}
/**
* Function for facebook pixel.
*/
public function facebook_pixel_init() {
$facebook_settings = Cartflows_Helper::get_facebook_settings();
if ( 'enable' === $facebook_settings['facebook_pixel_tracking'] ) {
$facebook_id = $facebook_settings['facebook_pixel_id'];
echo '';
$fb_script = "
";
$fb_page_view = "";
if ( 'enable' === $facebook_settings['facebook_pixel_tracking_for_site'] && ! wcf()->utils->is_step_post_type() ) {
echo $fb_script;
echo $fb_page_view;
} else {
echo $fb_script;
}
echo '';
}
}
/**
* Debug Data Setting Actions.
*
* @since 1.1.14
*/
public function debug_data_setting_actions() {
add_filter( 'cartflows_load_min_assets', array( $this, 'allow_load_minify' ) );
}
/**
* Get/Set the allow minify option.
*
* @since 1.1.14
*/
public function allow_load_minify() {
$debug_data = Cartflows_Helper::get_debug_settings();
$allow_minified = $debug_data['allow_minified_files'];
$allow_minify = false;
if ( 'enable' === $allow_minified ) {
$allow_minify = true;
}
return $allow_minify;
}
/**
* Global flow scripts.
*
* @since 1.0.0
*/
public function global_flow_scripts() {
global $post;
$flow = get_post_meta( $post->ID, 'wcf-flow-id', true );
$current_step = $post->ID;
$next_step_link = '';
$compatibility = Cartflows_Compatibility::get_instance();
if ( _is_wcf_landing_type() ) {
$next_step_id = wcf()->utils->get_next_step_id( $flow, $current_step );
$next_step_link = get_permalink( $next_step_id );
}
$page_template = get_post_meta( _get_wcf_step_id(), '_wp_page_template', true );
$fb_active = Cartflows_Helper::get_facebook_settings();
$wcf_ga_active = Cartflows_Helper::get_google_analytics_settings();
$params = array();
$ga_param = array();
if ( 'enable' === $fb_active['facebook_pixel_tracking'] && Cartflows_Loader::get_instance()->is_woo_active ) {
$params = Cartflows_Helper::prepare_cart_data_fb_response();
}
if ( 'enable' === $wcf_ga_active['enable_google_analytics'] ) {
$ga_param = Cartflows_Tracking::get_ga_items_list();
}
$localize = array(
'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),
'is_pb_preview' => $compatibility->is_page_builder_preview(),
'current_theme' => $compatibility->get_current_theme(),
'current_flow' => $flow,
'current_step' => $current_step,
'next_step' => $next_step_link,
'page_template' => $page_template,
'is_checkout_page' => _is_wcf_checkout_type(),
'params' => $params,
'fb_active' => $fb_active,
'wcf_ga_active' => $wcf_ga_active,
'ga_param' => $ga_param,
);
wp_localize_script( 'jquery', 'cartflows', apply_filters( 'global_cartflows_js_localize', $localize ) );
if ( 'default' !== $page_template ) {
wp_enqueue_style( 'wcf-normalize-frontend-global', wcf()->utils->get_css_url( 'cartflows-normalize' ), array(), CARTFLOWS_VER );
}
wp_enqueue_style( 'wcf-frontend-global', wcf()->utils->get_css_url( 'frontend' ), array(), CARTFLOWS_VER );
wp_enqueue_script(
'wcf-frontend-global',
wcf()->utils->get_js_url( 'frontend' ),
array( 'jquery', 'jquery-cookie' ),
CARTFLOWS_VER,
false
);
}
/**
* Custom Script in head.
*
* @since 1.0.0
*/
public function custom_script_option() {
/* Add custom script to header in frontend. */
$script = $this->get_custom_script();
if ( '' !== $script ) {
if ( false === strpos( $script, '';
}
echo '';
echo $script;
echo '';
}
}
/**
* Override woo templates.
*
* @param string $template new Template full path.
* @param string $template_name Template name.
* @param string $template_path Template Path.
* @since 1.1.5
* @return string.
*/
public function override_woo_template( $template, $template_name, $template_path ) {
global $woocommerce;
$_template = $template;
$plugin_path = CARTFLOWS_DIR . 'woocommerce/template/';
if ( file_exists( $plugin_path . $template_name ) ) {
$template = $plugin_path . $template_name;
}
if ( ! $template ) {
$template = $_template;
}
return $template;
}
/**
* Remove the action applied by the Flatsome theme.
*
* @since 1.1.5
* @return void.
*/
public function remove_flatsome_action() {
// Remove action where flatsome dequeued the woocommerce's default styles.
remove_action( 'wp_enqueue_scripts', 'flatsome_woocommerce_scripts_styles', 98 );
}
/**
* Add version class to body in frontend.
*
* @since 1.1.5
* @param array $classes classes.
* @return array $classes classes.
*/
public function add_cartflows_lite_version_to_body( $classes ) {
$classes[] = 'cartflows-' . CARTFLOWS_VER;
return $classes;
}
/**
* Get custom script data.
*
* @since 1.0.0
*/
public function get_custom_script() {
global $post;
$script = get_post_meta( $post->ID, 'wcf-custom-script', true );
return $script;
}
/**
* Set appropriate filter sctions.
*
* @since 1.1.14
*/
public function setup_optin_checkout_filter() {
if ( _is_wcf_doing_optin_ajax() ) {
/* Modify the optin order received url to go next step */
remove_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_to_thankyou_page' ), 10, 2 );
add_filter( 'woocommerce_get_checkout_order_received_url', array( $this, 'redirect_optin_to_next_step' ), 10, 2 );
}
}
/**
* Redirect to thank page if upsell not exists
*
* @param string $order_recieve_url url.
* @param object $order order object.
* @since 1.0.0
*/
public function redirect_optin_to_next_step( $order_recieve_url, $order ) {
/* Only for optin page */
wcf()->logger->log( 'Start-' . __CLASS__ . '::' . __FUNCTION__ );
wcf()->logger->log( 'Only for optin page' );
if ( _is_wcf_doing_optin_ajax() ) {
$optin_id = wcf()->utils->get_optin_id_from_post_data();
if ( ! $optin_id ) {
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
}
} else {
$optin_id = wcf()->utils->get_optin_id_from_order( $order->get_id() );
}
wcf()->logger->log( 'Optin ID : ' . $optin_id );
if ( $optin_id ) {
$next_step_id = wcf()->flow->get_next_step_id( $order );
if ( $next_step_id ) {
$order_recieve_url = get_permalink( $next_step_id );
$query_param = array(
'wcf-key' => $order->get_order_key(),
'wcf-order' => $order->get_id(),
);
if ( 'yes' === wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-fields' ) ) {
$fields_string = wcf()->options->get_optin_meta_value( $optin_id, 'wcf-optin-pass-specific-fields' );
$fields = array_map( 'trim', explode( ',', $fields_string ) );
if ( is_array( $fields ) ) {
$order_id = $order->get_id();
foreach ( $fields as $in => $key ) {
switch ( $key ) {
case 'first_name':
$query_param[ $key ] = $order->get_billing_first_name();
break;
case 'last_name':
$query_param[ $key ] = $order->get_billing_last_name();
break;
case 'email':
$query_param[ $key ] = $order->get_billing_email();
break;
default:
$query_param[ $key ] = get_post_meta( $order_id, '_billing_' . $key, true );
break;
}
}
}
}
$order_recieve_url = add_query_arg(
$query_param,
$order_recieve_url
);
}
}
wcf()->logger->log( 'End-' . __CLASS__ . '::' . __FUNCTION__ );
return $order_recieve_url;
}
}
/**
* Prepare if class 'Cartflows_Frontend' exist.
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Frontend::get_instance();
PK [+\?0 0 class-cartflows-cloning.phpnu W+A ID;
/**
* If post data exists, create the post duplicate
*/
if ( isset( $post ) && null !== $post ) {
/**
* New post data array
*/
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => $post->post_status,
'post_title' => $post->post_title . ' Clone',
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order,
);
/**
* Insert the post
*/
$new_flow_id = wp_insert_post( $args );
/**
* Get all current post terms ad set them to the new post
*/
// returns array of taxonomy names for post type, ex array("category", "post_tag");.
$taxonomies = get_object_taxonomies( $post->post_type );
foreach ( $taxonomies as $taxonomy ) {
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
wp_set_object_terms( $new_flow_id, $post_terms, $taxonomy, false );
}
/**
* Duplicate all post meta just in two SQL queries
*/
// @codingStandardsIgnoreStart
$post_meta_infos = $wpdb->get_results(
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
);
// @codingStandardsIgnoreEnd
if ( ! empty( $post_meta_infos ) ) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
$sql_query_sel = array();
foreach ( $post_meta_infos as $meta_info ) {
$meta_key = $meta_info->meta_key;
if ( '_wp_old_slug' === $meta_key ) {
continue;
}
$meta_value = addslashes( $meta_info->meta_value );
$sql_query_sel[] = "($new_flow_id, '$meta_key', '$meta_value')";
}
$sql_query .= implode( ',', $sql_query_sel );
// @codingStandardsIgnoreStart
$wpdb->query( $sql_query );
// @codingStandardsIgnoreEnd
}
/* Steps Cloning */
$flow_steps = get_post_meta( $post_id, 'wcf-steps', true );
$new_flow_steps = array();
/* Set Steps Empty */
update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
if ( is_array( $flow_steps ) && ! empty( $flow_steps ) ) {
foreach ( $flow_steps as $index => $step_data ) {
$step_id = $step_data['id'];
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
$step_object = get_post( $step_id );
/**
* New step post data array
*/
$step_args = array(
'comment_status' => $step_object->comment_status,
'ping_status' => $step_object->ping_status,
'post_author' => $new_post_author,
'post_content' => $step_object->post_content,
'post_excerpt' => $step_object->post_excerpt,
'post_name' => $step_object->post_name,
'post_parent' => $step_object->post_parent,
'post_password' => $step_object->post_password,
'post_status' => $step_object->post_status,
'post_title' => $step_object->post_title,
'post_type' => $step_object->post_type,
'to_ping' => $step_object->to_ping,
'menu_order' => $step_object->menu_order,
);
/**
* Insert the post
*/
$new_step_id = wp_insert_post( $step_args );
/**
* Duplicate all step meta
*/
// @codingStandardsIgnoreStart
$post_meta_infos = $wpdb->get_results(
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$step_id"
);
// @codingStandardsIgnoreEnd
if ( ! empty( $post_meta_infos ) ) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
$sql_query_sel = array();
foreach ( $post_meta_infos as $meta_info ) {
$meta_key = $meta_info->meta_key;
if ( '_wp_old_slug' === $meta_key ) {
continue;
}
$meta_value = addslashes( $meta_info->meta_value );
$sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
}
$sql_query .= implode( ',', $sql_query_sel );
// @codingStandardsIgnoreStart
$wpdb->query( $sql_query );
// @codingStandardsIgnoreEnd
}
// insert post meta.
update_post_meta( $new_step_id, 'wcf-flow-id', $new_flow_id );
update_post_meta( $new_step_id, 'wcf-step-type', $step_type );
wp_set_object_terms( $new_step_id, $step_type, CARTFLOWS_TAXONOMY_STEP_TYPE );
wp_set_object_terms( $new_step_id, 'flow-' . $new_flow_id, CARTFLOWS_TAXONOMY_STEP_FLOW );
/* Add New Flow Steps */
$new_flow_steps[] = array(
'id' => $new_step_id,
'title' => $step_object->post_title,
'type' => $step_type,
);
}
}
/* Update New Flow Step Post Meta */
update_post_meta( $new_flow_id, 'wcf-steps', $new_flow_steps );
/* Clear Page Builder Cache */
$this->clear_cache();
/**
* Redirect to the new flow edit screen
*/
wp_safe_redirect( admin_url( 'post.php?action=edit&post=' . $new_flow_id ) );
exit;
} else {
wp_die( 'Post creation failed, could not find original post: ' . $post_id );
}
}
/**
* Clone step with its meta.
*/
public function clone_step() {
global $wpdb;
if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || ( isset( $_REQUEST['action'] ) && 'cartflows_clone_step' === $_REQUEST['action'] ) ) ) {
wp_die( 'No post to duplicate has been supplied!' );
}
/*
* Nonce verification
*/
if ( ! isset( $_GET['step_clone_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['step_clone_nonce'] ) ), 'step_clone' ) ) {
return;
}
/**
* Get the original post id
*/
$post_id = ( isset( $_GET['post'] ) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
/**
* And all the original post data then
*/
$post = get_post( $post_id );
/**
* Assign current user to be the new post author
*/
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/**
* If post data exists, create the post duplicate
*/
if ( isset( $post ) && null !== $post ) {
/**
* New post data array
*/
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => $post->post_status,
'post_title' => $post->post_title . ' Clone',
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order,
);
/**
* Insert the post
*/
$new_step_id = wp_insert_post( $args );
/**
* Get all current post terms ad set them to the new post
*/
// returns array of taxonomy names for post type, ex array("category", "post_tag");.
$taxonomies = get_object_taxonomies( $post->post_type );
foreach ( $taxonomies as $taxonomy ) {
$post_terms = wp_get_object_terms( $post_id, $taxonomy, array( 'fields' => 'slugs' ) );
wp_set_object_terms( $new_step_id, $post_terms, $taxonomy, false );
}
/**
* Duplicate all post meta just in two SQL queries
*/
// @codingStandardsIgnoreStart
$post_meta_infos = $wpdb->get_results(
"SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id"
);
// @codingStandardsIgnoreEnd
if ( ! empty( $post_meta_infos ) ) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) VALUES ";
$sql_query_sel = array();
foreach ( $post_meta_infos as $meta_info ) {
$meta_key = $meta_info->meta_key;
if ( '_wp_old_slug' === $meta_key ) {
continue;
}
$meta_value = addslashes( $meta_info->meta_value );
$sql_query_sel[] = "($new_step_id, '$meta_key', '$meta_value')";
}
$sql_query .= implode( ',', $sql_query_sel );
// @codingStandardsIgnoreStart
$wpdb->query( $sql_query );
// @codingStandardsIgnoreEnd
}
$flow_id = get_post_meta( $post_id, 'wcf-flow-id', true );
$flow_steps = get_post_meta( $flow_id, 'wcf-steps', true );
$step_type = get_post_meta( $post_id, 'wcf-step-type', true );
if ( ! is_array( $flow_steps ) ) {
$flow_steps = array();
}
$flow_steps[] = array(
'id' => $new_step_id,
'title' => $post->post_title,
'type' => $step_type,
);
update_post_meta( $flow_id, 'wcf-steps', $flow_steps );
/* Clear Page Builder Cache */
$this->clear_cache();
/**
* Redirect to the new flow edit screen
*/
$redirect_url = add_query_arg( 'highlight-step-id', $new_step_id, get_edit_post_link( $flow_id, 'default' ) );
wp_safe_redirect( $redirect_url );
exit;
} else {
wp_die( 'Post creation failed, could not find original post: ' . $post_id );
}
}
/**
* Add the clone link to action list for flows row actions
*
* @param array $actions Actions array.
* @param object $post Post object.
*
* @return array
*/
public function clone_link( $actions, $post ) {
if ( current_user_can( 'edit_posts' ) && isset( $post ) && CARTFLOWS_FLOW_POST_TYPE === $post->post_type ) {
if ( isset( $actions['duplicate'] ) ) { // Duplicate page plugin remove.
unset( $actions['duplicate'] );
}
if ( isset( $actions['edit_as_new_draft'] ) ) { // Duplicate post plugin remove.
unset( $actions['edit_as_new_draft'] );
}
$actions['clone'] = '' . __( 'Clone', 'cartflows' ) . ' ';
if ( ! _is_cartflows_pro() ) {
$flow_posts = get_posts(
array(
'posts_per_page' => 4,
'post_type' => CARTFLOWS_FLOW_POST_TYPE,
'post_status' => array( 'publish', 'pending', 'draft', 'future', 'private', 'inherit', 'trash' ),
)
);
if ( is_array( $flow_posts ) ) {
$flow_count = count( $flow_posts );
if ( $flow_count > 3 || 3 === $flow_count ) {
unset( $actions['clone'] );
}
}
}
}
return $actions;
}
/**
* Clear Page Builder Cache
*/
public function clear_cache() {
// Clear 'Elementor' file cache.
if ( class_exists( '\Elementor\Plugin' ) ) {
Elementor\Plugin::$instance->files_manager->clear_cache();
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Cloning::get_instance();
PK [+\i" " class-cartflows-admin-fields.phpnu W+A ';
$output .= '' . $title . ' ';
$output .= '';
if ( ! empty( $description ) ) {
$output .= '';
}
return $output;
}
/**
* Text Field
*
* @param array $args Args.
* @return string
*/
public static function text_field( $args ) {
$id = $args['id'];
$name = $args['name'];
$title = $args['title'];
$value = $args['value'];
$description = isset( $args['description'] ) ? $args['description'] : '';
$placeholder = isset( $args['placeholder'] ) ? $args['placeholder'] : '';
$output = '';
$output .= '' . $title . ' ';
$output .= ' ';
$output .= '
';
if ( ! empty( $description ) ) {
$output .= '';
}
return $output;
}
/**
* URL Field
*
* @param array $args Args.
* @return string
*/
public static function url_field( $args ) {
$id = $args['id'];
$name = $args['name'];
$title = $args['title'];
$value = $args['value'];
$output = '';
$output .= '' . $title . ' ';
$output .= ' ';
$output .= '
';
return $output;
}
/**
* Checkbox Field
*
* @param array $args Args.
* @return string
*/
public static function checkobox_field( $args ) {
$id = $args['id'];
$name = $args['name'];
$title = $args['title'];
$value = $args['value'];
$output = '';
$output .= '';
$output .= ' ';
$output .= ' ';
$output .= $title;
$output .= ' ';
$output .= '
';
return $output;
}
/**
* Radio Field
*
* @param array $args Args.
* @return string
*/
public static function radio_field( $args ) {
$name = $args['name'];
$id = $args['id'];
$options = $args['options'];
$value = $args['value'];
$output = '';
foreach ( $options as $type => $data ) {
$output .= '';
}
return $output;
}
/**
* Select Field
*
* @since 1.1.4
*
* @param array $args Args.
* @return string
*/
public static function select_field( $args ) {
$id = $args['id'];
$name = $args['name'];
$title = $args['title'];
$description = $args['description'];
$value = $args['value'];
$options = $args['options'];
$output = '';
return $output;
}
/**
* Checkout Selection Field
*
* @param array $args Args.
* @return string
*/
public static function flow_checkout_selection_field( $args ) {
$id = $args['id'];
$name = $args['name'];
$title = $args['title'];
$value = $args['value'];
$checkout_steps = get_posts(
array(
'posts_per_page' => -1,
'post_type' => CARTFLOWS_STEP_POST_TYPE,
'post_status' => 'publish',
'orderby' => 'ID',
'order' => 'ASC',
'tax_query' => array( //phpcs:ignore
array(
'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
'field' => 'slug',
'terms' => 'checkout',
),
),
)
);
$output = '';
return $output;
}
}
PK [+\ 3 fields/typography/class-cartflows-font-families.phpnu W+A array(
'fallback' => 'Verdana, Arial, sans-serif',
'variants' => array(
'300',
'400',
'700',
),
),
'Verdana' => array(
'fallback' => 'Helvetica, Arial, sans-serif',
'variants' => array(
'300',
'400',
'700',
),
),
'Arial' => array(
'fallback' => 'Helvetica, Verdana, sans-serif',
'variants' => array(
'300',
'400',
'700',
),
),
'Times' => array(
'fallback' => 'Georgia, serif',
'variants' => array(
'300',
'400',
'700',
),
),
'Georgia' => array(
'fallback' => 'Times, serif',
'variants' => array(
'300',
'400',
'700',
),
),
'Courier' => array(
'fallback' => 'monospace',
'variants' => array(
'300',
'400',
'700',
),
),
);
}
return apply_filters( 'cartflows_system_fonts', self::$system_fonts );
}
/**
* Custom Fonts
*
* @since 1.0.0
*
* @return Array All the custom fonts in CartFlows
*/
public static function get_custom_fonts() {
$custom_fonts = array();
return apply_filters( 'cartflows_custom_fonts', $custom_fonts );
}
/**
* Google Fonts used in CartFlows.
* Array is generated from the google-fonts.json file.
*
* @since 1.0.0
*
* @return Array Array of Google Fonts.
*/
public static function get_google_fonts() {
if ( empty( self::$google_fonts ) ) {
$google_fonts_file = CARTFLOWS_DIR . 'classes/fields/typography/google-fonts.json';
if ( ! file_exists( $google_fonts_file ) ) {
return array();
}
global $wp_filesystem;
if ( empty( $wp_filesystem ) ) {
require_once ABSPATH . '/wp-admin/includes/file.php';
WP_Filesystem();
}
$file_contants = $wp_filesystem->get_contents( $google_fonts_file );
$google_fonts_json = json_decode( $file_contants, 1 );
if ( is_array( $google_fonts_json ) || is_object( $google_fonts_json ) ) {
foreach ( $google_fonts_json as $key => $font ) {
$name = key( $font );
foreach ( $font[ $name ] as $font_key => $single_font ) {
if ( 'variants' === $font_key ) {
foreach ( $single_font as $variant_key => $variant ) {
if ( 'regular' == $variant ) {
$font[ $name ][ $font_key ][ $variant_key ] = '400';
}
}
}
self::$google_fonts[ $name ] = array_values( $font[ $name ] );
}
}
}
}
return apply_filters( 'cartflows_google_fonts', self::$google_fonts );
}
/**
* Render Fonts
*
* @param array $post_id post ID.
* @return void
*/
public static function render_fonts( $post_id ) {
$google_font_url = get_post_meta( $post_id, 'wcf-field-google-font-url', true );
// @todo Avoid the URL generator from the JS and remove the below static URL check condition.
if ( empty( $google_font_url ) || '//fonts.googleapis.com/css?family=' == $google_font_url ) {
return;
}
wp_enqueue_style( 'cartflows-google-fonts', esc_url( $google_font_url ), array(), CARTFLOWS_VER, 'all' );
}
/**
* Get string between
*
* @param string $string Input string.
* @param string $start First string.
* @param string $end Last string.
* @return string string.
*/
public static function get_string_between( $string, $start, $end ) {
$string = ' ' . $string;
$ini = strpos( $string, $start );
if ( 0 == $ini ) {
return '';
}
$ini += strlen( $start );
$len = strpos( $string, $end, $ini ) - $ini;
return substr( $string, $ini, $len );
}
/**
* Google Font URL
* Combine multiple google font in one URL
*
* @link https://shellcreeper.com/?p=1476
* @param array $fonts Google Fonts array.
* @param array $subsets Font's Subsets array.
*
* @return string
*/
public static function google_fonts_url( $fonts, $subsets = array() ) {
/* URL */
$base_url = '//fonts.googleapis.com/css';
$font_args = array();
$family = array();
$fonts = apply_filters( 'cartflows_google_fonts', $fonts );
/* Format Each Font Family in Array */
foreach ( $fonts as $font_name => $font_weight ) {
$font_name = str_replace( ' ', '+', $font_name );
if ( ! empty( $font_weight ) ) {
if ( is_array( $font_weight ) ) {
$font_weight = implode( ',', $font_weight );
}
$font_family = explode( ',', $font_name );
$font_family = str_replace( "'", '', wcf_get_prop( $font_family, 0 ) );
$family[] = trim( $font_family . ':' . urlencode( trim( $font_weight ) ) );//phpcs:ignore
} else {
$family[] = trim( $font_name );
}
}
/* Only return URL if font family defined. */
if ( ! empty( $family ) ) {
/* Make Font Family a String */
$family = implode( '|', $family );
/* Add font family in args */
$font_args['family'] = $family;
/* Add font subsets in args */
if ( ! empty( $subsets ) ) {
/* format subsets to string */
if ( is_array( $subsets ) ) {
$subsets = implode( ',', $subsets );
}
$font_args['subset'] = urlencode( trim( $subsets ) );//phpcs:ignore
}
return add_query_arg( $font_args, $base_url );
}
return '';
}
/**
* Generate Google Font URL from the post meta.
*
* @param integer $post_id Post ID.
* @return string Google URL if post meta is set.
*/
public function generate_google_url( $post_id ) {
$font_weight = array();
$fields = get_post_meta( $post_id );
foreach ( $fields as $key => $value ) {
if ( false !== strpos( $key, 'font-family' ) ) {
$font_family = ! empty( $value[0] ) ? self::get_string_between( $value[0], '\'', '\'' ) : '';
$font_list[ $font_family ] = array();
}
}
$google_fonts = array();
$font_subset = array();
$system_fonts = self::get_system_fonts();
$get_google_fonts = self::get_google_fonts();
$variants = array( 'variants' => array( 400 ) );
foreach ( $font_list as $name => $font ) {
if ( ! empty( $name ) && ! isset( $system_fonts[ $name ] ) ) {
if ( isset( $get_google_fonts[ $name ] ) ) {
$variants = $get_google_fonts[ $name ][0];
}
// Add font variants.
$google_fonts[ $name ] = $variants;
// Add Subset.
$subset = apply_filters( 'cartflows_font_subset', '', $name );
if ( ! empty( $subset ) ) {
$font_subset[] = $subset;
}
}
}
return self::google_fonts_url( $google_fonts, $font_subset );
}
}
endif;
PK [+\< < # fields/typography/google-fonts.jsonnu W+A [
{
"ABeeZee": {
"variants": [
"regular",
"italic"
],
"category": "sans-serif"
}
},
{
"Abel": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Abhaya Libre": {
"variants": [
"regular",
"500",
"600",
"700",
"800"
],
"category": "serif"
}
},
{
"Abril Fatface": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Aclonica": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Acme": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Actor": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Adamina": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Advent Pro": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Aguafina Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Akronim": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Aladin": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Aldrich": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Alef": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Alegreya": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Alegreya SC": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Alegreya Sans": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Alegreya Sans SC": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Alex Brush": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Alfa Slab One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Alice": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Alike": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Alike Angular": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Allan": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Allerta": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Allerta Stencil": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Allura": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Almendra": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Almendra Display": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Almendra SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Amarante": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Amaranth": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Amatic SC": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Amethysta": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Amiko": {
"variants": [
"regular",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Amiri": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Amita": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Anaheim": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Andada": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Andika": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Angkor": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Annie Use Your Telescope": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Anonymous Pro": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"Antic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Antic Didone": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Antic Slab": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Anton": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Arapey": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Arbutus": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Arbutus Slab": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Architects Daughter": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Archivo": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Archivo Black": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Archivo Narrow": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Aref Ruqaa": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Arima Madurai": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"700",
"800",
"900"
],
"category": "display"
}
},
{
"Arimo": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Arizonia": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Armata": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Arsenal": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Artifika": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Arvo": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Arya": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Asap": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Asap Condensed": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Asar": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Asset": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Assistant": {
"variants": [
"200",
"300",
"regular",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Astloch": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Asul": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Athiti": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Atma": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "display"
}
},
{
"Atomic Age": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Aubrey": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Audiowide": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Autour One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Average": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Average Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Averia Gruesa Libre": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Averia Libre": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Averia Sans Libre": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Averia Serif Libre": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Bad Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Bahiana": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bai Jamjuree": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Baloo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Bhai": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Bhaijaan": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Bhaina": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Chettan": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Da": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Paaji": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Tamma": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Tammudu": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Baloo Thambi": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Balthazar": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Bangers": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Barlow": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Barlow Condensed": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Barlow Semi Condensed": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Barrio": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Basic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Battambang": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Baumans": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bayon": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Belgrano": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Bellefair": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Belleza": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"BenchNine": {
"variants": [
"300",
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Bentham": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Berkshire Swash": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Bevan": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bigelow Rules": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bigshot One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bilbo": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Bilbo Swash Caps": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"BioRhyme": {
"variants": [
"200",
"300",
"regular",
"700",
"800"
],
"category": "serif"
}
},
{
"BioRhyme Expanded": {
"variants": [
"200",
"300",
"regular",
"700",
"800"
],
"category": "serif"
}
},
{
"Biryani": {
"variants": [
"200",
"300",
"regular",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Bitter": {
"variants": [
"regular",
"italic",
"700"
],
"category": "serif"
}
},
{
"Black And White Picture": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Black Han Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Black Ops One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bokor": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bonbon": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Boogaloo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bowlby One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bowlby One SC": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Brawler": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Bree Serif": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Bubblegum Sans": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bubbler One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Buda": {
"variants": [
"300"
],
"category": "display"
}
},
{
"Buenard": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Bungee": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bungee Hairline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bungee Inline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bungee Outline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Bungee Shade": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Butcherman": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Butterfly Kids": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Cabin": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Cabin Condensed": {
"variants": [
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Cabin Sketch": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Caesar Dressing": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cagliostro": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Cairo": {
"variants": [
"200",
"300",
"regular",
"600",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Calligraffitti": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Cambay": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Cambo": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Candal": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Cantarell": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Cantata One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Cantora One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Capriola": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Cardo": {
"variants": [
"regular",
"italic",
"700"
],
"category": "serif"
}
},
{
"Carme": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Carrois Gothic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Carrois Gothic SC": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Carter One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Catamaran": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Caudex": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Caveat": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Caveat Brush": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Cedarville Cursive": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ceviche One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Chakra Petch": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Changa": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Changa One": {
"variants": [
"regular",
"italic"
],
"category": "display"
}
},
{
"Chango": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Charmonman": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Chathura": {
"variants": [
"100",
"300",
"regular",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Chau Philomene One": {
"variants": [
"regular",
"italic"
],
"category": "sans-serif"
}
},
{
"Chela One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Chelsea Market": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Chenla": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cherry Cream Soda": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cherry Swash": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Chewy": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Chicle": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Chivo": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Chonburi": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cinzel": {
"variants": [
"regular",
"700",
"900"
],
"category": "serif"
}
},
{
"Cinzel Decorative": {
"variants": [
"regular",
"700",
"900"
],
"category": "display"
}
},
{
"Clicker Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Coda": {
"variants": [
"regular",
"800"
],
"category": "display"
}
},
{
"Coda Caption": {
"variants": [
"800"
],
"category": "sans-serif"
}
},
{
"Codystar": {
"variants": [
"300",
"regular"
],
"category": "display"
}
},
{
"Coiny": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Combo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Comfortaa": {
"variants": [
"300",
"regular",
"700"
],
"category": "display"
}
},
{
"Coming Soon": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Concert One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Condiment": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Content": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Contrail One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Convergence": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Cookie": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Copse": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Corben": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Cormorant": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Cormorant Garamond": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Cormorant Infant": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Cormorant SC": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Cormorant Unicase": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Cormorant Upright": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Courgette": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Cousine": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"Coustard": {
"variants": [
"regular",
"900"
],
"category": "serif"
}
},
{
"Covered By Your Grace": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Crafty Girls": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Creepster": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Crete Round": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Crimson Text": {
"variants": [
"regular",
"italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Croissant One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Crushed": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cuprum": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Cute Font": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Cutive": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Cutive Mono": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"Damion": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Dancing Script": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Dangrek": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"David Libre": {
"variants": [
"regular",
"500",
"700"
],
"category": "serif"
}
},
{
"Dawning of a New Day": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Days One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Dekko": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Delius": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Delius Swash Caps": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Delius Unicase": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Della Respira": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Denk One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Devonshire": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Dhurjati": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Didact Gothic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Diplomata": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Diplomata SC": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Do Hyeon": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Dokdo": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Domine": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Donegal One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Doppio One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Dorsa": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Dosis": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Dr Sugiyama": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Duru Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Dynalight": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"EB Garamond": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "serif"
}
},
{
"Eagle Lake": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"East Sea Dokdo": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Eater": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Economica": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Eczar": {
"variants": [
"regular",
"500",
"600",
"700",
"800"
],
"category": "serif"
}
},
{
"El Messiri": {
"variants": [
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Electrolize": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Elsie": {
"variants": [
"regular",
"900"
],
"category": "display"
}
},
{
"Elsie Swash Caps": {
"variants": [
"regular",
"900"
],
"category": "display"
}
},
{
"Emblema One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Emilys Candy": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Encode Sans": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Encode Sans Condensed": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Encode Sans Expanded": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Encode Sans Semi Condensed": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Encode Sans Semi Expanded": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Engagement": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Englebert": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Enriqueta": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Erica One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Esteban": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Euphoria Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ewert": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Exo": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Exo 2": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Expletus Sans": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Fahkwang": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Fanwood Text": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Farsan": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fascinate": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fascinate Inline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Faster One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fasthand": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Fauna One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Faustina": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Federant": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Federo": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Felipa": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Fenix": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Finger Paint": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fira Mono": {
"variants": [
"regular",
"500",
"700"
],
"category": "monospace"
}
},
{
"Fira Sans": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Fira Sans Condensed": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Fira Sans Extra Condensed": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Fjalla One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Fjord One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Flamenco": {
"variants": [
"300",
"regular"
],
"category": "display"
}
},
{
"Flavors": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fondamento": {
"variants": [
"regular",
"italic"
],
"category": "handwriting"
}
},
{
"Fontdiner Swanky": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Forum": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Francois One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Frank Ruhl Libre": {
"variants": [
"300",
"regular",
"500",
"700",
"900"
],
"category": "serif"
}
},
{
"Freckle Face": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fredericka the Great": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fredoka One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Freehand": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fresca": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Frijole": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fruktur": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Fugaz One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"GFS Didot": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"GFS Neohellenic": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Gabriela": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Gaegu": {
"variants": [
"300",
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Gafata": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Galada": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Galdeano": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Galindo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gamja Flower": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Gentium Basic": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Gentium Book Basic": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Geo": {
"variants": [
"regular",
"italic"
],
"category": "sans-serif"
}
},
{
"Geostar": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Geostar Fill": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Germania One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gidugu": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Gilda Display": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Give You Glory": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Glass Antiqua": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Glegoo": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Gloria Hallelujah": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Goblin One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gochi Hand": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Gorditas": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Gothic A1": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Goudy Bookletter 1911": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Graduate": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Grand Hotel": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Gravitas One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Great Vibes": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Griffy": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gruppo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gudea": {
"variants": [
"regular",
"italic",
"700"
],
"category": "sans-serif"
}
},
{
"Gugi": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Gurajada": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Habibi": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Halant": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Hammersmith One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Hanalei": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Hanalei Fill": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Handlee": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Hanuman": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Happy Monkey": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Harmattan": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Headland One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Heebo": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Henny Penny": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Herr Von Muellerhoff": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Hi Melody": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Hind": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Hind Guntur": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Hind Madurai": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Hind Siliguri": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Hind Vadodara": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Holtwood One SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Homemade Apple": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Homenaje": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"IBM Plex Mono": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"IBM Plex Sans": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"IBM Plex Sans Condensed": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"IBM Plex Serif": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"IM Fell DW Pica": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"IM Fell DW Pica SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"IM Fell Double Pica": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"IM Fell Double Pica SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"IM Fell English": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"IM Fell English SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"IM Fell French Canon": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"IM Fell French Canon SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"IM Fell Great Primer": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"IM Fell Great Primer SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Iceberg": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Iceland": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Imprima": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Inconsolata": {
"variants": [
"regular",
"700"
],
"category": "monospace"
}
},
{
"Inder": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Indie Flower": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Inika": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Inknut Antiqua": {
"variants": [
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "serif"
}
},
{
"Irish Grover": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Istok Web": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Italiana": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Italianno": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Itim": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Jacques Francois": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Jacques Francois Shadow": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Jaldi": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Jim Nightshade": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Jockey One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Jolly Lodger": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Jomhuria": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Josefin Sans": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Josefin Slab": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Joti One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Jua": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Judson": {
"variants": [
"regular",
"italic",
"700"
],
"category": "serif"
}
},
{
"Julee": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Julius Sans One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Junge": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Jura": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Just Another Hand": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Just Me Again Down Here": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"K2D": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "sans-serif"
}
},
{
"Kadwa": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Kalam": {
"variants": [
"300",
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Kameron": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Kanit": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Kantumruy": {
"variants": [
"300",
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Karla": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Karma": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Katibeh": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kaushan Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Kavivanar": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Kavoon": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kdam Thmor": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Keania One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kelly Slab": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kenia": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Khand": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Khmer": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Khula": {
"variants": [
"300",
"regular",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Kirang Haerang": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kite One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Knewave": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"KoHo": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Kodchasan": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Kosugi": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Kosugi Maru": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Kotta One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Koulen": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kranky": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kreon": {
"variants": [
"300",
"regular",
"700"
],
"category": "serif"
}
},
{
"Kristi": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Krona One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Krub": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Kumar One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kumar One Outline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Kurale": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"La Belle Aurore": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Laila": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Lakki Reddy": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Lalezar": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lancelot": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lateef": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Lato": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"League Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Leckerli One": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ledger": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Lekton": {
"variants": [
"regular",
"italic",
"700"
],
"category": "sans-serif"
}
},
{
"Lemon": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lemonada": {
"variants": [
"300",
"regular",
"600",
"700"
],
"category": "display"
}
},
{
"Libre Barcode 128": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Barcode 128 Text": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Barcode 39": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Barcode 39 Extended": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Barcode 39 Extended Text": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Barcode 39 Text": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Libre Baskerville": {
"variants": [
"regular",
"italic",
"700"
],
"category": "serif"
}
},
{
"Libre Franklin": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Life Savers": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Lilita One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lily Script One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Limelight": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Linden Hill": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Lobster": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lobster Two": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Londrina Outline": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Londrina Shadow": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Londrina Sketch": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Londrina Solid": {
"variants": [
"100",
"300",
"regular",
"900"
],
"category": "display"
}
},
{
"Lora": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Love Ya Like A Sister": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Loved by the King": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Lovers Quarrel": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Luckiest Guy": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Lusitana": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Lustria": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"M PLUS 1p": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"M PLUS Rounded 1c": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Macondo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Macondo Swash Caps": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Mada": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Magra": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Maiden Orange": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Maitree": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Mako": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Mali": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "handwriting"
}
},
{
"Mallanna": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Mandali": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Manuale": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Marcellus": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Marcellus SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Marck Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Margarine": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Markazi Text": {
"variants": [
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Marko One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Marmelad": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Martel": {
"variants": [
"200",
"300",
"regular",
"600",
"700",
"800",
"900"
],
"category": "serif"
}
},
{
"Martel Sans": {
"variants": [
"200",
"300",
"regular",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Marvel": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Mate": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Mate SC": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Maven Pro": {
"variants": [
"regular",
"500",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"McLaren": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Meddon": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"MedievalSharp": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Medula One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Meera Inimai": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Megrim": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Meie Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Merienda": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Merienda One": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Merriweather": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Merriweather Sans": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "sans-serif"
}
},
{
"Metal": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Metal Mania": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Metamorphous": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Metrophobic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Michroma": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Milonga": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Miltonian": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Miltonian Tattoo": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Mina": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Miniver": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Miriam Libre": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Mirza": {
"variants": [
"regular",
"500",
"600",
"700"
],
"category": "display"
}
},
{
"Miss Fajardose": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mitr": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Modak": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Modern Antiqua": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Mogra": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Molengo": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Molle": {
"variants": [
"italic"
],
"category": "handwriting"
}
},
{
"Monda": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Monofett": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Monoton": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Monsieur La Doulaise": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Montaga": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Montez": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Montserrat": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Montserrat Alternates": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Montserrat Subrayada": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Moul": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Moulpali": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Mountains of Christmas": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Mouse Memoirs": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Mr Bedfort": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mr Dafoe": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mr De Haviland": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mrs Saint Delafield": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mrs Sheppards": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Mukta": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Mukta Mahee": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Mukta Malar": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Mukta Vaani": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Muli": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Mystery Quest": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"NTR": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Nanum Brush Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Nanum Gothic": {
"variants": [
"regular",
"700",
"800"
],
"category": "sans-serif"
}
},
{
"Nanum Gothic Coding": {
"variants": [
"regular",
"700"
],
"category": "monospace"
}
},
{
"Nanum Myeongjo": {
"variants": [
"regular",
"700",
"800"
],
"category": "serif"
}
},
{
"Nanum Pen Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Neucha": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Neuton": {
"variants": [
"200",
"300",
"regular",
"italic",
"700",
"800"
],
"category": "serif"
}
},
{
"New Rocker": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"News Cycle": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Niconne": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Niramit": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Nixie One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nobile": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Nokora": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Norican": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Nosifer": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Notable": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Nothing You Could Do": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Noticia Text": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Noto Sans": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Noto Sans JP": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Noto Sans KR": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Noto Serif": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Noto Serif JP": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Noto Serif KR": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Nova Cut": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Flat": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Mono": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"Nova Oval": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Round": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Script": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Slim": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Nova Square": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Numans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Nunito": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Nunito Sans": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Odor Mean Chey": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Offside": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Old Standard TT": {
"variants": [
"regular",
"italic",
"700"
],
"category": "serif"
}
},
{
"Oldenburg": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Oleo Script": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Oleo Script Swash Caps": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Open Sans": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "sans-serif"
}
},
{
"Open Sans Condensed": {
"variants": [
"300",
"300italic",
"700"
],
"category": "sans-serif"
}
},
{
"Oranienbaum": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Orbitron": {
"variants": [
"regular",
"500",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Oregano": {
"variants": [
"regular",
"italic"
],
"category": "display"
}
},
{
"Orienta": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Original Surfer": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Oswald": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Over the Rainbow": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Overlock": {
"variants": [
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "display"
}
},
{
"Overlock SC": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Overpass": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Overpass Mono": {
"variants": [
"300",
"regular",
"600",
"700"
],
"category": "monospace"
}
},
{
"Ovo": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Oxygen": {
"variants": [
"300",
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Oxygen Mono": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"PT Mono": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"PT Sans": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"PT Sans Caption": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"PT Sans Narrow": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"PT Serif": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"PT Serif Caption": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Pacifico": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Padauk": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Palanquin": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Palanquin Dark": {
"variants": [
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Pangolin": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Paprika": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Parisienne": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Passero One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Passion One": {
"variants": [
"regular",
"700",
"900"
],
"category": "display"
}
},
{
"Pathway Gothic One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Patrick Hand": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Patrick Hand SC": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Pattaya": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Patua One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Pavanam": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Paytone One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Peddana": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Peralta": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Permanent Marker": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Petit Formal Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Petrona": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Philosopher": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Piedra": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Pinyon Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Pirata One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Plaster": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Play": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Playball": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Playfair Display": {
"variants": [
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Playfair Display SC": {
"variants": [
"regular",
"italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Podkova": {
"variants": [
"regular",
"500",
"600",
"700",
"800"
],
"category": "serif"
}
},
{
"Poiret One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Poller One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Poly": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Pompiere": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Pontano Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Poor Story": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Poppins": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Port Lligat Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Port Lligat Slab": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Pragati Narrow": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Prata": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Preahvihear": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Press Start 2P": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Pridi": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Princess Sofia": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Prociono": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Prompt": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Prosto One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Proza Libre": {
"variants": [
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "sans-serif"
}
},
{
"Puritan": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Purple Purse": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Quando": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Quantico": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Quattrocento": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Quattrocento Sans": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Questrial": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Quicksand": {
"variants": [
"300",
"regular",
"500",
"700"
],
"category": "sans-serif"
}
},
{
"Quintessential": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Qwigley": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Racing Sans One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Radley": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Rajdhani": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Rakkas": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Raleway": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Raleway Dots": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Ramabhadra": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ramaraja": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Rambla": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Rammetto One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Ranchers": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Rancho": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ranga": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Rasa": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Rationale": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ravi Prakash": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Redressed": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Reem Kufi": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Reenie Beanie": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Revalia": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Rhodium Libre": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Ribeye": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Ribeye Marrow": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Righteous": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Risque": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Roboto": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Roboto Condensed": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Roboto Mono": {
"variants": [
"100",
"100italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"Roboto Slab": {
"variants": [
"100",
"300",
"regular",
"700"
],
"category": "serif"
}
},
{
"Rochester": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Rock Salt": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Rokkitt": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "serif"
}
},
{
"Romanesco": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ropa Sans": {
"variants": [
"regular",
"italic"
],
"category": "sans-serif"
}
},
{
"Rosario": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Rosarivo": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Rouge Script": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Rozha One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Rubik": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Rubik Mono One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ruda": {
"variants": [
"regular",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Rufina": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Ruge Boogie": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Ruluko": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Rum Raisin": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ruslan Display": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Russo One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ruthie": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Rye": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sacramento": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Sahitya": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Sail": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Saira": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Saira Condensed": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Saira Extra Condensed": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Saira Semi Condensed": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Salsa": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sanchez": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Sancreek": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sansita": {
"variants": [
"regular",
"italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Sarala": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Sarina": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sarpanch": {
"variants": [
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Satisfy": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Sawarabi Gothic": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Sawarabi Mincho": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Scada": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Scheherazade": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Schoolbell": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Scope One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Seaweed Script": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Secular One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Sedgwick Ave": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Sedgwick Ave Display": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Sevillana": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Seymour One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Shadows Into Light": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Shadows Into Light Two": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Shanti": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Share": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "display"
}
},
{
"Share Tech": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Share Tech Mono": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"Shojumaru": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Short Stack": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Shrikhand": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Siemreap": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sigmar One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Signika": {
"variants": [
"300",
"regular",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Signika Negative": {
"variants": [
"300",
"regular",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Simonetta": {
"variants": [
"regular",
"italic",
"900",
"900italic"
],
"category": "display"
}
},
{
"Sintony": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Sirin Stencil": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Six Caps": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Skranji": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Slabo 13px": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Slabo 27px": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Slackey": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Smokum": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Smythe": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sniglet": {
"variants": [
"regular",
"800"
],
"category": "display"
}
},
{
"Snippet": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Snowburst One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sofadi One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sofia": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Song Myung": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Sonsie One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sorts Mill Goudy": {
"variants": [
"regular",
"italic"
],
"category": "serif"
}
},
{
"Source Code Pro": {
"variants": [
"200",
"300",
"regular",
"500",
"600",
"700",
"900"
],
"category": "monospace"
}
},
{
"Source Sans Pro": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "sans-serif"
}
},
{
"Source Serif Pro": {
"variants": [
"regular",
"600",
"700"
],
"category": "serif"
}
},
{
"Space Mono": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"Special Elite": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Spectral": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "serif"
}
},
{
"Spectral SC": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic"
],
"category": "serif"
}
},
{
"Spicy Rice": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Spinnaker": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Spirax": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Squada One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sree Krushnadevaraya": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Sriracha": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Srisakdi": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Stalemate": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Stalinist One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Stardos Stencil": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Stint Ultra Condensed": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Stint Ultra Expanded": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Stoke": {
"variants": [
"300",
"regular"
],
"category": "serif"
}
},
{
"Strait": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Stylish": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Sue Ellen Francisco": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Suez One": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Sumana": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Sunflower": {
"variants": [
"300",
"500",
"700"
],
"category": "sans-serif"
}
},
{
"Sunshiney": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Supermercado One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Sura": {
"variants": [
"regular",
"700"
],
"category": "serif"
}
},
{
"Suranna": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Suravaram": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Suwannaphum": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Swanky and Moo Moo": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Syncopate": {
"variants": [
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Tajawal": {
"variants": [
"200",
"300",
"regular",
"500",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Tangerine": {
"variants": [
"regular",
"700"
],
"category": "handwriting"
}
},
{
"Taprom": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Tauri": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Taviraj": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Teko": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "sans-serif"
}
},
{
"Telex": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Tenali Ramakrishna": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Tenor Sans": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Text Me One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"The Girl Next Door": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Tienne": {
"variants": [
"regular",
"700",
"900"
],
"category": "serif"
}
},
{
"Tillana": {
"variants": [
"regular",
"500",
"600",
"700",
"800"
],
"category": "handwriting"
}
},
{
"Timmana": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Tinos": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Titan One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Titillium Web": {
"variants": [
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"900"
],
"category": "sans-serif"
}
},
{
"Trade Winds": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Trirong": {
"variants": [
"100",
"100italic",
"200",
"200italic",
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic",
"800",
"800italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Trocchi": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Trochut": {
"variants": [
"regular",
"italic",
"700"
],
"category": "display"
}
},
{
"Trykker": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Tulpen One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Ubuntu": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"700",
"700italic"
],
"category": "sans-serif"
}
},
{
"Ubuntu Condensed": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Ubuntu Mono": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "monospace"
}
},
{
"Ultra": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Uncial Antiqua": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Underdog": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Unica One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"UnifrakturCook": {
"variants": [
"700"
],
"category": "display"
}
},
{
"UnifrakturMaguntia": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Unkempt": {
"variants": [
"regular",
"700"
],
"category": "display"
}
},
{
"Unlock": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Unna": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"VT323": {
"variants": [
"regular"
],
"category": "monospace"
}
},
{
"Vampiro One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Varela": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Varela Round": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Vast Shadow": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Vesper Libre": {
"variants": [
"regular",
"500",
"700",
"900"
],
"category": "serif"
}
},
{
"Vibur": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Vidaloka": {
"variants": [
"regular"
],
"category": "serif"
}
},
{
"Viga": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Voces": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Volkhov": {
"variants": [
"regular",
"italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Vollkorn": {
"variants": [
"regular",
"italic",
"600",
"600italic",
"700",
"700italic",
"900",
"900italic"
],
"category": "serif"
}
},
{
"Vollkorn SC": {
"variants": [
"regular",
"600",
"700",
"900"
],
"category": "serif"
}
},
{
"Voltaire": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Waiting for the Sunrise": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Wallpoet": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Walter Turncoat": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Warnes": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Wellfleet": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Wendy One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Wire One": {
"variants": [
"regular"
],
"category": "sans-serif"
}
},
{
"Work Sans": {
"variants": [
"100",
"200",
"300",
"regular",
"500",
"600",
"700",
"800",
"900"
],
"category": "sans-serif"
}
},
{
"Yanone Kaffeesatz": {
"variants": [
"200",
"300",
"regular",
"700"
],
"category": "sans-serif"
}
},
{
"Yantramanav": {
"variants": [
"100",
"300",
"regular",
"500",
"700",
"900"
],
"category": "sans-serif"
}
},
{
"Yatra One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Yellowtail": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Yeon Sung": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Yeseva One": {
"variants": [
"regular"
],
"category": "display"
}
},
{
"Yesteryear": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Yrsa": {
"variants": [
"300",
"regular",
"500",
"600",
"700"
],
"category": "serif"
}
},
{
"Zeyada": {
"variants": [
"regular"
],
"category": "handwriting"
}
},
{
"Zilla Slab": {
"variants": [
"300",
"300italic",
"regular",
"italic",
"500",
"500italic",
"600",
"600italic",
"700",
"700italic"
],
"category": "serif"
}
},
{
"Zilla Slab Highlight": {
"variants": [
"regular",
"700"
],
"category": "display"
}
}
]PK [+\n]< < class-cartflows-update.phpnu W+A logger_files();
if ( version_compare( $saved_version, '1.1.22', '<' ) ) {
update_option( 'wcf_setup_skipped', true );
}
if ( version_compare( $saved_version, '1.2.0', '<' ) ) {
$this->changed_wp_templates();
}
// Update auto saved version number.
update_option( 'cartflows-version', CARTFLOWS_VER );
do_action( 'cartflows_update_after' );
}
/**
* Loading logger files.
*
* @since 1.0.0
* @return void
*/
public function logger_files() {
if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
$upload_dir = wp_upload_dir( null, false );
define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
}
wcf()->create_files();
}
/**
* Init
*
* @since 1.0.0
* @return void
*/
public function changed_wp_templates() {
global $wpdb;
$query_results = $wpdb->get_results(
$wpdb->prepare(
"SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} LEFT JOIN {$wpdb->postmeta} ON ( {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id )
where {$wpdb->posts}.post_type = %s AND {$wpdb->postmeta}.meta_key = %s AND {$wpdb->postmeta}.meta_value != %s AND {$wpdb->postmeta}.meta_value != %s",
'cartflows_step',
'_wp_page_template',
'cartflows-canvas',
'cartflows-default'
)
); // db call ok; no-cache ok.
if ( is_array( $query_results ) && ! empty( $query_results ) ) {
require_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-change-template-batch.php';
wcf()->logger->log( '(✓) Update Templates BATCH Started!' );
$change_template_batch = new Cartflows_Change_Template_Batch();
foreach ( $query_results as $query_result ) {
wcf()->logger->log( '(✓) POST ID ' . $query_result->ID );
$change_template_batch->push_to_queue( $query_result->ID );
}
$change_template_batch->save()->dispatch();
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Update::get_instance();
endif;
PK [+\Hk_ k_ class-cartflows-wizard.phpnu W+A
steps = array(
'basic-config' => array(
'name' => __( 'Welcome', 'cartflows' ),
'view' => array( $this, 'welcome_step' ),
'handler' => array( $this, 'welcome_step_save' ),
),
'page-builder' => array(
'name' => __( 'Page Builder', 'cartflows' ),
'view' => array( $this, 'page_builder_step' ),
),
'checkout' => array(
'name' => __( 'Checkout', 'cartflows' ),
'view' => array( $this, 'checkout_step' ),
),
'training' => array(
'name' => __( 'Training', 'cartflows' ),
'view' => array( $this, 'training_step' ),
),
'setup-ready' => array(
'name' => __( 'Ready!', 'cartflows' ),
'view' => array( $this, 'ready_step' ),
'handler' => '',
),
);
$this->step = isset( $_GET['step'] ) ? sanitize_text_field( $_GET['step'] ) : current( array_keys( $this->steps ) ); //phpcs:ignore
wp_enqueue_style( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/css/setup-wizard.css', array( 'dashicons' ), CARTFLOWS_VER );
wp_style_add_data( 'cartflows-setup', 'rtl', 'replace' );
wp_enqueue_script( 'cartflows-setup', CARTFLOWS_URL . 'admin/assets/js/setup-wizard.js', array( 'jquery', 'wp-util', 'updates' ), CARTFLOWS_VER, false );
wp_localize_script( 'cartflows-setup', 'cartflows_setup_vars', self::localize_vars() );
wp_enqueue_media();
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { //phpcs:ignore
call_user_func( $this->steps[ $this->step ]['handler'] );
}
ob_start();
$this->setup_wizard_header();
$this->setup_wizard_steps();
$this->setup_wizard_content();
$this->setup_wizard_footer();
exit;
}
/**
* Get current step slug
*/
public function get_current_step_slug() {
$keys = array_keys( $this->steps );
return $keys[ array_search( $this->step, array_keys( $this->steps ), true ) ];
}
/**
* Get previous step link
*/
public function get_prev_step_link() {
$keys = array_keys( $this->steps );
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) - 1 ] );
}
/**
* Get next step link
*/
public function get_next_step_link() {
$keys = array_keys( $this->steps );
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ), true ) + 1 ] );
}
/**
* Get next step link
*/
public function get_next_step_plain_link() {
$keys = array_keys( $this->steps );
$step_index = array_search( $this->step, $keys, true );
$step_index = ( count( $keys ) == $step_index + 1 ) ? $step_index : $step_index + 1;
$step = $keys[ $step_index ];
return admin_url( 'index.php?page=cartflow-setup&step=' . $step );
}
/**
* Setup Wizard Header.
*/
public function setup_wizard_header() {
set_current_screen();
?>
>
steps;
?>
$step ) :
$classes = '';
$activated = false;
if ( $step_key === $this->step ) {
$classes = 'active';
$activated = true;
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
$classes = 'done';
$activated = true;
}
?>
';
call_user_func( $this->steps[ $this->step ]['view'] );
echo '';
}
/**
* Introduction step.
*/
public function welcome_step() {
?>
get_next_step_link();
wp_safe_redirect( esc_url_raw( $redirect_url ) );
exit;
}
/**
* Locale settings
*/
public function page_builder_step() {
?>
true,
'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
);
$activate = array(
'woocommerce/woocommerce.php' => false,
'woo-cart-abandonment-recovery/woo-cart-abandonment-recovery.php' => false,
);
foreach ( $plugin_slug_arr as $slug => $do_silently ) {
$activate[ $slug ] = activate_plugin( $slug, '', false, $do_silently );
}
foreach ( $activate as $slug => $data ) {
if ( is_wp_error( $data ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $data->get_error_message(),
)
);
}
}
wp_send_json_success();
}
/**
* Save Locale Settings.
*/
public function page_builder_step_save() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
check_ajax_referer( 'wcf-page-builder-step-save', 'security' );
$plugin_init = isset( $_POST['plugin_init'] ) ? sanitize_text_field( wp_unslash( $_POST['plugin_init'] ) ) : '';
$save_option = ( isset( $_POST['save_builder_option'] ) && 'true' == $_POST['save_builder_option'] ) ? true : false;
$plugin_slug = filter_input( INPUT_POST, 'page_builder', FILTER_SANITIZE_STRING );
$do_sliently = true;
if ( 'woo-cart-abandonment-recovery' === $plugin_slug ) {
$do_sliently = false;
}
$activate = activate_plugin( $plugin_init, '', false, $do_sliently );
if ( $save_option ) {
$this->save_page_builder_option();
}
if ( is_wp_error( $activate ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $activate->get_error_message(),
)
);
}
wp_send_json_success(
array( 'plugin' => $plugin_slug )
);
}
/**
* Save selected page builder in options database.
*/
public function save_page_builder_option() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
$page_builder = isset( $_POST['page_builder'] ) ? sanitize_text_field( wp_unslash( $_POST['page_builder'] ) ) : ''; //phpcs:ignore
$wcf_settings = get_option( '_cartflows_common', array() );
if ( false !== strpos( $page_builder, 'beaver-builder' ) ) {
$page_builder = 'beaver-builder';
}
$wcf_settings['default_page_builder'] = $page_builder;
update_option( '_cartflows_common', $wcf_settings );
wp_send_json_success(
array( 'plugin' => $page_builder )
);
}
/**
* Final step.
*/
public function ready_step() {
// Set setup wizard status to complete.
update_option( 'wcf_setup_complete', true );
?>
Next step
Create First Flow
define_constants();
// Activation hook.
register_activation_hook( CARTFLOWS_FILE, array( $this, 'activation_reset' ) );
// deActivation hook.
register_deactivation_hook( CARTFLOWS_FILE, array( $this, 'deactivation_reset' ) );
add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
add_action( 'plugins_loaded', array( $this, 'load_cf_textdomain' ) );
}
/**
* Defines all constants
*
* @since 1.0.0
*/
public function define_constants() {
define( 'CARTFLOWS_BASE', plugin_basename( CARTFLOWS_FILE ) );
define( 'CARTFLOWS_DIR', plugin_dir_path( CARTFLOWS_FILE ) );
define( 'CARTFLOWS_URL', plugins_url( '/', CARTFLOWS_FILE ) );
define( 'CARTFLOWS_VER', '1.5.5' );
define( 'CARTFLOWS_SLUG', 'cartflows' );
define( 'CARTFLOWS_SETTINGS', 'cartflows_settings' );
define( 'CARTFLOWS_FLOW_POST_TYPE', 'cartflows_flow' );
define( 'CARTFLOWS_STEP_POST_TYPE', 'cartflows_step' );
if ( ! defined( 'CARTFLOWS_SERVER_URL' ) ) {
define( 'CARTFLOWS_SERVER_URL', 'https://my.cartflows.com/' );
}
define( 'CARTFLOWS_DOMAIN_URL', 'https://cartflows.com/' );
define( 'CARTFLOWS_TEMPLATES_URL', 'https://templates.cartflows.com/' );
define( 'CARTFLOWS_TAXONOMY_STEP_TYPE', 'cartflows_step_type' );
define( 'CARTFLOWS_TAXONOMY_STEP_FLOW', 'cartflows_step_flow' );
if ( ! defined( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER' ) ) {
define( 'CARTFLOWS_TAXONOMY_STEP_PAGE_BUILDER', 'cartflows_step_page_builder' );
}
if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER' ) ) {
define( 'CARTFLOWS_TAXONOMY_FLOW_PAGE_BUILDER', 'cartflows_flow_page_builder' );
}
if ( ! defined( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY' ) ) {
define( 'CARTFLOWS_TAXONOMY_FLOW_CATEGORY', 'cartflows_flow_category' );
}
if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
$upload_dir = wp_upload_dir( null, false );
define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
}
}
/**
* Loads plugin files.
*
* @since 1.0.0
*
* @return void
*/
public function load_plugin() {
$this->load_helper_files_components();
$this->load_core_files();
$this->load_core_components();
add_action( 'wp_loaded', array( $this, 'initialize' ) );
add_action( 'cartflows_pro_init', array( $this, 'after_cartflows_pro_init' ) );
if ( ! $this->is_woo_active ) {
add_action( 'admin_notices', array( $this, 'fails_to_load' ) );
}
/**
* CartFlows Init.
*
* Fires when Cartflows is instantiated.
*
* @since 1.0.0
*/
do_action( 'cartflows_init' );
}
/**
* After CartFlows Pro init.
*
* @since 1.1.19
*
* @return void
*/
public function after_cartflows_pro_init() {
if ( ! is_admin() ) {
return;
}
if ( version_compare( CARTFLOWS_PRO_VER, '1.4.0', '<' ) ) {
add_action( 'admin_notices', array( $this, 'required_cartflows_pro_notice' ) );
}
}
/**
* Required CartFlows Pro Notice.
*
* @since 1.1.19
*
* @return void
*/
public function required_cartflows_pro_notice() {
$required_pro_version = '1.4.0';
$class = 'notice notice-warning';
/* translators: %s: html tags */
$message = sprintf( __( 'You are using an older version of %1$sCartFlows Pro%2$s. Please update %1$sCartFlows Pro%2$s plugin to version %1$s%3$s%2$s or higher.', 'cartflows' ), '', ' ', $required_pro_version );
printf( '', $class, $message );
}
/**
* Load Helper Files and Components.
*
* @since 1.0.0
*
* @return void
*/
public function load_helper_files_components() {
$this->is_woo_active = function_exists( 'WC' );
/* Public Utils */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-utils.php';
/* Public Global Namespace Function */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
/* Admin Helper */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
/* Meta Default Values */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-default-meta.php';
require_once CARTFLOWS_DIR . 'classes/class-cartflows-tracking.php';
$this->utils = Cartflows_Utils::get_instance();
$this->options = Cartflows_Default_Meta::get_instance();
$this->alldata = Cartflows_Tracking::get_instance();
}
/**
* Init hooked function.
*
* @since 1.0.0
*
* @return void
*/
public function initialize() {
$this->assets_vars = $this->utils->get_assets_path();
}
/**
* Load Core Files.
*
* @since 1.0.0
*
* @return void
*/
public function load_core_files() {
/* Update compatibility. */
require_once CARTFLOWS_DIR . 'classes/class-cartflows-update.php';
/* Page builder compatibilty class */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-compatibility.php';
/* Theme support */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-theme-support.php';
/* Admin Meta Fields*/
include_once CARTFLOWS_DIR . 'classes/fields/typography/class-cartflows-font-families.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta-fields.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-meta.php';
/* Cloning */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-cloning.php';
/* Admin Settings */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-admin.php';
/* Logger */
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-interface.php';
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler.php';
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-handler-file.php';
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-log-levels.php';
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-logger-interface.php';
include_once CARTFLOWS_DIR . 'classes/logger/class-cartflows-wc-logger.php';
/* Core Modules */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-logger.php';
/* Frontend Global */
include_once CARTFLOWS_DIR . 'classes/class-cartflows-frontend.php';
require_once CARTFLOWS_DIR . 'classes/class-cartflows-flow-frontend.php';
/* Modules */
include_once CARTFLOWS_DIR . 'modules/flow/class-cartflows-flow.php';
include_once CARTFLOWS_DIR . 'modules/landing/class-cartflows-landing.php';
if ( $this->is_woo_active ) {
include_once CARTFLOWS_DIR . 'modules/checkout/class-cartflows-checkout.php';
include_once CARTFLOWS_DIR . 'modules/thankyou/class-cartflows-thankyou.php';
include_once CARTFLOWS_DIR . 'modules/optin/class-cartflows-optin.php';
}
include_once CARTFLOWS_DIR . 'classes/class-cartflows-api.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer-core.php';
include_once CARTFLOWS_DIR . 'classes/batch-process/class-cartflows-batch-process.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-importer.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-wizard.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-metabox.php';
include_once CARTFLOWS_DIR . 'classes/deprecated/deprecated-hooks.php';
}
/**
* Load Core Components.
*
* @since 1.0.0
*
* @return void
*/
public function load_core_components() {
$this->meta = Cartflows_Meta_Fields::get_instance();
$this->logger = Cartflows_Logger::get_instance();
$this->flow = Cartflows_Flow_Frontend::get_instance();
}
/**
* Create files/directories.
*/
public function create_files() {
// Install files and folders for uploading files and prevent hotlinking.
$upload_dir = wp_upload_dir();
$files = array(
array(
'base' => CARTFLOWS_LOG_DIR,
'file' => '.htaccess',
'content' => 'deny from all',
),
array(
'base' => CARTFLOWS_LOG_DIR,
'file' => 'index.html',
'content' => '',
),
);
foreach ( $files as $file ) {
if ( wp_mkdir_p( $file['base'] ) && ! file_exists( trailingslashit( $file['base'] ) . $file['file'] ) ) {
$file_handle = @fopen( trailingslashit( $file['base'] ) . $file['file'], 'w' ); // phpcs:ignore
if ( $file_handle ) {
fwrite( $file_handle, $file['content'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite
fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
}
}
}
}
/**
* Load CartFlows Pro Text Domain.
* This will load the translation textdomain depending on the file priorities.
* 1. Global Languages /wp-content/languages/cartflows/ folder
* 2. Local dorectory /wp-content/plugins/cartflows/languages/ folder
*
* @since 1.0.3
* @return void
*/
public function load_cf_textdomain() {
// Default languages directory for CartFlows Pro.
$lang_dir = CARTFLOWS_DIR . 'languages/';
/**
* Filters the languages directory path to use for CartFlows Pro.
*
* @param string $lang_dir The languages directory path.
*/
$lang_dir = apply_filters( 'cartflows_languages_directory', $lang_dir );
// Traditional WordPress plugin locale filter.
global $wp_version;
$get_locale = get_locale();
if ( $wp_version >= 4.7 ) {
$get_locale = get_user_locale();
}
/**
* Language Locale for CartFlows Pro
*
* @var $get_locale The locale to use.
* Uses get_user_locale()` in WordPress 4.7 or greater,
* otherwise uses `get_locale()`.
*/
$locale = apply_filters( 'plugin_locale', $get_locale, 'cartflows' );
$mofile = sprintf( '%1$s-%2$s.mo', 'cartflows', $locale );
// Setup paths to current locale file.
$mofile_local = $lang_dir . $mofile;
$mofile_global = WP_LANG_DIR . '/plugins/' . $mofile;
if ( file_exists( $mofile_global ) ) {
// Look in global /wp-content/languages/cartflows/ folder.
load_textdomain( 'cartflows', $mofile_global );
} elseif ( file_exists( $mofile_local ) ) {
// Look in local /wp-content/plugins/cartflows/languages/ folder.
load_textdomain( 'cartflows', $mofile_local );
} else {
// Load the default language files.
load_plugin_textdomain( 'cartflows', false, $lang_dir );
}
}
/**
* Fires admin notice when Elementor is not installed and activated.
*
* @since 1.0.0
*
* @return void
*/
public function fails_to_load() {
$screen = get_current_screen();
if ( ! wcf()->utils->is_step_post_type() ) {
return;
}
if ( ! wcf()->utils->check_is_woo_required_page() ) {
return;
}
$skip_notice = false;
wp_localize_script( 'wcf-global-admin', 'cartflows_woo', array( 'show_update_post' => $skip_notice ) );
$class = 'notice notice-warning';
/* translators: %s: html tags */
$message = sprintf( __( 'This %1$sCartFlows%2$s page requires %1$sWooCommerce%2$s plugin installed & activated.', 'cartflows' ), '', ' ' );
$plugin = 'woocommerce/woocommerce.php';
if ( _is_woo_installed() ) {
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
$action_url = wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin . '&plugin_status=all&paged=1&s', 'activate-plugin_' . $plugin );
$button_label = __( 'Activate WooCommerce', 'cartflows' );
} else {
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
$action_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=woocommerce' ), 'install-plugin_woocommerce' );
$button_label = __( 'Install WooCommerce', 'cartflows' );
}
$button = '' . $button_label . '
';
printf( '', esc_attr( $class ), $message, $button );
}
/**
* Activation Reset
*/
public function activation_reset() {
if ( ! defined( 'CARTFLOWS_LOG_DIR' ) ) {
$upload_dir = wp_upload_dir( null, false );
define( 'CARTFLOWS_LOG_DIR', $upload_dir['basedir'] . '/cartflows-logs/' );
}
$this->create_files();
include_once CARTFLOWS_DIR . 'classes/class-cartflows-helper.php';
include_once CARTFLOWS_DIR . 'classes/class-cartflows-functions.php';
include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-flow-post-type.php';
include_once CARTFLOWS_DIR . 'modules/flow/classes/class-cartflows-step-post-type.php';
Cartflows_Flow_Post_Type::get_instance()->flow_post_type();
Cartflows_Step_Post_Type::get_instance()->step_post_type();
flush_rewrite_rules();
}
/**
* Deactivation Reset
*/
public function deactivation_reset() {
}
/**
* Logger Class Instance
*/
public function logger() {
return Cartflows_Logger::get_instance();
}
}
/**
* Prepare if class 'Cartflows_Loader' exist.
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Loader::get_instance();
}
/**
* Get global class.
*
* @return object
*/
function wcf() {
return Cartflows_Loader::get_instance();
}
if ( ! function_exists( '_is_woo_installed' ) ) {
/**
* Is woocommerce plugin installed.
*
* @since 1.0.0
*
* @access public
*/
function _is_woo_installed() {
$path = 'woocommerce/woocommerce.php';
$plugins = get_plugins();
return isset( $plugins[ $path ] );
}
}
PK [+\G6N N class-cartflows-helper.phpnu W+A is_divi_theme_installed() ) {
$theme_status = 'installed';
if ( false === Cartflows_Compatibility::get_instance()->is_divi_enabled() ) {
$theme_status = 'deactivate';
$divi_status = 'activate';
} else {
$divi_status = '';
}
}
}
$plugins = array(
'elementor' => array(
'title' => 'Elementor',
'plugins' => array(
array(
'slug' => 'elementor', // For download from wp.org.
'init' => 'elementor/elementor.php',
'status' => self::get_plugin_status( 'elementor/elementor.php' ),
),
),
),
'divi' => array(
'title' => 'Divi',
'theme-status' => $theme_status,
'plugin-status' => $divi_status,
'plugins' => array(
array(
'slug' => 'divi-builder', // For download from wp.org.
'init' => 'divi-builder/divi-builder.php',
'status' => $divi_status,
),
),
),
);
$plugins['beaver-builder'] = array(
'title' => 'Beaver Builder',
'plugins' => array(),
);
// Check Pro Exist.
if ( file_exists( WP_PLUGIN_DIR . '/bb-plugin/fl-builder.php' ) && ! is_plugin_active( 'beaver-builder-lite-version/fl-builder.php' ) ) {
$plugins['beaver-builder']['plugins'][] = array(
'slug' => 'bb-plugin',
'init' => 'bb-plugin/fl-builder.php',
'status' => self::get_plugin_status( 'bb-plugin/fl-builder.php' ),
);
} else {
$plugins['beaver-builder']['plugins'][] = array(
'slug' => 'beaver-builder-lite-version', // For download from wp.org.
'init' => 'beaver-builder-lite-version/fl-builder.php',
'status' => self::get_plugin_status( 'beaver-builder-lite-version/fl-builder.php' ),
);
}
if ( file_exists( WP_PLUGIN_DIR . '/bb-ultimate-addon/bb-ultimate-addon.php' ) && ! is_plugin_active( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ) ) {
$plugins['beaver-builder']['plugins'][] = array(
'slug' => 'bb-ultimate-addon',
'init' => 'bb-ultimate-addon/bb-ultimate-addon.php',
'status' => self::get_plugin_status( 'bb-ultimate-addon/bb-ultimate-addon.php' ),
);
} else {
$plugins['beaver-builder']['plugins'][] = array(
'slug' => 'ultimate-addons-for-beaver-builder-lite', // For download from wp.org.
'init' => 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php',
'status' => self::get_plugin_status( 'ultimate-addons-for-beaver-builder-lite/bb-ultimate-addon.php' ),
);
}
return $plugins;
}
/**
* Get plugin status
*
* @since 1.1.4
*
* @param string $plugin_init_file Plguin init file.
* @return mixed
*/
public static function get_plugin_status( $plugin_init_file ) {
if ( null == self::$installed_plugins ) {
self::$installed_plugins = get_plugins();
}
if ( ! isset( self::$installed_plugins[ $plugin_init_file ] ) ) {
return 'install';
} elseif ( ! is_plugin_active( $plugin_init_file ) ) {
return 'activate';
} else {
return;
}
}
/**
* Get zapier settings.
*
* @return array.
*/
public static function get_common_settings() {
if ( null === self::$common ) {
$common_default = apply_filters(
'cartflows_common_settings_default',
array(
'disallow_indexing' => 'disable',
'global_checkout' => '',
'default_page_builder' => 'elementor',
)
);
$common = self::get_admin_settings_option( '_cartflows_common', false, false );
$common = wp_parse_args( $common, $common_default );
if ( ! did_action( 'wp' ) ) {
return $common;
} else {
self::$common = $common;
}
}
return self::$common;
}
/**
* Get debug settings data.
*
* @return array.
*/
public static function get_debug_settings() {
if ( null === self::$debug_data ) {
$debug_data_default = apply_filters(
'cartflows_debug_settings_default',
array(
'allow_minified_files' => 'disable',
)
);
$debug_data = self::get_admin_settings_option( '_cartflows_debug_data', false, false );
$debug_data = wp_parse_args( $debug_data, $debug_data_default );
if ( ! did_action( 'wp' ) ) {
return $debug_data;
} else {
self::$debug_data = $debug_data;
}
}
return self::$debug_data;
}
/**
* Get debug settings data.
*
* @return array.
*/
public static function get_permalink_settings() {
if ( null === self::$permalink_setting ) {
$permalink_default = apply_filters(
'cartflows_permalink_settings_default',
array(
'permalink' => CARTFLOWS_STEP_POST_TYPE,
'permalink_flow_base' => CARTFLOWS_FLOW_POST_TYPE,
'permalink_structure' => '',
)
);
$permalink_data = self::get_admin_settings_option( '_cartflows_permalink', false, false );
$permalink_data = wp_parse_args( $permalink_data, $permalink_default );
if ( ! did_action( 'wp' ) ) {
return $permalink_data;
} else {
self::$permalink_setting = $permalink_data;
}
}
return self::$permalink_setting;
}
/**
* Get debug settings data.
*
* @return array.
*/
public static function get_google_analytics_settings() {
if ( null === self::$google_analytics_settings ) {
$google_analytics_settings_default = apply_filters(
'cartflows_google_analytics_settings_default',
array(
'enable_google_analytics' => 'disable',
'enable_google_analytics_for_site' => 'disable',
'google_analytics_id' => '',
'enable_begin_checkout' => 'disable',
'enable_add_to_cart' => 'disable',
'enable_add_payment_info' => 'disable',
'enable_purchase_event' => 'disable',
)
);
$google_analytics_settings_data = self::get_admin_settings_option( '_cartflows_google_analytics', false, true );
$google_analytics_settings_data = wp_parse_args( $google_analytics_settings_data, $google_analytics_settings_default );
if ( ! did_action( 'wp' ) ) {
return $google_analytics_settings_data;
} else {
self::$google_analytics_settings = $google_analytics_settings_data;
}
}
return self::$google_analytics_settings = $google_analytics_settings_data; //phpcs:ignore
}
/**
* Get Checkout field.
*
* @param string $key Field key.
* @param int $post_id Post id.
* @return array.
*/
public static function get_checkout_fields( $key, $post_id ) {
$saved_fields = get_post_meta( $post_id, 'wcf_fields_' . $key, true );
if ( ! $saved_fields ) {
$saved_fields = array();
}
$fields = array_filter( $saved_fields );
if ( empty( $fields ) ) {
if ( 'billing' === $key || 'shipping' === $key ) {
$fields = WC()->countries->get_address_fields( WC()->countries->get_base_country(), $key . '_' );
update_post_meta( $post_id, 'wcf_fields_' . $key, $fields );
}
}
return $fields;
}
/**
* Add Checkout field.
*
* @param string $type Field type.
* @param string $field_key Field key.
* @param array $field_data Field data.
* @param int $post_id Post id.
* @return boolean.
*/
public static function add_checkout_field( $type, $field_key, $field_data = array(), $post_id ) {
$fields = self::get_checkout_fields( $type, $post_id );
$fields[ $field_key ] = $field_data;
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
return true;
}
/**
* Get checkout fields settings.
*
* @param string $type Field type.
* @param string $field_key Field key.
* @param int $post_id Post id.
* @return array.
*/
public static function delete_checkout_field( $type, $field_key, $post_id ) {
$fields = self::get_checkout_fields( $type, $post_id );
if ( isset( $fields[ $field_key ] ) ) {
unset( $fields[ $field_key ] );
}
update_post_meta( $post_id, 'wcf_fields_' . $type, $fields );
return true;
}
/**
* Get checkout fields settings.
*
* @return array.
*/
public static function get_checkout_fields_settings() {
if ( null === self::$checkout_fields ) {
$checkout_fields_default = array(
'enable_customization' => 'disable',
'enable_billing_fields' => 'disable',
);
$billing_fields = self::get_checkout_fields( 'billing' );
if ( is_array( $billing_fields ) && ! empty( $billing_fields ) ) {
foreach ( $billing_fields as $key => $value ) {
$checkout_fields_default[ $key ] = 'enable';
}
}
$checkout_fields = self::get_admin_settings_option( '_wcf_checkout_fields', false, false );
self::$checkout_fields = wp_parse_args( $checkout_fields, $checkout_fields_default );
}
return self::$checkout_fields;
}
/**
* Get meta options
*
* @since 1.0.0
* @param int $post_id Product ID.
* @param string $key Meta Key.
* @param string $default Default value.
* @return string Meta Value.
*/
public static function get_meta_option( $post_id, $key, $default = '' ) {
$value = get_post_meta( $post_id, $key, true );
if ( ! $value ) {
$value = $default;
}
return $value;
}
/**
* Save meta option
*
* @since 1.0.0
* @param int $post_id Product ID.
* @param array $args Arguments array.
*/
public static function save_meta_option( $post_id, $args = array() ) {
if ( is_array( $args ) && ! empty( $args ) ) {
foreach ( $args as $key => $value ) {
update_post_meta( $post_id, $key, $value );
}
}
}
/**
* Check if Elementor page builder is installed
*
* @since 1.0.0
*
* @access public
*/
public static function is_elementor_installed() {
$path = 'elementor/elementor.php';
$plugins = get_plugins();
return isset( $plugins[ $path ] );
}
/**
* Check if Step has product assigned.
*
* @since 1.0.0
* @param int $step_id step ID.
*
* @access public
*/
public static function has_product_assigned( $step_id ) {
$step_type = get_post_meta( $step_id, 'wcf-step-type', true );
if ( 'checkout' == $step_type ) {
$product = get_post_meta( $step_id, 'wcf-checkout-products', true );
} else {
$product = get_post_meta( $step_id, 'wcf-offer-product', true );
}
if ( ! empty( $product ) ) {
return true;
}
return false;
}
/**
* Get attributes for cartflows wrap.
*
* @since 1.1.4
*
* @access public
*/
public static function get_cartflows_container_atts() {
$attributes = apply_filters( 'cartflows_container_atts', array() );
$atts_string = '';
foreach ( $attributes as $key => $value ) {
if ( ! $value ) {
continue;
}
if ( true === $value ) {
$atts_string .= esc_html( $key ) . ' ';
} else {
$atts_string .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) );
}
}
return $atts_string;
}
/**
* Get facebook pixel settings.
*
* @return facebook array.
*/
public static function get_facebook_settings() {
if ( null === self::$facebook ) {
$facebook_default = array(
'facebook_pixel_id' => '',
'facebook_pixel_add_to_cart' => 'enable',
'facebook_pixel_initiate_checkout' => 'enable',
'facebook_pixel_add_payment_info' => 'enable',
'facebook_pixel_purchase_complete' => 'enable',
'facebook_pixel_tracking' => 'disable',
'facebook_pixel_tracking_for_site' => 'disable',
);
$facebook = self::get_admin_settings_option( '_cartflows_facebook', false, false );
$facebook = wp_parse_args( $facebook, $facebook_default );
self::$facebook = apply_filters( 'cartflows_facebook_settings_default', $facebook );
}
return self::$facebook;
}
/**
* Prepare response data for facebook.
*
* @param int $order_id order_id.
* @param array $offer_data offer data.
*/
public static function send_fb_response_if_enabled( $order_id, $offer_data = array() ) {
// Stop Execution if WooCommerce is not installed & don't set the cookie.
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
return;
}
$fb_settings = self::get_facebook_settings();
if ( 'enable' === $fb_settings['facebook_pixel_tracking'] ) {
setcookie( 'wcf_order_details', wp_json_encode( self::prepare_purchase_data_fb_response( $order_id, $offer_data ) ), strtotime( '+1 year' ), '/' );
}
}
/**
* Prepare purchase response for facebook purcase event.
*
* @param integer $order_id order id.
* @param array $offer_data offer data.
* @return mixed
*/
public static function prepare_purchase_data_fb_response( $order_id, $offer_data = array() ) {
$thankyou = array();
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
return $thankyou;
}
$thankyou['order_id'] = $order_id;
$thankyou['content_type'] = 'product';
$thankyou['currency'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_currency' );
$thankyou['userAgent'] = wcf()->options->get_checkout_meta_value( $order_id, '_customer_user_agent' );
$thankyou['plugin'] = 'CartFlows';
$order = wc_get_order( $order_id );
if ( empty( $offer_data ) ) {
// Iterating through each WC_Order_Item_Product objects.
foreach ( $order->get_items() as $item_key => $item ) {
$product = $item->get_product(); // Get the WC_Product object.
$thankyou['content_ids'][] = (string) $product->get_id();
}
$thankyou['value'] = wcf()->options->get_checkout_meta_value( $order_id, '_order_total' );
} else {
$thankyou['content_ids'][] = (string) $offer_data['id'];
$thankyou['value'] = $offer_data['total'];
}
return $thankyou;
}
/**
* Prepare cart data for fb response.
*
* @return array
*/
public static function prepare_cart_data_fb_response() {
$params = array();
if ( ! Cartflows_Loader::get_instance()->is_woo_active ) {
return $params;
}
$cart_total = WC()->cart->get_cart_contents_total();
$cart_items_count = WC()->cart->get_cart_contents_count();
$items = WC()->cart->get_cart();
$product_names = '';
$category_names = '';
$cart_contents = array();
foreach ( $items as $item => $value ) {
$_product = wc_get_product( $value['product_id'] );
$params['content_ids'][] = (string) $_product->get_id();
$product_names = $product_names . ', ' . $_product->get_title();
$category_names = $category_names . ', ' . wp_strip_all_tags( wc_get_product_category_list( $_product->get_id() ) );
array_push(
$cart_contents,
array(
'id' => $_product->get_id(),
'name' => $_product->get_title(),
'quantity' => $value['quantity'],
'item_price' => $_product->get_price(),
)
);
}
$user = wp_get_current_user();
$roles = implode( ', ', $user->roles );
$params['content_name'] = substr( $product_names, 2 );
$params['categoey_name'] = substr( $category_names, 2 );
$params['user_roles'] = $roles;
$params['plugin'] = 'CartFlows';
$params['contents'] = wp_json_encode( $cart_contents );
$params['content_type'] = 'product';
$params['value'] = $cart_total;
$params['num_items'] = $cart_items_count;
$params['currency'] = get_woocommerce_currency();
$params['language'] = get_bloginfo( 'language' );
$params['userAgent'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] ); //phpcs:ignore
$params['product_catalog_id'] = '';
$params['domain'] = get_site_url();
return $params;
}
/**
* Get the image url of size.
*
* @param int $post_id post id.
* @param array $key key.
* @param string $size image size.
*
* @return array
*/
public static function get_image_url( $post_id, $key, $size = false ) {
$url = get_post_meta( $post_id, $key, true );
$img_obj = get_post_meta( $post_id, $key . '-obj', true );
if ( is_array( $img_obj ) && ! empty( $img_obj ) && false !== $size ) {
$url = ! empty( $img_obj['url'][ $size ] ) ? $img_obj['url'][ $size ] : $url;
}
return $url;
}
}
PK [+\R R class-cartflows-logger.phpnu W+A CARTFLOWS_SETTINGS,
'cartflows-error-log' => 1,
),
admin_url( '/admin.php' )
);
echo ' | View Logs ';
}
/**
* Inint Logger.
*
* @since 1.0.0
*/
public function init_wc_logger() {
if ( class_exists( 'CartFlows_WC_Logger' ) ) {
$this->logger = new CartFlows_WC_Logger();
}
}
/**
* Write log
*
* @param string $message log message.
* @param string $level type of log.
* @since 1.0.0
*/
public function log( $message, $level = 'info' ) {
$enable_log = apply_filters( 'cartflows_enable_log', 'enable' );
if ( 'enable' === $enable_log &&
is_a( $this->logger, 'CartFlows_WC_Logger' ) &&
did_action( 'plugins_loaded' )
) {
$this->logger->log( $level, $message, array( 'source' => 'cartflows' ) );
}
}
/**
* Write log
*
* @param string $message log message.
* @param string $level type of log.
* @since 1.0.0
*/
public function import_log( $message, $level = 'info' ) {
if ( defined( 'WP_DEBUG' ) &&
WP_DEBUG &&
is_a( $this->logger, 'CartFlows_WC_Logger' ) &&
did_action( 'plugins_loaded' )
) {
$this->logger->log( $level, $message, array( 'source' => 'cartflows-import' ) );
}
}
/**
* Get all log files in the log directory.
*
* @return array
*/
public static function get_log_files() {
$files = scandir( CARTFLOWS_LOG_DIR );
$result = array();
if ( ! empty( $files ) ) {
foreach ( $files as $key => $value ) {
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
$result[ sanitize_title( $value ) ] = $value;
}
}
}
}
return $result;
}
/**
* Return the log file handle.
*
* @param string $filename Filename to get the handle for.
* @return string
*/
public static function get_log_file_handle( $filename ) {
return substr( $filename, 0, strlen( $filename ) > 48 ? strlen( $filename ) - 48 : strlen( $filename ) - 4 );
}
/**
* Show the log page contents for file log handler.
*/
public static function status_logs_file() {
if ( ! empty( $_REQUEST['handle'] ) ) {
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ), 'remove_log' ) ) {
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'cartflows' ) );
}
wp_delete_file( CARTFLOWS_LOG_DIR . rtrim( $_REQUEST['handle'], '-log' ) . '.log' ); //phpcs:ignore
echo " Log deleted successfully!
";
}
$logs = self::get_log_files();
if ( ! empty( $_REQUEST['log_file'] ) && isset( $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ] ) ) {
$viewed_log = $logs[ sanitize_title( wp_unslash( $_REQUEST['log_file'] ) ) ];
} elseif ( ! empty( $logs ) ) {
$viewed_log = current( $logs );
}
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
include_once CARTFLOWS_DIR . 'includes/admin/cartflows-error-log.php';
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Cartflows_Logger::get_instance();
PK [+\$
+ logger/class-cartflows-logger-interface.phpnu W+A ' . esc_html( is_object( $handler ) ? get_class( $handler ) : $handler ) . '',
'Cartflows_Log_Handler_Interface'
),
'3.0'
);
}
}
}
if ( null !== $threshold ) {
$threshold = Cartflows_Log_Levels::get_level_severity( $threshold );
} elseif ( defined( 'WC_LOG_THRESHOLD' ) && Cartflows_Log_Levels::is_valid_level( WC_LOG_THRESHOLD ) ) {
$threshold = Cartflows_Log_Levels::get_level_severity( WC_LOG_THRESHOLD );
} else {
$threshold = null;
}
$this->handlers = $register_handlers;
$this->threshold = $threshold;
}
/**
* Determine whether to handle or ignore log.
*
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @return bool True if the log should be handled.
*/
protected function should_handle( $level ) {
if ( null === $this->threshold ) {
return true;
}
return $this->threshold <= Cartflows_Log_Levels::get_level_severity( $level );
}
/**
* Add a log entry.
*
* This is not the preferred method for adding log messages. Please use log() or any one of
* the level methods (debug(), info(), etc.). This method may be deprecated in the future.
*
* @param string $handle File handle.
* @param string $message Message to log.
* @param string $level Logging level.
* @return bool
*/
public function add( $handle, $message, $level = Cartflows_Log_Levels::NOTICE ) {
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
$this->log(
$level,
$message,
array(
'source' => $handle,
'_legacy' => true,
)
);
wc_do_deprecated_action( 'cartflows_log_add', array( $handle, $message ), '3.0', 'This action has been deprecated with no alternative.' );
return true;
}
/**
* Add a log entry.
*
* @param string $level One of the following:
* 'emergency': System is unusable.
* 'alert': Action must be taken immediately.
* 'critical': Critical conditions.
* 'error': Error conditions.
* 'warning': Warning conditions.
* 'notice': Normal but significant condition.
* 'info': Informational messages.
* 'debug': Debug-level messages.
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function log( $level, $message, $context = array() ) {
if ( ! Cartflows_Log_Levels::is_valid_level( $level ) ) {
/* translators: 1: Cartflows_WC_Logger::log 2: level */
wc_doing_it_wrong( __METHOD__, sprintf( __( '%1$s was called with an invalid level "%2$s".', 'cartflows' ), 'Cartflows_WC_Logger::log', $level ), '3.0' );
}
if ( $this->should_handle( $level ) ) {
$timestamp = time();
$message = apply_filters( 'cartflows_logger_log_message', $message, $level, $context );
foreach ( $this->handlers as $handler ) {
$handler->handle( $timestamp, $level, $message, $context );
}
}
}
/**
* Adds an emergency level message.
*
* System is unusable.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function emergency( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::EMERGENCY, $message, $context );
}
/**
* Adds an alert level message.
*
* Action must be taken immediately.
* Example: Entire website down, database unavailable, etc.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function alert( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::ALERT, $message, $context );
}
/**
* Adds a critical level message.
*
* Critical conditions.
* Example: Application component unavailable, unexpected exception.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function critical( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::CRITICAL, $message, $context );
}
/**
* Adds an error level message.
*
* Runtime errors that do not require immediate action but should typically be logged
* and monitored.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function error( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::ERROR, $message, $context );
}
/**
* Adds a warning level message.
*
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
* necessarily wrong.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function warning( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::WARNING, $message, $context );
}
/**
* Adds a notice level message.
*
* Normal but significant events.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function notice( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::NOTICE, $message, $context );
}
/**
* Adds a info level message.
*
* Interesting events.
* Example: User logs in, SQL logs.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function info( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::INFO, $message, $context );
}
/**
* Adds a debug level message.
*
* Detailed debug information.
*
* @see Cartflows_WC_Logger::log
*
* @param string $message Message to log.
* @param array $context Log context.
*/
public function debug( $message, $context = array() ) {
$this->log( Cartflows_Log_Levels::DEBUG, $message, $context );
}
/**
* Clear entries for a chosen file/source.
*
* @param string $source Source/handle to clear.
* @return bool
*/
public function clear( $source = '' ) {
if ( ! $source ) {
return false;
}
foreach ( $this->handlers as $handler ) {
if ( is_callable( array( $handler, 'clear' ) ) ) {
$handler->clear( $source );
}
}
return true;
}
/**
* Clear all logs older than a defined number of days. Defaults to 30 days.
*
* @since 3.4.0
*/
public function clear_expired_logs() {
$days = absint( apply_filters( 'cartflows_logger_days_to_retain_logs', 30 ) );
$timestamp = strtotime( "-{$days} days" );
foreach ( $this->handlers as $handler ) {
if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
$handler->delete_logs_before_timestamp( $timestamp );
}
}
}
}
PK [+\(]- - + logger/class-cartflows-log-handler-file.phpnu W+A log_size_limit = apply_filters( 'cartflows_log_file_size_limit', $log_size_limit );
add_action( 'plugins_loaded', array( $this, 'write_cached_logs' ) );
}
/**
* Destructor.
*
* Cleans up open file handles.
*/
public function __destruct() {
foreach ( $this->handles as $handle ) {
if ( is_resource( $handle ) ) {
fclose( $handle ); // @codingStandardsIgnoreLine.
}
}
}
/**
* Handle a log entry.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message.
* @param array $context {
* Additional information for log handlers.
*
* @type string $source Optional. Determines log file to write to. Default 'log'.
* @type bool $_legacy Optional. Default false. True to use outdated log format
* originally used in deprecated Cartflows_WC_Logger::add calls.
* }
*
* @return bool False if value was not handled and true if value was handled.
*/
public function handle( $timestamp, $level, $message, $context ) {
if ( isset( $context['source'] ) && $context['source'] ) {
$handle = $context['source'];
} else {
$handle = 'log';
}
$entry = self::format_entry( $timestamp, $level, $message, $context );
return $this->add( $entry, $handle );
}
/**
* Builds a log entry text from timestamp, level and message.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message.
* @param array $context Additional information for log handlers.
*
* @return string Formatted log entry.
*/
protected static function format_entry( $timestamp, $level, $message, $context ) {
if ( isset( $context['_legacy'] ) && true === $context['_legacy'] ) {
if ( isset( $context['source'] ) && $context['source'] ) {
$handle = $context['source'];
} else {
$handle = 'log';
}
$message = apply_filters( 'cartflows_logger_add_message', $message, $handle );
$time = date_i18n( 'm-d-Y @ H:i:s' );
$entry = "{$time} - {$message}";
} else {
$entry = parent::format_entry( $timestamp, $level, $message, $context );
}
return $entry;
}
/**
* Open log file for writing.
*
* @param string $handle Log handle.
* @param string $mode Optional. File mode. Default 'a'.
* @return bool Success.
*/
protected function open( $handle, $mode = 'a' ) {
if ( $this->is_open( $handle ) ) {
return true;
}
$file = self::get_log_file_path( $handle );
if ( $file ) {
if ( ! file_exists( $file ) ) {
$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
if ( defined( 'FS_CHMOD_FILE' ) ) {
@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
}
}
$resource = @fopen( $file, $mode ); // @codingStandardsIgnoreLine.
if ( $resource ) {
$this->handles[ $handle ] = $resource;
return true;
}
}
return false;
}
/**
* Check if a handle is open.
*
* @param string $handle Log handle.
* @return bool True if $handle is open.
*/
protected function is_open( $handle ) {
return array_key_exists( $handle, $this->handles ) && is_resource( $this->handles[ $handle ] );
}
/**
* Close a handle.
*
* @param string $handle Log handle.
* @return bool success
*/
protected function close( $handle ) {
$result = false;
if ( $this->is_open( $handle ) ) {
$result = fclose( $this->handles[ $handle ] ); // @codingStandardsIgnoreLine.
unset( $this->handles[ $handle ] );
}
return $result;
}
/**
* Add a log entry to chosen file.
*
* @param string $entry Log entry text.
* @param string $handle Log entry handle.
*
* @return bool True if write was successful.
*/
protected function add( $entry, $handle ) {
$result = false;
if ( $this->should_rotate( $handle ) ) {
$this->log_rotate( $handle );
}
if ( $this->open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
$result = fwrite( $this->handles[ $handle ], $entry . PHP_EOL ); // @codingStandardsIgnoreLine.
} else {
$this->cache_log( $entry, $handle );
}
return false !== $result;
}
/**
* Clear entries from chosen file.
*
* @param string $handle Log handle.
*
* @return bool
*/
public function clear( $handle ) {
$result = false;
// Close the file if it's already open.
$this->close( $handle );
/**
* $this->open( $handle, 'w' ) == Open the file for writing only. Place the file pointer at
* the beginning of the file, and truncate the file to zero length.
*/
if ( $this->open( $handle, 'w' ) && is_resource( $this->handles[ $handle ] ) ) {
$result = true;
}
do_action( 'cartflows_log_clear', $handle );
return $result;
}
/**
* Remove/delete the chosen file.
*
* @param string $handle Log handle.
*
* @return bool
*/
public function remove( $handle ) {
$removed = false;
$logs = $this->get_log_files();
$handle = sanitize_title( $handle );
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
$file = realpath( trailingslashit( CARTFLOWS_LOG_DIR ) . $logs[ $handle ] );
if ( 0 === stripos( $file, realpath( trailingslashit( CARTFLOWS_LOG_DIR ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
$this->close( $file ); // Close first to be certain no processes keep it alive after it is unlinked.
$removed = unlink( $file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
}
do_action( 'cartflows_log_remove', $handle, $removed );
}
return $removed;
}
/**
* Check if log file should be rotated.
*
* Compares the size of the log file to determine whether it is over the size limit.
*
* @param string $handle Log handle.
* @return bool True if if should be rotated.
*/
protected function should_rotate( $handle ) {
$file = self::get_log_file_path( $handle );
if ( $file ) {
if ( $this->is_open( $handle ) ) {
$file_stat = fstat( $this->handles[ $handle ] );
return $file_stat['size'] > $this->log_size_limit;
} elseif ( file_exists( $file ) ) {
return filesize( $file ) > $this->log_size_limit;
} else {
return false;
}
} else {
return false;
}
}
/**
* Rotate log files.
*
* Logs are rotated by prepending '.x' to the '.log' suffix.
* The current log plus 10 historical logs are maintained.
* For example:
* base.9.log -> [ REMOVED ]
* base.8.log -> base.9.log
* ...
* base.0.log -> base.1.log
* base.log -> base.0.log
*
* @param string $handle Log handle.
*/
protected function log_rotate( $handle ) {
for ( $i = 8; $i >= 0; $i-- ) {
$this->increment_log_infix( $handle, $i );
}
$this->increment_log_infix( $handle );
}
/**
* Increment a log file suffix.
*
* @param string $handle Log handle.
* @param null|int $number Optional. Default null. Log suffix number to be incremented.
* @return bool True if increment was successful, otherwise false.
*/
protected function increment_log_infix( $handle, $number = null ) {
if ( null === $number ) {
$suffix = '';
$next_suffix = '.0';
} else {
$suffix = '.' . $number;
$next_suffix = '.' . ( $number + 1 );
}
$rename_from = self::get_log_file_path( "{$handle}{$suffix}" );
$rename_to = self::get_log_file_path( "{$handle}{$next_suffix}" );
if ( $this->is_open( $rename_from ) ) {
$this->close( $rename_from );
}
if ( is_writable( $rename_from ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
return rename( $rename_from, $rename_to ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_rename
} else {
return false;
}
}
/**
* Get a log file path.
*
* @param string $handle Log name.
* @return bool|string The log file path or false if path cannot be determined.
*/
public static function get_log_file_path( $handle ) {
if ( function_exists( 'wp_hash' ) ) {
return trailingslashit( CARTFLOWS_LOG_DIR ) . self::get_log_file_name( $handle );
} else {
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.0' );
return false;
}
}
/**
* Get a log file name.
*
* File names consist of the handle, followed by the date, followed by a hash, .log.
*
* @since 3.3
* @param string $handle Log name.
* @return bool|string The log file name or false if cannot be determined.
*/
public static function get_log_file_name( $handle ) {
if ( function_exists( 'wp_hash' ) ) {
$date_suffix = gmdate( 'Y-m-d', time() );
$hash_suffix = wp_hash( $handle );
return sanitize_file_name( implode( '-', array( $handle, $date_suffix, $hash_suffix ) ) . '.log' );
} else {
wc_doing_it_wrong( __METHOD__, __( 'This method should not be called before plugins_loaded.', 'cartflows' ), '3.3' );
return false;
}
}
/**
* Cache log to write later.
*
* @param string $entry Log entry text.
* @param string $handle Log entry handle.
*/
protected function cache_log( $entry, $handle ) {
$this->cached_logs[] = array(
'entry' => $entry,
'handle' => $handle,
);
}
/**
* Write cached logs.
*/
public function write_cached_logs() {
foreach ( $this->cached_logs as $log ) {
$this->add( $log['entry'], $log['handle'] );
}
}
/**
* Delete all logs older than a defined timestamp.
*
* @since 3.4.0
* @param integer $timestamp Timestamp to delete logs before.
*/
public static function delete_logs_before_timestamp( $timestamp = 0 ) {
if ( ! $timestamp ) {
return;
}
$log_files = self::get_log_files();
foreach ( $log_files as $log_file ) {
$last_modified = filemtime( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file );
if ( $last_modified < $timestamp ) {
@unlink( trailingslashit( CARTFLOWS_LOG_DIR ) . $log_file ); // @codingStandardsIgnoreLine.
}
}
}
/**
* Get all log files in the log directory.
*
* @since 3.4.0
* @return array
*/
public static function get_log_files() {
$files = @scandir( CARTFLOWS_LOG_DIR ); // @codingStandardsIgnoreLine.
$result = array();
if ( ! empty( $files ) ) {
foreach ( $files as $key => $value ) {
if ( ! in_array( $value, array( '.', '..' ), true ) ) {
if ( ! is_dir( $value ) && strstr( $value, '.log' ) ) {
$result[ sanitize_title( $value ) ] = $value;
}
}
}
}
return $result;
}
}
PK [+\𝑽 &