Merged in release/release-1.09 (pull request #10)
Release/release 1.09 * Install missing plugins * rs set to 1 * rebase pantheon for aws * rebase pantheon for aws * prod config change * prod config change * fix campaing issue * revert Approved-by: Jay Sharma
This commit is contained in:
committed by
Jay Sharma
parent
779393381f
commit
22f10a9edd
@@ -1,118 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* BSF analytics loader file.
|
||||
*
|
||||
* @version 1.0.0
|
||||
*
|
||||
* @package bsf-analytics
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class BSF_Analytics_Loader.
|
||||
*/
|
||||
class BSF_Analytics_Loader {
|
||||
|
||||
/**
|
||||
* Analytics Entities.
|
||||
*
|
||||
* @access private
|
||||
* @var array Entities array.
|
||||
*/
|
||||
private $entities = array();
|
||||
|
||||
/**
|
||||
* Analytics Version.
|
||||
*
|
||||
* @access private
|
||||
* @var float analytics version.
|
||||
*/
|
||||
private $analytics_version = '';
|
||||
|
||||
/**
|
||||
* Analytics path.
|
||||
*
|
||||
* @access private
|
||||
* @var string path array.
|
||||
*/
|
||||
private $analytics_path = '';
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @access private
|
||||
* @var object Class object.
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Get instace of class.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'load_analytics' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set entity for analytics.
|
||||
*
|
||||
* @param string $data Entity attributes data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_entity( $data ) {
|
||||
array_push( $this->entities, $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Analytics library.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_analytics() {
|
||||
$unique_entities = array();
|
||||
|
||||
if ( ! empty( $this->entities ) ) {
|
||||
foreach ( $this->entities as $entity ) {
|
||||
foreach ( $entity as $key => $data ) {
|
||||
|
||||
if ( isset( $data['path'] ) ) {
|
||||
if ( file_exists( $data['path'] . '/version.json' ) ) {
|
||||
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
$analytics_version = json_decode( $file_contents, 1 );
|
||||
$analytics_version = $analytics_version['bsf-analytics-ver'];
|
||||
|
||||
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
|
||||
$this->analytics_version = $analytics_version;
|
||||
$this->analytics_path = $data['path'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! isset( $unique_entities[ $key ] ) ) {
|
||||
$unique_entities[ $key ] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
|
||||
require_once $this->analytics_path . '/class-bsf-analytics.php';
|
||||
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* BSF analytics loader file.
|
||||
*
|
||||
* @version 1.0.0
|
||||
*
|
||||
* @package bsf-analytics
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class BSF_Analytics_Loader.
|
||||
*/
|
||||
class BSF_Analytics_Loader {
|
||||
|
||||
/**
|
||||
* Analytics Entities.
|
||||
*
|
||||
* @access private
|
||||
* @var array Entities array.
|
||||
*/
|
||||
private $entities = array();
|
||||
|
||||
/**
|
||||
* Analytics Version.
|
||||
*
|
||||
* @access private
|
||||
* @var float analytics version.
|
||||
*/
|
||||
private $analytics_version = '';
|
||||
|
||||
/**
|
||||
* Analytics path.
|
||||
*
|
||||
* @access private
|
||||
* @var string path array.
|
||||
*/
|
||||
private $analytics_path = '';
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @access private
|
||||
* @var object Class object.
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Get instace of class.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'load_analytics' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set entity for analytics.
|
||||
*
|
||||
* @param string $data Entity attributes data.
|
||||
* @return void
|
||||
*/
|
||||
public function set_entity( $data ) {
|
||||
array_push( $this->entities, $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Analytics library.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function load_analytics() {
|
||||
$unique_entities = array();
|
||||
|
||||
if ( ! empty( $this->entities ) ) {
|
||||
foreach ( $this->entities as $entity ) {
|
||||
foreach ( $entity as $key => $data ) {
|
||||
|
||||
if ( isset( $data['path'] ) ) {
|
||||
if ( file_exists( $data['path'] . '/version.json' ) ) {
|
||||
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
||||
$analytics_version = json_decode( $file_contents, 1 );
|
||||
$analytics_version = $analytics_version['bsf-analytics-ver'];
|
||||
|
||||
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
|
||||
$this->analytics_version = $analytics_version;
|
||||
$this->analytics_path = $data['path'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! isset( $unique_entities[ $key ] ) ) {
|
||||
$unique_entities[ $key ] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
|
||||
require_once $this->analytics_path . '/class-bsf-analytics.php';
|
||||
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,3 @@
|
||||
v2.7.11
|
||||
# Improvement: Added new required properties in Course Schema - offers, courseWorkload / courseSchedule.
|
||||
# Fix: Corrected syntax for FAQ schema type.
|
||||
|
||||
v2.7.10
|
||||
# Improvement: Improved codebase for improved security.
|
||||
# Improvement: Added Clip and SeekToAction fields in Video Object schema.
|
||||
# Fix: Invalid value errors for some fields in Job Posting schema when set to none.
|
||||
# Fix: Resolved PHP error while editing Posts/Pages in some cases.
|
||||
|
||||
v2.7.9
|
||||
# Fix: Addressed a Broken Access Control security bug. Props to Patchstack for privately reporting it to our team.
|
||||
# Fix: Issue with the custom image setting for How To Block.
|
||||
|
||||
@@ -149,7 +149,7 @@ if ( ! class_exists( 'Brainstorm_Update_AIOSRS_Pro' ) ) :
|
||||
$version = file_get_contents( realpath( plugin_dir_path( BSF_AIOSRS_PRO_FILE ) . '/admin/bsf-core/version.yml' ) );
|
||||
|
||||
// Compare versions.
|
||||
if ( version_compare( $version, (string) $bsf_core_version, '>' ) ) {
|
||||
if ( version_compare( $version, (string)$bsf_core_version, '>' ) ) {
|
||||
$bsf_core_version = $version;
|
||||
$bsf_core_path = $bsf_core_dir;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,92 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exit if accessed directly.
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
/**
|
||||
* This class initializes Schema for AMP
|
||||
*
|
||||
* @class BSF_AIOSRS_Pro_Schema_Global_Uninstall
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Uninstall {
|
||||
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor function.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->delete_all_plugin_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
/**
|
||||
* Delete function.
|
||||
*/
|
||||
public function delete_queries() {
|
||||
global $wpdb;
|
||||
$delete_keys = BSF_AIOSRS_Pro_Helper::$settings;
|
||||
$delete_keys_options = array_keys( $delete_keys );
|
||||
$delete_options_placeholders = implode( ', ', array_fill( 0, count( $delete_keys_options ), '%s' ) );
|
||||
$wpdb->query( $wpdb->prepare( " DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", '%' . $wpdb->esc_like( 'bsf-aiosrs-' ) . '%' ) );
|
||||
$wpdb->query( $wpdb->prepare( " DELETE FROM {$wpdb->posts} WHERE post_type LIKE %s", '%' . $wpdb->esc_like( 'aiosrs-schema' ) . '%' ) );
|
||||
$query = "DELETE FROM {$wpdb->options} WHERE option_name IN ($delete_options_placeholders)";
|
||||
// @codingStandardsIgnoreStart
|
||||
$wpdb->query( $wpdb->prepare( $query, $delete_keys_options ) );
|
||||
wp_cache_delete($delete_options_placeholders,'options');
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
/**
|
||||
* Delete Schema from single site or multisite.
|
||||
*/
|
||||
public function delete_all_plugin_data() {
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
|
||||
$option_schema = BSF_AIOSRS_Pro_Helper::$settings['aiosrs-pro-settings'];
|
||||
$delete_schema = isset( $option_schema['delete-schema-data'] ) ? $option_schema['delete-schema-data'] : '';
|
||||
if ( '1' === $delete_schema ) {
|
||||
self::delete_queries();
|
||||
}
|
||||
} else {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
||||
$original_blog_id = get_current_blog_id();
|
||||
$option_schema = BSF_AIOSRS_Pro_Helper::$settings['aiosrs-pro-settings'];
|
||||
$delete_schema = isset( $option_schema['delete-schema-data'] ) ? $option_schema['delete-schema-data'] : '';
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
if ( '1' === $delete_schema ) {
|
||||
self::delete_queries();
|
||||
}
|
||||
}
|
||||
switch_to_blog( $original_blog_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BSF_AIOSRS_Pro_Schema_Global_Uninstall::get_instance();
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exit if accessed directly.
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
/**
|
||||
* This class initializes Schema for AMP
|
||||
*
|
||||
* @class BSF_AIOSRS_Pro_Schema_Global_Uninstall
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Uninstall {
|
||||
|
||||
/**
|
||||
* Class instance.
|
||||
*
|
||||
* @access private
|
||||
* @var $instance Class instance.
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Constructor function.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->delete_all_plugin_data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
/**
|
||||
* Delete function.
|
||||
*/
|
||||
public function delete_queries() {
|
||||
global $wpdb;
|
||||
$delete_keys = BSF_AIOSRS_Pro_Helper::$settings;
|
||||
$delete_keys_options = array_keys( $delete_keys );
|
||||
$delete_options_placeholders = implode( ', ', array_fill( 0, count( $delete_keys_options ), '%s' ) );
|
||||
$wpdb->query( $wpdb->prepare( " DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE %s", '%' . $wpdb->esc_like( 'bsf-aiosrs-' ) . '%' ) );
|
||||
$wpdb->query( $wpdb->prepare( " DELETE FROM {$wpdb->posts} WHERE post_type LIKE %s", '%' . $wpdb->esc_like( 'aiosrs-schema' ) . '%' ) );
|
||||
$query = "DELETE FROM {$wpdb->options} WHERE option_name IN ($delete_options_placeholders)";
|
||||
// @codingStandardsIgnoreStart
|
||||
$wpdb->query( $wpdb->prepare( $query, $delete_keys_options ) );
|
||||
wp_cache_delete($delete_options_placeholders,'options');
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
/**
|
||||
* Delete Schema from single site or multisite.
|
||||
*/
|
||||
public function delete_all_plugin_data() {
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
|
||||
$option_schema = BSF_AIOSRS_Pro_Helper::$settings['aiosrs-pro-settings'];
|
||||
$delete_schema = isset( $option_schema['delete-schema-data'] ) ? $option_schema['delete-schema-data'] : '';
|
||||
if ( '1' === $delete_schema ) {
|
||||
self::delete_queries();
|
||||
}
|
||||
} else {
|
||||
global $wpdb;
|
||||
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
||||
$original_blog_id = get_current_blog_id();
|
||||
$option_schema = BSF_AIOSRS_Pro_Helper::$settings['aiosrs-pro-settings'];
|
||||
$delete_schema = isset( $option_schema['delete-schema-data'] ) ? $option_schema['delete-schema-data'] : '';
|
||||
foreach ( $blog_ids as $blog_id ) {
|
||||
switch_to_blog( $blog_id );
|
||||
if ( '1' === $delete_schema ) {
|
||||
self::delete_queries();
|
||||
}
|
||||
}
|
||||
switch_to_blog( $original_blog_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BSF_AIOSRS_Pro_Schema_Global_Uninstall::get_instance();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,477 +1,477 @@
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro - Schema Wizard
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Wizard' ) ) :
|
||||
|
||||
/**
|
||||
* BSF_AIOSRS_Pro_Schema_Wizard class.
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Wizard {
|
||||
|
||||
/**
|
||||
* Hook in tabs.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( apply_filters( 'wp_schema_pro_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
||||
add_action( 'admin_init', array( $this, 'setup_wizard' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add admin menus/screens.
|
||||
*/
|
||||
public function admin_menus() {
|
||||
add_dashboard_page( '', '', 'manage_options', 'aiosrs-pro-setup', '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the setup wizard.
|
||||
*/
|
||||
public function setup_wizard() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( empty( $_GET['page'] ) || 'aiosrs-pro-setup' !== $_GET['page'] ) {
|
||||
return;
|
||||
}
|
||||
$this->steps = array(
|
||||
'basic-config' => array(
|
||||
'name' => __( 'Choose Schema Type', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'choose_schema_type' ),
|
||||
'handler' => array( $this, 'choose_schema_type_save' ),
|
||||
),
|
||||
'enable-on' => array(
|
||||
'name' => __( 'Set Target Pages', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'implement_on_callback' ),
|
||||
'handler' => array( $this, 'implement_on_callback_save' ),
|
||||
),
|
||||
'setup-ready' => array(
|
||||
'name' => __( 'Ready!', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'schema_ready' ),
|
||||
'handler' => '',
|
||||
),
|
||||
);
|
||||
|
||||
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
||||
|
||||
wp_enqueue_style( 'aiosrs-pro-setup', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_css . 'setup-wizard.' . BSF_AIOSRS_Pro_Admin::$minfy_css_ext, array( 'dashicons', 'install' ), BSF_AIOSRS_PRO_VER );
|
||||
wp_enqueue_style( 'aiosrs-pro-admin-edit-style', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_css . 'style.' . BSF_AIOSRS_Pro_Admin::$minfy_css_ext, BSF_AIOSRS_PRO_VER, 'false' );
|
||||
wp_register_script( 'aiosrs-pro-admin-edit-script', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_js . 'script.' . BSF_AIOSRS_Pro_Admin::$minfy_js_ext, array( 'jquery', 'jquery-ui-tooltip' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'aiosrs-pro-setup', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_js . 'setup-wizard.' . BSF_AIOSRS_Pro_Admin::$minfy_js_ext, array( 'jquery' ), BSF_AIOSRS_PRO_VER, true );
|
||||
|
||||
wp_enqueue_style( 'bsf-target-rule-select2', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/select2.css', '', BSF_AIOSRS_PRO_VER, false );
|
||||
wp_enqueue_style( 'bsf-target-rule', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/target-rule.css', '', BSF_AIOSRS_PRO_VER, false );
|
||||
wp_register_script( 'bsf-target-rule-select2', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/select2.js', array( 'jquery', 'backbone', 'wp-util' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'bsf-target-rule', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/target-rule.js', array( 'jquery', 'bsf-target-rule-select2' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'bsf-user-role', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/user-role.js', array( 'jquery' ), BSF_AIOSRS_PRO_VER, true );
|
||||
|
||||
wp_enqueue_media();
|
||||
wp_localize_script(
|
||||
'bsf-target-rule',
|
||||
'Targetrule',
|
||||
array(
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'security' => wp_create_nonce( 'schema_nonce' ),
|
||||
)
|
||||
);
|
||||
if ( ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'aiosrs-pro-setup' ) ) && ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
|
||||
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 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 ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup Wizard Header.
|
||||
*/
|
||||
public function setup_wizard_header() {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php esc_html_e( 'Schema Setup', 'wp-schema-pro' ); ?></title>
|
||||
<script type="text/javascript">
|
||||
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
||||
var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ); ?>';
|
||||
</script>
|
||||
<?php wp_print_scripts( array( 'bsf-target-rule-select2', 'bsf-target-rule', 'bsf-user-role', 'aiosrs-pro-admin-edit-script', 'aiosrs-pro-setup' ) ); ?>
|
||||
<?php do_action( 'admin_print_styles' ); ?>
|
||||
</head>
|
||||
<body class="aiosrs-pro-setup wp-core-ui">
|
||||
<div id="aiosrs-pro-logo">
|
||||
<?php
|
||||
$brand_adv = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-branding-settings'];
|
||||
if ( '' !== $brand_adv['sp_plugin_name'] ) {
|
||||
?>
|
||||
<h2 class="wpsp-setup-pro-title"><?php echo esc_html( $brand_adv['sp_plugin_name'] ); ?></h2>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo esc_url( BSF_AIOSRS_PRO_WEBSITE_URL ); ?>" target="_blank"><img src="<?php echo esc_url( BSF_AIOSRS_PRO_URI . '/admin/assets/images/schema-pro.png' ); ?>" alt="<?php esc_html_e( 'Schema Pro', 'wp-schema-pro' ); ?>" ></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup Wizard Footer.
|
||||
*/
|
||||
public function setup_wizard_footer() {
|
||||
|
||||
$admin_url = BSF_AIOSRS_Pro_Admin::get_page_url( BSF_AIOSRS_Pro_Admin::$parent_page_slug );
|
||||
?>
|
||||
<div class="close-button-wrapper">
|
||||
<a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'wp-schema-pro' ); ?></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the steps.
|
||||
*/
|
||||
public function setup_wizard_steps() {
|
||||
|
||||
$ouput_steps = $this->steps;
|
||||
?>
|
||||
<ol class="aiosrs-pro-setup-steps">
|
||||
<?php
|
||||
foreach ( $ouput_steps as $step_key => $step ) :
|
||||
$classes = '';
|
||||
if ( $step_key === $this->step ) {
|
||||
$classes = 'active';
|
||||
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
|
||||
$classes = 'done';
|
||||
}
|
||||
?>
|
||||
<li class="<?php echo esc_attr( $classes ); ?>">
|
||||
<span><?php echo esc_html( $step['name'] ); ?></span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the content for the current step.
|
||||
*/
|
||||
public function setup_wizard_content() {
|
||||
echo '<div class="aiosrs-pro-setup-content">';
|
||||
call_user_func( $this->steps[ $this->step ]['view'] );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Introduction step.
|
||||
*/
|
||||
public function choose_schema_type() {
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Select the Schema Type:', 'wp-schema-pro' ); ?></h1>
|
||||
<form method="post">
|
||||
<input type="hidden" id="bsf-aiosrs-schema-title" name="bsf-aiosrs-schema-title" class="bsf-aiosrs-schema-title" >
|
||||
<input type="hidden" id="bsf-aiosrs-schema-type" name="bsf-aiosrs-schema-type" class="bsf-aiosrs-schema-type" >
|
||||
<table class="form-table aiosrs-pro-basic-config">
|
||||
<tr>
|
||||
<td><!-- Comment
|
||||
<?php foreach ( BSF_AIOSRS_Pro_Schema::$schema_meta_fields as $key => $schema_field ) { ?>
|
||||
--><span class="aiosrs-pro-schema-temp-wrap" data-schema-type="<?php echo esc_attr( $schema_field['key'] ); ?>" data-schema-title="<?php echo isset( $schema_field['label'] ) ? esc_attr( $schema_field['label'] ) : ''; ?>" >
|
||||
<i class="<?php echo isset( $schema_field['icon'] ) ? esc_attr( $schema_field['icon'] ) : 'dashicons dashicons-media-default'; ?>"></i>
|
||||
<?php echo isset( $schema_field['label'] ) ? esc_attr( $schema_field['label'] ) : ''; ?>
|
||||
</span><!-- Comment
|
||||
<?php } ?>
|
||||
--></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="aiosrs-pro-setup-actions step">
|
||||
<input type="submit" class="uct-activate button-primary button button-large button-next" disabled="true" value="<?php esc_html_e( 'Next', 'wp-schema-pro' ); ?>" name="save_step" />
|
||||
<?php wp_nonce_field( 'aiosrs-pro-setup' ); ?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Locale Settings.
|
||||
*/
|
||||
public function choose_schema_type_save() {
|
||||
check_admin_referer( 'aiosrs-pro-setup' );
|
||||
|
||||
// Update site title & tagline.
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
$title = isset( $_POST['bsf-aiosrs-schema-title'] ) ? sanitize_text_field( $_POST['bsf-aiosrs-schema-title'] ) : 0;
|
||||
$type = isset( $_POST['bsf-aiosrs-schema-type'] ) ? sanitize_text_field( $_POST['bsf-aiosrs-schema-type'] ) : 0;
|
||||
|
||||
$default_fields = array();
|
||||
if ( isset( BSF_AIOSRS_Pro_Schema::$schema_meta_fields[ 'bsf-aiosrs-' . $type ]['subkeys'] ) ) {
|
||||
$default_data = BSF_AIOSRS_Pro_Schema::$schema_meta_fields[ 'bsf-aiosrs-' . $type ]['subkeys'];
|
||||
foreach ( $default_data as $key => $value ) {
|
||||
if ( 'repeater' === $value['type'] ) {
|
||||
foreach ( $value['fields'] as $subkey => $subvalue ) {
|
||||
if ( isset( $subvalue['default'] ) && 'none' !== $subvalue['default'] ) {
|
||||
$default_fields[ $key ][0][ $subkey ] = $subvalue['default'];
|
||||
} else {
|
||||
$default_fields[ $key ][0][ $subkey ] = 'create-field';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( isset( $value['default'] ) && 'none' !== $value['default'] ) {
|
||||
$default_fields[ $key ] = $value['default'];
|
||||
} else {
|
||||
$default_fields[ $key ] = 'create-field';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postarr = array(
|
||||
'post_type' => 'aiosrs-schema',
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'meta_input' => array(
|
||||
'bsf-aiosrs-schema-type' => $type,
|
||||
'bsf-aiosrs-' . $type => $default_fields,
|
||||
),
|
||||
);
|
||||
$post_id = wp_insert_post( $postarr );
|
||||
|
||||
if ( ! is_wp_error( $post_id ) ) {
|
||||
$redirect_url = add_query_arg( 'schema-id', $post_id, $redirect_url );
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( $redirect_url ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locale settings
|
||||
*/
|
||||
public function implement_on_callback() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
$schema_id = 0;
|
||||
$title = '';
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
|
||||
if ( isset( $_GET['schema-id'] ) && ! empty( $_GET['schema-id'] ) ) {
|
||||
$schema_id = intval( $_GET['schema-id'] );
|
||||
$redirect_url = add_query_arg( 'schema-id', $schema_id, $redirect_url );
|
||||
$title = get_the_title( $schema_id );
|
||||
}
|
||||
|
||||
$meta_values = array(
|
||||
'include-locations' => array(
|
||||
'rule' => array( 'basic-singulars' ),
|
||||
),
|
||||
'exclude-locations' => array(),
|
||||
);
|
||||
?>
|
||||
|
||||
<h1>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1 schema title */
|
||||
wp_kses_post( 'Where %s schema should be integrated?', 'wp-schema-pro' ),
|
||||
esc_html( $title )
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
<form method="post">
|
||||
<input type="hidden" name="schema-id" value="<?php echo esc_attr( $schema_id ); ?>">
|
||||
<table class="bsf-aiosrs-schema-table widefat">
|
||||
<tr class="bsf-aiosrs-schema-row">
|
||||
<td class="bsf-aiosrs-schema-row-heading">
|
||||
<label><?php esc_html_e( 'Enable On', 'wp-schema-pro' ); ?></label>
|
||||
<i class="bsf-aiosrs-schema-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Add target pages where this Schema should appear.', 'wp-schema-pro' ); ?>"></i>
|
||||
</td>
|
||||
<td class="bsf-aiosrs-schema-row-content">
|
||||
<?php
|
||||
BSF_Target_Rule_Fields::target_rule_settings_field(
|
||||
'bsf-aiosrs-schema-location',
|
||||
array(
|
||||
'title' => __( 'Display Rules', 'wp-schema-pro' ),
|
||||
'value' => '[{"type":"basic-global","specific":null}]',
|
||||
'tags' => 'site,enable,target,pages',
|
||||
'rule_type' => 'display',
|
||||
'add_rule_label' => __( 'Add “AND” Rule', 'wp-schema-pro' ),
|
||||
),
|
||||
$meta_values['include-locations']
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bsf-aiosrs-schema-row">
|
||||
<td class="bsf-aiosrs-schema-row-heading">
|
||||
<label><?php esc_html_e( 'Exclude From', 'wp-schema-pro' ); ?></label>
|
||||
<i class="bsf-aiosrs-schema-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'This Schema will not appear at these pages.', 'wp-schema-pro' ); ?>"></i>
|
||||
</td>
|
||||
<td class="bsf-aiosrs-schema-row-content">
|
||||
<?php
|
||||
BSF_Target_Rule_Fields::target_rule_settings_field(
|
||||
'bsf-aiosrs-schema-exclusion',
|
||||
array(
|
||||
'title' => __( 'Exclude On', 'wp-schema-pro' ),
|
||||
'value' => '[]',
|
||||
'tags' => 'site,enable,target,pages',
|
||||
'add_rule_label' => __( 'Add “OR” Rule', 'wp-schema-pro' ),
|
||||
'rule_type' => 'exclude',
|
||||
),
|
||||
$meta_values['exclude-locations']
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="aiosrs-pro-setup-actions step">
|
||||
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Next', 'wp-schema-pro' ); ?>" name="save_step" />
|
||||
<?php wp_nonce_field( 'aiosrs-pro-setup' ); ?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Locale Settings.
|
||||
*/
|
||||
public function implement_on_callback_save() {
|
||||
check_admin_referer( 'aiosrs-pro-setup' );
|
||||
|
||||
$schema_id = isset( $_POST['schema-id'] ) ? sanitize_text_field( $_POST['schema-id'] ) : 0;
|
||||
$enabled_on = BSF_Target_Rule_Fields::get_format_rule_value( $_POST, 'bsf-aiosrs-schema-location' );
|
||||
$exclude_from = BSF_Target_Rule_Fields::get_format_rule_value( $_POST, 'bsf-aiosrs-schema-exclusion' );
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
if ( $schema_id ) {
|
||||
|
||||
$redirect_url = add_query_arg( 'schema-id', $schema_id, $redirect_url );
|
||||
update_post_meta( $schema_id, 'bsf-aiosrs-schema-location', $enabled_on );
|
||||
update_post_meta( $schema_id, 'bsf-aiosrs-schema-exclusion', $exclude_from );
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( $redirect_url ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Location rules of schema for Custom meta box.
|
||||
*
|
||||
* @param array $enabled_on Enabled on rules.
|
||||
* @param array $exclude_from Exlcude on rules.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_display_rules_for_meta_box( $enabled_on, $exclude_from ) {
|
||||
$locations = array();
|
||||
$enabled_location = array();
|
||||
$exclude_location = array();
|
||||
|
||||
$args = array(
|
||||
'public' => true,
|
||||
'_builtin' => true,
|
||||
);
|
||||
$post_types = get_post_types( $args );
|
||||
unset( $post_types['attachment'] );
|
||||
|
||||
$args['_builtin'] = false;
|
||||
$custom_post_type = get_post_types( $args );
|
||||
$post_types = array_merge( $post_types, $custom_post_type );
|
||||
|
||||
if ( ! empty( $enabled_on ) && isset( $enabled_on['rule'] ) ) {
|
||||
$enabled_location = $enabled_on['rule'];
|
||||
}
|
||||
if ( ! empty( $exclude_from ) && isset( $exclude_from['rule'] ) ) {
|
||||
$exclude_location = $exclude_from['rule'];
|
||||
}
|
||||
|
||||
if ( in_array( 'specifics', $enabled_location, true ) || ( in_array( 'basic-singulars', $enabled_location, true ) && ! in_array( 'basic-singulars', $exclude_location, true ) ) ) {
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$locations[ $post_type ] = 1;
|
||||
}
|
||||
} else {
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$key = $post_type . '|all';
|
||||
if ( in_array( $key, $enabled_location, true ) && ! in_array( $key, $exclude_location, true ) ) {
|
||||
$locations[ $post_type ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Final step.
|
||||
*/
|
||||
public function schema_ready() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema_id = 0;
|
||||
$title = '';
|
||||
|
||||
if ( isset( $_GET['schema-id'] ) && ! empty( $_GET['schema-id'] ) ) {
|
||||
$schema_id = intval( $_GET['schema-id'] );
|
||||
$title = get_the_title( $schema_id );
|
||||
}
|
||||
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Your Schema is Ready!', 'wp-schema-pro' ); ?></h1>
|
||||
|
||||
<div class="aiosrs-pro-setup-next-steps">
|
||||
<div class="aiosrs-pro-setup-next-steps-last">
|
||||
|
||||
<p class="success">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1 schema title */
|
||||
wp_kses_post( 'Congratulations! The <i>%s</i> Schema has been added and enabled on selected target locations.', 'wp-schema-pro' ),
|
||||
esc_html( $title )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="success">
|
||||
<strong><?php esc_html_e( 'Here’s what to do next:', 'wp-schema-pro' ); ?></strong><br>
|
||||
<?php esc_html_e( 'Step 1: Complete the setup and proceed to fill the required properties of this schema.', 'wp-schema-pro' ); ?><br>
|
||||
<?php esc_html_e( 'Step 2: Add necessary Schema information on individual pages and posts.', 'wp-schema-pro' ); ?><br>
|
||||
<?php esc_html_e( 'Step 3: Test if Schema is integrated correctly.', 'wp-schema-pro' ); ?>
|
||||
</p>
|
||||
|
||||
<table class="form-table aiosrs-pro-schema-ready">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo ( $schema_id ) ? esc_attr( get_edit_post_link( $schema_id ) ) : '#'; ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Complete Setup', 'wp-schema-pro' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
new BSF_AIOSRS_Pro_Schema_Wizard();
|
||||
|
||||
endif;
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro - Schema Wizard
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Wizard' ) ) :
|
||||
|
||||
/**
|
||||
* BSF_AIOSRS_Pro_Schema_Wizard class.
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Wizard {
|
||||
|
||||
/**
|
||||
* Hook in tabs.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( apply_filters( 'wp_schema_pro_enable_setup_wizard', true ) && current_user_can( 'manage_options' ) ) {
|
||||
add_action( 'admin_menu', array( $this, 'admin_menus' ) );
|
||||
add_action( 'admin_init', array( $this, 'setup_wizard' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add admin menus/screens.
|
||||
*/
|
||||
public function admin_menus() {
|
||||
add_dashboard_page( '', '', 'manage_options', 'aiosrs-pro-setup', '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the setup wizard.
|
||||
*/
|
||||
public function setup_wizard() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( empty( $_GET['page'] ) || 'aiosrs-pro-setup' !== $_GET['page'] ) {
|
||||
return;
|
||||
}
|
||||
$this->steps = array(
|
||||
'basic-config' => array(
|
||||
'name' => __( 'Choose Schema Type', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'choose_schema_type' ),
|
||||
'handler' => array( $this, 'choose_schema_type_save' ),
|
||||
),
|
||||
'enable-on' => array(
|
||||
'name' => __( 'Set Target Pages', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'implement_on_callback' ),
|
||||
'handler' => array( $this, 'implement_on_callback_save' ),
|
||||
),
|
||||
'setup-ready' => array(
|
||||
'name' => __( 'Ready!', 'wp-schema-pro' ),
|
||||
'view' => array( $this, 'schema_ready' ),
|
||||
'handler' => '',
|
||||
),
|
||||
);
|
||||
|
||||
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
|
||||
|
||||
wp_enqueue_style( 'aiosrs-pro-setup', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_css . 'setup-wizard.' . BSF_AIOSRS_Pro_Admin::$minfy_css_ext, array( 'dashicons', 'install' ), BSF_AIOSRS_PRO_VER );
|
||||
wp_enqueue_style( 'aiosrs-pro-admin-edit-style', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_css . 'style.' . BSF_AIOSRS_Pro_Admin::$minfy_css_ext, BSF_AIOSRS_PRO_VER, 'false' );
|
||||
wp_register_script( 'aiosrs-pro-admin-edit-script', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_js . 'script.' . BSF_AIOSRS_Pro_Admin::$minfy_js_ext, array( 'jquery', 'jquery-ui-tooltip' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'aiosrs-pro-setup', BSF_AIOSRS_PRO_URI . 'admin/assets/' . BSF_AIOSRS_Pro_Admin::$minfy_js . 'setup-wizard.' . BSF_AIOSRS_Pro_Admin::$minfy_js_ext, array( 'jquery' ), BSF_AIOSRS_PRO_VER, true );
|
||||
|
||||
wp_enqueue_style( 'bsf-target-rule-select2', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/select2.css', '', BSF_AIOSRS_PRO_VER, false );
|
||||
wp_enqueue_style( 'bsf-target-rule', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/target-rule.css', '', BSF_AIOSRS_PRO_VER, false );
|
||||
wp_register_script( 'bsf-target-rule-select2', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/select2.js', array( 'jquery', 'backbone', 'wp-util' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'bsf-target-rule', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/target-rule.js', array( 'jquery', 'bsf-target-rule-select2' ), BSF_AIOSRS_PRO_VER, true );
|
||||
wp_register_script( 'bsf-user-role', BSF_AIOSRS_PRO_URI . 'classes/lib/target-rule/user-role.js', array( 'jquery' ), BSF_AIOSRS_PRO_VER, true );
|
||||
|
||||
wp_enqueue_media();
|
||||
wp_localize_script(
|
||||
'bsf-target-rule',
|
||||
'Targetrule',
|
||||
array(
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'security' => wp_create_nonce( 'schema_nonce' ),
|
||||
)
|
||||
);
|
||||
if ( ( isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'aiosrs-pro-setup' ) ) && ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
|
||||
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 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 ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup Wizard Header.
|
||||
*/
|
||||
public function setup_wizard_header() {
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php esc_html_e( 'Schema Setup', 'wp-schema-pro' ); ?></title>
|
||||
<script type="text/javascript">
|
||||
addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
|
||||
var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ); ?>';
|
||||
</script>
|
||||
<?php wp_print_scripts( array( 'bsf-target-rule-select2', 'bsf-target-rule', 'bsf-user-role', 'aiosrs-pro-admin-edit-script', 'aiosrs-pro-setup' ) ); ?>
|
||||
<?php do_action( 'admin_print_styles' ); ?>
|
||||
</head>
|
||||
<body class="aiosrs-pro-setup wp-core-ui">
|
||||
<div id="aiosrs-pro-logo">
|
||||
<?php
|
||||
$brand_adv = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-branding-settings'];
|
||||
if ( '' !== $brand_adv['sp_plugin_name'] ) {
|
||||
?>
|
||||
<h2 class="wpsp-setup-pro-title"><?php echo esc_html( $brand_adv['sp_plugin_name'] ); ?></h2>
|
||||
<?php } else { ?>
|
||||
<a href="<?php echo esc_url( BSF_AIOSRS_PRO_WEBSITE_URL ); ?>" target="_blank"><img src="<?php echo esc_url( BSF_AIOSRS_PRO_URI . '/admin/assets/images/schema-pro.png' ); ?>" alt="<?php esc_html_e( 'Schema Pro', 'wp-schema-pro' ); ?>" ></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup Wizard Footer.
|
||||
*/
|
||||
public function setup_wizard_footer() {
|
||||
|
||||
$admin_url = BSF_AIOSRS_Pro_Admin::get_page_url( BSF_AIOSRS_Pro_Admin::$parent_page_slug );
|
||||
?>
|
||||
<div class="close-button-wrapper">
|
||||
<a href="<?php echo esc_url( $admin_url ); ?>" class="wizard-close-link" ><?php esc_html_e( 'Exit Setup Wizard', 'wp-schema-pro' ); ?></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the steps.
|
||||
*/
|
||||
public function setup_wizard_steps() {
|
||||
|
||||
$ouput_steps = $this->steps;
|
||||
?>
|
||||
<ol class="aiosrs-pro-setup-steps">
|
||||
<?php
|
||||
foreach ( $ouput_steps as $step_key => $step ) :
|
||||
$classes = '';
|
||||
if ( $step_key === $this->step ) {
|
||||
$classes = 'active';
|
||||
} elseif ( array_search( $this->step, array_keys( $this->steps ), true ) > array_search( $step_key, array_keys( $this->steps ), true ) ) {
|
||||
$classes = 'done';
|
||||
}
|
||||
?>
|
||||
<li class="<?php echo esc_attr( $classes ); ?>">
|
||||
<span><?php echo esc_html( $step['name'] ); ?></span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the content for the current step.
|
||||
*/
|
||||
public function setup_wizard_content() {
|
||||
echo '<div class="aiosrs-pro-setup-content">';
|
||||
call_user_func( $this->steps[ $this->step ]['view'] );
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Introduction step.
|
||||
*/
|
||||
public function choose_schema_type() {
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Select the Schema Type:', 'wp-schema-pro' ); ?></h1>
|
||||
<form method="post">
|
||||
<input type="hidden" id="bsf-aiosrs-schema-title" name="bsf-aiosrs-schema-title" class="bsf-aiosrs-schema-title" >
|
||||
<input type="hidden" id="bsf-aiosrs-schema-type" name="bsf-aiosrs-schema-type" class="bsf-aiosrs-schema-type" >
|
||||
<table class="form-table aiosrs-pro-basic-config">
|
||||
<tr>
|
||||
<td><!-- Comment
|
||||
<?php foreach ( BSF_AIOSRS_Pro_Schema::$schema_meta_fields as $key => $schema_field ) { ?>
|
||||
--><span class="aiosrs-pro-schema-temp-wrap" data-schema-type="<?php echo esc_attr( $schema_field['key'] ); ?>" data-schema-title="<?php echo isset( $schema_field['label'] ) ? esc_attr( $schema_field['label'] ) : ''; ?>" >
|
||||
<i class="<?php echo isset( $schema_field['icon'] ) ? esc_attr( $schema_field['icon'] ) : 'dashicons dashicons-media-default'; ?>"></i>
|
||||
<?php echo isset( $schema_field['label'] ) ? esc_attr( $schema_field['label'] ) : ''; ?>
|
||||
</span><!-- Comment
|
||||
<?php } ?>
|
||||
--></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="aiosrs-pro-setup-actions step">
|
||||
<input type="submit" class="uct-activate button-primary button button-large button-next" disabled="true" value="<?php esc_html_e( 'Next', 'wp-schema-pro' ); ?>" name="save_step" />
|
||||
<?php wp_nonce_field( 'aiosrs-pro-setup' ); ?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Locale Settings.
|
||||
*/
|
||||
public function choose_schema_type_save() {
|
||||
check_admin_referer( 'aiosrs-pro-setup' );
|
||||
|
||||
// Update site title & tagline.
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
$title = isset( $_POST['bsf-aiosrs-schema-title'] ) ? sanitize_text_field( $_POST['bsf-aiosrs-schema-title'] ) : 0;
|
||||
$type = isset( $_POST['bsf-aiosrs-schema-type'] ) ? sanitize_text_field( $_POST['bsf-aiosrs-schema-type'] ) : 0;
|
||||
|
||||
$default_fields = array();
|
||||
if ( isset( BSF_AIOSRS_Pro_Schema::$schema_meta_fields[ 'bsf-aiosrs-' . $type ]['subkeys'] ) ) {
|
||||
$default_data = BSF_AIOSRS_Pro_Schema::$schema_meta_fields[ 'bsf-aiosrs-' . $type ]['subkeys'];
|
||||
foreach ( $default_data as $key => $value ) {
|
||||
if ( 'repeater' === $value['type'] ) {
|
||||
foreach ( $value['fields'] as $subkey => $subvalue ) {
|
||||
if ( isset( $subvalue['default'] ) && 'none' !== $subvalue['default'] ) {
|
||||
$default_fields[ $key ][0][ $subkey ] = $subvalue['default'];
|
||||
} else {
|
||||
$default_fields[ $key ][0][ $subkey ] = 'create-field';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( isset( $value['default'] ) && 'none' !== $value['default'] ) {
|
||||
$default_fields[ $key ] = $value['default'];
|
||||
} else {
|
||||
$default_fields[ $key ] = 'create-field';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$postarr = array(
|
||||
'post_type' => 'aiosrs-schema',
|
||||
'post_title' => $title,
|
||||
'post_status' => 'publish',
|
||||
'meta_input' => array(
|
||||
'bsf-aiosrs-schema-type' => $type,
|
||||
'bsf-aiosrs-' . $type => $default_fields,
|
||||
),
|
||||
);
|
||||
$post_id = wp_insert_post( $postarr );
|
||||
|
||||
if ( ! is_wp_error( $post_id ) ) {
|
||||
$redirect_url = add_query_arg( 'schema-id', $post_id, $redirect_url );
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( $redirect_url ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Locale settings
|
||||
*/
|
||||
public function implement_on_callback() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
$schema_id = 0;
|
||||
$title = '';
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
|
||||
if ( isset( $_GET['schema-id'] ) && ! empty( $_GET['schema-id'] ) ) {
|
||||
$schema_id = intval( $_GET['schema-id'] );
|
||||
$redirect_url = add_query_arg( 'schema-id', $schema_id, $redirect_url );
|
||||
$title = get_the_title( $schema_id );
|
||||
}
|
||||
|
||||
$meta_values = array(
|
||||
'include-locations' => array(
|
||||
'rule' => array( 'basic-singulars' ),
|
||||
),
|
||||
'exclude-locations' => array(),
|
||||
);
|
||||
?>
|
||||
|
||||
<h1>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1 schema title */
|
||||
wp_kses_post( 'Where %s schema should be integrated?', 'wp-schema-pro' ),
|
||||
esc_html( $title )
|
||||
);
|
||||
?>
|
||||
</h1>
|
||||
<form method="post">
|
||||
<input type="hidden" name="schema-id" value="<?php echo esc_attr( $schema_id ); ?>">
|
||||
<table class="bsf-aiosrs-schema-table widefat">
|
||||
<tr class="bsf-aiosrs-schema-row">
|
||||
<td class="bsf-aiosrs-schema-row-heading">
|
||||
<label><?php esc_html_e( 'Enable On', 'wp-schema-pro' ); ?></label>
|
||||
<i class="bsf-aiosrs-schema-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Add target pages where this Schema should appear.', 'wp-schema-pro' ); ?>"></i>
|
||||
</td>
|
||||
<td class="bsf-aiosrs-schema-row-content">
|
||||
<?php
|
||||
BSF_Target_Rule_Fields::target_rule_settings_field(
|
||||
'bsf-aiosrs-schema-location',
|
||||
array(
|
||||
'title' => __( 'Display Rules', 'wp-schema-pro' ),
|
||||
'value' => '[{"type":"basic-global","specific":null}]',
|
||||
'tags' => 'site,enable,target,pages',
|
||||
'rule_type' => 'display',
|
||||
'add_rule_label' => __( 'Add “AND” Rule', 'wp-schema-pro' ),
|
||||
),
|
||||
$meta_values['include-locations']
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="bsf-aiosrs-schema-row">
|
||||
<td class="bsf-aiosrs-schema-row-heading">
|
||||
<label><?php esc_html_e( 'Exclude From', 'wp-schema-pro' ); ?></label>
|
||||
<i class="bsf-aiosrs-schema-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'This Schema will not appear at these pages.', 'wp-schema-pro' ); ?>"></i>
|
||||
</td>
|
||||
<td class="bsf-aiosrs-schema-row-content">
|
||||
<?php
|
||||
BSF_Target_Rule_Fields::target_rule_settings_field(
|
||||
'bsf-aiosrs-schema-exclusion',
|
||||
array(
|
||||
'title' => __( 'Exclude On', 'wp-schema-pro' ),
|
||||
'value' => '[]',
|
||||
'tags' => 'site,enable,target,pages',
|
||||
'add_rule_label' => __( 'Add “OR” Rule', 'wp-schema-pro' ),
|
||||
'rule_type' => 'exclude',
|
||||
),
|
||||
$meta_values['exclude-locations']
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="aiosrs-pro-setup-actions step">
|
||||
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Next', 'wp-schema-pro' ); ?>" name="save_step" />
|
||||
<?php wp_nonce_field( 'aiosrs-pro-setup' ); ?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Locale Settings.
|
||||
*/
|
||||
public function implement_on_callback_save() {
|
||||
check_admin_referer( 'aiosrs-pro-setup' );
|
||||
|
||||
$schema_id = isset( $_POST['schema-id'] ) ? sanitize_text_field( $_POST['schema-id'] ) : 0;
|
||||
$enabled_on = BSF_Target_Rule_Fields::get_format_rule_value( $_POST, 'bsf-aiosrs-schema-location' );
|
||||
$exclude_from = BSF_Target_Rule_Fields::get_format_rule_value( $_POST, 'bsf-aiosrs-schema-exclusion' );
|
||||
$redirect_url = $this->get_next_step_link();
|
||||
if ( $schema_id ) {
|
||||
|
||||
$redirect_url = add_query_arg( 'schema-id', $schema_id, $redirect_url );
|
||||
update_post_meta( $schema_id, 'bsf-aiosrs-schema-location', $enabled_on );
|
||||
update_post_meta( $schema_id, 'bsf-aiosrs-schema-exclusion', $exclude_from );
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( $redirect_url ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Location rules of schema for Custom meta box.
|
||||
*
|
||||
* @param array $enabled_on Enabled on rules.
|
||||
* @param array $exclude_from Exlcude on rules.
|
||||
* @return array
|
||||
*/
|
||||
public static function get_display_rules_for_meta_box( $enabled_on, $exclude_from ) {
|
||||
$locations = array();
|
||||
$enabled_location = array();
|
||||
$exclude_location = array();
|
||||
|
||||
$args = array(
|
||||
'public' => true,
|
||||
'_builtin' => true,
|
||||
);
|
||||
$post_types = get_post_types( $args );
|
||||
unset( $post_types['attachment'] );
|
||||
|
||||
$args['_builtin'] = false;
|
||||
$custom_post_type = get_post_types( $args );
|
||||
$post_types = array_merge( $post_types, $custom_post_type );
|
||||
|
||||
if ( ! empty( $enabled_on ) && isset( $enabled_on['rule'] ) ) {
|
||||
$enabled_location = $enabled_on['rule'];
|
||||
}
|
||||
if ( ! empty( $exclude_from ) && isset( $exclude_from['rule'] ) ) {
|
||||
$exclude_location = $exclude_from['rule'];
|
||||
}
|
||||
|
||||
if ( in_array( 'specifics', $enabled_location, true ) || ( in_array( 'basic-singulars', $enabled_location, true ) && ! in_array( 'basic-singulars', $exclude_location, true ) ) ) {
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$locations[ $post_type ] = 1;
|
||||
}
|
||||
} else {
|
||||
foreach ( $post_types as $post_type ) {
|
||||
$key = $post_type . '|all';
|
||||
if ( in_array( $key, $enabled_location, true ) && ! in_array( $key, $exclude_location, true ) ) {
|
||||
$locations[ $post_type ] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $locations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Final step.
|
||||
*/
|
||||
public function schema_ready() {
|
||||
if ( isset( $_REQUEST['wp_schema_pro_admin_page_nonce'] ) && ! wp_verify_nonce( $_REQUEST['wp_schema_pro_admin_page_nonce'], 'wp_schema_pro_admin_page' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$schema_id = 0;
|
||||
$title = '';
|
||||
|
||||
if ( isset( $_GET['schema-id'] ) && ! empty( $_GET['schema-id'] ) ) {
|
||||
$schema_id = intval( $_GET['schema-id'] );
|
||||
$title = get_the_title( $schema_id );
|
||||
}
|
||||
|
||||
?>
|
||||
<h1><?php esc_html_e( 'Your Schema is Ready!', 'wp-schema-pro' ); ?></h1>
|
||||
|
||||
<div class="aiosrs-pro-setup-next-steps">
|
||||
<div class="aiosrs-pro-setup-next-steps-last">
|
||||
|
||||
<p class="success">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1 schema title */
|
||||
wp_kses_post( 'Congratulations! The <i>%s</i> Schema has been added and enabled on selected target locations.', 'wp-schema-pro' ),
|
||||
esc_html( $title )
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<p class="success">
|
||||
<strong><?php esc_html_e( 'Here’s what to do next:', 'wp-schema-pro' ); ?></strong><br>
|
||||
<?php esc_html_e( 'Step 1: Complete the setup and proceed to fill the required properties of this schema.', 'wp-schema-pro' ); ?><br>
|
||||
<?php esc_html_e( 'Step 2: Add necessary Schema information on individual pages and posts.', 'wp-schema-pro' ); ?><br>
|
||||
<?php esc_html_e( 'Step 3: Test if Schema is integrated correctly.', 'wp-schema-pro' ); ?>
|
||||
</p>
|
||||
|
||||
<table class="form-table aiosrs-pro-schema-ready">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo ( $schema_id ) ? esc_attr( get_edit_post_link( $schema_id ) ) : '#'; ?>" type="button" class="button button-primary button-hero" ><?php esc_html_e( 'Complete Setup', 'wp-schema-pro' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
new BSF_AIOSRS_Pro_Schema_Wizard();
|
||||
|
||||
endif;
|
||||
|
||||
@@ -605,12 +605,6 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'default' => 'create-field',
|
||||
'description' => esc_html__( 'The organization that publishes the source content of the course. For example, UC Berkeley.', 'wp-schema-pro' ),
|
||||
),
|
||||
'offer-category' => array(
|
||||
'label' => esc_html__( 'Offer Category', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The pricing category of the course.(e.g. Free, Partially Free, Subscription, Paid).', 'wp-schema-pro' ),
|
||||
),
|
||||
'course-instance' => array(
|
||||
'label' => esc_html__( 'Course Instance', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
@@ -668,25 +662,6 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'type' => 'date',
|
||||
'default' => 'none',
|
||||
),
|
||||
'repeat-count' => array(
|
||||
'label' => esc_html__( 'Repeat Count', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'attrs' => array(
|
||||
'min' => '0',
|
||||
'step' => 'any',
|
||||
),
|
||||
),
|
||||
'repeat-frequency' => array(
|
||||
'label' => esc_html__( 'Repeat Frequency', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'course-workload' => array(
|
||||
'label' => esc_html__( 'Course Workload', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'previous-date' => array(
|
||||
'label' => esc_html__( 'Course Previous Start Date', 'wp-schema-pro' ),
|
||||
'type' => 'datetime-local',
|
||||
@@ -1768,9 +1743,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'required' => true,
|
||||
),
|
||||
'recipe-video-content-url' => array(
|
||||
'label' => esc_html__( 'Content URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
'label' => esc_html__( 'Content URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
'required' => true,
|
||||
),
|
||||
'recipe-video-embed-url' => array(
|
||||
@@ -1961,108 +1936,66 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'guideline-link' => empty( $doc_link ) ? 'https://wpschema.com/docs/how-to-add-a-schema-markup-for-a-video-object/' : 'https://developers.google.com/search/docs/data-types/videos',
|
||||
'path' => BSF_AIOSRS_PRO_DIR . 'classes/schema/',
|
||||
'subkeys' => array(
|
||||
'name' => array(
|
||||
'name' => array(
|
||||
'label' => esc_html__( 'Video Title', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'post_title',
|
||||
'required' => true,
|
||||
),
|
||||
'description' => array(
|
||||
'description' => array(
|
||||
'label' => esc_html__( 'Video Description', 'wp-schema-pro' ),
|
||||
'type' => 'textarea',
|
||||
'default' => 'post_content',
|
||||
'required' => true,
|
||||
),
|
||||
'image' => array(
|
||||
'image' => array(
|
||||
'label' => esc_html__( 'Video Thumbnail', 'wp-schema-pro' ),
|
||||
'type' => 'image',
|
||||
'default' => 'featured_img',
|
||||
'required' => true,
|
||||
),
|
||||
'upload-date' => array(
|
||||
'upload-date' => array(
|
||||
'label' => esc_html__( 'Video Upload Date', 'wp-schema-pro' ),
|
||||
'type' => 'date',
|
||||
'default' => 'post_date',
|
||||
'required' => true,
|
||||
),
|
||||
'orgnization-name' => array(
|
||||
'orgnization-name' => array(
|
||||
'label' => esc_html__( 'Publisher Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'blogname',
|
||||
),
|
||||
'site-logo' => array(
|
||||
'site-logo' => array(
|
||||
'label' => esc_html__( 'Publisher Logo', 'wp-schema-pro' ),
|
||||
'type' => 'image',
|
||||
'default' => 'site_logo',
|
||||
),
|
||||
'content-url' => array(
|
||||
'content-url' => array(
|
||||
'label' => esc_html__( 'Content URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'embed-url' => array(
|
||||
'embed-url' => array(
|
||||
'label' => esc_html__( 'Embed URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'duration' => array(
|
||||
'duration' => array(
|
||||
'label' => esc_html__( 'Video Duration', 'wp-schema-pro' ),
|
||||
'type' => 'time-duration',
|
||||
'default' => 'none',
|
||||
),
|
||||
'expires-date' => array(
|
||||
'expires-date' => array(
|
||||
'label' => esc_html__( 'Video Expires On', 'wp-schema-pro' ),
|
||||
'type' => 'date',
|
||||
'default' => 'none',
|
||||
),
|
||||
'interaction-count' => array(
|
||||
'interaction-count' => array(
|
||||
'label' => esc_html__( 'Video Interaction Count', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The number of times the video has been watched.', 'wp-schema-pro' ),
|
||||
),
|
||||
'clip' => array(
|
||||
'label' => esc_html__( 'Clips', 'wp-schema-pro' ),
|
||||
'type' => 'repeater',
|
||||
'is_recommnded' => true,
|
||||
'fields' => array(
|
||||
'clip-name' => array(
|
||||
'label' => esc_html__( 'Clip Name', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
),
|
||||
'clip-start-offset' => array(
|
||||
'label' => esc_html__( 'Clip Start Offset', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The start time of the clip expressed as the number of seconds from the beginning of the work.', 'wp-schema-pro' ),
|
||||
),
|
||||
'clip-end-offset' => array(
|
||||
'label' => esc_html__( 'Clip End Offset', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The end time of the clip expressed as the number of seconds from the beginning of the work.', 'wp-schema-pro' ),
|
||||
),
|
||||
'clip-url' => array(
|
||||
'label' => esc_html__( 'Clip URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'A URL that points to the start time of the clip.', 'wp-schema-pro' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'seekto-action-start-offset' => array(
|
||||
'label' => esc_html__( 'Seek To Action Start Offset', 'wp-schema-pro' ),
|
||||
'type' => 'number',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'The number of seconds to skip to.', 'wp-schema-pro' ),
|
||||
),
|
||||
'seekto-action-target' => array(
|
||||
'label' => esc_html__( 'Seek To Action target URL', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'none',
|
||||
'description' => esc_html__( 'A URL that points to the start time of the clip.', 'wp-schema-pro' ),
|
||||
),
|
||||
),
|
||||
),
|
||||
'bsf-aiosrs-faq' => array(
|
||||
@@ -2229,12 +2162,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
),
|
||||
'credit-text' => array(
|
||||
'credit-text' => array(
|
||||
'label' => esc_html__( 'Credit Text', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
),
|
||||
'creator-type' => array(
|
||||
'creator-type' => array(
|
||||
'label' => esc_html__( 'Creator Type', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'Person',
|
||||
@@ -2243,12 +2176,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema' ) ) {
|
||||
'Organization' => esc_html__( 'Organization', 'wp-schema-pro' ),
|
||||
),
|
||||
),
|
||||
'creator' => array(
|
||||
'creator' => array(
|
||||
'label' => esc_html__( 'Creator', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'author_name',
|
||||
),
|
||||
'copy-right-notice' => array(
|
||||
'copy-right-notice' => array(
|
||||
'label' => esc_html__( 'Copy Right Notice', 'wp-schema-pro' ),
|
||||
'type' => 'text',
|
||||
'default' => 'create-field',
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -36,25 +36,25 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Article' ) ) {
|
||||
$schema['mainEntityOfPage']['@id'] = esc_url( $data['main-entity'] );
|
||||
}
|
||||
|
||||
$schema['headline'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['headline'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
$schema['datePublished'] = ! empty( $data['published-date'] ) ? wp_strip_all_tags( (string) $data['published-date'] ) : null;
|
||||
$schema['datePublished'] = ! empty( $data['published-date'] ) ? wp_strip_all_tags( (string)$data['published-date'] ) : NULL;
|
||||
|
||||
$schema['dateModified'] = ! empty( $data['modified-date'] ) ? wp_strip_all_tags( (string) $data['modified-date'] ) : null;
|
||||
$schema['dateModified'] = ! empty( $data['modified-date'] ) ? wp_strip_all_tags( (string)$data['modified-date'] ) : NULL;
|
||||
|
||||
if ( ! empty( $data['author'] ) ) {
|
||||
$schema['author']['@type'] = 'Person';
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string) $data['author'] );
|
||||
$schema['author']['url'] = ! empty( $data['author-url'] ) ? wp_strip_all_tags( (string) $data['author-url'] ) : null;
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string)$data['author'] );
|
||||
$schema['author']['url'] = ! empty( $data['author-url'] ) ? wp_strip_all_tags( (string)$data['author-url'] ) : NULL;
|
||||
}
|
||||
|
||||
if ( ! empty( $data['orgnization-name'] ) ) {
|
||||
$schema['publisher']['@type'] = 'Organization';
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string)$data['orgnization-name'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['site-logo'] ) && ! empty( $data['site-logo'] ) ) {
|
||||
@@ -80,7 +80,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Article' ) ) {
|
||||
}
|
||||
}
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_article', $schema, $data, $post );
|
||||
}
|
||||
|
||||
@@ -28,14 +28,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Book';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $data['author'] ) ) {
|
||||
$schema['author']['@type'] = 'Person';
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string) $data['author'] );
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string)$data['author'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['url'] ) && ! empty( $data['url'] ) ) {
|
||||
@@ -50,11 +50,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
|
||||
foreach ( $data['work-example'] as $key => $value ) {
|
||||
|
||||
$schema['workExample'][ $key ]['@type'] = 'Book';
|
||||
$schema['workExample'][ $key ]['isbn'] = ! empty( $value['serial-number'] ) ? wp_strip_all_tags( (string) $value['serial-number'] ) : null;
|
||||
$schema['workExample'][ $key ]['isbn'] = ! empty( $value['serial-number'] ) ? wp_strip_all_tags( (string)$value['serial-number'] ) : NULL;
|
||||
|
||||
$schema['workExample'][ $key ]['bookEdition'] = ! empty( $value['book-edition'] ) ? wp_strip_all_tags( (string) $value['book-edition'] ) : null;
|
||||
$schema['workExample'][ $key ]['bookEdition'] = ! empty( $value['book-edition'] ) ? wp_strip_all_tags( (string)$value['book-edition'] ) : NULL;
|
||||
|
||||
$schema['workExample'][ $key ]['bookFormat'] = ! empty( $value['book-format'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string) $value['book-format'] ) : null;
|
||||
$schema['workExample'][ $key ]['bookFormat'] = ! empty( $value['book-format'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$value['book-format'] ) : NULL;
|
||||
|
||||
$schema['workExample'][ $key ]['potentialAction']['@type'] = 'ReadAction';
|
||||
$schema['workExample'][ $key ]['potentialAction']['target']['@type'] = 'EntryPoint';
|
||||
@@ -65,10 +65,10 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Book' ) ) {
|
||||
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['@type'] = 'Offer';
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = '0';
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string) $value['price'] ) : null;
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string)$value['price'] ) : NULL;
|
||||
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string) $value['currency'] ) : null;
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string) $value['avail'] ) : null;
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string)$value['currency'] ) : NULL;
|
||||
$schema['workExample'][ $key ]['potentialAction']['expectsAcceptanceOf']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string)$value['avail'] ) : NULL;
|
||||
|
||||
if ( isset( $value['country'] ) && ! empty( $value['country'] ) ) {
|
||||
$expects_acceptance = explode( ',', $value['country'] );
|
||||
|
||||
@@ -28,14 +28,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Course';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['courseCode'] = ! empty( $data['course-code'] ) ? wp_strip_all_tags( (string) $data['course-code'] ) : null;
|
||||
$schema['courseCode'] = ! empty( $data['course-code'] ) ? wp_strip_all_tags( (string)$data['course-code'] ) : NULL;
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['category'] = ! empty( $data['offer-category'] ) ? wp_strip_all_tags( (string) $data['offer-category'] ) : null;;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
if ( isset( $data['course-instance'] ) && ! empty( $data['course-instance'] ) ) {
|
||||
|
||||
@@ -47,47 +44,28 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
|
||||
isset( $value['location-address'] ) && ! empty( $value['location-address'] ) ) {
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['@type'] = 'CourseInstance';
|
||||
$schema['hasCourseInstance'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string)$value['name'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['description'] = ! empty( $value['description'] ) ? wp_strip_all_tags( (string) $value['description'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['description'] = ! empty( $value['description'] ) ? wp_strip_all_tags( (string)$value['description'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['courseMode'] = ! empty( $value['course-mode'] ) ? wp_strip_all_tags( (string) $value['course-mode'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['courseMode'] = ! empty( $value['course-mode'] ) ? wp_strip_all_tags( (string)$value['course-mode'] ) : NULL;
|
||||
|
||||
if ( ! empty( $value['course-workload'] ) ) {
|
||||
$schema['hasCourseInstance'][ $key ]['courseWorkload'] = ! empty( $value['course-workload'] ) ? wp_strip_all_tags( (string) $value['course-workload'] ) : null;
|
||||
} else if ( ! empty( $value['repeat-count'] ) && ! empty( $value['repeat-frequency'] ) ) {
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['@type'] = 'Schedule';
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['repeatCount'] = ! empty( $value['repeat-count'] ) ? wp_strip_all_tags( (string) $value['repeat-count'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['repeatFrequency'] = ! empty( $value['repeat-frequency'] ) ? wp_strip_all_tags( (string) $value['repeat-frequency'] ) : null;
|
||||
if ( ! empty( $value['start-date'] ) ) {
|
||||
if ( 'OfflineEventAttendanceMode' !== isset( $value['event-attendance-mode'] ) ) {
|
||||
$start_date = gmdate( DATE_ISO8601, strtotime( $value['start-date'] ) );
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['startDate'] = wp_strip_all_tags( (string) $start_date );
|
||||
} else {
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['startDate'] = wp_strip_all_tags( (string) $value['start-date'] );
|
||||
}
|
||||
}
|
||||
if ( ! empty( $value['end-date'] ) ) {
|
||||
$schema['hasCourseInstance'][ $key ]['courseSchedule']['endDate'] = ! empty( $value['end-date'] ) ? wp_strip_all_tags( (string) $value['end-date'] ) : null;
|
||||
}
|
||||
}
|
||||
$schema['hasCourseInstance'][ $key ]['eventStatus'] = ! empty( $value['event-status'] ) ? wp_strip_all_tags( (string)$value['event-status'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['eventStatus'] = ! empty( $value['event-status'] ) ? wp_strip_all_tags( (string) $value['event-status'] ) : null;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['eventAttendanceMode'] = ! empty( $value['event-attendance-mode'] ) ? wp_strip_all_tags( (string) $value['event-attendance-mode'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['eventAttendanceMode'] = ! empty( $value['event-attendance-mode'] ) ? wp_strip_all_tags( (string)$value['event-attendance-mode'] ) : NULL;
|
||||
|
||||
if ( ! empty( $value['start-date'] ) ) {
|
||||
if ( 'OfflineEventAttendanceMode' !== isset( $value['event-attendance-mode'] ) ) {
|
||||
$start_date = gmdate( DATE_ISO8601, strtotime( $value['start-date'] ) );
|
||||
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string) $start_date );
|
||||
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string)$start_date );
|
||||
} else {
|
||||
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string) $value['start-date'] );
|
||||
$schema['hasCourseInstance'][ $key ]['startDate'] = wp_strip_all_tags( (string)$value['start-date'] );
|
||||
}
|
||||
}
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['endDate'] = ! empty( $value['end-date'] ) ? wp_strip_all_tags( (string) $value['end-date'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['endDate'] = ! empty( $value['end-date'] ) ? wp_strip_all_tags( (string)$value['end-date'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['previousStartDate'] = ! empty( $value['previous-date'] ) ? wp_strip_all_tags( (string) $value['previous-date'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['previousStartDate'] = ! empty( $value['previous-date'] ) ? wp_strip_all_tags( (string)$value['previous-date'] ) : NULL;
|
||||
|
||||
if ( isset( $value['online-location'] ) && ! empty( $value['online-location'] ) && 'OfflineEventAttendanceMode' !== $value['event-attendance-mode'] || 'MixedEventAttendanceMode' === $value['event-attendance-mode'] ) {
|
||||
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'VirtualLocation';
|
||||
@@ -100,34 +78,34 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
|
||||
|
||||
if ( ! empty( $value['location-name'] ) && 'OnlineEventAttendanceMode' !== $value['event-attendance-mode'] ) {
|
||||
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'Place';
|
||||
$schema['hasCourseInstance'][ $key ]['location']['name'] = wp_strip_all_tags( (string) $value['location-name'] );
|
||||
$schema['hasCourseInstance'][ $key ]['location']['name'] = wp_strip_all_tags( (string)$value['location-name'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $value['location-address'] ) && 'OnlineEventAttendanceMode' !== $value['event-attendance-mode'] && is_string( $value['location-address'] ) ) {
|
||||
$schema['hasCourseInstance'][ $key ]['location']['@type'] = 'Place';
|
||||
$schema['hasCourseInstance'][ $key ]['location']['address'] = wp_strip_all_tags( (string) $value['location-address'] );
|
||||
$schema['hasCourseInstance'][ $key ]['location']['address'] = wp_strip_all_tags( (string)$value['location-address'] );
|
||||
}
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['organizer']['@type'] = 'Organization';
|
||||
$schema['hasCourseInstance'][ $key ]['organizer']['name'] = ! empty( $value['course-organizer-name'] ) ? wp_strip_all_tags( (string) $value['course-organizer-name'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['organizer']['url'] = ! empty( $value['course-organizer-url'] ) ? wp_strip_all_tags( (string) $value['course-organizer-url'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['organizer']['name'] = ! empty( $value['course-organizer-name'] ) ? wp_strip_all_tags( (string)$value['course-organizer-name'] ) : NULL;
|
||||
$schema['hasCourseInstance'][ $key ]['organizer']['url'] = ! empty( $value['course-organizer-url'] ) ? wp_strip_all_tags( (string)$value['course-organizer-url'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['@type'] = 'Offer';
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['price'] = '0';
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string) $value['price'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['price'] = ! empty( $value['price'] ) ? wp_strip_all_tags( (string)$value['price'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string) $value['currency'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['priceCurrency'] = ! empty( $value['currency'] ) ? wp_strip_all_tags( (string)$value['currency'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string) $value['url'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string)$value['url'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['validFrom'] = ! empty( $value['valid-from'] ) ? wp_strip_all_tags( (string) $value['valid-from'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['validFrom'] = ! empty( $value['valid-from'] ) ? wp_strip_all_tags( (string)$value['valid-from'] ) : NULL;
|
||||
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string) $value['avail'] ) : null;
|
||||
$schema['hasCourseInstance'][ $key ]['offers']['availability'] = ! empty( $value['avail'] ) ? wp_strip_all_tags( (string)$value['avail'] ) : NULL;
|
||||
|
||||
if ( ! empty( $value['performer'] ) ) {
|
||||
$schema['hasCourseInstance'][ $key ]['performer']['@type'] = 'Person';
|
||||
$schema['hasCourseInstance'][ $key ]['performer']['name'] = wp_strip_all_tags( (string) $value['performer'] );
|
||||
$schema['hasCourseInstance'][ $key ]['performer']['name'] = wp_strip_all_tags( (string)$value['performer'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +116,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
|
||||
|
||||
$schema['provider']['@type'] = 'Organization';
|
||||
|
||||
$schema['provider']['name'] = ! empty( $data['orgnization-name'] ) ? wp_strip_all_tags( (string) $data['orgnization-name'] ) : null;
|
||||
$schema['provider']['name'] = ! empty( $data['orgnization-name'] ) ? wp_strip_all_tags( (string)$data['orgnization-name'] ) : NULL;
|
||||
if ( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) {
|
||||
$schema['provider']['sameAs'] = esc_url( $data['same-as'] );
|
||||
}
|
||||
@@ -149,8 +127,8 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Course' ) ) {
|
||||
|
||||
$schema['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( $data['review-count'] ) : null;
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string)$data['rating'] ) : NULL;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( $data['review-count'] ) : NULL;
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_course', $schema, $data, $post );
|
||||
|
||||
@@ -76,19 +76,19 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
if ( $offline ) {
|
||||
if ( ! empty( $data['location'] ) ) {
|
||||
$schema['location']['@type'] = 'Place';
|
||||
$schema['location']['name'] = wp_strip_all_tags( (string) $data['location'] );
|
||||
$schema['location']['name'] = wp_strip_all_tags( (string)$data['location'] );
|
||||
}
|
||||
|
||||
$schema['location']['@type'] = 'Place';
|
||||
$schema['location']['address']['@type'] = 'PostalAddress';
|
||||
$schema['location']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
|
||||
$schema['location']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
|
||||
$schema['location']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
|
||||
$schema['location']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
|
||||
$schema['location']['@type'] = 'Place';
|
||||
$schema['location']['address']['@type'] = 'PostalAddress';
|
||||
$schema['location']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string)$data['location-street'] ) : NULL;
|
||||
$schema['location']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string)$data['location-locality'] ) : NULL;
|
||||
$schema['location']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string)$data['location-postal'] ) : NULL;
|
||||
$schema['location']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string)$data['location-region'] ) : NULL;
|
||||
if ( ! empty( $data['location-country'] ) ) {
|
||||
|
||||
$schema['location']['address']['addressCountry']['@type'] = 'Country';
|
||||
$schema['location']['address']['addressCountry']['name'] = wp_strip_all_tags( (string) $data['location-country'] );
|
||||
$schema['location']['address']['addressCountry']['name'] = wp_strip_all_tags( (string)$data['location-country'] );
|
||||
}
|
||||
} else {
|
||||
$schema['location']['@type'] = 'VirtualLocation';
|
||||
@@ -106,12 +106,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
*/
|
||||
public static function prepare_offer( $schema, $data ) {
|
||||
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string) $data['price'] ) : null;
|
||||
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string) $data['avail'] ) : null;
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
|
||||
$schema['offers']['validFrom'] = ! empty( $data['valid-from'] ) ? wp_strip_all_tags( (string) $data['valid-from'] ) : null;
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string)$data['price'] ) : NULL;
|
||||
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string)$data['avail'] ) : NULL;
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string)$data['currency'] ) : NULL;
|
||||
$schema['offers']['validFrom'] = ! empty( $data['valid-from'] ) ? wp_strip_all_tags( (string)$data['valid-from'] ) : NULL;
|
||||
if ( isset( $data['ticket-buy-url'] ) && ! empty( $data['ticket-buy-url'] ) ) {
|
||||
$schema['offers']['url'] = esc_url( $data['ticket-buy-url'] );
|
||||
}
|
||||
@@ -131,11 +131,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
|
||||
if ( ! empty( $data['performer'] ) ) {
|
||||
$schema['performer']['@type'] = 'Person';
|
||||
$schema['performer']['name'] = wp_strip_all_tags( (string) $data['performer'] );
|
||||
$schema['performer']['name'] = wp_strip_all_tags( (string)$data['performer'] );
|
||||
}
|
||||
$schema['organizer']['@type'] = 'Organization';
|
||||
$schema['organizer']['name'] = ! empty( $data['event-organizer-name'] ) ? wp_strip_all_tags( (string) $data['event-organizer-name'] ) : null;
|
||||
$schema['organizer']['url'] = ! empty( $data['event-organizer-url'] ) ? wp_strip_all_tags( (string) $data['event-organizer-url'] ) : null;
|
||||
$schema['organizer']['name'] = ! empty( $data['event-organizer-name'] ) ? wp_strip_all_tags( (string)$data['event-organizer-name'] ) : NULL;
|
||||
$schema['organizer']['url'] = ! empty( $data['event-organizer-url'] ) ? wp_strip_all_tags( (string)$data['event-organizer-url'] ) : NULL;
|
||||
|
||||
return $schema;
|
||||
}
|
||||
@@ -149,12 +149,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
*/
|
||||
public static function prepare_dates( $schema, $data ) {
|
||||
|
||||
$start_date = gmdate( DATE_ISO8601, strtotime( $data['start-date'] ) );
|
||||
$schema['startDate'] = ! empty( $start_date ) ? wp_strip_all_tags( (string) $start_date ) : null;
|
||||
$start_date = gmdate( DATE_ISO8601, strtotime( $data['start-date'] ) );
|
||||
$schema['startDate'] = ! empty( $start_date ) ? wp_strip_all_tags( (string)$start_date ) : NULL;
|
||||
|
||||
$schema['endDate'] = ! empty( $data['end-date'] ) ? wp_strip_all_tags( (string) $data['end-date'] ) : null;
|
||||
$schema['endDate'] = ! empty( $data['end-date'] ) ? wp_strip_all_tags( (string)$data['end-date'] ) : NULL;
|
||||
|
||||
$schema['previousStartDate'] = 'EventRescheduled' === $data['event-status'] ? wp_strip_all_tags( (string) $data['previous-date'] ) : null;
|
||||
$schema['previousStartDate'] = 'EventRescheduled' === $data['event-status'] ? wp_strip_all_tags( (string)$data['previous-date'] ) : NULL;
|
||||
|
||||
return $schema;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
*/
|
||||
public static function prepare_attendence_mode( $schema, $data ) {
|
||||
|
||||
$schema['eventAttendanceMode'] = isset( $data['schema-type'] ) && ! empty( $data['event-attendance-mode'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string) $data['event-attendance-mode'] ) : null;
|
||||
$schema['eventAttendanceMode'] = isset( $data['schema-type'] ) && ! empty( $data['event-attendance-mode'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$data['event-attendance-mode'] ) : NULL;
|
||||
|
||||
return $schema;
|
||||
}
|
||||
@@ -182,15 +182,15 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Event' ) ) {
|
||||
*/
|
||||
public static function prepare_basics( $schema, $data ) {
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['eventStatus'] = ! empty( $data['event-status'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string) $data['event-status'] ) : null;
|
||||
$schema['eventStatus'] = ! empty( $data['event-status'] ) ? 'https://schema.org/' . wp_strip_all_tags( (string)$data['event-status'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_FAQ' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_FAQ {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $data Meta Data.
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $data, $post ) {
|
||||
global $post;
|
||||
$schema = array();
|
||||
if ( isset( $data['question-answer'][0]['question'] ) && ! empty( $data['question-answer'][0]['question'] ) ) {
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'FAQPage';
|
||||
foreach ( $data['question-answer'] as $key => $value ) {
|
||||
if ( isset( $value['question'] ) && ! empty( $value['question'] ) ) {
|
||||
$schema['mainEntity'][ $key ]['@type'] = 'Question';
|
||||
$schema['mainEntity'][ $key ]['name'] = $value['question'];
|
||||
}
|
||||
if ( isset( $value['answer'] ) && ! empty( $value['answer'] ) ) {
|
||||
$schema['mainEntity'][ $key ]['acceptedAnswer']['@type'] = 'Answer';
|
||||
$schema['mainEntity'][ $key ]['acceptedAnswer']['text'] = $value['answer'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return apply_filters( 'wp_schema_pro_schema_faq', $schema, $data, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_FAQ' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_FAQ {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $data Meta Data.
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $data, $post ) {
|
||||
global $post;
|
||||
$schema = array();
|
||||
if ( isset( $data['question-answer'][0]['question'] ) && ! empty( $data['question-answer'][0]['question'] ) ) {
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['type'] = 'FAQPage';
|
||||
foreach ( $data['question-answer'] as $key => $value ) {
|
||||
if ( isset( $value['question'] ) && ! empty( $value['question'] ) ) {
|
||||
$schema['mainEntity'][ $key ]['@type'] = 'Question';
|
||||
$schema['mainEntity'][ $key ]['name'] = $value['question'];
|
||||
}
|
||||
if ( isset( $value['answer'] ) && ! empty( $value['answer'] ) ) {
|
||||
$schema['mainEntity'][ $key ]['acceptedAnswer']['@type'] = 'Answer';
|
||||
$schema['mainEntity'][ $key ]['acceptedAnswer']['text'] = $value['answer'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return apply_filters( 'wp_schema_pro_schema_faq', $schema, $data, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_How_To' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'HowTo';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
$schema['totalTime'] = ! empty( $data['total-time'] ) ? wp_strip_all_tags( (string) $data['total-time'] ) : null;
|
||||
$schema['totalTime'] = ! empty( $data['total-time'] ) ? wp_strip_all_tags( (string)$data['total-time'] ) : NULL;
|
||||
|
||||
if ( isset( $data['supply'] ) && ! empty( $data['supply'] ) ) {
|
||||
|
||||
@@ -42,7 +42,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_How_To' ) ) {
|
||||
|
||||
$schema['supply'][ $key ]['@type'] = 'HowToSupply';
|
||||
|
||||
$schema['supply'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
|
||||
$schema['supply'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string)$value['name'] ) : NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_How_To' ) ) {
|
||||
|
||||
$schema['tool'][ $key ]['@type'] = 'HowToTool';
|
||||
|
||||
$schema['tool'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
|
||||
$schema['tool'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string)$value['name'] ) : NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Image_License' ) ) {
|
||||
$schema[ $key ]['creditText'] = esc_url( $value['credit-text'] );
|
||||
}
|
||||
if ( ! empty( $data['creator-type'] ) ) {
|
||||
$schema['creator']['@type'] = wp_strip_all_tags( (string) $data['creator-type'] );
|
||||
$schema['creator']['@type'] = wp_strip_all_tags( (string)$data['creator-type'] );
|
||||
} else {
|
||||
$schema[ $key ]['creator']['@type'] = 'Person';
|
||||
}
|
||||
|
||||
@@ -28,42 +28,42 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Job_Posting' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'JobPosting';
|
||||
|
||||
$schema['title'] = ! empty( $data['title'] ) ? wp_strip_all_tags( (string) $data['title'] ) : null;
|
||||
$schema['title'] = ! empty( $data['title'] ) ? wp_strip_all_tags( (string)$data['title'] ) : NULL;
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? (string) $data['description'] : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? (string)$data['description'] : NULL;
|
||||
|
||||
$schema['datePosted'] = ! empty( $data['start-date'] ) ? wp_strip_all_tags( (string) $data['start-date'] ) : null;
|
||||
$schema['datePosted'] = ! empty( $data['start-date'] ) ? wp_strip_all_tags( (string)$data['start-date'] ) : NULL;
|
||||
|
||||
$schema['validThrough'] = ! empty( $data['expiry-date'] ) ? wp_strip_all_tags( (string) $data['expiry-date'] ) : null;
|
||||
$schema['validThrough'] = ! empty( $data['expiry-date'] ) ? wp_strip_all_tags( (string)$data['expiry-date'] ) : NULL;
|
||||
|
||||
$schema['employmentType'] = ! empty( $data['job-type'] ) ? wp_strip_all_tags( (string) $data['job-type'] ) : null;
|
||||
$schema['employmentType'] = ! empty( $data['job-type'] ) ? wp_strip_all_tags( (string)$data['job-type'] ) : NULL;
|
||||
|
||||
if ( ! empty( $data['education-requirements'] ) && 'none' !== $data['education-requirements'] ) {
|
||||
$schema['educationRequirements']['@type'] = 'EducationalOccupationalCredential';
|
||||
$schema['educationRequirements']['credentialCategory'] = wp_strip_all_tags( (string) $data['education-requirements'] );
|
||||
if ( ! empty( $data['education-requirements'] ) ) {
|
||||
$schema['educationRequirements']['@type'] = 'EducationalOccupationalCredential';
|
||||
$schema['educationRequirements']['credentialCategory'] = wp_strip_all_tags( (string)$data['education-requirements'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $data['experience-requirements'] ) && 'none' !== $data['experience-requirements'] ) {
|
||||
$schema['experienceRequirements']['@type'] = 'OccupationalExperienceRequirements';
|
||||
$schema['experienceRequirements']['monthsOfExperience'] = wp_strip_all_tags( (string) $data['experience-requirements'] );
|
||||
if ( ! empty( $data['experience-requirements'] ) ) {
|
||||
$schema['experienceRequirements']['@type'] = 'OccupationalExperienceRequirements';
|
||||
$schema['experienceRequirements']['monthsOfExperience'] = wp_strip_all_tags( (string)$data['experience-requirements'] );
|
||||
}
|
||||
|
||||
$schema['industry'] = ! empty( $data['industry'] ) ? wp_strip_all_tags( (string) $data['industry'] ) : null;
|
||||
$schema['industry'] = ! empty( $data['industry'] ) ? wp_strip_all_tags( (string)$data['industry'] ) : NULL;
|
||||
|
||||
$schema['qualifications'] = ! empty( $data['qualifications'] ) ? wp_strip_all_tags( (string) $data['qualifications'] ) : null;
|
||||
$schema['qualifications'] = ! empty( $data['qualifications'] ) ? wp_strip_all_tags( (string)$data['qualifications'] ) : NULL;
|
||||
|
||||
$schema['responsibilities'] = ! empty( $data['responsibilities'] ) ? wp_strip_all_tags( (string) $data['responsibilities'] ) : null;
|
||||
$schema['responsibilities'] = ! empty( $data['responsibilities'] ) ? wp_strip_all_tags( (string)$data['responsibilities'] ) : NULL;
|
||||
|
||||
$schema['skills'] = ! empty( $data['skills'] ) ? wp_strip_all_tags( (string) $data['skills'] ) : null;
|
||||
$schema['skills'] = ! empty( $data['skills'] ) ? wp_strip_all_tags( (string)$data['skills'] ) : NULL;
|
||||
|
||||
$schema['workHours'] = ! empty( $data['work-hours'] ) ? wp_strip_all_tags( (string) $data['work-hours'] ) : null;
|
||||
$schema['workHours'] = ! empty( $data['work-hours'] ) ? wp_strip_all_tags( (string)$data['work-hours'] ) : NULL;
|
||||
|
||||
if ( ( isset( $data['orgnization-name'] ) && ! empty( $data['orgnization-name'] ) ) ||
|
||||
( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) ) {
|
||||
|
||||
$schema['hiringOrganization']['@type'] = 'Organization';
|
||||
|
||||
$schema['hiringOrganization']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
|
||||
$schema['hiringOrganization']['name'] = wp_strip_all_tags( (string)$data['orgnization-name'] );
|
||||
if ( isset( $data['same-as'] ) && ! empty( $data['same-as'] ) ) {
|
||||
$schema['hiringOrganization']['sameAs'] = esc_url( $data['same-as'] );
|
||||
}
|
||||
@@ -82,30 +82,30 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Job_Posting' ) ) {
|
||||
$schema['jobLocation']['@type'] = 'Place';
|
||||
$schema['jobLocation']['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['jobLocation']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
|
||||
$schema['jobLocation']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
|
||||
$schema['jobLocation']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
|
||||
$schema['jobLocation']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
|
||||
$schema['jobLocation']['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string) $data['location-country'] ) : null;
|
||||
$schema['jobLocation']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string)$data['location-street'] ) : NULL;
|
||||
$schema['jobLocation']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string)$data['location-locality'] ) : NULL;
|
||||
$schema['jobLocation']['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string)$data['location-postal'] ) : NULL;
|
||||
$schema['jobLocation']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string)$data['location-region'] ) : NULL;
|
||||
$schema['jobLocation']['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string)$data['location-country'] ) : NULL;
|
||||
}
|
||||
|
||||
$schema['jobLocationType'] = ( ! empty( $data['job-location-type'] ) && 'none' !== $data['job-location-type'] ) ? wp_strip_all_tags( (string) $data['job-location-type'] ) : null;
|
||||
$schema['jobLocationType'] = ! empty( $data['job-location-type'] ) ? wp_strip_all_tags( (string)$data['job-location-type'] ) : NULL;
|
||||
|
||||
if ( isset( $data['remote-location'] ) && ! empty( $data['remote-location'] ) ) {
|
||||
foreach ( $data['remote-location'] as $key => $value ) {
|
||||
$schema['applicantLocationRequirements'][ $key ]['@type'] = 'Country';
|
||||
$schema['applicantLocationRequirements'][ $key ]['name'] = wp_strip_all_tags( (string) $value['applicant-location'] );
|
||||
$schema['applicantLocationRequirements'][ $key ]['name'] = wp_strip_all_tags( (string)$value['applicant-location'] );
|
||||
}
|
||||
} else {
|
||||
if ( isset( $data['applicant-location'] ) && ! empty( $data['applicant-location'] ) ) {
|
||||
$schema['applicantLocationRequirements']['@type'] = 'Country';
|
||||
$schema['applicantLocationRequirements']['name'] = wp_strip_all_tags( (string) $data['applicant-location'] );
|
||||
$schema['applicantLocationRequirements']['name'] = wp_strip_all_tags( (string)$data['applicant-location'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $data['salary-currency'] ) && ! empty( $data['salary-currency'] ) ) {
|
||||
$schema['baseSalary']['@type'] = 'MonetaryAmount';
|
||||
$schema['baseSalary']['currency'] = wp_strip_all_tags( (string) $data['salary-currency'] );
|
||||
$schema['baseSalary']['currency'] = wp_strip_all_tags( (string)$data['salary-currency'] );
|
||||
}
|
||||
|
||||
if ( ( isset( $data['salary'] ) && ! empty( $data['salary'] ) ) ||
|
||||
@@ -114,10 +114,10 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Job_Posting' ) ) {
|
||||
$schema['baseSalary']['@type'] = 'MonetaryAmount';
|
||||
$schema['baseSalary']['value']['@type'] = 'QuantitativeValue';
|
||||
|
||||
$schema['baseSalary']['value']['value'] = ! empty( $data['salary'] ) ? wp_strip_all_tags( (string) $data['salary'] ) : null;
|
||||
$schema['baseSalary']['value']['minValue'] = ( ! empty( $data['salary-min-value'] ) && 'none' !== $data['salary-min-value'] ) ? wp_strip_all_tags( (string) $data['salary-min-value'] ) : null;
|
||||
$schema['baseSalary']['value']['maxValue'] = ( ! empty( $data['salary-max-value'] ) && 'none' !== $data['salary-max-value'] ) ? wp_strip_all_tags( (string) $data['salary-max-value'] ) : null;
|
||||
$schema['baseSalary']['value']['unitText'] = ! empty( $data['salary-unit'] ) ? wp_strip_all_tags( (string) $data['salary-unit'] ) : null;
|
||||
$schema['baseSalary']['value']['value'] = ! empty( $data['salary'] ) ? wp_strip_all_tags( (string)$data['salary'] ) : NULL;
|
||||
$schema['baseSalary']['value']['minValue'] = ! empty( $data['salary-min-value'] ) ? wp_strip_all_tags( (string)$data['salary-min-value'] ) : NULL;
|
||||
$schema['baseSalary']['value']['maxValue'] = ! empty( $data['salary-max-value'] ) ? wp_strip_all_tags( (string)$data['salary-max-value'] ) : NULL;
|
||||
$schema['baseSalary']['value']['unitText'] = ! empty( $data['salary-unit'] ) ? wp_strip_all_tags( (string)$data['salary-unit'] ) : NULL;
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_job_posting', $schema, $data, $post );
|
||||
|
||||
@@ -33,15 +33,15 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Local_Business' ) ) {
|
||||
$schema['@type'] = 'LocalBusiness';
|
||||
}
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
|
||||
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string)$data['telephone'] ) : NULL;
|
||||
|
||||
$schema['url'] = ! empty( $data['url'] ) ? wp_strip_all_tags( (string) $data['url'] ) : null;
|
||||
$schema['url'] = ! empty( $data['url'] ) ? wp_strip_all_tags( (string)$data['url'] ) : NULL;
|
||||
|
||||
if ( ( isset( $data['location-street'] ) && ! empty( $data['location-street'] ) ) ||
|
||||
( isset( $data['location-locality'] ) && ! empty( $data['location-locality'] ) ) ||
|
||||
@@ -51,22 +51,22 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Local_Business' ) ) {
|
||||
|
||||
$schema['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
|
||||
$schema['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
|
||||
$schema['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string) $data['location-postal'] ) : null;
|
||||
$schema['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
|
||||
$schema['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string) $data['location-country'] ) : null;
|
||||
$schema['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string)$data['location-street'] ) : NULL;
|
||||
$schema['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string)$data['location-locality'] ) : NULL;
|
||||
$schema['address']['postalCode'] = ! empty( $data['location-postal'] ) ? wp_strip_all_tags( (string)$data['location-postal'] ) : NULL;
|
||||
$schema['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string)$data['location-region'] ) : NULL;
|
||||
$schema['address']['addressCountry'] = ! empty( $data['location-country'] ) ? wp_strip_all_tags( (string)$data['location-country'] ) : NULL;
|
||||
}
|
||||
|
||||
if ( ! empty( $data['rating'] ) && ! empty( $data['review-count'] ) && 'none' !== $data['rating'] && 'none' !== $data['review-count'] ) {
|
||||
|
||||
$schema['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string)$data['rating'] ) : NULL;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string)$data['review-count'] ) : NULL;
|
||||
}
|
||||
|
||||
$schema['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string) $data['price-range'] ) : null;
|
||||
$schema['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string)$data['price-range'] ) : NULL;
|
||||
|
||||
if ( isset( $data['hours-specification'] ) && ! empty( $data['hours-specification'] ) ) {
|
||||
foreach ( $data['hours-specification'] as $key => $value ) {
|
||||
@@ -80,8 +80,8 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Local_Business' ) ) {
|
||||
}
|
||||
if ( isset( $data['geo-latitude'] ) && isset( $data['geo-longitude'] ) ) {
|
||||
$schema['geo']['@type'] = 'GeoCoordinates';
|
||||
$schema['geo']['latitude'] = wp_strip_all_tags( (string) $data['geo-latitude'] );
|
||||
$schema['geo']['longitude'] = wp_strip_all_tags( (string) $data['geo-longitude'] );
|
||||
$schema['geo']['latitude'] = wp_strip_all_tags( (string)$data['geo-latitude'] );
|
||||
$schema['geo']['longitude'] = wp_strip_all_tags( (string)$data['geo-longitude'] );
|
||||
|
||||
}
|
||||
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
|
||||
@@ -92,22 +92,22 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Local_Business' ) ) {
|
||||
if ( '1' === $contact_type['cp-schema-type'] && true === apply_filters( 'wp_schema_pro_contactpoint_local_business_schema_enabled', true ) && isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
|
||||
$schema['ContactPoint']['@type'] = 'ContactPoint';
|
||||
|
||||
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string) $contact_type['contact-type'] ) : null;
|
||||
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string) $contact_type['telephone'] ) : null;
|
||||
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string)$contact_type['contact-type'] ) : NULL;
|
||||
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string)$contact_type['telephone'] ) : NULL;
|
||||
if ( isset( $contact_type['url'] ) && ! empty( $contact_type['url'] ) ) {
|
||||
$schema ['ContactPoint']['url'] = esc_url( $contact_type['url'] );
|
||||
}
|
||||
$schema ['ContactPoint']['email'] = ! empty( $contact_type['email'] ) ? wp_strip_all_tags( (string) $contact_type['email'] ) : null;
|
||||
$schema ['ContactPoint']['email'] = ! empty( $contact_type['email'] ) ? wp_strip_all_tags( (string)$contact_type['email'] ) : NULL;
|
||||
if ( isset( $contact_type['areaServed'] ) && ! empty( $contact_type['areaServed'] ) ) {
|
||||
$language = explode( ',', $contact_type['areaServed'] );
|
||||
foreach ( $language as $key => $value ) {
|
||||
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
}
|
||||
foreach ( $contact_point_type as $key => $value ) {
|
||||
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
$schema ['ContactPoint']['availableLanguage'] = ! empty( $contact_type['availableLanguage'] ) ? wp_strip_all_tags( (string) $contact_type['availableLanguage'] ) : null;
|
||||
$schema ['ContactPoint']['availableLanguage'] = ! empty( $contact_type['availableLanguage'] ) ? wp_strip_all_tags( (string)$contact_type['availableLanguage'] ) : NULL;
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_local_business', $schema, $data, $post );
|
||||
|
||||
@@ -28,7 +28,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Person';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
if ( ( isset( $data['street'] ) && ! empty( $data['street'] ) ) ||
|
||||
( isset( $data['locality'] ) && ! empty( $data['locality'] ) ) ||
|
||||
@@ -37,35 +37,35 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
|
||||
|
||||
$schema['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['address']['addressLocality'] = ! empty( $data['locality'] ) ? wp_strip_all_tags( (string) $data['locality'] ) : null;
|
||||
$schema['address']['addressLocality'] = ! empty( $data['locality'] ) ? wp_strip_all_tags( (string)$data['locality'] ) : NULL;
|
||||
|
||||
$schema['address']['addressRegion'] = ! empty( $data['region'] ) ? wp_strip_all_tags( (string) $data['region'] ) : null;
|
||||
$schema['address']['addressRegion'] = ! empty( $data['region'] ) ? wp_strip_all_tags( (string)$data['region'] ) : NULL;
|
||||
|
||||
$schema['address']['postalCode'] = ! empty( $data['postal'] ) ? wp_strip_all_tags( (string) $data['postal'] ) : null;
|
||||
$schema['address']['postalCode'] = ! empty( $data['postal'] ) ? wp_strip_all_tags( (string)$data['postal'] ) : NULL;
|
||||
|
||||
$schema['address']['streetAddress'] = ! empty( $data['street'] ) ? wp_strip_all_tags( (string) $data['street'] ) : null;
|
||||
$schema['address']['streetAddress'] = ! empty( $data['street'] ) ? wp_strip_all_tags( (string)$data['street'] ) : NULL;
|
||||
}
|
||||
|
||||
$schema['email'] = ! empty( $data['email'] ) ? wp_strip_all_tags( (string) $data['email'] ) : null;
|
||||
$schema['email'] = ! empty( $data['email'] ) ? wp_strip_all_tags( (string)$data['email'] ) : NULL;
|
||||
|
||||
$schema['gender'] = ! empty( $data['gender'] ) ? wp_strip_all_tags( (string) $data['gender'] ) : null;
|
||||
$schema['gender'] = ! empty( $data['gender'] ) ? wp_strip_all_tags( (string)$data['gender'] ) : NULL;
|
||||
|
||||
if ( isset( $data['dob'] ) && ! empty( $data['dob'] ) ) {
|
||||
$date_informat = gmdate( 'Y.m.d', strtotime( $data['dob'] ) );
|
||||
$schema['birthDate'] = wp_strip_all_tags( (string) $date_informat );
|
||||
$schema['birthDate'] = wp_strip_all_tags( (string)$date_informat );
|
||||
}
|
||||
|
||||
$schema['memberOf'] = ! empty( $data['member'] ) ? wp_strip_all_tags( (string) $data['member'] ) : null;
|
||||
$schema['memberOf'] = ! empty( $data['member'] ) ? wp_strip_all_tags( (string)$data['member'] ) : NULL;
|
||||
|
||||
$schema['nationality'] = ! empty( $data['nationality'] ) ? wp_strip_all_tags( (string) $data['nationality'] ) : null;
|
||||
$schema['nationality'] = ! empty( $data['nationality'] ) ? wp_strip_all_tags( (string)$data['nationality'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
$schema['jobTitle'] = ! empty( $data['job-title'] ) ? wp_strip_all_tags( (string) $data['job-title'] ) : null;
|
||||
$schema['jobTitle'] = ! empty( $data['job-title'] ) ? wp_strip_all_tags( (string)$data['job-title'] ) : NULL;
|
||||
|
||||
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
|
||||
$schema['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string)$data['telephone'] ) : NULL;
|
||||
|
||||
if ( isset( $data['homepage-url'] ) && ! empty( $data['homepage-url'] ) ) {
|
||||
$schema['url'] = esc_url( $data['homepage-url'] );
|
||||
@@ -86,22 +86,22 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Person' ) ) {
|
||||
if ( '1' === $contact_type['cp-schema-type'] && true === apply_filters( 'wp_schema_pro_contactpoint_person_schema_enabled', true ) && isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
|
||||
$schema['ContactPoint']['@type'] = 'ContactPoint';
|
||||
|
||||
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string) $contact_type['contact-type'] ) : null;
|
||||
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string) $contact_type['telephone'] ) : null;
|
||||
$schema ['ContactPoint']['contactType'] = ! empty( $contact_type['contact-type'] ) ? wp_strip_all_tags( (string)$contact_type['contact-type'] ) : NULL;
|
||||
$schema ['ContactPoint']['telephone'] = ! empty( $contact_type['telephone'] ) ? wp_strip_all_tags( (string)$contact_type['telephone'] ) : NULL;
|
||||
if ( isset( $contact_type['url'] ) && ! empty( $contact_type['url'] ) ) {
|
||||
$schema ['ContactPoint']['url'] = esc_url( $contact_type['url'] );
|
||||
}
|
||||
$schema ['ContactPoint']['email'] = ! empty( $contact_type['email'] ) ? wp_strip_all_tags( (string) $contact_type['email'] ) : null;
|
||||
$schema ['ContactPoint']['email'] = ! empty( $contact_type['email'] ) ? wp_strip_all_tags( (string)$contact_type['email'] ) : NULL;
|
||||
if ( isset( $contact_type['areaServed'] ) && ! empty( $contact_type['areaServed'] ) ) {
|
||||
$language = explode( ',', $contact_type['areaServed'] );
|
||||
foreach ( $language as $key => $value ) {
|
||||
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
}
|
||||
foreach ( $contact_point_type as $key => $value ) {
|
||||
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema ['ContactPoint']['contactOption'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
$schema ['ContactPoint']['availableLanguage'] = ! empty( $contact_type['availableLanguage'] ) ? wp_strip_all_tags( (string) $contact_type['availableLanguage'] ) : null;
|
||||
$schema ['ContactPoint']['availableLanguage'] = ! empty( $contact_type['availableLanguage'] ) ? wp_strip_all_tags( (string)$contact_type['availableLanguage'] ) : NULL;
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_person', $schema, $data, $post );
|
||||
|
||||
@@ -26,19 +26,19 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
$schema = array();
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Product';
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
$schema['sku'] = ! empty( $data['sku'] ) ? wp_strip_all_tags( (string) $data['sku'] ) : null;
|
||||
$schema['mpn'] = ! empty( $data['mpn'] ) ? wp_strip_all_tags( (string) $data['mpn'] ) : null;
|
||||
$schema['sku'] = ! empty( $data['sku'] ) ? wp_strip_all_tags( (string)$data['sku'] ) : NULL;
|
||||
$schema['mpn'] = ! empty( $data['mpn'] ) ? wp_strip_all_tags( (string)$data['mpn'] ) : NULL;
|
||||
if ( ! empty( $data['brand-name'] ) ) {
|
||||
$schema['brand']['@type'] = 'Brand';
|
||||
$schema['brand']['name'] = wp_strip_all_tags( (string) $data['brand-name'] );
|
||||
$schema['brand']['name'] = wp_strip_all_tags( (string)$data['brand-name'] );
|
||||
}
|
||||
|
||||
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
|
||||
@@ -46,14 +46,14 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
|
||||
$schema['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string)$data['rating'] ) : NULL;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string)$data['review-count'] ) : NULL;
|
||||
}
|
||||
if ( apply_filters( 'wp_schema_pro_remove_product_offers', true ) ) {
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string) $data['price'] ) : null;
|
||||
$schema['offers']['priceValidUntil'] = ! empty( $data['price-valid-until'] ) ? wp_strip_all_tags( (string) $data['price-valid-until'] ) : null;
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string)$data['price'] ) : NULL;
|
||||
$schema['offers']['priceValidUntil'] = ! empty( $data['price-valid-until'] ) ? wp_strip_all_tags( (string)$data['price-valid-until'] ) : NULL;
|
||||
|
||||
if ( isset( $data['url'] ) && ! empty( $data['url'] ) ) {
|
||||
$schema['offers']['url'] = esc_url( $data['url'] );
|
||||
@@ -62,28 +62,28 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Product' ) ) {
|
||||
if ( ( isset( $data['currency'] ) && ! empty( $data['currency'] ) ) ||
|
||||
( isset( $data['avail'] ) && ! empty( $data['avail'] ) ) ) {
|
||||
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
|
||||
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string) $data['avail'] ) : null;
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string)$data['currency'] ) : NULL;
|
||||
$schema['offers']['availability'] = ! empty( $data['avail'] ) ? wp_strip_all_tags( (string)$data['avail'] ) : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( apply_filters( 'wp_schema_pro_remove_product_reviews', true ) && isset( $data['product-review'] ) && ! empty( $data['product-review'] ) ) {
|
||||
foreach ( $data['product-review'] as $key => $value ) {
|
||||
if ( ( isset( $value['reviewer-name'] ) && ! empty( $value['reviewer-name'] ) ) && ( isset( $value['product-rating'] ) && ! empty( $value['product-rating'] ) ) ) {
|
||||
$schema['review'][ $key ]['@type'] = 'Review';
|
||||
$schema['review'][ $key ]['author']['name'] = wp_strip_all_tags( (string) $value['reviewer-name'] );
|
||||
$schema['review'][ $key ]['@type'] = 'Review';
|
||||
$schema['review'][ $key ]['author']['name'] = wp_strip_all_tags( (string)$value['reviewer-name'] );
|
||||
if ( isset( $value['reviewer-type'] ) && ! empty( $value['reviewer-type'] ) ) {
|
||||
$schema['review'][ $key ]['author']['@type'] = wp_strip_all_tags( (string) $value['reviewer-type'] );
|
||||
$schema['review'][ $key ]['author']['@type'] = wp_strip_all_tags( (string)$value['reviewer-type'] );
|
||||
} else {
|
||||
$schema['review'][ $key ]['author']['@type'] = 'Person';
|
||||
}
|
||||
|
||||
if ( isset( $value['product-rating'] ) && ! empty( $value['product-rating'] ) ) {
|
||||
$schema['review'][ $key ]['reviewRating']['@type'] = 'Rating';
|
||||
$schema['review'][ $key ]['reviewRating']['ratingValue'] = wp_strip_all_tags( (string) $value['product-rating'] );
|
||||
$schema['review'][ $key ]['reviewRating']['ratingValue'] = wp_strip_all_tags( (string)$value['product-rating'] );
|
||||
}
|
||||
|
||||
$schema['review'][ $key ]['reviewBody'] = ! empty( $value['review-body'] ) ? wp_strip_all_tags( (string) $value['review-body'] ) : null;
|
||||
$schema['review'][ $key ]['reviewBody'] = ! empty( $value['review-body'] ) ? wp_strip_all_tags( (string)$value['review-body'] ) : NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,50 +28,50 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Recipe';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
}
|
||||
if ( isset( $data['reviewer-type'] ) && ! empty( $data['reviewer-type'] ) ) {
|
||||
$schema['author']['@type'] = wp_strip_all_tags( (string) $data['reviewer-type'] );
|
||||
$schema['author']['@type'] = wp_strip_all_tags( (string)$data['reviewer-type'] );
|
||||
} else {
|
||||
$schema['author']['@type'] = 'Person';
|
||||
}
|
||||
$schema['author']['name'] = ! empty( $data['author'] ) ? wp_strip_all_tags( (string) $data['author'] ) : null;
|
||||
$schema['author']['name'] = ! empty( $data['author'] ) ? wp_strip_all_tags( (string)$data['author'] ) : NULL;
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
$schema['prepTime'] = ! empty( $data['preperation-time'] ) ? wp_strip_all_tags( (string) $data['preperation-time'] ) : null;
|
||||
$schema['prepTime'] = ! empty( $data['preperation-time'] ) ? wp_strip_all_tags( (string)$data['preperation-time'] ) : NULL;
|
||||
|
||||
$schema['cookTime'] = ! empty( $data['cook-time'] ) ? wp_strip_all_tags( (string) $data['cook-time'] ) : null;
|
||||
$schema['cookTime'] = ! empty( $data['cook-time'] ) ? wp_strip_all_tags( (string)$data['cook-time'] ) : NULL;
|
||||
if ( isset( $data['recipe-yield'] ) && ! empty( $data['recipe-yield'] ) ) {
|
||||
$schema['recipeYield'] = esc_html( $data['recipe-yield'] );
|
||||
}
|
||||
$schema['keywords'] = ! empty( $data['recipe-keywords'] ) ? wp_strip_all_tags( (string) $data['recipe-keywords'] ) : null;
|
||||
$schema['keywords'] = ! empty( $data['recipe-keywords'] ) ? wp_strip_all_tags( (string)$data['recipe-keywords'] ) : NULL;
|
||||
|
||||
$schema['recipeCategory'] = ! empty( $data['recipe-category'] ) ? wp_strip_all_tags( (string) $data['recipe-category'] ) : null;
|
||||
$schema['recipeCategory'] = ! empty( $data['recipe-category'] ) ? wp_strip_all_tags( (string)$data['recipe-category'] ) : NULL;
|
||||
|
||||
$schema['recipeCuisine'] = ! empty( $data['recipe-cuisine'] ) ? wp_strip_all_tags( (string) $data['recipe-cuisine'] ) : null;
|
||||
$schema['recipeCuisine'] = ! empty( $data['recipe-cuisine'] ) ? wp_strip_all_tags( (string)$data['recipe-cuisine'] ) : NULL;
|
||||
|
||||
if ( ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) ||
|
||||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
|
||||
|
||||
$schema['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string)$data['rating'] ) : NULL;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string)$data['review-count'] ) : NULL;
|
||||
}
|
||||
|
||||
if ( isset( $data['nutrition'] ) && ! empty( $data['nutrition'] ) ) {
|
||||
$schema['nutrition']['@type'] = 'NutritionInformation';
|
||||
$schema['nutrition']['calories'] = wp_strip_all_tags( (string) $data['nutrition'] );
|
||||
$schema['nutrition']['calories'] = wp_strip_all_tags( (string)$data['nutrition'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['ingredients'] ) && ! empty( $data['ingredients'] ) ) {
|
||||
$recipe_ingredients = explode( ',', $data['ingredients'] );
|
||||
foreach ( $recipe_ingredients as $key => $value ) {
|
||||
$schema['recipeIngredient'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema['recipeIngredient'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
|
||||
if ( isset( $value['steps'] ) && ! empty( $value['steps'] ) ) {
|
||||
|
||||
$schema['recipeInstructions'][ $key ]['@type'] = 'HowToStep';
|
||||
$schema['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string) $value['steps'] );
|
||||
$schema['recipeInstructions'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string) $value['name'] ) : null;
|
||||
$schema['recipeInstructions'][ $key ]['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string) $value['url'] ) : null;
|
||||
$schema['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string)$value['steps'] );
|
||||
$schema['recipeInstructions'][ $key ]['name'] = ! empty( $value['name'] ) ? wp_strip_all_tags( (string)$value['name'] ) : NULL;
|
||||
$schema['recipeInstructions'][ $key ]['url'] = ! empty( $value['url'] ) ? wp_strip_all_tags( (string)$value['url'] ) : NULL;
|
||||
if ( isset( $value['image'] ) && ! empty( $value['image'] ) ) {
|
||||
$schema['recipeInstructions'][ $key ]['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['image'], 'URL' );
|
||||
}
|
||||
@@ -95,9 +95,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
|
||||
|
||||
foreach ( $data['recipe-video'] as $key => $value ) {
|
||||
if ( isset( $value['video-name'] ) && ! empty( $value['video-name'] ) ) {
|
||||
$schema['video'][ $key ]['@type'] = 'VideoObject';
|
||||
$schema['video'][ $key ]['name'] = wp_strip_all_tags( (string) $value['video-name'] );
|
||||
$schema['video'][ $key ]['description'] = ! empty( $value['video-desc'] ) ? wp_strip_all_tags( (string) $value['video-desc'] ) : null;
|
||||
$schema['video'][ $key ]['@type'] = 'VideoObject';
|
||||
$schema['video'][ $key ]['name'] = wp_strip_all_tags( (string)$value['video-name'] );
|
||||
$schema['video'][ $key ]['description'] = ! empty( $value['video-desc'] ) ? wp_strip_all_tags( (string)$value['video-desc'] ) : NULL;
|
||||
if ( isset( $value['video-image'] ) && ! empty( $value['video-image'] ) ) {
|
||||
$schema['video'][ $key ]['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $value['video-image'], 'URL' );
|
||||
}
|
||||
@@ -107,9 +107,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Recipe' ) ) {
|
||||
if ( isset( $value['recipe-video-embed-url'] ) && ! empty( $value['recipe-video-embed-url'] ) ) {
|
||||
$schema['video'][ $key ]['embedUrl'] = esc_url( $value['recipe-video-embed-url'] );
|
||||
}
|
||||
$schema['video'][ $key ]['duration'] = ! empty( $value['recipe-video-duration'] ) ? wp_strip_all_tags( (string) $value['recipe-video-duration'] ) : null;
|
||||
$schema['video'][ $key ]['uploadDate'] = ! empty( $value['recipe-video-upload-date'] ) ? wp_strip_all_tags( (string) $value['recipe-video-upload-date'] ) : null;
|
||||
$schema['video'][ $key ]['interactionCount'] = ! empty( $value['recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string) $value['recipe-video-interaction-count'] ) : null;
|
||||
$schema['video'][ $key ]['duration'] = ! empty( $value['recipe-video-duration'] ) ? wp_strip_all_tags( (string)$value['recipe-video-duration'] ) : NULL;
|
||||
$schema['video'][ $key ]['uploadDate'] = ! empty( $value['recipe-video-upload-date'] ) ? wp_strip_all_tags( (string)$value['recipe-video-upload-date'] ) : NULL;
|
||||
$schema['video'][ $key ]['interactionCount'] = ! empty( $value['recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string)$value['recipe-video-interaction-count'] ) : NULL;
|
||||
if ( isset( $value['recipe-video-expires-date'] ) && ! empty( $value['recipe-video-expires-date'] ) && is_string( $value['recipe-video-expires-date'] ) ) {
|
||||
$schema['video'][ $key ]['expires'] = wp_strip_all_tags( $value['recipe-video-expires-date'] );
|
||||
}
|
||||
|
||||
@@ -34,50 +34,50 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
switch ( $data['schema-type'] ) {
|
||||
case 'bsf-aiosrs-book':
|
||||
$schema['itemReviewed']['@type'] = 'Book';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-book-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-book-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-book-name'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-book-author'] ) && ! empty( $data['bsf-aiosrs-book-author'] ) ) {
|
||||
$schema['itemReviewed']['author']['@type'] = 'Person';
|
||||
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-book-author'] );
|
||||
$schema['itemReviewed']['author']['sameAs'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-book-same-As'] );
|
||||
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-book-author'] );
|
||||
$schema['itemReviewed']['author']['sameAs'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-book-same-As'] );
|
||||
|
||||
}
|
||||
$schema['itemReviewed']['isbn'] = ! empty( $data['bsf-aiosrs-book-serial-number'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-serial-number'] ) : null;
|
||||
$schema['description'] = ! empty( $data['bsf-aiosrs-book-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-book-description'] ) : null;
|
||||
$book_url = get_permalink( $post['ID'] );
|
||||
$schema['itemReviewed']['isbn'] = ! empty( $data['bsf-aiosrs-book-serial-number'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-book-serial-number'] ) : NULL;
|
||||
$schema['description'] = ! empty( $data['bsf-aiosrs-book-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-book-description'] ) : NULL;
|
||||
$book_url = get_permalink( $post['ID'] );
|
||||
if ( isset( $book_url ) && ! empty( $book_url ) ) {
|
||||
$schema['url'] = esc_url( $book_url );
|
||||
}
|
||||
break;
|
||||
case 'bsf-aiosrs-course':
|
||||
$schema['itemReviewed']['@type'] = 'Course';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-course-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-name'] ) : null;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-course-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-course-description'] ) : null;
|
||||
$schema['itemReviewed']['@type'] = 'Course';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-course-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-course-name'] ) : NULL;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-course-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-course-description'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-course-orgnization-name'] ) && ! empty( $data['bsf-aiosrs-course-orgnization-name'] ) ) {
|
||||
$schema['itemReviewed']['provider']['@type'] = 'Organization';
|
||||
$schema['itemReviewed']['provider']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-course-orgnization-name'] );
|
||||
$schema['itemReviewed']['provider']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-course-orgnization-name'] );
|
||||
}
|
||||
break;
|
||||
case 'bsf-aiosrs-event':
|
||||
$schema['itemReviewed']['@type'] = 'event';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-event-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-name'] ) : null;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-event-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-description'] ) : null;
|
||||
$schema['itemReviewed']['@type'] = 'event';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-event-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-name'] ) : NULL;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-event-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-description'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-event-image'] ) && ! empty( $data['bsf-aiosrs-event-image'] ) ) {
|
||||
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-event-image'] );
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-event-start-date'] ) && ! empty( $data['bsf-aiosrs-event-start-date'] ) ) {
|
||||
if ( 'OfflineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) {
|
||||
$start_date = gmdate( DATE_ISO8601, strtotime( $data['bsf-aiosrs-event-start-date'] ) );
|
||||
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string) $start_date );
|
||||
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string)$start_date );
|
||||
} else {
|
||||
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-start-date'] );
|
||||
$schema['itemReviewed']['startDate'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-event-start-date'] );
|
||||
}
|
||||
}
|
||||
$schema['itemReviewed']['endDate'] = ! empty( $data['bsf-aiosrs-event-end-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-end-date'] ) : null;
|
||||
$schema['itemReviewed']['eventStatus'] = ! empty( $data['bsf-aiosrs-event-event-status'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-status'] ) : null;
|
||||
$schema['itemReviewed']['endDate'] = ! empty( $data['bsf-aiosrs-event-end-date'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-end-date'] ) : NULL;
|
||||
$schema['itemReviewed']['eventStatus'] = ! empty( $data['bsf-aiosrs-event-event-status'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-event-status'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['eventAttendanceMode'] = ! empty( $data['bsf-aiosrs-event-event-attendance-mode'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-attendance-mode'] ) : null;
|
||||
$schema['itemReviewed']['eventAttendanceMode'] = ! empty( $data['bsf-aiosrs-event-event-attendance-mode'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-event-attendance-mode'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['previousStartDate'] = ! empty( $data['bsf-aiosrs-event-previous-date'] ) && 'EventRescheduled' === $data['bsf-aiosrs-event-event-status'] ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-previous-date'] ) : null;
|
||||
$schema['itemReviewed']['previousStartDate'] = ! empty( $data['bsf-aiosrs-event-previous-date'] ) && 'EventRescheduled' === $data['bsf-aiosrs-event-event-status'] ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-previous-date'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-event-online-location'] ) && ! empty( $data['bsf-aiosrs-event-online-location'] ) &&
|
||||
( 'OfflineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) ||
|
||||
( 'MixedEventAttendanceMode' === $data['bsf-aiosrs-event-event-attendance-mode'] ) ) {
|
||||
@@ -86,11 +86,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-event-performer'] ) && ! empty( $data['bsf-aiosrs-event-performer'] ) ) {
|
||||
$schema['itemReviewed']['performer']['@type'] = 'Person';
|
||||
$schema['itemReviewed']['performer']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-performer'] );
|
||||
$schema['itemReviewed']['performer']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-event-performer'] );
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-event-location'] ) && ! empty( $data['bsf-aiosrs-event-location'] ) && 'OnlineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) {
|
||||
$schema['itemReviewed']['location']['@type'] = 'Place';
|
||||
$schema['itemReviewed']['location']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location'] );
|
||||
$schema['itemReviewed']['location']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location'] );
|
||||
}
|
||||
if ( ( ( isset( $data['bsf-aiosrs-event-location-street'] ) && ! empty( $data['bsf-aiosrs-event-location-street'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-event-location-locality'] ) && ! empty( $data['bsf-aiosrs-event-location-locality'] ) ) ||
|
||||
@@ -99,11 +99,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
( isset( $data['bsf-aiosrs-event-location-country'] ) && ! empty( $data['bsf-aiosrs-event-location-country'] ) ) ) && ( 'OnlineEventAttendanceMode' !== $data['bsf-aiosrs-event-event-attendance-mode'] ) ) {
|
||||
$schema['itemReviewed']['location']['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['itemReviewed']['location']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-event-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-street'] ) : null;
|
||||
$schema['itemReviewed']['location']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-event-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-locality'] ) : null;
|
||||
$schema['itemReviewed']['location']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-event-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-postal'] ) : null;
|
||||
$schema['itemReviewed']['location']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-event-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-region'] ) : null;
|
||||
$schema['itemReviewed']['location']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-event-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-location-country'] ) : null;
|
||||
$schema['itemReviewed']['location']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-event-location-street'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location-street'] ) : NULL;
|
||||
$schema['itemReviewed']['location']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-event-location-locality'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location-locality'] ) : NULL;
|
||||
$schema['itemReviewed']['location']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-event-location-postal'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location-postal'] ) : NULL;
|
||||
$schema['itemReviewed']['location']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-event-location-region'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location-region'] ) : NULL;
|
||||
$schema['itemReviewed']['location']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-event-location-country'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-location-country'] ) : NULL;
|
||||
}
|
||||
$schema['itemReviewed']['offers']['@type'] = 'Offer';
|
||||
|
||||
@@ -114,17 +114,17 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
if ( isset( $data['bsf-aiosrs-event-ticket-buy-url'] ) && ! empty( $data['bsf-aiosrs-event-ticket-buy-url'] ) ) {
|
||||
$schema['itemReviewed']['offers']['url'] = esc_url( $data['bsf-aiosrs-event-ticket-buy-url'] );
|
||||
}
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-event-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-price'] ) : null;
|
||||
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-event-avail'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-avail'] ) : null;
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-event-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-currency'] ) : null;
|
||||
$schema['itemReviewed']['offers']['validFrom'] = ! empty( $data['bsf-aiosrs-event-valid-from'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-valid-from'] ) : null;
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-event-price'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-price'] ) : NULL;
|
||||
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-event-avail'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-avail'] ) : NULL;
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-event-currency'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-currency'] ) : NULL;
|
||||
$schema['itemReviewed']['offers']['validFrom'] = ! empty( $data['bsf-aiosrs-event-valid-from'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-valid-from'] ) : NULL;
|
||||
}
|
||||
if ( ( isset( $data['bsf-aiosrs-event-event-organizer-name'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-name'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-event-event-organizer-url'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-url'] ) ) ) {
|
||||
|
||||
$schema['itemReviewed']['organizer']['@type'] = 'Organization';
|
||||
|
||||
$schema['itemReviewed']['organizer']['name'] = ! empty( $data['bsf-aiosrs-event-event-organizer-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-event-event-organizer-name'] ) : null;
|
||||
$schema['itemReviewed']['organizer']['name'] = ! empty( $data['bsf-aiosrs-event-event-organizer-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-event-event-organizer-name'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-event-event-organizer-url'] ) && ! empty( $data['bsf-aiosrs-event-event-organizer-url'] ) ) {
|
||||
$schema['itemReviewed']['organizer']['url'] = esc_url( $data['bsf-aiosrs-event-event-organizer-url'] );
|
||||
}
|
||||
@@ -132,12 +132,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
break;
|
||||
case 'bsf-aiosrs-local-business':
|
||||
$schema['itemReviewed']['@type'] = 'LocalBusiness';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-local-business-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-local-business-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-name'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-local-business-image'] ) && ! empty( $data['bsf-aiosrs-local-business-image'] ) ) {
|
||||
|
||||
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-local-business-image'] );
|
||||
}
|
||||
$schema['itemReviewed']['telephone'] = ! empty( $data['bsf-aiosrs-local-business-telephone'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-telephone'] ) : null;
|
||||
$schema['itemReviewed']['telephone'] = ! empty( $data['bsf-aiosrs-local-business-telephone'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-telephone'] ) : NULL;
|
||||
if ( ( isset( $data['bsf-aiosrs-local-business-location-street'] ) && ! empty( $data['bsf-aiosrs-local-business-location-street'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-local-business-location-locality'] ) && ! empty( $data['bsf-aiosrs-local-business-location-locality'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-local-business-location-postal'] ) && ! empty( $data['bsf-aiosrs-local-business-location-postal'] ) ) ||
|
||||
@@ -146,44 +146,44 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
|
||||
$schema['itemReviewed']['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-local-business-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-street'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-local-business-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-locality'] ) : null;
|
||||
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-local-business-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-postal'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-local-business-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-region'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-local-business-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-location-country'] ) : null;
|
||||
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-local-business-location-street'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-location-street'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-local-business-location-locality'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-location-locality'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-local-business-location-postal'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-location-postal'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-local-business-location-region'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-location-region'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-local-business-location-country'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-location-country'] ) : NULL;
|
||||
}
|
||||
$schema['itemReviewed']['priceRange'] = ! empty( $data['bsf-aiosrs-local-business-price-range'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-local-business-price-range'] ) : null;
|
||||
$schema['itemReviewed']['priceRange'] = ! empty( $data['bsf-aiosrs-local-business-price-range'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-local-business-price-range'] ) : NULL;
|
||||
break;
|
||||
case 'bsf-aiosrs-recipe':
|
||||
$schema['itemReviewed']['@type'] = 'Recipe';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-recipe-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-recipe-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-name'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-recipe-image'] ) && ! empty( $data['bsf-aiosrs-recipe-image'] ) ) {
|
||||
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-recipe-image'] );
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-recipe-author'] ) && ! empty( $data['bsf-aiosrs-recipe-author'] ) ) {
|
||||
$schema['itemReviewed']['author']['@type'] = 'Person';
|
||||
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-author'] );
|
||||
$schema['itemReviewed']['author']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-author'] );
|
||||
}
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-recipe-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-description'] ) : null;
|
||||
$schema['itemReviewed']['prepTime'] = ! empty( $data['bsf-aiosrs-recipe-preperation-time'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-preperation-time'] ) : null;
|
||||
$schema['itemReviewed']['cookTime'] = ! empty( $data['bsf-aiosrs-recipe-cook-time'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-cook-time'] ) : null;
|
||||
$schema['itemReviewed']['keywords'] = ! empty( $data['bsf-aiosrs-recipe-recipe-keywords'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-keywords'] ) : null;
|
||||
$schema['itemReviewed']['recipeCategory'] = ! empty( $data['bsf-aiosrs-recipe-recipe-category'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-category'] ) : null;
|
||||
$schema['itemReviewed']['recipeCuisine'] = ! empty( $data['bsf-aiosrs-recipe-recipe-cuisine'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-cuisine'] ) : null;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-recipe-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-description'] ) : NULL;
|
||||
$schema['itemReviewed']['prepTime'] = ! empty( $data['bsf-aiosrs-recipe-preperation-time'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-preperation-time'] ) : NULL;
|
||||
$schema['itemReviewed']['cookTime'] = ! empty( $data['bsf-aiosrs-recipe-cook-time'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-cook-time'] ) : NULL;
|
||||
$schema['itemReviewed']['keywords'] = ! empty( $data['bsf-aiosrs-recipe-recipe-keywords'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-keywords'] ) : NULL;
|
||||
$schema['itemReviewed']['recipeCategory'] = ! empty( $data['bsf-aiosrs-recipe-recipe-category'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-category'] ) : NULL;
|
||||
$schema['itemReviewed']['recipeCuisine'] = ! empty( $data['bsf-aiosrs-recipe-recipe-cuisine'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-cuisine'] ) : NULL;
|
||||
if ( ( isset( $data['bsf-aiosrs-recipe-rating'] ) && ! empty( $data['bsf-aiosrs-recipe-rating'] ) ) ||
|
||||
( isset( $data['review-count'] ) && ! empty( $data['review-count'] ) ) ) {
|
||||
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-recipe-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-rating'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-recipe-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-review-count'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-recipe-rating'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-rating'] ) : NULL;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-recipe-review-count'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-review-count'] ) : NULL;
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-recipe-nutrition'] ) && ! empty( $data['bsf-aiosrs-recipe-nutrition'] ) ) {
|
||||
$schema['itemReviewed']['nutrition']['@type'] = 'NutritionInformation';
|
||||
$schema['itemReviewed']['nutrition']['calories'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-nutrition'] );
|
||||
$schema['itemReviewed']['nutrition']['calories'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-nutrition'] );
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-recipe-ingredients'] ) && ! empty( $data['bsf-aiosrs-recipe-ingredients'] ) ) {
|
||||
$recipe_ingredients = explode( ',', $data['bsf-aiosrs-recipe-ingredients'] );
|
||||
foreach ( $recipe_ingredients as $key => $value ) {
|
||||
$schema['itemReviewed']['recipeIngredient'][ $key ] = wp_strip_all_tags( (string) $value );
|
||||
$schema['itemReviewed']['recipeIngredient'][ $key ] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
}
|
||||
if ( isset( $data['bsf-aiosrs-recipe-recipe-instructions'] ) && ! empty( $data['bsf-aiosrs-recipe-recipe-instructions'] ) ) {
|
||||
@@ -191,15 +191,15 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
foreach ( $recipe_instructions as $key => $value ) {
|
||||
if ( isset( $value ) && ! empty( $value ) ) {
|
||||
$schema['itemReviewed']['recipeInstructions'][ $key ]['@type'] = 'HowToStep';
|
||||
$schema['itemReviewed']['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string) $value );
|
||||
$schema['itemReviewed']['recipeInstructions'][ $key ]['text'] = wp_strip_all_tags( (string)$value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $data['bsf-aiosrs-recipe-video-name'] ) && ! empty( $data['bsf-aiosrs-recipe-video-name'] ) ) {
|
||||
$schema['itemReviewed']['video']['@type'] = 'VideoObject';
|
||||
$schema['itemReviewed']['video']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-video-name'] );
|
||||
$schema['itemReviewed']['video']['description'] = ! empty( $data['bsf-aiosrs-recipe-video-desc'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-video-desc'] ) : null;
|
||||
$schema['itemReviewed']['video']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-video-name'] );
|
||||
$schema['itemReviewed']['video']['description'] = ! empty( $data['bsf-aiosrs-recipe-video-desc'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-video-desc'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-recipe-video-image'] ) && ! empty( $data['bsf-aiosrs-recipe-video-image'] ) ) {
|
||||
$schema['itemReviewed']['video']['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-recipe-video-image'] );
|
||||
}
|
||||
@@ -209,51 +209,51 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
if ( isset( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] ) && ! empty( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] ) ) {
|
||||
$schema['itemReviewed']['video']['embedUrl'] = esc_url( $data['bsf-aiosrs-recipe-recipe-video-embed-url'] );
|
||||
}
|
||||
$schema['itemReviewed']['video']['duration'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-duration'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-duration'] ) : null;
|
||||
$schema['itemReviewed']['video']['uploadDate'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) : null;
|
||||
$schema['itemReviewed']['video']['interactionCount'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) : null;
|
||||
$schema['itemReviewed']['video']['expires'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) : null;
|
||||
$schema['itemReviewed']['video']['duration'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-duration'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-video-duration'] ) : NULL;
|
||||
$schema['itemReviewed']['video']['uploadDate'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-video-upload-date'] ) : NULL;
|
||||
$schema['itemReviewed']['video']['interactionCount'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-video-interaction-count'] ) : NULL;
|
||||
$schema['itemReviewed']['video']['expires'] = ! empty( $data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-recipe-recipe-video-expires-date'] ) : NULL;
|
||||
}
|
||||
break;
|
||||
case 'bsf-aiosrs-software-application':
|
||||
$schema['itemReviewed']['@type'] = 'SoftwareApplication';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-software-application-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-software-application-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-name'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['operatingSystem'] = ! empty( $data['bsf-aiosrs-software-application-operating-system'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-operating-system'] ) : null;
|
||||
$schema['itemReviewed']['operatingSystem'] = ! empty( $data['bsf-aiosrs-software-application-operating-system'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-operating-system'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['applicationCategory'] = ! empty( $data['bsf-aiosrs-software-application-category'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-category'] ) : null;
|
||||
$schema['itemReviewed']['applicationCategory'] = ! empty( $data['bsf-aiosrs-software-application-category'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-category'] ) : NULL;
|
||||
|
||||
if ( ( isset( $data['bsf-aiosrs-software-application-rating'] ) && ! empty( $data['bsf-aiosrs-software-application-rating'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-software-application-review-count'] ) && ! empty( $data['bsf-aiosrs-software-application-review-count'] ) ) ) {
|
||||
|
||||
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-software-application-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-rating'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-software-application-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-review-count'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-software-application-rating'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-rating'] ) : NULL;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-software-application-review-count'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-review-count'] ) : NULL;
|
||||
}
|
||||
if ( true === apply_filters( 'wp_schema_pro_remove_software_application_offers_review_type', true ) ) {
|
||||
$schema['itemReviewed']['offers']['@type'] = 'Offer';
|
||||
$schema['itemReviewed']['offers']['price'] = '0';
|
||||
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-software-application-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-price'] ) : null;
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-software-application-price'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-price'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-software-application-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-software-application-currency'] ) : null;
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-software-application-currency'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-software-application-currency'] ) : NULL;
|
||||
}
|
||||
break;
|
||||
case 'bsf-aiosrs-product':
|
||||
$schema['itemReviewed']['@type'] = 'product';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-product-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-product-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-name'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-product-image'] ) && ! empty( $data['bsf-aiosrs-product-image'] ) ) {
|
||||
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-product-image'] );
|
||||
}
|
||||
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-product-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-description'] ) : null;
|
||||
$schema['itemReviewed']['description'] = ! empty( $data['bsf-aiosrs-product-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-description'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['sku'] = ! empty( $data['bsf-aiosrs-product-sku'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-sku'] ) : null;
|
||||
$schema['itemReviewed']['mpn'] = ! empty( $data['bsf-aiosrs-product-mpn'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-mpn'] ) : null;
|
||||
$schema['itemReviewed']['sku'] = ! empty( $data['bsf-aiosrs-product-sku'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-sku'] ) : NULL;
|
||||
$schema['itemReviewed']['mpn'] = ! empty( $data['bsf-aiosrs-product-mpn'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-mpn'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-product-brand-name'] ) && ! empty( $data['bsf-aiosrs-product-brand-name'] ) ) {
|
||||
$schema['itemReviewed']['brand']['@type'] = 'Organization';
|
||||
$schema['itemReviewed']['brand']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-product-brand-name'] );
|
||||
$schema['itemReviewed']['brand']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-product-brand-name'] );
|
||||
}
|
||||
|
||||
if ( ( isset( $data['bsf-aiosrs-product-rating'] ) && ! empty( $data['bsf-aiosrs-product-rating'] ) ) ||
|
||||
@@ -261,44 +261,44 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
|
||||
$schema['itemReviewed']['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-product-rating'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-rating'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-product-review-count'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-review-count'] ) : null;
|
||||
$schema['itemReviewed']['aggregateRating']['ratingValue'] = ! empty( $data['bsf-aiosrs-product-rating'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-rating'] ) : NULL;
|
||||
$schema['itemReviewed']['aggregateRating']['reviewCount'] = ! empty( $data['bsf-aiosrs-product-review-count'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-review-count'] ) : NULL;
|
||||
}
|
||||
if ( apply_filters( 'wp_schema_pro_remove_product_offers', true ) ) {
|
||||
$schema['itemReviewed']['offers']['@type'] = 'Offer';
|
||||
$schema['itemReviewed']['offers']['price'] = '0';
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-product-price'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-price'] ) : null;
|
||||
$schema['itemReviewed']['offers']['priceValidUntil'] = ! empty( $data['bsf-aiosrs-product-price-valid-until'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-price-valid-until'] ) : null;
|
||||
$schema['itemReviewed']['offers']['@type'] = 'Offer';
|
||||
$schema['itemReviewed']['offers']['price'] = '0';
|
||||
$schema['itemReviewed']['offers']['price'] = ! empty( $data['bsf-aiosrs-product-price'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-price'] ) : NULL;
|
||||
$schema['itemReviewed']['offers']['priceValidUntil'] = ! empty( $data['bsf-aiosrs-product-price-valid-until'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-price-valid-until'] ) : NULL;
|
||||
|
||||
$schema['itemReviewed']['offers']['url'] = get_permalink( $post['ID'] );
|
||||
|
||||
if ( ( isset( $data['bsf-aiosrs-product-currency'] ) && ! empty( $data['bsf-aiosrs-product-currency'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-product-avail'] ) && ! empty( $data['bsf-aiosrs-product-avail'] ) ) ) {
|
||||
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-product-currency'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-currency'] ) : null;
|
||||
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-product-avail'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-product-avail'] ) : null;
|
||||
$schema['itemReviewed']['offers']['priceCurrency'] = ! empty( $data['bsf-aiosrs-product-currency'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-currency'] ) : NULL;
|
||||
$schema['itemReviewed']['offers']['availability'] = ! empty( $data['bsf-aiosrs-product-avail'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-product-avail'] ) : NULL;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'bsf-aiosrs-movie':
|
||||
$schema['itemReviewed']['@type'] = 'Movie';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-movie-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-name'] ) : null;
|
||||
$schema['itemReviewed']['sameAs'] = ! empty( $data['bsf-aiosrs-movie-same-As'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-same-As'] ) : null;
|
||||
$schema['itemReviewed']['@type'] = 'Movie';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-movie-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-movie-name'] ) : NULL;
|
||||
$schema['itemReviewed']['sameAs'] = ! empty( $data['bsf-aiosrs-movie-same-As'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-movie-same-As'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-movie-image'] ) && ! empty( $data['bsf-aiosrs-movie-image'] ) ) {
|
||||
$schema['itemReviewed']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['bsf-aiosrs-movie-image'] );
|
||||
}
|
||||
$schema['itemReviewed']['dateCreated'] = ! empty( $data['bsf-aiosrs-movie-dateCreated'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-dateCreated'] ) : null;
|
||||
$schema['itemReviewed']['dateCreated'] = ! empty( $data['bsf-aiosrs-movie-dateCreated'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-movie-dateCreated'] ) : NULL;
|
||||
if ( isset( $data['bsf-aiosrs-movie-director-name'] ) && ! empty( $data['bsf-aiosrs-movie-director-name'] ) ) {
|
||||
$schema['itemReviewed']['director']['@type'] = 'Person';
|
||||
$schema['itemReviewed']['director']['name'] = wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-director-name'] );
|
||||
$schema['itemReviewed']['director']['name'] = wp_strip_all_tags( (string)$data['bsf-aiosrs-movie-director-name'] );
|
||||
}
|
||||
$schema['description'] = ! empty( $data['bsf-aiosrs-movie-description'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-movie-description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['bsf-aiosrs-movie-description'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-movie-description'] ) : NULL;
|
||||
|
||||
break;
|
||||
case 'bsf-aiosrs-organization':
|
||||
$schema['itemReviewed']['@type'] = 'Organization';
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-organization-name'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-name'] ) : null;
|
||||
$schema['itemReviewed']['name'] = ! empty( $data['bsf-aiosrs-organization-name'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-name'] ) : NULL;
|
||||
if ( ( isset( $data['bsf-aiosrs-organization-location-street'] ) && ! empty( $data['bsf-aiosrs-organization-location-street'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-organization-location-locality'] ) && ! empty( $data['bsf-aiosrs-organization-location-locality'] ) ) ||
|
||||
( isset( $data['bsf-aiosrs-organization-location-postal'] ) && ! empty( $data['bsf-aiosrs-organization-location-postal'] ) ) ||
|
||||
@@ -307,11 +307,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
|
||||
$schema['itemReviewed']['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-organization-location-street'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-street'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-organization-location-locality'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-locality'] ) : null;
|
||||
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-organization-location-postal'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-postal'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-organization-location-region'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-region'] ) : null;
|
||||
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-organization-location-country'] ) ? wp_strip_all_tags( (string) $data['bsf-aiosrs-organization-location-country'] ) : null;
|
||||
$schema['itemReviewed']['address']['streetAddress'] = ! empty( $data['bsf-aiosrs-organization-location-street'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-location-street'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressLocality'] = ! empty( $data['bsf-aiosrs-organization-location-locality'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-location-locality'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['postalCode'] = ! empty( $data['bsf-aiosrs-organization-location-postal'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-location-postal'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressRegion'] = ! empty( $data['bsf-aiosrs-organization-location-region'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-location-region'] ) : NULL;
|
||||
$schema['itemReviewed']['address']['addressCountry'] = ! empty( $data['bsf-aiosrs-organization-location-country'] ) ? wp_strip_all_tags( (string)$data['bsf-aiosrs-organization-location-country'] ) : NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -321,13 +321,13 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
|
||||
if ( isset( $data['rating'] ) && ! empty( $data['rating'] ) ) {
|
||||
$schema['reviewRating']['@type'] = 'Rating';
|
||||
$schema['reviewRating']['ratingValue'] = wp_strip_all_tags( (string) $data['rating'] );
|
||||
$schema['reviewRating']['ratingValue'] = wp_strip_all_tags( (string)$data['rating'] );
|
||||
}
|
||||
$schema['reviewBody'] = ! empty( $data['review-body'] ) ? wp_strip_all_tags( (string) $data['review-body'] ) : null;
|
||||
$schema['datePublished'] = ! empty( $data['date'] ) ? wp_strip_all_tags( (string) $data['date'] ) : null;
|
||||
$schema['author']['@type'] = ! empty( $data['reviewer-type'] ) ? wp_strip_all_tags( (string) $data['reviewer-type'] ) : 'Person';
|
||||
$schema['reviewBody'] = ! empty( $data['review-body'] ) ? wp_strip_all_tags( (string)$data['review-body'] ) : NULL;
|
||||
$schema['datePublished'] = ! empty( $data['date'] ) ? wp_strip_all_tags( (string)$data['date'] ) : NULL;
|
||||
$schema['author']['@type'] = ! empty( $data['reviewer-type'] ) ? wp_strip_all_tags( (string)$data['reviewer-type'] ) : 'Person';
|
||||
if ( isset( $data['reviewer-name'] ) && ! empty( $data['reviewer-name'] ) ) {
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string) $data['reviewer-name'] );
|
||||
$schema['author']['name'] = wp_strip_all_tags( (string)$data['reviewer-name'] );
|
||||
$author_data = get_userdata( $post['post_author'] );
|
||||
$author_name = ( isset( $author_data->user_nicename ) ) ? $author_data->user_nicename : '';
|
||||
$author_url = get_author_posts_url( $post['ID'] );
|
||||
@@ -337,7 +337,7 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Review' ) ) {
|
||||
}
|
||||
if ( isset( $data['publisher-name'] ) && ! empty( $data['publisher-name'] ) ) {
|
||||
$schema['publisher']['@type'] = 'Organization';
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['publisher-name'] );
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string)$data['publisher-name'] );
|
||||
$prg_url_value = get_bloginfo( 'url' );
|
||||
$schema['publisher']['sameAs'] = esc_url( $prg_url_value );
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Service' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Service';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['serviceType'] = ! empty( $data['type'] ) ? wp_strip_all_tags( (string) $data['type'] ) : null;
|
||||
$schema['serviceType'] = ! empty( $data['type'] ) ? wp_strip_all_tags( (string)$data['type'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
@@ -43,12 +43,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Service' ) ) {
|
||||
|
||||
$schema['provider']['@type'] = 'LocalBusiness';
|
||||
|
||||
$schema['provider']['name'] = ! empty( $data['provider'] ) ? wp_strip_all_tags( (string) $data['provider'] ) : null;
|
||||
$schema['provider']['name'] = ! empty( $data['provider'] ) ? wp_strip_all_tags( (string)$data['provider'] ) : NULL;
|
||||
if ( isset( $data['location-image'] ) && ! empty( $data['location-image'] ) ) {
|
||||
$schema['provider']['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['location-image'] );
|
||||
}
|
||||
$schema['provider']['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string) $data['telephone'] ) : null;
|
||||
$schema['provider']['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string) $data['price-range'] ) : null;
|
||||
$schema['provider']['telephone'] = ! empty( $data['telephone'] ) ? wp_strip_all_tags( (string)$data['telephone'] ) : NULL;
|
||||
$schema['provider']['priceRange'] = ! empty( $data['price-range'] ) ? wp_strip_all_tags( (string)$data['price-range'] ) : NULL;
|
||||
}
|
||||
|
||||
if ( ( isset( $data['location-locality'] ) && ! empty( $data['location-locality'] ) ) ||
|
||||
@@ -58,17 +58,17 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Service' ) ) {
|
||||
$schema['provider']['@type'] = 'LocalBusiness';
|
||||
$schema['provider']['address']['@type'] = 'PostalAddress';
|
||||
|
||||
$schema['provider']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string) $data['location-locality'] ) : null;
|
||||
$schema['provider']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string) $data['location-region'] ) : null;
|
||||
$schema['provider']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string) $data['location-street'] ) : null;
|
||||
$schema['provider']['address']['addressLocality'] = ! empty( $data['location-locality'] ) ? wp_strip_all_tags( (string)$data['location-locality'] ) : NULL;
|
||||
$schema['provider']['address']['addressRegion'] = ! empty( $data['location-region'] ) ? wp_strip_all_tags( (string)$data['location-region'] ) : NULL;
|
||||
$schema['provider']['address']['streetAddress'] = ! empty( $data['location-street'] ) ? wp_strip_all_tags( (string)$data['location-street'] ) : NULL;
|
||||
}
|
||||
|
||||
if ( isset( $data['area'] ) && ! empty( $data['area'] ) ) {
|
||||
$schema['areaServed']['@type'] = 'State';
|
||||
$schema['areaServed']['name'] = wp_strip_all_tags( (string) $data['area'] );
|
||||
$schema['areaServed']['name'] = wp_strip_all_tags( (string)$data['area'] );
|
||||
}
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_service', $schema, $data, $post );
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Software_Application' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'SoftwareApplication';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['operatingSystem'] = ! empty( $data['operating-system'] ) ? wp_strip_all_tags( (string) $data['operating-system'] ) : null;
|
||||
$schema['operatingSystem'] = ! empty( $data['operating-system'] ) ? wp_strip_all_tags( (string)$data['operating-system'] ) : NULL;
|
||||
|
||||
$schema['applicationCategory'] = ! empty( $data['category'] ) ? wp_strip_all_tags( (string) $data['category'] ) : null;
|
||||
$schema['applicationCategory'] = ! empty( $data['category'] ) ? wp_strip_all_tags( (string)$data['category'] ) : NULL;
|
||||
|
||||
if ( isset( $data['image'] ) && ! empty( $data['image'] ) ) {
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'] );
|
||||
@@ -43,16 +43,16 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Software_Application' ) ) {
|
||||
|
||||
$schema['aggregateRating']['@type'] = 'AggregateRating';
|
||||
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string) $data['rating'] ) : null;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string) $data['review-count'] ) : null;
|
||||
$schema['aggregateRating']['ratingValue'] = ! empty( $data['rating'] ) ? wp_strip_all_tags( (string)$data['rating'] ) : NULL;
|
||||
$schema['aggregateRating']['reviewCount'] = ! empty( $data['review-count'] ) ? wp_strip_all_tags( (string)$data['review-count'] ) : NULL;
|
||||
}
|
||||
|
||||
$schema['offers']['@type'] = 'Offer';
|
||||
$schema['offers']['price'] = '0';
|
||||
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string) $data['price'] ) : null;
|
||||
$schema['offers']['price'] = ! empty( $data['price'] ) ? wp_strip_all_tags( (string)$data['price'] ) : NULL;
|
||||
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string) $data['currency'] ) : null;
|
||||
$schema['offers']['priceCurrency'] = ! empty( $data['currency'] ) ? wp_strip_all_tags( (string)$data['currency'] ) : NULL;
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_software_application', $schema, $data, $post );
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'VideoObject';
|
||||
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string) $data['name'] ) : null;
|
||||
$schema['name'] = ! empty( $data['name'] ) ? wp_strip_all_tags( (string)$data['name'] ) : NULL;
|
||||
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string) $data['description'] ) : null;
|
||||
$schema['description'] = ! empty( $data['description'] ) ? wp_strip_all_tags( (string)$data['description'] ) : NULL;
|
||||
|
||||
if ( isset( $data['orgnization-name'] ) && ! empty( $data['orgnization-name'] ) ) {
|
||||
$schema['publisher']['@type'] = 'Organization';
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string) $data['orgnization-name'] );
|
||||
$schema['publisher']['name'] = wp_strip_all_tags( (string)$data['orgnization-name'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['site-logo'] ) && ! empty( $data['site-logo'] ) ) {
|
||||
@@ -46,9 +46,9 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
|
||||
$schema['thumbnailUrl'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $data['image'], 'URL' );
|
||||
}
|
||||
|
||||
$schema['uploadDate'] = ! empty( $data['upload-date'] ) ? wp_strip_all_tags( (string) $data['upload-date'] ) : null;
|
||||
$schema['uploadDate'] = ! empty( $data['upload-date'] ) ? wp_strip_all_tags( (string)$data['upload-date'] ) : NULL;
|
||||
|
||||
$schema['duration'] = ! empty( $data['duration'] ) ? wp_strip_all_tags( (string) $data['duration'] ) : null;
|
||||
$schema['duration'] = ! empty( $data['duration'] ) ? wp_strip_all_tags( (string)$data['duration'] ) : NULL;
|
||||
|
||||
if ( isset( $data['content-url'] ) && ! empty( $data['content-url'] ) ) {
|
||||
$schema['contentUrl'] = esc_url( $data['content-url'] );
|
||||
@@ -58,28 +58,12 @@ if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Video_Object' ) ) {
|
||||
$schema['embedUrl'] = esc_url( $data['embed-url'] );
|
||||
}
|
||||
|
||||
$schema['expires'] = ! empty( $data['expires-date'] ) ? wp_strip_all_tags( (string) $data['expires-date'] ) : null;
|
||||
$schema['expires'] = ! empty( $data['expires-date'] ) ? wp_strip_all_tags( (string)$data['expires-date'] ) : NULL;
|
||||
|
||||
if ( isset( $data['interaction-count'] ) && ! empty( $data['interaction-count'] ) ) {
|
||||
$schema['interactionStatistic']['@type'] = 'InteractionCounter';
|
||||
$schema['interactionStatistic']['interactionType']['@type'] = 'WatchAction';
|
||||
$schema['interactionStatistic']['userInteractionCount'] = wp_strip_all_tags( (string) $data['interaction-count'] );
|
||||
}
|
||||
|
||||
if ( isset( $data['clip'] ) && ! empty( $data['clip'] ) ) {
|
||||
foreach ( $data['clip'] as $key => $value ) {
|
||||
$schema['hasPart'][ $key ]['@type'] = 'Clip';
|
||||
$schema['hasPart'][ $key ]['name'] = wp_strip_all_tags( (string) $value['clip-name'] );
|
||||
$schema['hasPart'][ $key ]['startOffset'] = wp_strip_all_tags( (string) $value['clip-start-offset'] );
|
||||
$schema['hasPart'][ $key ]['endOffset'] = wp_strip_all_tags( (string) $value['clip-end-offset'] );
|
||||
$schema['hasPart'][ $key ]['url'] = esc_url( $value['clip-url'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $data['seekto-action-start-offset'] ) && ! empty( $data['seekto-action-start-offset'] ) && isset( $data['content-url'] ) ) {
|
||||
$schema['potentialAction']['@type'] = 'SeekToAction';
|
||||
$schema['potentialAction']['target'] = esc_url( $data['seekto-action-target'] ) . '?t={seek_to_second_number}';
|
||||
$schema['potentialAction']['startOffset-input'] = 'required name=seek_to_second_number';
|
||||
$schema['interactionStatistic']['userInteractionCount'] = wp_strip_all_tags( (string)$data['interaction-count'] );
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_schema_video_object', $schema, $data, $post );
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Breadcrumb' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Breadcrumb {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'BreadcrumbList';
|
||||
|
||||
$breadcrumb_list = BSF_AIOSRS_Pro_Schema_Template::get_breadcrumb_list();
|
||||
foreach ( $breadcrumb_list as $key => $breadcrumb ) {
|
||||
$schema['itemListElement'][ $key ]['@type'] = 'ListItem';
|
||||
$schema['itemListElement'][ $key ]['position'] = $key + 1;
|
||||
$schema['itemListElement'][ $key ]['item']['@id'] = esc_url( $breadcrumb['url'] );
|
||||
$schema['itemListElement'][ $key ]['item']['name'] = $breadcrumb['title'];
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_breadcrumb', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Breadcrumb' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Breadcrumb {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'BreadcrumbList';
|
||||
|
||||
$breadcrumb_list = BSF_AIOSRS_Pro_Schema_Template::get_breadcrumb_list();
|
||||
foreach ( $breadcrumb_list as $key => $breadcrumb ) {
|
||||
$schema['itemListElement'][ $key ]['@type'] = 'ListItem';
|
||||
$schema['itemListElement'][ $key ]['position'] = $key + 1;
|
||||
$schema['itemListElement'][ $key ]['item']['@id'] = $breadcrumb['url'];
|
||||
$schema['itemListElement'][ $key ]['item']['name'] = $breadcrumb['title'];
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_breadcrumb', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,389 +1,389 @@
|
||||
<?php
|
||||
/**
|
||||
* Astra Notices
|
||||
*
|
||||
* An easy to use PHP Library to add dismissible admin notices in the WordPress admin.
|
||||
*
|
||||
* @package Astra Notices
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Notices' ) ) :
|
||||
|
||||
/**
|
||||
* Astra_Notices
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Astra_Notices {
|
||||
|
||||
/**
|
||||
* Notices
|
||||
*
|
||||
* @access private
|
||||
* @var array Notices.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $version = '1.1.8';
|
||||
|
||||
/**
|
||||
* Notices
|
||||
*
|
||||
* @access private
|
||||
* @var array Notices.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $notices = array();
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @access private
|
||||
* @var object Class object.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @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.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_notices', array( $this, 'show_notices' ), 30 );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_action( 'wp_ajax_astra-notice-dismiss', array( $this, 'dismiss_notice' ) );
|
||||
add_filter( 'wp_kses_allowed_html', array( $this, 'add_data_attributes' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters and Returns a list of allowed tags and attributes for a given context.
|
||||
*
|
||||
* @param array $allowedposttags array of allowed tags.
|
||||
* @param string $context Context type (explicit).
|
||||
* @since 1.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function add_data_attributes( $allowedposttags, $context ) {
|
||||
$allowedposttags['a']['data-repeat-notice-after'] = true;
|
||||
|
||||
return $allowedposttags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param array $args Notice arguments.
|
||||
* @return void
|
||||
*/
|
||||
public static function add_notice( $args = array() ) {
|
||||
self::$notices[] = $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss Notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function dismiss_notice() {
|
||||
$notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
|
||||
$repeat_notice_after = ( isset( $_POST['repeat_notice_after'] ) ) ? absint( $_POST['repeat_notice_after'] ) : '';
|
||||
$nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
|
||||
$notice = $this->get_notice_by_id( $notice_id );
|
||||
$capability = isset( $notice['capability'] ) ? $notice['capability'] : 'manage_options';
|
||||
|
||||
if ( ! apply_filters( 'astra_notices_user_cap_check', current_user_can( $capability ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) {
|
||||
wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'wp-schema-pro' ) );
|
||||
}
|
||||
|
||||
// Valid inputs?
|
||||
if ( ! empty( $notice_id ) ) {
|
||||
|
||||
if ( ! empty( $repeat_notice_after ) ) {
|
||||
set_transient( $notice_id, true, $repeat_notice_after );
|
||||
} else {
|
||||
update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Scripts.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
wp_register_script( 'astra-notices', self::get_url() . 'notices.js', array( 'jquery' ), self::$version, true );
|
||||
wp_localize_script(
|
||||
'astra-notices',
|
||||
'astraNotices',
|
||||
array(
|
||||
'_notice_nonce' => wp_create_nonce( 'astra-notices' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the notices based on the given priority of the notice.
|
||||
* This function is called from usort()
|
||||
*
|
||||
* @since 1.5.2
|
||||
* @param array $notice_1 First notice.
|
||||
* @param array $notice_2 Second Notice.
|
||||
* @return array
|
||||
*/
|
||||
public function sort_notices( $notice_1, $notice_2 ) {
|
||||
if ( ! isset( $notice_1['priority'] ) ) {
|
||||
$notice_1['priority'] = 10;
|
||||
}
|
||||
if ( ! isset( $notice_2['priority'] ) ) {
|
||||
$notice_2['priority'] = 10;
|
||||
}
|
||||
|
||||
return $notice_1['priority'] - $notice_2['priority'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered notices.
|
||||
* Since v1.1.8 it is recommended to register the notices on
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private function get_notices() {
|
||||
usort( self::$notices, array( $this, 'sort_notices' ) );
|
||||
|
||||
return self::$notices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notice by notice_id
|
||||
*
|
||||
* @param string $notice_id Notice id.
|
||||
*
|
||||
* @return array notice based on the notice id.
|
||||
*/
|
||||
private function get_notice_by_id( $notice_id ) {
|
||||
if ( empty( $notice_id ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$notices = $this->get_notices();
|
||||
$notice = wp_list_filter(
|
||||
$notices,
|
||||
array(
|
||||
'id' => $notice_id,
|
||||
)
|
||||
);
|
||||
|
||||
return ! empty( $notice ) ? $notice[0] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the notices in the WordPress admin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function show_notices() {
|
||||
$defaults = array(
|
||||
'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`.
|
||||
'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error].
|
||||
'message' => '', // Optional, Message.
|
||||
'show_if' => true, // Optional, Show notice on custom condition. E.g. 'show_if' => if( is_admin() ) ? true, false, .
|
||||
'repeat-notice-after' => '', // Optional, Dismiss-able notice time. It'll auto show after given time.
|
||||
'display-notice-after' => false, // Optional, Dismiss-able notice time. It'll auto show after given time.
|
||||
'class' => '', // Optional, Additional notice wrapper class.
|
||||
'priority' => 10, // Priority of the notice.
|
||||
'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices.
|
||||
'is_dismissible' => true,
|
||||
'capability' => 'manage_options', // User capability - This capability is required for the current user to see this notice.
|
||||
);
|
||||
|
||||
// Count for the notices that are rendered.
|
||||
$notices_displayed = 0;
|
||||
$notices = $this->get_notices();
|
||||
|
||||
foreach ( $notices as $key => $notice ) {
|
||||
$notice = wp_parse_args( $notice, $defaults );
|
||||
|
||||
// Show notices only for users with `manage_options` cap.
|
||||
if ( ! current_user_can( $notice['capability'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notice['id'] = self::get_notice_id( $notice, $key );
|
||||
$notice['classes'] = self::get_wrap_classes( $notice );
|
||||
|
||||
// Notices visible after transient expire.
|
||||
if ( isset( $notice['show_if'] ) && true === $notice['show_if'] ) {
|
||||
|
||||
// don't display the notice if it is not supposed to be displayed with other notices.
|
||||
if ( 0 !== $notices_displayed && false === $notice['display-with-other-notices'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( self::is_expired( $notice ) ) {
|
||||
|
||||
self::markup( $notice );
|
||||
++$notices_displayed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param array $notice Notice markup.
|
||||
* @return void
|
||||
*/
|
||||
public static function markup( $notice = array() ) {
|
||||
wp_enqueue_script( 'astra-notices' );
|
||||
|
||||
do_action( 'astra_notice_before_markup' );
|
||||
|
||||
do_action( "astra_notice_before_markup_{$notice['id']}" );
|
||||
|
||||
?>
|
||||
<div id="<?php echo esc_attr( $notice['id'] ); ?>" class="<?php echo esc_attr( $notice['classes'] ); ?>" data-repeat-notice-after="<?php echo esc_attr( $notice['repeat-notice-after'] ); ?>">
|
||||
<div class="notice-container">
|
||||
<?php do_action( "astra_notice_inside_markup_{$notice['id']}" ); ?>
|
||||
<?php echo wp_kses_post( $notice['message'] ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
do_action( "astra_notice_after_markup_{$notice['id']}" );
|
||||
|
||||
do_action( 'astra_notice_after_markup' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wrapper classes for a notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @return array Notice wrapper classes.
|
||||
*/
|
||||
private static function get_wrap_classes( $notice ) {
|
||||
$classes = array( 'astra-notice', 'notice' );
|
||||
|
||||
if ( $notice['is_dismissible'] ) {
|
||||
$classes[] = 'is-dismissible';
|
||||
}
|
||||
|
||||
$classes[] = $notice['class'];
|
||||
if ( isset( $notice['type'] ) && '' !== $notice['type'] ) {
|
||||
$classes[] = 'notice-' . $notice['type'];
|
||||
}
|
||||
|
||||
return esc_attr( implode( ' ', $classes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML ID for a given notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @param int $key Notice array index.
|
||||
* @return string HTML if for the notice.
|
||||
*/
|
||||
private static function get_notice_id( $notice, $key ) {
|
||||
if ( isset( $notice['id'] ) && ! empty( $notice['id'] ) ) {
|
||||
return $notice['id'];
|
||||
}
|
||||
|
||||
return 'astra-notices-id-' . $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the notice is expires.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @return boolean
|
||||
*/
|
||||
private static function is_expired( $notice ) {
|
||||
$transient_status = get_transient( $notice['id'] );
|
||||
|
||||
if ( false === $transient_status ) {
|
||||
|
||||
if ( isset( $notice['display-notice-after'] ) && false !== $notice['display-notice-after'] ) {
|
||||
|
||||
if ( 'delayed-notice' !== get_user_meta( get_current_user_id(), $notice['id'], true ) &&
|
||||
'notice-dismissed' !== get_user_meta( get_current_user_id(), $notice['id'], true ) ) {
|
||||
set_transient( $notice['id'], 'delayed-notice', $notice['display-notice-after'] );
|
||||
update_user_meta( get_current_user_id(), $notice['id'], 'delayed-notice' );
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the user meta status if current notice is dismissed or delay completed.
|
||||
$meta_status = get_user_meta( get_current_user_id(), $notice['id'], true );
|
||||
|
||||
if ( empty( $meta_status ) || 'delayed-notice' === $meta_status ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base URL for the astra-notices.
|
||||
*
|
||||
* @return mixed URL.
|
||||
*/
|
||||
public static function get_url() {
|
||||
$path = wp_normalize_path( dirname( __FILE__ ) );
|
||||
$theme_dir = wp_normalize_path( get_template_directory() );
|
||||
|
||||
if ( strpos( $path, $theme_dir ) !== false ) {
|
||||
return trailingslashit( get_template_directory_uri() . str_replace( $theme_dir, '', $path ) );
|
||||
} else {
|
||||
return plugin_dir_url( __FILE__ );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
Astra_Notices::get_instance();
|
||||
|
||||
endif;
|
||||
<?php
|
||||
/**
|
||||
* Astra Notices
|
||||
*
|
||||
* An easy to use PHP Library to add dismissible admin notices in the WordPress admin.
|
||||
*
|
||||
* @package Astra Notices
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Astra_Notices' ) ) :
|
||||
|
||||
/**
|
||||
* Astra_Notices
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Astra_Notices {
|
||||
|
||||
/**
|
||||
* Notices
|
||||
*
|
||||
* @access private
|
||||
* @var array Notices.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $version = '1.1.8';
|
||||
|
||||
/**
|
||||
* Notices
|
||||
*
|
||||
* @access private
|
||||
* @var array Notices.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $notices = array();
|
||||
|
||||
/**
|
||||
* Instance
|
||||
*
|
||||
* @access private
|
||||
* @var object Class object.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @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.0.0
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'admin_notices', array( $this, 'show_notices' ), 30 );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||
add_action( 'wp_ajax_astra-notice-dismiss', array( $this, 'dismiss_notice' ) );
|
||||
add_filter( 'wp_kses_allowed_html', array( $this, 'add_data_attributes' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters and Returns a list of allowed tags and attributes for a given context.
|
||||
*
|
||||
* @param array $allowedposttags array of allowed tags.
|
||||
* @param string $context Context type (explicit).
|
||||
* @since 1.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function add_data_attributes( $allowedposttags, $context ) {
|
||||
$allowedposttags['a']['data-repeat-notice-after'] = true;
|
||||
|
||||
return $allowedposttags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param array $args Notice arguments.
|
||||
* @return void
|
||||
*/
|
||||
public static function add_notice( $args = array() ) {
|
||||
self::$notices[] = $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss Notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function dismiss_notice() {
|
||||
$notice_id = ( isset( $_POST['notice_id'] ) ) ? sanitize_key( $_POST['notice_id'] ) : '';
|
||||
$repeat_notice_after = ( isset( $_POST['repeat_notice_after'] ) ) ? absint( $_POST['repeat_notice_after'] ) : '';
|
||||
$nonce = ( isset( $_POST['nonce'] ) ) ? sanitize_key( $_POST['nonce'] ) : '';
|
||||
$notice = $this->get_notice_by_id( $notice_id );
|
||||
$capability = isset( $notice['capability'] ) ? $notice['capability'] : 'manage_options';
|
||||
|
||||
if ( ! apply_filters( 'astra_notices_user_cap_check', current_user_can( $capability ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( false === wp_verify_nonce( $nonce, 'astra-notices' ) ) {
|
||||
wp_send_json_error( esc_html_e( 'WordPress Nonce not validated.', 'wp-schema-pro' ) );
|
||||
}
|
||||
|
||||
// Valid inputs?
|
||||
if ( ! empty( $notice_id ) ) {
|
||||
|
||||
if ( ! empty( $repeat_notice_after ) ) {
|
||||
set_transient( $notice_id, true, $repeat_notice_after );
|
||||
} else {
|
||||
update_user_meta( get_current_user_id(), $notice_id, 'notice-dismissed' );
|
||||
}
|
||||
|
||||
wp_send_json_success();
|
||||
}
|
||||
|
||||
wp_send_json_error();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue Scripts.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_scripts() {
|
||||
wp_register_script( 'astra-notices', self::get_url() . 'notices.js', array( 'jquery' ), self::$version, true );
|
||||
wp_localize_script(
|
||||
'astra-notices',
|
||||
'astraNotices',
|
||||
array(
|
||||
'_notice_nonce' => wp_create_nonce( 'astra-notices' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the notices based on the given priority of the notice.
|
||||
* This function is called from usort()
|
||||
*
|
||||
* @since 1.5.2
|
||||
* @param array $notice_1 First notice.
|
||||
* @param array $notice_2 Second Notice.
|
||||
* @return array
|
||||
*/
|
||||
public function sort_notices( $notice_1, $notice_2 ) {
|
||||
if ( ! isset( $notice_1['priority'] ) ) {
|
||||
$notice_1['priority'] = 10;
|
||||
}
|
||||
if ( ! isset( $notice_2['priority'] ) ) {
|
||||
$notice_2['priority'] = 10;
|
||||
}
|
||||
|
||||
return $notice_1['priority'] - $notice_2['priority'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all registered notices.
|
||||
* Since v1.1.8 it is recommended to register the notices on
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
private function get_notices() {
|
||||
usort( self::$notices, array( $this, 'sort_notices' ) );
|
||||
|
||||
return self::$notices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get notice by notice_id
|
||||
*
|
||||
* @param string $notice_id Notice id.
|
||||
*
|
||||
* @return array notice based on the notice id.
|
||||
*/
|
||||
private function get_notice_by_id( $notice_id ) {
|
||||
if ( empty( $notice_id ) ) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$notices = $this->get_notices();
|
||||
$notice = wp_list_filter(
|
||||
$notices,
|
||||
array(
|
||||
'id' => $notice_id,
|
||||
)
|
||||
);
|
||||
|
||||
return ! empty( $notice ) ? $notice[0] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the notices in the WordPress admin.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @return void
|
||||
*/
|
||||
public function show_notices() {
|
||||
$defaults = array(
|
||||
'id' => '', // Optional, Notice ID. If empty it set `astra-notices-id-<$array-index>`.
|
||||
'type' => 'info', // Optional, Notice type. Default `info`. Expected [info, warning, notice, error].
|
||||
'message' => '', // Optional, Message.
|
||||
'show_if' => true, // Optional, Show notice on custom condition. E.g. 'show_if' => if( is_admin() ) ? true, false, .
|
||||
'repeat-notice-after' => '', // Optional, Dismiss-able notice time. It'll auto show after given time.
|
||||
'display-notice-after' => false, // Optional, Dismiss-able notice time. It'll auto show after given time.
|
||||
'class' => '', // Optional, Additional notice wrapper class.
|
||||
'priority' => 10, // Priority of the notice.
|
||||
'display-with-other-notices' => true, // Should the notice be displayed if other notices are being displayed from Astra_Notices.
|
||||
'is_dismissible' => true,
|
||||
'capability' => 'manage_options', // User capability - This capability is required for the current user to see this notice.
|
||||
);
|
||||
|
||||
// Count for the notices that are rendered.
|
||||
$notices_displayed = 0;
|
||||
$notices = $this->get_notices();
|
||||
|
||||
foreach ( $notices as $key => $notice ) {
|
||||
$notice = wp_parse_args( $notice, $defaults );
|
||||
|
||||
// Show notices only for users with `manage_options` cap.
|
||||
if ( ! current_user_can( $notice['capability'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notice['id'] = self::get_notice_id( $notice, $key );
|
||||
$notice['classes'] = self::get_wrap_classes( $notice );
|
||||
|
||||
// Notices visible after transient expire.
|
||||
if ( isset( $notice['show_if'] ) && true === $notice['show_if'] ) {
|
||||
|
||||
// don't display the notice if it is not supposed to be displayed with other notices.
|
||||
if ( 0 !== $notices_displayed && false === $notice['display-with-other-notices'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( self::is_expired( $notice ) ) {
|
||||
|
||||
self::markup( $notice );
|
||||
++$notices_displayed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @param array $notice Notice markup.
|
||||
* @return void
|
||||
*/
|
||||
public static function markup( $notice = array() ) {
|
||||
wp_enqueue_script( 'astra-notices' );
|
||||
|
||||
do_action( 'astra_notice_before_markup' );
|
||||
|
||||
do_action( "astra_notice_before_markup_{$notice['id']}" );
|
||||
|
||||
?>
|
||||
<div id="<?php echo esc_attr( $notice['id'] ); ?>" class="<?php echo esc_attr( $notice['classes'] ); ?>" data-repeat-notice-after="<?php echo esc_attr( $notice['repeat-notice-after'] ); ?>">
|
||||
<div class="notice-container">
|
||||
<?php do_action( "astra_notice_inside_markup_{$notice['id']}" ); ?>
|
||||
<?php echo wp_kses_post( $notice['message'] ); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
do_action( "astra_notice_after_markup_{$notice['id']}" );
|
||||
|
||||
do_action( 'astra_notice_after_markup' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get wrapper classes for a notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @return array Notice wrapper classes.
|
||||
*/
|
||||
private static function get_wrap_classes( $notice ) {
|
||||
$classes = array( 'astra-notice', 'notice' );
|
||||
|
||||
if ( $notice['is_dismissible'] ) {
|
||||
$classes[] = 'is-dismissible';
|
||||
}
|
||||
|
||||
$classes[] = $notice['class'];
|
||||
if ( isset( $notice['type'] ) && '' !== $notice['type'] ) {
|
||||
$classes[] = 'notice-' . $notice['type'];
|
||||
}
|
||||
|
||||
return esc_attr( implode( ' ', $classes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML ID for a given notice.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @param int $key Notice array index.
|
||||
* @return string HTML if for the notice.
|
||||
*/
|
||||
private static function get_notice_id( $notice, $key ) {
|
||||
if ( isset( $notice['id'] ) && ! empty( $notice['id'] ) ) {
|
||||
return $notice['id'];
|
||||
}
|
||||
|
||||
return 'astra-notices-id-' . $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the notice is expires.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param array $notice Notice arguments.
|
||||
* @return boolean
|
||||
*/
|
||||
private static function is_expired( $notice ) {
|
||||
$transient_status = get_transient( $notice['id'] );
|
||||
|
||||
if ( false === $transient_status ) {
|
||||
|
||||
if ( isset( $notice['display-notice-after'] ) && false !== $notice['display-notice-after'] ) {
|
||||
|
||||
if ( 'delayed-notice' !== get_user_meta( get_current_user_id(), $notice['id'], true ) &&
|
||||
'notice-dismissed' !== get_user_meta( get_current_user_id(), $notice['id'], true ) ) {
|
||||
set_transient( $notice['id'], 'delayed-notice', $notice['display-notice-after'] );
|
||||
update_user_meta( get_current_user_id(), $notice['id'], 'delayed-notice' );
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the user meta status if current notice is dismissed or delay completed.
|
||||
$meta_status = get_user_meta( get_current_user_id(), $notice['id'], true );
|
||||
|
||||
if ( empty( $meta_status ) || 'delayed-notice' === $meta_status ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get base URL for the astra-notices.
|
||||
*
|
||||
* @return mixed URL.
|
||||
*/
|
||||
public static function get_url() {
|
||||
$path = wp_normalize_path( dirname( __FILE__ ) );
|
||||
$theme_dir = wp_normalize_path( get_template_directory() );
|
||||
|
||||
if ( strpos( $path, $theme_dir ) !== false ) {
|
||||
return trailingslashit( get_template_directory_uri() . str_replace( $theme_dir, '', $path ) );
|
||||
} else {
|
||||
return plugin_dir_url( __FILE__ );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
Astra_Notices::get_instance();
|
||||
|
||||
endif;
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Premium License
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div id="aiosrs-pro-license-form" style="display: none;">
|
||||
<div class="aiosrs-pro-license-form-overlay"></div>
|
||||
<div class="aiosrs-pro-license-form-inner">
|
||||
<button type="button" id="aiosrs-pro-license-form-close-btn">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close', 'wp-schema-pro' ); ?></span>
|
||||
<span class="dashicons dashicons-no-alt"></span>
|
||||
</button>
|
||||
|
||||
<?php
|
||||
$bsf_product_id = bsf_extract_product_id( BSF_AIOSRS_PRO_DIR );
|
||||
$args = array(
|
||||
'product_id' => $bsf_product_id,
|
||||
'button_text_activate' => esc_html__( 'Activate License', 'wp-schema-pro' ),
|
||||
'button_text_deactivate' => esc_html__( 'Deactivate License', 'wp-schema-pro' ),
|
||||
'license_form_title' => '',
|
||||
'license_deactivate_status' => esc_html__( 'Your license is not active!', 'wp-schema-pro' ),
|
||||
'license_activate_status' => esc_html__( 'Your license is activated!', 'wp-schema-pro' ),
|
||||
'submit_button_class' => 'bsf-product-license button-default',
|
||||
'form_class' => 'form-wrap bsf-license-register-' . esc_attr( $bsf_product_id ),
|
||||
'bsf_license_form_heading_class' => 'bsf-license-heading',
|
||||
'bsf_license_active_class' => 'success-message',
|
||||
'bsf_license_not_activate_message' => 'license-error',
|
||||
'size' => 'regular',
|
||||
'bsf_license_allow_email' => false,
|
||||
);
|
||||
echo esc_html( bsf_license_activation_form( $args ) );
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Premium License
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div id="aiosrs-pro-license-form" style="display: none;">
|
||||
<div class="aiosrs-pro-license-form-overlay"></div>
|
||||
<div class="aiosrs-pro-license-form-inner">
|
||||
<button type="button" id="aiosrs-pro-license-form-close-btn">
|
||||
<span class="screen-reader-text"><?php esc_html_e( 'Close', 'wp-schema-pro' ); ?></span>
|
||||
<span class="dashicons dashicons-no-alt"></span>
|
||||
</button>
|
||||
|
||||
<?php
|
||||
$bsf_product_id = bsf_extract_product_id( BSF_AIOSRS_PRO_DIR );
|
||||
$args = array(
|
||||
'product_id' => $bsf_product_id,
|
||||
'button_text_activate' => esc_html__( 'Activate License', 'wp-schema-pro' ),
|
||||
'button_text_deactivate' => esc_html__( 'Deactivate License', 'wp-schema-pro' ),
|
||||
'license_form_title' => '',
|
||||
'license_deactivate_status' => esc_html__( 'Your license is not active!', 'wp-schema-pro' ),
|
||||
'license_activate_status' => esc_html__( 'Your license is activated!', 'wp-schema-pro' ),
|
||||
'submit_button_class' => 'bsf-product-license button-default',
|
||||
'form_class' => 'form-wrap bsf-license-register-' . esc_attr( $bsf_product_id ),
|
||||
'bsf_license_form_heading_class' => 'bsf-license-heading',
|
||||
'bsf_license_active_class' => 'success-message',
|
||||
'bsf_license_not_activate_message' => 'license-error',
|
||||
'size' => 'regular',
|
||||
'bsf_license_allow_email' => false,
|
||||
);
|
||||
echo esc_html( bsf_license_activation_form( $args ) );
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exit if accessed directly.
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
die;
|
||||
}
|
||||
/**
|
||||
* Set constants.
|
||||
*/
|
||||
define( 'BSF_AIOSRS_PRO_FILE', __FILE__ );
|
||||
define( 'BSF_AIOSRS_PRO_DIR', plugin_dir_path( BSF_AIOSRS_PRO_FILE ) );
|
||||
|
||||
/**
|
||||
* Required uninstall file.
|
||||
*/
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'classes/class-bsf-aiosrs-pro-helper.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'classes/class-bsf-aiosrs-pro-schema-global-uninstall.php';
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Exit if accessed directly.
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
die;
|
||||
}
|
||||
/**
|
||||
* Set constants.
|
||||
*/
|
||||
define( 'BSF_AIOSRS_PRO_FILE', __FILE__ );
|
||||
define( 'BSF_AIOSRS_PRO_DIR', plugin_dir_path( BSF_AIOSRS_PRO_FILE ) );
|
||||
|
||||
/**
|
||||
* Required uninstall file.
|
||||
*/
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'classes/class-bsf-aiosrs-pro-helper.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'classes/class-bsf-aiosrs-pro-schema-global-uninstall.php';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Author: Brainstorm Force
|
||||
* Author URI: https://www.brainstormforce.com
|
||||
* Description: Schema Pro is the go-to plugin to adding Schema Markup on your website with ease. Enables you to display rich snippets on search engines and improve your overall page SEO.
|
||||
* Version: 2.7.11
|
||||
* Version: 2.7.9
|
||||
* Text Domain: wp-schema-pro
|
||||
* License: GPL2
|
||||
*
|
||||
@@ -70,7 +70,7 @@ define( 'BSF_AIOSRS_PRO_FILE', __FILE__ );
|
||||
define( 'BSF_AIOSRS_PRO_BASE', plugin_basename( BSF_AIOSRS_PRO_FILE ) );
|
||||
define( 'BSF_AIOSRS_PRO_DIR', plugin_dir_path( BSF_AIOSRS_PRO_FILE ) );
|
||||
define( 'BSF_AIOSRS_PRO_URI', plugins_url( '/', BSF_AIOSRS_PRO_FILE ) );
|
||||
define( 'BSF_AIOSRS_PRO_VER', '2.7.11' );
|
||||
define( 'BSF_AIOSRS_PRO_VER', '2.7.9' );
|
||||
define( 'BSF_AIOSRS_PRO_CACHE_KEY', 'wp_schema_pro_optimized_structured_data' );
|
||||
define( 'BSF_AIOSRS_PRO_WEBSITE_URL', 'https://wpschema.com/' );
|
||||
|
||||
|
||||
@@ -1,168 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Admin Helper.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Admin_Helper' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Admin_Helper.
|
||||
*/
|
||||
final class BSF_SP_Admin_Helper {
|
||||
|
||||
/**
|
||||
* Member Variable
|
||||
*
|
||||
* @since 0.0.1
|
||||
* @var instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an option from the database for
|
||||
* the admin settings page.
|
||||
*
|
||||
* @param string $key The option key.
|
||||
* @param mixed $default Option default value if option is not available.
|
||||
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
||||
* @return string Return the option value
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
||||
|
||||
// Get the site-wide option if we're in the network admin.
|
||||
if ( $network_override && is_multisite() ) {
|
||||
$value = get_site_option( $key, $default );
|
||||
} else {
|
||||
$value = get_option( $key, $default );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide Widget settings.
|
||||
*
|
||||
* @return array()
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_block_options() {
|
||||
|
||||
$blocks = BSF_SP_Helper::$block_list;
|
||||
$saved_blocks = self::get_admin_settings_option( '_wpsp_blocks' );
|
||||
if ( is_array( $blocks ) ) {
|
||||
foreach ( $blocks as $slug => $data ) {
|
||||
$_slug = str_replace( 'wpsp/', '', $slug );
|
||||
|
||||
if ( isset( $saved_blocks[ $_slug ] ) ) {
|
||||
if ( 'disabled' === $saved_blocks[ $_slug ] ) {
|
||||
$blocks[ $slug ]['is_activate'] = false;
|
||||
} else {
|
||||
$blocks[ $slug ]['is_activate'] = true;
|
||||
}
|
||||
} else {
|
||||
$blocks[ $slug ]['is_activate'] = ( isset( $data['default'] ) ) ? $data['default'] : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BSF_SP_Helper::$block_list = $blocks;
|
||||
|
||||
return apply_filters( 'wpsp_enabled_blocks', BSF_SP_Helper::$block_list );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an option from the admin settings page.
|
||||
*
|
||||
* @param string $key The option key.
|
||||
* @param mixed $value The value to update.
|
||||
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
||||
* @return mixed
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
||||
|
||||
// Update the site-wide option since we're in the network admin.
|
||||
if ( $network && is_multisite() ) {
|
||||
update_site_option( $key, $value );
|
||||
} else {
|
||||
update_option( $key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Specific Stylesheet
|
||||
*
|
||||
* @since 1.13.4
|
||||
*/
|
||||
public static function create_specific_stylesheet() {
|
||||
|
||||
$saved_blocks = self::get_admin_settings_option( '_wpsp_blocks' );
|
||||
$combined = array();
|
||||
$is_already_faq = false;
|
||||
|
||||
foreach ( BSF_SP_Config::$block_attributes as $key => $block ) {
|
||||
|
||||
$block_name = str_replace( 'wpsp/', '', $key );
|
||||
|
||||
if ( isset( $saved_blocks[ $block_name ] ) && 'disabled' === $saved_blocks[ $block_name ] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ( $block_name ) {
|
||||
case 'faq-child':
|
||||
case 'faq':
|
||||
if ( ! $is_already_faq ) {
|
||||
$combined[] = 'faq';
|
||||
$combined[] = 'faq-child';
|
||||
$is_already_faq = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$combined[] = $block_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$combined_path = plugin_dir_path( BSF_AIOSRS_PRO_FILE ) . 'dist/style-blocks.css';
|
||||
wp_delete_file( $combined_path );
|
||||
|
||||
$style = '';
|
||||
|
||||
$wp_filesystem = BSF_SP_Helper::get_instance()->get_filesystem();
|
||||
|
||||
foreach ( $combined as $key => $c_block ) {
|
||||
$style .= $wp_filesystem->get_contents( plugin_dir_path( BSF_AIOSRS_PRO_FILE ) . 'wpsp-blocks/assets/css/blocks/' . $c_block . '.css' );
|
||||
|
||||
}
|
||||
$wp_filesystem->put_contents( $combined_path, $style, FS_CHMOD_FILE );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare if class 'WPSP_Admin_Helper' exist.
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
BSF_SP_Admin_Helper::get_instance();
|
||||
}
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Admin Helper.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Admin_Helper' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Admin_Helper.
|
||||
*/
|
||||
final class BSF_SP_Admin_Helper {
|
||||
|
||||
/**
|
||||
* Member Variable
|
||||
*
|
||||
* @since 0.0.1
|
||||
* @var instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an option from the database for
|
||||
* the admin settings page.
|
||||
*
|
||||
* @param string $key The option key.
|
||||
* @param mixed $default Option default value if option is not available.
|
||||
* @param boolean $network_override Whether to allow the network admin setting to be overridden on subsites.
|
||||
* @return string Return the option value
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_admin_settings_option( $key, $default = false, $network_override = false ) {
|
||||
|
||||
// Get the site-wide option if we're in the network admin.
|
||||
if ( $network_override && is_multisite() ) {
|
||||
$value = get_site_option( $key, $default );
|
||||
} else {
|
||||
$value = get_option( $key, $default );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide Widget settings.
|
||||
*
|
||||
* @return array()
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function get_block_options() {
|
||||
|
||||
$blocks = BSF_SP_Helper::$block_list;
|
||||
$saved_blocks = self::get_admin_settings_option( '_wpsp_blocks' );
|
||||
if ( is_array( $blocks ) ) {
|
||||
foreach ( $blocks as $slug => $data ) {
|
||||
$_slug = str_replace( 'wpsp/', '', $slug );
|
||||
|
||||
if ( isset( $saved_blocks[ $_slug ] ) ) {
|
||||
if ( 'disabled' === $saved_blocks[ $_slug ] ) {
|
||||
$blocks[ $slug ]['is_activate'] = false;
|
||||
} else {
|
||||
$blocks[ $slug ]['is_activate'] = true;
|
||||
}
|
||||
} else {
|
||||
$blocks[ $slug ]['is_activate'] = ( isset( $data['default'] ) ) ? $data['default'] : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BSF_SP_Helper::$block_list = $blocks;
|
||||
|
||||
return apply_filters( 'wpsp_enabled_blocks', BSF_SP_Helper::$block_list );
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an option from the admin settings page.
|
||||
*
|
||||
* @param string $key The option key.
|
||||
* @param mixed $value The value to update.
|
||||
* @param bool $network Whether to allow the network admin setting to be overridden on subsites.
|
||||
* @return mixed
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public static function update_admin_settings_option( $key, $value, $network = false ) {
|
||||
|
||||
// Update the site-wide option since we're in the network admin.
|
||||
if ( $network && is_multisite() ) {
|
||||
update_site_option( $key, $value );
|
||||
} else {
|
||||
update_option( $key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Specific Stylesheet
|
||||
*
|
||||
* @since 1.13.4
|
||||
*/
|
||||
public static function create_specific_stylesheet() {
|
||||
|
||||
$saved_blocks = self::get_admin_settings_option( '_wpsp_blocks' );
|
||||
$combined = array();
|
||||
$is_already_faq = false;
|
||||
|
||||
foreach ( BSF_SP_Config::$block_attributes as $key => $block ) {
|
||||
|
||||
$block_name = str_replace( 'wpsp/', '', $key );
|
||||
|
||||
if ( isset( $saved_blocks[ $block_name ] ) && 'disabled' === $saved_blocks[ $block_name ] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ( $block_name ) {
|
||||
case 'faq-child':
|
||||
case 'faq':
|
||||
if ( ! $is_already_faq ) {
|
||||
$combined[] = 'faq';
|
||||
$combined[] = 'faq-child';
|
||||
$is_already_faq = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$combined[] = $block_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$combined_path = plugin_dir_path( BSF_AIOSRS_PRO_FILE ) . 'dist/style-blocks.css';
|
||||
wp_delete_file( $combined_path );
|
||||
|
||||
$style = '';
|
||||
|
||||
$wp_filesystem = BSF_SP_Helper::get_instance()->get_filesystem();
|
||||
|
||||
foreach ( $combined as $key => $c_block ) {
|
||||
$style .= $wp_filesystem->get_contents( plugin_dir_path( BSF_AIOSRS_PRO_FILE ) . 'wpsp-blocks/assets/css/blocks/' . $c_block . '.css' );
|
||||
|
||||
}
|
||||
$wp_filesystem->put_contents( $combined_path, $style, FS_CHMOD_FILE );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare if class 'WPSP_Admin_Helper' exist.
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
BSF_SP_Admin_Helper::get_instance();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,98 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Block Helper.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Block_JS' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Block_JS.
|
||||
*/
|
||||
class BSF_SP_Block_JS {
|
||||
|
||||
/**
|
||||
* Adds Google fonts for FAQ block.
|
||||
*
|
||||
* @since 1.15.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_faq_gfont( $attr ) {
|
||||
|
||||
$question_load_google_font = isset( $attr['questionloadGoogleFonts'] ) ? $attr['questionloadGoogleFonts'] : '';
|
||||
$question_font_family = isset( $attr['questionFontFamily'] ) ? $attr['questionFontFamily'] : '';
|
||||
$question_font_weight = isset( $attr['questionFontWeight'] ) ? $attr['questionFontWeight'] : '';
|
||||
$question_font_subset = isset( $attr['questionFontSubset'] ) ? $attr['questionFontSubset'] : '';
|
||||
|
||||
$answer_load_google_font = isset( $attr['answerloadGoogleFonts'] ) ? $attr['answerloadGoogleFonts'] : '';
|
||||
$answer_font_family = isset( $attr['answerFontFamily'] ) ? $attr['answerFontFamily'] : '';
|
||||
$answer_font_weight = isset( $attr['answerFontWeight'] ) ? $attr['answerFontWeight'] : '';
|
||||
$answer_font_subset = isset( $attr['answerFontSubset'] ) ? $attr['answerFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $question_load_google_font, $question_font_family, $question_font_weight, $question_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $answer_load_google_font, $answer_font_family, $answer_font_weight, $answer_font_subset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Google fonts for How To block.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_how_to_gfont( $attr ) {
|
||||
|
||||
$head_load_google_font = isset( $attr['headLoadGoogleFonts'] ) ? $attr['headLoadGoogleFonts'] : '';
|
||||
$head_font_family = isset( $attr['headFontFamily'] ) ? $attr['headFontFamily'] : '';
|
||||
$head_font_weight = isset( $attr['headFontWeight'] ) ? $attr['headFontWeight'] : '';
|
||||
$head_font_subset = isset( $attr['headFontSubset'] ) ? $attr['headFontSubset'] : '';
|
||||
|
||||
$subhead_load_google_font = isset( $attr['subHeadLoadGoogleFonts'] ) ? $attr['subHeadLoadGoogleFonts'] : '';
|
||||
$subhead_font_family = isset( $attr['subHeadFontFamily'] ) ? $attr['subHeadFontFamily'] : '';
|
||||
$subhead_font_weight = isset( $attr['subHeadFontWeight'] ) ? $attr['subHeadFontWeight'] : '';
|
||||
$subhead_font_subset = isset( $attr['subHeadFontSubset'] ) ? $attr['subHeadFontSubset'] : '';
|
||||
|
||||
$price_load_google_font = isset( $attr['priceLoadGoogleFonts'] ) ? $attr['priceLoadGoogleFonts'] : '';
|
||||
$price_font_family = isset( $attr['priceFontFamily'] ) ? $attr['priceFontFamily'] : '';
|
||||
$price_font_weight = isset( $attr['priceFontWeight'] ) ? $attr['priceFontWeight'] : '';
|
||||
$price_font_subset = isset( $attr['priceFontSubset'] ) ? $attr['priceFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $head_load_google_font, $head_font_family, $head_font_weight, $head_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $subhead_load_google_font, $subhead_font_family, $subhead_font_weight, $subhead_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $price_load_google_font, $price_font_family, $price_font_weight, $price_font_subset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Google fonts for HowTo Child Block.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_how_to_child_gfont( $attr ) {
|
||||
|
||||
$head_load_google_font = isset( $attr['headLoadGoogleFonts'] ) ? $attr['headLoadGoogleFonts'] : '';
|
||||
$head_font_family = isset( $attr['headFontFamily'] ) ? $attr['headFontFamily'] : '';
|
||||
$head_font_weight = isset( $attr['headFontWeight'] ) ? $attr['headFontWeight'] : '';
|
||||
$head_font_subset = isset( $attr['headFontSubset'] ) ? $attr['headFontSubset'] : '';
|
||||
|
||||
$subhead_load_google_font = isset( $attr['subHeadLoadGoogleFonts'] ) ? $attr['subHeadLoadGoogleFonts'] : '';
|
||||
$subhead_font_family = isset( $attr['subHeadFontFamily'] ) ? $attr['subHeadFontFamily'] : '';
|
||||
$subhead_font_weight = isset( $attr['subHeadFontWeight'] ) ? $attr['subHeadFontWeight'] : '';
|
||||
$subhead_font_subset = isset( $attr['subHeadFontSubset'] ) ? $attr['subHeadFontSubset'] : '';
|
||||
|
||||
$cta_load_google_font = isset( $attr['ctaLoadGoogleFonts'] ) ? $attr['ctaLoadGoogleFonts'] : '';
|
||||
$cta_font_family = isset( $attr['ctaFontFamily'] ) ? $attr['ctaFontFamily'] : '';
|
||||
$cta_font_weight = isset( $attr['ctaFontWeight'] ) ? $attr['ctaFontWeight'] : '';
|
||||
$cta_font_subset = isset( $attr['ctaFontSubset'] ) ? $attr['ctaFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $cta_load_google_font, $cta_font_family, $cta_font_weight, $cta_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $head_load_google_font, $head_font_family, $head_font_weight, $head_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $subhead_load_google_font, $subhead_font_family, $subhead_font_weight, $subhead_font_subset );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Block Helper.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Block_JS' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Block_JS.
|
||||
*/
|
||||
class BSF_SP_Block_JS {
|
||||
|
||||
/**
|
||||
* Adds Google fonts for FAQ block.
|
||||
*
|
||||
* @since 1.15.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_faq_gfont( $attr ) {
|
||||
|
||||
$question_load_google_font = isset( $attr['questionloadGoogleFonts'] ) ? $attr['questionloadGoogleFonts'] : '';
|
||||
$question_font_family = isset( $attr['questionFontFamily'] ) ? $attr['questionFontFamily'] : '';
|
||||
$question_font_weight = isset( $attr['questionFontWeight'] ) ? $attr['questionFontWeight'] : '';
|
||||
$question_font_subset = isset( $attr['questionFontSubset'] ) ? $attr['questionFontSubset'] : '';
|
||||
|
||||
$answer_load_google_font = isset( $attr['answerloadGoogleFonts'] ) ? $attr['answerloadGoogleFonts'] : '';
|
||||
$answer_font_family = isset( $attr['answerFontFamily'] ) ? $attr['answerFontFamily'] : '';
|
||||
$answer_font_weight = isset( $attr['answerFontWeight'] ) ? $attr['answerFontWeight'] : '';
|
||||
$answer_font_subset = isset( $attr['answerFontSubset'] ) ? $attr['answerFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $question_load_google_font, $question_font_family, $question_font_weight, $question_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $answer_load_google_font, $answer_font_family, $answer_font_weight, $answer_font_subset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Google fonts for How To block.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_how_to_gfont( $attr ) {
|
||||
|
||||
$head_load_google_font = isset( $attr['headLoadGoogleFonts'] ) ? $attr['headLoadGoogleFonts'] : '';
|
||||
$head_font_family = isset( $attr['headFontFamily'] ) ? $attr['headFontFamily'] : '';
|
||||
$head_font_weight = isset( $attr['headFontWeight'] ) ? $attr['headFontWeight'] : '';
|
||||
$head_font_subset = isset( $attr['headFontSubset'] ) ? $attr['headFontSubset'] : '';
|
||||
|
||||
$subhead_load_google_font = isset( $attr['subHeadLoadGoogleFonts'] ) ? $attr['subHeadLoadGoogleFonts'] : '';
|
||||
$subhead_font_family = isset( $attr['subHeadFontFamily'] ) ? $attr['subHeadFontFamily'] : '';
|
||||
$subhead_font_weight = isset( $attr['subHeadFontWeight'] ) ? $attr['subHeadFontWeight'] : '';
|
||||
$subhead_font_subset = isset( $attr['subHeadFontSubset'] ) ? $attr['subHeadFontSubset'] : '';
|
||||
|
||||
$price_load_google_font = isset( $attr['priceLoadGoogleFonts'] ) ? $attr['priceLoadGoogleFonts'] : '';
|
||||
$price_font_family = isset( $attr['priceFontFamily'] ) ? $attr['priceFontFamily'] : '';
|
||||
$price_font_weight = isset( $attr['priceFontWeight'] ) ? $attr['priceFontWeight'] : '';
|
||||
$price_font_subset = isset( $attr['priceFontSubset'] ) ? $attr['priceFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $head_load_google_font, $head_font_family, $head_font_weight, $head_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $subhead_load_google_font, $subhead_font_family, $subhead_font_weight, $subhead_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $price_load_google_font, $price_font_family, $price_font_weight, $price_font_subset );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds Google fonts for HowTo Child Block.
|
||||
*
|
||||
* @since 2.4.0
|
||||
* @param array $attr the blocks attr.
|
||||
*/
|
||||
public static function blocks_how_to_child_gfont( $attr ) {
|
||||
|
||||
$head_load_google_font = isset( $attr['headLoadGoogleFonts'] ) ? $attr['headLoadGoogleFonts'] : '';
|
||||
$head_font_family = isset( $attr['headFontFamily'] ) ? $attr['headFontFamily'] : '';
|
||||
$head_font_weight = isset( $attr['headFontWeight'] ) ? $attr['headFontWeight'] : '';
|
||||
$head_font_subset = isset( $attr['headFontSubset'] ) ? $attr['headFontSubset'] : '';
|
||||
|
||||
$subhead_load_google_font = isset( $attr['subHeadLoadGoogleFonts'] ) ? $attr['subHeadLoadGoogleFonts'] : '';
|
||||
$subhead_font_family = isset( $attr['subHeadFontFamily'] ) ? $attr['subHeadFontFamily'] : '';
|
||||
$subhead_font_weight = isset( $attr['subHeadFontWeight'] ) ? $attr['subHeadFontWeight'] : '';
|
||||
$subhead_font_subset = isset( $attr['subHeadFontSubset'] ) ? $attr['subHeadFontSubset'] : '';
|
||||
|
||||
$cta_load_google_font = isset( $attr['ctaLoadGoogleFonts'] ) ? $attr['ctaLoadGoogleFonts'] : '';
|
||||
$cta_font_family = isset( $attr['ctaFontFamily'] ) ? $attr['ctaFontFamily'] : '';
|
||||
$cta_font_weight = isset( $attr['ctaFontWeight'] ) ? $attr['ctaFontWeight'] : '';
|
||||
$cta_font_subset = isset( $attr['ctaFontSubset'] ) ? $attr['ctaFontSubset'] : '';
|
||||
|
||||
BSF_SP_Helper::blocks_google_font( $cta_load_google_font, $cta_font_family, $cta_font_weight, $cta_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $head_load_google_font, $head_font_family, $head_font_weight, $head_font_subset );
|
||||
BSF_SP_Helper::blocks_google_font( $subhead_load_google_font, $subhead_font_family, $subhead_font_weight, $subhead_font_subset );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,338 +1,338 @@
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Config.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Config' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Config.
|
||||
*/
|
||||
class BSF_SP_Config {
|
||||
|
||||
/**
|
||||
* Block Attributes
|
||||
*
|
||||
* @var block_attributes
|
||||
*/
|
||||
public static $block_attributes = null;
|
||||
|
||||
/**
|
||||
* Block Assets
|
||||
*
|
||||
* @var block_attributes
|
||||
*/
|
||||
public static $block_assets = null;
|
||||
|
||||
/**
|
||||
* Get Widget List.
|
||||
*
|
||||
* @since 0.0.1
|
||||
*
|
||||
* @return array The Widget List.
|
||||
*/
|
||||
public static function get_block_attributes() {
|
||||
|
||||
if ( null === self::$block_attributes ) {
|
||||
self::$block_attributes = array(
|
||||
'wpsp/faq' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'FAQ - Schema Pro', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block helps you add a FAQ section with inbuilt schema support.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'js_assets' => array( 'wpsp-faq-js' ),
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'layout' => 'accordion',
|
||||
'inactiveOtherItems' => true,
|
||||
'expandFirstItem' => false,
|
||||
'enableSchemaSupport' => false,
|
||||
'align' => 'left',
|
||||
'enableSeparator' => false,
|
||||
'rowsGap' => 10,
|
||||
'columnsGap' => 10,
|
||||
'boxBgColor' => '#FFFFFF',
|
||||
'boxPaddingTypeMobile' => 'px',
|
||||
'boxPaddingTypeTablet' => 'px',
|
||||
'boxPaddingTypeDesktop' => 'px',
|
||||
'vBoxPaddingMobile' => 10,
|
||||
'hBoxPaddingMobile' => 10,
|
||||
'vBoxPaddingTablet' => 10,
|
||||
'hBoxPaddingTablet' => 10,
|
||||
'vBoxPaddingDesktop' => 10,
|
||||
'hBoxPaddingDesktop' => 10,
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => 1,
|
||||
'borderRadius' => 2,
|
||||
'borderColor' => '#D2D2D2',
|
||||
'questionTextColor' => '#313131',
|
||||
'questionTextActiveColor' => '#313131',
|
||||
'questionPaddingTypeDesktop' => 'px',
|
||||
'vquestionPaddingMobile' => 10,
|
||||
'vquestionPaddingTablet' => 10,
|
||||
'vquestionPaddingDesktop' => 10,
|
||||
'hquestionPaddingMobile' => 10,
|
||||
'hquestionPaddingTablet' => 10,
|
||||
'hquestionPaddingDesktop' => 10,
|
||||
'answerTextColor' => '#313131',
|
||||
'answerPaddingTypeDesktop' => 'px',
|
||||
'vanswerPaddingMobile' => 10,
|
||||
'vanswerPaddingTablet' => 10,
|
||||
'vanswerPaddingDesktop' => 10,
|
||||
'hanswerPaddingMobile' => 10,
|
||||
'hanswerPaddingTablet' => 10,
|
||||
'hanswerPaddingDesktop' => 10,
|
||||
'iconColor' => '',
|
||||
'iconActiveColor' => '',
|
||||
'gapBtwIconQUestion' => 10,
|
||||
'questionloadGoogleFonts' => false,
|
||||
'answerloadGoogleFonts' => false,
|
||||
'questionFontFamily' => 'Default',
|
||||
'questionFontWeight' => '',
|
||||
'questionFontSubset' => '',
|
||||
'questionFontSize' => '',
|
||||
'questionFontSizeType' => 'px',
|
||||
'questionFontSizeTablet' => '',
|
||||
'questionFontSizeMobile' => '',
|
||||
'questionLineHeight' => '',
|
||||
'questionLineHeightType' => 'em',
|
||||
'questionLineHeightTablet' => '',
|
||||
'questionLineHeightMobile' => '',
|
||||
'answerFontFamily' => 'Default',
|
||||
'answerFontWeight' => '',
|
||||
'answerFontSubset' => '',
|
||||
'answerFontSize' => '',
|
||||
'answerFontSizeType' => 'px',
|
||||
'answerFontSizeTablet' => '',
|
||||
'answerFontSizeMobile' => '',
|
||||
'answerLineHeight' => '',
|
||||
'answerLineHeightType' => 'em',
|
||||
'answerLineHeightTablet' => '',
|
||||
'answerLineHeightMobile' => '',
|
||||
'icon' => 'fas fa-plus',
|
||||
'iconActive' => 'fas fa-minus',
|
||||
'iconAlign' => 'row',
|
||||
'iconSize' => 15,
|
||||
'iconSizeMobile' => 15,
|
||||
'iconSizeTablet' => 15,
|
||||
'iconSizeType' => 'px',
|
||||
'columns' => 2,
|
||||
'tcolumns' => 2,
|
||||
'mcolumns' => 1,
|
||||
'schema' => '',
|
||||
'enableToggle' => true,
|
||||
'questionLeftPaddingTablet' => 10,
|
||||
'questionBottomPaddingTablet' => 10,
|
||||
'questionLeftPaddingDesktop' => 10,
|
||||
'questionBottomPaddingDesktop' => 10,
|
||||
'questionLeftPaddingMobile' => 10,
|
||||
'questionBottomPaddingMobile' => 10,
|
||||
),
|
||||
),
|
||||
'wpsp/faq-child' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'FAQ - Schema Pro Child', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block helps you add single FAQ.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'question' => '',
|
||||
'answer' => '',
|
||||
'icon' => 'fas fa-plus',
|
||||
'iconActive' => 'fas fa-minus',
|
||||
'layout' => 'accordion',
|
||||
),
|
||||
),
|
||||
'wpsp/how-to' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'How-to - Schema Pro', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block allows you to design attractive How-to pages or articles with automatically adding How-to Schema to your page.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'overallAlignment' => 'left',
|
||||
'toolsCount' => 1,
|
||||
'materialCount' => 1,
|
||||
'tools' => '',
|
||||
'materials' => '',
|
||||
'showTotaltime' => false,
|
||||
'showEstcost' => false,
|
||||
'showTools' => false,
|
||||
'showMaterials' => false,
|
||||
'mainimage' => '',
|
||||
'imgSize' => 'thumbnail',
|
||||
'timeSpace' => 5,
|
||||
'costSpace' => 5,
|
||||
'time' => '30',
|
||||
'cost' => '65',
|
||||
'currencyType' => ' USD',
|
||||
'headingAlign' => 'left',
|
||||
'descriptionAlign' => 'left',
|
||||
'headingColor' => '',
|
||||
'showEstcostcolor' => '',
|
||||
'showTotaltimecolor' => '',
|
||||
'subHeadingColor' => '',
|
||||
'headingTag' => 'h3',
|
||||
'headSpace' => 15,
|
||||
'headFontFamily' => 'Default',
|
||||
'headFontWeight' => '',
|
||||
'headFontSubset' => '',
|
||||
'headFontSizeType' => 'px',
|
||||
'headLineHeightType' => 'em',
|
||||
'headFontSize' => '',
|
||||
'headFontSizeTablet' => '',
|
||||
'headFontSizeMobile' => '',
|
||||
'headLineHeight' => '',
|
||||
'headLineHeightTablet' => '',
|
||||
'headLineHeightMobile' => '',
|
||||
'subHeadFontFamily' => 'Default',
|
||||
'subHeadFontWeight' => '',
|
||||
'subHeadFontSubset' => '',
|
||||
'subHeadFontSize' => '',
|
||||
'subHeadFontSizeType' => 'px',
|
||||
'subHeadFontSizeTablet' => '',
|
||||
'subHeadFontSizeMobile' => '',
|
||||
'subHeadLineHeight' => '',
|
||||
'subHeadLineHeightType' => 'em',
|
||||
'subHeadLineHeightTablet' => '',
|
||||
'subHeadLineHeightMobile' => '',
|
||||
'separatorSpace' => 15,
|
||||
'headLoadGoogleFonts' => false,
|
||||
'subHeadLoadGoogleFonts' => false,
|
||||
'priceFontSizeType' => 'px',
|
||||
'priceFontSize' => '',
|
||||
'priceFontSizeTablet' => '',
|
||||
'priceFontSizeMobile' => '',
|
||||
'priceFontFamily' => 'Default',
|
||||
'priceFontWeight' => '',
|
||||
'priceFontSubset' => '',
|
||||
'priceLineHeightType' => 'em',
|
||||
'priceLineHeight' => '',
|
||||
'priceLineHeightTablet' => '',
|
||||
'priceLineHeightMobile' => '',
|
||||
'priceLoadGoogleFonts' => false,
|
||||
'row_gap' => 20,
|
||||
'step_gap' => 20,
|
||||
'schema' => '',
|
||||
),
|
||||
),
|
||||
'wpsp/how-to-child' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'Steps', 'wp-schema-pro' ),
|
||||
'description' => __( 'This steps box allows you to place an image along with a heading and description within a single block.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'classMigrate' => false,
|
||||
'headingAlign' => 'left',
|
||||
'headingColor' => '',
|
||||
'subHeadingColor' => '',
|
||||
'headFontSize' => '',
|
||||
'headFontSizeType' => 'px',
|
||||
'headFontSizeTablet' => '',
|
||||
'headFontSizeMobile' => '',
|
||||
'headFontFamily' => '',
|
||||
'headFontWeight' => '',
|
||||
'headFontSubset' => '',
|
||||
'headLineHeightType' => 'em',
|
||||
'headLineHeight' => '',
|
||||
'headLineHeightTablet' => '',
|
||||
'headLineHeightMobile' => '',
|
||||
'headLoadGoogleFonts' => false,
|
||||
'subHeadFontSize' => '',
|
||||
'subHeadFontSizeType' => 'px',
|
||||
'subHeadFontSizeTablet' => '',
|
||||
'subHeadFontSizeMobile' => '',
|
||||
'subHeadFontFamily' => '',
|
||||
'subHeadFontWeight' => '',
|
||||
'subHeadFontSubset' => '',
|
||||
'subHeadLineHeightType' => 'em',
|
||||
'subHeadLineHeight' => '',
|
||||
'subHeadLineHeightTablet' => '',
|
||||
'subHeadLineHeightMobile' => '',
|
||||
'subHeadLoadGoogleFonts' => false,
|
||||
'separatorWidth' => '',
|
||||
'separatorHeight' => '',
|
||||
'separatorWidthType' => '%',
|
||||
'headSpace' => '10',
|
||||
'separatorSpace' => '10',
|
||||
'subHeadSpace' => '10',
|
||||
'iconColor' => '#333',
|
||||
'iconSize' => '40',
|
||||
'iconimgPosition' => 'above-title',
|
||||
'block_id' => '',
|
||||
'iconHover' => '',
|
||||
'iconimgBorderRadius' => '0',
|
||||
'seperatorStyle' => 'solid',
|
||||
'seperatorWidth' => '30',
|
||||
'seperatorColor' => '#333',
|
||||
'seperatorThickness' => '2',
|
||||
'ctaLinkColor' => '#333',
|
||||
'ctaFontSize' => '',
|
||||
'ctaFontSizeType' => 'px',
|
||||
'ctaFontSizeMobile' => '',
|
||||
'ctaFontSizeTablet' => '',
|
||||
'ctaFontFamily' => '',
|
||||
'ctaFontWeight' => '',
|
||||
'ctaFontSubset' => '',
|
||||
'ctaLoadGoogleFonts' => false,
|
||||
'ctaBtnLinkColor' => '#333',
|
||||
'ctaBgColor' => 'transparent',
|
||||
'ctaBtnVertPadding' => '10',
|
||||
'ctaBtnHrPadding' => '14',
|
||||
'ctaBorderStyle' => 'solid',
|
||||
'ctaBorderColor' => '#333',
|
||||
'ctaBorderWidth' => '1',
|
||||
'ctaBorderRadius' => '0',
|
||||
'iconLeftMargin' => '5',
|
||||
'iconRightMargin' => '10',
|
||||
'iconTopMargin' => '5',
|
||||
'iconBottomMargin' => '5',
|
||||
'imageSize' => 'thumbnail',
|
||||
'imageWidthType' => false,
|
||||
'imageWidth' => '120',
|
||||
'seperatorSpace' => '15',
|
||||
'ctaLinkHoverColor' => '',
|
||||
'ctaBgHoverColor' => '',
|
||||
'ctaBorderhoverColor' => '',
|
||||
'ctaIconSpace' => '5',
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
return self::$block_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Block Assets.
|
||||
*
|
||||
* @since 1.13.4
|
||||
*
|
||||
* @return array The Asset List.
|
||||
*/
|
||||
public static function get_block_assets() {
|
||||
|
||||
$minify = BSF_AIOSRS_Pro_Helper::bsf_schema_pro_is_wp_debug_enable() ? 'js/faq.js' : 'min-js/faq.min.js';
|
||||
$faq_js = BSF_AIOSRS_PRO_URI . 'wpsp-blocks/assets/' . $minify;
|
||||
|
||||
if ( null === self::$block_assets ) {
|
||||
self::$block_assets = array(
|
||||
|
||||
'wpsp-faq-js' => array(
|
||||
'src' => $faq_js,
|
||||
'dep' => array(),
|
||||
'skipEditor' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
return self::$block_assets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Config.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Config' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_SP_Config.
|
||||
*/
|
||||
class BSF_SP_Config {
|
||||
|
||||
/**
|
||||
* Block Attributes
|
||||
*
|
||||
* @var block_attributes
|
||||
*/
|
||||
public static $block_attributes = null;
|
||||
|
||||
/**
|
||||
* Block Assets
|
||||
*
|
||||
* @var block_attributes
|
||||
*/
|
||||
public static $block_assets = null;
|
||||
|
||||
/**
|
||||
* Get Widget List.
|
||||
*
|
||||
* @since 0.0.1
|
||||
*
|
||||
* @return array The Widget List.
|
||||
*/
|
||||
public static function get_block_attributes() {
|
||||
|
||||
if ( null === self::$block_attributes ) {
|
||||
self::$block_attributes = array(
|
||||
'wpsp/faq' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'FAQ - Schema Pro', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block helps you add a FAQ section with inbuilt schema support.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'js_assets' => array( 'wpsp-faq-js' ),
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'layout' => 'accordion',
|
||||
'inactiveOtherItems' => true,
|
||||
'expandFirstItem' => false,
|
||||
'enableSchemaSupport' => false,
|
||||
'align' => 'left',
|
||||
'enableSeparator' => false,
|
||||
'rowsGap' => 10,
|
||||
'columnsGap' => 10,
|
||||
'boxBgColor' => '#FFFFFF',
|
||||
'boxPaddingTypeMobile' => 'px',
|
||||
'boxPaddingTypeTablet' => 'px',
|
||||
'boxPaddingTypeDesktop' => 'px',
|
||||
'vBoxPaddingMobile' => 10,
|
||||
'hBoxPaddingMobile' => 10,
|
||||
'vBoxPaddingTablet' => 10,
|
||||
'hBoxPaddingTablet' => 10,
|
||||
'vBoxPaddingDesktop' => 10,
|
||||
'hBoxPaddingDesktop' => 10,
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => 1,
|
||||
'borderRadius' => 2,
|
||||
'borderColor' => '#D2D2D2',
|
||||
'questionTextColor' => '#313131',
|
||||
'questionTextActiveColor' => '#313131',
|
||||
'questionPaddingTypeDesktop' => 'px',
|
||||
'vquestionPaddingMobile' => 10,
|
||||
'vquestionPaddingTablet' => 10,
|
||||
'vquestionPaddingDesktop' => 10,
|
||||
'hquestionPaddingMobile' => 10,
|
||||
'hquestionPaddingTablet' => 10,
|
||||
'hquestionPaddingDesktop' => 10,
|
||||
'answerTextColor' => '#313131',
|
||||
'answerPaddingTypeDesktop' => 'px',
|
||||
'vanswerPaddingMobile' => 10,
|
||||
'vanswerPaddingTablet' => 10,
|
||||
'vanswerPaddingDesktop' => 10,
|
||||
'hanswerPaddingMobile' => 10,
|
||||
'hanswerPaddingTablet' => 10,
|
||||
'hanswerPaddingDesktop' => 10,
|
||||
'iconColor' => '',
|
||||
'iconActiveColor' => '',
|
||||
'gapBtwIconQUestion' => 10,
|
||||
'questionloadGoogleFonts' => false,
|
||||
'answerloadGoogleFonts' => false,
|
||||
'questionFontFamily' => 'Default',
|
||||
'questionFontWeight' => '',
|
||||
'questionFontSubset' => '',
|
||||
'questionFontSize' => '',
|
||||
'questionFontSizeType' => 'px',
|
||||
'questionFontSizeTablet' => '',
|
||||
'questionFontSizeMobile' => '',
|
||||
'questionLineHeight' => '',
|
||||
'questionLineHeightType' => 'em',
|
||||
'questionLineHeightTablet' => '',
|
||||
'questionLineHeightMobile' => '',
|
||||
'answerFontFamily' => 'Default',
|
||||
'answerFontWeight' => '',
|
||||
'answerFontSubset' => '',
|
||||
'answerFontSize' => '',
|
||||
'answerFontSizeType' => 'px',
|
||||
'answerFontSizeTablet' => '',
|
||||
'answerFontSizeMobile' => '',
|
||||
'answerLineHeight' => '',
|
||||
'answerLineHeightType' => 'em',
|
||||
'answerLineHeightTablet' => '',
|
||||
'answerLineHeightMobile' => '',
|
||||
'icon' => 'fas fa-plus',
|
||||
'iconActive' => 'fas fa-minus',
|
||||
'iconAlign' => 'row',
|
||||
'iconSize' => 15,
|
||||
'iconSizeMobile' => 15,
|
||||
'iconSizeTablet' => 15,
|
||||
'iconSizeType' => 'px',
|
||||
'columns' => 2,
|
||||
'tcolumns' => 2,
|
||||
'mcolumns' => 1,
|
||||
'schema' => '',
|
||||
'enableToggle' => true,
|
||||
'questionLeftPaddingTablet' => 10,
|
||||
'questionBottomPaddingTablet' => 10,
|
||||
'questionLeftPaddingDesktop' => 10,
|
||||
'questionBottomPaddingDesktop' => 10,
|
||||
'questionLeftPaddingMobile' => 10,
|
||||
'questionBottomPaddingMobile' => 10,
|
||||
),
|
||||
),
|
||||
'wpsp/faq-child' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'FAQ - Schema Pro Child', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block helps you add single FAQ.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'question' => '',
|
||||
'answer' => '',
|
||||
'icon' => 'fas fa-plus',
|
||||
'iconActive' => 'fas fa-minus',
|
||||
'layout' => 'accordion',
|
||||
),
|
||||
),
|
||||
'wpsp/how-to' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'How-to - Schema Pro', 'wp-schema-pro' ),
|
||||
'description' => __( 'This block allows you to design attractive How-to pages or articles with automatically adding How-to Schema to your page.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'block_id' => '',
|
||||
'overallAlignment' => 'left',
|
||||
'toolsCount' => 1,
|
||||
'materialCount' => 1,
|
||||
'tools' => '',
|
||||
'materials' => '',
|
||||
'showTotaltime' => false,
|
||||
'showEstcost' => false,
|
||||
'showTools' => false,
|
||||
'showMaterials' => false,
|
||||
'mainimage' => '',
|
||||
'imgSize' => 'thumbnail',
|
||||
'timeSpace' => 5,
|
||||
'costSpace' => 5,
|
||||
'time' => '30',
|
||||
'cost' => '65',
|
||||
'currencyType' => ' USD',
|
||||
'headingAlign' => 'left',
|
||||
'descriptionAlign' => 'left',
|
||||
'headingColor' => '',
|
||||
'showEstcostcolor' => '',
|
||||
'showTotaltimecolor' => '',
|
||||
'subHeadingColor' => '',
|
||||
'headingTag' => 'h3',
|
||||
'headSpace' => 15,
|
||||
'headFontFamily' => 'Default',
|
||||
'headFontWeight' => '',
|
||||
'headFontSubset' => '',
|
||||
'headFontSizeType' => 'px',
|
||||
'headLineHeightType' => 'em',
|
||||
'headFontSize' => '',
|
||||
'headFontSizeTablet' => '',
|
||||
'headFontSizeMobile' => '',
|
||||
'headLineHeight' => '',
|
||||
'headLineHeightTablet' => '',
|
||||
'headLineHeightMobile' => '',
|
||||
'subHeadFontFamily' => 'Default',
|
||||
'subHeadFontWeight' => '',
|
||||
'subHeadFontSubset' => '',
|
||||
'subHeadFontSize' => '',
|
||||
'subHeadFontSizeType' => 'px',
|
||||
'subHeadFontSizeTablet' => '',
|
||||
'subHeadFontSizeMobile' => '',
|
||||
'subHeadLineHeight' => '',
|
||||
'subHeadLineHeightType' => 'em',
|
||||
'subHeadLineHeightTablet' => '',
|
||||
'subHeadLineHeightMobile' => '',
|
||||
'separatorSpace' => 15,
|
||||
'headLoadGoogleFonts' => false,
|
||||
'subHeadLoadGoogleFonts' => false,
|
||||
'priceFontSizeType' => 'px',
|
||||
'priceFontSize' => '',
|
||||
'priceFontSizeTablet' => '',
|
||||
'priceFontSizeMobile' => '',
|
||||
'priceFontFamily' => 'Default',
|
||||
'priceFontWeight' => '',
|
||||
'priceFontSubset' => '',
|
||||
'priceLineHeightType' => 'em',
|
||||
'priceLineHeight' => '',
|
||||
'priceLineHeightTablet' => '',
|
||||
'priceLineHeightMobile' => '',
|
||||
'priceLoadGoogleFonts' => false,
|
||||
'row_gap' => 20,
|
||||
'step_gap' => 20,
|
||||
'schema' => '',
|
||||
),
|
||||
),
|
||||
'wpsp/how-to-child' => array(
|
||||
'slug' => '',
|
||||
'title' => __( 'Steps', 'wp-schema-pro' ),
|
||||
'description' => __( 'This steps box allows you to place an image along with a heading and description within a single block.', 'wp-schema-pro' ),
|
||||
'default' => true,
|
||||
'attributes' => array(
|
||||
'classMigrate' => false,
|
||||
'headingAlign' => 'left',
|
||||
'headingColor' => '',
|
||||
'subHeadingColor' => '',
|
||||
'headFontSize' => '',
|
||||
'headFontSizeType' => 'px',
|
||||
'headFontSizeTablet' => '',
|
||||
'headFontSizeMobile' => '',
|
||||
'headFontFamily' => '',
|
||||
'headFontWeight' => '',
|
||||
'headFontSubset' => '',
|
||||
'headLineHeightType' => 'em',
|
||||
'headLineHeight' => '',
|
||||
'headLineHeightTablet' => '',
|
||||
'headLineHeightMobile' => '',
|
||||
'headLoadGoogleFonts' => false,
|
||||
'subHeadFontSize' => '',
|
||||
'subHeadFontSizeType' => 'px',
|
||||
'subHeadFontSizeTablet' => '',
|
||||
'subHeadFontSizeMobile' => '',
|
||||
'subHeadFontFamily' => '',
|
||||
'subHeadFontWeight' => '',
|
||||
'subHeadFontSubset' => '',
|
||||
'subHeadLineHeightType' => 'em',
|
||||
'subHeadLineHeight' => '',
|
||||
'subHeadLineHeightTablet' => '',
|
||||
'subHeadLineHeightMobile' => '',
|
||||
'subHeadLoadGoogleFonts' => false,
|
||||
'separatorWidth' => '',
|
||||
'separatorHeight' => '',
|
||||
'separatorWidthType' => '%',
|
||||
'headSpace' => '10',
|
||||
'separatorSpace' => '10',
|
||||
'subHeadSpace' => '10',
|
||||
'iconColor' => '#333',
|
||||
'iconSize' => '40',
|
||||
'iconimgPosition' => 'above-title',
|
||||
'block_id' => '',
|
||||
'iconHover' => '',
|
||||
'iconimgBorderRadius' => '0',
|
||||
'seperatorStyle' => 'solid',
|
||||
'seperatorWidth' => '30',
|
||||
'seperatorColor' => '#333',
|
||||
'seperatorThickness' => '2',
|
||||
'ctaLinkColor' => '#333',
|
||||
'ctaFontSize' => '',
|
||||
'ctaFontSizeType' => 'px',
|
||||
'ctaFontSizeMobile' => '',
|
||||
'ctaFontSizeTablet' => '',
|
||||
'ctaFontFamily' => '',
|
||||
'ctaFontWeight' => '',
|
||||
'ctaFontSubset' => '',
|
||||
'ctaLoadGoogleFonts' => false,
|
||||
'ctaBtnLinkColor' => '#333',
|
||||
'ctaBgColor' => 'transparent',
|
||||
'ctaBtnVertPadding' => '10',
|
||||
'ctaBtnHrPadding' => '14',
|
||||
'ctaBorderStyle' => 'solid',
|
||||
'ctaBorderColor' => '#333',
|
||||
'ctaBorderWidth' => '1',
|
||||
'ctaBorderRadius' => '0',
|
||||
'iconLeftMargin' => '5',
|
||||
'iconRightMargin' => '10',
|
||||
'iconTopMargin' => '5',
|
||||
'iconBottomMargin' => '5',
|
||||
'imageSize' => 'thumbnail',
|
||||
'imageWidthType' => false,
|
||||
'imageWidth' => '120',
|
||||
'seperatorSpace' => '15',
|
||||
'ctaLinkHoverColor' => '',
|
||||
'ctaBgHoverColor' => '',
|
||||
'ctaBorderhoverColor' => '',
|
||||
'ctaIconSpace' => '5',
|
||||
),
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
return self::$block_attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Block Assets.
|
||||
*
|
||||
* @since 1.13.4
|
||||
*
|
||||
* @return array The Asset List.
|
||||
*/
|
||||
public static function get_block_assets() {
|
||||
|
||||
$minify = BSF_AIOSRS_Pro_Helper::bsf_schema_pro_is_wp_debug_enable() ? 'js/faq.js' : 'min-js/faq.min.js';
|
||||
$faq_js = BSF_AIOSRS_PRO_URI . 'wpsp-blocks/assets/' . $minify;
|
||||
|
||||
if ( null === self::$block_assets ) {
|
||||
self::$block_assets = array(
|
||||
|
||||
'wpsp-faq-js' => array(
|
||||
'src' => $faq_js,
|
||||
'dep' => array(),
|
||||
'skipEditor' => true,
|
||||
),
|
||||
);
|
||||
}
|
||||
return self::$block_assets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Blocks Loader.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Loader' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_Schema_Pro_Loader.
|
||||
*/
|
||||
final class BSF_SP_Loader {
|
||||
|
||||
/**
|
||||
* Member Variable
|
||||
*
|
||||
* @var instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->wpsp_define_constants();
|
||||
|
||||
$this->wpsp_load_plugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines all constants
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public function wpsp_define_constants() {
|
||||
define( 'SP_SLUG', 'wpsp' );
|
||||
define( 'WPSP_TABLET_BREAKPOINT', '976' );
|
||||
define( 'WPSP_MOBILE_BREAKPOINT', '767' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads plugin files.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wpsp_load_plugin() {
|
||||
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-init-blocks.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-helper.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-admin-helper.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare if class 'BSF_SP_Loader' exist.
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
|
||||
}
|
||||
BSF_SP_Loader::get_instance();
|
||||
}
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Schema Pro Blocks Loader.
|
||||
*
|
||||
* @package Schema Pro
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'BSF_SP_Loader' ) ) {
|
||||
|
||||
/**
|
||||
* Class BSF_Schema_Pro_Loader.
|
||||
*/
|
||||
final class BSF_SP_Loader {
|
||||
|
||||
/**
|
||||
* Member Variable
|
||||
*
|
||||
* @var instance
|
||||
*/
|
||||
private static $instance;
|
||||
|
||||
/**
|
||||
* Initiator
|
||||
*/
|
||||
public static function get_instance() {
|
||||
if ( ! isset( self::$instance ) ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
$this->wpsp_define_constants();
|
||||
|
||||
$this->wpsp_load_plugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines all constants
|
||||
*
|
||||
* @since 2.2.0
|
||||
*/
|
||||
public function wpsp_define_constants() {
|
||||
define( 'SP_SLUG', 'wpsp' );
|
||||
define( 'WPSP_TABLET_BREAKPOINT', '976' );
|
||||
define( 'WPSP_MOBILE_BREAKPOINT', '767' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads plugin files.
|
||||
*
|
||||
* @since 2.2.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function wpsp_load_plugin() {
|
||||
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-init-blocks.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-helper.php';
|
||||
require_once BSF_AIOSRS_PRO_DIR . 'wpsp-blocks/classes/class-bsf-sp-admin-helper.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare if class 'BSF_SP_Loader' exist.
|
||||
* Kicking this off by calling 'get_instance()' method
|
||||
*/
|
||||
|
||||
}
|
||||
BSF_SP_Loader::get_instance();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user