first commit

This commit is contained in:
CHIEFSOFT\ameye
2023-11-30 13:20:54 -05:00
commit e9e5c0546c
5833 changed files with 1801865 additions and 0 deletions
@@ -0,0 +1,52 @@
=== Absolute Reviews ===
Tags: reviews, rating, review, schema.org
Requires at least: 4.0
Tested up to: 6.0
Requires PHP: 5.4
Stable tag: 1.1.1
Contributors: codesupplyco
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
== Description ==
Add beautiful responsive and modern review boxes with valid JSON-LD schema to your posts with the “Advanced Reviews” plugin.
== Changelog ==
= 1.1.1 =
* Added schema attributes to Review Block
= 1.1.0 =
* Added compatibility with WordPress 5.9
= 1.0.9 =
* Improved plugin security.
= 1.0.8 =
* Improved the display of the panel in the admin
= 1.0.7 =
* Compatibility fixes for WordPress 5.5
= 1.0.6 =
* Improved google scheme.
* Improved posts location.
= 1.0.5 =
* Added support Post Views Counter.
= 1.0.4 =
* Minor improvements.
= 1.0.3 =
* Added css variables to styles.
= 1.0.2 =
* Improve indicators.
= 1.0.1 =
* Initial release.
= 1.0 =
* Initial release.
@@ -0,0 +1,65 @@
<?php
/**
* Plugin Name: Absolute Reviews
* Description: Add beautiful responsive and modern review boxes with valid JSON-LD schema to your posts with the "Advanced Reviews" plugin.
* Version: 1.1.1
* Author: Code Supply Co.
* Author URI: https://codesupply.co
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: absolute-reviews
* Domain Path: /languages
*
* @link https://codesupply.co
* @package ABR
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Variables
*/
define( 'ABR_URL', plugin_dir_url( __FILE__ ) );
define( 'ABR_PATH', plugin_dir_path( __FILE__ ) );
/**
* Plugin Activation.
*/
function abr_activation() {
do_action( 'abr_activation' );
}
register_activation_hook( __FILE__, 'abr_activation' );
/**
* Plugin Deactivation.
*/
function abr_deactivation() {
do_action( 'abr_deactivation' );
}
register_deactivation_hook( __FILE__, 'abr_deactivation' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-absolute-reviews.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function abr_init() {
$plugin = new ABR();
$plugin->run();
}
abr_init();
@@ -0,0 +1,922 @@
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package ABR
* @subpackage ABR/admin
*/
class ABR_Admin {
/**
* The ID of this plugin.
* @access private
* @var string $abr The ID of this plugin.
*/
private $abr;
/**
* The version of this plugin.
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @param string $abr The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $abr, $version ) {
$this->abr = $abr;
$this->version = $version;
}
/**
* Register admin page
*
* @since 1.0.0
*/
public function register_options_page() {
add_options_page( esc_html__( 'Reviews', 'absolute-reviews' ), esc_html__( 'Reviews', 'absolute-reviews' ), 'manage_options', 'absolute-reviews', array( $this, 'build_options_page' ) );
}
/**
* Build admin page
*
* @since 1.0.0
*/
public function build_options_page() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'You do not have sufficient rights to view this page.', 'absolute-reviews' ) );
}
$indicators = abr_default_indicators();
$this->save_options_page();
?>
<div class="wrap abr-wrap">
<h2><?php esc_html_e( 'Reviews Settings', 'absolute-reviews' ); ?></h2>
<div class="abr-settings">
<form method="post">
<h3><?php esc_html_e( 'Indicators of the progress bar', 'absolute-reviews' ); ?></h3>
<table class="form-table">
<tbody>
<?php
for ( $index = 1; $index <= 10; $index++ ) {
?>
<tr>
<th scope="row">
<label for="abr_review_indicator_label_<?php echo esc_attr( $index ); ?>"><?php esc_html_e( 'Indicator', 'absolute-reviews' ); ?> <?php echo esc_attr( $index ); ?></label>
<p class="description"><?php esc_html_e( 'Default:', 'absolute-reviews' ); ?> <?php echo esc_html( $indicators[ $index ]['name'] ); ?></p>
</th>
<td>
<input class="regular-text" id="abr_review_indicator_label_<?php echo esc_attr( $index ); ?>" placeholder="<?php esc_html_e( 'Label', 'absolute-reviews' ); ?>" name="abr_review_indicator_label_<?php echo esc_attr( $index ); ?>" type="text" value="<?php echo esc_attr( get_option( "abr_review_indicator_label_{$index}", $indicators[ $index ]['name'] ) ); ?>"><br>
</td>
</tr>
<?php } ?>
<tr>
<th scope="row">
<label for="abr_review_disable_indicators"><?php esc_html_e( 'Disable all indicators on the front end', 'absolute-reviews' ); ?></label>
</th>
<td>
<input class="regular-text" id="abr_review_disable_indicators" name="abr_review_disable_indicators[]" type="checkbox" value="true" <?php checked( (bool) get_option( 'abr_review_disable_indicators', false ) ); ?>>
</td>
</tr>
</tbody>
</table>
<h3><?php esc_html_e( 'Supported Post Types', 'absolute-reviews' ); ?></h3>
<table class="form-table">
<tbody>
<tr>
<th scope="row">
<label for="abr_review_post_types"><?php esc_html_e( 'Enable reviews for the following post types', 'absolute-reviews' ); ?></label>
</th>
<td>
<?php
$post_types = get_post_types(
array(
'publicly_queryable' => 1,
'_builtin' => false,
)
);
unset( $post_types['attachment'] );
// Merge post types.
$post_types = array_merge( abr_default_post_types(), $post_types );
// Get types of option.
$option_types = get_option( 'abr_review_post_types', abr_default_post_types() );
foreach ( $post_types as $post_type ) {
?>
<p>
<label><input class="regular-text" id="abr_review_post_types" name="abr_review_post_types[]" type="checkbox" value="<?php echo esc_attr( $post_type ); ?>" <?php echo in_array( $post_type, $option_types, true ) ? 'checked' : ''; ?>> <?php echo esc_html( $post_type ); ?></label>
</p>
<?php
}
?>
</td>
</tr>
</tbody>
</table>
<?php wp_nonce_field(); ?>
<p class="submit"><input class="button button-primary" name="save_settings" type="submit" value="<?php esc_html_e( 'Save changes', 'absolute-reviews' ); ?>" /></p>
</form>
</div>
</div>
<?php
}
/**
* Settings save
*
* @since 1.0.0
*/
protected function save_options_page() {
if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'] ) ) { // Input var ok; sanitization ok.
return;
}
if ( isset( $_POST['save_settings'] ) ) { // Input var ok.
for ( $index = 1; $index <= 10; $index++ ) {
if ( isset( $_POST[ 'abr_review_indicator_label_' . $index ] ) ) { // Input var ok.
update_option( "abr_review_indicator_label_{$index}", sanitize_text_field( wp_unslash( $_POST[ 'abr_review_indicator_label_' . $index ] ) ) ); // Input var ok.
}
}
if ( isset( $_POST['abr_review_post_types'] ) ) { // Input var ok; sanitization ok.
$post_types = is_array( $_POST['abr_review_post_types'] ) ? $_POST['abr_review_post_types'] : array(); // Input var ok; sanitization ok.
update_option( 'abr_review_post_types', array_map( 'sanitize_text_field', $post_types ) );
} else {
update_option( 'abr_review_post_types', array() );
}
if ( isset( $_POST['abr_review_disable_indicators'] ) ) { // Input var ok.
update_option( 'abr_review_disable_indicators', true );
} else {
update_option( 'abr_review_disable_indicators', false );
}
printf( '<div id="message" class="updated fade"><p><strong>%s</strong></p></div>', esc_html__( 'Settings saved.', 'absolute-reviews' ) );
}
}
/**
* Addd new Meta Box for Review.
*/
public function metabox_review_register() {
// Get types of option.
$option_types = get_option( 'abr_review_post_types', abr_default_post_types() );
if ( $option_types ) {
add_meta_box( 'abr_review_metabox', esc_html__( 'Review Options', 'absolute-reviews' ), array( $this, 'metabox_review_callback' ), $option_types, 'normal', 'high', null );
}
}
/**
* Callback for Review Meta Box.
*
* @param object $post Object of post.
*/
public function metabox_review_callback( $post ) {
$review_settings = abr_get_post_metadata( $post->ID, '_abr_review_settings', true );
$review_heading = abr_get_post_metadata( $post->ID, '_abr_review_heading', true );
$review_desc = abr_get_post_metadata( $post->ID, '_abr_review_desc', true );
$review_legend = abr_get_post_metadata( $post->ID, '_abr_review_legend', true );
$review_type = abr_get_post_metadata( $post->ID, '_abr_review_type', true, 'percentage' );
$review_items = abr_get_post_metadata( $post->ID, '_abr_review_items', true, array() );
$review_main_scale = abr_get_post_metadata( $post->ID, '_abr_review_main_scale', true, true );
$review_auto_score = abr_get_post_metadata( $post->ID, '_abr_review_auto_score', true, true );
$review_total_score = abr_get_post_metadata( $post->ID, '_abr_review_total_score', true );
$review_pros_heading = abr_get_post_metadata( $post->ID, '_abr_review_pros_heading', true );
$review_pros_items = abr_get_post_metadata( $post->ID, '_abr_review_pros_items', true, array() );
$review_cons_heading = abr_get_post_metadata( $post->ID, '_abr_review_cons_heading', true );
$review_cons_items = abr_get_post_metadata( $post->ID, '_abr_review_cons_items', true, array() );
$review_schema_heading = abr_get_post_metadata( $post->ID, '_abr_review_schema_heading', true );
$review_schema_desc = abr_get_post_metadata( $post->ID, '_abr_review_schema_desc', true );
$review_schema_author = abr_get_post_metadata( $post->ID, '_abr_review_schema_author', true );
$review_schema_author_custom = abr_get_post_metadata( $post->ID, '_abr_review_schema_author_custom', true );
?>
<div class="abr-metabox-wrap review-wrap">
<input type="hidden" name="abr_review_action" value="1">
<?php wp_nonce_field( 'abr_review_meta_nonce', 'abr_review_meta_nonce' ); ?>
<div class="abr-metabox-switcher">
<input class="abr-metabox-checkbox" type="checkbox" name="abr_review_settings" value="1" <?php checked( $review_settings ); ?>>
<div class="abr-metabox-switch">
<span class="abr-metabox-switch-on"></span>
<span class="abr-metabox-switch-off"></span>
<span class="abr-metabox-switch-slider"></span>
</div>
<?php esc_html_e( 'Enable Review', 'absolute-reviews' ); ?>
</div>
<div class="abr-metabox-tabs" <?php checked( $review_settings ); ?>>
<ul class="abr-metabox-tabs-navigation">
<li><a href="#review-tab-general"><?php esc_html_e( 'General', 'absolute-reviews' ); ?></a></li>
<li><a href="#review-tab-criteria"><?php esc_html_e( 'Criteria', 'absolute-reviews' ); ?></a></li>
<li><a href="#review-tab-pros-cons"><?php esc_html_e( 'Pros / Cons', 'absolute-reviews' ); ?></a></li>
<li><a href="#review-tab-scheme"><?php esc_html_e( 'Schema Attributes', 'absolute-reviews' ); ?></a></li>
</ul>
<div class="abr-metabox-tabs-content">
<div id="review-tab-general">
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_heading"><?php esc_html_e( 'Heading', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_heading" name="abr_review_heading" value="<?php echo esc_attr( $review_heading ); ?>" />
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_desc"><?php esc_html_e( 'Description', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<textarea id="abr_review_desc" name="abr_review_desc" rows="6"><?php echo esc_html( $review_desc ); ?></textarea>
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_legend"><?php esc_html_e( 'Legend', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<textarea id="abr_review_legend" name="abr_review_legend" rows="3"><?php echo wp_kses_post( $review_legend ); ?></textarea>
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_type"><?php esc_html_e( 'Type', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<select id="abr_review_type" name="abr_review_type">
<option value="percentage" <?php selected( $review_type, 'percentage' ); ?>><?php esc_html_e( 'Percentage (1-100%)', 'absolute-reviews' ); ?></option>
<option value="point-5" <?php selected( $review_type, 'point-5' ); ?>><?php esc_html_e( 'Points (1-5)', 'absolute-reviews' ); ?></option>
<option value="point-10" <?php selected( $review_type, 'point-10' ); ?>><?php esc_html_e( 'Points (1-10)', 'absolute-reviews' ); ?></option>
<option value="star" <?php selected( $review_type, 'star' ); ?>><?php esc_html_e( 'Stars (1-5)', 'absolute-reviews' ); ?></option>
</select>
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_main_scale"><?php esc_html_e( 'Main Scale', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<label><input type="checkbox" id="abr_review_main_scale" name="abr_review_main_scale" value="1" <?php checked( $review_main_scale ); ?>></label>
</div>
</div>
<div class="abr-metabox-field review-field-auto-score">
<div class="abr-metabox-label">
<label for="abr_review_auto_score"><?php esc_html_e( 'Auto Сalculate Total Score', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<label><input type="checkbox" id="abr_review_auto_score" name="abr_review_auto_score" value="1" <?php checked( $review_auto_score ); ?>></label>
</div>
</div>
<div class="abr-metabox-field review-field-total-score" <?php checked( $review_auto_score ); ?>>
<div class="abr-metabox-label">
<label for="abr_review_total_score"><?php esc_html_e( 'Total Score', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_total_score" name="abr_review_total_score" value="<?php echo esc_attr( $review_total_score ); ?>" />
</div>
</div>
</div>
<div id="review-tab-criteria">
<div class="abr-metabox-repeater">
<table class="abr-metabox-repeater-table">
<tbody>
<tr class="row hidden">
<td>
<div class="row-content">
<div class="row-topbar">
<a href="#" class="btn-remove-row delete"><?php esc_html_e( 'Remove', 'absolute-reviews' ); ?></a>
<div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'absolute-reviews' ); ?>"></div>
<strong class="signature"><span><?php echo esc_html__( 'Criterion', 'absolute-reviews' ); ?></span></strong>
</div>
<div class="row-fields">
<div class="row-body review-field-grid">
<p class="review-field-criterion-name">
<label><?php esc_html_e( 'Name', 'absolute-reviews' ); ?>:<br>
<input disabled type="text" class="attribute-name" name="abr_review_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Criterion', 'absolute-reviews' ); ?>"></label>
</p>
<p class="review-field-criterion-number">
<label><?php esc_html_e( 'Value', 'absolute-reviews' ); ?>:<br>
<input disabled type="number" name="abr_review_items[val][]" min="0" step="1"></label>
</p>
<p class="review-field-criterion-desc">
<label><?php esc_html_e( 'Description', 'absolute-reviews' ); ?>:<br>
<textarea disabled name="abr_review_items[desc][]" placeholder="<?php esc_html_e( 'Description', 'absolute-reviews' ); ?>" row="4"></textarea>
</label>
</p>
</div>
</div>
</div>
</td>
</tr>
<?php
if ( isset( $review_items['name'] ) && $review_items['name'] ) {
foreach ( $review_items['name'] as $key => $name ) {
?>
<tr class="row">
<td>
<div class="row-content">
<div class="row-topbar closed">
<a href="#" class="btn-remove-row delete"><?php esc_html_e( 'Remove', 'absolute-reviews' ); ?></a>
<div class="handlediv" title="<?php esc_html_e( 'Click to toggle', 'absolute-reviews' ); ?>"></div>
<strong class="signature"><?php echo (string) $review_items['name'][ $key ] ? esc_html( $review_items['name'][ $key ] ) : '<span>' . esc_html__( 'Criterion', 'absolute-reviews' ) . '</span>'; ?></strong>
</div>
<div class="row-fields" style="display:none">
<div class="row-body review-field-grid">
<p class="review-field-criterion-name">
<label><?php esc_html_e( 'Name', 'absolute-reviews' ); ?>:<br>
<input type="text" class="attribute-name" name="abr_review_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Criterion', 'absolute-reviews' ); ?>" value="<?php echo esc_attr( $review_items['name'][ $key ] ); ?>"></label>
</p>
<p class="review-field-criterion-number">
<label><?php esc_html_e( 'Value', 'absolute-reviews' ); ?>:<br>
<input type="number" name="abr_review_items[val][]" value="<?php echo esc_attr( $review_items['val'][ $key ] ); ?>" min="0" step="1"></label>
</p>
<p class="review-field-criterion-desc">
<label><?php esc_html_e( 'Description', 'absolute-reviews' ); ?>:<br>
<textarea name="abr_review_items[desc][]" placeholder="<?php esc_html_e( 'Description', 'absolute-reviews' ); ?>" row="4"><?php echo esc_attr( $review_items['desc'][ $key ] ); ?></textarea>
</label>
</p>
</div>
</div>
</div>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<a class="btn-add-row button button-primary" href="#" data-event="btn-add-row"><?php esc_html_e( 'Add new criterion', 'absolute-reviews' ); ?></a>
</div>
</div>
<div id="review-tab-pros-cons">
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_pros_heading"><?php esc_html_e( 'Pros Heading', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_pros_heading" name="abr_review_pros_heading" placeholder="<?php esc_html_e( 'The Good', 'absolute-reviews' ); ?>" value="<?php echo esc_attr( $review_pros_heading ); ?>" />
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_pros_heading"><?php esc_html_e( 'Pros List', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<div class="abr-metabox-repeater">
<table class="abr-metabox-repeater-table review-repeater-simple">
<tbody>
<tr class="row hidden">
<td>
<div class="row-content">
<div class="row-fields">
<div class="row-body">
<div class="row-handle">
<span class="dashicons dashicons-menu-alt"></span>
</div>
<input disabled type="text" class="attribute-name" name="abr_review_pros_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Item', 'absolute-reviews' ); ?>">
<a href="#" class="btn-remove-row delete">
<span class="dashicons dashicons-no-alt"></span>
</a>
</div>
</div>
</div>
</td>
</tr>
<?php
if ( isset( $review_pros_items['name'] ) && $review_pros_items['name'] ) {
foreach ( $review_pros_items['name'] as $key => $name ) {
?>
<tr class="row">
<td>
<div class="row-content">
<div class="row-fields">
<div class="row-body">
<div class="row-handle">
<span class="dashicons dashicons-menu-alt"></span>
</div>
<input type="text" class="attribute-name" name="abr_review_pros_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Item', 'absolute-reviews' ); ?>" value="<?php echo esc_attr( $review_pros_items['name'][ $key ] ); ?>"></label>
<a href="#" class="btn-remove-row delete">
<span class="dashicons dashicons-no-alt"></span>
</a>
</div>
</div>
</div>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<a class="btn-add-row button button-primary" href="#" data-event="btn-add-row"><?php esc_html_e( 'Add new pros item', 'absolute-reviews' ); ?></a>
</div>
</div>
</div>
<br><hr><br>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_cons_heading"><?php esc_html_e( 'Cons Heading', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_cons_heading" name="abr_review_cons_heading" placeholder="<?php esc_html_e( 'The Bad', 'absolute-reviews' ); ?>" value="<?php echo esc_attr( $review_cons_heading ); ?>" />
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_cons_heading"><?php esc_html_e( 'Cons List', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<div class="abr-metabox-repeater">
<table class="abr-metabox-repeater-table review-repeater-simple">
<tbody>
<tr class="row hidden">
<td>
<div class="row-content">
<div class="row-fields">
<div class="row-body">
<div class="row-handle">
<span class="dashicons dashicons-menu-alt"></span>
</div>
<input disabled type="text" class="attribute-name" name="abr_review_cons_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Item', 'absolute-reviews' ); ?>">
<a href="#" class="btn-remove-row delete">
<span class="dashicons dashicons-no-alt"></span>
</a>
</div>
</div>
</div>
</td>
</tr>
<?php
if ( isset( $review_cons_items['name'] ) && $review_cons_items['name'] ) {
foreach ( $review_cons_items['name'] as $key => $name ) {
?>
<tr class="row">
<td>
<div class="row-content">
<div class="row-fields">
<div class="row-body">
<div class="row-handle">
<span class="dashicons dashicons-menu-alt"></span>
</div>
<input type="text" class="attribute-name" name="abr_review_cons_items[name][]" placeholder="<?php esc_html_e( 'Name', 'absolute-reviews' ); ?>" data-label="<?php esc_html_e( 'Item', 'absolute-reviews' ); ?>" value="<?php echo esc_attr( $review_cons_items['name'][ $key ] ); ?>"></label>
<a href="#" class="btn-remove-row delete">
<span class="dashicons dashicons-no-alt"></span>
</a>
</div>
</div>
</div>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<a class="btn-add-row button button-primary" href="#" data-event="btn-add-row"><?php esc_html_e( 'Add new cons item', 'absolute-reviews' ); ?></a>
</div>
</div>
</div>
</div>
<div id="review-tab-scheme">
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_schema_heading"><?php esc_html_e( 'Item Reviewed', 'absolute-reviews' ); ?></label>
<p class="description"><?php esc_html_e( 'Heading will be used if blank.', 'absolute-reviews' ); ?></p>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_schema_heading" name="abr_review_schema_heading" value="<?php echo esc_attr( $review_schema_heading ); ?>" />
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_schema_desc"><?php esc_html_e( 'Review Text', 'absolute-reviews' ); ?></label>
<p class="description"><?php esc_html_e( 'Description will be used if blank.', 'absolute-reviews' ); ?></p>
</div>
<div class="abr-metabox-input">
<textarea id="abr_review_schema_desc" name="abr_review_schema_desc" rows="6"><?php echo esc_html( $review_schema_desc ); ?></textarea>
</div>
</div>
<div class="abr-metabox-field">
<div class="abr-metabox-label">
<label for="abr_review_schema_author"><?php esc_html_e( 'Review Author', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<select id="abr_review_schema_author" name="abr_review_schema_author">
<?php
$user = get_userdata( $post->post_author );
if ( $user->user_login ) {
?>
<option value="<?php echo esc_attr( $user->user_login ); ?>" <?php selected( $review_schema_author, $user->user_login ); ?>>
<?php echo esc_html( $user->user_login ); ?>
</option>
<?php
}
if ( $user->first_name ) {
?>
<option value="<?php echo esc_attr( $user->first_name ); ?>" <?php selected( $review_schema_author, $user->first_name ); ?>>
<?php echo esc_html( $user->first_name ); ?>
</option>
<?php
}
if ( $user->last_name ) {
?>
<option value="<?php echo esc_attr( $user->last_name ); ?>" <?php selected( $review_schema_author, $user->last_name ); ?>>
<?php echo esc_html( $user->last_name ); ?>
</option>
<?php
}
if ( $user->first_name && $user->last_name ) {
$user_var_once = $user->first_name . ' ' . $user->last_name;
$user_var_second = $user->last_name . ' ' . $user->first_name;
?>
<option value="<?php echo esc_attr( $user_var_once ); ?>" <?php selected( $review_schema_author, $user_var_once ); ?>>
<?php echo esc_html( $user_var_once ); ?>
</option>
<option value="<?php echo esc_attr( $user_var_second ); ?>" <?php selected( $review_schema_author, $user_var_second ); ?>>
<?php echo esc_html( $user_var_second ); ?>
</option>
<?php
}
?>
<option value="custom" <?php selected( $review_schema_author, 'custom' ); ?>><?php esc_html_e( 'Custom', 'absolute-reviews' ); ?></option>
</select>
</div>
</div>
<div class="abr-metabox-field review-field-schema-author-custom" <?php checked( $review_schema_author, 'custom' ); ?>">
<div class="abr-metabox-label">
<label for="abr_review_schema_author_custom"><?php esc_html_e( 'Custom Author', 'absolute-reviews' ); ?></label>
</div>
<div class="abr-metabox-input">
<input type="text" id="abr_review_schema_author_custom" name="abr_review_schema_author_custom" value="<?php echo esc_attr( $review_schema_author_custom ); ?>" />
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
/**
* Save meta tags by post
*
* @param int $post_id Post ID.
* @param object $post Post Object.
*/
public function metabox_review_save( $post_id, $post ) {
// Break if doing autosave.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Break if current user can't edit this post.
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
// Break if this post revision.
if ( wp_is_post_revision( $post_id ) ) {
return;
}
if ( ! isset( $_POST['abr_review_meta_nonce'] ) || ! wp_verify_nonce( $_POST['abr_review_meta_nonce'], 'abr_review_meta_nonce' ) ) { // Input var ok; sanitization ok.
return;
}
if ( ! isset( $_POST['abr_review_action'] ) || 1 !== (int) $_POST['abr_review_action'] ) { // Input var ok; sanitization ok.
return;
}
if ( isset( $_POST['abr_review_settings'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_settings', 1 );
} else {
update_post_meta( $post_id, '_abr_review_settings', '' );
}
// Check Switch Metabox.
if ( isset( $_POST['abr_review_settings'] ) ) { // Input var ok; sanitization ok.
$review_type = null;
$review_items = null;
if ( isset( $_POST['abr_review_heading'] ) ) {
$review_heading = sanitize_text_field( $_POST['abr_review_heading'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_heading', $review_heading );
}
if ( isset( $_POST['abr_review_type'] ) ) {
$review_type = sanitize_text_field( $_POST['abr_review_type'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_type', $review_type );
}
if ( isset( $_POST['abr_review_items'] ) ) { // Input var ok; sanitization ok.
$review_items = map_deep( $_POST['abr_review_items'], 'sanitize_text_field' ); // Input var ok; sanitization ok.
if ( isset( $_POST['abr_review_type'] ) && isset( $review_items['val'] ) ) { // Input var ok; sanitization ok.
switch ( $_POST['abr_review_type'] ) { // Input var ok; sanitization ok.
case 'percentage':
$max = '100';
break;
case 'point-5':
$max = '5';
break;
case 'point-10':
$max = '10';
break;
case 'star':
$max = '5';
break;
}
if ( $review_items['val'] ) {
foreach ( $review_items['val'] as $key => $value ) {
if ( $value > $max ) {
$review_items['val'][ $key ] = $max;
}
}
}
}
update_post_meta( $post_id, '_abr_review_items', $review_items );
} else {
update_post_meta( $post_id, '_abr_review_items', array() );
}
if ( isset( $_POST['abr_review_main_scale'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_main_scale', 1 );
} else {
update_post_meta( $post_id, '_abr_review_main_scale', '' );
}
if ( isset( $_POST['abr_review_auto_score'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_auto_score', 1 );
} else {
update_post_meta( $post_id, '_abr_review_auto_score', '' );
}
if ( isset( $_POST['abr_review_total_score'] ) ) {
$review_total_score = sanitize_text_field( $_POST['abr_review_total_score'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_total_score', $review_total_score );
}
if ( isset( $_POST['abr_review_desc'] ) ) { // Input var ok; sanitization ok.
$review_desc = sanitize_text_field( $_POST['abr_review_desc'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_desc', $review_desc );
}
if ( isset( $_POST['abr_review_pros_heading'] ) ) {
$review_pros_heading = sanitize_text_field( $_POST['abr_review_pros_heading'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_pros_heading', $review_pros_heading );
}
if ( isset( $_POST['abr_review_pros_items'] ) ) { // Input var ok; sanitization ok.
$review_pros_items = map_deep( $_POST['abr_review_pros_items'], 'sanitize_text_field' ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_pros_items', $review_pros_items );
} else {
update_post_meta( $post_id, '_abr_review_pros_items', array() );
}
if ( isset( $_POST['abr_review_cons_heading'] ) ) {
$review_cons_heading = sanitize_text_field( $_POST['abr_review_cons_heading'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_cons_heading', $review_cons_heading );
}
if ( isset( $_POST['abr_review_cons_items'] ) ) { // Input var ok; sanitization ok.
$review_cons_items = map_deep( $_POST['abr_review_cons_items'], 'sanitize_text_field' ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_cons_items', $review_cons_items );
} else {
update_post_meta( $post_id, '_abr_review_cons_items', array() );
}
if ( isset( $_POST['abr_review_legend'] ) ) { // Input var ok; sanitization ok.
$review_legend = sanitize_text_field( $_POST['abr_review_legend'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_legend', $review_legend );
}
if ( isset( $_POST['abr_review_schema_heading'] ) ) {
$review_schema_heading = sanitize_text_field( $_POST['abr_review_schema_heading'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_schema_heading', $review_schema_heading );
}
if ( isset( $_POST['abr_review_schema_desc'] ) ) {
$review_schema_desc = sanitize_text_field( $_POST['abr_review_schema_desc'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_schema_desc', $review_schema_desc );
}
if ( isset( $_POST['abr_review_schema_author'] ) ) {
$review_schema_author = sanitize_text_field( $_POST['abr_review_schema_author'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_schema_author', $review_schema_author );
}
if ( isset( $_POST['abr_review_schema_author_custom'] ) ) {
$review_schema_author_custom = sanitize_text_field( $_POST['abr_review_schema_author_custom'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_abr_review_schema_author_custom', $review_schema_author_custom );
}
// Review total score.
$total_score = (float) $this->calc_review_total_score( $post_id, $review_type, $review_items );
/* ------------------------ */
// Save total score number.
$review_type = abr_get_post_metadata( $post_id, '_abr_review_type', true, 'percentage' );
$review_auto_score = abr_get_post_metadata( $post_id, '_abr_review_auto_score', true, true );
if ( empty( $review_auto_score ) ) {
$total_score = (float) abr_get_post_metadata( $post_id, '_abr_review_total_score', true );
}
// Vars.
switch ( $review_type ) {
case 'percentage':
$max = 100;
break;
case 'point-5':
$max = 5;
break;
case 'point-10':
$max = 10;
break;
case 'star':
$max = 5;
break;
}
// Validate value.
switch ( $review_type ) {
case 'percentage':
case 'point-5':
case 'point-10':
$total_score = ( $total_score <= $max ) ? round( $total_score ) : $max;
break;
case 'star':
$total_score = ( $total_score <= $max ) ? round( $total_score, 1 ) : $max;
break;
}
update_post_meta( $post_id, '_abr_review_total_score_number', (float) $total_score );
}
}
/**
* Calc Total Score
*
* @param int $post_id Post ID.
* @param string $review_type Type of review.
* @param array $review_items Array list items.
*/
public function calc_review_total_score( $post_id, $review_type, $review_items ) {
/* Review Type */
if ( $review_type ) {
/* Set Score */
switch ( $review_type ) {
case 'star':
$stars_count = 5;
break;
case 'point-5':
$points_count = 5;
break;
case 'point-10':
$points_count = 10;
break;
}
if ( isset( $review_items['name'] ) && $review_items['name'] ) {
$average = 0;
$review_items_count = 0;
foreach ( $review_items['name'] as $key => $item_name ) {
if ( ! $item_name ) {
continue;
}
$item_value = floatval( $review_items['val'][ $key ] );
/* Get Item Value */
switch ( $review_type ) {
case 'star':
$item_value = ( $item_value <= $stars_count ) ? $item_value : $stars_count;
break;
case 'point-5':
case 'point-10':
$item_value = ( $item_value <= $points_count ) ? $item_value : $points_count;
break;
}
$review_items_count++;
$average += floatval( $item_value );
}
if ( $average > 0 ) {
$average = $average / $review_items_count;
$average = round( $average, 1 );
}
return $average;
}
}
}
/**
* Register the stylesheets and JavaScript for the admin area.
*
* @param string $page Current page.
*/
public function admin_enqueue_scripts( $page ) {
// Styles.
wp_enqueue_style( $this->abr, abr_style( plugin_dir_url( __FILE__ ) . 'css/absolute-reviews-admin.css' ), array(), $this->version, 'all' );
if ( in_array( $page, array( 'post.php', 'post-new.php' ), true ) ) {
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-tabs' );
// Scripts.
wp_enqueue_script( $this->abr, plugin_dir_url( __FILE__ ) . 'js/absolute-reviews-admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-sortable' ), $this->version, false );
}
}
}
@@ -0,0 +1,547 @@
/**
* All of the CSS for your admin-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'absolute-reviews-icons';
src: url("../../fonts/absolute-reviews-icons.woff") format("woff"), url("../../fonts/absolute-reviews-icons.ttf") format("truetype"), url("../../fonts/absolute-reviews-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="abr-icon-"],
[class*=" abr-icon-"] {
font-family: 'absolute-reviews-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.abr-icon-comment:before {
content: "\e905";
}
.abr-icon-eye:before {
content: "\e903";
}
.abr-icon-watch:before {
content: "\e904";
}
.abr-icon-funds-fill:before {
content: "\e902";
}
.abr-icon-x:before {
content: "\e901";
}
.abr-icon-check:before {
content: "\e900";
}
.abr-icon-star-half:before {
content: "\e938";
}
.abr-icon-star-full:before {
content: "\e939";
}
.abr-icon-star-empty:before {
content: "\e93a";
}
/*--------------------------------------------------------------*/
/* Basic -------------------------------------------------------------- */
.abr-metabox-wrap .abr-metabox-tabs {
background: none;
border: none;
display: flex;
margin: 0;
padding: 0;
border-radius: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation {
display: flex;
flex-direction: column;
border: none;
border-left: 1px solid #eee;
background: #FAFAFA;
flex: 0 0 200px;
margin: 0;
padding: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation:before {
display: none;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li {
display: block;
background: transparent;
border: none;
margin: 0;
padding: 0;
float: none;
outline: none;
box-shadow: none;
border-radius: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li a {
border: none;
border-bottom: 1px solid #eee;
position: relative;
display: block;
font-size: 0.8125rem;
line-height: 1.25rem;
padding: 0.625rem;
text-decoration: none;
outline: none;
box-shadow: none;
color: #0073aa;
float: none;
cursor: pointer;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li a:hover {
color: #00a0d2;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li.ui-tabs-active {
margin: 0;
padding: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li.ui-tabs-active a {
background-color: #eee;
color: #555;
cursor: pointer;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-content {
flex-grow: 1;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-content .ui-tabs-panel {
padding: 0;
border-radius: 0;
}
@media screen and (max-width: 768px) {
.abr-metabox-wrap .abr-metabox-tabs {
flex-direction: column;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation {
flex: 0 0 100%;
}
}
.abr-metabox-wrap .abr-metabox-field {
display: flex;
position: relative;
flex-direction: column;
}
.abr-metabox-wrap .abr-metabox-field:last-child {
border-bottom: none;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label {
position: relative;
flex: 0 0 100%;
float: none;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label label {
display: block;
font-size: 14px;
line-height: 1.4em;
margin: 0 0 3px;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input {
position: relative;
flex: 0 0 100%;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="number"],
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="text"],
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input select,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input textarea {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="number"].short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="text"].short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input select.short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input textarea.short {
max-width: 100px;
}
@media (min-width: 1200px) {
.abr-metabox-wrap .abr-metabox-field {
flex-direction: row;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label {
flex: 0 0 20%;
padding: 1rem 1.25rem;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input {
flex: 0 0 80%;
padding: 1rem 1.25rem;
}
}
.abr-metabox-wrap .abr-metabox-switcher {
display: flex;
position: absolute;
top: -2rem;
left: 1rem;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch {
border: 2px solid #555d66;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: flex;
height: 1.75rem;
height: 18px;
padding: 0;
position: relative;
vertical-align: middle;
width: 36px;
margin-left: 0.5rem;
border-radius: 9px;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-on {
position: absolute;
top: 2px;
right: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0s ease 0.25s;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-off {
border: 2px solid #6c7781;
display: block;
position: absolute;
top: 2px;
left: 2px;
width: 7px;
height: 7px;
z-index: 1;
border-radius: 50%;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-slider {
position: absolute;
top: 2px;
right: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0.25s ease;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 2;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch {
border-color: #11A0D2;
background: #11A0D2;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-on {
top: 4px;
right: 6px;
width: 2px;
height: 6px;
background: #FFFFFF;
transition: none;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-off {
opacity: 0;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-slider {
background: #FFFFFF;
top: 2px;
right: calc(50% + 4px);
}
.abr-metabox-wrap .abr-metabox-repeater {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater > table {
width: 100%;
border: none;
border-collapse: collapse;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr {
background: #FFFFFF;
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr th {
text-align: right;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr th,
.abr-metabox-wrap .abr-metabox-repeater > table tr td {
border: none;
vertical-align: top;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-sortable-helper {
display: table;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-sortable-placeholder {
background: #F9F9F9;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-state-highlight td {
background: #F9F9F9;
border: 1px dashed #D8D8D8;
}
.abr-metabox-wrap .abr-metabox-repeater .btn-add-row {
margin: 1rem 1.25rem;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content input, .abr-metabox-wrap .abr-metabox-repeater .row-content textarea {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content input[type="number"] {
max-width: 100px;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content p {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar {
position: relative;
border-bottom: 1px solid #EFEFEF;
padding: 1rem 1.25rem;
zoom: 1;
cursor: move;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .handlediv {
display: block !important;
background-position: 6px 5px;
visibility: hidden;
width: 27px;
height: 26px;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .handlediv:before {
content: "\f142";
cursor: pointer;
display: inline-block;
font: 400 20px/1 Dashicons;
line-height: .5;
padding: 8px 10px;
position: relative;
left: 12px;
top: 0;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar.closed .handlediv:before {
content: "\f140";
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .delete {
color: red;
font-weight: 400;
line-height: 26px;
text-decoration: none;
position: relative;
visibility: hidden;
float: left;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .signature {
display: inline-block;
padding-left: 100px;
line-height: 26px;
font-weight: 700;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .signature span {
opacity: 0.5;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar:hover .handlediv,
.abr-metabox-wrap .abr-metabox-repeater .row-topbar:hover .delete {
visibility: visible;
}
.abr-metabox-wrap .abr-metabox-repeater .row-fields {
border-bottom: 1px solid #EFEFEF;
background-color: #FDFDFD;
}
.abr-metabox-wrap .abr-metabox-repeater .row-body {
padding: 1rem 1.25rem;
}
/* Reviews -------------------------------------------------------------- */
#abr_review_metabox .handlediv {
display: none;
}
#abr_review_metabox .inside {
display: block;
margin: 0;
padding: 0;
}
#abr_review_metabox .hidden {
display: none;
}
#abr_review_metabox .handle-actions {
display: none;
}
#abr_review_metabox .postbox-header {
min-height: 44px;
}
#abr_review_metabox .abr-metabox-tabs {
display: none;
}
#abr_review_metabox .abr-metabox-tabs[checked="checked"] {
display: flex;
}
#abr_review_metabox .review-repeater-simple .row-fields {
border: none;
background: none;
}
#abr_review_metabox .review-repeater-simple .row-body {
position: relative;
padding: 0.5rem 2rem;
}
#abr_review_metabox .review-repeater-simple .row-handle {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
justify-content: center;
align-items: center;
margin: 0;
font-size: 1rem;
color: #000000;
text-decoration: none;
cursor: move;
}
#abr_review_metabox .review-repeater-simple .btn-remove-row {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
justify-content: center;
align-items: center;
margin: 0;
font-size: 1rem;
color: #555d66;
text-decoration: none;
}
#abr_review_metabox .review-repeater-simple .btn-remove-row:hover {
color: #000000;
}
#abr_review_metabox .review-repeater-simple + .btn-add-row {
margin-right: 0;
margin-left: 0;
}
@media (min-width: 768px) {
#abr_review_metabox .review-field-grid {
display: flex;
flex-wrap: wrap;
}
#abr_review_metabox .review-field-grid .review-field-criterion-name {
flex: 1 0 70%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-number {
flex: 1 0 30%;
padding-right: 2rem;
box-sizing: border-box;
}
#abr_review_metabox .review-field-grid .review-field-criterion-number input {
max-width: 100%;
width: 100%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-desc {
flex: 1 0 100%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-desc textarea {
min-height: 80px;
}
}
/* Widget -------------------------------------------------------------- */
.widget[id*="abr_reviews_posts_widget"] .widget-content fieldset {
border: 1px solid #DDDDDD;
margin-top: 0.5rem;
padding: 0 0.75rem;
}
.widget[id*="abr_reviews_posts_widget"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"] .abr-small-post {
display: none;
}
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-simple-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-simple-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-simple-post {
display: none;
}
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-small-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-small-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-small-post {
display: block;
}
@@ -0,0 +1,547 @@
/**
* All of the CSS for your admin-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'absolute-reviews-icons';
src: url("../../fonts/absolute-reviews-icons.woff") format("woff"), url("../../fonts/absolute-reviews-icons.ttf") format("truetype"), url("../../fonts/absolute-reviews-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="abr-icon-"],
[class*=" abr-icon-"] {
font-family: 'absolute-reviews-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.abr-icon-comment:before {
content: "\e905";
}
.abr-icon-eye:before {
content: "\e903";
}
.abr-icon-watch:before {
content: "\e904";
}
.abr-icon-funds-fill:before {
content: "\e902";
}
.abr-icon-x:before {
content: "\e901";
}
.abr-icon-check:before {
content: "\e900";
}
.abr-icon-star-half:before {
content: "\e938";
}
.abr-icon-star-full:before {
content: "\e939";
}
.abr-icon-star-empty:before {
content: "\e93a";
}
/*--------------------------------------------------------------*/
/* Basic -------------------------------------------------------------- */
.abr-metabox-wrap .abr-metabox-tabs {
background: none;
border: none;
display: flex;
margin: 0;
padding: 0;
border-radius: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation {
display: flex;
flex-direction: column;
border: none;
border-right: 1px solid #eee;
background: #FAFAFA;
flex: 0 0 200px;
margin: 0;
padding: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation:before {
display: none;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li {
display: block;
background: transparent;
border: none;
margin: 0;
padding: 0;
float: none;
outline: none;
box-shadow: none;
border-radius: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li a {
border: none;
border-bottom: 1px solid #eee;
position: relative;
display: block;
font-size: 0.8125rem;
line-height: 1.25rem;
padding: 0.625rem;
text-decoration: none;
outline: none;
box-shadow: none;
color: #0073aa;
float: none;
cursor: pointer;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li a:hover {
color: #00a0d2;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li.ui-tabs-active {
margin: 0;
padding: 0;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation li.ui-tabs-active a {
background-color: #eee;
color: #555;
cursor: pointer;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-content {
flex-grow: 1;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-content .ui-tabs-panel {
padding: 0;
border-radius: 0;
}
@media screen and (max-width: 768px) {
.abr-metabox-wrap .abr-metabox-tabs {
flex-direction: column;
}
.abr-metabox-wrap .abr-metabox-tabs > .abr-metabox-tabs-navigation {
flex: 0 0 100%;
}
}
.abr-metabox-wrap .abr-metabox-field {
display: flex;
position: relative;
flex-direction: column;
}
.abr-metabox-wrap .abr-metabox-field:last-child {
border-bottom: none;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label {
position: relative;
flex: 0 0 100%;
float: none;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label label {
display: block;
font-size: 14px;
line-height: 1.4em;
margin: 0 0 3px;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input {
position: relative;
flex: 0 0 100%;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="number"],
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="text"],
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input select,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input textarea {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="number"].short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input input[type="text"].short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input select.short,
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input textarea.short {
max-width: 100px;
}
@media (min-width: 1200px) {
.abr-metabox-wrap .abr-metabox-field {
flex-direction: row;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-label {
flex: 0 0 20%;
padding: 1rem 1.25rem;
}
.abr-metabox-wrap .abr-metabox-field .abr-metabox-input {
flex: 0 0 80%;
padding: 1rem 1.25rem;
}
}
.abr-metabox-wrap .abr-metabox-switcher {
display: flex;
position: absolute;
top: -2rem;
right: 1rem;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch {
border: 2px solid #555d66;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: flex;
height: 1.75rem;
height: 18px;
padding: 0;
position: relative;
vertical-align: middle;
width: 36px;
margin-right: 0.5rem;
border-radius: 9px;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-on {
position: absolute;
top: 2px;
left: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0s ease 0.25s;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-off {
border: 2px solid #6c7781;
display: block;
position: absolute;
top: 2px;
right: 2px;
width: 7px;
height: 7px;
z-index: 1;
border-radius: 50%;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-switch .abr-metabox-switch-slider {
position: absolute;
top: 2px;
left: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0.25s ease;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 2;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch {
border-color: #11A0D2;
background: #11A0D2;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-on {
top: 4px;
left: 6px;
width: 2px;
height: 6px;
background: #FFFFFF;
transition: none;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-off {
opacity: 0;
}
.abr-metabox-wrap .abr-metabox-switcher .abr-metabox-checkbox:checked + .abr-metabox-switch .abr-metabox-switch-slider {
background: #FFFFFF;
top: 2px;
left: calc(50% + 4px);
}
.abr-metabox-wrap .abr-metabox-repeater {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater > table {
width: 100%;
border: none;
border-collapse: collapse;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr {
background: #FFFFFF;
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr th {
text-align: left;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr th,
.abr-metabox-wrap .abr-metabox-repeater > table tr td {
border: none;
vertical-align: top;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-sortable-helper {
display: table;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-sortable-placeholder {
background: #F9F9F9;
}
.abr-metabox-wrap .abr-metabox-repeater > table tr.ui-state-highlight td {
background: #F9F9F9;
border: 1px dashed #D8D8D8;
}
.abr-metabox-wrap .abr-metabox-repeater .btn-add-row {
margin: 1rem 1.25rem;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content input, .abr-metabox-wrap .abr-metabox-repeater .row-content textarea {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content input[type="number"] {
max-width: 100px;
}
.abr-metabox-wrap .abr-metabox-repeater .row-content p {
width: 100%;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar {
position: relative;
border-bottom: 1px solid #EFEFEF;
padding: 1rem 1.25rem;
zoom: 1;
cursor: move;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .handlediv {
display: block !important;
background-position: 6px 5px;
visibility: hidden;
width: 27px;
height: 26px;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .handlediv:before {
content: "\f142";
cursor: pointer;
display: inline-block;
font: 400 20px/1 Dashicons;
line-height: .5;
padding: 8px 10px;
position: relative;
right: 12px;
top: 0;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar.closed .handlediv:before {
content: "\f140";
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .delete {
color: red;
font-weight: 400;
line-height: 26px;
text-decoration: none;
position: relative;
visibility: hidden;
float: right;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .signature {
display: inline-block;
padding-right: 100px;
line-height: 26px;
font-weight: 700;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar .signature span {
opacity: 0.5;
}
.abr-metabox-wrap .abr-metabox-repeater .row-topbar:hover .handlediv,
.abr-metabox-wrap .abr-metabox-repeater .row-topbar:hover .delete {
visibility: visible;
}
.abr-metabox-wrap .abr-metabox-repeater .row-fields {
border-bottom: 1px solid #EFEFEF;
background-color: #FDFDFD;
}
.abr-metabox-wrap .abr-metabox-repeater .row-body {
padding: 1rem 1.25rem;
}
/* Reviews -------------------------------------------------------------- */
#abr_review_metabox .handlediv {
display: none;
}
#abr_review_metabox .inside {
display: block;
margin: 0;
padding: 0;
}
#abr_review_metabox .hidden {
display: none;
}
#abr_review_metabox .handle-actions {
display: none;
}
#abr_review_metabox .postbox-header {
min-height: 44px;
}
#abr_review_metabox .abr-metabox-tabs {
display: none;
}
#abr_review_metabox .abr-metabox-tabs[checked="checked"] {
display: flex;
}
#abr_review_metabox .review-repeater-simple .row-fields {
border: none;
background: none;
}
#abr_review_metabox .review-repeater-simple .row-body {
position: relative;
padding: 0.5rem 2rem;
}
#abr_review_metabox .review-repeater-simple .row-handle {
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
justify-content: center;
align-items: center;
margin: 0;
font-size: 1rem;
color: #000000;
text-decoration: none;
cursor: move;
}
#abr_review_metabox .review-repeater-simple .btn-remove-row {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
justify-content: center;
align-items: center;
margin: 0;
font-size: 1rem;
color: #555d66;
text-decoration: none;
}
#abr_review_metabox .review-repeater-simple .btn-remove-row:hover {
color: #000000;
}
#abr_review_metabox .review-repeater-simple + .btn-add-row {
margin-left: 0;
margin-right: 0;
}
@media (min-width: 768px) {
#abr_review_metabox .review-field-grid {
display: flex;
flex-wrap: wrap;
}
#abr_review_metabox .review-field-grid .review-field-criterion-name {
flex: 1 0 70%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-number {
flex: 1 0 30%;
padding-left: 2rem;
box-sizing: border-box;
}
#abr_review_metabox .review-field-grid .review-field-criterion-number input {
max-width: 100%;
width: 100%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-desc {
flex: 1 0 100%;
}
#abr_review_metabox .review-field-grid .review-field-criterion-desc textarea {
min-height: 80px;
}
}
/* Widget -------------------------------------------------------------- */
.widget[id*="abr_reviews_posts_widget"] .widget-content fieldset {
border: 1px solid #DDDDDD;
margin-top: 0.5rem;
padding: 0 0.75rem;
}
.widget[id*="abr_reviews_posts_widget"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"] .abr-small-post {
display: none;
}
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-simple-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-simple-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-simple-post {
display: none;
}
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-3"] .abr-small-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-4"] .abr-small-post, .widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-large-post,
.widget[id*="abr_reviews_posts_widget"][template="reviews-5"] .abr-small-post {
display: block;
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,211 @@
"use strict";
/* Basic -------------------------------------------------------------- */
(function($) {
var abrMetabox = {};
( function() {
var $this;
abrMetabox = {
/*
* Initialize
*/
init: function( e ) {
$this = abrMetabox;
// Variables.
$this.wrap = $( '.abr-metabox-wrap' );
// Init.
$this.metaboxInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$this.wrap.on( 'click change keyup keydown', '.abr-metabox-repeater .attribute-name', $this.setSignature );
$this.wrap.on( 'click', '.abr-metabox-repeater .row-topbar', $this.toggleItems );
$this.wrap.on( 'click', '.abr-metabox-repeater .btn-remove-row', $this.removeRepeaterRow );
$this.wrap.on( 'click', '.abr-metabox-repeater .btn-add-row', $this.addRepeaterRow );
},
/*
* Init metabox elements
*/
metaboxInit: function( e ) {
// Add tabs for Meta Box (UI)
$this.wrap.find( '.abr-metabox-tabs' ).tabs();
// Repeater sortable
$this.wrap.find( '.abr-metabox-repeater tbody' ).sortable( {
items: 'tr',
placeholder: 'ui-state-highlight',
handle: '.row-topbar, .row-handle',
start: function( e, ui ) {
ui.placeholder.height( ui.item.height() );
},
} );
},
/*
* Toggle items
*/
toggleItems: function() {
if ( $( this ).hasClass( 'closed' ) ) {
$( this ).removeClass( 'closed' );
$( this ).siblings( '.row-fields' ).slideDown();
} else {
$( this ).addClass( 'closed' );
$( this ).siblings( '.row-fields' ).slideUp();
}
},
/*
* Set signature
*/
setSignature: function() {
var label = '<span>' + $( this ).data( 'label' ) + '</span>';
var value = $( this ).val() ? $( this ).val() : label;
$( this ).parents( '.row-content' ).find( '.signature' ).html( value );
},
/*
* Add repeater row
*/
addRepeaterRow: function() {
var repeater = $( this ).siblings( '.abr-metabox-repeater-table' )
// Get html row.
var html = repeater.find( 'tbody tr.hidden' ).html();
// Add new row.
repeater.find( 'tbody' ).append( '<tr class="row">' + html + '</tr>' );
// Visible all input and textarea.
repeater.find( 'tr' ).not( '.hidden' ).find( 'input, textarea' ).removeAttr( 'disabled' );
return false;
},
/*
* Remove repeater row
*/
removeRepeaterRow: function() {
$( this ).parents( '.row' ).remove();
return false;
}
};
} )();
// Initialize.
$( function() {
abrMetabox.init();
} );
})(jQuery);
/* Reviews -------------------------------------------------------------- */
(function($) {
var abrReviews = {};
( function() {
var $this;
abrReviews = {
/*
* Initialize
*/
init: function( e ) {
$this = abrReviews;
// Variables.
$this.wrap = $( '.review-wrap' );
// Init.
$this.reviewsInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$this.wrap.on( 'click', 'input[name="abr_review_settings"]', $this.toggleMetaBox );
$this.wrap.on( 'click', 'input[name="abr_review_auto_score"]', $this.actionAutoScore );
$this.wrap.on( 'change', 'select[name="abr_review_schema_author"]', $this.actionSchemaAuthor );
},
/*
* Init reviews elements
*/
reviewsInit: function( e ) {
$this.actionAutoScore( 'input[name="abr_review_auto_score"]' );
$this.actionSchemaAuthor( 'select[name="abr_review_schema_author"]' );
},
/*
* Toggle metabox view
*/
toggleMetaBox: function() {
if ( $( this ).prop( 'checked' ) ) {
$this.wrap.find( '.abr-metabox-tabs' ).attr( 'checked', 'checked' );
} else {
$this.wrap.find( '.abr-metabox-tabs' ).removeAttr( 'checked' );
}
},
/*
* Action auto score
*/
actionAutoScore: function( e ) {
let checked = $( typeof e === 'string' ? e : this ).prop('checked');
if ( checked ) {
$( '.review-field-total-score' ).addClass( 'hidden' );
} else {
$( '.review-field-total-score' ).removeClass( 'hidden' );
}
},
/*
* Action schema author
*/
actionSchemaAuthor: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
if ( 'custom' !== val ) {
$( '.review-field-schema-author-custom' ).addClass( 'hidden' );
} else {
$( '.review-field-schema-author-custom' ).removeClass( 'hidden' );
}
},
};
} )();
// Initialize.
$( function() {
abrReviews.init();
});
})(jQuery);
@@ -0,0 +1,19 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="absolute-reviews-icons" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="check" d="M823.168 712.832l-439.168-439.168-183.168 183.168c-16.683 16.683-43.691 16.683-60.331 0s-16.683-43.691 0-60.331l213.333-213.333c16.683-16.683 43.691-16.683 60.331 0l469.333 469.333c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0z" />
<glyph unicode="&#xe901;" glyph-name="x" d="M225.835 652.502l225.835-225.835-225.835-225.835c-16.683-16.683-16.683-43.691 0-60.331s43.691-16.683 60.331 0l225.835 225.835 225.835-225.835c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331l-225.835 225.835 225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-225.835-225.835-225.835 225.835c-16.683 16.683-43.691 16.683-60.331 0s-16.683-43.691 0-60.331z" />
<glyph unicode="&#xe902;" glyph-name="funds-fill" d="M97.127 147.968l200.192 200.192 144.845-144.794 234.035 233.984 91.801-91.75v256h-256l91.802-91.802-161.638-161.638-144.794 144.845-253.235-253.235c-29.188 65.535-44.226 136.489-44.135 208.23 0 282.778 229.223 512 512 512s512-229.222 512-512c0-282.778-229.222-512-512-512-164.316-0.107-318.673 78.757-414.873 211.968z" />
<glyph unicode="&#xe903;" glyph-name="eye" d="M4.523 445.739c-5.803-11.691-6.229-25.728 0-38.144 0 0 16.896-33.664 47.787-78.635 19.243-27.989 44.288-61.099 74.965-94.635 38.144-41.771 85.504-84.779 141.611-119.467 68.053-42.069 149.589-72.192 243.115-72.192s175.061 30.123 243.115 72.192c56.107 34.688 103.467 77.696 141.611 119.467 30.635 33.536 55.723 66.645 74.965 94.635 30.891 44.971 47.787 78.635 47.787 78.635 5.803 11.691 6.229 25.728 0 38.144 0 0-16.896 33.664-47.787 78.635-19.243 27.989-44.288 61.099-74.965 94.635-38.144 41.771-85.504 84.779-141.611 119.467-68.053 42.069-149.589 72.192-243.115 72.192s-175.061-30.123-243.115-72.192c-56.107-34.688-103.467-77.696-141.611-119.467-30.677-33.536-55.723-66.603-74.965-94.635-30.891-44.971-47.787-78.635-47.787-78.635zM91.307 426.667c6.955 11.989 17.365 29.056 31.317 49.408 17.493 25.429 40.107 55.296 67.627 85.376 34.347 37.589 75.733 74.923 123.477 104.448 57.6 35.584 123.776 59.435 198.272 59.435s140.672-23.851 198.229-59.435c47.744-29.525 89.131-66.859 123.477-104.448 27.477-30.080 50.133-59.947 67.627-85.376 13.995-20.352 24.405-37.376 31.317-49.408-6.955-11.989-17.365-29.056-31.317-49.408-17.493-25.429-40.107-55.296-67.627-85.376-34.347-37.589-75.733-74.923-123.477-104.448-57.557-35.584-123.733-59.435-198.229-59.435s-140.672 23.851-198.229 59.435c-47.744 29.525-89.131 66.859-123.477 104.448-27.477 30.080-50.133 59.947-67.627 85.376-13.995 20.352-24.405 37.419-31.36 49.408zM682.667 426.667c0 47.104-19.157 89.856-50.005 120.661s-73.557 50.005-120.661 50.005-89.856-19.157-120.661-50.005-50.005-73.557-50.005-120.661 19.157-89.856 50.005-120.661 73.557-50.005 120.661-50.005 89.856 19.157 120.661 50.005 50.005 73.557 50.005 120.661zM597.333 426.667c0-23.595-9.515-44.843-25.003-60.331s-36.736-25.003-60.331-25.003-44.843 9.515-60.331 25.003-25.003 36.736-25.003 60.331 9.515 44.843 25.003 60.331 36.736 25.003 60.331 25.003 44.843-9.515 60.331-25.003 25.003-36.736 25.003-60.331z" />
<glyph unicode="&#xe904;" glyph-name="watch" d="M469.333 554.667v-128c0-11.776 4.779-22.443 12.501-30.165l64-64c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331l-51.499 51.499v110.336c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667zM654.080 116.224l-7.083-77.355c-1.024-11.349-6.272-21.12-14.208-28.075-7.68-6.784-17.707-10.795-28.587-10.795h-184.789c-11.52-0.043-21.76 4.267-29.44 11.477-7.467 6.997-12.416 16.597-13.397 27.435l-7.083 77.525c43.349-19.968 91.648-31.104 142.507-31.104 50.688 0 98.816 11.051 142.080 30.891zM349.312 624.342c44.245 36.48 100.864 58.325 162.688 58.325 70.699 0 134.656-28.587 181.035-74.965s74.965-110.336 74.965-181.035-28.587-134.656-74.965-181.035c-4.437-4.437-9.003-8.704-13.781-12.8-1.493-1.323-3.029-2.603-4.565-3.84-44.245-36.48-100.864-58.325-162.688-58.325-70.699 0-134.656 28.587-181.035 74.965s-74.965 110.336-74.965 181.035 28.587 134.656 74.965 181.035c4.437 4.437 9.003 8.704 13.781 12.8 1.493 1.323 3.029 2.603 4.565 3.84zM746.283 674.902l-13.44 147.413c-2.987 32.256-17.835 61.013-40.021 81.792-22.997 21.547-54.016 34.688-87.808 34.56h-185.771c-32.213-0.128-62.037-12.203-84.693-32.299-23.552-20.821-39.467-50.432-42.539-84.139l-13.397-146.475c-2.688-2.517-5.376-5.12-7.979-7.723-61.696-61.739-99.968-147.115-99.968-241.365s38.272-179.627 99.968-241.365c2.475-2.475 4.992-4.907 7.509-7.296l13.44-146.987c2.987-32.256 17.835-61.013 40.021-81.792 22.997-21.547 54.016-34.688 87.808-34.56h184.661c32.384-0.043 62.421 12.032 85.205 32.171 23.595 20.864 39.637 50.517 42.667 84.267l13.397 146.475c2.688 2.517 5.376 5.12 7.979 7.723 61.739 61.739 100.011 147.115 100.011 241.365s-38.272 179.627-99.968 241.365c-2.304 2.304-4.693 4.608-7.040 6.869zM369.92 737.11l7.083 77.355c1.024 11.307 6.272 21.077 14.123 28.032 7.637 6.784 17.579 10.795 28.459 10.837h185.429c11.52 0.043 21.76-4.267 29.44-11.477 7.467-6.997 12.416-16.597 13.397-27.435l7.083-77.696c-43.477 20.053-91.904 31.275-142.933 31.275-50.688 0-98.816-11.051-142.080-30.891z" />
<glyph unicode="&#xe905;" glyph-name="comment" d="M938.667 298.667v426.667c0 35.328-14.379 67.413-37.504 90.496s-55.168 37.504-90.496 37.504h-597.333c-35.328 0-67.413-14.379-90.496-37.504s-37.504-55.168-37.504-90.496v-682.667c0-10.923 4.181-21.845 12.501-30.165 16.683-16.683 43.691-16.683 60.331 0l158.165 158.165h494.336c35.328 0 67.413 14.379 90.496 37.504s37.504 55.168 37.504 90.496zM853.333 298.667c0-11.776-4.736-22.4-12.501-30.165s-18.389-12.501-30.165-12.501h-512c-11.776 0-22.443-4.779-30.165-12.501l-97.835-97.835v579.669c0 11.776 4.736 22.4 12.501 30.165s18.389 12.501 30.165 12.501h597.333c11.776 0 22.4-4.736 30.165-12.501s12.501-18.389 12.501-30.165z" />
<glyph unicode="&#xe938;" glyph-name="star-half" d="M1024 562.95l-353.78 51.408-158.22 320.582-158.216-320.582-353.784-51.408 256-249.538-60.432-352.352 316.432 166.358 316.432-166.358-60.434 352.352 256.002 249.538zM512 206.502l-0.942-0.496 0.942 570.768 111.736-226.396 249.836-36.304-180.788-176.222 42.678-248.83-223.462 117.48z" />
<glyph unicode="&#xe939;" glyph-name="star-full" d="M1024 562.95l-353.78 51.408-158.22 320.582-158.216-320.582-353.784-51.408 256-249.538-60.432-352.352 316.432 166.358 316.432-166.358-60.434 352.352 256.002 249.538z" />
<glyph unicode="&#xe93a;" glyph-name="star-empty" d="M1024 562.95l-353.78 51.408-158.22 320.582-158.216-320.582-353.784-51.408 256-249.538-60.432-352.352 316.432 166.358 316.432-166.358-60.434 352.352 256.002 249.538zM512 206.502l-223.462-117.48 42.676 248.83-180.786 176.222 249.84 36.304 111.732 226.396 111.736-226.396 249.836-36.304-180.788-176.222 42.678-248.83-223.462 117.48z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 7.0 KiB

File diff suppressed because one or more lines are too long
@@ -0,0 +1,35 @@
<?php
/**
* Define the internationalization functionality
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/includes
*/
/**
* Define the internationalization functionality.
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @package ABR
* @subpackage ABR/includes
*/
class ABR_i18n {
/**
* Load the plugin text domain for translation.
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( 'absolute-reviews', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
}
}
@@ -0,0 +1,115 @@
<?php
/**
* Register all actions and filters for the plugin
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/includes
*/
/**
* Register all actions and filters for the plugin.
*
* Maintain a list of all hooks that are registered throughout
* the plugin, and register them with the WordPress API. Call the
* run function to execute the list of actions and filters.
*
* @package ABR
* @subpackage ABR/includes
*/
class ABR_Loader {
/**
* The array of actions registered with WordPress.
*
* @access protected
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
*/
protected $actions;
/**
* The array of filters registered with WordPress.
*
* @access protected
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
*/
protected $filters;
/**
* Initialize the collections used to maintain the actions and filters.
*/
public function __construct() {
$this->actions = array();
$this->filters = array();
}
/**
* Add a new action to the collection to be registered with WordPress.
* @param string $hook The name of the WordPress action that is being registered.
* @param object $component A reference to the instance of the object on which the action is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Add a new filter to the collection to be registered with WordPress.
*
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* A utility function that is used to register the actions and hooks into a single
* collection.
* @access private
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority The priority at which the function should be fired.
* @param int $accepted_args The number of arguments that should be passed to the $callback.
* @return array The collection of actions and filters registered with WordPress.
*/
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
$hooks[] = array(
'hook' => $hook,
'component' => $component,
'callback' => $callback,
'priority' => $priority,
'accepted_args' => $accepted_args,
);
return $hooks;
}
/**
* Register the filters and actions with WordPress.
*/
public function run() {
foreach ( $this->filters as $hook ) {
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
foreach ( $this->actions as $hook ) {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
}
}
@@ -0,0 +1,234 @@
<?php
/**
* The file that defines the core plugin class
*
* A class definition that includes attributes and functions used across both the
* public-facing side of the site and the admin area.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/includes
*/
/**
* The core plugin class.
*
* This is used to define internationalization, admin-specific hooks, and
* public-facing site hooks.
*
* Also maintains the unique identifier of this plugin as well as the current
* version of the plugin.
*
* @since 1.0.0
* @package ABR
* @subpackage ABR/includes
*/
class ABR {
/**
* The loader that's responsible for maintaining and registering all hooks that power
* the plugin.
*
* @access protected
* @var ABR_Loader $loader Maintains and registers all hooks for the plugin.
*/
protected $loader;
/**
* The unique identifier of this plugin.
*
* @access protected
* @var string $abr The string used to uniquely identify this plugin.
*/
protected $abr;
/**
* The current version of the plugin.
*
* @access protected
* @var string $version The current version of the plugin.
*/
protected $version;
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*/
public function __construct() {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// Get plugin data.
$plugin_data = get_plugin_data( ABR_PATH . '/absolute-reviews.php' );
$this->version = $plugin_data['Version'];
$this->abr = 'absolute-reviews';
$this->load_dependencies();
$this->set_locale();
$this->define_admin_hooks();
$this->define_public_hooks();
}
/**
* Load the required dependencies for this plugin.
*
* Include the following files that make up the plugin:
*
* - ABR_Loader. Orchestrates the hooks of the plugin.
* - ABR_i18n. Defines internationalization functionality.
* - ABR_Admin. Defines all hooks for the admin area.
* - ABR_Public. Defines all hooks for the public side of the site.
*
* Create an instance of the loader which will be used to register the hooks
* with WordPress.
*
* @access private
*/
private function load_dependencies() {
/**
* Helpers Functions for the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/helpers-absolute-reviews.php';
/**
* Post Meta.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/post-meta.php';
/**
* Posts Template.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/posts-template.php';
/**
* Register widgets for the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-absolute-reviews-posts-widget.php';
/**
* Register gutenberg blocks.
*/
if ( function_exists( 'register_block_type' ) ) {
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-absolute-reviews-block.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-absolute-reviews-posts-block.php';
}
/**
* The class responsible for orchestrating the actions and filters of the
* core plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-absolute-reviews-loader.php';
/**
* The class responsible for defining internationalization functionality
* of the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-absolute-reviews-i18n.php';
/**
* The class responsible for defining all actions that occur in the admin area.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-absolute-reviews-admin.php';
/**
* The class responsible for defining all actions that occur in the public-facing
* side of the site.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-absolute-reviews-public.php';
$this->loader = new ABR_Loader();
}
/**
* Define the locale for this plugin for internationalization.
*
* Uses the ABR_i18n class in order to set the domain and to register the hook
* with WordPress.
*
* @access private
*/
private function set_locale() {
$plugin_i18n = new ABR_i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
/**
* Register all of the hooks related to the admin area functionality
* of the plugin.
*
* @access private
*/
private function define_admin_hooks() {
$plugin_admin = new ABR_Admin( $this->get_abr(), $this->get_version() );
$this->loader->add_action( 'admin_menu', $plugin_admin, 'register_options_page' );
$this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'metabox_review_register' );
$this->loader->add_action( 'save_post', $plugin_admin, 'metabox_review_save', 10, 2 );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'admin_enqueue_scripts' );
}
/**
* Register all of the hooks related to the public-facing functionality
* of the plugin.
*
* @access private
*/
private function define_public_hooks() {
$plugin_public = new ABR_Public( $this->get_abr(), $this->get_version() );
$this->loader->add_action( 'wp_head', $plugin_public, 'wp_head' );
$this->loader->add_action( 'the_content', $plugin_public, 'the_content' );
$this->loader->add_action( 'abr_reviews_posts_templates', $plugin_public, 'posts_templates' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'wp_enqueue_scripts' );
}
/**
* Run the loader to execute all of the hooks with WordPress.
*/
public function run() {
$this->loader->run();
}
/**
* The name of the plugin used to uniquely identify it within the context of
* WordPress and to define internationalization functionality.
*
* @return string The name of the plugin.
*/
public function get_abr() {
return $this->abr;
}
/**
* The reference to the class that orchestrates the hooks with the plugin.
*
* @return ABR_Loader Orchestrates the hooks of the plugin.
*/
public function get_loader() {
return $this->loader;
}
/**
* Retrieve the version number of the plugin.
*
* @return string The version number of the plugin.
*/
public function get_version() {
return $this->version;
}
}
@@ -0,0 +1,886 @@
<?php
/**
* Helpers Absolute Reviews
*
* @package ABR
* @subpackage ABR/includes
*/
if ( ! function_exists( 'abr_style' ) ) {
/**
* Processing path of style.
*
* @param string $path URL to the stylesheet.
*/
function abr_style( $path ) {
// Check RTL.
if ( is_rtl() ) {
return $path;
}
// Check Dev.
$dev = ABR_PATH . 'public/css/absolute-reviews-public-dev.css';
if ( file_exists( $dev ) ) {
return str_replace( '.css', '-dev.css', $path );
}
return $path;
}
}
if ( ! function_exists( 'abr_powerkit_module_enabled' ) ) {
/**
* Helper function to check the status of powerkit modules
*
* @param array $name Name of module.
*/
function abr_powerkit_module_enabled( $name ) {
if ( function_exists( 'powerkit_module_enabled' ) && powerkit_module_enabled( $name ) ) {
return true;
}
}
}
if ( ! function_exists( 'abr_post_views_enabled' ) ) {
/**
* Check post views module.
*
* @return string Type.
*/
function abr_post_views_enabled() {
// Post Views Counter.
if ( class_exists( 'Post_Views_Counter' ) ) {
return 'post_views';
}
// Powerkit Post Views.
if ( abr_powerkit_module_enabled( 'post_views' ) ) {
return 'pk_post_views';
}
}
}
if ( ! function_exists( 'abr_get_available_image_sizes' ) ) {
/**
* Get the available image sizes
*/
function abr_get_available_image_sizes() {
$wais = & $GLOBALS['_wp_additional_image_sizes'];
$sizes = array();
$image_sizes = get_intermediate_image_sizes();
if ( is_array( $image_sizes ) && $image_sizes ) {
foreach ( $image_sizes as $size ) {
if ( in_array( $size, array( 'thumbnail', 'medium', 'medium_large', 'large' ), true ) ) {
$sizes[ $size ] = array(
'width' => get_option( "{$size}_size_w" ),
'height' => get_option( "{$size}_size_h" ),
'crop' => (bool) get_option( "{$size}_crop" ),
);
} elseif ( isset( $wais[ $size ] ) ) {
$sizes[ $size ] = array(
'width' => $wais[ $size ]['width'],
'height' => $wais[ $size ]['height'],
'crop' => $wais[ $size ]['crop'],
);
}
// Size registered, but has 0 width and height.
if ( 0 === (int) $sizes[ $size ]['width'] && 0 === (int) $sizes[ $size ]['height'] ) {
unset( $sizes[ $size ] );
}
}
}
return $sizes;
}
}
if ( ! function_exists( 'abr_get_image_size' ) ) {
/**
* Gets the data of a specific image size.
*
* @param string $size Name of the size.
*/
function abr_get_image_size( $size ) {
if ( ! is_string( $size ) ) {
return;
}
$sizes = abr_get_available_image_sizes();
return isset( $sizes[ $size ] ) ? $sizes[ $size ] : false;
}
}
if ( ! function_exists( 'abr_get_list_available_image_sizes' ) ) {
/**
* Get the list available image sizes
*/
function abr_get_list_available_image_sizes() {
$intermediate_image_sizes = get_intermediate_image_sizes();
$image_sizes = array();
foreach ( $intermediate_image_sizes as $size ) {
$image_sizes[ $size ] = $size;
$data = abr_get_image_size( $size );
if ( isset( $data['width'] ) || isset( $data['height'] ) ) {
$width = '~';
$height = '~';
if ( isset( $data['width'] ) && $data['width'] ) {
$width = $data['width'] . 'px';
}
if ( isset( $data['height'] ) && $data['height'] ) {
$height = $data['height'] . 'px';
}
$image_sizes[ $size ] .= sprintf( ' [%s, %s]', $width, $height );
}
}
$image_sizes = apply_filters( 'abr_list_available_image_sizes', $image_sizes );
return $image_sizes;
}
}
if ( ! function_exists( 'abr_get_post_metadata' ) ) {
/**
* Retrieves a post meta field for the given post ID.
*
* @param int $post_id Post ID.
* @param string $key Optional. The meta key to retrieve. By default, returns
* data for all keys. Default empty.
* @param bool $single Optional. If true, returns only the first value for the specified meta key.
* This parameter has no effect if $key is not specified. Default false.
* @param mixed $default Default value.
* @return mixed Will be an array if $single is false. Will be value of the meta
* field if $single is true.
*/
function abr_get_post_metadata( $post_id, $key = '', $single = false, $default = null ) {
if ( ! metadata_exists( 'post', $post_id, $key ) && $default ) {
return $default;
}
return get_metadata( 'post', $post_id, $key, $single );
}
}
if ( ! function_exists( 'abr_default_post_types' ) ) {
/**
* Return default post types.
*/
function abr_default_post_types() {
$types = array(
'post' => 'post',
);
return apply_filters( 'abr_default_post_types', $types );
}
}
if ( ! function_exists( 'abr_default_indicators' ) ) {
/**
* Return default indicators.
*/
function abr_default_indicators() {
$indicators = array(
0 => array(
'name' => 'None',
),
1 => array(
'name' => 'Awfully',
),
2 => array(
'name' => 'Very bad',
),
3 => array(
'name' => 'Bad',
),
4 => array(
'name' => 'Passably',
),
5 => array(
'name' => 'Neutral',
),
6 => array(
'name' => 'Normal',
),
7 => array(
'name' => 'Good',
),
8 => array(
'name' => 'Very good',
),
9 => array(
'name' => 'Amazing',
),
10 => array(
'name' => 'The best',
),
);
return apply_filters( 'abr_default_indicators', $indicators );
}
}
if ( ! function_exists( 'abr_list_indicators' ) ) {
/**
* Return list indicators.
*/
function abr_list_indicators() {
$indicators = abr_default_indicators();
// Disable all indicators.
if ( get_option( 'abr_review_disable_indicators', false ) ) {
$indicators = array();
}
// Set custom name for indicators.
foreach ( $indicators as $index => $value ) {
$indicators[ $index ]['name'] = get_option( "abr_review_indicator_label_{$index}", $indicators[ $index ]['name'] );
}
return $indicators;
}
}
if ( ! function_exists( 'abr_the_review' ) ) {
/**
* Post Review
*
* @param int $post_id Post ID.
*/
function abr_the_review( $post_id = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
}
if ( ! $post_id ) {
return;
}
$post_type = get_post_type( $post_id );
// Get types of option.
$option_types = get_option( 'abr_review_post_types', abr_default_post_types() );
if ( ! in_array( $post_type, $option_types, true ) ) {
return;
}
// Check display.
if ( ! abr_get_post_metadata( $post_id, '_abr_review_settings', true ) ) {
return;
}
// Params.
$params = array(
'type' => abr_get_post_metadata( $post_id, '_abr_review_type', true, 'percentage' ),
'items' => abr_get_post_metadata( $post_id, '_abr_review_items', true, array() ),
'heading' => abr_get_post_metadata( $post_id, '_abr_review_heading', true ),
'desc' => abr_get_post_metadata( $post_id, '_abr_review_desc', true ),
'main_scale' => abr_get_post_metadata( $post_id, '_abr_review_main_scale', true, true ),
'total_score_number' => abr_get_post_metadata( $post_id, '_abr_review_total_score_number', true ),
'pros_heading' => abr_get_post_metadata( $post_id, '_abr_review_pros_heading', true ),
'pros_items' => abr_get_post_metadata( $post_id, '_abr_review_pros_items', true, array() ),
'cons_heading' => abr_get_post_metadata( $post_id, '_abr_review_cons_heading', true ),
'cons_items' => abr_get_post_metadata( $post_id, '_abr_review_cons_items', true, array() ),
'legend' => abr_get_post_metadata( $post_id, '_abr_review_legend', true ),
'schema_heading' => abr_get_post_metadata( $post_id, '_abr_review_schema_heading', true ),
'schema_desc' => abr_get_post_metadata( $post_id, '_abr_review_schema_desc', true ),
'schema_author' => abr_get_post_metadata( $post_id, '_abr_review_schema_author', true ),
'schema_author_custom' => abr_get_post_metadata( $post_id, '_abr_review_schema_author_custom', true ),
);
abr_review_display_block( $params );
}
}
if ( ! function_exists( 'abr_get_review' ) ) {
/**
* Get review of post
*
* @param bool $format Do you format the result?.
* @param int $post_id Post ID.
*/
function abr_get_review( $format = false, $post_id = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
}
if ( ! $post_id ) {
return 0;
}
if ( ! abr_get_post_metadata( $post_id, '_abr_review_settings', true ) ) {
return 0;
}
$review_type = abr_get_post_metadata( $post_id, '_abr_review_type', true, 'percentage' );
$total_score = (float) abr_get_post_metadata( $post_id, '_abr_review_total_score_number', true );
// Vars.
switch ( $review_type ) {
case 'percentage':
$max = 100;
break;
case 'point-5':
$max = 5;
break;
case 'point-10':
$max = 10;
break;
case 'star':
$max = 5;
break;
}
// Formating value.
if ( $total_score && $format ) {
if ( 'percentage' === $review_type ) {
$total_score = sprintf( '%s%%', $total_score );
} else {
$total_score = sprintf( '%s/%s', $total_score, $max );
}
}
return $total_score;
}
}
if ( ! function_exists( 'abr_review_get_val_index' ) ) {
/**
* Get value index for post review
*
* @param string $type The type of review.
* @param float $value The value.
*/
function abr_review_get_val_index( $type, $value ) {
$val_index = $value;
if ( 'star' === $type ) {
$val_index = round( $value * 2 - 1 );
}
if ( 'point-5' === $type ) {
$val_index = round( $value * 2 - 1 );
}
if ( 'percentage' === $type ) {
$val_index = round( $value / 10 );
}
return $val_index;
}
}
if ( ! function_exists( 'abr_review_get_type' ) ) {
/**
* Get type review of post
*
* @param int $post_id Post ID.
* @param mixed $default Return default.
*/
function abr_review_get_type( $post_id = null, $default = false ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
}
if ( ! $post_id ) {
return $default;
}
return abr_get_post_metadata( $post_id, '_abr_review_type', true, $default );
}
}
if ( ! function_exists( 'abr_review_star_rating' ) ) {
/**
* Output a HTML element with a star rating for a given rating.
*
* @param array $args {
* Optional. Array of star ratings arguments.
*
* @type int|float $rating The rating to display, expressed in either a 0.5 rating increment,
* or percentage. Default 0.
* @type string $type Format that the $rating is in. Valid values are 'rating' (default),
* or, 'percent'. Default 'rating'.
* @type int $number The number of ratings that makes up this rating. Default 0.
* @type bool $echo Whether to echo the generated markup. False to return the markup instead
* of echoing it. Default true.
* }
*/
function abr_review_star_rating( $args = array() ) {
$defaults = array(
'rating' => 0,
'type' => 'rating',
'number' => 0,
'echo' => true,
);
$r = wp_parse_args( $args, $defaults );
// Non-English decimal places when the $rating is coming from a string.
$rating = (float) str_replace( ',', '.', $r['rating'] );
// Convert Percentage to star rating, 0..5 in .5 increments.
if ( 'percent' === $r['type'] ) {
$rating = round( $rating / 10, 0 ) / 2;
}
// Calculate the number of each type of star needed.
$full_stars = floor( $rating );
$half_stars = ceil( $rating - $full_stars );
$empty_stars = 5 - $full_stars - $half_stars;
if ( $r['number'] ) {
/* translators: 1: the rating, 2: the number of ratings */
$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
$title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
} else {
/* translators: %s: the rating */
$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
}
$output = '<div class="abr-star-rating">';
$output .= '<span class="screen-reader-text">' . $title . '</span>';
$output .= str_repeat( '<div class="abr-star abr-star-full" aria-hidden="true"></div>', $full_stars );
$output .= str_repeat( '<div class="abr-star abr-star-half" aria-hidden="true"></div>', $half_stars );
$output .= str_repeat( '<div class="abr-star abr-star-empty" aria-hidden="true"></div>', $empty_stars );
$output .= '</div>';
if ( $r['echo'] ) {
echo (string) $output; // XSS.
}
return $output;
}
}
if ( ! function_exists( 'abr_review_display_rating' ) ) {
/**
* Display review rating info
*
* @param string $type The type of review.
* @param float $max The max value.
* @param float $value The value.
* @param string $name The name.
* @param bool $label Display label.
*/
function abr_review_display_rating( $type, $max, $value, $name = null, $label = true ) {
switch ( $type ) {
case 'star':
$value = ( $value <= $max ) ? round( $value, 1 ) : $max;
break;
case 'point-5':
case 'point-10':
case 'percentage':
$value = ( $value <= $max ) ? round( $value ) : $max;
break;
}
// Get indicators.
$indicators = abr_list_indicators();
// Set value index.
$val_index = abr_review_get_val_index( $type, $value );
?>
<div class="abr-review-data">
<?php if ( $name ) { ?>
<div class="abr-review-name">
<?php echo esc_html( $name ); ?>
</div>
<?php } ?>
<?php if ( 'star' === $type ) : ?>
<div class="abr-review-stars">
<?php
abr_review_star_rating( array(
'rating' => $value,
'type' => 'rating',
'number' => 0,
) );
?>
</div>
<?php elseif ( 'point-5' === $type || 'point-10' === $type ) : ?>
<div class="abr-review-line">
<?php
$max_slice = 'point-5' === $type ? 5 : 10;
for ( $index = 1; $index <= $max_slice; $index++ ) {
if ( $index <= $value ) {
$class = 'abr-review-slice-active';
} else {
$class = 'abr-review-slice-no-active';
}
?>
<span class="abr-review-slice <?php echo esc_attr( $class ); ?>"></span>
<?php
}
?>
</div>
<?php elseif ( 'percentage' === $type ) : ?>
<div class="abr-review-progress">
<div class="abr-review-progressbar abr-review-progressbar-<?php echo esc_attr( $val_index ); ?>"></div>
</div>
<?php endif; ?>
<?php if ( $label ) { ?>
<div class="abr-review-label">
<span class="abr-review-text">
<?php
echo wp_kses_post( sprintf( '<span class="total">%s</span><span class="sep">/</span><span class="max">%s</span>', $value, $max ) );
?>
</span>
<?php if ( $indicators && $indicators[ $val_index ]['name'] ) { ?>
<span class="abr-badge abr-badge-primary abr-review-badge-<?php echo esc_attr( $val_index ); ?>">
<?php echo esc_html( $indicators[ $val_index ]['name'] ); ?>
</span>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
}
}
if ( ! function_exists( 'abr_review_display_block' ) ) {
/**
* Display review rating
*
* @param array $params The params of review.
*/
function abr_review_display_block( $params ) {
$params = array_merge( array(
'variant' => 'default',
'type' => 'percentage',
'items' => array(),
'heading' => '',
'desc' => '',
'main_scale' => true,
'total_label' => esc_html__( 'Total Score', 'absolute-reviews' ),
'total_score_number' => '',
'pros_heading' => '',
'pros_items' => array(),
'cons_heading' => '',
'cons_items' => array(),
'legend' => '',
'schema_heading' => '',
'schema_desc' => '',
'schema_author' => '',
'schema_author_custom' => '',
), $params );
// Vars.
switch ( $params['type'] ) {
case 'percentage':
$max = 100;
break;
case 'point-5':
$max = 5;
break;
case 'point-10':
$max = 10;
break;
case 'star':
$max = 5;
break;
}
// Get indicators.
$indicators = abr_list_indicators();
?>
<div class="abr-post-review abr-review-<?php echo esc_attr( $params['variant'] ); ?> abr-review-<?php echo esc_attr( $params['type'] ); ?>" itemprop="reviews" itemscope itemtype="http://schema.org/Review">
<div class="abr-review-author" itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name">
<?php echo esc_html( 'custom' === $params['schema_author'] ? $params['schema_author_custom'] : $params['schema_author'] ); ?>
</span>
</div>
<!-- Info -->
<?php if ( $params['heading'] || $params['desc'] ) { ?>
<div class="abr-review-info">
<div class="abr-review-heading" itemprop="itemReviewed" itemscope itemtype="http://schema.org/Product">
<?php
// Review title.
if ( $params['heading'] ) {
?>
<h3 class="abr-title abr-review-title"><?php echo esc_html( $params['heading'] ); ?></h3>
<?php
}
if ( $params['heading'] || $params['schema_heading'] ) {
$heading = $params['schema_heading'] ? $params['schema_heading'] : $params['heading'];
?>
<span class="abr-review-scheme-hidden" itemprop="name"><?php echo esc_html( $heading ); ?></span>
<?php
}
?>
<div class="abr-review-scheme-hidden" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<span itemprop="ratingValue"><?php echo esc_html( $params['total_score_number'] ); ?></span>
<span itemprop="bestRating"><?php echo esc_html( $max ); ?></span>
<span itemprop="worstRating"><?php echo esc_html( 0 ); ?></span>
<span itemprop="reviewCount"><?php echo esc_html( 1 ); ?></span>
</div>
</div>
<?php
// Review desc.
if ( $params['desc'] ) {
?>
<div class="abr-review-description" itemprop="reviewBody"><?php echo wp_kses( $params['desc'], 'post' ); ?></div>
<?php
}
if ( $params['desc'] || $params['schema_desc'] ) {
$desc = $params['schema_desc'] ? $params['schema_desc'] : $params['desc'];
?>
<div class="abr-review-scheme-hidden" itemprop="reviewBody"><?php echo wp_kses( $desc, 'post' ); ?></div>
<?php
}
?>
</div>
<?php } ?>
<!-- Review Total -->
<div class="abr-review-total">
<?php
$total_score = (float) $params['total_score_number'];
if ( $total_score ) {
if ( ! $params['main_scale'] && $params['items'] ) {
?>
<div class="abr-review-list">
<ul>
<?php
if ( isset( $params['items']['name'] ) && $params['items']['name'] ) {
foreach ( $params['items']['name'] as $key => $item_name ) {
$item_desc = (string) $params['items']['desc'][ $key ];
$item_value = (float) $params['items']['val'][ $key ];
if ( ! $item_name ) {
continue;
}
?>
<li class="abr-review-item">
<?php abr_review_display_rating( $params['type'], $max, $item_value, $item_name ); ?>
<div class="abr-review-desc">
<?php echo esc_html( $item_desc ); ?>
</div>
</li>
<?php
}
}
?>
</ul>
</div>
<?php
}
if ( $params['main_scale'] ) {
abr_review_display_rating( $params['type'], $max, $total_score, null, false );
}
?>
<div class="abr-review-score <?php echo esc_html( ! $params['total_label'] ? 'abr-review-score-row' : '' ); ?>" itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<div class="abr-review-text">
<?php
echo wp_kses( sprintf( '<span class="total" itemprop="ratingValue">%s</span><span class="sep">/</span><span class="max" itemprop="bestRating">%s</span>', $total_score, $max ), array(
'span' => array(
'class' => true,
'itemprop' => true,
),
) );
?>
</div>
<?php if ( $params['total_label'] || $params['legend'] ) { ?>
<div class="abr-review-subtext">
<?php if ( $params['total_label'] ) { ?>
<span class="abr-data-label"><?php echo esc_html( $params['total_label'] ); ?></span>
<?php } ?>
<?php if ( $params['legend'] ) { ?>
<span class="abr-data-info">i<span><?php echo wp_kses_post( $params['legend'] ); ?></span></span>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
}
?>
</div>
<!-- Review Indicator -->
<?php
if ( 'block' === $params['variant'] ) {
// Set value index.
$val_index = abr_review_get_val_index( $params['type'], $total_score );
if ( $indicators && $indicators[ $val_index ]['name'] ) {
?>
<div class="abr-review-indicator">
<span class="abr-badge abr-badge-primary abr-review-badge-<?php echo esc_attr( $val_index ); ?>">
<?php echo esc_html( $indicators[ $val_index ]['name'] ); ?>
</span>
</div>
<?php
}
}
?>
<!-- Items List -->
<?php if ( $params['items'] && $params['main_scale'] ) { ?>
<div class="abr-review-list">
<ul>
<?php
if ( isset( $params['items']['name'] ) && $params['items']['name'] ) {
foreach ( $params['items']['name'] as $key => $item_name ) {
$item_desc = (string) $params['items']['desc'][ $key ];
$item_value = (float) $params['items']['val'][ $key ];
if ( ! $item_name ) {
continue;
}
?>
<li class="abr-review-item">
<?php abr_review_display_rating( $params['type'], $max, $item_value, $item_name ); ?>
<div class="abr-review-desc">
<?php echo esc_html( $item_desc ); ?>
</div>
</li>
<?php
}
}
?>
</ul>
</div>
<?php } ?>
<!-- Items Pros / Cons -->
<?php if ( $params['pros_items'] || $params['cons_items'] ) { ?>
<div class="abr-review-details">
<?php
if ( $params['pros_items'] ) {
$params['pros_heading'] = $params['pros_heading'] ? $params['pros_heading'] : esc_html__( 'The Good', 'absolute-reviews' );
?>
<div class="abr-review-items abr-review-pros">
<div class="abr-review-title">
<h3 class="abr-title"><?php echo esc_html( $params['pros_heading'] ); ?></h3>
</div>
<ul>
<?php
if ( isset( $params['pros_items']['name'] ) && $params['pros_items']['name'] ) {
foreach ( $params['pros_items']['name'] as $key => $name ) {
?>
<li><?php echo esc_attr( $params['pros_items']['name'][ $key ] ); ?></li>
<?php
}
}
?>
</ul>
</div>
<?php } ?>
<?php
if ( $params['cons_items'] ) {
$params['cons_heading'] = $params['cons_heading'] ? $params['cons_heading'] : esc_html__( 'The Bad', 'absolute-reviews' );
?>
<div class="abr-review-items abr-review-cons">
<div class="abr-review-title">
<h3 class="abr-title"><?php echo esc_html( $params['cons_heading'] ); ?></h3>
</div>
<ul>
<?php
if ( isset( $params['cons_items']['name'] ) && $params['cons_items']['name'] ) {
foreach ( $params['cons_items']['name'] as $key => $name ) {
?>
<li class="abr-item"><?php echo esc_attr( $params['cons_items']['name'][ $key ] ); ?></li>
<?php
}
}
?>
</ul>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
}
}
if ( ! function_exists( 'abr_reviews_posts_widget_handler' ) ) {
/**
* Widget template handler
*
* @param string $name Specific template.
* @param array $posts Array of posts.
* @param array $params Array of params.
* @param array $instance Widget instance.
*/
function abr_reviews_posts_widget_handler( $name, $posts, $params, $instance ) {
$templates = apply_filters( 'abr_reviews_posts_templates', array() );
if ( isset( $templates[ $name ] ) && function_exists( $templates[ $name ]['func'] ) ) {
call_user_func( $templates[ $name ]['func'], $posts, $params, $instance );
} else {
call_user_func( 'abr_reviews_posts_template', $posts, $params, $instance );
}
}
}
/**
* Convert Block Post Meta
*
* @param array $settings Settings of block.
* @param string $prefix The prefix.
*/
function abr_block_convert_post_meta( $settings, $prefix ) {
$meta = array();
$list = array(
'category' => 'showMetaCategory',
'author' => 'showMetaAuthor',
'date' => 'showMetaDate',
'comments' => 'showMetaComments',
'views' => 'showMetaViews',
'reading_time' => 'showMetaReadingTime',
);
$list = apply_filters( 'abr_convert_post_meta', $list, $settings, $prefix );
foreach ( $list as $key => $alt ) {
if ( isset( $settings[ $prefix . '_' . $alt ] ) && $settings[ $prefix . '_' . $alt ] ) {
$meta[] = $key;
}
}
return $meta;
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,358 @@
<?php
/**
* Post Meta Helper Functions
*
* These helper functions return post meta.
*
* @package abr
* @subpackage Core
* @version 1.0.0
* @since 1.0.0
*/
if ( ! function_exists( 'abr_allowed_post_meta' ) ) {
/**
* Allowed Post Meta
*
* @param bool $compact If compact version shall be displayed.
* @param array $exclude Exclude list.
*/
function abr_allowed_post_meta( $compact = false, $exclude = array() ) {
$allowed = array(
'category' => esc_html__( 'Category', 'canvas' ),
'date' => esc_html__( 'Date', 'canvas' ),
'author' => esc_html__( 'Author', 'canvas' ),
'comments' => esc_html__( 'Comments count', 'canvas' ),
);
if ( abr_post_views_enabled() ) {
$allowed['views'] = esc_html__( 'Views', 'canvas' );
}
if ( abr_powerkit_module_enabled( 'reading_time' ) ) {
$allowed['reading_time'] = esc_html__( 'Reading time', 'canvas' );
}
$allowed = apply_filters( 'abr_allowed_post_meta', $allowed );
// Computes the difference of arrays.
$allowed = array_diff_key( $allowed, array_flip( (array) $exclude ) );
// If compact.
if ( $compact ) {
return array_keys( $allowed );
}
return $allowed;
}
}
if ( ! function_exists( 'abr_block_post_meta' ) ) {
/**
* Block Post Meta
*
* A wrapper function that returns all post meta types either
* in an ordered list <ul> or as a single element <span>.
*
* @param array $settings Settings of block.
* @param mixed $meta Contains post meta types.
* @param bool $echo Echo or return.
* @param bool $compact If meta compact.
*/
function abr_block_post_meta( $settings, $meta, $echo = true, $compact = false ) {
$func_handler = apply_filters( 'abr_get_block_post_meta_handler', false );
if ( $func_handler ) {
return call_user_func( $func_handler, $settings, $meta, $echo, $compact );
}
$allowed = array();
if ( isset( $settings['showMetaCategory'] ) && $settings['showMetaCategory'] ) {
$allowed[] = 'category';
}
if ( isset( $settings['showMetaAuthor'] ) && $settings['showMetaAuthor'] ) {
$allowed[] = 'author';
}
if ( isset( $settings['showMetaDate'] ) && $settings['showMetaDate'] ) {
$allowed[] = 'date';
}
if ( isset( $settings['showMetaComments'] ) && $settings['showMetaComments'] ) {
$allowed[] = 'comments';
}
if ( isset( $settings['showMetaViews'] ) && $settings['showMetaViews'] ) {
$allowed[] = 'views';
}
if ( isset( $settings['showMetaReadingTime'] ) && $settings['showMetaReadingTime'] ) {
$allowed[] = 'reading_time';
}
if ( isset( $settings['metaCompact'] ) && $settings['metaCompact'] ) {
$compact = true;
}
$allowed = apply_filters( 'abr_allowed_block_post_meta', $allowed, $settings, $meta, $echo, $compact );
if ( ! $allowed ) {
return;
}
abr_get_post_meta( $meta, $compact, $echo, $allowed );
}
}
if ( ! function_exists( 'abr_get_post_meta' ) ) {
/**
* Post Meta
*
* A wrapper function that returns all post meta types either
* in an ordered list <ul> or as a single element <span>.
*
* @param mixed $meta Contains post meta types.
* @param bool $compact If compact version shall be displayed.
* @param bool $echo Echo or return.
* @param array $allowed Allowed meta types.
* @param array $settings The advanced settings.
*/
function abr_get_post_meta( $meta, $compact = false, $echo = true, $allowed = array(), $settings = array() ) {
$func_handler = apply_filters( 'abr_get_post_meta_handler', false );
if ( $func_handler ) {
return call_user_func( $func_handler, $meta, $compact, $echo, $allowed, $settings );
}
// Return if no post meta types provided.
if ( ! $meta ) {
return;
}
// Set default allowed post meta types.
if ( ! $allowed ) {
$allowed = abr_allowed_post_meta();
}
if ( is_array( $meta ) ) {
// Intersect provided and allowed meta types.
$meta = array_intersect( $allowed, $meta );
}
$output = null;
if ( $meta && is_array( $meta ) ) {
$output .= '<ul class="abr-post-meta post-meta">';
// Add normal meta types to the list.
foreach ( $meta as $type ) {
$function = "abr_get_meta_$type";
if ( function_exists( $function ) ) {
$output .= $function( 'li', $compact );
}
}
$output .= '</ul>';
} else {
if ( in_array( $meta, $allowed, true ) ) {
// Output single meta type.
$function = "abr_get_meta_$meta";
if ( function_exists( $function ) ) {
$output .= $function( 'div', $compact );
}
}
}
if ( $echo ) {
echo (string) $output; // XSS ok.
} else {
return $output;
}
}
}
if ( ! function_exists( 'abr_get_meta_date' ) ) {
/**
* Post Date
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
*/
function abr_get_meta_date( $tag = 'span', $compact = false ) {
$output = '<' . esc_html( $tag ) . ' class="abr-meta-date meta-date">';
if ( false === $compact ) {
$time_string = get_the_date();
} else {
$time_string = get_the_date( 'd.m.y' );
}
$output .= apply_filters( 'abr_post_meta_date_output', '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' );
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
if ( ! function_exists( 'abr_get_meta_author' ) ) {
/**
* Post Author
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
*/
function abr_get_meta_author( $tag = 'span', $compact = false ) {
$authors = array( get_the_author_meta( 'ID' ) );
$output = '<' . esc_html( $tag ) . ' class="abr-meta-author meta-author">';
$output .= sprintf(
'<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
/* translators: %s: author name */
esc_attr( sprintf( __( 'View all posts by %s', 'absolute-reviews' ), get_the_author() ) ),
// Author.
get_the_author()
);
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
if ( ! function_exists( 'abr_get_meta_category' ) ) {
/**
* Post Сategory
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
* @param int $post_id Post ID.
*/
function abr_get_meta_category( $tag = 'span', $compact = false, $post_id = null ) {
if ( ! $post_id ) {
$post_id = get_the_ID();
}
$output = '<' . esc_html( $tag ) . ' class="abr-meta-category meta-category">';
$output .= get_the_category_list( '', '', $post_id );
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
if ( ! function_exists( 'abr_get_meta_comments' ) ) {
/**
* Post Comments
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
*/
function abr_get_meta_comments( $tag = 'span', $compact = false ) {
$output = '';
$output .= '<' . esc_html( $tag ) . ' class="abr-meta-comments meta-comments">';
if ( true === $compact ) {
$output .= '<i class="abr-icon abr-icon-comment"></i>';
ob_start();
comments_popup_link( '0', '1', '%', 'comments-link', '' );
$output .= ob_get_clean();
} else {
ob_start();
comments_popup_link( esc_html__( 'No comments', 'absolute-reviews' ), esc_html__( 'One comment', 'absolute-reviews' ), '% ' . esc_html__( 'comments', 'absolute-reviews' ), 'comments-link', '' );
$output .= ob_get_clean();
}
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
if ( ! function_exists( 'abr_get_meta_reading_time' ) ) {
/**
* Post Reading Time
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
*/
function abr_get_meta_reading_time( $tag = 'span', $compact = false ) {
if ( ! function_exists( 'powerkit_module_enabled' ) || ! powerkit_module_enabled( 'reading_time' ) ) {
return;
}
$reading_time = powerkit_get_post_reading_time();
$output = '<' . esc_html( $tag ) . ' class="abr-meta-reading-time meta-reading-time">';
if ( true === $compact ) {
$output .= '<i class="abr-icon abr-icon-watch"></i>' . intval( $reading_time ) . ' ' . esc_html( 'min', 'absolute-reviews' );
} else {
/* translators: %s number of minutes */
$output .= esc_html( sprintf( _n( '%s minute read', '%s minute read', $reading_time, 'absolute-reviews' ), $reading_time ) );
}
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
if ( ! function_exists( 'abr_get_meta_views' ) ) {
/**
* Post Reading Time
*
* @param string $tag Element tag, i.e. div or span.
* @param bool $compact If compact version shall be displayed.
*/
function abr_get_meta_views( $tag = 'span', $compact = false ) {
switch ( abr_post_views_enabled() ) {
case 'post_views':
$views = pvc_get_post_views();
break;
case 'pk_post_views':
$views = powerkit_get_post_views( null, false );
break;
default:
return;
}
// Don't display if minimum threshold is not met.
if ( $views < apply_filters( 'abr_post_minimum_views', 1 ) ) {
return;
}
$output = '<' . esc_html( $tag ) . ' class="abr-meta-views meta-views">';
$views_rounded = powerkit_get_round_number( $views );
if ( true === $compact ) {
$output .= '<i class="abr-icon abr-icon-eye"></i>' . esc_html( $views_rounded );
} else {
/* translators: %s number of post views */
$output .= esc_html( sprintf( _n( '%s view', '%s views', $views, 'absolute-reviews' ), $views_rounded ) );
}
$output .= '</' . esc_html( $tag ) . '>';
return $output;
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,464 @@
# Copyright (C) 2022 absolute-reviews
# This file is distributed under the same license as the absolute-reviews package.
msgid ""
msgstr ""
"Project-Id-Version: absolute-reviews\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: Code Supply Co. <hello@codesupply.co>\n"
"Last-Translator: Code Supply Co. <hello@codesupply.co>\n"
"Report-Msgid-Bugs-To: https://codesupply.co/contact/\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SourceCharset: UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: admin/class-absolute-reviews-admin.php:57, admin/class-absolute-reviews-admin.php:57, public/class-absolute-reviews-block.php:51
msgid "Reviews"
msgstr ""
#: admin/class-absolute-reviews-admin.php:68
msgid "You do not have sufficient rights to view this page."
msgstr ""
#: admin/class-absolute-reviews-admin.php:77
msgid "Reviews Settings"
msgstr ""
#: admin/class-absolute-reviews-admin.php:81
msgid "Indicators of the progress bar"
msgstr ""
#: admin/class-absolute-reviews-admin.php:89
msgid "Indicator"
msgstr ""
#: admin/class-absolute-reviews-admin.php:90
msgid "Default:"
msgstr ""
#: admin/class-absolute-reviews-admin.php:93
msgid "Label"
msgstr ""
#: admin/class-absolute-reviews-admin.php:99
msgid "Disable all indicators on the front end"
msgstr ""
#: admin/class-absolute-reviews-admin.php:108
msgid "Supported Post Types"
msgstr ""
#: admin/class-absolute-reviews-admin.php:114
msgid "Enable reviews for the following post types"
msgstr ""
#: admin/class-absolute-reviews-admin.php:148
msgid "Save changes"
msgstr ""
#: admin/class-absolute-reviews-admin.php:187
msgid "Settings saved."
msgstr ""
#: admin/class-absolute-reviews-admin.php:199
msgid "Review Options"
msgstr ""
#: admin/class-absolute-reviews-admin.php:242
msgid "Enable Review"
msgstr ""
#: admin/class-absolute-reviews-admin.php:247
msgid "General"
msgstr ""
#: admin/class-absolute-reviews-admin.php:248
msgid "Criteria"
msgstr ""
#: admin/class-absolute-reviews-admin.php:249
msgid "Pros / Cons"
msgstr ""
#: admin/class-absolute-reviews-admin.php:250, public/class-absolute-reviews-block.php:71
msgid "Schema Attributes"
msgstr ""
#: admin/class-absolute-reviews-admin.php:256, public/class-absolute-reviews-block.php:162, public/class-absolute-reviews-posts-block.php:451
msgid "Heading"
msgstr ""
#: admin/class-absolute-reviews-admin.php:264, admin/class-absolute-reviews-admin.php:342, admin/class-absolute-reviews-admin.php:343, admin/class-absolute-reviews-admin.php:378, admin/class-absolute-reviews-admin.php:379, public/class-absolute-reviews-block.php:169
msgid "Description"
msgstr ""
#: admin/class-absolute-reviews-admin.php:272, public/class-absolute-reviews-block.php:176
msgid "Legend"
msgstr ""
#: admin/class-absolute-reviews-admin.php:280
msgid "Type"
msgstr ""
#: admin/class-absolute-reviews-admin.php:284, public/class-absolute-reviews-block.php:81, public/class-absolute-reviews-posts-block.php:255, public/class-absolute-reviews-posts-widget.php:248
msgid "Percentage (1-100%)"
msgstr ""
#: admin/class-absolute-reviews-admin.php:285, public/class-absolute-reviews-block.php:101, public/class-absolute-reviews-posts-block.php:256, public/class-absolute-reviews-posts-widget.php:249
msgid "Points (1-5)"
msgstr ""
#: admin/class-absolute-reviews-admin.php:286, public/class-absolute-reviews-block.php:121, public/class-absolute-reviews-posts-block.php:257, public/class-absolute-reviews-posts-widget.php:250
msgid "Points (1-10)"
msgstr ""
#: admin/class-absolute-reviews-admin.php:287, public/class-absolute-reviews-block.php:140, public/class-absolute-reviews-posts-block.php:258, public/class-absolute-reviews-posts-widget.php:251
msgid "Stars (1-5)"
msgstr ""
#: admin/class-absolute-reviews-admin.php:293
msgid "Main Scale"
msgstr ""
#: admin/class-absolute-reviews-admin.php:301
msgid "Auto Сalculate Total Score"
msgstr ""
#: admin/class-absolute-reviews-admin.php:309, includes/helpers-absolute-reviews.php:576, public/class-absolute-reviews-block.php:89, public/class-absolute-reviews-block.php:109, public/class-absolute-reviews-block.php:129, public/class-absolute-reviews-block.php:148, public/class-absolute-reviews-block.php:186
msgid "Total Score"
msgstr ""
#: admin/class-absolute-reviews-admin.php:324, admin/class-absolute-reviews-admin.php:360
msgid "Remove"
msgstr ""
#: admin/class-absolute-reviews-admin.php:325, admin/class-absolute-reviews-admin.php:361
msgid "Click to toggle"
msgstr ""
#: admin/class-absolute-reviews-admin.php:326, admin/class-absolute-reviews-admin.php:333, admin/class-absolute-reviews-admin.php:362, admin/class-absolute-reviews-admin.php:369
msgid "Criterion"
msgstr ""
#: admin/class-absolute-reviews-admin.php:332, admin/class-absolute-reviews-admin.php:333, admin/class-absolute-reviews-admin.php:368, admin/class-absolute-reviews-admin.php:369, admin/class-absolute-reviews-admin.php:422, admin/class-absolute-reviews-admin.php:446, admin/class-absolute-reviews-admin.php:492, admin/class-absolute-reviews-admin.php:516
msgid "Name"
msgstr ""
#: admin/class-absolute-reviews-admin.php:337, admin/class-absolute-reviews-admin.php:373
msgid "Value"
msgstr ""
#: admin/class-absolute-reviews-admin.php:393
msgid "Add new criterion"
msgstr ""
#: admin/class-absolute-reviews-admin.php:399
msgid "Pros Heading"
msgstr ""
#: admin/class-absolute-reviews-admin.php:402, includes/helpers-absolute-reviews.php:787
msgid "The Good"
msgstr ""
#: admin/class-absolute-reviews-admin.php:407
msgid "Pros List"
msgstr ""
#: admin/class-absolute-reviews-admin.php:422, admin/class-absolute-reviews-admin.php:446, admin/class-absolute-reviews-admin.php:492, admin/class-absolute-reviews-admin.php:516
msgid "Item"
msgstr ""
#: admin/class-absolute-reviews-admin.php:462
msgid "Add new pros item"
msgstr ""
#: admin/class-absolute-reviews-admin.php:469
msgid "Cons Heading"
msgstr ""
#: admin/class-absolute-reviews-admin.php:472, includes/helpers-absolute-reviews.php:811
msgid "The Bad"
msgstr ""
#: admin/class-absolute-reviews-admin.php:477
msgid "Cons List"
msgstr ""
#: admin/class-absolute-reviews-admin.php:532
msgid "Add new cons item"
msgstr ""
#: admin/class-absolute-reviews-admin.php:540
msgid "Item Reviewed"
msgstr ""
#: admin/class-absolute-reviews-admin.php:541
msgid "Heading will be used if blank."
msgstr ""
#: admin/class-absolute-reviews-admin.php:549
msgid "Review Text"
msgstr ""
#: admin/class-absolute-reviews-admin.php:550
msgid "Description will be used if blank."
msgstr ""
#: admin/class-absolute-reviews-admin.php:558
msgid "Review Author"
msgstr ""
#: admin/class-absolute-reviews-admin.php:602
msgid "Custom"
msgstr ""
#: admin/class-absolute-reviews-admin.php:608, public/class-absolute-reviews-block.php:190
msgid "Custom Author"
msgstr ""
#. translators: %s: author name
#: includes/post-meta.php:224
msgid "View all posts by %s"
msgstr ""
#: includes/post-meta.php:278
msgid "No comments"
msgstr ""
#: includes/post-meta.php:278
msgid "One comment"
msgstr ""
#: includes/post-meta.php:278
msgid "comments"
msgstr ""
#. translators: %s number of minutes
#: includes/post-meta.php:309
msgid "%s minute read"
msgid_plural "%s minute read"
msgstr[0] ""
msgstr[1] ""
#. translators: %s number of post views
#: includes/post-meta.php:351
msgid "%s view"
msgid_plural "%s views"
msgstr[0] ""
msgstr[1] ""
#: public/class-absolute-reviews-block.php:52
msgid "The block allows you to display images from your review account."
msgstr ""
#: public/class-absolute-reviews-block.php:66, public/class-absolute-reviews-posts-block.php:202
msgid "Block Settings"
msgstr ""
#: public/class-absolute-reviews-block.php:75, public/class-absolute-reviews-posts-block.php:219
msgid "Typography Settings"
msgstr ""
#: public/class-absolute-reviews-block.php:183
msgid "Total Score Label"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:137, public/class-absolute-reviews-public.php:92
msgid "Reviews 1"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:139, public/class-absolute-reviews-public.php:96
msgid "Reviews 2"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:141, public/class-absolute-reviews-public.php:100
msgid "Reviews 3"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:143, public/class-absolute-reviews-public.php:104
msgid "Reviews 4"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:145, public/class-absolute-reviews-public.php:108
msgid "Reviews 5"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:147, public/class-absolute-reviews-public.php:112
msgid "Reviews 6"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:149, public/class-absolute-reviews-public.php:116
msgid "Reviews 7"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:151, public/class-absolute-reviews-public.php:120
msgid "Reviews 8"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:207
msgid "Large Post Meta Settings"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:211
msgid "Small Post Meta Settings"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:215
msgid "Thumbnail Settings"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:249
msgid "Filter by Review Type"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:254, public/class-absolute-reviews-posts-widget.php:247
msgid "All types"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:264
msgid "Posts Count"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:273
msgid "Image Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:298
msgid "Large Post Image Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:325
msgid "Small Post Image Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:353
msgid "Heading Font Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:384
msgid "Heading Post Large Font Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:417
msgid "Heading Post Small Font Size"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:465
msgid "Heading Hover"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:479
msgid "Post Meta"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:493
msgid "Post Meta Links"
msgstr ""
#: public/class-absolute-reviews-posts-block.php:507
msgid "Post Meta Links Hover"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:48
msgid "Display a list of your reviews posts."
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:50
msgid "Reviews Posts"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:219
msgid "Title:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:227
msgid "Template:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:240
msgid "Number of posts:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:245
msgid "Filter by Review Type:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:257
msgid "Order by:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:259
msgid "Date"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:260
msgid "Comments"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:261
msgid "Random"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:264
msgid "Views"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:271
msgid "Order"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:273
msgid "Descending"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:274
msgid "Ascending"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:279
msgid "Time frame:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:280
msgid "3 months"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:284
msgid "Category:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:309, public/class-absolute-reviews-posts-widget.php:337, public/class-absolute-reviews-posts-widget.php:365
msgid "Image size:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:320, public/class-absolute-reviews-posts-widget.php:348, public/class-absolute-reviews-posts-widget.php:376
msgid "Post meta:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:328, public/class-absolute-reviews-posts-widget.php:356, public/class-absolute-reviews-posts-widget.php:384
msgid "Compact post meta:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:330, public/class-absolute-reviews-posts-widget.php:358, public/class-absolute-reviews-posts-widget.php:386
msgid "Display compact post meta"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:334
msgid "Large Post"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:362
msgid "Small Post"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:390
msgid "Avoid duplicate posts:"
msgstr ""
#: public/class-absolute-reviews-posts-widget.php:392
msgid "Exclude duplicate posts"
msgstr ""
@@ -0,0 +1,57 @@
<?php
/**
* Review block template
*
* @var $attributes - block attributes
* @var $options - layout options
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/includes
*/
switch ( $attributes['layout'] ) {
case 'percentage':
$total_score = $options['total_score_percentage'];
break;
case 'point-5':
$total_score = $options['total_score_point_5'];
break;
case 'point-10':
$total_score = $options['total_score_point_10'];
break;
case 'star':
$total_score = $options['total_score_star'];
break;
default:
$total_score = 0;
break;
}
$params = array(
'variant' => 'block',
'type' => $attributes['layout'],
'heading' => $attributes['heading'],
'desc' => $attributes['desc'],
'legend' => $attributes['legend'],
'total_label' => $attributes['total_score_label'],
'total_score_number' => $total_score,
'main_scale' => true,
'auto_score' => false,
);
$params['schema_author'] = get_post_meta( get_queried_object_id(), '_abr_review_schema_author', true );
$params['schema_author_custom'] = get_post_meta( get_queried_object_id(), '_abr_review_schema_author_custom', true );
if ( isset( $attributes['schema_author_custom'] ) && $attributes['schema_author_custom'] ) {
$params['schema_author'] = 'custom';
$params['schema_author_custom'] = $attributes['schema_author_custom'];
}
echo '<div class="' . esc_attr( $attributes['className'] ) . '" ' . ( isset( $attributes['anchor'] ) ? ' id="' . esc_attr( $attributes['anchor'] ) . '"' : '' ) . '>';
abr_review_display_block( $params );
echo '</div>';
@@ -0,0 +1,261 @@
<?php
/**
* The Gutenberg Block.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/includes
*/
/**
* The initialize block.
*/
class ABR_Review_Block {
/**
* Initialize
*/
public function __construct() {
add_action( 'init', array( $this, 'block' ) );
add_filter( 'canvas_register_block_type', array( $this, 'register_block_type' ) );
}
/**
* Enqueue the block's assets for the editor.
*/
public function block() {
// Styles.
wp_register_style(
'absolute-reviews-block-editor-style',
ABR_URL . 'public/css/absolute-reviews-public.css',
array( 'wp-edit-blocks' ),
filemtime( ABR_PATH . 'public/css/absolute-reviews-public.css' )
);
wp_style_add_data( 'absolute-reviews-block-editor-style', 'rtl', 'replace' );
}
/**
* Register block
*
* @param array $blocks all registered blocks.
* @return array
*/
public function register_block_type( $blocks ) {
// Add block.
$blocks[] = array(
'name' => 'canvas/absolute-reviews',
'title' => esc_html__( 'Reviews', 'absolute-reviews' ),
'description' => esc_html__( 'The block allows you to display images from your review account.', 'absolute-reviews' ),
'category' => 'canvas',
'keywords' => array(),
'icon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path d="M10 1l3 6 6 .75-4.12 4.62L16 19l-6-3-6 3 1.13-6.63L1 7.75 7 7z"/></g></svg>',
'supports' => array(
'className' => true,
'anchor' => true,
'html' => false,
'canvasSpacings' => true,
),
'styles' => array(),
'location' => array(),
'sections' => array(
'general' => array(
'title' => esc_html__( 'Block Settings', 'absolute-reviews' ),
'priority' => 5,
'open' => true,
),
'schema_attrs' => array(
'title' => esc_html__( 'Schema Attributes', 'absolute-reviews' ),
'priority' => 10,
),
'typography' => array(
'title' => esc_html__( 'Typography Settings', 'absolute-reviews' ),
'priority' => 10,
),
),
'layouts' => array(
'percentage' => array(
'name' => esc_html__( 'Percentage (1-100%)', 'absolute-reviews' ),
'icon' => '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><path d="M19 19.429h18.286M19 16h24m-24-3.429h20.571M7 30.429h33.75M7 27h31.5M7 23.571h36" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/><path fill="#2D2D2D" d="M7 12h8v8H7z"/><path d="M13 19a1 1 0 110-2 1 1 0 010 2zm-4-4a1 1 0 110-2 1 1 0 010 2zm4.5-2l.5.5L8.5 19l-.5-.5 5.5-5.5z" fill="#FFF" fill-rule="nonzero"/></g></svg>',
'location' => array(),
'template' => dirname( __FILE__ ) . '/block/render.php',
'sections' => array(),
'fields' => array(
array(
'key' => 'total_score_percentage',
'label' => esc_html__( 'Total Score', 'absolute-reviews' ),
'section' => 'general',
'type' => 'number',
'step' => 1,
'min' => 1,
'max' => 100,
'default' => 50,
),
),
),
'point-5' => array(
'name' => esc_html__( 'Points (1-5)', 'absolute-reviews' ),
'icon' => '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"><path d="M7 25.5h27m-27-4h36m-36-4h31M7 29.571h36"/></g><path fill="#2D2D2D" d="M7 12h5v2H7zM13 12h5v2h-5zM19 12h5v2h-5zM25 12h5v2h-5z"/><path fill="#C7C7C7" d="M31 12h5v2h-5zM37 12h5v2h-5z"/></g></svg>',
'location' => array(),
'template' => dirname( __FILE__ ) . '/block/render.php',
'sections' => array(),
'fields' => array(
array(
'key' => 'total_score_point_5',
'label' => esc_html__( 'Total Score', 'absolute-reviews' ),
'section' => 'general',
'type' => 'number',
'step' => 1,
'min' => 1,
'max' => 5,
'default' => 1,
),
),
),
'point-10' => array(
'name' => esc_html__( 'Points (1-10)', 'absolute-reviews' ),
'icon' => '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"><path d="M7 25.5h27m-27-4h36m-36-4h31M7 29.571h36"/></g><path fill="#2D2D2D" d="M7 12h5v2H7zM13 12h5v2h-5zM19 12h5v2h-5zM25 12h5v2h-5z"/><path fill="#C7C7C7" d="M31 12h5v2h-5zM37 12h5v2h-5z"/></g></svg>',
'location' => array(),
'template' => dirname( __FILE__ ) . '/block/render.php',
'sections' => array(),
'fields' => array(
array(
'key' => 'total_score_point_10',
'label' => esc_html__( 'Total Score', 'absolute-reviews' ),
'section' => 'general',
'type' => 'number',
'step' => 1,
'min' => 1,
'max' => 10,
'default' => 1,
),
),
),
'star' => array(
'name' => esc_html__( 'Stars (1-5)', 'absolute-reviews' ),
'icon' => '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><path d="M19 19.429h18.286M19 16h24m-24-3.429h20.571M7 30.429h33.75M7 27h31.5M7 23.571h36" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/><path fill="#2D2D2D" d="M7 12h8v8H7z"/><path d="M11 13.143l.883 1.88 1.974.304-1.428 1.463.337 2.067L11 17.881l-1.766.976.337-2.067-1.428-1.463 1.974-.303z" fill="#FFF"/></g></svg>',
'location' => array(),
'template' => dirname( __FILE__ ) . '/block/render.php',
'sections' => array(),
'fields' => array(
array(
'key' => 'total_score_star',
'label' => esc_html__( 'Total Score', 'absolute-reviews' ),
'section' => 'general',
'type' => 'number',
'step' => 1,
'min' => 1,
'max' => 5,
'default' => 1,
),
),
),
),
'fields' => array(
array(
'key' => 'heading',
'label' => esc_html__( 'Heading', 'absolute-reviews' ),
'section' => 'general',
'type' => 'text',
'default' => '',
),
array(
'key' => 'desc',
'label' => esc_html__( 'Description', 'absolute-reviews' ),
'section' => 'general',
'type' => 'textarea',
'default' => '',
),
array(
'key' => 'legend',
'label' => esc_html__( 'Legend', 'absolute-reviews' ),
'section' => 'general',
'type' => 'textarea',
'default' => '',
),
array(
'key' => 'total_score_label',
'label' => esc_html__( 'Total Score Label', 'absolute-reviews' ),
'section' => 'general',
'type' => 'text',
'default' => esc_html__( 'Total Score', 'absolute-reviews' ),
),
array(
'key' => 'schema_author_custom',
'label' => esc_html__( 'Custom Author', 'absolute-reviews' ),
'section' => 'schema_attrs',
'type' => 'text',
'default' => '',
),
// Typography.
array(
'key' => 'typographyDescription',
'label' => esc_html__( 'Description Font Size', 'authentic' ),
'section' => 'typography',
'type' => 'dimension',
'default' => '0.875rem',
'output' => array(
array(
'element' => '$ .abr-review-info .abr-review-description',
'property' => 'font-size',
'suffix' => '!important',
),
),
'active_callback' => array(
array(
'field' => 'desc',
'operator' => '!=',
'value' => '',
),
),
),
array(
'key' => 'typographyLegend',
'label' => esc_html__( 'Legend Font Size', 'authentic' ),
'section' => 'typography',
'type' => 'dimension',
'default' => '0.875rem',
'output' => array(
array(
'element' => '$ .abr-review-total .abr-review-subtext .abr-data-info > span',
'property' => 'font-size',
'suffix' => '!important',
),
),
'active_callback' => array(
array(
'field' => 'legend',
'operator' => '!=',
'value' => '',
),
),
),
array(
'key' => 'typographyTotal',
'label' => esc_html__( 'Total Font Size', 'authentic' ),
'section' => 'typography',
'type' => 'dimension',
'default' => '3rem',
'output' => array(
array(
'element' => '$ .abr-review-total .abr-review-score .abr-review-text',
'property' => 'font-size',
'suffix' => '!important',
),
),
),
),
'template' => dirname( __FILE__ ) . '/block/render.php',
'editor_style' => 'absolute-reviews-block-editor-style',
);
return $blocks;
}
}
new ABR_Review_Block();
@@ -0,0 +1,630 @@
<?php
/**
* Block Reviews Posts
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/public
*/
/**
* Block Reviews Posts
*/
class ABR_Reviews_Posts_Block {
/**
* Initialize
*/
public function __construct() {
add_filter( 'canvas_block_layouts_canvas/posts', array( $this, 'register_layout' ), 99 );
add_filter( 'canvas_block_posts_query_args', array( $this, 'change_query_args' ), 10, 3 );
}
/**
* Get fields array for Meta
*
* @param array $settings The settings.
*/
public function get_meta_fields( $settings ) {
$settings = array_merge( array(
'field_prefix' => 'reviews',
'section_name' => '',
'active_callback' => array(),
), $settings );
// Set fields.
$fields = array(
array(
'key' => $settings['field_prefix'] . '_showMetaCategory',
'label' => esc_html__( 'Category', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => true,
'active_callback' => $settings['active_callback'],
),
array(
'key' => $settings['field_prefix'] . '_showMetaAuthor',
'label' => esc_html__( 'Author', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => true,
'active_callback' => $settings['active_callback'],
),
array(
'key' => $settings['field_prefix'] . '_showMetaDate',
'label' => esc_html__( 'Date', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => true,
'active_callback' => $settings['active_callback'],
),
array(
'key' => $settings['field_prefix'] . '_showMetaComments',
'label' => esc_html__( 'Comments', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => false,
'active_callback' => $settings['active_callback'],
),
abr_post_views_enabled() ? array(
'key' => $settings['field_prefix'] . '_showMetaViews',
'label' => esc_html__( 'Views', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => false,
'active_callback' => $settings['active_callback'],
) : array(),
abr_powerkit_module_enabled( 'reading_time' ) ? array(
'key' => $settings['field_prefix'] . '_showMetaReadingTime',
'label' => esc_html__( 'Reading Time', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => false,
'active_callback' => $settings['active_callback'],
) : array(),
array(
'key' => uniqid(),
'section' => $settings['section_name'],
'type' => 'separator',
'active_callback' => $settings['active_callback'],
),
array(
'key' => $settings['field_prefix'] . 'MetaCompact',
'label' => esc_html__( 'Display compact post meta', 'authentic' ),
'section' => $settings['section_name'],
'type' => 'toggle',
'default' => false,
'active_callback' => $settings['active_callback'],
),
);
return $fields;
}
/**
* Get types of layout.
*
* @since 1.0.0
* @access private
*/
public function get_types_of_layouts() {
$types = array(
'reviews-1' => 'reviews-1',
'reviews-2' => 'reviews-2',
'reviews-3' => 'reviews-3',
'reviews-4' => 'reviews-4',
'reviews-5' => 'reviews-5',
'reviews-6' => 'reviews-6',
'reviews-7' => 'reviews-7',
'reviews-8' => 'reviews-8',
);
return $types;
}
/**
* Get name of layout by key.
*
* @param mixed $key The key.
*/
public function get_name_of_layout_by( $key ) {
switch ( $key ) {
case 'reviews-1':
return esc_html__( 'Reviews 1', 'absolute-reviews' );
case 'reviews-2':
return esc_html__( 'Reviews 2', 'absolute-reviews' );
case 'reviews-3':
return esc_html__( 'Reviews 3', 'absolute-reviews' );
case 'reviews-4':
return esc_html__( 'Reviews 4', 'absolute-reviews' );
case 'reviews-5':
return esc_html__( 'Reviews 5', 'absolute-reviews' );
case 'reviews-6':
return esc_html__( 'Reviews 6', 'absolute-reviews' );
case 'reviews-7':
return esc_html__( 'Reviews 7', 'absolute-reviews' );
case 'reviews-8':
return esc_html__( 'Reviews 8', 'absolute-reviews' );
}
}
/**
* Get icon of layout by key.
*
* @param mixed $key The key.
*/
public function get_icon_of_layout_by( $key ) {
switch ( $key ) {
case 'reviews-1':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" stroke="#2D2D2D" fill="none" fill-rule="evenodd"><rect stroke-width="1.5" width="50" height="42" rx="3"/><g transform="translate(10 6)"><rect stroke-width="1.5" width="14" height="12" rx="1"/><path d="M18 4.625h12.278M18 7.625h8.273" stroke-linecap="round" stroke-linejoin="round"/></g><g transform="translate(10 24)"><rect stroke-width="1.5" width="14" height="12" rx="1"/><path d="M18 4.625h12.278M18 7.625h8.273" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>';
case 'reviews-2':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g transform="translate(10 24)"><rect stroke="#2D2D2D" stroke-width="1.5" width="14" height="12" rx="1"/><g transform="translate(18 9)"><rect fill="#C7C7C7" width="13" height="2" rx="1"/><rect fill="#2D2D2D" width="10" height="2" rx="1"/></g><path d="M18 2h12.278M18 5h8.273" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/></g><g transform="translate(10 6)"><rect stroke="#2D2D2D" stroke-width="1.5" width="14" height="12" rx="1"/><g transform="translate(18 9)"><rect fill="#C7C7C7" width="13" height="2" rx="1"/><rect fill="#2D2D2D" width="10" height="2" rx="1"/></g><path d="M18 2h12.278M18 5h8.273" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>';
case 'reviews-3':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" stroke="#2D2D2D" fill="none" fill-rule="evenodd"><rect stroke-width="1.5" width="50" height="42" rx="3"/><rect x=".5" y=".5" width="24" height="16" rx="1" transform="translate(12 4)" stroke-width="1.5"/><g transform="translate(13 30)"><rect stroke-width="1.5" width="8" height="8" rx="1"/><path d="M11.361 2.5H23.64M11 5.5h8.667" stroke-linecap="round" stroke-linejoin="round"/></g><path d="M13.028 26.5H28.68m-15.652-3h22.666" stroke-linecap="round" stroke-linejoin="round"/></g></svg>';
case 'reviews-4':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><rect x=".5" y=".5" width="24" height="16" rx="1" transform="translate(12 4)" stroke="#2D2D2D" stroke-width="1.5"/><rect stroke="#2D2D2D" stroke-width="1.5" x="13" y="30" width="8" height="8" rx="1"/><path d="M24.361 35.5h8.667m-8.667-3H36.64" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(12 24)"><rect fill="#C7C7C7" width="25" height="2" rx="1"/><rect fill="#2D2D2D" width="19" height="2" rx="1"/></g></g></svg>';
case 'reviews-5':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><rect x=".5" y=".5" width="24" height="16" rx="1" transform="translate(12 4)" stroke="#2D2D2D" stroke-width="1.5"/><g transform="translate(13 30)" stroke="#2D2D2D"><rect stroke-width="1.5" width="8" height="8" rx="1"/><path d="M11.361 2.5H23.64M11 5.5h8.667" stroke-linecap="round" stroke-linejoin="round"/></g><path d="M12.722 26.5h10.212m-10.212-3H25" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/><text font-family="FuturaPT-Bold, Futura PT" font-size="5" font-weight="bold" fill="#2D2D2D"><tspan x="27" y="28">3/5</tspan></text></g></svg>';
case 'reviews-6':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g transform="translate(12 4)"><rect stroke="#2D2D2D" stroke-width="1.5" x=".5" y=".5" width="24" height="33" rx="1"/><g transform="translate(3 3)"><circle fill="#2D2D2D" cx="3" cy="3" r="3"/><path d="M4.333 5a.667.667 0 110-1.333.667.667 0 010 1.333zM1.667 2.333a.667.667 0 110-1.333.667.667 0 010 1.333zm3-1.333L5 1.333 1.333 5 1 4.667 4.666 1z" fill="#FFF" fill-rule="nonzero"/></g><path d="M3.528 26.5h17.944M3.44 29h11.416" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>';
case 'reviews-7':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g transform="translate(12 4)"><rect stroke="#2D2D2D" stroke-width="1.5" x=".5" y=".5" width="24" height="33" rx="1"/><path d="M3.57 29.758l1.172-1.173.849.848 1.371-1.37.538.537v-1.5H6l.538.538-.947.947-.849-.849L3.26 29.22a3 3 0 11.31.538z" fill="#2D2D2D" fill-rule="nonzero"/><path d="M3.528 19.5h17.944M3.44 22h11.416" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>';
case 'reviews-8':
return '<svg width="52" height="44" xmlns="http://www.w3.org/2000/svg"><g transform="translate(1 1)" fill="none" fill-rule="evenodd"><rect stroke="#2D2D2D" stroke-width="1.5" width="50" height="42" rx="3"/><g transform="translate(12 4)"><rect stroke="#2D2D2D" stroke-width="1.5" x=".5" y=".5" width="24" height="33" rx="1"/><path d="M3.57 7.758l1.172-1.173.849.848 1.371-1.37.538.537V5.1H6l.538.538-.947.947-.849-.849L3.26 7.22a3 3 0 11.31.538z" fill="#2D2D2D" fill-rule="nonzero"/><path d="M3.528 27.5h17.944M3.44 30h11.416" stroke="#2D2D2D" stroke-linecap="round" stroke-linejoin="round"/></g></g></svg>';
}
}
/**
* Register layout.
*
* @param array $layouts List of layouts.
*/
public function register_layout( $layouts = array() ) {
$image_sizes = abr_get_list_available_image_sizes();
$types = $this->get_types_of_layouts();
foreach ( $types as $type ) {
$layouts[ $type ] = array(
'location' => array(),
'name' => $this->get_name_of_layout_by( $type ),
'template' => dirname( __FILE__ ) . '/posts-block.php',
'icon' => $this->get_icon_of_layout_by( $type ),
'sections' => array(
'general' => array(
'title' => esc_html__( 'Block Settings', 'absolute-reviews' ),
'priority' => 5,
'open' => true,
),
'reviewsLargeMeta' => array(
'title' => esc_html__( 'Large Post Meta Settings', 'absolute-reviews' ),
'priority' => 10,
),
'reviewsSmallMeta' => array(
'title' => esc_html__( 'Small Post Meta Settings', 'absolute-reviews' ),
'priority' => 20,
),
'reviewsThumbnail' => array(
'title' => esc_html__( 'Thumbnail Settings', 'absolute-reviews' ),
'priority' => 30,
),
'reviewsTypography' => array(
'title' => esc_html__( 'Typography Settings', 'absolute-reviews' ),
'priority' => 40,
),
),
'hide_fields' => array(
'showMetaCategory',
'showMetaAuthor',
'showMetaDate',
'showMetaComments',
'showMetaViews',
'showMetaReadingTime',
'showMetaShares',
'showExcerpt',
'showViewPostButton',
'showPagination',
'imageSize',
'postsCount',
'colorText',
'colorHeading',
'colorHeadingHover',
'colorText',
'colorMeta',
'colorMetaHover',
'colorMetaLinks',
'colorMetaLinksHover',
),
'fields' => array_merge(
array(
array(
'key' => 'reviewType',
'label' => esc_html__( 'Filter by Review Type', 'absolute-reviews' ),
'section' => 'query',
'type' => 'select',
'multiple' => false,
'choices' => array(
'all' => esc_html__( 'All types', 'absolute-reviews' ),
'percentage' => esc_html__( 'Percentage (1-100%)', 'absolute-reviews' ),
'point-5' => esc_html__( 'Points (1-5)', 'absolute-reviews' ),
'point-10' => esc_html__( 'Points (1-10)', 'absolute-reviews' ),
'star' => esc_html__( 'Stars (1-5)', 'absolute-reviews' ),
),
'default' => 'all',
),
array(
'key' => 'reviewsPostsCount',
'label' => esc_html__( 'Posts Count', 'absolute-reviews' ),
'section' => 'general',
'type' => 'number',
'default' => 5,
'min' => 1,
'max' => 100,
),
array(
'key' => 'imageSize',
'label' => esc_html__( 'Image Size', 'absolute-reviews' ),
'section' => 'reviewsThumbnail',
'type' => 'select',
'default' => 'large',
'choices' => $image_sizes,
'active_callback' => array(
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-5',
),
),
),
array(
'key' => 'largeImageSize',
'label' => esc_html__( 'Large Post Image Size', 'absolute-reviews' ),
'section' => 'reviewsThumbnail',
'type' => 'select',
'default' => 'large',
'choices' => $image_sizes,
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
),
array(
'key' => 'smallImageSize',
'label' => esc_html__( 'Small Post Image Size', 'absolute-reviews' ),
'section' => 'reviewsThumbnail',
'type' => 'select',
'default' => 'large',
'choices' => $image_sizes,
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
),
// Typography.
array(
'key' => 'typographyHeading',
'label' => esc_html__( 'Heading Font Size', 'absolute-reviews' ),
'section' => 'reviewsTypography',
'type' => 'dimension',
'default' => '1rem',
'output' => array(
array(
'element' => '$ .entry-title a',
'property' => 'font-size',
'suffix' => '!important',
),
),
'active_callback' => array(
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-5',
),
),
),
array(
'key' => 'typographyLargeHeading',
'label' => esc_html__( 'Heading Post Large Font Size', 'absolute-reviews' ),
'section' => 'reviewsTypography',
'type' => 'dimension',
'default' => '1.5rem',
'output' => array(
array(
'element' => '$ .abr-post-item:first-child .entry-title a',
'property' => 'font-size',
'suffix' => '!important',
),
),
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
),
array(
'key' => 'typographySmallHeading',
'label' => esc_html__( 'Heading Post Small Font Size', 'absolute-reviews' ),
'section' => 'reviewsTypography',
'type' => 'dimension',
'default' => '1rem',
'output' => array(
array(
'element' => '$ .abr-post-item:nth-child(n+2) .entry-title a',
'property' => 'font-size',
'suffix' => '!important',
),
),
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
),
// Color Settings.
array(
'key' => 'colorHeading',
'label' => esc_html__( 'Heading', 'absolute-reviews' ),
'section' => 'color',
'type' => 'color',
'default' => '#000',
'output' => array(
array(
'element' => '$ .abr-variation-default .entry-title a',
'property' => 'color',
'suffix' => '!important',
),
),
),
array(
'key' => 'colorHeadingHover',
'label' => esc_html__( 'Heading Hover', 'absolute-reviews' ),
'section' => 'color',
'type' => 'color',
'default' => '#5a5a5a',
'output' => array(
array(
'element' => '$ .abr-variation-default .entry-title a:hover, $ .abr-variation-default .entry-title a:focus',
'property' => 'color',
'suffix' => '!important',
),
),
),
array(
'key' => 'colorMeta',
'label' => esc_html__( 'Post Meta', 'absolute-reviews' ),
'section' => 'color',
'type' => 'color',
'default' => '',
'output' => array(
array(
'element' => '$ .abr-variation-default .post-meta span, $ .abr-variation-default .post-categories span',
'property' => 'color',
'suffix' => '!important',
),
),
),
array(
'key' => 'colorMetaLinks',
'label' => esc_html__( 'Post Meta Links', 'absolute-reviews' ),
'section' => 'color',
'type' => 'color',
'default' => '',
'output' => array(
array(
'element' => '$ .abr-variation-default .post-meta a, $ .abr-variation-default .post-categories a',
'property' => 'color',
'suffix' => '!important',
),
),
),
array(
'key' => 'colorMetaLinksHover',
'label' => esc_html__( 'Post Meta Links Hover', 'absolute-reviews' ),
'section' => 'color',
'type' => 'color',
'default' => '',
'output' => array(
array(
'element' => '$ .abr-variation-default .post-meta a:hover, $ .abr-variation-default .post-meta a:focus, $ .abr-variation-default .post-categories a:hover, $ .abr-variation-default .post-categories a:focus',
'property' => 'color',
'suffix' => '!important',
),
),
),
),
// Meta Settings.
$this->get_meta_fields(
array(
'field_prefix' => 'reviews',
'section_name' => 'meta',
'active_callback' => array(
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '!=',
'value' => 'reviews-5',
),
),
)
),
$this->get_meta_fields(
array(
'field_prefix' => 'reviewsLarge',
'section_name' => 'reviewsLargeMeta',
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
)
),
$this->get_meta_fields(
array(
'field_prefix' => 'reviewsSmall',
'section_name' => 'reviewsSmallMeta',
'active_callback' => array(
array(
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-3',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-4',
),
array(
'field' => 'layout',
'operator' => '==',
'value' => 'reviews-5',
),
),
),
)
)
),
);
}
return $layouts;
}
/**
* Change post query attributes
*
* @param array $args Args for post query.
* @param array $attributes Block attributes.
* @param array $options Block options.
*/
public function change_query_args( $args, $attributes, $options ) {
// Review type.
if ( isset( $options['reviewType'] ) && 'all' !== $options['reviewType'] ) {
$args['meta_query'] = array(
'relation' => 'OR',
array(
'key' => '_abr_review_type',
'value' => $options['reviewType'],
),
);
}
// Posts count.
if ( isset( $options['reviewsPostsCount'] ) && $options['reviewsPostsCount'] ) {
$args['posts_per_page'] = $options['reviewsPostsCount'];
}
return $args;
}
}
new ABR_Reviews_Posts_Block();
@@ -0,0 +1,454 @@
<?php
/**
* Widget Reviews Posts
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/public
*/
/**
* Widget Reviews Posts
*/
class ABR_Reviews_Posts_Widget extends WP_Widget {
/**
* Sets up a new widget instance.
*/
public function __construct() {
$this->default_settings = apply_filters(
'abr_widget_posts_settings', array(
'title' => '',
'template' => 'list',
'posts_per_page' => 5,
'review_type' => 'all',
'orderby' => 'date',
'order' => 'desc',
'time_frame' => '',
'category' => false,
'thumbnail' => 'large',
'post_meta' => array( 'date' ),
'post_meta_compact' => false,
'thumbnail_large' => 'large',
'post_meta_large' => array( 'date' ),
'post_meta_large_compact' => false,
'thumbnail_small' => 'large',
'post_meta_small' => array( 'date' ),
'post_meta_small_compact' => false,
'avoid_duplicate' => false,
'output' => 'widget',
)
);
$widget_details = array(
'classname' => 'abr_reviews_posts_widget',
'description' => esc_html__( 'Display a list of your reviews posts.', 'absolute-reviews' ),
);
parent::__construct( 'abr_reviews_posts_widget', esc_html__( 'Reviews Posts', 'absolute-reviews' ), $widget_details );
}
/**
* Outputs the content for the current widget instance.
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current widget instance.
*/
public function widget( $args, $instance ) {
global $abr_posts;
global $wp_query;
if ( ! $abr_posts ) {
$abr_posts = array();
}
$params = array_merge( $this->default_settings, $instance );
$posts_args = array(
'posts_per_page' => $params['posts_per_page'],
'order' => $params['order'],
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
);
if ( $params['category'] ) {
$category = $params['category'];
$posts_args['cat'] = $category;
}
// Avoid Duplicate.
if ( $params['avoid_duplicate'] ) {
$main_posts = array();
if ( isset( $wp_query->posts ) && $wp_query->posts ) {
$main_posts = wp_list_pluck( $wp_query->posts, 'ID' );
}
if ( $main_posts ) {
$posts_args['post__not_in'] = array_merge( $main_posts, $abr_posts );
} else {
$posts_args['post__not_in'] = $abr_posts;
}
}
// Review type.
if ( 'all' !== $params['review_type'] ) {
$posts_args['meta_query'] = array(
'relation' => 'OR',
array(
'key' => '_abr_review_type',
'value' => $params['review_type'],
),
);
}
// Post order.
if ( class_exists( 'Post_Views_Counter' ) && 'meta_value_num' === $params['orderby'] ) {
// Post Views.
$posts_args['orderby'] = 'post_views';
} else {
$posts_args['orderby'] = $params['orderby'];
}
if ( $params['time_frame'] ) {
$posts_args['date_query'] = array(
array(
'column' => 'post_date_gmt',
'after' => $params['time_frame'] . ' ago',
),
);
}
$posts = new WP_Query( apply_filters_ref_array( 'abr_reviews_posts_widget_args', array( $posts_args, & $params ) ) );
if ( $posts->have_posts() ) {
// Before Widget.
echo $args['before_widget']; // XSS.
// Title.
if ( $params['title'] ) {
echo $args['before_title'] . apply_filters( 'widget_title', $params['title'], $instance, $this->id_base ) . $args['after_title']; // XSS.
}
$review_id = get_the_ID();
// Class Template.
$class = sprintf( 'abr-posts-template-%s', $params['template'] );
// Class Number of Posts.
$class .= sprintf( ' abr-posts-per-page-%s', (int) $params['posts_per_page'] );
?>
<div class="widget-body abr-reviews-posts <?php echo esc_html( $class ); ?>">
<div class="abr-reviews-posts-list">
<?php
$params['counter'] = 0;
while ( $posts->have_posts() ) :
$posts->the_post();
$abr_posts[] = $review_id;
$params['counter']++;
?>
<div class="abr-post-item">
<?php abr_reviews_posts_widget_handler( $params['template'], $posts, $params, $instance ); ?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php
// After Widget.
echo $args['after_widget']; // XSS.
}
wp_reset_postdata();
}
/**
* Handles updating settings for the current widget instance.
*
* @param array $new_instance New settings for this instance as input by the user via
* WP_Widget::form().
* @param array $old_instance Old settings for this instance.
* @return array Settings to save or bool false to cancel saving.
*/
public function update( $new_instance, $old_instance ) {
$instance = $new_instance;
// Post Meta.
if ( ! isset( $instance['post_meta'] ) ) {
$instance['post_meta'] = array();
}
// Compact Post Meta.
if ( ! isset( $instance['post_meta_compact'] ) ) {
$instance['post_meta_compact'] = false;
}
// Avoid duplicate posts.
if ( ! isset( $instance['avoid_duplicate'] ) ) {
$instance['avoid_duplicate'] = false;
}
return apply_filters( 'abr_reviews_posts_widget_update', $instance );
}
/**
* Outputs the widget settings form.
*
* @param array $instance Current settings.
*/
public function form( $instance ) {
$params = array_merge( $this->default_settings, $instance );
$allowed_post_meta = abr_allowed_post_meta();
$image_sizes = abr_get_list_available_image_sizes();
$templates = apply_filters( 'abr_reviews_posts_templates', array() );
?>
<!-- Title -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'absolute-reviews' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $params['title'] ); ?>" /></p>
<?php do_action( 'abr_reviews_posts_widget_form_before', $this, $params, $instance ); ?>
<!-- Template -->
<?php if ( $templates ) { ?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>"><?php esc_html_e( 'Template:', 'absolute-reviews' ); ?></label>
<select name="<?php echo esc_attr( $this->get_field_name( 'template' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>" class="widefat abr-template">
<?php
foreach ( $templates as $slug => $template ) {
$name = isset( $template['name'] ) ? $template['name'] : $slug;
?>
<option value="<?php echo esc_attr( $slug ); ?>" <?php selected( $params['template'], $slug ); ?>><?php echo esc_html( $name ); ?></option>
<?php } ?>
</select>
</p>
<?php } ?>
<!-- Number of Posts -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'posts_per_page' ) ); ?>"><?php esc_html_e( 'Number of posts:', 'absolute-reviews' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'posts_per_page' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'posts_per_page' ) ); ?>" type="number" value="<?php echo esc_attr( $params['posts_per_page'] ); ?>" /></p>
<!-- Filter by Review Type -->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'review_type' ) ); ?>"><?php esc_html_e( 'Filter by Review Type:', 'absolute-reviews' ); ?></label>
<select name="<?php echo esc_attr( $this->get_field_name( 'review_type' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'review_type' ) ); ?>" class="widefat">
<option value="all" <?php selected( $params['review_type'], 'all' ); ?>><?php esc_html_e( 'All types', 'absolute-reviews' ); ?></option>
<option value="percentage" <?php selected( $params['review_type'], 'percentage' ); ?>><?php esc_html_e( 'Percentage (1-100%)', 'absolute-reviews' ); ?></option>
<option value="point-5" <?php selected( $params['review_type'], 'point-5' ); ?>><?php esc_html_e( 'Points (1-5)', 'absolute-reviews' ); ?></option>
<option value="point-10" <?php selected( $params['review_type'], 'point-10' ); ?>><?php esc_html_e( 'Points (1-10)', 'absolute-reviews' ); ?></option>
<option value="star" <?php selected( $params['review_type'], 'star' ); ?>><?php esc_html_e( 'Stars (1-5)', 'absolute-reviews' ); ?></option>
</select>
</p>
<!-- Order by -->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order by:', 'absolute-reviews' ); ?></label>
<select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
<option value="date" <?php selected( $params['orderby'], 'date' ); ?>><?php esc_html_e( 'Date', 'absolute-reviews' ); ?></option>
<option value="comment_count" <?php selected( $params['orderby'], 'comment_count' ); ?>><?php esc_html_e( 'Comments', 'absolute-reviews' ); ?></option>
<option value="rand" <?php selected( $params['orderby'], 'rand' ); ?>><?php esc_html_e( 'Random', 'absolute-reviews' ); ?></option>
<?php if ( class_exists( 'Post_Views_Counter' ) ) { ?>
<option value="meta_value_num" <?php selected( $params['orderby'], 'meta_value_num' ); ?>><?php esc_html_e( 'Views', 'absolute-reviews' ); ?></option>
<?php } ?>
</select>
</p>
<!-- Order -->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order', 'absolute-reviews' ); ?>:</label>
<select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat">
<option value="desc" <?php selected( $params['order'], 'desc' ); ?>><?php esc_html_e( 'Descending', 'absolute-reviews' ); ?></option>
<option value="asc" <?php selected( $params['order'], 'asc' ); ?>><?php esc_html_e( 'Ascending', 'absolute-reviews' ); ?></option>
</select>
</p>
<!-- Time Frame -->
<p><label for="<?php echo esc_attr( $this->get_field_id( 'time_frame' ) ); ?>"><?php esc_html_e( 'Time frame:', 'absolute-reviews' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'time_frame' ) ); ?>" placeholder="<?php esc_html_e( '3 months', 'absolute-reviews' ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'time_frame' ) ); ?>" type="text" value="<?php echo esc_attr( $params['time_frame'] ); ?>" /></p>
<!-- Category -->
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>"><?php esc_html_e( 'Category:', 'absolute-reviews' ); ?></label>
<select name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>[]" id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" class="widefat" style="height: auto !important;" multiple="multiple" size="8">
<?php
$cat_args = array(
'hide_empty' => 0,
'hierarchical' => 1,
'selected' => (array) $params['category'],
'walker' => new ABR_Add_Posts_Categories_Tree_Walker(),
);
$allowed_html = array(
'option' => array(
'class' => true,
'value' => true,
'selected' => true,
),
);
echo wp_kses( walk_category_dropdown_tree( get_categories( $cat_args ), 0, $cat_args ), $allowed_html );
?>
</select>
</p>
<fieldset class="abr-simple-post">
<!-- Image size -->
<h4><?php esc_html_e( 'Image size:', 'absolute-reviews' ); ?></h4>
<?php if ( $image_sizes ) { ?>
<p><select name="<?php echo esc_attr( $this->get_field_name( 'thumbnail' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'thumbnail' ) ); ?>">
<?php foreach ( $image_sizes as $key => $caption ) { ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $params['thumbnail'] ); ?>><?php echo esc_html( $caption ); ?></option>
<?php } ?>
</select></p>
<?php } ?>
<!-- Post meta -->
<h4><?php esc_html_e( 'Post meta:', 'absolute-reviews' ); ?></h4>
<?php foreach ( $allowed_post_meta as $key => $caption ) { ?>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta' ) ); ?>-<?php echo esc_attr( $key ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta' ) ); ?>[]" type="checkbox" value="<?php echo esc_attr( $key ); ?>" <?php checked( in_array( $key, (array) $params['post_meta'], true ) ? true : false ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta' ) ); ?>-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $caption ); ?></label></p>
<?php } ?>
<!-- Compact post meta -->
<h4><?php esc_html_e( 'Compact post meta:', 'absolute-reviews' ); ?></h4>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta_compact' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta_compact' ) ); ?>" type="checkbox" <?php checked( (bool) $params['post_meta_compact'] ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta_compact' ) ); ?>"><?php esc_html_e( 'Display compact post meta', 'absolute-reviews' ); ?></label></p>
</fieldset>
<fieldset class="abr-large-post">
<legend><?php esc_html_e( 'Large Post', 'absolute-reviews' ); ?></legend>
<!-- Image size -->
<h4><?php esc_html_e( 'Image size:', 'absolute-reviews' ); ?></h4>
<?php if ( $image_sizes ) { ?>
<p><select name="<?php echo esc_attr( $this->get_field_name( 'thumbnail_large' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'thumbnail_large' ) ); ?>-<?php echo esc_attr( $key ); ?>">
<?php foreach ( $image_sizes as $key => $caption ) { ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $params['thumbnail_large'] ); ?>><?php echo esc_html( $caption ); ?></option>
<?php } ?>
</select></p>
<?php } ?>
<!-- Post meta -->
<h4><?php esc_html_e( 'Post meta:', 'absolute-reviews' ); ?></h4>
<?php foreach ( $allowed_post_meta as $key => $caption ) { ?>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta_large' ) ); ?>-<?php echo esc_attr( $key ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta_large' ) ); ?>[]" type="checkbox" value="<?php echo esc_attr( $key ); ?>" <?php checked( in_array( $key, (array) $params['post_meta_large'], true ) ? true : false ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta_large' ) ); ?>-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $caption ); ?></label></p>
<?php } ?>
<!-- Compact post meta -->
<h4><?php esc_html_e( 'Compact post meta:', 'absolute-reviews' ); ?></h4>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta_large_compact' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta_large_compact' ) ); ?>" type="checkbox" <?php checked( (bool) $params['post_meta_large_compact'] ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta_large_compact' ) ); ?>"><?php esc_html_e( 'Display compact post meta', 'absolute-reviews' ); ?></label></p>
</fieldset>
<fieldset class="abr-small-post">
<legend><?php esc_html_e( 'Small Post', 'absolute-reviews' ); ?></legend>
<!-- Image size -->
<h4><?php esc_html_e( 'Image size:', 'absolute-reviews' ); ?></h4>
<?php if ( $image_sizes ) { ?>
<p><select name="<?php echo esc_attr( $this->get_field_name( 'thumbnail_small' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'thumbnail_small' ) ); ?>-<?php echo esc_attr( $key ); ?>">
<?php foreach ( $image_sizes as $key => $caption ) { ?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $params['thumbnail_small'] ); ?>><?php echo esc_html( $caption ); ?></option>
<?php } ?>
</select></p>
<?php } ?>
<!-- Post meta -->
<h4><?php esc_html_e( 'Post meta:', 'absolute-reviews' ); ?></h4>
<?php foreach ( $allowed_post_meta as $key => $caption ) { ?>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta_small' ) ); ?>-<?php echo esc_attr( $key ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta_small' ) ); ?>[]" type="checkbox" value="<?php echo esc_attr( $key ); ?>" <?php checked( in_array( $key, (array) $params['post_meta_small'], true ) ? true : false ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta_small' ) ); ?>-<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $caption ); ?></label></p>
<?php } ?>
<!-- Compact Post Meta -->
<h4><?php esc_html_e( 'Compact post meta:', 'absolute-reviews' ); ?></h4>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'post_meta_small_compact' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'post_meta_small_compact' ) ); ?>" type="checkbox" <?php checked( (bool) $params['post_meta_small_compact'] ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'post_meta_small_compact' ) ); ?>"><?php esc_html_e( 'Display compact post meta', 'absolute-reviews' ); ?></label></p>
</fieldset>
<!-- Avoid duplicate posts -->
<h4><?php esc_html_e( 'Avoid duplicate posts:', 'absolute-reviews' ); ?></h4>
<p><input id="<?php echo esc_attr( $this->get_field_id( 'avoid_duplicate' ) ); ?>" class="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'avoid_duplicate' ) ); ?>" type="checkbox" <?php checked( (bool) $params['avoid_duplicate'] ); ?> />
<label for="<?php echo esc_attr( $this->get_field_id( 'avoid_duplicate' ) ); ?>"><?php esc_html_e( 'Exclude duplicate posts', 'absolute-reviews' ); ?></label></p>
<?php do_action( 'abr_reviews_posts_widget_form_after', $this, $params, $instance ); ?>
<script>
(function($) {
let objTemplate = $( '#<?php echo esc_attr( $this->get_field_id( 'template' ) ); ?>' );
$( objTemplate ).on( 'change', function() {
$( this ).closest( '.widget' ).attr( 'template', $( this ).val() );
});
$( objTemplate ).change();
})(jQuery);
</script>
<?php
}
}
/**
* Create HTML dropdown list of Categories.
*/
class ABR_Add_Posts_Categories_Tree_Walker extends Walker_CategoryDropdown {
/**
* Starts the element output.
*
* @since 2.1.0
* @access public
*
* @see Walker::start_el()
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $category Category data object.
* @param int $depth Depth of category. Used for padding.
* @param array $args Uses 'selected', 'show_count', and 'value_field' keys, if they exist.
* See wp_dropdown_categories().
* @param int $id Optional. ID of the current category. Default 0 (unused).
*/
public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
$pad = $depth > 0 ? '- ' . str_repeat( '&nbsp;', $depth * 3 ) : '';
$selected = array_map( 'intval', $args['selected'] );
$cat_name = apply_filters( 'list_cats', $category->name, $category );
$output .= sprintf(
'<option class="level-%1$s" value="%2$s" %4$s>%3$s</option>',
esc_attr( $depth ),
esc_attr( $category->term_id ),
esc_html( $pad . $cat_name ),
selected( in_array( $category->term_id, $selected, true ), true )
);
$output .= "\n";
}
}
/**
* Register Widget
*/
function abr_reviews_posts_init() {
register_widget( 'ABR_Reviews_Posts_Widget' );
}
add_action( 'widgets_init', 'abr_reviews_posts_init' );
@@ -0,0 +1,149 @@
<?php
/**
* The public-facing functionality of the plugin.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
* @subpackage ABR/public
*/
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package ABR
* @subpackage ABR/public
*/
class ABR_Public {
/**
* The ID of this plugin.
* @access private
* @var string $abr The ID of this plugin.
*/
private $abr;
/**
* The version of this plugin.
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @param string $abr The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $abr, $version ) {
$this->abr = $abr;
$this->version = $version;
}
/**
* Filter output review in post content.
*
* @param string $content The content of post.
*/
public function the_content( $content ) {
// Check enabled.
if ( ! apply_filters( 'abr_review_content_enabled', true ) ) {
return $content;
}
// Check AMP endpoint.
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
return $content;
}
if ( is_singular() && ( is_single( get_the_ID() ) || is_page( get_the_ID() ) ) ) {
ob_start();
abr_the_review();
$review = ob_get_clean();
// Concatenation.
$content = $content . $review;
}
return $content;
}
/**
* Register Posts Templates
*
* @since 1.0.0
* @access private
*
* @param array $templates List of Templates.
*/
public function posts_templates( $templates = array() ) {
$templates = array(
'reviews-1' => array(
'name' => esc_html__( 'Reviews 1', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-2' => array(
'name' => esc_html__( 'Reviews 2', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-3' => array(
'name' => esc_html__( 'Reviews 3', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-4' => array(
'name' => esc_html__( 'Reviews 4', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-5' => array(
'name' => esc_html__( 'Reviews 5', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-6' => array(
'name' => esc_html__( 'Reviews 6', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-7' => array(
'name' => esc_html__( 'Reviews 7', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
'reviews-8' => array(
'name' => esc_html__( 'Reviews 8', 'absolute-reviews' ),
'func' => 'abr_reviews_posts_template',
),
);
return $templates;
}
/**
* Fire the wp_head action.
*/
public function wp_head() {
?>
<link rel="preload" href="<?php echo esc_url( ABR_URL . 'fonts/absolute-reviews-icons.woff' ); ?>" as="font" type="font/woff" crossorigin>
<?php
}
/**
* Register the stylesheets for the public-facing side of the site.
*/
public function wp_enqueue_scripts() {
// Styles.
wp_enqueue_style( $this->abr, abr_style( plugin_dir_url( __FILE__ ) . 'css/absolute-reviews-public.css' ), array(), $this->version, 'all' );
// Add RTL support.
wp_style_add_data( $this->abr, 'rtl', 'replace' );
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,69 @@
<?php
/**
* Posts Block
*
* @package ABR
* @subpackage ABR/public
*/
// when layout is not selected, used list.php
// but we don't need to print any html in this situation.
if ( ! isset( $attributes['layout'] ) || ! $attributes['layout'] ) {
return;
}
$attributes['output'] = 'block';
$attributes['template'] = $attributes['layout'];
// Set classes.
$class_wrap = $attributes['canvasClassName'];
// Class Template.
$class_block = sprintf( 'abr-posts-template-%s', $attributes['layout'] );
// Class Number of Posts.
$class_block .= sprintf( ' abr-posts-per-page-%s', (int) $options['reviewsPostsCount'] );
if ( $posts->have_posts() ) {
?>
<div class="abr-block-reviews-posts <?php echo esc_attr( $class_wrap ); ?>">
<div class="abr-reviews-posts <?php echo esc_attr( $class_block ); ?>">
<div class="abr-reviews-posts-list">
<?php
$attributes['counter'] = 0;
// Check if there're enough posts in the query.
while ( $posts->have_posts() ) {
$posts->the_post();
$attributes['counter']++;
$attributes['post_meta_list'] = abr_block_convert_post_meta( $options, 'reviews' );
$attributes['post_meta_compact'] = isset( $options['reviewsMetaCompact'] ) ? $options['reviewsMetaCompact'] : false;
$attributes['thumbnail'] = isset( $options['imageSize'] ) ? $options['imageSize'] : 'large';
if ( in_array( $attributes['layout'], array( 'reviews-3', 'reviews-4', 'reviews-5' ), true ) ) {
if ( 1 === $attributes['counter'] ) {
$attributes['post_meta_list'] = abr_block_convert_post_meta( $options, 'reviewsLarge' );
$attributes['post_meta_compact'] = isset( $options['reviewsLargeMetaCompact'] ) ? $options['reviewsLargeMetaCompact'] : false;
$attributes['thumbnail'] = isset( $options['largeImageSize'] ) ? $options['largeImageSize'] : 'large';
} else {
$attributes['post_meta_list'] = abr_block_convert_post_meta( $options, 'reviewsSmall' );
$attributes['post_meta_compact'] = isset( $options['reviewsSmallMetaCompact'] ) ? $options['reviewsSmallMetaCompact'] : false;
$attributes['thumbnail'] = isset( $options['smallImageSize'] ) ? $options['smallImageSize'] : 'large';
}
}
?>
<div class="abr-post-item">
<?php abr_reviews_posts_template( $posts, $attributes, null ); ?>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php
} else {
cnvs_alert_warning( esc_html__( 'There aren\'t enough posts that match the filter criteria.', 'authentic' ) );
}
@@ -0,0 +1,194 @@
<?php
/**
* Posts Template
*
* @package ABR
* @subpackage ABR/public
*/
/**
* Default Template
*
* @param array $posts Array of posts.
* @param array $params Array of params.
* @param array $instance Instance.
*/
function abr_reviews_posts_template( $posts, $params, $instance ) {
$review_id = get_the_ID();
$value = abr_get_review( false, $review_id );
// Get indicators.
$indicators = abr_list_indicators();
// Get type.
$type = abr_review_get_type( $review_id, 'none' );
// Set value index.
$val_index = abr_review_get_val_index( $type, $value );
// Set mode.
$mode = 'simple';
// Set variation.
$variation = 'default';
if ( 'reviews-2' === $params['template'] || 'reviews-4' === $params['template'] ) {
$mode = 'extended';
}
// Badges.
$badge_block = sprintf( 'abr-badge abr-badge-primary abr-review-badge-%s', $val_index );
$badge_text = sprintf( 'abr-badge-text abr-badge-text-primary abr-review-badge-text-%s', $val_index );
// Set variation by template.
if ( in_array( $params['template'], array( 'reviews-6', 'reviews-7', 'reviews-8' ), true ) ) {
$variation = 'overlay';
}
// Post Meta.
if ( 'widget' === $params['output'] ) {
$params['post_meta_list'] = $params['post_meta'];
$params['post_meta_compact'] = $params['post_meta_compact'];
$params['thumbnail'] = $params['thumbnail'];
if ( in_array( $params['template'], array( 'reviews-3', 'reviews-4', 'reviews-5' ), true ) ) {
if ( 1 === $params['counter'] ) {
$params['post_meta_list'] = $params['post_meta_large'];
$params['post_meta_compact'] = $params['post_meta_large_compact'];
$params['thumbnail'] = $params['thumbnail_large'];
} else {
$params['post_meta_list'] = $params['post_meta_small'];
$params['post_meta_compact'] = $params['post_meta_small_compact'];
$params['thumbnail'] = $params['thumbnail_small'];
}
}
}
// Class Type.
$class = sprintf( 'abr-type-%s', $type );
// Class Variation.
$class .= sprintf( ' abr-variation-%s', $variation );
// Classes.
$class_caption = $badge_block;
$class_number = null;
if ( 'reviews-1' === $params['template'] || 'reviews-3' === $params['template'] ) {
$class_caption = $badge_text;
$class_number = $badge_block;
}
if ( 'percentage' === $type ) {
$class_caption = $badge_block;
$class_number = null;
}
$meta_settings = array(
'abr-params' => $params,
);
?>
<article <?php post_class( $class ); ?>>
<div class="abr-post-outer">
<?php if ( has_post_thumbnail() ) { ?>
<div class="abr-post-inner abr-post-thumbnail">
<a href="<?php the_permalink(); ?>" class="post-thumbnail">
<?php the_post_thumbnail( $params['thumbnail'] ); ?>
</a>
</div>
<?php } ?>
<div class="abr-post-inner abr-post-data">
<?php if ( 'overlay' === $variation ) { ?>
<a class="abr-post-link" href="<?php the_permalink(); ?>"></a>
<?php } ?>
<div class="abr-post-headline">
<?php
abr_get_post_meta( 'category', (bool) $params['post_meta_compact'], true, $params['post_meta_list'], $meta_settings );
?>
<?php
$tag = apply_filters( 'abr_reviews_posts_title_tag', 'h5', $params, $instance );
?>
<<?php echo esc_html( $tag ); ?> class="entry-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</<?php echo esc_html( $tag ); ?>>
<?php
abr_get_post_meta( abr_allowed_post_meta( true, 'category' ), (bool) $params['post_meta_compact'], true, $params['post_meta_list'], $meta_settings );
?>
</div>
<?php if ( $value ) { ?>
<?php if ( 'simple' === $mode ) { ?>
<div class="abr-review-meta">
<div class="abr-review-number <?php echo esc_attr( $class_number ); ?>">
<?php
echo abr_get_review( true, $review_id ); // XSS.
?>
</div>
<?php if ( $indicators && $indicators[ $val_index ]['name'] ) { ?>
<div class="abr-review-caption <?php echo esc_attr( $class_caption ); ?>">
<?php echo esc_html( $indicators[ $val_index ]['name'] ); ?>
</div>
<?php } ?>
</div>
<?php } else { ?>
<div class="abr-review-meta">
<div class="abr-review-indicator abr-review-<?php echo esc_attr( $type ); ?>">
<?php if ( 'star' === $type ) : ?>
<div class="abr-review-stars">
<?php
abr_review_star_rating(
array(
'rating' => $value,
'type' => 'rating',
'number' => 0,
)
);
?>
</div>
<?php elseif ( 'point-5' === $type || 'point-10' === $type ) : ?>
<div class="abr-review-line">
<?php
$max_slice = 'point-5' === $type ? 5 : 10;
for ( $index = 1; $index <= $max_slice; $index++ ) {
if ( $index <= $value ) {
$class = 'abr-review-slice-active';
} else {
$class = 'abr-review-slice-no-active';
}
?>
<span class="abr-review-slice <?php echo esc_attr( $class ); ?>"></span>
<?php
}
?>
</div>
<?php elseif ( 'percentage' === $type ) : ?>
<div class="abr-review-progress">
<div class="abr-review-progressbar abr-review-progressbar-<?php echo esc_attr( $val_index ); ?>" style="width:<?php echo esc_attr( $value > 90 ? $value : 100 ); ?>%"></div>
</div>
<?php endif; ?>
</div>
<div class="abr-review-number <?php echo esc_attr( $class_number ); ?>">
<?php
echo abr_get_review( true, $review_id ); // XSS.
?>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</article>
<?php
}
@@ -0,0 +1,31 @@
<?php
/**
* Fired when the plugin is uninstalled.
*
* When populating this file, consider the following flow
* of control:
*
* - This method should be static
* - Check if the $_REQUEST content actually is the plugin name
* - Run an admin referrer check to make sure it goes through authentication
* - Verify the output of $_GET makes sense
* - Repeat with other user roles. Best directly by using the links/query string parameters.
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
*
* This file may be updated more in future version of the Boilerplate; however, this is the
* general skeleton and outline for how the file should work.
*
* For more information, see the following discussion:
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ABR
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
@@ -0,0 +1,57 @@
=== Advanced Popups ===
Tags: popup, advertising, popups, optin, marketing
Requires at least: 4.0
Tested up to: 6.0
Requires PHP: 5.4
Stable tag: 1.1.3
Contributors: codesupplyco
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
== Description ==
Display high-converting newsletter popups, a cookie notice, or a notification with the light-weight yet feature-rich plugin.
== Changelog ==
= 1.1.3 =
* Improved thumbnail size.
= 1.1.2 =
* Improved plugin security.
= 1.1.1 =
* Improved functions for working with cookies.
= 1.1.0 =
* Updated styles for mobile devices.
= 1.0.9 =
* Minor improvements.
= 1.0.8 =
* Added dev filter to classes in popup.
= 1.0.7 =
* Compatibility fixes for WordPress 5.5
= 1.0.6 =
* Minor improvements.
= 1.0.5 =
* Improve thumbnail.
= 1.0.4 =
* Fixed "Limit display сache lifetime (days)".
= 1.0.3 =
* Added css variables to styles.
= 1.0.2 =
* Added compatibility with php 5.6.
= 1.0.1 =
* Add preload for font icons.
= 1.0 =
* Initial release.
@@ -0,0 +1,929 @@
<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package ADP
* @subpackage ADP/admin
*/
class ADP_Admin {
/**
* The ID of this plugin.
* @access private
* @var string $adp The ID of this plugin.
*/
private $adp;
/**
* The version of this plugin.
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @param string $adp The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $adp, $version ) {
$this->adp = $adp;
$this->version = $version;
}
/**
* Register post type
*/
public function register_post_type() {
register_post_type( 'adp-popup', array(
'labels' => array(
'name' => esc_html__( 'Popups', 'coffee-guru' ),
'singular_name' => esc_html__( 'Popup', 'coffee-guru' ),
'menu_name' => esc_html__( 'Popups', 'coffee-guru' ),
'name_admin_bar' => esc_html__( 'Popup', 'coffee-guru' ),
'add_new' => esc_html__( 'Add New', 'coffee-guru' ),
'add_new_item' => esc_html__( 'Add New Popup', 'coffee-guru' ),
'new_item' => esc_html__( 'New Popup', 'coffee-guru' ),
'edit_item' => esc_html__( 'Edit Popup', 'coffee-guru' ),
'view_item' => esc_html__( 'View Popup', 'coffee-guru' ),
'all_items' => esc_html__( 'Popups', 'coffee-guru' ),
'search_items' => esc_html__( 'Search Popups', 'coffee-guru' ),
'parent_item_colon' => esc_html__( 'Parent Popups:', 'coffee-guru' ),
'not_found' => esc_html__( 'No popups found.', 'coffee-guru' ),
'not_found_in_trash' => esc_html__( 'No popups found in Trash.', 'coffee-guru' ),
),
'public' => false,
'publicly_queryable' => false,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'menu_position' => 55,
'show_in_menu' => true,
'menu_icon' => 'dashicons-editor-expand',
'supports' => array( 'title', 'editor', 'author', 'thumbnail' ),
'show_in_rest' => true,
'show_in_menu' => 'options-general.php',
) );
}
/**
* Addd new meta box.
*/
public function metabox_popup_register() {
add_meta_box( 'adp_popup_metabox', esc_html__( 'Popup Settings', 'advanced-popups' ), array( $this, 'metabox_popup_callback' ), array( 'adp-popup' ), 'normal', 'high', null );
}
/**
* Callback for Popup Meta Box.
*
* @param object $post Object of post.
*/
public function metabox_popup_callback( $post ) {
$popup_type = adp_get_post_meta( $post->ID, '_adp_popup_type', true, 'content' );
$popup_location = adp_get_post_meta( $post->ID, '_adp_popup_location', true, 'center' );
$popup_preview_image = adp_get_post_meta( $post->ID, '_adp_popup_preview_image', true, 'left' );
$popup_info_text = adp_get_post_meta( $post->ID, '_adp_popup_info_text', true );
$popup_info_buton_label = adp_get_post_meta( $post->ID, '_adp_popup_info_buton_label', true );
$popup_info_button_action = adp_get_post_meta( $post->ID, '_adp_popup_info_button_action', true, 'link' );
$popup_info_button_link = adp_get_post_meta( $post->ID, '_adp_popup_info_button_link', true );
$popup_limit_display = adp_get_post_meta( $post->ID, '_adp_popup_limit_display', true, 1 );
$popup_limit_lifetime = adp_get_post_meta( $post->ID, '_adp_popup_limit_lifetime', true, 30 );
$popup_show_to = adp_get_post_meta( $post->ID, '_adp_popup_show_to', true, 'both' );
$popup_rules_mode = adp_get_post_meta( $post->ID, '_adp_popup_rules_mode', true, 'all' );
$popup_rules = adp_get_post_meta( $post->ID, '_adp_popup_rules', true, array() );
$popup_open_trigger = adp_get_post_meta( $post->ID, '_adp_popup_open_trigger', true, 'delay' );
$popup_open_delay_number = adp_get_post_meta( $post->ID, '_adp_popup_open_delay_number', true, 1 );
$popup_open_scroll_position = adp_get_post_meta( $post->ID, '_adp_popup_open_scroll_position', true, 10 );
$popup_open_scroll_type = adp_get_post_meta( $post->ID, '_adp_popup_open_scroll_type', true, '%' );
$popup_open_manual_selector = adp_get_post_meta( $post->ID, '_adp_popup_open_manual_selector', true );
$popup_close_trigger = adp_get_post_meta( $post->ID, '_adp_popup_close_trigger', true, 'none' );
$popup_close_delay_number = adp_get_post_meta( $post->ID, '_adp_popup_close_delay_number', true, 30 );
$popup_close_scroll_position = adp_get_post_meta( $post->ID, '_adp_popup_close_scroll_position', true, 10 );
$popup_close_scroll_type = adp_get_post_meta( $post->ID, '_adp_popup_close_scroll_type', true, '%' );
$popup_open_animation = adp_get_post_meta( $post->ID, '_adp_popup_open_animation', true, 'popupOpenFade' );
$popup_exit_animation = adp_get_post_meta( $post->ID, '_adp_popup_exit_animation', true, 'popupExitFade' );
$popup_content_box_width = adp_get_post_meta( $post->ID, '_adp_popup_content_box_width', true, 500 );
$popup_notification_box_width = adp_get_post_meta( $post->ID, '_adp_popup_notification_box_width', true, 400 );
$popup_notification_bar_width = adp_get_post_meta( $post->ID, '_adp_popup_notification_bar_width', true, 1024 );
$popup_light_close = adp_get_post_meta( $post->ID, '_adp_popup_light_close', true, false );
$popup_display_overlay = adp_get_post_meta( $post->ID, '_adp_popup_display_overlay', true, false );
$popup_mobile_disable = adp_get_post_meta( $post->ID, '_adp_popup_mobile_disable', true );
$popup_body_scroll_disable = adp_get_post_meta( $post->ID, '_adp_popup_body_scroll_disable', true );
$popup_overlay_close = adp_get_post_meta( $post->ID, '_adp_popup_overlay_close', true );
$popup_esc_close = adp_get_post_meta( $post->ID, '_adp_popup_esc_close', true );
$popup_f4_close = adp_get_post_meta( $post->ID, '_adp_popup_f4_close', true );
// Default location for notification bar.
if ( 'notification-bar' === $popup_type ) {
if ( 'top' !== $popup_location && 'bottom' !== $popup_location ) {
$popup_location = 'bottom';
}
}
?>
<div class="adp-metabox-wrap popup-wrap">
<input type="hidden" name="adp_popup_action" value="1">
<?php wp_nonce_field( 'adp_popup_meta_nonce', 'adp_popup_meta_nonce' ); ?>
<div class="adp-metabox-tabs">
<ul class="adp-metabox-tabs-navigation">
<li><a href="#popup-tab-general"><?php esc_html_e( 'General', 'advanced-popups' ); ?></a></li>
<li><a href="#popup-tab-display"><?php esc_html_e( 'Display Rules', 'advanced-popups' ); ?></a></li>
<li><a href="#popup-tab-triggers"><?php esc_html_e( 'Triggers', 'advanced-popups' ); ?></a></li>
<li><a href="#popup-tab-style"><?php esc_html_e( 'Style', 'advanced-popups' ); ?></a></li>
<li><a href="#popup-tab-advanced"><?php esc_html_e( 'Advanced', 'advanced-popups' ); ?></a></li>
</ul>
<div class="adp-metabox-tabs-content">
<div id="popup-tab-general">
<div class="adp-metabox-field popup-field-type">
<div class="adp-metabox-label">
<label for="adp_popup_type"><?php esc_html_e( 'Type', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_type" name="adp_popup_type">
<option value="content" <?php selected( $popup_type, 'content' ); ?>><?php esc_html_e( 'Content Box', 'advanced-popups' ); ?></option>
<option value="notification-box" <?php selected( $popup_type, 'notification-box' ); ?>><?php esc_html_e( 'Notification Box', 'advanced-popups' ); ?></option>
<option value="notification-bar" <?php selected( $popup_type, 'notification-bar' ); ?>><?php esc_html_e( 'Notification Bar', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-location">
<div class="adp-metabox-label">
<label for="adp_popup_location"><?php esc_html_e( 'Location', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_location" name="adp_popup_location">
<option value="top" <?php selected( $popup_location, 'top' ); ?>><?php esc_html_e( 'Top', 'advanced-popups' ); ?></option>
<option value="top-left" <?php selected( $popup_location, 'top-left' ); ?>><?php esc_html_e( 'Top Left', 'advanced-popups' ); ?></option>
<option value="top-right" <?php selected( $popup_location, 'top-right' ); ?>><?php esc_html_e( 'Top Right', 'advanced-popups' ); ?></option>
<option value="bottom" <?php selected( $popup_location, 'bottom' ); ?>><?php esc_html_e( 'Bottom', 'advanced-popups' ); ?></option>
<option value="bottom-left" <?php selected( $popup_location, 'bottom-left' ); ?>><?php esc_html_e( 'Bottom Left', 'advanced-popups' ); ?></option>
<option value="bottom-right" <?php selected( $popup_location, 'bottom-right' ); ?>><?php esc_html_e( 'Bottom Right', 'advanced-popups' ); ?></option>
<option value="left" <?php selected( $popup_location, 'left' ); ?>><?php esc_html_e( 'Left', 'advanced-popups' ); ?></option>
<option value="right" <?php selected( $popup_location, 'right' ); ?>><?php esc_html_e( 'Right', 'advanced-popups' ); ?></option>
<option value="center" <?php selected( $popup_location, 'center' ); ?>><?php esc_html_e( 'Center', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-preview-image">
<div class="adp-metabox-label">
<label for="adp_popup_preview_image"><?php esc_html_e( 'Preview Image', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_preview_image" name="adp_popup_preview_image">
<option value="left" <?php selected( $popup_preview_image, 'left' ); ?>><?php esc_html_e( 'Left', 'advanced-popups' ); ?></option>
<option value="right" <?php selected( $popup_preview_image, 'right' ); ?>><?php esc_html_e( 'Right', 'advanced-popups' ); ?></option>
<option value="top" <?php selected( $popup_preview_image, 'top' ); ?>><?php esc_html_e( 'Top', 'advanced-popups' ); ?></option>
<option value="bottom" <?php selected( $popup_preview_image, 'bottom' ); ?>><?php esc_html_e( 'Bottom', 'advanced-popups' ); ?></option>
<option value="none" <?php selected( $popup_preview_image, 'none' ); ?>><?php esc_html_e( 'None', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-info-text">
<div class="adp-metabox-label">
<label for="adp_popup_info_text"><?php esc_html_e( 'Notification Text', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<textarea type="number" id="adp_popup_info_text" name="adp_popup_info_text" row="4"><?php echo wp_kses_post( $popup_info_text ); ?></textarea>
</div>
</div>
<div class="adp-metabox-field popup-field-info-buton-label">
<div class="adp-metabox-label">
<label for="adp_popup_info_buton_label"><?php esc_html_e( 'Notification Button Label', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input type="text" id="adp_popup_info_buton_label" name="adp_popup_info_buton_label" value="<?php echo esc_attr( $popup_info_buton_label ); ?>" />
</div>
</div>
<div class="adp-metabox-field popup-field-info-buton-action">
<div class="adp-metabox-label">
<label for="adp_popup_info_button_action"><?php esc_html_e( 'Notification Button Action', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_info_button_action" name="adp_popup_info_button_action">
<option value="link" <?php selected( $popup_info_button_action, 'link' ); ?>><?php esc_html_e( 'Link', 'advanced-popups' ); ?></option>
<option value="accept" <?php selected( $popup_info_button_action, 'accept' ); ?>><?php esc_html_e( 'Accept', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-info-buton-link">
<div class="adp-metabox-label">
<label for="adp_popup_info_button_link"><?php esc_html_e( 'Notification Button Link', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input type="text" id="adp_popup_info_button_link" name="adp_popup_info_button_link" value="<?php echo esc_attr( $popup_info_button_link ); ?>" />
</div>
</div>
<div class="adp-metabox-field popup-field-limit-display">
<div class="adp-metabox-label">
<label for="adp_popup_limit_display"><?php esc_html_e( 'Limit display', 'advanced-popups' ); ?></label>
<p class="description">
<?php esc_html_e( 'Show the popup only [n] times.', 'advanced-popups' ); ?>
</p>
</div>
<div class="adp-metabox-input">
<input class="short" type="number" id="adp_popup_limit_display" name="adp_popup_limit_display" value="<?php echo esc_attr( $popup_limit_display ); ?>" />
</div>
</div>
<div class="adp-metabox-field popup-field-limit-lifetime">
<div class="adp-metabox-label">
<label for="adp_popup_limit_lifetime"><?php esc_html_e( 'Limit display сache lifetime (days)', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input class="short" type="number" id="adp_popup_limit_lifetime " name="adp_popup_limit_lifetime" value="<?php echo esc_attr( $popup_limit_lifetime ); ?>" />
</div>
</div>
<div class="adp-metabox-field">
<div class="adp-metabox-label popup-field-show-to">
<label for="adp_popup_show_to"><?php esc_html_e( 'Guests or Logged-in', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_show_to" name="adp_popup_show_to">
<option value="both" <?php selected( $popup_show_to, 'both' ); ?>><?php esc_html_e( 'Show to both users and guest visitors' ); ?></option>
<option value="guest" <?php selected( $popup_show_to, 'guest' ); ?>><?php esc_html_e( 'Show only to guest visitors' ); ?></option>
<option value="user" <?php selected( $popup_show_to, 'user' ); ?>><?php esc_html_e( 'Show only to logged-in users', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
</div>
<div id="popup-tab-display">
<div class="adp-metabox-field popup-field-rules-mode">
<div class="adp-metabox-label">
<label for="adp_popup_rules_mode"><?php esc_html_e( 'Show Popup', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="radio" id="adp_popup_rules_mode" name="adp_popup_rules_mode" value="all" <?php checked( $popup_rules_mode, 'all' ); ?>> <?php esc_html_e( 'Entire Site', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_rules_mode" name="adp_popup_rules_mode" value="specific" <?php checked( $popup_rules_mode, 'specific' ); ?>> <?php esc_html_e( 'Specific Pages', 'advanced-popups' ); ?></label>&nbsp;
</div>
</div>
<div class="adp-metabox-field popup-field-rules">
<div class="popup-field-rules-list">
<?php
if ( is_array( $popup_rules ) && $popup_rules ) {
foreach ( $popup_rules as $i => $row ) {
?>
<div class="row">
<?php
foreach ( $row as $t => $tools ) {
?>
<div class="tools">
<select class="adp-popup-rules" name="adp_popup_rules[<?php echo esc_attr( $i ); ?>][<?php echo esc_attr( $t ); ?>][rule]">
<?php
$rules = ADP_Popup_Rules::instance()->get_list();
foreach ( $rules as $optgroup => $items ) {
$label = $optgroup;
$label = str_replace( 'general', esc_html__( 'General', 'advanced-popups' ), $label );
$label = str_replace( 'post_types', esc_html__( 'Posts Types', 'advanced-popups' ), $label );
$label = str_replace( 'taxonomies', esc_html__( 'Taxonomies', 'advanced-popups' ), $label );
?>
<optgroup data-group="<?php echo esc_attr( $optgroup ); ?>"
label="<?php echo esc_attr( $label ); ?>">
<?php
foreach ( $items as $key => $name ) {
?>
<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $tools['rule'] ); ?>>
<?php echo esc_html( $name ); ?>
</option>
<?php
}
?>
</option>
<?php
}
?>
</select>
<input type="text" class="adp-popup-url" name="adp_popup_rules[<?php echo esc_attr( $i ); ?>][<?php echo esc_attr( $t ); ?>][url]" value="<?php echo esc_attr( $tools['url'] ); ?>">
<?php
$type = ADP_Popup_Rules::instance()->get_type( $tools['rule'] );
?>
<select multiple class="adp-popup-objects" name="adp_popup_rules[<?php echo esc_attr( $i ); ?>][<?php echo esc_attr( $t ); ?>][object][]">
<?php
if ( isset( $tools['object'] ) && is_array( $tools['object'] ) ) {
foreach ( $tools['object'] as $object ) {
$name = (int) $object;
if ( 'post' === $type ) {
$name = get_the_title( $object );
}
if ( 'taxonomy' === $type ) {
$term = get_term( $object );
$name = $term->name;
}
?>
<option value="<?php echo esc_attr( $object ); ?>" selected="selected"><?php echo esc_html( $name ); ?></option>
<?php
}
}
?>
</select>
<a href="#" class="delete remove-another-rule">
<span class="dashicons dashicons-no-alt"></span>
</a>
</div>
<?php
}
?>
<div class="tools-bar">
<div class="button add-another-rule">
<?php esc_html_e( 'Add another OR rule', 'advanced-popups' ); ?>
</div>
<a href="#" class="delete remove-rule"><?php esc_html_e( 'Remove', 'advanced-popups' ); ?></a>
</div>
</div>
<?php
}
}
?>
</div>
<div class="button button-primary add-new-rule">
<?php esc_html_e( 'Add New Rule ', 'advanced-popups' ); ?>
</div>
</div>
</div>
<div id="popup-tab-triggers">
<div class="adp-metabox-field popup-field-open-trigger">
<div class="adp-metabox-label">
<label for="adp_popup_open_trigger"><?php esc_html_e( 'Trigger Open Popup', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="delay" <?php checked( $popup_open_trigger, 'delay' ); ?>> <?php esc_html_e( 'Time Delay', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="viewed" <?php checked( $popup_open_trigger, 'viewed' ); ?>> <?php esc_html_e( 'Page Viewed', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="read" <?php checked( $popup_open_trigger, 'read' ); ?>> <?php esc_html_e( 'Page Read', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="exit" <?php checked( $popup_open_trigger, 'exit' ); ?>> <?php esc_html_e( 'Exit Intent', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="scroll" <?php checked( $popup_open_trigger, 'scroll' ); ?>> <?php esc_html_e( 'Scroll Position', 'advanced-popups' ); ?></label>
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="accept" <?php checked( $popup_open_trigger, 'accept' ); ?>> <?php esc_html_e( 'Accept Agreement', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_open_trigger" name="adp_popup_open_trigger" value="manual" <?php checked( $popup_open_trigger, 'manual' ); ?>> <?php esc_html_e( 'Manual Launch', 'advanced-popups' ); ?></label>&nbsp;
</div>
</div>
<div class="adp-metabox-field popup-field-open-accept-desc">
<div class="adp-metabox-label"></div>
<div class="adp-metabox-input">
<p class="description"><?php esc_html_e( 'It works for "Notification Box" and "Notification Bar". And if "Notification Button Action" is selected as "Accept", then the popup will be displayed until the user accepts the agreement.', 'advanced-popups' ); ?></p>
</div>
</div>
<div class="adp-metabox-field popup-field-open-delay-number">
<div class="adp-metabox-label">
<label for="adp_popup_open_delay_number"><?php esc_html_e( 'Time Delay', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input class="short" type="number" id="adp_popup_open_delay_number" name="adp_popup_open_delay_number" value="<?php echo esc_attr( $popup_open_delay_number ); ?>" /> <?php esc_html_e( 'Seconds', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-open-scroll-position">
<div class="adp-metabox-label">
<label for="adp_popup_open_scroll_position"><?php esc_html_e( 'Scroll Position', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label>
<input class="short" type="number" id="adp_popup_open_scroll_position" name="adp_popup_open_scroll_position" value="<?php echo esc_attr( $popup_open_scroll_position ); ?>" />
<select class="short" id="adp_popup_open_scroll_type" name="adp_popup_open_scroll_type">
<option value="px" <?php selected( $popup_open_scroll_type, 'px' ); ?>><?php esc_html_e( 'Px.', 'advanced-popups' ); ?></option>
<option value="%" <?php selected( $popup_open_scroll_type, '%' ); ?>><?php esc_html_e( '%', 'advanced-popups' ); ?></option>
</select> <?php esc_html_e( 'of screen', 'advanced-popups' ); ?>
</label>
</div>
</div>
<div class="adp-metabox-field popup-field-open-manual-selector">
<div class="adp-metabox-label">
<label for="adp_popup_open_manual_selector"><?php esc_html_e( 'CSS Selector', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input type="text" id="adp_popup_open_manual_selector" name="adp_popup_open_manual_selector" value="<?php echo esc_attr( $popup_open_manual_selector ); ?>" />
</div>
</div>
<div class="adp-metabox-field popup-field-close-trigger">
<div class="adp-metabox-label">
<label for="adp_popup_close_trigger"><?php esc_html_e( 'Trigger Close Popup', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="radio" id="adp_popup_close_trigger" name="adp_popup_close_trigger" value="none" <?php checked( $popup_close_trigger, 'none' ); ?>> <?php esc_html_e( 'None', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_close_trigger" name="adp_popup_close_trigger" value="delay" <?php checked( $popup_close_trigger, 'delay' ); ?>> <?php esc_html_e( 'Time Delay', 'advanced-popups' ); ?></label>&nbsp;
<label><input type="radio" id="adp_popup_close_trigger" name="adp_popup_close_trigger" value="scroll" <?php checked( $popup_close_trigger, 'scroll' ); ?>> <?php esc_html_e( 'Scroll Position', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-close-delay-number">
<div class="adp-metabox-label">
<label for="adp_popup_close_delay_number"><?php esc_html_e( 'Time Delay', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input class="short" type="number" id="adp_popup_close_delay_number" name="adp_popup_close_delay_number" value="<?php echo esc_attr( $popup_close_delay_number ); ?>" /> <?php esc_html_e( 'Seconds', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-close-scroll-position">
<div class="adp-metabox-label">
<label for="adp_popup_close_scroll_position"><?php esc_html_e( 'Offset Scroll Position', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label>
<input class="short" type="number" id="adp_popup_close_scroll_position" name="adp_popup_close_scroll_position" value="<?php echo esc_attr( $popup_close_scroll_position ); ?>" />
<select class="short" id="adp_popup_close_scroll_type" name="adp_popup_close_scroll_type">
<option value="px" <?php selected( $popup_close_scroll_type, 'px' ); ?>><?php esc_html_e( 'Px.', 'advanced-popups' ); ?></option>
<option value="%" <?php selected( $popup_close_scroll_type, '%' ); ?>><?php esc_html_e( '%', 'advanced-popups' ); ?></option>
</select> <?php esc_html_e( 'of screen', 'advanced-popups' ); ?>
</label>
</div>
</div>
</div>
<div id="popup-tab-style">
<div class="adp-metabox-field popup-field-open-animation">
<div class="adp-metabox-label">
<label for="adp_popup_open_animation"><?php esc_html_e( 'Open Animation', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_open_animation" name="adp_popup_open_animation">
<option value="popupOpenFade" <?php selected( $popup_open_animation, 'popupOpenFade' ); ?>><?php esc_html_e( 'Fade', 'advanced-popups' ); ?></option>
<option value="popupOpenSlide" <?php selected( $popup_open_animation, 'popupOpenSlide' ); ?>><?php esc_html_e( 'Slide', 'advanced-popups' ); ?></option>
<option value="popupOpenZoom" <?php selected( $popup_open_animation, 'popupOpenZoom' ); ?>><?php esc_html_e( 'Zoom', 'advanced-popups' ); ?></option>
<option value="popupOpenSlideFade" <?php selected( $popup_open_animation, 'popupOpenSlideFade' ); ?>><?php esc_html_e( 'Slide and Fade', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-exit-animation">
<div class="adp-metabox-label">
<label for="adp_popup_exit_animation"><?php esc_html_e( 'Exit Animation', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<select id="adp_popup_exit_animation" name="adp_popup_exit_animation">
<option value="popupExitFade" <?php selected( $popup_exit_animation, 'popupExitFade' ); ?>><?php esc_html_e( 'Fade', 'advanced-popups' ); ?></option>
<option value="popupExitSlide" <?php selected( $popup_exit_animation, 'popupExitSlide' ); ?>><?php esc_html_e( 'Slide', 'advanced-popups' ); ?></option>
<option value="popupExitZoom" <?php selected( $popup_exit_animation, 'popupExitZoom' ); ?>><?php esc_html_e( 'Zoom', 'advanced-popups' ); ?></option>
<option value="popupExitSlideFade" <?php selected( $popup_exit_animation, 'popupExitSlideFade' ); ?>><?php esc_html_e( 'Slide and Fade', 'advanced-popups' ); ?></option>
</select>
</div>
</div>
<div class="adp-metabox-field popup-field-content-box-width">
<div class="adp-metabox-label">
<label for="adp_popup_content_box_width"><?php esc_html_e( 'Content Box Width', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label>
<input class="short" type="number" id="adp_popup_content_box_width" name="adp_popup_content_box_width" value="<?php echo esc_attr( $popup_content_box_width ); ?>" /> <?php esc_html_e( 'px.', 'advanced-popups' ); ?>
</label>
</div>
</div>
<div class="adp-metabox-field popup-field-notification-box-width">
<div class="adp-metabox-label">
<label for="adp_popup_notification_box_width"><?php esc_html_e( 'Notification Box Width', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label>
<input class="short" type="number" id="adp_popup_notification_box_width" name="adp_popup_notification_box_width" value="<?php echo esc_attr( $popup_notification_box_width ); ?>" /> <?php esc_html_e( 'px.', 'advanced-popups' ); ?>
</label>
</div>
</div>
<div class="adp-metabox-field popup-field-notification-bar-width">
<div class="adp-metabox-label">
<label for="adp_popup_notification_bar_width"><?php esc_html_e( 'Notification Bar Width', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label>
<input class="short" type="number" id="adp_popup_notification_bar_width" name="adp_popup_notification_bar_width" value="<?php echo esc_attr( $popup_notification_bar_width ); ?>" /> <?php esc_html_e( 'px.', 'advanced-popups' ); ?>
</label>
</div>
</div>
<div class="adp-metabox-field popup-field-display-overlay">
<div class="adp-metabox-label">
<label for="adp_popup_light_close"><?php esc_html_e( 'Light Close Button', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input type="checkbox" id="adp_popup_light_close" name="adp_popup_light_close" value="1" <?php checked( $popup_light_close ); ?>>
</div>
</div>
<div class="adp-metabox-field popup-field-display-overlay">
<div class="adp-metabox-label">
<label for="adp_popup_display_overlay"><?php esc_html_e( 'Display Overlay', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<input type="checkbox" id="adp_popup_display_overlay" name="adp_popup_display_overlay" value="1" <?php checked( $popup_display_overlay ); ?>>
</div>
</div>
</div>
<div id="popup-tab-advanced">
<div class="adp-metabox-field popup-field-mobile-disable">
<div class="adp-metabox-label">
<label for="adp_popup_mobile_disable"><?php esc_html_e( 'Mobile Disable', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="checkbox" id="adp_popup_mobile_disable" name="adp_popup_mobile_disable" value="1" <?php checked( $popup_mobile_disable ); ?>> <?php esc_html_e( 'Disable popup on mobile', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-body-scroll-disable">
<div class="adp-metabox-label">
<label for="adp_popup_body_scroll_disable"><?php esc_html_e( 'Disable Scrolling', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="checkbox" id="adp_popup_body_scroll_disable" name="adp_popup_body_scroll_disable" value="1" <?php checked( $popup_body_scroll_disable ); ?>> <?php esc_html_e( 'Disable scrolling on body', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-overlay-close">
<div class="adp-metabox-label">
<label for="adp_popup_overlay_close"><?php esc_html_e( 'Click Overlay to Close', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="checkbox" id="adp_popup_overlay_close" name="adp_popup_overlay_close" value="1" <?php checked( $popup_overlay_close ); ?>> <?php esc_html_e( 'Checking this will cause popup to close when user clicks on overlay', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-esc-close">
<div class="adp-metabox-label">
<label for="adp_popup_esc_close"><?php esc_html_e( 'Press ESC to Close', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="checkbox" id="adp_popup_esc_close" name="adp_popup_esc_close" value="1" <?php checked( $popup_esc_close ); ?>> <?php esc_html_e( 'Checking this will cause popup to close when user presses ESC key', 'advanced-popups' ); ?></label>
</div>
</div>
<div class="adp-metabox-field popup-field-f4-close">
<div class="adp-metabox-label">
<label for="adp_popup_f4_close"><?php esc_html_e( 'Press F4 to Close', 'advanced-popups' ); ?></label>
</div>
<div class="adp-metabox-input">
<label><input type="checkbox" id="adp_popup_f4_close" name="adp_popup_f4_close" value="1" <?php checked( $popup_f4_close ); ?>> <?php esc_html_e( 'Checking this will cause popup to close when user presses F4 key', 'advanced-popups' ); ?></label>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
/**
* Save meta tags by post
*
* @param int $post_id Post ID.
* @param object $post Post Object.
*/
public function metabox_popup_save( $post_id, $post ) {
// Break if doing autosave.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Break if current user can't edit this post.
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
// Break if this post revision.
if ( wp_is_post_revision( $post_id ) ) {
return;
}
if ( ! isset( $_POST['adp_popup_meta_nonce'] ) || ! wp_verify_nonce( $_POST['adp_popup_meta_nonce'], 'adp_popup_meta_nonce' ) ) { // Input var ok; sanitization ok.
return;
}
if ( ! isset( $_POST['adp_popup_action'] ) || 1 !== (int) $_POST['adp_popup_action'] ) { // Input var ok; sanitization ok.
return;
}
if ( isset( $_POST['adp_popup_type'] ) ) {
$popup_type = sanitize_text_field( $_POST['adp_popup_type'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_type', $popup_type );
}
if ( isset( $_POST['adp_popup_location'] ) ) {
$popup_location = sanitize_text_field( $_POST['adp_popup_location'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_location', $popup_location );
}
if ( isset( $_POST['adp_popup_preview_image'] ) ) {
$popup_preview_image = sanitize_text_field( $_POST['adp_popup_preview_image'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_preview_image', $popup_preview_image );
}
if ( isset( $_POST['adp_popup_info_text'] ) ) {
$popup_info_text = wp_kses_post( $_POST['adp_popup_info_text'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_info_text', $popup_info_text );
}
if ( isset( $_POST['adp_popup_info_buton_label'] ) ) {
$popup_info_buton_label = sanitize_text_field( $_POST['adp_popup_info_buton_label'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_info_buton_label', $popup_info_buton_label );
}
if ( isset( $_POST['adp_popup_info_button_action'] ) ) {
$popup_info_button_action = sanitize_text_field( $_POST['adp_popup_info_button_action'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_info_button_action', $popup_info_button_action );
}
if ( isset( $_POST['adp_popup_info_button_link'] ) ) {
$popup_info_button_link = sanitize_text_field( $_POST['adp_popup_info_button_link'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_info_button_link', $popup_info_button_link );
}
if ( isset( $_POST['adp_popup_limit_display'] ) ) {
$popup_limit_display = (int) sanitize_text_field( $_POST['adp_popup_limit_display'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_limit_display', $popup_limit_display );
}
if ( isset( $_POST['adp_popup_limit_lifetime'] ) ) {
$popup_limit_lifetime = (int) sanitize_text_field( $_POST['adp_popup_limit_lifetime'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_limit_lifetime', $popup_limit_lifetime );
}
if ( isset( $_POST['adp_popup_show_to'] ) ) {
$popup_show_to = sanitize_text_field( $_POST['adp_popup_show_to'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_show_to', $popup_show_to );
}
if ( isset( $_POST['adp_popup_rules_mode'] ) ) {
$popup_rules_mode = sanitize_text_field( $_POST['adp_popup_rules_mode'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_rules_mode', $popup_rules_mode );
}
if ( isset( $_POST['adp_popup_rules'] ) ) {
$popup_rules = map_deep( $_POST['adp_popup_rules'], 'sanitize_text_field' ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_rules', $popup_rules );
} else {
delete_post_meta( $post_id, '_adp_popup_rules' );
}
if ( isset( $_POST['adp_popup_open_trigger'] ) ) {
$popup_open_trigger = sanitize_text_field( $_POST['adp_popup_open_trigger'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_trigger', $popup_open_trigger );
}
if ( isset( $_POST['adp_popup_open_delay_number'] ) ) {
$popup_open_delay_number = sanitize_text_field( $_POST['adp_popup_open_delay_number'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_delay_number', $popup_open_delay_number );
}
if ( isset( $_POST['adp_popup_open_scroll_position'] ) ) {
$popup_open_scroll_position = sanitize_text_field( $_POST['adp_popup_open_scroll_position'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_scroll_position', $popup_open_scroll_position );
}
if ( isset( $_POST['adp_popup_open_scroll_type'] ) ) {
$popup_open_scroll_type = sanitize_text_field( $_POST['adp_popup_open_scroll_type'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_scroll_type', $popup_open_scroll_type );
}
if ( isset( $_POST['adp_popup_open_manual_selector'] ) ) {
$popup_open_manual_selector = sanitize_text_field( $_POST['adp_popup_open_manual_selector'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_manual_selector', $popup_open_manual_selector );
}
if ( isset( $_POST['adp_popup_close_trigger'] ) ) {
$popup_close_trigger = sanitize_text_field( $_POST['adp_popup_close_trigger'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_close_trigger', $popup_close_trigger );
}
if ( isset( $_POST['adp_popup_close_delay_number'] ) ) {
$popup_close_delay_number = sanitize_text_field( $_POST['adp_popup_close_delay_number'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_close_delay_number', $popup_close_delay_number );
}
if ( isset( $_POST['adp_popup_close_scroll_position'] ) ) {
$popup_close_scroll_position = sanitize_text_field( $_POST['adp_popup_close_scroll_position'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_close_scroll_position', $popup_close_scroll_position );
}
if ( isset( $_POST['adp_popup_close_scroll_type'] ) ) {
$popup_close_scroll_type = sanitize_text_field( $_POST['adp_popup_close_scroll_type'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_close_scroll_type', $popup_close_scroll_type );
}
if ( isset( $_POST['adp_popup_open_animation'] ) ) {
$popup_open_animation = sanitize_text_field( $_POST['adp_popup_open_animation'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_open_animation', $popup_open_animation );
}
if ( isset( $_POST['adp_popup_exit_animation'] ) ) {
$popup_exit_animation = sanitize_text_field( $_POST['adp_popup_exit_animation'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_exit_animation', $popup_exit_animation );
}
if ( isset( $_POST['adp_popup_content_box_width'] ) ) {
$popup_content_box_width = (int) sanitize_text_field( $_POST['adp_popup_content_box_width'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_content_box_width', $popup_content_box_width );
}
if ( isset( $_POST['adp_popup_notification_box_width'] ) ) {
$popup_notification_box_width = (int) sanitize_text_field( $_POST['adp_popup_notification_box_width'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_notification_box_width', $popup_notification_box_width );
}
if ( isset( $_POST['adp_popup_notification_bar_width'] ) ) {
$popup_notification_bar_width = (int) sanitize_text_field( $_POST['adp_popup_notification_bar_width'] ); // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_notification_bar_width', $popup_notification_bar_width );
}
if ( isset( $_POST['adp_popup_light_close'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_light_close', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_light_close', '' );
}
if ( isset( $_POST['adp_popup_display_overlay'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_display_overlay', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_display_overlay', '' );
}
if ( isset( $_POST['adp_popup_mobile_disable'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_mobile_disable', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_mobile_disable', '' );
}
if ( isset( $_POST['adp_popup_body_scroll_disable'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_body_scroll_disable', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_body_scroll_disable', '' );
}
if ( isset( $_POST['adp_popup_overlay_close'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_overlay_close', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_overlay_close', '' );
}
if ( isset( $_POST['adp_popup_esc_close'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_esc_close', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_esc_close', '' );
}
if ( isset( $_POST['adp_popup_f4_close'] ) ) { // Input var ok; sanitization ok.
update_post_meta( $post_id, '_adp_popup_f4_close', 1 );
} else {
update_post_meta( $post_id, '_adp_popup_f4_close', '' );
}
}
/**
* Get objects list in rules.
*/
public function ajax_rules_objects() {
check_ajax_referer();
$search = isset( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : ''; // Input var ok; sanitization ok.
$group = isset( $_GET['group'] ) ? sanitize_text_field( $_GET['group'] ) : 'post_types'; // Input var ok; sanitization ok.
$rule = isset( $_GET['rule'] ) ? sanitize_text_field( $_GET['rule'] ) : 'none'; // Input var ok; sanitization ok.
$page = isset( $_GET['page'] ) ? (int) sanitize_text_field( $_GET['page'] ) : 1; // Input var ok; sanitization ok.
// Data container.
$data = array();
// Get object.
$object = ADP_Popup_Rules::instance()->get_object( $rule );
// Get posts.
if ( 'post_types' === $group ) {
$args = array(
's' => $search,
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'posts_per_page' => 10,
'post_type' => $object,
'paged' => $page,
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
$data['items'][ $query->post->ID ] = $query->post->post_title;
}
}
if ( $page < (int) $query->max_num_pages ) {
$data['pagination'] = true;
} else {
$data['pagination'] = false;
}
}
// Get terms.
if ( 'taxonomies' === $group ) {
$terms = get_terms( $object, array(
'hide_empty' => false,
) );
if ( $terms && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$data['items'][ $term->term_id ] = $term->name;
}
}
$data['pagination'] = false;
}
wp_send_json( $data );
}
/**
* Register the stylesheets and JavaScript for the admin area.
*
* @param string $page Current page.
*/
public function admin_enqueue_scripts( $page ) {
global $post_type;
if ( 'adp-popup' !== $post_type ) {
return;
}
if ( in_array( $page, array( 'post.php', 'post-new.php' ), true ) ) {
// Select2.
wp_enqueue_style( 'select2', plugin_dir_url( __FILE__ ) . 'css/select2.min.css' );
wp_enqueue_script( 'select2', plugin_dir_url( __FILE__ ) . 'js/select2.full.min.js', array( 'jquery' ) );
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-tabs' );
// Scripts.
wp_enqueue_script( $this->adp, plugin_dir_url( __FILE__ ) . 'js/advanced-popups-admin.js', array( 'jquery', 'jquery-ui-tabs', 'jquery-ui-sortable', 'select2' ), $this->version, false );
wp_localize_script( $this->adp, 'adp_popup_data', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce(),
'label_general' => esc_html__( 'General', 'advanced-popups' ),
'label_post_types' => esc_html__( 'Posts Types', 'advanced-popups' ),
'label_taxonomies' => esc_html__( 'Taxonomies', 'advanced-popups' ),
'btn_label_another' => esc_html__( 'Add another OR rule', 'advanced-popups' ),
'btn_delete' => esc_html__( 'Remove', 'advanced-popups' ),
'select2_placeholder' => esc_html__( 'Find items...', 'advanced-popups' ),
'select2_errorLoading' => esc_html__( 'The results could not be loaded.', 'advanced-popups' ),
'select2_loadingMore' => esc_html__( 'Loading more results...', 'advanced-popups' ),
'select2_noResults' => esc_html__( 'Nothing not found', 'advanced-popups' ),
'select2_searching' => esc_html__( 'Searching...', 'advanced-popups' ),
'select2_removeAllItems' => esc_html__( 'Remove all items', 'advanced-popups' ),
'rules_list' => wp_json_encode( ADP_Popup_Rules::instance()->get_list() ),
) );
// Styles.
wp_enqueue_style( $this->adp, adp_style( plugin_dir_url( __FILE__ ) . 'css/advanced-popups-admin.css' ), array(), $this->version, 'all' );
}
}
}
@@ -0,0 +1,500 @@
/**
* All of the CSS for your admin-facing functionality should be
* included in this file.
*/
/*--------------------------------------------------------------*/
#adp_popup_metabox .inside {
margin: 0;
padding: 0;
}
#adp_popup_metabox .hidden {
display: none;
}
/* Basic -------------------------------------------------------------- */
.adp-metabox-wrap .adp-metabox-tabs {
background: none;
border: none;
display: flex;
margin: 0;
padding: 0;
border-radius: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation {
display: flex;
flex-direction: column;
border: none;
border-left: 1px solid #eee;
background: #FAFAFA;
flex: 0 0 200px;
margin: 0;
padding: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation:before {
display: none;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li {
display: block;
background: transparent;
border: none;
margin: 0;
padding: 0;
float: none;
outline: none;
box-shadow: none;
border-radius: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li a {
border: none;
border-bottom: 1px solid #eee;
position: relative;
display: block;
font-size: 0.8125rem;
line-height: 1.25rem;
padding: 0.625rem;
text-decoration: none;
outline: none;
box-shadow: none;
color: #0073aa;
float: none;
cursor: pointer;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li a:hover {
color: #00a0d2;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li.ui-tabs-active {
margin: 0;
padding: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li.ui-tabs-active a {
background-color: #eee;
color: #555;
cursor: pointer;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-content {
flex-grow: 1;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-content .ui-tabs-panel {
padding: 0;
border-radius: 0;
}
@media screen and (max-width: 768px) {
.adp-metabox-wrap .adp-metabox-tabs {
flex-direction: column;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation {
flex: 0 0 100%;
}
}
.adp-metabox-wrap .adp-metabox-field {
display: flex;
position: relative;
flex-direction: column;
}
.adp-metabox-wrap .adp-metabox-field:last-child {
border-bottom: none;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label {
position: relative;
flex: 0 0 100%;
float: none;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label label {
display: block;
font-size: 14px;
line-height: 1.4em;
margin: 0 0 3px;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input {
position: relative;
flex: 0 0 100%;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="number"],
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="text"],
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input select,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input textarea {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="number"].short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="text"].short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input select.short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input textarea.short {
max-width: 100px;
}
@media (min-width: 1200px) {
.adp-metabox-wrap .adp-metabox-field {
flex-direction: row;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label {
flex: 0 0 20%;
padding: 1rem 1.25rem;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input {
flex: 0 0 80%;
padding: 1rem 1.25rem;
}
}
.adp-metabox-wrap .adp-metabox-switcher {
display: flex;
position: absolute;
top: -2rem;
left: 1rem;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch {
border: 2px solid #555d66;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: flex;
height: 1.75rem;
height: 18px;
padding: 0;
position: relative;
vertical-align: middle;
width: 36px;
margin-left: 0.5rem;
border-radius: 9px;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-on {
position: absolute;
top: 2px;
right: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0s ease 0.25s;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-off {
border: 2px solid #6c7781;
display: block;
position: absolute;
top: 3px;
left: 3px;
width: 7px;
height: 7px;
z-index: 1;
border-radius: 50%;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-slider {
position: absolute;
top: 2px;
right: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0.25s ease;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 2;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch {
border-color: #11A0D2;
background: #11A0D2;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch .adp-metabox-switch-on {
top: 4px;
right: 6px;
width: 2px;
height: 6px;
background: #FFFFFF;
transition: none;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch .adp-metabox-switch-slider {
background: #FFFFFF;
top: 2px;
right: calc(50% + 4px);
}
.adp-metabox-wrap .adp-metabox-repeater {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater > table {
width: 100%;
border: none;
border-collapse: collapse;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr {
background: #FFFFFF;
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr th {
text-align: right;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr th,
.adp-metabox-wrap .adp-metabox-repeater > table tr td {
border: none;
vertical-align: top;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-sortable-helper {
display: table;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-sortable-placeholder {
background: #F9F9F9;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-state-highlight td {
background: #F9F9F9;
border: 1px dashed #D8D8D8;
}
.adp-metabox-wrap .adp-metabox-repeater .btn-add-row {
margin: 1rem 1.25rem;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content input, .adp-metabox-wrap .adp-metabox-repeater .row-content textarea {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content input[type="number"] {
max-width: 100px;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content p {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar {
position: relative;
border-bottom: 1px solid #EFEFEF;
padding: 1rem 1.25rem;
zoom: 1;
cursor: move;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .handlediv {
display: block !important;
background-position: 6px 5px;
visibility: hidden;
width: 27px;
height: 26px;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .handlediv:before {
content: "\f142";
cursor: pointer;
display: inline-block;
font: 400 20px/1 Dashicons;
line-height: .5;
padding: 8px 10px;
position: relative;
left: 12px;
top: 0;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar.closed .handlediv:before {
content: "\f140";
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .delete {
color: red;
font-weight: 400;
line-height: 26px;
text-decoration: none;
position: relative;
visibility: hidden;
float: left;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .signature {
display: inline-block;
padding-left: 100px;
line-height: 26px;
font-weight: 700;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .signature span {
opacity: 0.5;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar:hover .handlediv,
.adp-metabox-wrap .adp-metabox-repeater .row-topbar:hover .delete {
visibility: visible;
}
.adp-metabox-wrap .adp-metabox-repeater .row-fields {
border-bottom: 1px solid #EFEFEF;
background-color: #FDFDFD;
}
.adp-metabox-wrap .adp-metabox-repeater .row-body {
padding: 1rem 1.25rem;
}
/* Popup -------------------------------------------------------------- */
.adp-metabox-wrap .popup-field-info-text,
.adp-metabox-wrap .popup-field-info-buton-label,
.adp-metabox-wrap .popup-field-info-buton-action,
.adp-metabox-wrap .popup-field-info-buton-link {
display: none;
}
.adp-metabox-wrap .popup-field-rules {
flex-direction: column;
}
.adp-metabox-wrap .popup-field-rules input[type="text"],
.adp-metabox-wrap .popup-field-rules select {
width: 100%;
box-sizing: border-box;
}
.adp-metabox-wrap .popup-field-rules .delete {
display: inline-block;
color: red;
font-weight: 400;
line-height: 26px;
margin-right: 1rem;
}
.adp-metabox-wrap .popup-field-rules .add-new-rule {
margin-right: 1rem;
margin-bottom: 1rem;
margin-left: auto;
}
.adp-metabox-wrap .popup-field-rules-list:not(:empty) {
margin-bottom: 2rem;
}
.adp-metabox-wrap .popup-field-rules-list .row {
border-top: 1px dashed #EEEEEE;
margin-top: 1.5rem;
padding-right: 1.25rem;
padding-left: 1.25rem;
padding-top: 1.5rem;
}
.adp-metabox-wrap .popup-field-rules-list .row:first-child {
border-top: none;
margin-top: 0;
padding-top: 0;
}
.adp-metabox-wrap .popup-field-rules-list .tools {
position: relative;
border-right: 2px solid #555D66;
background: #FAFAFA;
margin-top: 1rem;
padding: 1rem;
padding-left: 3rem;
}
.adp-metabox-wrap .popup-field-rules-list .tools:first-child {
margin-top: 0;
}
.adp-metabox-wrap .popup-field-rules-list .tools-bar {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 1rem;
}
.adp-metabox-wrap .popup-field-rules-list .remove-another-rule {
position: absolute;
justify-content: center;
align-items: center;
top: 1rem;
left: 1rem;
margin: 0;
font-size: 1rem;
color: #555d66;
text-decoration: none;
}
.adp-metabox-wrap .popup-field-rules-list .remove-another-rule:hover {
color: #000000;
}
.adp-metabox-wrap .popup-field-rules-list input[type="text"],
.adp-metabox-wrap .popup-field-rules-list .select2 {
width: 100%;
margin-top: 1rem;
}
.adp-metabox-wrap .popup-field-rules-list .select2-selection {
border: 1px solid #ddd;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
border-radius: 0;
min-height: 30px;
height: 30px;
}
.adp-metabox-wrap .popup-field-rules-list .select2-selection__choice {
background: #FAFAFA;
border-color: #CDCDCD;
}
.adp-metabox-wrap .adp-popup-objects.hidden + .select2 {
display: none;
}
.popup-block-easy .editor-post-title {
margin-bottom: 2rem;
}
.popup-block-easy .edit-post-header-toolbar {
visibility: hidden;
}
.popup-block-easy .editor-post-text-editor,
.popup-block-easy .block-editor-block-list__layout {
display: none;
}
.popup-block-easy .adp-metabox-wrap .popup-field-info-text,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-label,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-action,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-link {
display: flex;
}
@@ -0,0 +1,500 @@
/**
* All of the CSS for your admin-facing functionality should be
* included in this file.
*/
/*--------------------------------------------------------------*/
#adp_popup_metabox .inside {
margin: 0;
padding: 0;
}
#adp_popup_metabox .hidden {
display: none;
}
/* Basic -------------------------------------------------------------- */
.adp-metabox-wrap .adp-metabox-tabs {
background: none;
border: none;
display: flex;
margin: 0;
padding: 0;
border-radius: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation {
display: flex;
flex-direction: column;
border: none;
border-right: 1px solid #eee;
background: #FAFAFA;
flex: 0 0 200px;
margin: 0;
padding: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation:before {
display: none;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li {
display: block;
background: transparent;
border: none;
margin: 0;
padding: 0;
float: none;
outline: none;
box-shadow: none;
border-radius: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li a {
border: none;
border-bottom: 1px solid #eee;
position: relative;
display: block;
font-size: 0.8125rem;
line-height: 1.25rem;
padding: 0.625rem;
text-decoration: none;
outline: none;
box-shadow: none;
color: #0073aa;
float: none;
cursor: pointer;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li a:hover {
color: #00a0d2;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li.ui-tabs-active {
margin: 0;
padding: 0;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation li.ui-tabs-active a {
background-color: #eee;
color: #555;
cursor: pointer;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-content {
flex-grow: 1;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-content .ui-tabs-panel {
padding: 0;
border-radius: 0;
}
@media screen and (max-width: 768px) {
.adp-metabox-wrap .adp-metabox-tabs {
flex-direction: column;
}
.adp-metabox-wrap .adp-metabox-tabs > .adp-metabox-tabs-navigation {
flex: 0 0 100%;
}
}
.adp-metabox-wrap .adp-metabox-field {
display: flex;
position: relative;
flex-direction: column;
}
.adp-metabox-wrap .adp-metabox-field:last-child {
border-bottom: none;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label {
position: relative;
flex: 0 0 100%;
float: none;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label label {
display: block;
font-size: 14px;
line-height: 1.4em;
margin: 0 0 3px;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input {
position: relative;
flex: 0 0 100%;
margin: 0;
padding: 1rem 1rem 0.5rem;
box-sizing: border-box;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="number"],
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="text"],
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input select,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input textarea {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="number"].short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input input[type="text"].short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input select.short,
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input textarea.short {
max-width: 100px;
}
@media (min-width: 1200px) {
.adp-metabox-wrap .adp-metabox-field {
flex-direction: row;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-label {
flex: 0 0 20%;
padding: 1rem 1.25rem;
}
.adp-metabox-wrap .adp-metabox-field .adp-metabox-input {
flex: 0 0 80%;
padding: 1rem 1.25rem;
}
}
.adp-metabox-wrap .adp-metabox-switcher {
display: flex;
position: absolute;
top: -2rem;
right: 1rem;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch {
border: 2px solid #555d66;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: flex;
height: 1.75rem;
height: 18px;
padding: 0;
position: relative;
vertical-align: middle;
width: 36px;
margin-right: 0.5rem;
border-radius: 9px;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-on {
position: absolute;
top: 2px;
left: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0s ease 0.25s;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-off {
border: 2px solid #6c7781;
display: block;
position: absolute;
top: 3px;
right: 3px;
width: 7px;
height: 7px;
z-index: 1;
border-radius: 50%;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-switch .adp-metabox-switch-slider {
position: absolute;
top: 2px;
left: 2px;
width: 10px;
height: 10px;
z-index: 1;
background: #6C7781;
border-radius: 50%;
transition: all 0.25s ease;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
z-index: 2;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch {
border-color: #11A0D2;
background: #11A0D2;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch .adp-metabox-switch-on {
top: 4px;
left: 6px;
width: 2px;
height: 6px;
background: #FFFFFF;
transition: none;
}
.adp-metabox-wrap .adp-metabox-switcher .adp-metabox-checkbox:checked + .adp-metabox-switch .adp-metabox-switch-slider {
background: #FFFFFF;
top: 2px;
left: calc(50% + 4px);
}
.adp-metabox-wrap .adp-metabox-repeater {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater > table {
width: 100%;
border: none;
border-collapse: collapse;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr {
background: #FFFFFF;
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr th {
text-align: left;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr th,
.adp-metabox-wrap .adp-metabox-repeater > table tr td {
border: none;
vertical-align: top;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-sortable-helper {
display: table;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-sortable-placeholder {
background: #F9F9F9;
}
.adp-metabox-wrap .adp-metabox-repeater > table tr.ui-state-highlight td {
background: #F9F9F9;
border: 1px dashed #D8D8D8;
}
.adp-metabox-wrap .adp-metabox-repeater .btn-add-row {
margin: 1rem 1.25rem;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content input, .adp-metabox-wrap .adp-metabox-repeater .row-content textarea {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content input[type="number"] {
max-width: 100px;
}
.adp-metabox-wrap .adp-metabox-repeater .row-content p {
width: 100%;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar {
position: relative;
border-bottom: 1px solid #EFEFEF;
padding: 1rem 1.25rem;
zoom: 1;
cursor: move;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .handlediv {
display: block !important;
background-position: 6px 5px;
visibility: hidden;
width: 27px;
height: 26px;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .handlediv:before {
content: "\f142";
cursor: pointer;
display: inline-block;
font: 400 20px/1 Dashicons;
line-height: .5;
padding: 8px 10px;
position: relative;
right: 12px;
top: 0;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar.closed .handlediv:before {
content: "\f140";
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .delete {
color: red;
font-weight: 400;
line-height: 26px;
text-decoration: none;
position: relative;
visibility: hidden;
float: right;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .signature {
display: inline-block;
padding-right: 100px;
line-height: 26px;
font-weight: 700;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar .signature span {
opacity: 0.5;
}
.adp-metabox-wrap .adp-metabox-repeater .row-topbar:hover .handlediv,
.adp-metabox-wrap .adp-metabox-repeater .row-topbar:hover .delete {
visibility: visible;
}
.adp-metabox-wrap .adp-metabox-repeater .row-fields {
border-bottom: 1px solid #EFEFEF;
background-color: #FDFDFD;
}
.adp-metabox-wrap .adp-metabox-repeater .row-body {
padding: 1rem 1.25rem;
}
/* Popup -------------------------------------------------------------- */
.adp-metabox-wrap .popup-field-info-text,
.adp-metabox-wrap .popup-field-info-buton-label,
.adp-metabox-wrap .popup-field-info-buton-action,
.adp-metabox-wrap .popup-field-info-buton-link {
display: none;
}
.adp-metabox-wrap .popup-field-rules {
flex-direction: column;
}
.adp-metabox-wrap .popup-field-rules input[type="text"],
.adp-metabox-wrap .popup-field-rules select {
width: 100%;
box-sizing: border-box;
}
.adp-metabox-wrap .popup-field-rules .delete {
display: inline-block;
color: red;
font-weight: 400;
line-height: 26px;
margin-left: 1rem;
}
.adp-metabox-wrap .popup-field-rules .add-new-rule {
margin-left: 1rem;
margin-bottom: 1rem;
margin-right: auto;
}
.adp-metabox-wrap .popup-field-rules-list:not(:empty) {
margin-bottom: 2rem;
}
.adp-metabox-wrap .popup-field-rules-list .row {
border-top: 1px dashed #EEEEEE;
margin-top: 1.5rem;
padding-left: 1.25rem;
padding-right: 1.25rem;
padding-top: 1.5rem;
}
.adp-metabox-wrap .popup-field-rules-list .row:first-child {
border-top: none;
margin-top: 0;
padding-top: 0;
}
.adp-metabox-wrap .popup-field-rules-list .tools {
position: relative;
border-left: 2px solid #555D66;
background: #FAFAFA;
margin-top: 1rem;
padding: 1rem;
padding-right: 3rem;
}
.adp-metabox-wrap .popup-field-rules-list .tools:first-child {
margin-top: 0;
}
.adp-metabox-wrap .popup-field-rules-list .tools-bar {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 1rem;
}
.adp-metabox-wrap .popup-field-rules-list .remove-another-rule {
position: absolute;
justify-content: center;
align-items: center;
top: 1rem;
right: 1rem;
margin: 0;
font-size: 1rem;
color: #555d66;
text-decoration: none;
}
.adp-metabox-wrap .popup-field-rules-list .remove-another-rule:hover {
color: #000000;
}
.adp-metabox-wrap .popup-field-rules-list input[type="text"],
.adp-metabox-wrap .popup-field-rules-list .select2 {
width: 100%;
margin-top: 1rem;
}
.adp-metabox-wrap .popup-field-rules-list .select2-selection {
border: 1px solid #ddd;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
border-radius: 0;
min-height: 30px;
height: 30px;
}
.adp-metabox-wrap .popup-field-rules-list .select2-selection__choice {
background: #FAFAFA;
border-color: #CDCDCD;
}
.adp-metabox-wrap .adp-popup-objects.hidden + .select2 {
display: none;
}
.popup-block-easy .editor-post-title {
margin-bottom: 2rem;
}
.popup-block-easy .edit-post-header-toolbar {
visibility: hidden;
}
.popup-block-easy .editor-post-text-editor,
.popup-block-easy .block-editor-block-list__layout {
display: none;
}
.popup-block-easy .adp-metabox-wrap .popup-field-info-text,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-label,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-action,
.popup-block-easy .adp-metabox-wrap .popup-field-info-buton-link {
display: flex;
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,662 @@
"use strict";
/* Basic -------------------------------------------------------------- */
(function($) {
var adpMetabox = {};
( function() {
var $this;
adpMetabox = {
/*
* Initialize
*/
init: function( e ) {
$this = adpMetabox;
// Variables.
$this.wrap = $( '.adp-metabox-wrap' );
// Init.
$this.metaboxInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$this.wrap.on( 'click change keyup keydown', '.adp-metabox-repeater .attribute-name', $this.setSignature );
$this.wrap.on( 'click', '.adp-metabox-repeater .row-topbar', $this.toggleItems );
$this.wrap.on( 'click', '.adp-metabox-repeater .btn-remove-row', $this.removeRepeaterRow );
$this.wrap.on( 'click', '.adp-metabox-repeater .btn-add-row', $this.addRepeaterRow );
},
/*
* Init metabox elements
*/
metaboxInit: function( e ) {
// Add tabs for Meta Box (UI)
$this.wrap.find( '.adp-metabox-tabs' ).tabs();
// Repeater sortable
$this.wrap.find( '.adp-metabox-repeater tbody' ).sortable( {
items: 'tr',
placeholder: 'ui-state-highlight',
handle: '.row-topbar, .row-handle',
start: function( e, ui ) {
ui.placeholder.height( ui.item.height() );
},
} );
},
/*
* Toggle items
*/
toggleItems: function() {
if ( $( this ).hasClass( 'closed' ) ) {
$( this ).removeClass( 'closed' );
$( this ).siblings( '.row-fields' ).slideDown();
} else {
$( this ).addClass( 'closed' );
$( this ).siblings( '.row-fields' ).slideUp();
}
},
/*
* Set signature
*/
setSignature: function() {
var label = '<span>' + $( this ).data( 'label' ) + '</span>';
var value = $( this ).val() ? $( this ).val() : label;
$( this ).parents( '.row-content' ).find( '.signature' ).html( value );
},
/*
* Add repeater row
*/
addRepeaterRow: function() {
var repeater = $( this ).siblings( '.adp-metabox-repeater-table' )
// Get html row.
var html = repeater.find( 'tbody tr.hidden' ).html();
// Add new row.
repeater.find( 'tbody' ).append( '<tr class="row">' + html + '</tr>' );
// Visible all input and textarea.
repeater.find( 'tr' ).not( '.hidden' ).find( 'input, textarea' ).removeAttr( 'disabled' );
return false;
},
/*
* Remove repeater row
*/
removeRepeaterRow: function() {
$( this ).parents( '.row' ).remove();
return false;
}
};
} )();
// Initialize.
$( function() {
adpMetabox.init();
});
})(jQuery);
/* Popup -------------------------------------------------------------- */
(function($) {
var adpPopup = {};
( function() {
var $this;
adpPopup = {
/*
* Initialize
*/
init: function( e ) {
$this = adpPopup;
// Variables.
$this.wrap = $( '.popup-wrap' );
// Init.
$this.popupInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$this.wrap.on( 'change', 'select[name="adp_popup_type"]', $this.actionType );
$this.wrap.on( 'change', 'select[name="adp_popup_info_button_action"]', $this.actionInfoAct );
$this.wrap.on( 'change click', 'input[name="adp_popup_open_trigger"]', $this.actionOpenTrigger );
$this.wrap.on( 'change click', 'input[name="adp_popup_close_trigger"]', $this.actionCloseTrigger );
$this.wrap.on( 'change click', 'input[name="adp_popup_rules_mode"]', $this.actionRulesMode );
$this.wrap.on( 'click', '.add-new-rule', $this.addNewRule );
$this.wrap.on( 'click', '.add-another-rule', $this.addAnotherRule );
$this.wrap.on( 'click', '.remove-rule', $this.removeRule );
$this.wrap.on( 'click', '.remove-another-rule', $this.removeAnotherRule );
$this.wrap.on( 'change', '.adp-popup-rules', $this.actionPopupRules );
},
/*
* Init popup elements
*/
popupInit: function( e ) {
$this.actionType( 'select[name="adp_popup_type"]' );
$this.actionInfoAct( 'select[name="adp_popup_info_button_action"]' );
$this.actionOpenTrigger( 'input[name="adp_popup_open_trigger"]:checked' );
$this.actionCloseTrigger( 'input[name="adp_popup_close_trigger"]:checked' );
$this.actionRulesMode( 'input[name="adp_popup_rules_mode"]:checked' );
$this.actionPopupRules( '.adp-popup-rules' );
},
/*
* Action popup type
*/
actionType: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
// Set editor easy and hide overlay close.
if ( 'content' !== val ) {
$( '.popup-field-overlay-close' ).addClass( 'hidden' );
$( '.block-editor' ).addClass( 'popup-block-easy' );
$( '.editor-post-featured-image' ).parents( '.components-panel__body' ).hide();
} else {
$( '.popup-field-overlay-close' ).removeClass( 'hidden' );
$( '.block-editor' ).removeClass( 'popup-block-easy' );
$( '.editor-post-featured-image' ).parents( '.components-panel__body' ).show();
}
// Hide preview image and content width.
if ( 'content' !== val ) {
$( '.popup-field-preview-image' ).addClass( 'hidden' );
$( '.popup-field-content-box-width' ).addClass( 'hidden' );
} else {
$( '.popup-field-preview-image' ).removeClass( 'hidden' );
$( '.popup-field-content-box-width' ).removeClass( 'hidden' );
}
// Hide notification box width.
if ( 'notification-box' !== val ) {
$( '.popup-field-notification-box-width' ).addClass( 'hidden' );
} else {
$( '.popup-field-notification-box-width' ).removeClass( 'hidden' );
}
// Hide notification bar width.
if ( 'notification-bar' !== val ) {
$( '.popup-field-notification-bar-width' ).addClass( 'hidden' );
} else {
$( '.popup-field-notification-bar-width' ).removeClass( 'hidden' );
}
// Hide location.
if ( 'content' !== val && 'notification-box' !== val ) {
$( 'select[name="adp_popup_location"] option[value="top-left"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="top-right"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="bottom-left"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="bottom-right"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="left"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="right"]' ).addClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="center"]' ).addClass( 'hidden' );
let location = $( 'select[name="adp_popup_location"]' ).val();
if ( 'top' !== location && 'bottom' !== location ) {
$( 'select[name="adp_popup_location"] option[value="bottom"]' ).prop( 'selected', true );
}
} else {
$( 'select[name="adp_popup_location"] option[value="top-left"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="top-right"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="bottom-left"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="bottom-right"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="left"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="right"]' ).removeClass( 'hidden' );
$( 'select[name="adp_popup_location"] option[value="center"]' ).removeClass( 'hidden' );
}
},
/*
* Action info button act.
*/
actionInfoAct: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
if ( 'link' !== val ) {
$( '.popup-field-info-buton-link' ).addClass( 'hidden' );
} else {
$( '.popup-field-info-buton-link' ).removeClass( 'hidden' );
}
},
/*
* Action open trigger.
*/
actionOpenTrigger: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
if ( 'delay' !== val ) {
$( '.popup-field-open-delay-number' ).addClass( 'hidden' );
} else {
$( '.popup-field-open-delay-number' ).removeClass( 'hidden' );
}
if ( 'scroll' !== val ) {
$( '.popup-field-open-scroll-position' ).addClass( 'hidden' );
} else {
$( '.popup-field-open-scroll-position' ).removeClass( 'hidden' );
}
if ( 'accept' !== val ) {
$( '.popup-field-open-accept-desc' ).addClass( 'hidden' );
} else {
$( '.popup-field-open-accept-desc' ).removeClass( 'hidden' );
}
if ( 'manual' !== val ) {
$( '.popup-field-open-manual-selector' ).addClass( 'hidden' );
$( '.popup-field-limit-display' ).removeClass( 'hidden' );
$( '.popup-field-limit-lifetime' ).removeClass( 'hidden' );
} else {
$( '.popup-field-limit-display' ).addClass( 'hidden' );
$( '.popup-field-limit-lifetime' ).addClass( 'hidden' );
$( '.popup-field-open-manual-selector' ).removeClass( 'hidden' );
}
},
/*
* Action close trigger.
*/
actionCloseTrigger: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
if ( 'delay' !== val ) {
$( '.popup-field-close-delay-number' ).addClass( 'hidden' );
} else {
$( '.popup-field-close-delay-number' ).removeClass( 'hidden' );
}
if ( 'scroll' !== val ) {
$( '.popup-field-close-scroll-position' ).addClass( 'hidden' );
} else {
$( '.popup-field-close-scroll-position' ).removeClass( 'hidden' );
}
},
/*
* Action rules mode.
*/
actionRulesMode: function( e ) {
let val = $( typeof e === 'string' ? e : this ).val();
if ( 'specific' !== val ) {
$( '.popup-field-rules' ).addClass( 'hidden' );
} else {
$( '.popup-field-rules' ).removeClass( 'hidden' );
}
},
/*
* Build select rules.
*/
buildSelectRules: function() {
var list = JSON.parse( adp_popup_data.rules_list );
var output = '<select class="adp-popup-rules">';
for ( var optgroup in list ) {
let label = optgroup;
label = label.replace( 'general', adp_popup_data.label_general );
label = label.replace( 'post_types', adp_popup_data.label_post_types );
label = label.replace( 'taxonomies', adp_popup_data.label_taxonomies );
output += '<optgroup data-group="' + optgroup + '" label="' + label + '">';
for ( var event in list[ optgroup ] ) {
output += '<option value="' + event + '">';
// Name of option.
output += list[ optgroup ][ event ];
output += '</option>';
}
output += '</optgroup>';
}
output += '</select>';
return output;
},
/*
* Build input url.
*/
buildInputUrl: function() {
var output = '<input type="text" class="adp-popup-url">';
return output;
},
/*
* Build select objects.
*/
buildSelectObjects: function() {
var output = '<select multiple class="adp-popup-objects"></select>';
return output;
},
/*
* Build row rules.
*/
buildRowRules: function() {
var output = '<div class="row">';
// Add new tools.
output += $this.buildToolsRules();
output += '<div class="tools-bar">';
// Add button another OR rule.
output += '<div class="button add-another-rule">';
output += adp_popup_data.btn_label_another;
output += '</div>';
output += '<a href="#" class="delete remove-rule">';
output += adp_popup_data.btn_delete;
output += '</a>';
output += '</div>';
// Close.
output += '</div>';
return output;
},
/*
* Build tools rules.
*/
buildToolsRules: function() {
var output = '<div class="tools">';
output += $this.buildSelectRules();
output += $this.buildInputUrl();
output += $this.buildSelectObjects();
output += '<a href="#" class="delete remove-another-rule">';
output += '<span class="dashicons dashicons-no-alt"></span>'
output += '</a>';
output += '</div>';
return output;
},
/*
* Add new rule.
*/
addNewRule: function() {
var row = $this.buildRowRules();
$( row ).appendTo( '.popup-field-rules-list' );
$this.setIndexRules();
$this.popupInit();
},
/*
* Add anothe rule.
*/
addAnotherRule: function() {
var tools = $this.buildToolsRules();
$( this ).parents( '.tools-bar' ).before( tools );
$this.setIndexRules();
$this.popupInit();
},
/*
* Remove new rule.
*/
removeRule: function() {
let list = $( this ).parents( '.popup-field-rules-list' );
$( this ).parents( '.row' ).remove();
if ( ! $( list ).find( '.row' ).length ) {
$( list ).html('');
}
$this.setIndexRules();
},
/*
* Remove anothe rule.
*/
removeAnotherRule: function() {
let list = $( this ).parents( '.popup-field-rules-list' );
let row = $( this ).parents( '.row' );
if ( $( row ).find('.tools').length <= 1 ) {
$( this ).parents( '.row' ).remove();
if ( ! $( list ).find( '.row' ).length ) {
$( list ).html('');
}
} else {
$( this ).parents( '.tools' ).remove();
}
$this.setIndexRules();
},
/*
* Set index rules.
*/
setIndexRules: function() {
$( '.popup-field-rules-list .row' ).each(function(i, row) {
$( row ).find( '.tools' ).each(function(t, tools) {
// Select rules.
$( tools ).find( '.adp-popup-rules' ).each(function(j, select) {
$( select ).attr( 'name', 'adp_popup_rules[' + i + '][' + t + '][rule]' );
});
// Input url.
$( tools ).find( '.adp-popup-url' ).each(function(j, input) {
$( input ).attr( 'name', 'adp_popup_rules[' + i + '][' + t + '][url]' );
});
// Input objects.
$( tools ).find( '.adp-popup-objects' ).each(function(j, select) {
$( select ).attr( 'name', 'adp_popup_rules[' + i + '][' + t + '][object][]'.replace( 'index', i ) );
});
});
});
},
/*
* Action poopup rules.
*/
actionPopupRules: function( e ) {
let el = $( typeof e === 'string' ? e : this );
// Action.
if ( typeof e !== 'string' ) {
let select = $( el ).siblings( '.adp-popup-objects' );
let group = $( el ).find('option:selected').parents('optgroup').data( 'group' );
if ( 'general' === group ) {
$( el ).siblings( '.adp-popup-objects' ).addClass( 'hidden' );
} else {
$( el ).siblings( '.adp-popup-objects' ).removeClass( 'hidden' );
}
if ( 'url' !== $( el ).val() ) {
$( el ).siblings( '.adp-popup-url' ).addClass( 'hidden' );
} else {
$( el ).siblings( '.adp-popup-url' ).removeClass( 'hidden' );
}
// Reset options.
$( select ).html( '' );
// Init Select2.
$this.setObjectsSelect2( select );
// Init.
} else {
$( el ).each(function(i, rule) {
let select = $( rule ).siblings( '.adp-popup-objects' );
let group = $( rule ).find('option:selected').parents('optgroup').data( 'group' );
if ( 'general' === group ) {
$( rule ).siblings( '.adp-popup-objects' ).addClass( 'hidden' );
} else {
$( rule ).siblings( '.adp-popup-objects' ).removeClass( 'hidden' );
}
if ( 'url' !== $( rule ).val() ) {
$( rule ).siblings( '.adp-popup-url' ).addClass( 'hidden' );
} else {
$( rule ).siblings( '.adp-popup-url' ).removeClass( 'hidden' );
}
// Init Select2.
$this.setObjectsSelect2( select );
});
}
},
/*
* Set objects Select2.
*/
setObjectsSelect2: function( el ) {
var rules = $( el ).siblings('.adp-popup-rules');
var group = $( rules ).find('option:selected').parents('optgroup').data( 'group' );
var rule = $( rules ).find('option:selected').val();
$( el ).select2( {
placeholder: adp_popup_data.select2_placeholder,
minimumInputLength: 0,
language: {
errorLoading: function() {
return adp_popup_data.select2_errorLoading;
},
loadingMore: function() {
return adp_popup_data.select2_loadingMore;
},
noResults: function() {
return adp_popup_data.select2_noResults;
},
searching: function() {
return adp_popup_data.select2_searching;
},
removeAllItems: function() {
return adp_popup_data.select2_removeAllItems;
}
},
delay: 250,
multiple: true,
width: '100%',
ajax: {
url: adp_popup_data.ajaxurl,
dataType: 'json',
quietMillis: 100,
data: function (params) {
var query = {
group: group,
rule: rule,
search: params.term,
page: params.page || 1,
_wpnonce: adp_popup_data.nonce,
action: 'adp_popup_rules_objects',
}
return query;
},
processResults: function( data, params, params2 ) {
var options = [];
if ( data && typeof data.items !== 'undefined' ) {
$.each( data.items, function( index, text ) {
options.push( { id: index, text: text } );
});
}
return {
results: options,
pagination: {
more: data.pagination,
}
};
},
cache: true
},
} );
}
};
} )();
// Initialize.
$( function() {
adpPopup.init();
});
})(jQuery);
File diff suppressed because one or more lines are too long
@@ -0,0 +1,65 @@
<?php
/**
* Plugin Name: Advanced Popups
* Description: Display high-converting newsletter popups, a cookie notice, or a notification with the light-weight yet feature-rich plugin.
* Version: 1.1.3
* Author: Code Supply Co.
* Author URI: https://codesupply.co
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: advanced-popups
* Domain Path: /languages
*
* @link https://codesupply.co
* @package ADP
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Variables
*/
define( 'ADP_URL', plugin_dir_url( __FILE__ ) );
define( 'ADP_PATH', plugin_dir_path( __FILE__ ) );
/**
* Plugin Activation.
*/
function adp_activation() {
do_action( 'adp_activation' );
}
register_activation_hook( __FILE__, 'adp_activation' );
/**
* Plugin Deactivation.
*/
function adp_deactivation() {
do_action( 'adp_deactivation' );
}
register_deactivation_hook( __FILE__, 'adp_deactivation' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-advanced-popups.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function adp_init() {
$plugin = new ADP();
$plugin->run();
}
adp_init();
@@ -0,0 +1,11 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="advanced-popups-icons" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe913;" glyph-name="x" d="M571.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-226.133-226.133-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 965 B

@@ -0,0 +1 @@
{"IcoMoonType":"selection","icons":[{"icon":{"paths":["M571.733 512l226.133-226.133c17.067-17.067 17.067-42.667 0-59.733s-42.667-17.067-59.733 0l-226.133 226.133-226.133-226.133c-17.067-17.067-42.667-17.067-59.733 0s-17.067 42.667 0 59.733l226.133 226.133-226.133 226.133c-17.067 17.067-17.067 42.667 0 59.733 8.533 8.533 17.067 12.8 29.867 12.8s21.333-4.267 29.867-12.8l226.133-226.133 226.133 226.133c8.533 8.533 21.333 12.8 29.867 12.8s21.333-4.267 29.867-12.8c17.067-17.067 17.067-42.667 0-59.733l-226.133-226.133z"],"attrs":[{}],"isMulticolor":false,"isMulticolor2":false,"tags":["x"],"grid":24},"attrs":[{}],"properties":{"order":1,"id":4,"prevSize":24,"code":59667,"name":"x"},"setIdx":0,"setId":1,"iconIdx":0}],"height":1024,"metadata":{"name":"advanced-popups-icons"},"preferences":{"showGlyphs":true,"showQuickUse":true,"showQuickUse2":true,"showSVGs":true,"fontPref":{"prefix":"adp-icon-","metadata":{"fontFamily":"advanced-popups-icons","majorVersion":1,"minorVersion":0},"metrics":{"emSize":1024,"baseline":6.25,"whitespace":50},"embed":false,"ie7":false,"noie8":true,"showSelector":false,"autoHost":true,"showVersion":false,"showMetadata":false,"showMetrics":false,"cssVars":true,"cssVarsFormat":"scss"},"imagePref":{"prefix":"adp-icon-","png":true,"useClassSelector":true,"color":0,"bgColor":16777215,"classSelector":".advanced-popups-icon","name":"icomoon"},"historySize":100,"showCodes":true,"gridSize":16,"quickUsageToken":{"UntitledProject":"Y2UyMTZhNmEzZGVlN2Q0M2QxNTk5MmQxMTJhZmI4YzgjMSMxNTI5NDk5NDEyIyMj"}}}
@@ -0,0 +1,35 @@
<?php
/**
* Define the internationalization functionality
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/includes
*/
/**
* Define the internationalization functionality.
*
* Loads and defines the internationalization files for this plugin
* so that it is ready for translation.
*
* @package ADP
* @subpackage ADP/includes
*/
class ADP_i18n {
/**
* Load the plugin text domain for translation.
*/
public function load_plugin_textdomain() {
load_plugin_textdomain( 'advanced-popups', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/' );
}
}
@@ -0,0 +1,115 @@
<?php
/**
* Register all actions and filters for the plugin
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/includes
*/
/**
* Register all actions and filters for the plugin.
*
* Maintain a list of all hooks that are registered throughout
* the plugin, and register them with the WordPress API. Call the
* run function to execute the list of actions and filters.
*
* @package ADP
* @subpackage ADP/includes
*/
class ADP_Loader {
/**
* The array of actions registered with WordPress.
*
* @access protected
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
*/
protected $actions;
/**
* The array of filters registered with WordPress.
*
* @access protected
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
*/
protected $filters;
/**
* Initialize the collections used to maintain the actions and filters.
*/
public function __construct() {
$this->actions = array();
$this->filters = array();
}
/**
* Add a new action to the collection to be registered with WordPress.
* @param string $hook The name of the WordPress action that is being registered.
* @param object $component A reference to the instance of the object on which the action is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
*/
public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* Add a new filter to the collection to be registered with WordPress.
*
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority Optional. The priority at which the function should be fired. Default is 10.
* @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
*/
public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
$this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
}
/**
* A utility function that is used to register the actions and hooks into a single
* collection.
* @access private
* @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
* @param string $hook The name of the WordPress filter that is being registered.
* @param object $component A reference to the instance of the object on which the filter is defined.
* @param string $callback The name of the function definition on the $component.
* @param int $priority The priority at which the function should be fired.
* @param int $accepted_args The number of arguments that should be passed to the $callback.
* @return array The collection of actions and filters registered with WordPress.
*/
private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
$hooks[] = array(
'hook' => $hook,
'component' => $component,
'callback' => $callback,
'priority' => $priority,
'accepted_args' => $accepted_args,
);
return $hooks;
}
/**
* Register the filters and actions with WordPress.
*/
public function run() {
foreach ( $this->filters as $hook ) {
add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
foreach ( $this->actions as $hook ) {
add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
}
}
}
@@ -0,0 +1,251 @@
<?php
/**
* Class Advanced Popups Rules.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/includes
*/
/**
* Class Rules
*/
class ADP_Popup_Rules {
/**
* The instance.
*
* @var mixed $instance The instance.
*/
public static $instance;
/**
* The rules.
*
* @var array $instance The rules.
*/
public $rules;
/**
* The rule sort order.
*
* @var array $rule_sort_order The rule sort order.
*/
public $rule_sort_order = array();
/**
* Init.
*/
public static function init() {
self::instance();
}
/**
* Return instance.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Get List rules
*/
public function get_list() {
$list = array(
'general' => array(),
'post_types' => array(),
'taxonomies' => array(),
);
$types = array();
// General.
$list['general'] = array(
'none' => esc_html__( 'None', 'advanced-popups' ),
'is_front_page' => esc_html__( 'Front Page', 'advanced-popups' ),
'is_home' => esc_html__( 'Home Page', 'advanced-popups' ),
'is_archive' => esc_html__( 'Archive Page', 'advanced-popups' ),
'is_author' => esc_html__( 'Author Page', 'advanced-popups' ),
'is_search' => esc_html__( 'Search Result Page', 'advanced-popups' ),
'is_404' => esc_html__( '404 Error Page', 'advanced-popups' ),
'url' => esc_html__( 'URL (slug)', 'advanced-popups' ),
);
// Post types.
$post_types = get_post_types( array(
'public' => true,
), 'objects' );
foreach ( $post_types as $name => $post_type ) {
if ( 'adp-popup' === $name ) {
continue;
}
if ( 'attachment' === $name ) {
continue;
}
$types[] = $name;
$list['post_types'][ 'post_type_' . $name ] = $post_type->labels->name;
}
// Taxonomies.
foreach ( $types as $name ) {
$post_type = get_post_type_object( $name );
$taxonomies = get_object_taxonomies( $name, 'object' );
foreach ( $taxonomies as $tax_name => $taxonomy ) {
$list['taxonomies'][ 'taxonomy_' . $tax_name ] = esc_html__( 'Taxonomy of ', 'advanced-popups' ) . $post_type->labels->name . ': ' . $taxonomy->labels->name;
}
}
return $list;
}
/**
* Get type from rule value
*
* @param string $val The value.
*/
public function get_type( $val ) {
if ( 'url' === $val ) {
return 'url';
}
if ( 0 === strpos( $val, 'is_' ) ) {
return 'is';
}
if ( 0 === strpos( $val, 'post_type' ) ) {
return 'post';
}
if ( 0 === strpos( $val, 'taxonomy' ) ) {
return 'taxonomy';
}
}
/**
* Get object from rule value
*
* @param string $val The value.
*/
public function get_object( $val ) {
$val = str_replace( array( 'post_type', 'taxonomy' ), '', $val );
return ltrim( $val, '_' );
}
/**
* Checking all the rules on the front end
*
* @param string $rules The rules.
*/
public function is_check( $rules ) {
if ( ! $rules ) {
return true;
}
$check = array();
foreach ( $rules as $i => $row ) {
$check[ $i ] = true;
foreach ( $row as $t => $tools ) {
if ( ! isset( $tools['rule'] ) ) {
continue;
}
if ( 'none' === $tools['rule'] ) {
continue;
}
$rule = $tools['rule'];
// Get type from rule value.
$type_rule = self::instance()->get_type( $rule );
// Get type object from rule value.
$type_object = self::instance()->get_object( $rule );
$check_or = true;
// Check rules.
switch ( $type_rule ) {
case 'url':
if ( isset( $tools['url'] ) && $tools['url'] ) {
$object_uri = ltrim( rtrim( $tools['url'], '/' ), '/' );
$current_uri = ltrim( rtrim( $_SERVER['REQUEST_URI'], '/' ), '/' );
if ( $object_uri !== $current_uri ) {
$check_or = false;
}
}
break;
case 'is':
if ( ! function_exists( $rule ) || ! call_user_func( $rule ) ) {
$check_or = false;
}
break;
case 'post':
if ( ! is_singular( $type_object ) ) {
$check_or = false;
}
$post_id = get_the_ID();
if ( isset( $tools['object'] ) && is_array( $tools['object'] ) ) {
foreach ( $tools['object'] as $object ) {
$check_or = (int) $post_id === (int) $object ? true : false;
}
}
break;
case 'taxonomy':
if ( ! is_tax( $type_object ) ) {
$check_or = false;
}
$term_id = get_queried_object_id();
if ( isset( $tools['object'] ) && is_array( $tools['object'] ) ) {
foreach ( $tools['object'] as $object ) {
$check_or = (int) $term_id === (int) $object ? true : false;
}
}
break;
}
$check[ $i ] = $check_or;
if ( $check_or ) {
break;
}
}
}
$is_check = true;
foreach ( $check as $item ) {
if ( ! $item ) {
$is_check = false;
break;
}
}
return $is_check;
}
}
@@ -0,0 +1,210 @@
<?php
/**
* The file that defines the core plugin class
*
* A class definition that includes attributes and functions used across both the
* public-facing side of the site and the admin area.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/includes
*/
/**
* The core plugin class.
*
* This is used to define internationalization, admin-specific hooks, and
* public-facing site hooks.
*
* Also maintains the unique identifier of this plugin as well as the current
* version of the plugin.
*
* @since 1.0.0
* @package ADP
* @subpackage ADP/includes
*/
class ADP {
/**
* The loader that's responsible for maintaining and registering all hooks that power
* the plugin.
*
* @access protected
* @var ADP_Loader $loader Maintains and registers all hooks for the plugin.
*/
protected $loader;
/**
* The unique identifier of this plugin.
*
* @access protected
* @var string $adp The string used to uniquely identify this plugin.
*/
protected $adp;
/**
* The current version of the plugin.
*
* @access protected
* @var string $version The current version of the plugin.
*/
protected $version;
/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*/
public function __construct() {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// Get plugin data.
$plugin_data = get_plugin_data( ADP_PATH . '/advanced-popups.php' );
$this->version = $plugin_data['Version'];
$this->adp = 'advanced-popups';
$this->load_dependencies();
$this->set_locale();
$this->define_admin_hooks();
$this->define_public_hooks();
}
/**
* Load the required dependencies for this plugin.
*
* Include the following files that make up the plugin:
*
* - ADP_Loader. Orchestrates the hooks of the plugin.
* - ADP_i18n. Defines internationalization functionality.
* - ADP_Admin. Defines all hooks for the admin area.
* - ADP_Public. Defines all hooks for the public side of the site.
*
* Create an instance of the loader which will be used to register the hooks
* with WordPress.
*
* @access private
*/
private function load_dependencies() {
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/helpers-advanced-popups.php';
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-popups-rules.php';
/**
* The class responsible for orchestrating the actions and filters of the
* core plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-popups-loader.php';
/**
* The class responsible for defining internationalization functionality
* of the plugin.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-advanced-popups-i18n.php';
/**
* The class responsible for defining all actions that occur in the admin area.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-advanced-popups-admin.php';
/**
* The class responsible for defining all actions that occur in the public-facing
* side of the site.
*/
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-advanced-popups-public.php';
$this->loader = new ADP_Loader();
}
/**
* Define the locale for this plugin for internationalization.
*
* Uses the ADP_i18n class in order to set the domain and to register the hook
* with WordPress.
*
* @access private
*/
private function set_locale() {
$plugin_i18n = new ADP_i18n();
$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
}
/**
* Register all of the hooks related to the admin area functionality
* of the plugin.
*
* @access private
*/
private function define_admin_hooks() {
$plugin_admin = new ADP_Admin( $this->get_adp(), $this->get_version() );
$this->loader->add_action( 'init', $plugin_admin, 'register_post_type' );
$this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'metabox_popup_register' );
$this->loader->add_action( 'save_post', $plugin_admin, 'metabox_popup_save', 10, 2 );
$this->loader->add_action( 'wp_ajax_nopriv_adp_popup_rules_objects', $plugin_admin, 'ajax_rules_objects' );
$this->loader->add_action( 'wp_ajax_adp_popup_rules_objects', $plugin_admin, 'ajax_rules_objects' );
$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'admin_enqueue_scripts' );
}
/**
* Register all of the hooks related to the public-facing functionality
* of the plugin.
*
* @access private
*/
private function define_public_hooks() {
$plugin_public = new ADP_Public( $this->get_adp(), $this->get_version() );
$this->loader->add_action( 'wp_head', $plugin_public, 'wp_head' );
$this->loader->add_action( 'wp_footer', $plugin_public, 'wp_footer' );
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'wp_enqueue_scripts' );
}
/**
* Run the loader to execute all of the hooks with WordPress.
*/
public function run() {
$this->loader->run();
}
/**
* The name of the plugin used to uniquely identify it within the context of
* WordPress and to define internationalization functionality.
*
* @return string The name of the plugin.
*/
public function get_adp() {
return $this->adp;
}
/**
* The reference to the class that orchestrates the hooks with the plugin.
*
* @return ADP_Loader Orchestrates the hooks of the plugin.
*/
public function get_loader() {
return $this->loader;
}
/**
* Retrieve the version number of the plugin.
*
* @return string The version number of the plugin.
*/
public function get_version() {
return $this->version;
}
}
@@ -0,0 +1,87 @@
<?php
/**
* Helpers Advanced Popups
*
* @package ADP
* @subpackage ADP/includes
*/
/**
* Processing path of style.
*
* @param string $path URL to the stylesheet.
*/
function adp_style( $path ) {
// Check RTL.
if ( is_rtl() ) {
return $path;
}
// Check Dev.
$dev = ADP_PATH . 'public/css/advanced-popups-public-dev.css';
if ( file_exists( $dev ) ) {
return str_replace( '.css', '-dev.css', $path );
}
return $path;
}
/**
* Retrieves a post meta field for the given post ID.
*
* @param int $post_id Post ID.
* @param string $key Optional. The meta key to retrieve. By default, returns
* data for all keys. Default empty.
* @param bool $single Optional. If true, returns only the first value for the specified meta key.
* This parameter has no effect if $key is not specified. Default false.
* @param mixed $default Default value.
* @return mixed Will be an array if $single is false. Will be value of the meta
* field if $single is true.
*/
function adp_get_post_meta( $post_id, $key = '', $single = false, $default = null ) {
if ( ! metadata_exists( 'post', $post_id, $key ) && $default ) {
return $default;
}
return get_metadata( 'post', $post_id, $key, $single );
}
/**
* Checks whether a popup should be displayed or not
*
* @param int $popup_id The popup Id.
*/
function adp_is_popup_visible( $popup_id ) {
$visible = true;
// Verify rules.
$popup_rules_mode = adp_get_post_meta( $popup_id, '_adp_popup_rules_mode', true, 'all' );
if ( true === $visible && 'specific' === $popup_rules_mode ) {
$popup_rules = adp_get_post_meta( $popup_id, '_adp_popup_rules', true, array() );
$visible = ADP_Popup_Rules::instance()->is_check( $popup_rules );
}
// Has user seen this popup before?
$popup_limit_display = adp_get_post_meta( $popup_id, '_adp_popup_limit_display', true, 1 );
if ( true === $visible && $popup_limit_display && isset( $_COOKIE[ "adp-popup-{$popup_id}" ] ) && $_COOKIE[ "adp-popup-{$popup_id}" ] >= $popup_limit_display ) {
$visible = false;
}
// Guests or Logged-in.
if ( true === $visible ) {
$popup_show_to = adp_get_post_meta( $popup_id, '_adp_popup_show_to', true, 'both' );
$visible = ! ( ( 'guest' === $popup_show_to && is_user_logged_in() ) || ( 'user' === $popup_show_to && ! is_user_logged_in() ) );
}
// Apply a final filter to determine visibility.
$visible = apply_filters( 'advanced_popups_is_popup_visible', $visible, $popup_id );
return $visible;
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,389 @@
# Copyright (C) 2021 advanced-popups
# This file is distributed under the same license as the advanced-popups package.
msgid ""
msgstr ""
"Project-Id-Version: advanced-popups\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language-Team: Code Supply Co. <hello@codesupply.co>\n"
"Last-Translator: Code Supply Co. <hello@codesupply.co>\n"
"Report-Msgid-Bugs-To: https://codesupply.co/contact/\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: *.js\n"
"X-Poedit-SourceCharset: UTF-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: admin/class-advanced-popups-admin.php:93
msgid "Popup Settings"
msgstr ""
#: admin/class-advanced-popups-admin.php:151, admin/class-advanced-popups-admin.php:299, admin/class-advanced-popups-admin.php:911
msgid "General"
msgstr ""
#: admin/class-advanced-popups-admin.php:152
msgid "Display Rules"
msgstr ""
#: admin/class-advanced-popups-admin.php:153
msgid "Triggers"
msgstr ""
#: admin/class-advanced-popups-admin.php:154
msgid "Style"
msgstr ""
#: admin/class-advanced-popups-admin.php:155
msgid "Advanced"
msgstr ""
#: admin/class-advanced-popups-admin.php:161
msgid "Type"
msgstr ""
#: admin/class-advanced-popups-admin.php:165
msgid "Content Box"
msgstr ""
#: admin/class-advanced-popups-admin.php:166
msgid "Notification Box"
msgstr ""
#: admin/class-advanced-popups-admin.php:167
msgid "Notification Bar"
msgstr ""
#: admin/class-advanced-popups-admin.php:173
msgid "Location"
msgstr ""
#: admin/class-advanced-popups-admin.php:177, admin/class-advanced-popups-admin.php:197
msgid "Top"
msgstr ""
#: admin/class-advanced-popups-admin.php:178
msgid "Top Left"
msgstr ""
#: admin/class-advanced-popups-admin.php:179
msgid "Top Right"
msgstr ""
#: admin/class-advanced-popups-admin.php:180, admin/class-advanced-popups-admin.php:198
msgid "Bottom"
msgstr ""
#: admin/class-advanced-popups-admin.php:181
msgid "Bottom Left"
msgstr ""
#: admin/class-advanced-popups-admin.php:182
msgid "Bottom Right"
msgstr ""
#: admin/class-advanced-popups-admin.php:183, admin/class-advanced-popups-admin.php:195
msgid "Left"
msgstr ""
#: admin/class-advanced-popups-admin.php:184, admin/class-advanced-popups-admin.php:196
msgid "Right"
msgstr ""
#: admin/class-advanced-popups-admin.php:185
msgid "Center"
msgstr ""
#: admin/class-advanced-popups-admin.php:191
msgid "Preview Image"
msgstr ""
#: admin/class-advanced-popups-admin.php:199, admin/class-advanced-popups-admin.php:432, includes/class-advanced-popups-rules.php:70
msgid "None"
msgstr ""
#: admin/class-advanced-popups-admin.php:205
msgid "Notification Text"
msgstr ""
#: admin/class-advanced-popups-admin.php:213
msgid "Notification Button Label"
msgstr ""
#: admin/class-advanced-popups-admin.php:221
msgid "Notification Button Action"
msgstr ""
#: admin/class-advanced-popups-admin.php:225
msgid "Link"
msgstr ""
#: admin/class-advanced-popups-admin.php:226
msgid "Accept"
msgstr ""
#: admin/class-advanced-popups-admin.php:232
msgid "Notification Button Link"
msgstr ""
#: admin/class-advanced-popups-admin.php:240
msgid "Limit display"
msgstr ""
#: admin/class-advanced-popups-admin.php:242
msgid "Show the popup only [n] times."
msgstr ""
#: admin/class-advanced-popups-admin.php:251
msgid "Limit display сache lifetime (days)"
msgstr ""
#: admin/class-advanced-popups-admin.php:260
msgid "Guests or Logged-in"
msgstr ""
#: admin/class-advanced-popups-admin.php:266
msgid "Show only to logged-in users"
msgstr ""
#: admin/class-advanced-popups-admin.php:274
msgid "Show Popup"
msgstr ""
#: admin/class-advanced-popups-admin.php:277
msgid "Entire Site"
msgstr ""
#: admin/class-advanced-popups-admin.php:278
msgid "Specific Pages"
msgstr ""
#: admin/class-advanced-popups-admin.php:300, admin/class-advanced-popups-admin.php:912
msgid "Posts Types"
msgstr ""
#: admin/class-advanced-popups-admin.php:301, admin/class-advanced-popups-admin.php:913
msgid "Taxonomies"
msgstr ""
#: admin/class-advanced-popups-admin.php:358, admin/class-advanced-popups-admin.php:914
msgid "Add another OR rule"
msgstr ""
#: admin/class-advanced-popups-admin.php:361, admin/class-advanced-popups-admin.php:915
msgid "Remove"
msgstr ""
#: admin/class-advanced-popups-admin.php:371
msgid "Add New Rule "
msgstr ""
#: admin/class-advanced-popups-admin.php:378
msgid "Trigger Open Popup"
msgstr ""
#: admin/class-advanced-popups-admin.php:381, admin/class-advanced-popups-admin.php:398, admin/class-advanced-popups-admin.php:433, admin/class-advanced-popups-admin.php:439
msgid "Time Delay"
msgstr ""
#: admin/class-advanced-popups-admin.php:382
msgid "Page Viewed"
msgstr ""
#: admin/class-advanced-popups-admin.php:383
msgid "Page Read"
msgstr ""
#: admin/class-advanced-popups-admin.php:384
msgid "Exit Intent"
msgstr ""
#: admin/class-advanced-popups-admin.php:385, admin/class-advanced-popups-admin.php:406, admin/class-advanced-popups-admin.php:434
msgid "Scroll Position"
msgstr ""
#: admin/class-advanced-popups-admin.php:386
msgid "Accept Agreement"
msgstr ""
#: admin/class-advanced-popups-admin.php:387
msgid "Manual Launch"
msgstr ""
#: admin/class-advanced-popups-admin.php:393
msgid "It works for \"Notification Box\" and \"Notification Bar\". And if \"Notification Button Action\" is selected as \"Accept\", then the popup will be displayed until the user accepts the agreement."
msgstr ""
#: admin/class-advanced-popups-admin.php:401, admin/class-advanced-popups-admin.php:442
msgid "Seconds"
msgstr ""
#: admin/class-advanced-popups-admin.php:413, admin/class-advanced-popups-admin.php:454
msgid "Px."
msgstr ""
#: admin/class-advanced-popups-admin.php:414, admin/class-advanced-popups-admin.php:455
msgid "%"
msgstr ""
#: admin/class-advanced-popups-admin.php:415, admin/class-advanced-popups-admin.php:456
msgid "of screen"
msgstr ""
#: admin/class-advanced-popups-admin.php:421
msgid "CSS Selector"
msgstr ""
#: admin/class-advanced-popups-admin.php:429
msgid "Trigger Close Popup"
msgstr ""
#: admin/class-advanced-popups-admin.php:447
msgid "Offset Scroll Position"
msgstr ""
#: admin/class-advanced-popups-admin.php:464
msgid "Open Animation"
msgstr ""
#: admin/class-advanced-popups-admin.php:468, admin/class-advanced-popups-admin.php:481
msgid "Fade"
msgstr ""
#: admin/class-advanced-popups-admin.php:469, admin/class-advanced-popups-admin.php:482
msgid "Slide"
msgstr ""
#: admin/class-advanced-popups-admin.php:470, admin/class-advanced-popups-admin.php:483
msgid "Zoom"
msgstr ""
#: admin/class-advanced-popups-admin.php:471, admin/class-advanced-popups-admin.php:484
msgid "Slide and Fade"
msgstr ""
#: admin/class-advanced-popups-admin.php:477
msgid "Exit Animation"
msgstr ""
#: admin/class-advanced-popups-admin.php:490
msgid "Content Box Width"
msgstr ""
#: admin/class-advanced-popups-admin.php:494, admin/class-advanced-popups-admin.php:504, admin/class-advanced-popups-admin.php:514
msgid "px."
msgstr ""
#: admin/class-advanced-popups-admin.php:500
msgid "Notification Box Width"
msgstr ""
#: admin/class-advanced-popups-admin.php:510
msgid "Notification Bar Width"
msgstr ""
#: admin/class-advanced-popups-admin.php:520
msgid "Light Close Button"
msgstr ""
#: admin/class-advanced-popups-admin.php:528
msgid "Display Overlay"
msgstr ""
#: admin/class-advanced-popups-admin.php:538
msgid "Mobile Disable"
msgstr ""
#: admin/class-advanced-popups-admin.php:541
msgid "Disable popup on mobile"
msgstr ""
#: admin/class-advanced-popups-admin.php:546
msgid "Disable Scrolling"
msgstr ""
#: admin/class-advanced-popups-admin.php:549
msgid "Disable scrolling on body"
msgstr ""
#: admin/class-advanced-popups-admin.php:554
msgid "Click Overlay to Close"
msgstr ""
#: admin/class-advanced-popups-admin.php:557
msgid "Checking this will cause popup to close when user clicks on overlay"
msgstr ""
#: admin/class-advanced-popups-admin.php:562
msgid "Press ESC to Close"
msgstr ""
#: admin/class-advanced-popups-admin.php:565
msgid "Checking this will cause popup to close when user presses ESC key"
msgstr ""
#: admin/class-advanced-popups-admin.php:570
msgid "Press F4 to Close"
msgstr ""
#: admin/class-advanced-popups-admin.php:573
msgid "Checking this will cause popup to close when user presses F4 key"
msgstr ""
#: admin/class-advanced-popups-admin.php:916
msgid "Find items..."
msgstr ""
#: admin/class-advanced-popups-admin.php:917
msgid "The results could not be loaded."
msgstr ""
#: admin/class-advanced-popups-admin.php:918
msgid "Loading more results..."
msgstr ""
#: admin/class-advanced-popups-admin.php:919
msgid "Nothing not found"
msgstr ""
#: admin/class-advanced-popups-admin.php:920
msgid "Searching..."
msgstr ""
#: admin/class-advanced-popups-admin.php:921
msgid "Remove all items"
msgstr ""
#: includes/class-advanced-popups-rules.php:71
msgid "Front Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:72
msgid "Home Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:73
msgid "Archive Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:74
msgid "Author Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:75
msgid "Search Result Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:76
msgid "404 Error Page"
msgstr ""
#: includes/class-advanced-popups-rules.php:77
msgid "URL (slug)"
msgstr ""
#: includes/class-advanced-popups-rules.php:108
msgid "Taxonomy of "
msgstr ""
@@ -0,0 +1,271 @@
<?php
/**
* The public-facing functionality of the plugin.
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
* @subpackage ADP/public
*/
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package ADP
* @subpackage ADP/public
*/
class ADP_Public {
/**
* The ID of this plugin.
* @access private
* @var string $adp The ID of this plugin.
*/
private $adp;
/**
* The version of this plugin.
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @param string $adp The name of the plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $adp, $version ) {
$this->adp = $adp;
$this->version = $version;
}
/**
* Initialize
*/
public function wp_footer() {
$query = new WP_Query();
// Get all popups.
$popups = $query->query( array(
'post_status' => 'publish',
'post_type' => 'adp-popup',
'posts_per_page' => -1,
) );
// Looop popups.
foreach ( $popups as $popup ) {
$popup_type = adp_get_post_meta( $popup->ID, '_adp_popup_type', true, 'content' );
$popup_location = adp_get_post_meta( $popup->ID, '_adp_popup_location', true, 'center' );
$popup_preview_image = adp_get_post_meta( $popup->ID, '_adp_popup_preview_image', true, 'left' );
$popup_info_text = adp_get_post_meta( $popup->ID, '_adp_popup_info_text', true );
$popup_info_buton_label = adp_get_post_meta( $popup->ID, '_adp_popup_info_buton_label', true );
$popup_info_button_action = adp_get_post_meta( $popup->ID, '_adp_popup_info_button_action', true, 'link' );
$popup_info_button_link = adp_get_post_meta( $popup->ID, '_adp_popup_info_button_link', true );
$popup_limit_display = adp_get_post_meta( $popup->ID, '_adp_popup_limit_display', true, 1 );
$popup_limit_lifetime = adp_get_post_meta( $popup->ID, '_adp_popup_limit_lifetime', true, 30 );
$popup_open_trigger = adp_get_post_meta( $popup->ID, '_adp_popup_open_trigger', true, 'delay' );
$popup_open_delay_number = adp_get_post_meta( $popup->ID, '_adp_popup_open_delay_number', true, 1 );
$popup_open_scroll_position = adp_get_post_meta( $popup->ID, '_adp_popup_open_scroll_position', true, 10 );
$popup_open_scroll_type = adp_get_post_meta( $popup->ID, '_adp_popup_open_scroll_type', true, '%' );
$popup_open_manual_selector = adp_get_post_meta( $popup->ID, '_adp_popup_open_manual_selector', true );
$popup_close_trigger = adp_get_post_meta( $popup->ID, '_adp_popup_close_trigger', true, 'none' );
$popup_close_delay_number = adp_get_post_meta( $popup->ID, '_adp_popup_close_delay_number', true, 30 );
$popup_close_scroll_position = adp_get_post_meta( $popup->ID, '_adp_popup_close_scroll_position', true, 10 );
$popup_close_scroll_type = adp_get_post_meta( $popup->ID, '_adp_popup_close_scroll_type', true, '%' );
$popup_open_animation = adp_get_post_meta( $popup->ID, '_adp_popup_open_animation', true, 'popupOpenFade' );
$popup_exit_animation = adp_get_post_meta( $popup->ID, '_adp_popup_exit_animation', true, 'popupExitFade' );
$popup_content_box_width = adp_get_post_meta( $popup->ID, '_adp_popup_content_box_width', true, 500 );
$popup_notification_box_width = adp_get_post_meta( $popup->ID, '_adp_popup_notification_box_width', true, 400 );
$popup_notification_bar_width = adp_get_post_meta( $popup->ID, '_adp_popup_notification_bar_width', true, 1024 );
$popup_light_close = adp_get_post_meta( $popup->ID, '_adp_popup_light_close', true, false );
$popup_display_overlay = adp_get_post_meta( $popup->ID, '_adp_popup_display_overlay', true, false );
$popup_mobile_disable = adp_get_post_meta( $popup->ID, '_adp_popup_mobile_disable', true );
$popup_body_scroll_disable = adp_get_post_meta( $popup->ID, '_adp_popup_body_scroll_disable', true );
$popup_overlay_close = adp_get_post_meta( $popup->ID, '_adp_popup_overlay_close', true );
$popup_esc_close = adp_get_post_meta( $popup->ID, '_adp_popup_esc_close', true );
$popup_f4_close = adp_get_post_meta( $popup->ID, '_adp_popup_f4_close', true );
// Check show popup.
if ( ! adp_is_popup_visible( $popup->ID ) ) {
continue;
}
$has_post_thumbnail = has_post_thumbnail( $popup->ID ) && 'none' !== $popup_preview_image;
// Default location for notification bar.
if ( 'notification-bar' === $popup_type ) {
if ( 'top' !== $popup_location && 'bottom' !== $popup_location ) {
$popup_location = 'bottom';
}
}
// Set popup width.
if ( 'content' === $popup_type ) {
$popup_width = $popup_content_box_width . 'px';
if ( $has_post_thumbnail ) {
$popup_width = ( $popup_content_box_width * 2 ) . 'px';
}
} elseif ( 'notification-box' === $popup_type ) {
$popup_width = $popup_notification_box_width . 'px';
} else {
$popup_width = '100%';
}
// Set Popup CSS.
$popup_style = sprintf( 'width:%s;', $popup_width );
// Set Outer CSS.
$outer_style = sprintf( 'max-width:%s;', '100%' );
if ( 'notification-bar' === $popup_type ) {
$outer_style = sprintf( 'max-width:%s;', $popup_notification_bar_width . 'px' );
}
// Popup clasess.
$class = 'adp-popup';
$class .= ' adp-popup-type-' . esc_attr( $popup_type );
$class .= ' adp-popup-location-' . esc_attr( $popup_location );
$class .= ' adp-preview-image-' . esc_attr( $popup_preview_image );
$class .= ' adp-preview-image-' . esc_attr( $has_post_thumbnail ? 'yes' : 'no' );
// Filter clasess.
$class = apply_filters( 'adp_popup_clasess', $class, $popup->ID, $popup_type, $popup_location );
?>
<div class="<?php echo esc_attr( $class ); ?>"
data-limit-display="<?php echo esc_attr( $popup_limit_display ); ?>"
data-limit-lifetime="<?php echo esc_attr( $popup_limit_lifetime ); ?>"
data-open-trigger="<?php echo esc_attr( $popup_open_trigger ); ?>"
data-open-delay-number="<?php echo esc_attr( $popup_open_delay_number ); ?>"
data-open-scroll-position="<?php echo esc_attr( $popup_open_scroll_position ); ?>"
data-open-scroll-type="<?php echo esc_attr( $popup_open_scroll_type ); ?>"
data-open-manual-selector="<?php echo esc_attr( $popup_open_manual_selector ); ?>"
data-close-trigger="<?php echo esc_attr( $popup_close_trigger ); ?>"
data-close-delay-number="<?php echo esc_attr( $popup_close_delay_number ); ?>"
data-close-scroll-position="<?php echo esc_attr( $popup_close_scroll_position ); ?>"
data-close-scroll-type="<?php echo esc_attr( $popup_close_scroll_type ); ?>"
data-open-animation="<?php echo esc_attr( $popup_open_animation ); ?>"
data-exit-animation="<?php echo esc_attr( $popup_exit_animation ); ?>"
data-light-close="<?php echo esc_attr( $popup_light_close ? 'true' : 'false' ); ?>"
data-overlay="<?php echo esc_attr( $popup_display_overlay ? 'true' : 'false' ); ?>"
data-mobile-disable="<?php echo esc_attr( $popup_mobile_disable ? 'true' : 'false' ); ?>"
data-body-scroll-disable="<?php echo esc_attr( $popup_body_scroll_disable ? 'true' : 'false' ); ?>"
data-overlay-close="<?php echo esc_attr( $popup_overlay_close ? 'true' : 'false' ); ?>"
data-esc-close="<?php echo esc_attr( $popup_esc_close ? 'true' : 'false' ); ?>"
data-f4-close="<?php echo esc_attr( $popup_f4_close ? 'true' : 'false' ); ?>"
data-id="<?php echo esc_attr( $popup->ID ); ?>"
style="<?php echo esc_attr( $popup_style ); ?>">
<div class="adp-popup-wrap">
<div class="adp-popup-container">
<!-- Content -->
<?php if ( 'content' === $popup_type ) { ?>
<div class="adp-popup-outer" style="<?php echo esc_attr( $outer_style ); ?>">
<?php if ( $has_post_thumbnail ) { ?>
<div class="adp-popup-thumbnail">
<?php echo get_the_post_thumbnail( $popup->ID, 'large', array( 'class' => 'adp-lazyload-disabled' ) ); ?>
</div>
<?php } ?>
<div class="adp-popup-content">
<div class="adp-popup-inner">
<?php
$content = do_blocks( $popup->post_content );
echo do_shortcode( $content ); // XSS.
?>
</div>
<button type="button" class="adp-popup-close"></button>
</div>
</div>
<?php } ?>
<!-- Info -->
<?php if ( 'notification-box' === $popup_type || 'notification-bar' === $popup_type ) { ?>
<div class="adp-popup-outer" style="<?php echo esc_attr( $outer_style ); ?>">
<?php if ( $popup_info_text ) { ?>
<div class="adp-popup-text">
<?php echo wp_kses( $popup_info_text, 'post' ); ?>
</div>
<?php } ?>
<?php if ( $popup_info_buton_label ) { ?>
<?php if ( 'accept' === $popup_info_button_action ) { ?>
<button class="adp-button adp-popup-button adp-popup-accept">
<?php echo wp_kses( $popup_info_buton_label, 'post' ); ?>
</button>
<?php } ?>
<?php if ( 'link' === $popup_info_button_action ) { ?>
<a class="adp-button adp-popup-button" target="_blank" href="<?php echo esc_attr( $popup_info_button_link ); ?>">
<?php echo wp_kses( $popup_info_buton_label, 'post' ); ?>
</a>
<?php } ?>
<?php } ?>
<button type="button" class="adp-popup-close"></button>
</div>
<?php } ?>
</div>
</div>
</div>
<?php if ( $popup_display_overlay ) { ?>
<div class="adp-popup-overlay"></div>
<?php } ?>
<?php
// Integration css of powerkit blocks.
if ( function_exists( 'cnvs_gutenberg' ) ) {
// Parse blocks.
$blocks = parse_blocks( $popup->post_content );
$blocks_css = cnvs_gutenberg()->parse_blocks_css( $blocks );
if ( $blocks_css ) {
echo sprintf( '<style>%s</style>', $blocks_css ); // XSS.
}
}
}
}
/**
* Fire the wp_head action.
*/
public function wp_head() {
?>
<link rel="preload" href="<?php echo esc_url( ADP_URL . 'fonts/advanced-popups-icons.woff' ); ?>" as="font" type="font/woff" crossorigin>
<?php
}
/**
* Register the stylesheets for the public-facing side of the site.
*/
public function wp_enqueue_scripts() {
// Scripts.
wp_enqueue_script( $this->adp, plugin_dir_url( __FILE__ ) . 'js/advanced-popups-public.js', array( 'jquery' ), $this->version, false );
// Styles.
wp_enqueue_style( $this->adp, adp_style( plugin_dir_url( __FILE__ ) . 'css/advanced-popups-public.css' ), array(), $this->version, 'all' );
// Add RTL support.
wp_style_add_data( $this->adp, 'rtl', 'replace' );
}
}
@@ -0,0 +1,626 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'advanced-popups-icons';
src: url("../../fonts/advanced-popups-icons.woff") format("woff"), url("../../fonts/advanced-popups-icons.ttf") format("truetype"), url("../../fonts/advanced-popups-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="adp-icon-"],
[class*=" adp-icon-"] {
font-family: 'advanced-popups-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.adp-icon-x:before {
content: "\e913";
}
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.adp-popup {
--adp-popup-wrap-scrollbar-width: 0.625rem;
--adp-popup-wrap-scrollbar-track-background: #f1f1f1;
--adp-popup-wrap-scrollbar-thumb-background: #888;
--adp-popup-wrap-scrollbar-thumb-hover-background: #555;
--adp-popup-wrap-box-shadow: 0 0 40px 0 rgba(0,0,0,.075);
--adp-popup-container-background: #FFFFFF;
--adp-popup-close-font-size: 1.25rem;
--adp-popup-close-color: #000;
--adp-popup-close-hover-color: #777;
--adp-popup-close-light-color: #FFFF;
--adp-popup-close-light-hover-color: rgba(255,255,255,0.75);
--adp-popup-type-content-close-font-size: 1.5rem;
--adp-popup-type-notification-text-font-size: 90%;
--adp-popup-type-notification-text-color: #777777;
--adp-popup-type-notification-text-link-color: #000000;
--adp-popup-type-notification-button-background: #282828;
--adp-popup-type-notification-button-color: #FFF;
--adp-popup-type-notification-button-border-radius: 0;
}
.adp-popup-overlay {
--adp-popup-overlay-background: rgba(0,0,0,0.25);
}
/*--------------------------------------------------------------*/
.adp-popup-scroll-hidden {
overflow: hidden;
width: 100%;
}
.adp-popup-animated {
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
overflow: hidden !important;
}
@-webkit-keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@-webkit-keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@-webkit-keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@-webkit-keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@-webkit-keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
@keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
.popupOpenFade {
-webkit-animation-name: popupOpenFade;
animation-name: popupOpenFade;
}
.popupExitFade {
-webkit-animation-name: popupExitFade;
animation-name: popupExitFade;
}
.popupOpenSlide {
-webkit-animation-name: popupOpenSlide;
animation-name: popupOpenSlide;
}
.popupExitSlide {
-webkit-animation-name: popupExitSlide;
animation-name: popupExitSlide;
}
.popupOpenZoom {
-webkit-animation-name: popupOpenZoom;
animation-name: popupOpenZoom;
}
.popupExitZoom {
-webkit-animation-name: popupExitZoom;
animation-name: popupExitZoom;
}
.popupOpenSlideFade {
-webkit-animation-name: popupOpenSlideFade;
animation-name: popupOpenSlideFade;
}
.popupExitSlideFade {
-webkit-animation-name: popupExitSlideFade;
animation-name: popupExitSlideFade;
}
.adp-popup {
display: none;
position: fixed;
z-index: 999999;
max-width: calc(100vw - 1.5rem);
max-height: calc(100vh - 1.5rem);
-webkit-backface-visibility: hidden;
}
@media (min-width: 720px) {
.adp-popup {
max-width: calc(100vw - 6rem);
max-height: calc(100vh - 6rem);
}
}
.adp-popup.adp-popup-location-top {
top: 20px;
right: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-top-left {
top: 20px;
right: 20px;
}
.adp-popup.adp-popup-location-top-right {
top: 20px;
left: 20px;
}
.adp-popup.adp-popup-location-bottom {
bottom: 20px;
right: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-bottom-left {
right: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-bottom-right {
left: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-left {
top: 50%;
right: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-right {
top: 50%;
left: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-center {
top: 50%;
right: 50%;
transform: translate3d(-50%, -50%, 0);
}
.adp-popup .adp-popup-wrap {
position: relative;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
box-shadow: var(--adp-popup-wrap-box-shadow);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar {
width: var(--adp-popup-wrap-scrollbar-width);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-track {
background: var(--adp-popup-wrap-scrollbar-track-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb {
background: var(--adp-popup-wrap-scrollbar-thumb-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb:hover {
background: var(--adp-popup-wrap-scrollbar-thumb-hover-background);
}
.adp-popup .adp-popup-container {
background: var(--adp-popup-container-background);
width: 100%;
}
.adp-popup .adp-popup-outer {
position: relative;
display: flex;
flex-direction: column;
}
.adp-popup .adp-popup-thumbnail img {
width: 100%;
}
.adp-popup .adp-popup-close {
position: absolute;
background: transparent;
color: var(--adp-popup-close-color);
padding: 0;
line-height: 1;
font-size: var(--adp-popup-close-font-size);
top: 20px;
left: 20px;
z-index: 2;
}
.adp-popup .adp-popup-close:before {
font-family: 'advanced-popups-icons';
transition: color 0.25s ease;
content: "\e913";
}
.adp-popup .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
.adp-popup.adp-popup-open {
display: flex;
}
@media (max-width: 720px) {
.adp-popup.adp-popup-open[data-mobile-disable="true"] {
display: none;
}
}
.adp-popup-overlay {
background: var(--adp-popup-overlay-background);
position: fixed;
display: none;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
z-index: 999998;
}
.adp-popup-overlay .adp-popup-wrap {
box-shadow: none;
}
.adp-popup-open + .adp-popup-overlay {
display: block;
}
@media (max-width: 719.98px) {
.adp-popup-type-content {
max-width: 100vw;
max-height: 100vh;
}
}
.adp-popup-type-content .adp-popup-content {
padding: 40px;
}
.adp-popup-type-content .adp-popup-close {
font-size: var(--adp-popup-type-content-close-font-size);
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -40px;
width: initial;
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
@media (min-width: 1024px) {
.adp-popup-type-content .adp-popup-outer {
flex-direction: row;
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close {
color: var(--adp-popup-close-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close:hover:before, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-thumbnail {
order: 1;
}
.adp-popup-type-content.adp-preview-image-right .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
left: initial;
right: initial;
width: initial;
height: initial;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
left: initial;
right: initial;
width: initial;
height: initial;
}
.adp-popup-type-content .adp-popup-thumbnail {
position: relative;
flex: 1 0 50%;
order: 1;
}
.adp-popup-type-content .adp-popup-thumbnail img {
position: absolute;
display: block;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
.adp-popup-type-content .adp-popup-content {
padding: 80px;
flex: 1 0 50%;
order: 2;
}
.adp-popup-type-content .adp-popup-content:first-child:last-child {
flex: 1 0 100%;
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -80px;
}
}
.adp-popup-type-notification-box .adp-popup-outer,
.adp-popup-type-notification-bar .adp-popup-outer {
padding: 30px;
}
.adp-popup-type-notification-box .adp-popup-text,
.adp-popup-type-notification-bar .adp-popup-text {
padding-left: 10px;
font-size: var(--adp-popup-type-notification-text-font-size);
color: var(--adp-popup-type-notification-text-color);
}
.adp-popup-type-notification-box .adp-popup-text a,
.adp-popup-type-notification-bar .adp-popup-text a {
color: var(--adp-popup-type-notification-text-link-color);
text-decoration: underline;
}
.adp-popup-type-notification-box .adp-popup-text a:hover,
.adp-popup-type-notification-bar .adp-popup-text a:hover {
text-decoration: none;
}
.adp-popup-type-notification-box .adp-popup-button,
.adp-popup-type-notification-bar .adp-popup-button {
background: var(--adp-popup-type-notification-button-background);
margin-top: 1.5rem;
width: 100%;
color: var(--adp-popup-type-notification-button-color);
border-radius: var(--adp-popup-type-notification-button-border-radius);
}
.adp-popup-type-notification-box .adp-popup-close {
top: 15px;
left: 15px;
}
.adp-popup-type-notification-bar.adp-popup-location-top {
width: 100%;
max-width: 100%;
top: 0;
right: 0;
bottom: auto;
transform: none;
}
.adp-popup-type-notification-bar.adp-popup-location-bottom {
width: 100%;
max-width: 100%;
top: auto;
right: 0;
bottom: 0;
transform: none;
}
.adp-popup-type-notification-bar .adp-popup-outer {
padding-top: 20px;
padding-bottom: 20px;
padding-right: 60px;
padding-left: 60px;
}
@media (min-width: 720px) {
.adp-popup-type-notification-bar .adp-popup-outer {
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
margin: 0 auto;
padding-right: 40px;
padding-left: 40px;
}
.adp-popup-type-notification-bar .adp-popup-close {
top: 50%;
transform: translateY(-50%);
}
.adp-popup-type-notification-bar .adp-button {
margin-right: 1rem;
margin-top: 0;
width: auto;
}
}
@@ -0,0 +1,626 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
@font-face {
font-family: 'advanced-popups-icons';
src: url("../../fonts/advanced-popups-icons.woff") format("woff"), url("../../fonts/advanced-popups-icons.ttf") format("truetype"), url("../../fonts/advanced-popups-icons.svg") format("svg");
font-weight: normal;
font-style: normal;
font-display: swap;
}
[class^="adp-icon-"],
[class*=" adp-icon-"] {
font-family: 'advanced-popups-icons' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.adp-icon-x:before {
content: "\e913";
}
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.adp-popup {
--adp-popup-wrap-scrollbar-width: 0.625rem;
--adp-popup-wrap-scrollbar-track-background: #f1f1f1;
--adp-popup-wrap-scrollbar-thumb-background: #888;
--adp-popup-wrap-scrollbar-thumb-hover-background: #555;
--adp-popup-wrap-box-shadow: 0 0 40px 0 rgba(0,0,0,.075);
--adp-popup-container-background: #FFFFFF;
--adp-popup-close-font-size: 1.25rem;
--adp-popup-close-color: #000;
--adp-popup-close-hover-color: #777;
--adp-popup-close-light-color: #FFFF;
--adp-popup-close-light-hover-color: rgba(255,255,255,0.75);
--adp-popup-type-content-close-font-size: 1.5rem;
--adp-popup-type-notification-text-font-size: 90%;
--adp-popup-type-notification-text-color: #777777;
--adp-popup-type-notification-text-link-color: #000000;
--adp-popup-type-notification-button-background: #282828;
--adp-popup-type-notification-button-color: #FFF;
--adp-popup-type-notification-button-border-radius: 0;
}
.adp-popup-overlay {
--adp-popup-overlay-background: rgba(0,0,0,0.25);
}
/*--------------------------------------------------------------*/
.adp-popup-scroll-hidden {
overflow: hidden;
width: 100%;
}
.adp-popup-animated {
-webkit-animation-duration: 0.5s;
animation-duration: 0.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
overflow: hidden !important;
}
@-webkit-keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes popupOpenFade {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@-webkit-keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes popupExitFade {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@-webkit-keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlide {
from {
transform: translate3d(0, 100vh, 0);
visibility: visible;
}
to {
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@keyframes popupExitSlide {
from {
transform: translate3d(0, 0, 0);
}
to {
visibility: hidden;
transform: translate3d(0, 100vh, 0);
}
}
@-webkit-keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@keyframes popupOpenZoom {
from {
opacity: 0;
transform: scale(1.1);
}
to {
opacity: 1;
transform: scale(1);
}
}
@-webkit-keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@keyframes popupExitZoom {
from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(1.1);
}
}
@-webkit-keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@keyframes popupOpenSlideFade {
from {
opacity: 0;
transform: translate3d(0, 40px, 0);
visibility: visible;
}
to {
opacity: 1;
transform: translate3d(0, 0, 0);
}
}
@-webkit-keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
@keyframes popupExitSlideFade {
from {
opacity: 1;
transform: translate3d(0, 0, 0);
}
to {
opacity: 0;
visibility: hidden;
transform: translate3d(0, 40px, 0);
}
}
.popupOpenFade {
-webkit-animation-name: popupOpenFade;
animation-name: popupOpenFade;
}
.popupExitFade {
-webkit-animation-name: popupExitFade;
animation-name: popupExitFade;
}
.popupOpenSlide {
-webkit-animation-name: popupOpenSlide;
animation-name: popupOpenSlide;
}
.popupExitSlide {
-webkit-animation-name: popupExitSlide;
animation-name: popupExitSlide;
}
.popupOpenZoom {
-webkit-animation-name: popupOpenZoom;
animation-name: popupOpenZoom;
}
.popupExitZoom {
-webkit-animation-name: popupExitZoom;
animation-name: popupExitZoom;
}
.popupOpenSlideFade {
-webkit-animation-name: popupOpenSlideFade;
animation-name: popupOpenSlideFade;
}
.popupExitSlideFade {
-webkit-animation-name: popupExitSlideFade;
animation-name: popupExitSlideFade;
}
.adp-popup {
display: none;
position: fixed;
z-index: 999999;
max-width: calc(100vw - 1.5rem);
max-height: calc(100vh - 1.5rem);
-webkit-backface-visibility: hidden;
}
@media (min-width: 720px) {
.adp-popup {
max-width: calc(100vw - 6rem);
max-height: calc(100vh - 6rem);
}
}
.adp-popup.adp-popup-location-top {
top: 20px;
left: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-top-left {
top: 20px;
left: 20px;
}
.adp-popup.adp-popup-location-top-right {
top: 20px;
right: 20px;
}
.adp-popup.adp-popup-location-bottom {
bottom: 20px;
left: 50%;
transform: translate3d(-50%, 0, 0);
}
.adp-popup.adp-popup-location-bottom-left {
left: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-bottom-right {
right: 20px;
bottom: 20px;
}
.adp-popup.adp-popup-location-left {
top: 50%;
left: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-right {
top: 50%;
right: 20px;
transform: translate3d(0, -50%, 0);
}
.adp-popup.adp-popup-location-center {
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.adp-popup .adp-popup-wrap {
position: relative;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
box-shadow: var(--adp-popup-wrap-box-shadow);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar {
width: var(--adp-popup-wrap-scrollbar-width);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-track {
background: var(--adp-popup-wrap-scrollbar-track-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb {
background: var(--adp-popup-wrap-scrollbar-thumb-background);
}
.adp-popup .adp-popup-wrap::-webkit-scrollbar-thumb:hover {
background: var(--adp-popup-wrap-scrollbar-thumb-hover-background);
}
.adp-popup .adp-popup-container {
background: var(--adp-popup-container-background);
width: 100%;
}
.adp-popup .adp-popup-outer {
position: relative;
display: flex;
flex-direction: column;
}
.adp-popup .adp-popup-thumbnail img {
width: 100%;
}
.adp-popup .adp-popup-close {
position: absolute;
background: transparent;
color: var(--adp-popup-close-color);
padding: 0;
line-height: 1;
font-size: var(--adp-popup-close-font-size);
top: 20px;
right: 20px;
z-index: 2;
}
.adp-popup .adp-popup-close:before {
font-family: 'advanced-popups-icons';
transition: color 0.25s ease;
content: "\e913";
}
.adp-popup .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup.adp-popup-open[data-light-close="true"] .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
.adp-popup.adp-popup-open {
display: flex;
}
@media (max-width: 720px) {
.adp-popup.adp-popup-open[data-mobile-disable="true"] {
display: none;
}
}
.adp-popup-overlay {
background: var(--adp-popup-overlay-background);
position: fixed;
display: none;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999998;
}
.adp-popup-overlay .adp-popup-wrap {
box-shadow: none;
}
.adp-popup-open + .adp-popup-overlay {
display: block;
}
@media (max-width: 719.98px) {
.adp-popup-type-content {
max-width: 100vw;
max-height: 100vh;
}
}
.adp-popup-type-content .adp-popup-content {
padding: 40px;
}
.adp-popup-type-content .adp-popup-close {
font-size: var(--adp-popup-type-content-close-font-size);
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -40px;
width: initial;
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close {
color: var(--adp-popup-close-light-color);
}
.adp-popup-type-content.adp-preview-image-yes .adp-popup-close:hover:before {
color: var(--adp-popup-close-light-hover-color);
}
@media (min-width: 1024px) {
.adp-popup-type-content .adp-popup-outer {
flex-direction: row;
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close {
color: var(--adp-popup-close-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-close:hover:before, .adp-popup-type-content.adp-preview-image-bottom .adp-popup-close:hover:before {
color: var(--adp-popup-close-hover-color);
}
.adp-popup-type-content.adp-preview-image-left .adp-popup-thumbnail {
order: 1;
}
.adp-popup-type-content.adp-preview-image-right .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-top .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
right: initial;
left: initial;
width: initial;
height: initial;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-outer {
flex-direction: column;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail {
order: 3;
}
.adp-popup-type-content.adp-preview-image-bottom .adp-popup-thumbnail img {
position: relative;
top: initial;
bottom: initial;
right: initial;
left: initial;
width: initial;
height: initial;
}
.adp-popup-type-content .adp-popup-thumbnail {
position: relative;
flex: 1 0 50%;
order: 1;
}
.adp-popup-type-content .adp-popup-thumbnail img {
position: absolute;
display: block;
top: 0;
bottom: 0;
right: 0;
left: 0;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
.adp-popup-type-content .adp-popup-content {
padding: 80px;
flex: 1 0 50%;
order: 2;
}
.adp-popup-type-content .adp-popup-content:first-child:last-child {
flex: 1 0 100%;
}
.adp-popup-type-content .wp-block-cover:first-child:last-child {
margin: -80px;
}
}
.adp-popup-type-notification-box .adp-popup-outer,
.adp-popup-type-notification-bar .adp-popup-outer {
padding: 30px;
}
.adp-popup-type-notification-box .adp-popup-text,
.adp-popup-type-notification-bar .adp-popup-text {
padding-right: 10px;
font-size: var(--adp-popup-type-notification-text-font-size);
color: var(--adp-popup-type-notification-text-color);
}
.adp-popup-type-notification-box .adp-popup-text a,
.adp-popup-type-notification-bar .adp-popup-text a {
color: var(--adp-popup-type-notification-text-link-color);
text-decoration: underline;
}
.adp-popup-type-notification-box .adp-popup-text a:hover,
.adp-popup-type-notification-bar .adp-popup-text a:hover {
text-decoration: none;
}
.adp-popup-type-notification-box .adp-popup-button,
.adp-popup-type-notification-bar .adp-popup-button {
background: var(--adp-popup-type-notification-button-background);
margin-top: 1.5rem;
width: 100%;
color: var(--adp-popup-type-notification-button-color);
border-radius: var(--adp-popup-type-notification-button-border-radius);
}
.adp-popup-type-notification-box .adp-popup-close {
top: 15px;
right: 15px;
}
.adp-popup-type-notification-bar.adp-popup-location-top {
width: 100%;
max-width: 100%;
top: 0;
left: 0;
bottom: auto;
transform: none;
}
.adp-popup-type-notification-bar.adp-popup-location-bottom {
width: 100%;
max-width: 100%;
top: auto;
left: 0;
bottom: 0;
transform: none;
}
.adp-popup-type-notification-bar .adp-popup-outer {
padding-top: 20px;
padding-bottom: 20px;
padding-left: 60px;
padding-right: 60px;
}
@media (min-width: 720px) {
.adp-popup-type-notification-bar .adp-popup-outer {
justify-content: center;
align-items: center;
flex-direction: row;
flex-wrap: wrap;
margin: 0 auto;
padding-left: 40px;
padding-right: 40px;
}
.adp-popup-type-notification-bar .adp-popup-close {
top: 50%;
transform: translateY(-50%);
}
.adp-popup-type-notification-bar .adp-button {
margin-left: 1rem;
margin-top: 0;
width: auto;
}
}
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,429 @@
"use strict";
jQuery(document).ready(function($) {
var adpPopup = {};
( function() {
var $this;
adpPopup = {
sPrevious : window.scrollY,
sDirection: 'down',
/*
* Initialize
*/
init: function( e ) {
$this = adpPopup;
$this.popupInit( e );
// Init events.
$this.events( e );
},
/*
* Events
*/
events: function( e ) {
// Custom Events
$( document ).on( 'click', '.adp-popup-close', $this.closePopup );
$( document ).on( 'click', '.adp-popup-accept', $this.acceptPopup );
$( document ).on( 'click', '.adp-popup-accept', $this.closePopup );
// Checking this will cause popup to close when user presses key.
$( document ).keyup(function(e) {
// Press ESC to Close.
if ( e.key === 'Escape' ) {
$( '.adp-popup-open[data-esc-close="true"]' ).each(function(index, popup) {
$this.closePopup(popup);
});
}
// Press F4 to Close.
if ( e.key === 'F4' ) {
$( '.adp-popup-open[data-esc-close="true"]' ).each(function(index, popup) {
$this.closePopup(popup);
});
}
});
// Checking this will cause popup to close when user clicks on overlay.
$( document ).on( 'click', '.adp-popup-overlay', function( e ) {
$this.closePopup( $( this).prev() );
} );
},
/*
* Init popup elements
*/
popupInit: function( e ) {
// Set scroll direction.
$( document ).on( 'scroll', function() {
let scrollCurrent = window.scrollY;
// Set scroll temporary vars.
if ( scrollCurrent > $this.sPrevious ) {
$this.sDirection = 'down';
} else {
$this.sDirection = 'up';
}
$this.sPrevious = scrollCurrent;
});
// Open popup
$( '.adp-popup' ).each(function(index, popup) {
// Manual Launch.
if ( 'manual' === $( popup ).data( 'open-trigger' ) ) {
let selector = $( popup ).data( 'open-manual-selector' );
if ( selector ) {
$( document ).on( 'click', selector, function( e ) {
event.preventDefault();
$( popup ).removeClass( 'adp-popup-already-opened' );
$this.openPopup( popup );
} );
}
}
// Checks whether a popup should be displayed or not.
if ( ! $this.isAllowPopup( popup ) ) {
return;
}
$this.openTriggerPopup( popup );
});
},
/*
* Trigger open popup
*/
openTriggerPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
var trigger = $( popup ).data( 'open-trigger' );
// Page Viewed.
if ( 'viewed' === trigger ) {
$this.openPopup( popup );
}
// Time Delay.
if ( 'delay' === trigger ) {
setTimeout( function() {
$this.openPopup( popup );
}, $( popup ).data( 'open-delay-number' ) * 1000 );
}
// Exit Intent.
if ( 'exit' === trigger ) {
var showExit = true;
document.addEventListener( "mousemove", function( e ) {
// Get current scroll position
var scroll = window.pageYOffset || document.documentElement.scrollTop;
if ( ( e.pageY - scroll ) < 7 && showExit ) {
$this.openPopup( popup );
showExit = false;
}
} );
}
// Scroll Position.
if ( 'read' === trigger || 'scroll' === trigger ) {
var pointScrollType = $( popup ).data( 'open-scroll-type' );
var pointScrollPosition = $( popup ).data( 'open-scroll-position' );
if ( 'read' === trigger ) {
pointScrollType = '%';
pointScrollPosition = 100;
}
// Event scroll.
$( document ).on( 'scroll', function() {
// Type px.
if ( 'px' === pointScrollType ) {
if ( window.scrollY >= pointScrollPosition ) {
$this.openPopup( popup );
}
}
// Type %.
if ( '%' === pointScrollType ) {
if ( $this.getScrollPercent() >= pointScrollPosition ) {
$this.openPopup( popup );
}
}
} );
}
// Accept Agreement.
if ( 'accept' === trigger ) {
let accept = $this.getCookie( 'adp-popup-accept-' + $( popup ).data( 'id' ) || 0 );
if ( ! accept ) {
$this.openPopup( popup );
}
}
},
/*
* Trigger close popup
*/
closeTriggerPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
var trigger = $( popup ).data( 'close-trigger' );
// Time Delay.
if ( 'delay' === trigger ) {
setTimeout( function() {
$this.closePopup(popup);
}, $( popup ).data( 'close-delay-number' ) * 1000 );
}
// Scroll Position.
if ( 'scroll' === trigger ) {
var pointScrollType = $( popup ).data( 'close-scroll-type' );
var pointScrollPosition = $( popup ).data( 'close-scroll-position' );
var initScrollPx = $( popup ).data( 'init-scroll-px' );
var initScrollPercent = $( popup ).data( 'init-scroll-percent' );
// Event scroll.
$( document ).on( 'scroll', function() {
// Type px.
if ( 'px' === pointScrollType ) {
if ( 'up' === $this.sDirection && window.scrollY < ( initScrollPx - pointScrollPosition ) ) {
$this.closePopup( popup );
}
if ( 'down' === $this.sDirection && window.scrollY >= ( initScrollPx + pointScrollPosition ) ) {
$this.closePopup( popup );
}
}
// Type %.
if ( '%' === pointScrollType ) {
if ( 'up' === $this.sDirection && $this.getScrollPercent() < ( initScrollPercent - pointScrollPosition ) ) {
$this.closePopup(popup);
}
if ( 'down' === $this.sDirection && $this.getScrollPercent() >= ( initScrollPercent + pointScrollPosition ) ) {
$this.closePopup(popup);
}
}
} );
}
},
/*
* Open popup
*/
openPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
if ( $( popup ).hasClass( 'adp-popup-open' ) ) {
return;
}
// Check already opened.
if ( $( popup ).hasClass( 'adp-popup-already-opened' ) ) {
return;
}
// Display popup.
$( popup ).addClass( 'adp-popup-open' );
// Set current scroll.
$( popup ).data( 'init-scroll-px', window.scrollY );
$( popup ).data( 'init-scroll-percent', $this.getScrollPercent() );
// Hide body scroll.
if ( $( popup ).is( '[data-body-scroll-disable="true"]' ) ) {
$( 'body' ).addClass( 'adp-popup-scroll-hidden' );
}
// Set Cookie of Limit display.
let limit = parseInt( $this.getCookie( 'adp-popup-' + $( popup ).data( 'id' ) ) || 0 ) + 1;
$this.setCookie( 'adp-popup-' + $( popup ).data( 'id' ), limit, {
expires: $( popup ).data( 'limit-lifetime' )
} );
// Open animation.
let animation = $( popup ).data( 'open-animation' );
$this.applyAnimation( popup, animation );
// Init close trigger.
$this.closeTriggerPopup( popup );
},
/*
* Accept popup
*/
acceptPopup: function( e ) {
let $el = ( e.originalEvent ) ? this : e;
// Get popup container.
let popup = $( $el ).closest( '.adp-popup' );
// Set Cookie of Accept.
$this.setCookie( 'adp-popup-accept-' + $( popup ).data( 'id' ), 1, {
expires: 360
} );
},
/*
* Close popup
*/
closePopup: function( e ) {
let $el = ( e.originalEvent ) ? this : e;
// Get popup container.
let popup = $( $el ).closest( '.adp-popup' );
// Close animation.
let animation = $( popup ).data( 'exit-animation' );
$this.applyAnimation( popup, animation, function() {
// Already opened.
$( popup ).addClass( 'adp-popup-already-opened' );
// Hide popup.
$( popup ).removeClass( 'adp-popup-open' );
// Remove classes from body.
$( 'body' ).removeClass( 'adp-popup-scroll-hidden' );
} );
},
/*
* Checks whether a popup should be displayed or not
*/
isAllowPopup: function( e ) {
let popup = ( e.originalEvent ) ? this : e;
// Has user seen this popup before?
let limitDisplay = parseInt( $( popup ).data( 'limit-display' ) || 0 );
let limitDisplayCookie = parseInt( $this.getCookie( 'adp-popup-' + $( popup ).data( 'id' ) ) );
if ( limitDisplay && limitDisplayCookie && limitDisplayCookie >= limitDisplay ) {
return;
}
return true;
},
/*
* Apply animation
*/
applyAnimation: function( el, name, callback ) {
var popup = $( el ).closest( '.adp-popup' );
if ( typeof callback === 'function' ) {
var overlayName = 'popupExitFade';
} else {
var overlayName = 'popupOpenFade';
}
// Overlay Animation.
$( popup ).next( '.adp-popup-overlay' ).addClass( 'adp-popup-animated ' + overlayName )
.one( 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
$( this ).removeClass( 'adp-popup-animated ' + overlayName );
} );
// Wrap Animation.
$( popup ).find( '.adp-popup-wrap' ).addClass( 'adp-popup-animated ' + name )
.one( 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
// remove the animation classes after animation ends
// required in order to apply new animation on close
$( this ).removeClass( 'adp-popup-animated ' + name );
if ( typeof callback === 'function' ) {
callback();
}
} );
},
/*
* Set cookie
*/
getCookie: function( name ) {
var matches = document.cookie.match( new RegExp(
"(?:^|; )" + name.replace( /([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1' ) + "=([^;]*)"
) );
return matches ? decodeURIComponent( matches[ 1 ] ) : undefined;
},
/*
* Set cookie
*/
setCookie: function( name, value, options ) {
options = options || {};
options.path = options.hasOwnProperty( 'path' ) ? options.path : '/';
options.expires = parseInt( options.expires );
if ( typeof options.expires == "number" && options.expires ) {
options.expires = new Date().setDate(new Date().getDate() + options.expires );
options.expires = new Date(options.expires).toUTCString();
}
value = encodeURIComponent( value );
var updatedCookie = name + "=" + value;
for ( var propName in options ) {
updatedCookie += "; " + propName;
var propValue = options[ propName ];
if ( propValue !== true ) {
updatedCookie += "=" + propValue;
}
}
document.cookie = updatedCookie;
},
/*
* Get scroll percent
*/
getScrollPercent: function() {
var h = document.documentElement,
b = document.body,
st = 'scrollTop',
sh = 'scrollHeight';
return (h[st]||b[st]) / ((h[sh]||b[sh]) - h.clientHeight) * 100;
}
};
} )();
// Initialize.
adpPopup.init();
});
@@ -0,0 +1,31 @@
<?php
/**
* Fired when the plugin is uninstalled.
*
* When populating this file, consider the following flow
* of control:
*
* - This method should be static
* - Check if the $_REQUEST content actually is the plugin name
* - Run an admin referrer check to make sure it goes through authentication
* - Verify the output of $_GET makes sense
* - Repeat with other user roles. Best directly by using the links/query string parameters.
* - Repeat things for multisite. Once for a single site in the network, once sitewide.
*
* This file may be updated more in future version of the Boilerplate; however, this is the
* general skeleton and outline for how the file should work.
*
* For more information, see the following discussion:
* https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
*
* @link https://codesupply.co
* @since 1.0.0
*
* @package ADP
*/
// If uninstall not called from WordPress, then exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
+34
View File
@@ -0,0 +1,34 @@
# Only allow direct access to specific Web-available files.
# Apache 2.2
<IfModule !mod_authz_core.c>
Order Deny,Allow
Deny from all
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Akismet CSS and JS
<FilesMatch "^(form\.js|akismet\.js|akismet-frontend\.js|akismet\.css)$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
# Akismet images
<FilesMatch "^logo-(a|full)-2x\.png$">
<IfModule !mod_authz_core.c>
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</FilesMatch>
+339
View File
@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
@@ -0,0 +1,360 @@
/**
* Observe how the user enters content into the comment form in order to determine whether it's a bot or not.
*
* Note that no actual input is being saved here, only counts and timings between events.
*/
( function() {
// Passive event listeners are guaranteed to never call e.preventDefault(),
// but they're not supported in all browsers. Use this feature detection
// to determine whether they're available for use.
var supportsPassive = false;
try {
var opts = Object.defineProperty( {}, 'passive', {
get : function() {
supportsPassive = true;
}
} );
window.addEventListener( 'testPassive', null, opts );
window.removeEventListener( 'testPassive', null, opts );
} catch ( e ) {}
function init() {
var input_begin = '';
var keydowns = {};
var lastKeyup = null;
var lastKeydown = null;
var keypresses = [];
var modifierKeys = [];
var correctionKeys = [];
var lastMouseup = null;
var lastMousedown = null;
var mouseclicks = [];
var mousemoveTimer = null;
var lastMousemoveX = null;
var lastMousemoveY = null;
var mousemoveStart = null;
var mousemoves = [];
var touchmoveCountTimer = null;
var touchmoveCount = 0;
var lastTouchEnd = null;
var lastTouchStart = null;
var touchEvents = [];
var scrollCountTimer = null;
var scrollCount = 0;
var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ];
var modifierKeyCodes = [ 'Shift', 'CapsLock' ];
var forms = document.querySelectorAll( 'form[method=post]' );
for ( var i = 0; i < forms.length; i++ ) {
var form = forms[i];
var formAction = form.getAttribute( 'action' );
// Ignore forms that POST directly to other domains; these could be things like payment forms.
if ( formAction ) {
// Check that the form is posting to an external URL, not a path.
if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) {
if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) {
continue;
}
}
}
form.addEventListener( 'submit', function () {
var ak_bkp = prepare_timestamp_array_for_request( keypresses );
var ak_bmc = prepare_timestamp_array_for_request( mouseclicks );
var ak_bte = prepare_timestamp_array_for_request( touchEvents );
var ak_bmm = prepare_timestamp_array_for_request( mousemoves );
var input_fields = {
// When did the user begin entering any input?
'ak_bib': input_begin,
// When was the form submitted?
'ak_bfs': Date.now(),
// How many keypresses did they make?
'ak_bkpc': keypresses.length,
// How quickly did they press a sample of keys, and how long between them?
'ak_bkp': ak_bkp,
// How quickly did they click the mouse, and how long between clicks?
'ak_bmc': ak_bmc,
// How many mouseclicks did they make?
'ak_bmcc': mouseclicks.length,
// When did they press modifier keys (like Shift or Capslock)?
'ak_bmk': modifierKeys.join( ';' ),
// When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back
'ak_bck': correctionKeys.join( ';' ),
// How many times did they move the mouse?
'ak_bmmc': mousemoves.length,
// How many times did they move around using a touchscreen?
'ak_btmc': touchmoveCount,
// How many times did they scroll?
'ak_bsc': scrollCount,
// How quickly did they perform touch events, and how long between them?
'ak_bte': ak_bte,
// How many touch events were there?
'ak_btec' : touchEvents.length,
// How quickly did they move the mouse, and how long between moves?
'ak_bmm' : ak_bmm
};
for ( var field_name in input_fields ) {
var field = document.createElement( 'input' );
field.setAttribute( 'type', 'hidden' );
field.setAttribute( 'name', field_name );
field.setAttribute( 'value', input_fields[ field_name ] );
this.appendChild( field );
}
}, supportsPassive ? { passive: true } : false );
form.addEventListener( 'keydown', function ( e ) {
// If you hold a key down, some browsers send multiple keydown events in a row.
// Ignore any keydown events for a key that hasn't come back up yet.
if ( e.key in keydowns ) {
return;
}
var keydownTime = ( new Date() ).getTime();
keydowns[ e.key ] = [ keydownTime ];
if ( ! input_begin ) {
input_begin = keydownTime;
}
// In some situations, we don't want to record an interval since the last keypress -- for example,
// on the first keypress, or on a keypress after focus has changed to another element. Normally,
// we want to record the time between the last keyup and this keydown. But if they press a
// key while already pressing a key, we want to record the time between the two keydowns.
var lastKeyEvent = Math.max( lastKeydown, lastKeyup );
if ( lastKeyEvent ) {
keydowns[ e.key ].push( keydownTime - lastKeyEvent );
}
lastKeydown = keydownTime;
}, supportsPassive ? { passive: true } : false );
form.addEventListener( 'keyup', function ( e ) {
if ( ! ( e.key in keydowns ) ) {
// This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or...
return;
}
var keyupTime = ( new Date() ).getTime();
if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) {
if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) {
modifierKeys.push( keypresses.length - 1 );
} else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) {
correctionKeys.push( keypresses.length - 1 );
} else {
// ^ Don't record timings for keys like Shift or backspace, since they
// typically get held down for longer than regular typing.
var keydownTime = keydowns[ e.key ][0];
var keypress = [];
// Keypress duration.
keypress.push( keyupTime - keydownTime );
// Amount of time between this keypress and the previous keypress.
if ( keydowns[ e.key ].length > 1 ) {
keypress.push( keydowns[ e.key ][1] );
}
keypresses.push( keypress );
}
}
delete keydowns[ e.key ];
lastKeyup = keyupTime;
}, supportsPassive ? { passive: true } : false );
form.addEventListener( "focusin", function ( e ) {
lastKeydown = null;
lastKeyup = null;
keydowns = {};
}, supportsPassive ? { passive: true } : false );
form.addEventListener( "focusout", function ( e ) {
lastKeydown = null;
lastKeyup = null;
keydowns = {};
}, supportsPassive ? { passive: true } : false );
}
document.addEventListener( 'mousedown', function ( e ) {
lastMousedown = ( new Date() ).getTime();
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'mouseup', function ( e ) {
if ( ! lastMousedown ) {
// If the mousedown happened before this script was loaded, but the mouseup happened after...
return;
}
var now = ( new Date() ).getTime();
var mouseclick = [];
mouseclick.push( now - lastMousedown );
if ( lastMouseup ) {
mouseclick.push( lastMousedown - lastMouseup );
}
mouseclicks.push( mouseclick );
lastMouseup = now;
// If the mouse has been clicked, don't record this time as an interval between keypresses.
lastKeydown = null;
lastKeyup = null;
keydowns = {};
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'mousemove', function ( e ) {
if ( mousemoveTimer ) {
clearTimeout( mousemoveTimer );
mousemoveTimer = null;
}
else {
mousemoveStart = ( new Date() ).getTime();
lastMousemoveX = e.offsetX;
lastMousemoveY = e.offsetY;
}
mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) {
var now = ( new Date() ).getTime() - 250; // To account for the timer delay.
var mousemove = [];
mousemove.push( now - originalMousemoveStart );
mousemove.push(
Math.round(
Math.sqrt(
Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) +
Math.pow( theEvent.offsetY - lastMousemoveY, 2 )
)
)
);
if ( mousemove[1] > 0 ) {
// If there was no measurable distance, then it wasn't really a move.
mousemoves.push( mousemove );
}
mousemoveStart = null;
mousemoveTimer = null;
}, 250, e, mousemoveStart );
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'touchmove', function ( e ) {
if ( touchmoveCountTimer ) {
clearTimeout( touchmoveCountTimer );
}
touchmoveCountTimer = setTimeout( function () {
touchmoveCount++;
}, 250 );
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'touchstart', function ( e ) {
lastTouchStart = ( new Date() ).getTime();
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'touchend', function ( e ) {
if ( ! lastTouchStart ) {
// If the touchstart happened before this script was loaded, but the touchend happened after...
return;
}
var now = ( new Date() ).getTime();
var touchEvent = [];
touchEvent.push( now - lastTouchStart );
if ( lastTouchEnd ) {
touchEvent.push( lastTouchStart - lastTouchEnd );
}
touchEvents.push( touchEvent );
lastTouchEnd = now;
// Don't record this time as an interval between keypresses.
lastKeydown = null;
lastKeyup = null;
keydowns = {};
}, supportsPassive ? { passive: true } : false );
document.addEventListener( 'scroll', function ( e ) {
if ( scrollCountTimer ) {
clearTimeout( scrollCountTimer );
}
scrollCountTimer = setTimeout( function () {
scrollCount++;
}, 250 );
}, supportsPassive ? { passive: true } : false );
}
/**
* For the timestamp data that is collected, don't send more than `limit` data points in the request.
* Choose a random slice and send those.
*/
function prepare_timestamp_array_for_request( a, limit ) {
if ( ! limit ) {
limit = 100;
}
var rv = '';
if ( a.length > 0 ) {
var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) );
for ( var i = 0; i < limit && i < a.length; i++ ) {
rv += a[ random_starting_point + i ][0];
if ( a[ random_starting_point + i ].length >= 2 ) {
rv += "," + a[ random_starting_point + i ][1];
}
rv += ";";
}
}
return rv;
}
if ( document.readyState !== 'loading' ) {
init();
} else {
document.addEventListener( 'DOMContentLoaded', init );
}
})();
+718
View File
@@ -0,0 +1,718 @@
.wp-admin.jetpack_page_akismet-key-config, .wp-admin.settings_page_akismet-key-config {
background-color:#f3f6f8;
}
#submitted-on {
position: relative;
}
#the-comment-list .author .akismet-user-comment-count {
display: inline;
}
#the-comment-list .author a span {
text-decoration: none;
color: #999;
}
#the-comment-list .author a span.akismet-span-link {
text-decoration: inherit;
color: inherit;
}
#the-comment-list .akismet_remove_url {
margin-left: 3px;
color: #999;
padding: 2px 3px 2px 0;
}
#the-comment-list .akismet_remove_url:hover {
color: #A7301F;
font-weight: bold;
padding: 2px 2px 2px 0;
}
#dashboard_recent_comments .akismet-status {
display: none;
}
.akismet-status {
float: right;
}
.akismet-status a {
color: #AAA;
font-style: italic;
}
table.comments td.comment p a {
text-decoration: underline;
}
table.comments td.comment p a:after {
content: attr(href);
color: #aaa;
display: inline-block; /* Show the URL without the link's underline extending under it. */
padding: 0 1ex; /* Because it's inline block, we can't just use spaces in the content: attribute to separate it from the link text. */
}
.mshot-arrow {
width: 0;
height: 0;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
border-right: 10px solid #5C5C5C;
position: absolute;
left: -6px;
top: 91px;
}
.mshot-container {
background: #5C5C5C;
position: absolute;
top: -94px;
padding: 7px;
width: 450px;
height: 338px;
z-index: 20000;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-border-radius: 6px;
}
.akismet-mshot {
position: absolute;
z-index: 100;
}
.akismet-mshot .mshot-image {
margin: 0;
height: 338px;
width: 450px;
}
.checkforspam {
display: inline-block !important;
}
.checkforspam-spinner {
display: inline-block;
margin-top: 7px;
}
.akismet-right {
float: right;
}
.akismet-card .akismet-right {
margin: 1em 0;
}
.akismet-alert-text {
color: #dd3d36;
font-weight: bold;
font-size: 120%;
margin-top: .5rem;
}
.akismet-alert {
padding: 0.4em 1em 1.4em 1em;
box-sizing: border-box;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
}
.akismet-alert h3.akismet-key-status {
color: #fff;
margin: 1em 0 0.5em 0;
}
.akismet-alert.akismet-critical {
background-color: #993300;
}
.akismet-alert.akismet-active {
background-color: #649316;
}
.akismet-alert p.akismet-key-status {
font-size: 24px;
}
.akismet-alert p.akismet-description {
color:#fff;
font-size: 14px;
margin: 0 0;
font-style: normal;
}
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a,
.akismet-alert p.akismet-description a {
color: #fff;
}
.akismet-new-snapshot {
margin-top: 1em;
padding: 1em;
text-align: center;
background: #fff;
}
.akismet-new-snapshot h3 {
background: #f5f5f5;
color: #888;
font-size: 11px;
margin: 0;
padding: 3px;
}
.new-snapspot ul {
font-size: 12px;
width: 100%;
}
.akismet-new-snapshot ul li {
color: #999;
float: left;
font-size: 11px;
padding: 0 20px;
text-transform: uppercase;
width: 33%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
}
.akismet-new-snapshot ul li:first-child,
.akismet-new-snapshot ul li:nth-child(2) {
border-right:1px dotted #ccc;
}
.akismet-new-snapshot ul li span {
color: #52accc;
display: block;
font-size: 32px;
font-weight: lighter;
line-height: 1.5em;
}
.akismet-settings th:first-child {
vertical-align: top;
padding-top: 15px;
}
.akismet-settings th.akismet-api-key {
vertical-align: middle;
padding-top: 0;
}
.akismet-settings input[type=text] {
width: 75%;
}
.akismet-settings span.akismet-note{
float: left;
padding-left: 23px;
font-size: 75%;
margin-top: -10px;
}
/**
* For the activation notice on the plugins page.
*/
#akismet_setup_prompt {
background: none;
border: none;
margin: 0;
padding: 0;
width: 100%;
}
.akismet_activate {
border: 1px solid #4F800D;
padding: 5px;
margin: 15px 0;
background: #83AF24;
background-image: -webkit-gradient(linear, 0% 0, 80% 100%, from(#83AF24), to(#4F800D));
background-image: -moz-linear-gradient(80% 100% 120deg, #4F800D, #83AF24);
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-border-radius: 3px;
position: relative;
overflow: hidden;
}
.akismet_activate .aa_a {
position: absolute;
top: -5px;
right: 10px;
font-size: 140px;
color: #769F33;
font-family: Georgia, "Times New Roman", Times, serif;
}
.akismet_activate .aa_button {
font-weight: bold;
border: 1px solid #029DD6;
border-top: 1px solid #06B9FD;
font-size: 15px;
text-align: center;
padding: 9px 0 8px 0;
color: #FFF;
background: #029DD6;
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1));
background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6);
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-border-radius: 2px;
width: 100%;
cursor: pointer;
margin: 0;
}
.akismet_activate .aa_button:hover {
text-decoration: none !important;
border: 1px solid #029DD6;
border-bottom: 1px solid #00A8EF;
font-size: 15px;
text-align: center;
padding: 9px 0 8px 0;
color: #F0F8FB;
background: #0079B1;
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#0079B1), to(#0092BF));
background-image: -moz-linear-gradient(0% 100% 90deg, #0092BF, #0079B1);
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-border-radius: 2px;
}
.akismet_activate .aa_button_border {
border: 1px solid #006699;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-border-radius: 2px;
background: #029DD6;
background-image: -webkit-gradient(linear, 0% 0, 0% 100%, from(#029DD6), to(#0079B1));
background-image: -moz-linear-gradient(0% 100% 90deg, #0079B1, #029DD6);
}
.akismet_activate .aa_button_container {
box-sizing: border-box;
display: inline-block;
background: #DEF1B8;
padding: 5px;
-moz-border-radius: 2px;
border-radius: 2px;
-webkit-border-radius: 2px;
width: 266px;
}
.akismet_activate .aa_description {
position: absolute;
top: 22px;
left: 285px;
margin-left: 25px;
color: #E5F2B1;
font-size: 15px;
}
.akismet_activate .aa_description strong {
color: #FFF;
font-weight: normal;
}
@media (max-width: 550px) {
.akismet_activate .aa_a {
display: none;
}
.akismet_activate .aa_button_container {
width: 100%;
}
}
@media (max-width: 782px) {
.akismet_activate {
min-width: 0;
}
}
@media (max-width: 850px) {
#akismet_setup_prompt .aa_description {
display: none;
}
.akismet_activate {
min-width: 0;
}
}
.jetpack_page_akismet-key-config #wpcontent, .settings_page_akismet-key-config #wpcontent {
padding-left: 0;
}
.akismet-masthead {
background-color:#fff;
text-align:center;
box-shadow:0 1px 0 rgba(200,215,225,0.5),0 1px 2px #e9eff3
}
@media (max-width: 45rem) {
.akismet-masthead {
padding:0 1.25rem
}
}
.akismet-masthead__inside-container {
padding:.375rem 0;
margin:0 auto;
width:100%;
max-width:45rem;
text-align: left;
}
.akismet-masthead__logo-container {
padding:.3125rem 0 0
}
.akismet-masthead__logo {
width:10.375rem;
height:1.8125rem;
}
.akismet-masthead__logo-link {
display:inline-block;
outline:none;
vertical-align:middle
}
.akismet-masthead__logo-link:focus {
line-height:0;
box-shadow:0 0 0 2px #78dcfa
}
.akismet-masthead__logo-link+code {
margin:0 10px;
padding:5px 9px;
border-radius:2px;
background:#e6ecf1;
color:#647a88
}
.akismet-masthead__links {
display:-ms-flexbox;
display:flex;
-ms-flex-flow:row wrap;
flex-flow:row wrap;
-ms-flex:2 50%;
flex:2 50%;
-ms-flex-pack:end;
justify-content:flex-end;
margin:0
}
@media (max-width: 480px) {
.akismet-masthead__links {
padding-right:.625rem
}
}
.akismet-masthead__link-li {
margin:0;
padding:0
}
.akismet-masthead__link {
font-style:normal;
color:#0087be;
padding:.625rem;
display:inline-block
}
.akismet-masthead__link:visited {
color:#0087be
}
.akismet-masthead__link:active,.akismet-masthead__link:hover {
color:#00aadc
}
.akismet-masthead__link:hover {
text-decoration:underline
}
.akismet-masthead__link .dashicons {
display:none
}
@media (max-width: 480px) {
.akismet-masthead__link:hover,.akismet-masthead__link:active {
text-decoration:none
}
.akismet-masthead__link .dashicons {
display:block;
font-size:1.75rem
}
.akismet-masthead__link span+span {
display:none
}
}
.akismet-masthead__link-li:last-of-type .akismet-masthead__link {
padding-right:0
}
.akismet-lower {
margin: 0 auto;
text-align: left;
max-width: 45rem;
padding: 1.5rem;
}
.akismet-lower .notice {
margin-bottom: 2rem;
}
.akismet-card {
margin-top: 1rem;
margin-bottom: 0;
position: relative;
margin: 0 auto 0.625rem auto;
box-sizing: border-box;
background: white;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
}
.akismet-card:after, .akismet-card .inside:after, .akismet-masthead__logo-container:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.akismet-card .inside {
padding: 1.5rem;
padding-top: 1rem;
}
.akismet-card .akismet-card-actions {
margin-top: 1rem;
}
.jetpack_page_akismet-key-config .update-nag, .settings_page_akismet-key-config .update-nag {
display: none;
}
.akismet-masthead .akismet-right {
line-height: 2.125rem;
font-size: 0.9rem;
}
.akismet-box {
box-sizing: border-box;
background: white;
border: 1px solid rgba(200, 215, 225, 0.5);
}
.akismet-box h2, .akismet-box h3 {
padding: 1.5rem 1.5rem .5rem 1.5rem;
margin: 0;
}
.akismet-box p {
padding: 0 1.5rem 1.5rem 1.5rem;
margin: 0;
}
.akismet-jetpack-email {
font-style: oblique;
}
.akismet-jetpack-gravatar {
padding: 0 0 0 1.5rem;
float: left;
margin-right: 1rem;
width: 54px;
height: 54px;
}
.akismet-box p:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.akismet-box .akismet-right {
padding-right: 1.5rem;
}
.akismet-boxes .akismet-box {
margin-bottom: 0;
padding: 0;
margin-top: -1px;
}
.akismet-boxes .akismet-box:last-child {
margin-bottom: 1.5rem;
}
.akismet-boxes .akismet-box:first-child {
margin-top: 1.5rem;
}
.akismet-box-header {
max-width: 700px;
margin: 0 auto 40px auto;
line-height: 1.5;
}
.akismet-box-header h2 {
margin: 1.5rem 10% 0;
font-size: 1.375rem;
font-weight: 700;
color: #000;
}
.akismet-box .centered {
text-align: center;
}
.akismet-enter-api-key-box {
margin: 1.5rem 0;
}
.akismet-box .enter-api-key {
display: none;
margin-top: 1.5rem;
}
.akismet-box .akismet-toggles {
margin: 3rem 0;
}
.akismet-box .akismet-ak-connect, .akismet-box .toggle-jp-connect {
display: none;
}
.akismet-box .enter-api-key p {
padding: 0 1.5rem;
}
.akismet-button, .akismet-button:hover, .akismet-button:visited {
background: white;
border-color: #c8d7e1;
border-style: solid;
border-width: 1px 1px 2px;
color: #2e4453;
cursor: pointer;
display: inline-block;
margin: 0;
outline: 0;
overflow: hidden;
font-size: 14px;
font-weight: 500;
text-overflow: ellipsis;
text-decoration: none;
vertical-align: top;
box-sizing: border-box;
font-size: 14px;
line-height: 21px;
border-radius: 4px;
padding: 7px 14px 9px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.akismet-button:hover {
border-color: #a8bece;
}
.akismet-button:active {
border-width: 2px 1px 1px;
}
.akismet-is-primary, .akismet-is-primary:hover, .akismet-is-primary:visited {
background: #00aadc;
border-color: #0087be;
color: white;
}
.akismet-is-primary:hover, .akismet-is-primary:focus {
border-color: #005082;
}
.akismet-is-primary:hover {
border-color: #005082;
}
.akismet-section-header {
position: relative;
margin: 0 auto 0.625rem auto;
padding: 1rem;
box-sizing: border-box;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
background: #ffffff;
width: 100%;
padding-top: 0.6875rem;
padding-bottom: 0.6875rem;
display: flex;
}
.akismet-section-header__label {
display: -ms-flexbox;
display: flex;
-ms-flex-align: center;
align-items: center;
-ms-flex-positive: 1;
flex-grow: 1;
line-height: 1.75rem;
position: relative;
font-size: 0.875rem;
color: #4f748e;
}
.akismet-section-header__actions {
line-height: 1.75rem;
}
.akismet-setup-instructions {
text-align: center;
}
.akismet-setup-instructions form {
padding-bottom: 1.5rem;
}
div.error.akismet-usage-limit-alert {
padding: 25px 45px 25px 15px;
display: flex;
align-items: center;
}
#akismet-plugin-container .akismet-usage-limit-alert {
margin: 0 auto 0.625rem auto;
box-sizing: border-box;
box-shadow: 0 0 0 1px rgba(200, 215, 225, 0.5), 0 1px 2px #e9eff3;
border: none;
border-left: 4px solid #d63638;
}
.akismet-usage-limit-alert .akismet-usage-limit-logo {
width: 38px;
min-width: 38px;
height: 38px;
border-radius: 20px;
margin-right: 18px;
background: black;
position: relative;
}
.akismet-usage-limit-alert .akismet-usage-limit-logo img {
position: absolute;
width: 22px;
left: 8px;
top: 10px;
}
.akismet-usage-limit-alert .akismet-usage-limit-text {
flex-grow: 1;
margin-right: 18px;
}
.akismet-usage-limit-alert h3 {
margin: 0;
}
.akismet-usage-limit-alert .akismet-usage-limit-cta {
text-align: right;
}
@media (max-width: 550px) {
div.error.akismet-usage-limit-alert {
display: block;
}
.akismet-usage-limit-alert .akismet-usage-limit-logo,
.akismet-usage-limit-alert .akismet-usage-limit-text {
margin-bottom: 15px;
}
.akismet-usage-limit-alert .akismet-usage-limit-cta {
text-align: left;
}
}
+421
View File
@@ -0,0 +1,421 @@
jQuery( function ( $ ) {
var mshotRemovalTimer = null;
var mshotRetryTimer = null;
var mshotTries = 0;
var mshotRetryInterval = 1000;
var mshotEnabledLinkSelector = 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a';
var preloadedMshotURLs = [];
$('.akismet-status').each(function () {
var thisId = $(this).attr('commentid');
$(this).prependTo('#comment-' + thisId + ' .column-comment');
});
$('.akismet-user-comment-count').each(function () {
var thisId = $(this).attr('commentid');
$(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
});
akismet_enable_comment_author_url_removal();
$( '#the-comment-list' ).on( 'click', '.akismet_remove_url', function () {
var thisId = $(this).attr('commentid');
var data = {
action: 'comment_author_deurl',
_wpnonce: WPAkismet.comment_author_url_nonce,
id: thisId
};
$.ajax({
url: ajaxurl,
type: 'POST',
data: data,
beforeSend: function () {
// Removes "x" link
$("a[commentid='"+ thisId +"']").hide();
// Show temp status
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
},
success: function (response) {
if (response) {
// Show status/undo link
$("#author_comment_url_"+ thisId)
.attr('cid', thisId)
.addClass('akismet_undo_link_removal')
.html(
$( '<span/>' ).text( WPAkismet.strings['URL removed'] )
)
.append( ' ' )
.append(
$( '<span/>' )
.text( WPAkismet.strings['(undo)'] )
.addClass( 'akismet-span-link' )
);
}
}
});
return false;
}).on( 'click', '.akismet_undo_link_removal', function () {
var thisId = $(this).attr('cid');
var thisUrl = $(this).attr('href');
var data = {
action: 'comment_author_reurl',
_wpnonce: WPAkismet.comment_author_url_nonce,
id: thisId,
url: thisUrl
};
$.ajax({
url: ajaxurl,
type: 'POST',
data: data,
beforeSend: function () {
// Show temp status
$("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
},
success: function (response) {
if (response) {
// Add "x" link
$("a[commentid='"+ thisId +"']").show();
// Show link. Core strips leading http://, so let's do that too.
$("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
}
}
});
return false;
});
// Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments.
if ( "enable_mshots" in WPAkismet && WPAkismet.enable_mshots ) {
$( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () {
clearTimeout( mshotRemovalTimer );
if ( $( '.akismet-mshot' ).length > 0 ) {
if ( $( '.akismet-mshot:first' ).data( 'link' ) == this ) {
// The preview is already showing for this link.
return;
}
else {
// A new link is being hovered, so remove the old preview.
$( '.akismet-mshot' ).remove();
}
}
clearTimeout( mshotRetryTimer );
var linkUrl = $( this ).attr( 'href' );
if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) {
// This preview image was already preloaded, so begin with a retry URL so the user doesn't see the placeholder image for the first second.
mshotTries = 2;
}
else {
mshotTries = 1;
}
var mShot = $( '<div class="akismet-mshot mshot-container"><div class="mshot-arrow"></div><img src="' + akismet_mshot_url( linkUrl, mshotTries ) + '" width="450" height="338" class="mshot-image" /></div>' );
mShot.data( 'link', this );
mShot.data( 'url', linkUrl );
mShot.find( 'img' ).on( 'load', function () {
$( '.akismet-mshot' ).data( 'pending-request', false );
} );
var offset = $( this ).offset();
mShot.offset( {
left : Math.min( $( window ).width() - 475, offset.left + $( this ).width() + 10 ), // Keep it on the screen if the link is near the edge of the window.
top: offset.top + ( $( this ).height() / 2 ) - 101 // 101 = top offset of the arrow plus the top border thickness
} );
$( 'body' ).append( mShot );
mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
} ).on( 'mouseout', 'a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type, td.comment p a', function () {
mshotRemovalTimer = setTimeout( function () {
clearTimeout( mshotRetryTimer );
$( '.akismet-mshot' ).remove();
}, 200 );
} );
var preloadDelayTimer = null;
$( window ).on( 'scroll resize', function () {
clearTimeout( preloadDelayTimer );
preloadDelayTimer = setTimeout( preloadMshotsInViewport, 500 );
} );
preloadMshotsInViewport();
}
/**
* The way mShots works is if there was no screenshot already recently generated for the URL,
* it returns a "loading..." image for the first request. Then, some subsequent request will
* receive the actual screenshot, but it's unknown how long it will take. So, what we do here
* is continually re-request the mShot, waiting a second after every response until we get the
* actual screenshot.
*/
function retryMshotUntilLoaded() {
clearTimeout( mshotRetryTimer );
var imageWidth = $( '.akismet-mshot img' ).get(0).naturalWidth;
if ( imageWidth == 0 ) {
// It hasn't finished loading yet the first time. Check again shortly.
setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
}
else if ( imageWidth == 400 ) {
// It loaded the preview image.
if ( mshotTries == 20 ) {
// Give up if we've requested the mShot 20 times already.
return;
}
if ( ! $( '.akismet-mshot' ).data( 'pending-request' ) ) {
$( '.akismet-mshot' ).data( 'pending-request', true );
mshotTries++;
$( '.akismet-mshot .mshot-image' ).attr( 'src', akismet_mshot_url( $( '.akismet-mshot' ).data( 'url' ), mshotTries ) );
}
mshotRetryTimer = setTimeout( retryMshotUntilLoaded, mshotRetryInterval );
}
else {
// All done.
}
}
function preloadMshotsInViewport() {
var windowWidth = $( window ).width();
var windowHeight = $( window ).height();
$( '#the-comment-list' ).find( mshotEnabledLinkSelector ).each( function ( index, element ) {
var linkUrl = $( this ).attr( 'href' );
// Don't attempt to preload an mshot for a single link twice.
if ( preloadedMshotURLs.indexOf( linkUrl ) !== -1 ) {
// The URL is already preloaded.
return true;
}
if ( typeof element.getBoundingClientRect !== 'function' ) {
// The browser is too old. Return false to stop this preloading entirely.
return false;
}
var rect = element.getBoundingClientRect();
if ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= windowHeight && rect.right <= windowWidth ) {
akismet_preload_mshot( linkUrl );
$( this ).data( 'akismet-mshot-preloaded', true );
}
} );
}
$( '.checkforspam.enable-on-load' ).on( 'click', function( e ) {
if ( $( this ).hasClass( 'ajax-disabled' ) ) {
// Akismet hasn't been configured yet. Allow the user to proceed to the button's link.
return;
}
e.preventDefault();
if ( $( this ).hasClass( 'button-disabled' ) ) {
window.location.href = $( this ).data( 'success-url' ).replace( '__recheck_count__', 0 ).replace( '__spam_count__', 0 );
return;
}
$('.checkforspam').addClass('button-disabled').addClass( 'checking' );
$('.checkforspam-spinner').addClass( 'spinner' ).addClass( 'is-active' );
akismet_check_for_spam(0, 100);
}).removeClass( 'button-disabled' );
var spam_count = 0;
var recheck_count = 0;
function akismet_check_for_spam(offset, limit) {
var check_for_spam_buttons = $( '.checkforspam' );
var nonce = check_for_spam_buttons.data( 'nonce' );
// We show the percentage complete down to one decimal point so even queues with 100k
// pending comments will show some progress pretty quickly.
var percentage_complete = Math.round( ( recheck_count / check_for_spam_buttons.data( 'pending-comment-count' ) ) * 1000 ) / 10;
// Update the progress counter on the "Check for Spam" button.
$( '.checkforspam' ).text( check_for_spam_buttons.data( 'progress-label' ).replace( '%1$s', percentage_complete ) );
$.post(
ajaxurl,
{
'action': 'akismet_recheck_queue',
'offset': offset,
'limit': limit,
'nonce': nonce
},
function(result) {
if ( 'error' in result ) {
// An error is only returned in the case of a missing nonce, so we don't need the actual error message.
window.location.href = check_for_spam_buttons.data( 'failure-url' );
return;
}
recheck_count += result.counts.processed;
spam_count += result.counts.spam;
if (result.counts.processed < limit) {
window.location.href = check_for_spam_buttons.data( 'success-url' ).replace( '__recheck_count__', recheck_count ).replace( '__spam_count__', spam_count );
}
else {
// Account for comments that were caught as spam and moved out of the queue.
akismet_check_for_spam(offset + limit - result.counts.spam, limit);
}
}
);
}
if ( "start_recheck" in WPAkismet && WPAkismet.start_recheck ) {
$( '.checkforspam' ).click();
}
if ( typeof MutationObserver !== 'undefined' ) {
// Dynamically add the "X" next the the author URL links when a comment is quick-edited.
var comment_list_container = document.getElementById( 'the-comment-list' );
if ( comment_list_container ) {
var observer = new MutationObserver( function ( mutations ) {
for ( var i = 0, _len = mutations.length; i < _len; i++ ) {
if ( mutations[i].addedNodes.length > 0 ) {
akismet_enable_comment_author_url_removal();
// Once we know that we'll have to check for new author links, skip the rest of the mutations.
break;
}
}
} );
observer.observe( comment_list_container, { attributes: true, childList: true, characterData: true } );
}
}
function akismet_enable_comment_author_url_removal() {
$( '#the-comment-list' )
.find( 'tr.comment, tr[id ^= "comment-"]' )
.find( '.column-author a[href^="http"]:first' ) // Ignore mailto: links, which would be the comment author's email.
.each(function () {
if ( $( this ).parent().find( '.akismet_remove_url' ).length > 0 ) {
return;
}
var linkHref = $(this).attr( 'href' );
// Ignore any links to the current domain, which are diagnostic tools, like the IP address link
// or any other links another plugin might add.
var currentHostParts = document.location.href.split( '/' );
var currentHost = currentHostParts[0] + '//' + currentHostParts[2] + '/';
if ( linkHref.indexOf( currentHost ) != 0 ) {
var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
$(this)
.attr("id", "author_comment_url_"+ thisCommentId[1])
.after(
$( '<a href="#" class="akismet_remove_url">x</a>' )
.attr( 'commentid', thisCommentId[1] )
.attr( 'title', WPAkismet.strings['Remove this URL'] )
);
}
});
}
/**
* Generate an mShot URL if given a link URL.
*
* @param string linkUrl
* @param int retry If retrying a request, the number of the retry.
* @return string The mShot URL;
*/
function akismet_mshot_url( linkUrl, retry ) {
var mshotUrl = '//s0.wp.com/mshots/v1/' + encodeURIComponent( linkUrl ) + '?w=900';
if ( retry > 1 ) {
mshotUrl += '&r=' + encodeURIComponent( retry );
}
mshotUrl += '&source=akismet';
return mshotUrl;
}
/**
* Begin loading an mShot preview of a link.
*
* @param string linkUrl
*/
function akismet_preload_mshot( linkUrl ) {
var img = new Image();
img.src = akismet_mshot_url( linkUrl );
preloadedMshotURLs.push( linkUrl );
}
$( '.akismet-could-be-primary' ).each( function () {
var form = $( this ).closest( 'form' );
form.data( 'initial-state', form.serialize() );
form.on( 'change keyup', function () {
var self = $( this );
var submit_button = self.find( '.akismet-could-be-primary' );
if ( self.serialize() != self.data( 'initial-state' ) ) {
submit_button.addClass( 'akismet-is-primary' );
}
else {
submit_button.removeClass( 'akismet-is-primary' );
}
} );
} );
/**
* Shows the Enter API key form
*/
$( '.akismet-enter-api-key-box a' ).on( 'click', function ( e ) {
e.preventDefault();
var div = $( '.enter-api-key' );
div.show( 500 );
div.find( 'input[name=key]' ).focus();
$( this ).hide();
} );
/**
* Hides the Connect with Jetpack form | Shows the Activate Akismet Account form
*/
$( 'a.toggle-ak-connect' ).on( 'click', function ( e ) {
e.preventDefault();
$( '.akismet-ak-connect' ).slideToggle('slow');
$( 'a.toggle-ak-connect' ).hide();
$( '.akismet-jp-connect' ).hide();
$( 'a.toggle-jp-connect' ).show();
} );
/**
* Shows the Connect with Jetpack form | Hides the Activate Akismet Account form
*/
$( 'a.toggle-jp-connect' ).on( 'click', function ( e ) {
e.preventDefault();
$( '.akismet-jp-connect' ).slideToggle('slow');
$( 'a.toggle-jp-connect' ).hide();
$( '.akismet-ak-connect' ).hide();
$( 'a.toggle-ak-connect' ).show();
} );
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+68
View File
@@ -0,0 +1,68 @@
<?php
/**
* @package Akismet
*/
/*
Plugin Name: Akismet Anti-Spam
Plugin URI: https://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key.
Version: 5.0.1
Requires at least: 5.0
Requires PHP: 5.2
Author: Automattic
Author URI: https://automattic.com/wordpress-plugins/
License: GPLv2 or later
Text Domain: akismet
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Copyright 2005-2022 Automattic, Inc.
*/
// Make sure we don't expose any info if called directly
if ( !function_exists( 'add_action' ) ) {
echo 'Hi there! I\'m just a plugin, not much I can do when called directly.';
exit;
}
define( 'AKISMET_VERSION', '5.0.1' );
define( 'AKISMET__MINIMUM_WP_VERSION', '5.0' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 10000 );
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-rest-api.php' );
add_action( 'init', array( 'Akismet', 'init' ) );
add_action( 'rest_api_init', array( 'Akismet_REST_API', 'init' ) );
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' );
add_action( 'init', array( 'Akismet_Admin', 'init' ) );
}
//add wrapper class around deprecated akismet functions that are referenced elsewhere
require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' );
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-cli.php' );
}
+509
View File
@@ -0,0 +1,509 @@
=== Akismet Anti-Spam ===
== Archived Changelog Entries ==
This file contains older changelog entries, so we can keep the size of the standard WordPress readme.txt file reasonable.
For the latest changes, please see the "Changelog" section of the [readme.txt file](https://plugins.svn.wordpress.org/akismet/trunk/readme.txt).
= 4.1.12 =
*Release Date - 3 September 2021*
* Fixed "Use of undefined constant" notice.
* Improved styling of alert notices.
= 4.1.11 =
*Release Date - 23 August 2021*
* Added support for Akismet API usage notifications on Akismet settings and edit-comments admin pages.
* Added support for the deleted_comment action when bulk-deleting comments from Spam.
= 4.1.10 =
*Release Date - 6 July 2021*
* Simplified the code around checking comments in REST API and XML-RPC requests.
* Updated Plus plan terminology in notices to match current subscription names.
* Added `rel="noopener"` to the widget link to avoid warnings in Google Lighthouse.
* Set the Akismet JavaScript as deferred instead of async to improve responsiveness.
* Improved the preloading of screenshot popups on the edit comments admin page.
= 4.1.9 =
*Release Date - 2 March 2021*
* Improved handling of pingbacks in XML-RPC multicalls
= 4.1.8 =
*Release Date - 6 January 2021*
* Fixed missing fields in submit-spam and submit-ham calls that could lead to reduced accuracy.
* Fixed usage of deprecated jQuery function.
= 4.1.7 =
*Release Date - 22 October 2020*
* Show the "Set up your Akismet account" banner on the comments admin screen, where it's relevant to mention if Akismet hasn't been configured.
* Don't use wp_blacklist_check when the new wp_check_comment_disallowed_list function is available.
= 4.1.6 =
*Release Date - 4 June 2020*
* Disable "Check for Spam" button until the page is loaded to avoid errors with clicking through to queue recheck endpoint directly.
* Added filter "akismet_enable_mshots" to allow disabling screenshot popups on the edit comments admin page.
= 4.1.5 =
*Release Date - 29 April 2020*
* Based on user feedback, we have dropped the in-admin notice explaining the availability of the "privacy notice" option in the AKismet settings screen. The option itself is available, but after displaying the notice for the last 2 years, it is now considered a known fact.
* Updated the "Requires at least" to WP 4.6, based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet
* Moved older changelog entries to a separate file to keep the size of this readme reasonable, also based on recommendations from https://wp-info.org/tools/checkplugini18n.php?slug=akismet
= 4.1.4 =
*Release Date - 17 March 2020*
* Only redirect to the Akismet setup screen upon plugin activation if the plugin was activated manually from within the plugin-related screens, to help users with non-standard install workflows, like WP-CLI.
* Update the layout of the initial setup screen to be more readable on small screens.
* If no API key has been entered, don't run code that expects an API key.
* Improve the readability of the comment history entries.
* Don't modify the comment form HTML if no API key has been set.
= 4.1.3 =
*Release Date - 31 October 2019*
* Prevented an attacker from being able to cause a user to unknowingly recheck their Pending comments for spam.
* Improved compatibility with Jetpack 7.7+.
* Updated the plugin activation page to use consistent language and markup.
* Redirecting users to the Akismet connnection/settings screen upon plugin activation, in an effort to make it easier for people to get setup.
= 4.1.2 =
*Release Date - 14 May 2019*
* Fixed a conflict between the Akismet setup banner and other plugin notices.
* Reduced the number of API requests made by the plugin when attempting to verify the API key.
* Include additional data in the pingback pre-check API request to help make the stats more accurate.
* Fixed a bug that was enabling the "Check for Spam" button when no comments were eligible to be checked.
* Improved Akismet's AMP compatibility.
= 4.1.1 =
*Release Date - 31 January 2019*
* Fixed the "Setup Akismet" notice so it resizes responsively.
* Only highlight the "Save Changes" button in the Akismet config when changes have been made.
* The count of comments in your spam queue shown on the dashboard show now always be up-to-date.
= 4.1 =
*Release Date - 12 November 2018*
* Added a WP-CLI method for retrieving stats.
* Hooked into the new "Personal Data Eraser" functionality from WordPress 4.9.6.
* Added functionality to clear outdated alerts from Akismet.com.
= 4.0.8 =
*Release Date - 19 June 2018*
* Improved the grammar and consistency of the in-admin privacy related notes (notice and config).
* Revised in-admin explanation of the comment form privacy notice to make its usage clearer.
* Added `rel="nofollow noopener"` to the comment form privacy notice to improve SEO and security.
= 4.0.7 =
*Release Date - 28 May 2018*
* Based on user feedback, the link on "Learn how your comment data is processed." in the optional privacy notice now has a `target` of `_blank` and opens in a new tab/window.
* Updated the in-admin privacy notice to use the term "comment" instead of "contact" in "Akismet can display a notice to your users under your comment forms."
* Only show in-admin privacy notice if Akismet has an API Key configured
= 4.0.6 =
*Release Date - 26 May 2018*
* Moved away from using `empty( get_option() )` to instantiating a variable to be compatible with older versions of PHP (5.3, 5.4, etc).
= 4.0.5 =
*Release Date - 26 May 2018*
* Corrected version number after tagging. Sorry...
= 4.0.4 =
*Release Date - 26 May 2018*
* Added a hook to provide Akismet-specific privacy information for a site's privacy policy.
* Added tools to control the display of a privacy related notice under comment forms.
* Fixed HTML in activation failure message to close META and HEAD tag properly.
* Fixed a bug that would sometimes prevent Akismet from being correctly auto-configured.
= 4.0.3 =
*Release Date - 19 February 2018*
* Added a scheduled task to remove entries in wp_commentmeta that no longer have corresponding comments in wp_comments.
* Added a new `akismet_batch_delete_count` action to the batch delete methods for people who'd like to keep track of the numbers of records being processed by those methods.
= 4.0.2 =
*Release Date - 18 December 2017*
* Fixed a bug that could cause Akismet to recheck a comment that has already been manually approved or marked as spam.
* Fixed a bug that could cause Akismet to claim that some comments are still waiting to be checked when no comments are waiting to be checked.
= 4.0.1 =
*Release Date - 6 November 2017*
* Fixed a bug that could prevent some users from connecting Akismet via their Jetpack connection.
* Ensured that any pending Akismet-related events are unscheduled if the plugin is deactivated.
* Allow some JavaScript to be run asynchronously to avoid affecting page render speeds.
= 4.0 =
*Release Date - 19 September 2017*
* Added REST API endpoints for configuring Akismet and retrieving stats.
* Increased the minimum supported WordPress version to 4.0.
* Added compatibility with comments submitted via the REST API.
* Improved the progress indicator on the "Check for Spam" button.
= 3.3.4 =
*Release Date - 3 August 2017*
* Disabled Akismet's debug log output by default unless AKISMET_DEBUG is defined.
* URL previews now begin preloading when the mouse moves near them in the comments section of wp-admin.
* When a comment is caught by the Comment Blacklist, Akismet will always allow it to stay in the trash even if it is spam as well.
* Fixed a bug that was preventing an error from being shown when a site can't reach Akismet's servers.
= 3.3.3 =
*Release Date - 13 July 2017*
* Reduced amount of bandwidth used by the URL Preview feature.
* Improved the admin UI when the API key is manually pre-defined for the site.
* Removed a workaround for WordPress installations older than 3.3 that will improve Akismet's compatibility with other plugins.
* The number of spam blocked that is displayed on the WordPress dashboard will now be more accurate and updated more frequently.
* Fixed a bug in the Akismet widget that could cause PHP warnings.
= 3.3.2 =
*Release Date - 10 May 2017*
* Fixed a bug causing JavaScript errors in some browsers.
= 3.3.1 =
*Release Date - 2 May 2017*
* Improve performance by only requesting the akismet_comment_nonce option when absolutely necessary.
* Fixed two bugs that could cause PHP warnings.
* Fixed a bug that was preventing the "Remove author URL" feature from working after a comment was edited using "Quick Edit."
* Fixed a bug that was preventing the URL preview feature from working after a comment was edited using "Quick Edit."
= 3.3 =
*Release Date - 23 February 2017*
* Updated the Akismet admin pages with a new clean design.
* Fixed bugs preventing the `akismet_add_comment_nonce` and `akismet_update_alert` wrapper functions from working properly.
* Fixed bug preventing the loading indicator from appearing when re-checking all comments for spam.
* Added a progress indicator to the "Check for Spam" button.
* Added a success message after manually rechecking the Pending queue for spam.
= 3.2 =
*Release Date - 6 September 2016*
* Added a WP-CLI module. You can now check comments and recheck the moderation queue from the command line.
* Stopped using the deprecated jQuery function `.live()`.
* Fixed a bug in `remove_comment_author_url()` and `add_comment_author_url()` that could generate PHP notices.
* Fixed a bug that could cause an infinite loop for sites with very very very large comment IDs.
* Fixed a bug that could cause the Akismet widget title to be blank.
= 3.1.11 =
*Release Date - 12 May 2016*
* Fixed a bug that could cause the "Check for Spam" button to skip some comments.
* Fixed a bug that could prevent some spam submissions from being sent to Akismet.
* Updated all links to use https:// when possible.
* Disabled Akismet debug logging unless WP_DEBUG and WP_DEBUG_LOG are both enabled.
= 3.1.10 =
*Release Date - 1 April 2016*
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
* Fixed a bug that could have resulted in comments that were caught by the core WordPress comment blacklist not to have a corresponding History entry.
* Fixed a bug that could have caused avoidable PHP warnings in the error log.
= 3.1.9 =
*Release Date - 28 March 2016*
* Add compatibility with Jetpack so that Jetpack can automatically configure Akismet settings when appropriate.
* Fixed a bug preventing some comment data from being sent to Akismet.
= 3.1.8 =
*Release Date - 4 March 2016*
* Fixed a bug preventing Akismet from being used with some plugins that rewrite admin URLs.
* Reduced the amount of bandwidth used on Akismet API calls
* Reduced the amount of space Akismet uses in the database
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
= 3.1.7 =
*Release Date - 4 January 2016*
* Added documentation for the 'akismet_comment_nonce' filter.
* The post-install activation button is now accessible to screen readers and keyboard-only users.
* Fixed a bug that was preventing the "Remove author URL" feature from working in WordPress 4.4
= 3.1.6 =
*Release Date - 14 December 2015*
* Improve the notices shown after activating Akismet.
* Update some strings to allow for the proper plural forms in all languages.
= 3.1.5 =
*Release Date - 13 October 2015*
* Closes a potential XSS vulnerability.
= 3.1.4 =
*Release Date - 24 September 2015*
* Fixed a bug that was preventing some users from automatically connecting using Jetpack if they didn't have a current Akismet subscription.
* Fixed a bug that could cause comments caught as spam to be placed in the Pending queue.
* Error messages and instructions have been simplified to be more understandable.
* Link previews are enabled for all links inside comments, not just the author's website link.
= 3.1.3 =
*Release Date - 6 July 2015*
* Notify users when their account status changes after previously being successfully set up. This should help any users who are seeing blank Akismet settings screens.
= 3.1.2 =
*Release Date - 7 June 2015*
* Reduced the amount of space Akismet uses in the commentmeta table.
* Fixed a bug where some comments with quotes in the author name weren't getting history entries
* Pre-emptive security improvements to ensure that the Akismet plugin can't be used by attackers to compromise a WordPress installation.
* Better UI for the key entry field: allow whitespace to be included at the beginning or end of the key and strip it out automatically when the form is submitted.
* When deactivating the plugin, notify the Akismet API so the site can be marked as inactive.
* Clearer error messages.
= 3.1.1 =
*Release Date - 17th March, 2015*
* Improvements to the "Remove comment author URL" JavaScript
* Include the pingback pre-check from the 2.6 branch.
= 3.1 =
*Release Date - 11th March, 2015*
* Use HTTPS by default for all requests to Akismet.
* Fix for a situation where Akismet might strip HTML from a comment.
= 3.0.4 =
*Release Date - 11th December, 2014*
* Fix to make .htaccess compatible with Apache 2.4.
* Fix to allow removal of https author URLs.
* Fix to avoid stripping part of the author URL when removing and re-adding.
* Removed the "Check for Spam" button from the "Trash" and "Approved" queues, where it would have no effect.
* Allow automatic API key configuration when Jetpack is installed and connected to a WordPress.com account
= 3.0.3 =
*Release Date - 3rd November, 2014*
* Fix for sending the wrong data to delete_comment action that could have prevented old spam comments from being deleted.
* Added a filter to disable logging of Akismet debugging information.
* Added a filter for the maximum comment age when deleting old spam comments.
* Added a filter for the number per batch when deleting old spam comments.
* Removed the "Check for Spam" button from the Spam folder.
= 3.0.2 =
*Release Date - 18th August, 2014*
* Performance improvements.
* Fixed a bug that could truncate the comment data being sent to Akismet for checking.
= 3.0.1 =
*Release Date - 9th July, 2014*
* Removed dependency on PHP's fsockopen function
* Fix spam/ham reports to work when reported outside of the WP dashboard, e.g., from Notifications or the WP app
* Remove jQuery dependency for comment form JavaScript
* Remove unnecessary data from some Akismet comment meta
* Suspended keys will now result in all comments being put in moderation, not spam.
= 3.0.0 =
*Release Date - 15th April, 2014*
* Move Akismet to Settings menu
* Drop Akismet Stats menu
* Add stats snapshot to Akismet settings
* Add Akismet subscription details and status to Akismet settings
* Add contextual help for each page
* Improve Akismet setup to use Jetpack to automate plugin setup
* Fix "Check for Spam" to use AJAX to avoid page timing out
* Fix Akismet settings page to be responsive
* Drop legacy code
* Tidy up CSS and Javascript
* Replace the old discard setting with a new "discard pervasive spam" feature.
= 2.6.0 =
*Release Date - 18th March, 2014*
* Add ajax paging to the check for spam button to handle large volumes of comments
* Optimize javascript and add localization support
* Fix bug in link to spam comments from right now dashboard widget
* Fix bug with deleting old comments to avoid timeouts dealing with large volumes of comments
* Include X-Pingback-Forwarded-For header in outbound WordPress pingback verifications
* Add pre-check for pingbacks, to stop spam before an outbound verification request is made
= 2.5.9 =
*Release Date - 1st August, 2013*
* Update 'Already have a key' link to redirect page rather than depend on javascript
* Fix some non-translatable strings to be translatable
* Update Activation banner in plugins page to redirect user to Akismet config page
= 2.5.8 =
*Release Date - 20th January, 2013*
* Simplify the activation process for new users
* Remove the reporter_ip parameter
* Minor preventative security improvements
= 2.5.7 =
*Release Date - 13th December, 2012*
* FireFox Stats iframe preview bug
* Fix mshots preview when using https
* Add .htaccess to block direct access to files
* Prevent some PHP notices
* Fix Check For Spam return location when referrer is empty
* Fix Settings links for network admins
* Fix prepare() warnings in WP 3.5
= 2.5.6 =
*Release Date - 26th April, 2012*
* Prevent retry scheduling problems on sites where wp_cron is misbehaving
* Preload mshot previews
* Modernize the widget code
* Fix a bug where comments were not held for moderation during an error condition
* Improve the UX and display when comments are temporarily held due to an error
* Make the Check For Spam button force a retry when comments are held due to an error
* Handle errors caused by an invalid key
* Don't retry comments that are too old
* Improve error messages when verifying an API key
= 2.5.5 =
*Release Date - 11th January, 2012*
* Add nonce check for comment author URL remove action
* Fix the settings link
= 2.5.4 =
*Release Date - 5th January, 2012*
* Limit Akismet CSS and Javascript loading in wp-admin to just the pages that need it
* Added author URL quick removal functionality
* Added mShot preview on Author URL hover
* Added empty index.php to prevent directory listing
* Move wp-admin menu items under Jetpack, if it is installed
* Purge old Akismet comment meta data, default of 15 days
= 2.5.3 =
*Release Date - 8th Febuary, 2011*
* Specify the license is GPL v2 or later
* Fix a bug that could result in orphaned commentmeta entries
* Include hotfix for WordPress 3.0.5 filter issue
= 2.5.2 =
*Release Date - 14th January, 2011*
* Properly format the comment count for author counts
* Look for super admins on multisite installs when looking up user roles
* Increase the HTTP request timeout
* Removed padding for author approved count
* Fix typo in function name
* Set Akismet stats iframe height to fixed 2500px. Better to have one tall scroll bar than two side by side.
= 2.5.1 =
*Release Date - 17th December, 2010*
* Fix a bug that caused the "Auto delete" option to fail to discard comments correctly
* Remove the comment nonce form field from the 'Akismet Configuration' page in favor of using a filter, akismet_comment_nonce
* Fixed padding bug in "author" column of posts screen
* Added margin-top to "cleared by ..." badges on dashboard
* Fix possible error when calling akismet_cron_recheck()
* Fix more PHP warnings
* Clean up XHTML warnings for comment nonce
* Fix for possible condition where scheduled comment re-checks could get stuck
* Clean up the comment meta details after deleting a comment
* Only show the status badge if the comment status has been changed by someone/something other than Akismet
* Show a 'History' link in the row-actions
* Translation fixes
* Reduced font-size on author name
* Moved "flagged by..." notification to top right corner of comment container and removed heavy styling
* Hid "flagged by..." notification while on dashboard
= 2.5.0 =
*Release Date - 7th December, 2010*
* Track comment actions under 'Akismet Status' on the edit comment screen
* Fix a few remaining deprecated function calls ( props Mike Glendinning )
* Use HTTPS for the stats IFRAME when wp-admin is using HTTPS
* Use the WordPress HTTP class if available
* Move the admin UI code to a separate file, only loaded when needed
* Add cron retry feature, to replace the old connectivity check
* Display Akismet status badge beside each comment
* Record history for each comment, and display it on the edit page
* Record the complete comment as originally submitted in comment_meta, to use when reporting spam and ham
* Highlight links in comment content
* New option, "Show the number of comments you've approved beside each comment author."
* New option, "Use a nonce on the comment form."
= 2.4.0 =
*Release Date - 23rd August, 2010*
* Spell out that the license is GPLv2
* Fix PHP warnings
* Fix WordPress deprecated function calls
* Fire the delete_comment action when deleting comments
* Move code specific for older WP versions to legacy.php
* General code clean up
= 2.3.0 =
*Release Date - 5th June, 2010*
* Fix "Are you sure" nonce message on config screen in WPMU
* Fix XHTML compliance issue in sidebar widget
* Change author link; remove some old references to WordPress.com accounts
* Localize the widget title (core ticket #13879)
= 2.2.9 =
*Release Date - 2nd June, 2010*
* Eliminate a potential conflict with some plugins that may cause spurious reports
= 2.2.8 =
*Release Date - 27th May, 2010*
* Fix bug in initial comment check for ipv6 addresses
* Report comments as ham when they are moved from spam to moderation
* Report comments as ham when clicking undo after spam
* Use transition_comment_status action when available instead of older actions for spam/ham submissions
* Better diagnostic messages when PHP network functions are unavailable
* Better handling of comments by logged-in users
= 2.2.7 =
*Release Date - 17th December, 2009*
* Add a new AKISMET_VERSION constant
* Reduce the possibility of over-counting spam when another spam filter plugin is in use
* Disable the connectivity check when the API key is hard-coded for WPMU
= 2.2.6 =
*Release Date - 20th July, 2009*
* Fix a global warning introduced in 2.2.5
* Add changelog and additional readme.txt tags
* Fix an array conversion warning in some versions of PHP
* Support a new WPCOM_API_KEY constant for easier use with WordPress MU
= 2.2.5 =
*Release Date - 13th July, 2009*
* Include a new Server Connectivity diagnostic check, to detect problems caused by firewalls
= 2.2.4 =
*Release Date - 3rd June, 2009*
* Fixed a key problem affecting the stats feature in WordPress MU
* Provide additional blog information in Akismet API calls
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,185 @@
<?php
WP_CLI::add_command( 'akismet', 'Akismet_CLI' );
/**
* Filter spam comments.
*/
class Akismet_CLI extends WP_CLI_Command {
/**
* Checks one or more comments against the Akismet API.
*
* ## OPTIONS
* <comment_id>...
* : The ID(s) of the comment(s) to check.
*
* [--noaction]
* : Don't change the status of the comment. Just report what Akismet thinks it is.
*
* ## EXAMPLES
*
* wp akismet check 12345
*
* @alias comment-check
*/
public function check( $args, $assoc_args ) {
foreach ( $args as $comment_id ) {
if ( isset( $assoc_args['noaction'] ) ) {
// Check the comment, but don't reclassify it.
$api_response = Akismet::check_db_comment( $comment_id, 'wp-cli' );
}
else {
$api_response = Akismet::recheck_comment( $comment_id, 'wp-cli' );
}
if ( 'true' === $api_response ) {
WP_CLI::line( sprintf( __( "Comment #%d is spam.", 'akismet' ), $comment_id ) );
}
else if ( 'false' === $api_response ) {
WP_CLI::line( sprintf( __( "Comment #%d is not spam.", 'akismet' ), $comment_id ) );
}
else {
if ( false === $api_response ) {
WP_CLI::error( __( "Failed to connect to Akismet.", 'akismet' ) );
}
else if ( is_wp_error( $api_response ) ) {
WP_CLI::warning( sprintf( __( "Comment #%d could not be checked.", 'akismet' ), $comment_id ) );
}
}
}
}
/**
* Recheck all comments in the Pending queue.
*
* ## EXAMPLES
*
* wp akismet recheck_queue
*
* @alias recheck-queue
*/
public function recheck_queue() {
$batch_size = 100;
$start = 0;
$total_counts = array();
do {
$result_counts = Akismet_Admin::recheck_queue_portion( $start, $batch_size );
if ( $result_counts['processed'] > 0 ) {
foreach ( $result_counts as $key => $count ) {
if ( ! isset( $total_counts[ $key ] ) ) {
$total_counts[ $key ] = $count;
}
else {
$total_counts[ $key ] += $count;
}
}
$start += $batch_size;
$start -= $result_counts['spam']; // These comments will have been removed from the queue.
}
} while ( $result_counts['processed'] > 0 );
WP_CLI::line( sprintf( _n( "Processed %d comment.", "Processed %d comments.", $total_counts['processed'], 'akismet' ), number_format( $total_counts['processed'] ) ) );
WP_CLI::line( sprintf( _n( "%d comment moved to Spam.", "%d comments moved to Spam.", $total_counts['spam'], 'akismet' ), number_format( $total_counts['spam'] ) ) );
if ( $total_counts['error'] ) {
WP_CLI::line( sprintf( _n( "%d comment could not be checked.", "%d comments could not be checked.", $total_counts['error'], 'akismet' ), number_format( $total_counts['error'] ) ) );
}
}
/**
* Fetches stats from the Akismet API.
*
* ## OPTIONS
*
* [<interval>]
* : The time period for which to retrieve stats.
* ---
* default: all
* options:
* - days
* - months
* - all
* ---
*
* [--format=<format>]
* : Allows overriding the output of the command when listing connections.
* ---
* default: table
* options:
* - table
* - json
* - csv
* - yaml
* - count
* ---
*
* [--summary]
* : When set, will display a summary of the stats.
*
* ## EXAMPLES
*
* wp akismet stats
* wp akismet stats all
* wp akismet stats days
* wp akismet stats months
* wp akismet stats all --summary
*/
public function stats( $args, $assoc_args ) {
$api_key = Akismet::get_api_key();
if ( empty( $api_key ) ) {
WP_CLI::error( __( 'API key must be set to fetch stats.', 'akismet' ) );
}
switch ( $args[0] ) {
case 'days':
$interval = '60-days';
break;
case 'months':
$interval = '6-months';
break;
default:
$interval = 'all';
break;
}
$response = Akismet::http_post(
Akismet::build_query( array(
'blog' => get_option( 'home' ),
'key' => $api_key,
'from' => $interval,
) ),
'get-stats'
);
if ( empty( $response[1] ) ) {
WP_CLI::error( __( 'Currently unable to fetch stats. Please try again.', 'akismet' ) );
}
$response_body = json_decode( $response[1], true );
if ( is_null( $response_body ) ) {
WP_CLI::error( __( 'Stats response could not be decoded.', 'akismet' ) );
}
if ( isset( $assoc_args['summary'] ) ) {
$keys = array(
'spam',
'ham',
'missed_spam',
'false_positives',
'accuracy',
'time_saved',
);
WP_CLI\Utils\format_items( $assoc_args['format'], array( $response_body ), $keys );
}
else {
$stats = $response_body['breakdown'];
WP_CLI\Utils\format_items( $assoc_args['format'], $stats, array_keys( end( $stats ) ) );
}
}
}
@@ -0,0 +1,366 @@
<?php
class Akismet_REST_API {
/**
* Register the REST API routes.
*/
public static function init() {
if ( ! function_exists( 'register_rest_route' ) ) {
// The REST API wasn't integrated into core until 4.4, and we support 4.0+ (for now).
return false;
}
register_rest_route( 'akismet/v1', '/key', array(
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_key' ),
), array(
'methods' => WP_REST_Server::EDITABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'set_key' ),
'args' => array(
'key' => array(
'required' => true,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
),
),
), array(
'methods' => WP_REST_Server::DELETABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'delete_key' ),
)
) );
register_rest_route( 'akismet/v1', '/settings/', array(
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_settings' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'set_boolean_settings' ),
'args' => array(
'akismet_strictness' => array(
'required' => false,
'type' => 'boolean',
'description' => __( 'If true, Akismet will automatically discard the worst spam automatically rather than putting it in the spam folder.', 'akismet' ),
),
'akismet_show_user_comments_approved' => array(
'required' => false,
'type' => 'boolean',
'description' => __( 'If true, show the number of approved comments beside each comment author in the comments list page.', 'akismet' ),
),
),
)
) );
register_rest_route( 'akismet/v1', '/stats', array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
'args' => array(
'interval' => array(
'required' => false,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_interval' ),
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
'default' => 'all',
),
),
) );
register_rest_route( 'akismet/v1', '/stats/(?P<interval>[\w+])', array(
'args' => array(
'interval' => array(
'description' => __( 'The time period for which to retrieve stats. Options: 60-days, 6-months, all', 'akismet' ),
'type' => 'string',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'privileged_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_stats' ),
)
) );
register_rest_route( 'akismet/v1', '/alert', array(
array(
'methods' => WP_REST_Server::READABLE,
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'get_alert' ),
'args' => array(
'key' => array(
'required' => false,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
),
),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'set_alert' ),
'args' => array(
'key' => array(
'required' => false,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
),
),
),
array(
'methods' => WP_REST_Server::DELETABLE,
'permission_callback' => array( 'Akismet_REST_API', 'remote_call_permission_callback' ),
'callback' => array( 'Akismet_REST_API', 'delete_alert' ),
'args' => array(
'key' => array(
'required' => false,
'type' => 'string',
'sanitize_callback' => array( 'Akismet_REST_API', 'sanitize_key' ),
'description' => __( 'A 12-character Akismet API key. Available at akismet.com/get/', 'akismet' ),
),
),
)
) );
}
/**
* Get the current Akismet API key.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_key( $request = null ) {
return rest_ensure_response( Akismet::get_api_key() );
}
/**
* Set the API key, if possible.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function set_key( $request ) {
if ( defined( 'WPCOM_API_KEY' ) ) {
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be changed via the API.', 'akismet' ), array( 'status'=> 409 ) ) );
}
$new_api_key = $request->get_param( 'key' );
if ( ! self::key_is_valid( $new_api_key ) ) {
return rest_ensure_response( new WP_Error( 'invalid_key', __( 'The value provided is not a valid and registered API key.', 'akismet' ), array( 'status' => 400 ) ) );
}
update_option( 'wordpress_api_key', $new_api_key );
return self::get_key();
}
/**
* Unset the API key, if possible.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function delete_key( $request ) {
if ( defined( 'WPCOM_API_KEY' ) ) {
return rest_ensure_response( new WP_Error( 'hardcoded_key', __( 'This site\'s API key is hardcoded and cannot be deleted.', 'akismet' ), array( 'status'=> 409 ) ) );
}
delete_option( 'wordpress_api_key' );
return rest_ensure_response( true );
}
/**
* Get the Akismet settings.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_settings( $request = null ) {
return rest_ensure_response( array(
'akismet_strictness' => ( get_option( 'akismet_strictness', '1' ) === '1' ),
'akismet_show_user_comments_approved' => ( get_option( 'akismet_show_user_comments_approved', '1' ) === '1' ),
) );
}
/**
* Update the Akismet settings.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function set_boolean_settings( $request ) {
foreach ( array(
'akismet_strictness',
'akismet_show_user_comments_approved',
) as $setting_key ) {
$setting_value = $request->get_param( $setting_key );
if ( is_null( $setting_value ) ) {
// This setting was not specified.
continue;
}
// From 4.7+, WP core will ensure that these are always boolean
// values because they are registered with 'type' => 'boolean',
// but we need to do this ourselves for prior versions.
$setting_value = Akismet_REST_API::parse_boolean( $setting_value );
update_option( $setting_key, $setting_value ? '1' : '0' );
}
return self::get_settings();
}
/**
* Parse a numeric or string boolean value into a boolean.
*
* @param mixed $value The value to convert into a boolean.
* @return bool The converted value.
*/
public static function parse_boolean( $value ) {
switch ( $value ) {
case true:
case 'true':
case '1':
case 1:
return true;
case false:
case 'false':
case '0':
case 0:
return false;
default:
return (bool) $value;
}
}
/**
* Get the Akismet stats for a given time period.
*
* Possible `interval` values:
* - all
* - 60-days
* - 6-months
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_stats( $request ) {
$api_key = Akismet::get_api_key();
$interval = $request->get_param( 'interval' );
$stat_totals = array();
$response = Akismet::http_post( Akismet::build_query( array( 'blog' => get_option( 'home' ), 'key' => $api_key, 'from' => $interval ) ), 'get-stats' );
if ( ! empty( $response[1] ) ) {
$stat_totals[$interval] = json_decode( $response[1] );
}
return rest_ensure_response( $stat_totals );
}
/**
* Get the current alert code and message. Alert codes are used to notify the site owner
* if there's a problem, like a connection issue between their site and the Akismet API,
* invalid requests being sent, etc.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function get_alert( $request ) {
return rest_ensure_response( array(
'code' => get_option( 'akismet_alert_code' ),
'message' => get_option( 'akismet_alert_msg' ),
) );
}
/**
* Update the current alert code and message by triggering a call to the Akismet server.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function set_alert( $request ) {
delete_option( 'akismet_alert_code' );
delete_option( 'akismet_alert_msg' );
// Make a request so the most recent alert code and message are retrieved.
Akismet::verify_key( Akismet::get_api_key() );
return self::get_alert( $request );
}
/**
* Clear the current alert code and message.
*
* @param WP_REST_Request $request
* @return WP_Error|WP_REST_Response
*/
public static function delete_alert( $request ) {
delete_option( 'akismet_alert_code' );
delete_option( 'akismet_alert_msg' );
return self::get_alert( $request );
}
private static function key_is_valid( $key ) {
$response = Akismet::http_post(
Akismet::build_query(
array(
'key' => $key,
'blog' => get_option( 'home' )
)
),
'verify-key'
);
if ( $response[1] == 'valid' ) {
return true;
}
return false;
}
public static function privileged_permission_callback() {
return current_user_can( 'manage_options' );
}
/**
* For calls that Akismet.com makes to the site to clear outdated alert codes, use the API key for authorization.
*/
public static function remote_call_permission_callback( $request ) {
$local_key = Akismet::get_api_key();
return $local_key && ( strtolower( $request->get_param( 'key' ) ) === strtolower( $local_key ) );
}
public static function sanitize_interval( $interval, $request, $param ) {
$interval = trim( $interval );
$valid_intervals = array( '60-days', '6-months', 'all', );
if ( ! in_array( $interval, $valid_intervals ) ) {
$interval = 'all';
}
return $interval;
}
public static function sanitize_key( $key, $request, $param ) {
return trim( $key );
}
}
@@ -0,0 +1,136 @@
<?php
/**
* @package Akismet
*/
class Akismet_Widget extends WP_Widget {
function __construct() {
load_plugin_textdomain( 'akismet' );
parent::__construct(
'akismet_widget',
__( 'Akismet Widget' , 'akismet'),
array( 'description' => __( 'Display the number of spam comments Akismet has caught' , 'akismet') )
);
if ( is_active_widget( false, false, $this->id_base ) ) {
add_action( 'wp_head', array( $this, 'css' ) );
}
}
function css() {
?>
<style type="text/css">
.a-stats {
width: auto;
}
.a-stats a {
background: #7CA821;
background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821);
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14));
border: 1px solid #5F8E14;
border-radius:3px;
color: #CFEA93;
cursor: pointer;
display: block;
font-weight: normal;
height: 100%;
-moz-border-radius:3px;
padding: 7px 0 8px;
text-align: center;
text-decoration: none;
-webkit-border-radius:3px;
width: 100%;
}
.a-stats a:hover {
text-decoration: none;
background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417);
background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B));
}
.a-stats .count {
color: #FFF;
display: block;
font-size: 15px;
line-height: 16px;
padding: 0 13px;
white-space: nowrap;
}
</style>
<?php
}
function form( $instance ) {
if ( $instance && isset( $instance['title'] ) ) {
$title = $instance['title'];
}
else {
$title = __( 'Spam Blocked' , 'akismet' );
}
?>
<p>
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'akismet'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
</p>
<?php
}
function update( $new_instance, $old_instance ) {
$instance['title'] = strip_tags( $new_instance['title'] );
return $instance;
}
function widget( $args, $instance ) {
$count = get_option( 'akismet_spam_count' );
if ( ! isset( $instance['title'] ) ) {
$instance['title'] = __( 'Spam Blocked' , 'akismet' );
}
echo $args['before_widget'];
if ( ! empty( $instance['title'] ) ) {
echo $args['before_title'];
echo esc_html( $instance['title'] );
echo $args['after_title'];
}
?>
<div class="a-stats">
<a href="https://akismet.com" target="_blank" rel="noopener" title="">
<?php
echo wp_kses(
sprintf(
/* translators: The placeholder is the number of pieces of spam blocked by Akismet. */
_n(
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
'<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>',
$count,
'akismet'
),
number_format_i18n( $count )
),
array(
'strong' => array(
'class' => true,
),
)
);
?>
</a>
</div>
<?php
echo $args['after_widget'];
}
}
function akismet_register_widgets() {
register_widget( 'Akismet_Widget' );
}
add_action( 'widgets_init', 'akismet_register_widgets' );
File diff suppressed because it is too large Load Diff
+2
View File
@@ -0,0 +1,2 @@
<?php
# Silence is golden.
+87
View File
@@ -0,0 +1,87 @@
=== Akismet Spam Protection ===
Contributors: matt, ryan, andy, mdawaffe, tellyworth, josephscott, lessbloat, eoigal, cfinke, automattic, jgs, procifer, stephdau, kbrownkd
Tags: comments, spam, antispam, anti-spam, contact form, anti spam, comment moderation, comment spam, contact form spam, spam comments
Requires at least: 5.0
Tested up to: 6.1
Stable tag: 5.0.1
License: GPLv2 or later
The best anti-spam protection to block spam comments and spam in a contact form. The most trusted antispam solution for WordPress and WooCommerce.
== Description ==
Akismet checks your comments and contact form submissions against our global database of spam to prevent your site from publishing malicious content. You can review the comment spam it catches on your blog's "Comments" admin screen.
Major features in Akismet include:
* Automatically checks all comments and filters out the ones that look like spam.
* Each comment has a status history, so you can easily see which comments were caught or cleared by Akismet and which were spammed or unspammed by a moderator.
* URLs are shown in the comment body to reveal hidden or misleading links.
* Moderators can see the number of approved comments for each user.
* A discard feature that outright blocks the worst spam, saving you disk space and speeding up your site.
PS: You'll be prompted to get an Akismet.com API key to use it, once activated. Keys are free for personal blogs; paid subscriptions are available for businesses and commercial sites.
== Installation ==
Upload the Akismet plugin to your blog, activate it, and then enter your Akismet.com API key.
1, 2, 3: You're done!
== Changelog ==
= 5.0.1 =
*Release Date - 28 September 2022*
* Added an empty state for the Statistics section on the admin page.
* Fixed a bug that broke some admin page links when Jetpack plugins are active.
* Marked some event listeners as passive to improve performance in newer browsers.
* Disabled interaction observation on forms that post to other domains.
= 5.0 =
*Release Date - 26 July 2022*
* Added a new feature to catch spammers by observing how they interact with the page.
= 4.2.5 =
*Release Date - 11 July 2022*
* Fixed a bug that added unnecessary comment history entries after comment rechecks.
* Added a notice that displays when WP-Cron is disabled and might be affecting comment rechecks.
= 4.2.4 =
*Release Date - 20 May 2022*
* Improved translator instructions for comment history.
* Bumped the "Tested up to" tag to WP 6.0.
= 4.2.3 =
*Release Date - 25 April 2022*
* Improved compatibility with Fluent Forms
* Fixed missing translation domains
* Updated stats URL.
* Improved accessibility of elements on the config page.
= 4.2.2 =
*Release Date - 24 January 2022*
* Improved compatibility with Formidable Forms
* Fixed a bug that could cause issues when multiple contact forms appear on one page.
* Updated delete_comment and deleted_comment actions to pass two arguments to match WordPress core since 4.9.0.
* Added a filter that allows comment types to be excluded when counting users' approved comments.
= 4.2.1 =
*Release Date - 1 October 2021*
* Fixed a bug causing AMP validation to fail on certain pages with forms.
= 4.2 =
*Release Date - 30 September 2021*
* Added links to additional information on API usage notifications.
* Reduced the number of network requests required for a comment page when running Akismet.
* Improved compatibility with the most popular contact form plugins.
* Improved API usage buttons for clarity on what upgrade is needed.
For older changelog entries, please see the [additional changelog.txt file](https://plugins.svn.wordpress.org/akismet/trunk/changelog.txt) delivered with the plugin.
@@ -0,0 +1,8 @@
<div class="akismet-box">
<?php Akismet::view( 'title' ); ?>
<?php Akismet::view( 'setup' );?>
</div>
<br/>
<div class="akismet-box">
<?php Akismet::view( 'enter' );?>
</div>
+259
View File
@@ -0,0 +1,259 @@
<?php
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
?>
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<div class="akismet-lower">
<?php if ( Akismet::get_api_key() ) { ?>
<?php Akismet_Admin::display_status(); ?>
<?php } ?>
<?php if ( ! empty( $notices ) ) { ?>
<?php foreach ( $notices as $notice ) { ?>
<?php Akismet::view( 'notice', $notice ); ?>
<?php } ?>
<?php } ?>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Statistics', 'akismet' ); ?></span>
</div>
<?php if ( $stat_totals && isset( $stat_totals['all'] ) && (int) $stat_totals['all']->spam > 0 ) : ?>
<div class="akismet-section-header__actions">
<a href="<?php echo esc_url( Akismet_Admin::get_page_url( 'stats' ) ); ?>">
<?php esc_html_e( 'Detailed Stats', 'akismet' ); ?>
</a>
</div>
</div> <!-- close akismet-section-header -->
<div class="akismet-new-snapshot">
<iframe allowtransparency="true" scrolling="no" frameborder="0" style="width: 100%; height: 220px; overflow: hidden;" src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/snapshot.php?blog=%s&api_key=%s&height=200&locale=%s', urlencode( get_option( 'home' ) ), Akismet::get_api_key(), get_locale() ) ); ?>"></iframe>
<ul>
<li>
<h3><?php esc_html_e( 'Past six months' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['6-months']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['6-months']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'All time' , 'akismet');?></h3>
<span><?php echo number_format( $stat_totals['all']->spam );?></span>
<?php echo esc_html( _n( 'Spam blocked', 'Spam blocked', $stat_totals['all']->spam, 'akismet' ) ); ?>
</li>
<li>
<h3><?php esc_html_e( 'Accuracy' , 'akismet');?></h3>
<span><?php echo floatval( $stat_totals['all']->accuracy ); ?>%</span>
<?php printf( _n( '%s missed spam', '%s missed spam', $stat_totals['all']->missed_spam, 'akismet' ), number_format( $stat_totals['all']->missed_spam ) ); ?>
|
<?php printf( _n( '%s false positive', '%s false positives', $stat_totals['all']->false_positives, 'akismet' ), number_format( $stat_totals['all']->false_positives ) ); ?>
</li>
</ul>
</div> <!-- close akismet-new-snapshot -->
<?php else : ?>
</div> <!-- close akismet-section-header -->
<div class="inside">
<p>Akismet is active and ready to stop spam. Your site's spam statistics will be displayed here.</p>
</div>
<?php endif; ?>
</div> <!-- close akismet-card -->
<?php if ( $akismet_user ) : ?>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Settings' , 'akismet'); ?></span>
</div>
</div>
<div class="inside">
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<table cellspacing="0" class="akismet-settings">
<tbody>
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<tr>
<th class="akismet-api-key" width="10%" align="left" scope="row">
<label for="key"><?php esc_html_e( 'API Key', 'akismet' ); ?></label>
</th>
<td width="5%"/>
<td align="left">
<span class="api-key"><input id="key" name="key" type="text" size="15" value="<?php echo esc_attr( get_option('wordpress_api_key') ); ?>" class="<?php echo esc_attr( 'regular-text code ' . $akismet_user->status ); ?>"></span>
</td>
</tr>
<?php } ?>
<?php if ( isset( $_GET['ssl_status'] ) ) { ?>
<tr>
<th align="left" scope="row"><?php esc_html_e( 'SSL Status', 'akismet' ); ?></th>
<td></td>
<td align="left">
<p>
<?php
if ( ! wp_http_supports( array( 'ssl' ) ) ) {
?><b><?php esc_html_e( 'Disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Your Web server cannot make SSL requests; contact your Web host and ask them to add support for SSL requests.', 'akismet' ); ?><?php
}
else {
$ssl_disabled = get_option( 'akismet_ssl_disabled' );
if ( $ssl_disabled ) {
?><b><?php esc_html_e( 'Temporarily disabled.', 'akismet' ); ?></b> <?php esc_html_e( 'Akismet encountered a problem with a previous SSL request and disabled it temporarily. It will begin using SSL for requests again shortly.', 'akismet' ); ?><?php
}
else {
?><b><?php esc_html_e( 'Enabled.', 'akismet' ); ?></b> <?php esc_html_e( 'All systems functional.', 'akismet' ); ?><?php
}
}
?>
</p>
</td>
</tr>
<?php } ?>
<tr>
<th align="left" scope="row"><?php esc_html_e('Comments', 'akismet');?></th>
<td></td>
<td align="left">
<p>
<label for="akismet_show_user_comments_approved" title="<?php esc_attr_e( 'Show approved comments' , 'akismet'); ?>">
<input
name="akismet_show_user_comments_approved"
id="akismet_show_user_comments_approved"
value="1"
type="checkbox"
<?php
// If the option isn't set, or if it's enabled ('1'), or if it was enabled a long time ago ('true'), check the checkbox.
checked( true, ( in_array( get_option( 'akismet_show_user_comments_approved' ), array( false, '1', 'true' ), true ) ) );
?>
/>
<?php esc_html_e( 'Show the number of approved comments beside each comment author', 'akismet' ); ?>
</label>
</p>
</td>
</tr>
<tr>
<th class="strictness" align="left" scope="row"><?php esc_html_e('Strictness', 'akismet'); ?></th>
<td></td>
<td align="left">
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet anti-spam strictness', 'akismet'); ?></span></legend>
<p><label for="akismet_strictness_1"><input type="radio" name="akismet_strictness" id="akismet_strictness_1" value="1" <?php checked('1', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Silently discard the worst and most pervasive spam so I never see it.', 'akismet'); ?></label></p>
<p><label for="akismet_strictness_0"><input type="radio" name="akismet_strictness" id="akismet_strictness_0" value="0" <?php checked('0', get_option('akismet_strictness')); ?> /> <?php esc_html_e('Always put spam in the Spam folder for review.', 'akismet'); ?></label></p>
</fieldset>
<span class="akismet-note"><strong><?php esc_html_e('Note:', 'akismet');?></strong>
<?php
$delete_interval = max( 1, intval( apply_filters( 'akismet_delete_comment_interval', 15 ) ) );
printf(
_n(
'Spam in the <a href="%1$s">spam folder</a> older than 1 day is deleted automatically.',
'Spam in the <a href="%1$s">spam folder</a> older than %2$d days is deleted automatically.',
$delete_interval,
'akismet'
),
admin_url( 'edit-comments.php?comment_status=spam' ),
$delete_interval
);
?>
</td>
</tr>
<tr>
<th class="comment-form-privacy-notice" align="left" scope="row"><?php esc_html_e('Privacy', 'akismet'); ?></th>
<td></td>
<td align="left">
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e('Akismet privacy notice', 'akismet'); ?></span></legend>
<p><label for="akismet_comment_form_privacy_notice_display"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_display" value="display" <?php checked('display', get_option('akismet_comment_form_privacy_notice')); ?> /> <?php esc_html_e('Display a privacy notice under your comment forms.', 'akismet'); ?></label></p>
<p><label for="akismet_comment_form_privacy_notice_hide"><input type="radio" name="akismet_comment_form_privacy_notice" id="akismet_comment_form_privacy_notice_hide" value="hide" <?php echo in_array( get_option('akismet_comment_form_privacy_notice'), array('display', 'hide') ) ? checked('hide', get_option('akismet_comment_form_privacy_notice'), false) : 'checked="checked"'; ?> /> <?php esc_html_e('Do not display privacy notice.', 'akismet'); ?></label></p>
</fieldset>
<span class="akismet-note"><?php esc_html_e( 'To help your site with transparency under privacy laws like the GDPR, Akismet can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on above.', 'akismet' );?></span>
</td>
</tr>
</tbody>
</table>
<div class="akismet-card-actions">
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<div id="delete-action">
<a class="submitdelete deletion" href="<?php echo esc_url( Akismet_Admin::get_page_url( 'delete_key' ) ); ?>"><?php esc_html_e('Disconnect this account', 'akismet'); ?></a>
</div>
<?php } ?>
<?php wp_nonce_field(Akismet_Admin::NONCE) ?>
<div id="publishing-action">
<input type="hidden" name="action" value="enter-key">
<input type="submit" name="submit" id="submit" class="akismet-button akismet-could-be-primary" value="<?php esc_attr_e('Save Changes', 'akismet');?>">
</div>
<div class="clear"></div>
</div>
</form>
</div>
</div>
<?php if ( ! Akismet::predefined_api_key() ) { ?>
<div class="akismet-card">
<div class="akismet-section-header">
<div class="akismet-section-header__label">
<span><?php esc_html_e( 'Account' , 'akismet'); ?></span>
</div>
</div>
<div class="inside">
<table cellspacing="0" border="0" class="akismet-settings">
<tbody>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Subscription Type' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php echo esc_html( $akismet_user->account_name ); ?></p>
</td>
</tr>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Status' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php
if ( 'cancelled' == $akismet_user->status ) :
esc_html_e( 'Cancelled', 'akismet' );
elseif ( 'suspended' == $akismet_user->status ) :
esc_html_e( 'Suspended', 'akismet' );
elseif ( 'missing' == $akismet_user->status ) :
esc_html_e( 'Missing', 'akismet' );
elseif ( 'no-sub' == $akismet_user->status ) :
esc_html_e( 'No Subscription Found', 'akismet' );
else :
esc_html_e( 'Active', 'akismet' );
endif; ?></p>
</td>
</tr>
<?php if ( $akismet_user->next_billing_date ) : ?>
<tr>
<th scope="row" align="left"><?php esc_html_e( 'Next Billing Date' , 'akismet');?></th>
<td width="5%"/>
<td align="left">
<p><?php echo date( 'F j, Y', $akismet_user->next_billing_date ); ?></p>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="akismet-card-actions">
<div id="publishing-action">
<?php Akismet::view( 'get', array( 'text' => ( $akismet_user->account_type == 'free-api-key' && $akismet_user->status == 'active' ? __( 'Upgrade' , 'akismet') : __( 'Change' , 'akismet') ), 'redirect' => 'upgrade' ) ); ?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<?php } ?>
<?php endif;?>
</div>
</div>
@@ -0,0 +1,72 @@
<?php
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
?>
<div class="akismet-box">
<?php Akismet::view( 'title' ); ?>
<div class="akismet-jp-connect">
<h3><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></h3><?php
if ( in_array( $akismet_user->status, array( 'no-sub', 'missing' ) ) ) {?>
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="auto-connect" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="plugin-signup"/>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
</form>
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
<p><?php
/* translators: %s is the WordPress.com username */
echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
<?php } elseif ( $akismet_user->status == 'cancelled' ) { ?>
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
<form name="akismet_activate" id="akismet_activate" action="https://akismet.com/get/" method="post" class="akismet-right" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="user_id" value="<?php echo esc_attr( $akismet_user->ID ); ?>"/>
<input type="hidden" name="redirect" value="upgrade"/>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
</form>
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
<p><?php
/* translators: %s is the WordPress.com email address */
echo esc_html( sprintf( __( 'Your subscription for %s is cancelled.' , 'akismet' ), $akismet_user->user_email ) ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
<?php } elseif ( $akismet_user->status == 'suspended' ) { ?>
<div class="akismet-right">
<p><a href="https://akismet.com/contact" class="akismet-button akismet-is-primary"><?php esc_html_e( 'Contact Akismet support' , 'akismet' ); ?></a></p>
</div>
<p>
<span class="akismet-alert-text"><?php
/* translators: %s is the WordPress.com email address */
echo esc_html( sprintf( __( 'Your subscription for %s is suspended.' , 'akismet' ), $akismet_user->user_email ) ); ?></span>
<?php esc_html_e( 'No worries! Get in touch and we&#8217;ll sort this out.', 'akismet' ); ?>
</p>
<?php } else { // ask do they want to use akismet account found using jetpack wpcom connection ?>
<p><?php esc_html_e( 'Use your Jetpack connection to set up Akismet.', 'akismet' ); ?></p>
<form name="akismet_use_wpcom_key" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post" id="akismet-activate" class="akismet-right">
<input type="hidden" name="key" value="<?php echo esc_attr( $akismet_user->api_key );?>"/>
<input type="hidden" name="action" value="enter-key">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="submit" class="akismet-button akismet-is-primary" value="<?php esc_attr_e( 'Connect with Jetpack' , 'akismet' ); ?>"/>
</form>
<?php echo get_avatar( $akismet_user->user_email, null, null, null, array( 'class' => 'akismet-jetpack-gravatar' ) ); ?>
<p><?php
/* translators: %s is the WordPress.com username */
echo sprintf( esc_html( __( 'You are connected as %s.', 'akismet' ) ), '<b>' . esc_html( $akismet_user->user_login ) . '</b>' ); ?><br /><span class="akismet-jetpack-email"><?php echo esc_html( $akismet_user->user_email ); ?></span></p>
<?php } ?>
</div>
<div class="akismet-ak-connect">
<?php Akismet::view( 'setup' );?>
</div>
<div class="centered akismet-toggles">
<a href="#" class="toggle-jp-connect"><?php esc_html_e( 'Connect with Jetpack', 'akismet' ); ?></a>
<a href="#" class="toggle-ak-connect"><?php esc_html_e( 'Set up a different account', 'akismet' ); ?></a>
</div>
</div>
<br/>
<div class="akismet-box">
<?php Akismet::view( 'enter' );?>
</div>
@@ -0,0 +1,13 @@
<div class="akismet-enter-api-key-box centered">
<a href="#"><?php esc_html_e( 'Manually enter an API key', 'akismet' ); ?></a>
<div class="enter-api-key">
<form action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="post">
<?php wp_nonce_field( Akismet_Admin::NONCE ) ?>
<input type="hidden" name="action" value="enter-key">
<p style="width: 100%; display: flex; flex-wrap: nowrap; box-sizing: border-box;">
<input id="key" name="key" type="text" size="15" value="" placeholder="<?php esc_attr_e( 'Enter your API key' , 'akismet' ); ?>" class="regular-text code" style="flex-grow: 1; margin-right: 1rem;">
<input type="submit" name="submit" id="submit" class="akismet-button" value="<?php esc_attr_e( 'Connect with API key', 'akismet' );?>">
</p>
</form>
</div>
</div>
+12
View File
@@ -0,0 +1,12 @@
<?php
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
?>
<form name="akismet_activate" action="https://akismet.com/get/" method="POST" target="_blank">
<input type="hidden" name="passback_url" value="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>"/>
<input type="hidden" name="blog" value="<?php echo esc_url( get_option( 'home' ) ); ?>"/>
<input type="hidden" name="redirect" value="<?php echo isset( $redirect ) ? $redirect : 'plugin-signup'; ?>"/>
<button type="submit" class="<?php echo isset( $classes ) && count( $classes ) > 0 ? esc_attr( implode( ' ', $classes ) ) : 'akismet-button'; ?>" value="<?php echo esc_attr( $text ); ?>"><?php echo esc_attr( $text ) . '<span class="screen-reader-text">' . esc_html__( '(opens in a new tab)', 'akismet' ) . '</span>'; ?></button>
</form>
+291
View File
@@ -0,0 +1,291 @@
<?php
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
?>
<?php if ( $type == 'plugin' ) : ?>
<div class="updated" id="akismet_setup_prompt">
<form name="akismet_activate" action="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" method="POST">
<div class="akismet_activate">
<div class="aa_a">A</div>
<div class="aa_button_container">
<div class="aa_button_border">
<input type="submit" class="aa_button" value="<?php esc_attr_e( 'Set up your Akismet account', 'akismet' ); ?>" />
</div>
</div>
<div class="aa_description"><?php _e('<strong>Almost done</strong> - configure Akismet and say goodbye to spam', 'akismet');?></div>
</div>
</form>
</div>
<?php elseif ( $type == 'spam-check' ) : ?>
<div class="notice notice-warning">
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' );?></strong></p>
<p><?php esc_html_e( 'Some comments have not yet been checked for spam by Akismet. They have been temporarily held for moderation and will automatically be rechecked later.', 'akismet' ); ?></p>
<?php if ( $link_text ) { ?>
<p><?php echo $link_text; ?></p>
<?php } ?>
</div>
<?php elseif ( $type == 'spam-check-cron-disabled' ) : ?>
<div class="notice notice-warning">
<p><strong><?php esc_html_e( 'Akismet has detected a problem.', 'akismet' ); ?></strong></p>
<p><?php esc_html_e( 'WP-Cron has been disabled using the DISABLE_WP_CRON constant. Comment rechecks may not work properly.', 'akismet' ); ?></p>
</div>
<?php elseif ( $type == 'alert' ) : ?>
<div class='error'>
<p><strong><?php printf( esc_html__( 'Akismet Error Code: %s', 'akismet' ), $code ); ?></strong></p>
<p><?php echo esc_html( $msg ); ?></p>
<p><?php
/* translators: the placeholder is a clickable URL that leads to more information regarding an error code. */
printf( esc_html__( 'For more information: %s' , 'akismet'), '<a href="https://akismet.com/errors/' . $code . '">https://akismet.com/errors/' . $code . '</a>' );
?>
</p>
</div>
<?php elseif ( $type == 'notice' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php echo $notice_header; ?></h3>
<p class="akismet-description">
<?php echo $notice_text; ?>
</p>
</div>
<?php elseif ( $type == 'missing-functions' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e('Network functions are disabled.', 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Your web host or server administrator has disabled PHP&#8217;s <code>gethostbynamel</code> function. <strong>Akismet cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator and give them <a href="%s" target="_blank">this information about Akismet&#8217;s system requirements</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'servers-be-down' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e("Your site can&#8217;t connect to the Akismet servers.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Your firewall may be blocking Akismet from connecting to its API. Please contact your host and refer to <a href="%s" target="_blank">our guide about firewalls</a>.', 'akismet'), 'https://blog.akismet.com/akismet-hosting-faq/'); ?></p>
</div>
<?php elseif ( $type == 'active-dunning' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e("Please update your payment information.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('We cannot process your payment. Please <a href="%s" target="_blank">update your payment details</a>.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'cancelled' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e("Your Akismet plan has been cancelled.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please visit your <a href="%s" target="_blank">Akismet account page</a> to reactivate your subscription.', 'akismet'), 'https://akismet.com/account/'); ?></p>
</div>
<?php elseif ( $type == 'suspended' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e("Your Akismet subscription is suspended.", 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'active-notice' && $time_saved ) : ?>
<div class="akismet-alert akismet-active">
<h3 class="akismet-key-status"><?php echo esc_html( $time_saved ); ?></h3>
<p class="akismet-description"><?php printf( __('You can help us fight spam and upgrade your account by <a href="%s" target="_blank">contributing a token amount</a>.', 'akismet'), 'https://akismet.com/account/upgrade/'); ?></p>
</div>
<?php elseif ( $type == 'missing' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e( 'There is a problem with your API key.', 'akismet'); ?></h3>
<p class="akismet-description"><?php printf( __('Please contact <a href="%s" target="_blank">Akismet support</a> for assistance.', 'akismet'), 'https://akismet.com/contact/'); ?></p>
</div>
<?php elseif ( $type == 'no-sub' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You don&#8217;t have an Akismet plan.', 'akismet'); ?></h3>
<p class="akismet-description">
<?php printf( __( 'In 2012, Akismet began using subscription plans for all accounts (even free ones). A plan has not been assigned to your account, and we&#8217;d appreciate it if you&#8217;d <a href="%s" target="_blank">sign into your account</a> and choose one.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/' ); ?>
</p>
</div>
<?php elseif ( $type == 'new-key-valid' ) :
global $wpdb;
$check_pending_link = false;
$at_least_one_comment_in_moderation = !! $wpdb->get_var( "SELECT comment_ID FROM {$wpdb->comments} WHERE comment_approved = '0' LIMIT 1" );
if ( $at_least_one_comment_in_moderation) {
$check_pending_link = 'edit-comments.php?akismet_recheck=' . wp_create_nonce( 'akismet_recheck' );
}
?>
<div class="akismet-alert akismet-active">
<h3 class="akismet-key-status"><?php esc_html_e( 'Akismet is now protecting your site from spam. Happy blogging!', 'akismet' ); ?></h3>
<?php if ( $check_pending_link ) { ?>
<p class="akismet-description"><?php printf( __( 'Would you like to <a href="%s">check pending comments</a>?', 'akismet' ), esc_url( $check_pending_link ) ); ?></p>
<?php } ?>
</div>
<?php elseif ( $type == 'new-key-invalid' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e( 'The key you entered is invalid. Please double-check it.' , 'akismet'); ?></h3>
</div>
<?php elseif ( $type == 'existing-key-invalid' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php echo esc_html( __( 'Your API key is no longer valid.', 'akismet' ) ); ?></h3>
<p class="akismet-description">
<?php
echo wp_kses(
sprintf(
/* translators: The placeholder is a URL. */
__( 'Please enter a new key or <a href="%s" target="_blank">contact Akismet support</a>.', 'akismet' ),
'https://akismet.com/contact/'
),
array(
'a' => array(
'href' => true,
'target' => true,
),
)
);
?>
</p>
</div>
<?php elseif ( $type == 'new-key-failed' ) : ?>
<div class="akismet-alert akismet-critical">
<h3 class="akismet-key-status"><?php esc_html_e( 'The API key you entered could not be verified.' , 'akismet'); ?></h3>
<p class="akismet-description">
<?php
echo wp_kses(
sprintf(
/* translators: The placeholder is a URL. */
__( 'The connection to akismet.com could not be established. Please refer to <a href="%s" target="_blank">our guide about firewalls</a> and check your server configuration.', 'akismet' ),
'https://blog.akismet.com/akismet-hosting-faq/'
),
array(
'a' => array(
'href' => true,
'target' => true,
),
)
);
?>
</p>
</div>
<?php elseif ( $type == 'limit-reached' && in_array( $level, array( 'yellow', 'red' ) ) ) : ?>
<div class="akismet-alert akismet-critical">
<?php if ( $level == 'yellow' ): ?>
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You&#8217;re using your Akismet key on more sites than your Plus subscription allows.', 'akismet' ); ?></h3>
<p class="akismet-description">
<?php
echo wp_kses(
sprintf(
/* translators: The placeholder is a URL. */
__( 'Your Plus subscription allows the use of Akismet on only one site. Please <a href="%s" target="_blank">purchase additional Plus subscriptions</a> or upgrade to an Enterprise subscription that allows the use of Akismet on unlimited sites.', 'akismet' ),
'https://docs.akismet.com/billing/add-more-sites/'
),
array(
'a' => array(
'href' => true,
'target' => true,
),
)
);
?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
</p>
<?php elseif ( $level == 'red' ): ?>
<h3 class="akismet-key-status failed"><?php esc_html_e( 'You&#8217;re using Akismet on far too many sites for your Plus subscription.', 'akismet' ); ?></h3>
<p class="akismet-description">
<?php printf( __( 'To continue your service, <a href="%s" target="_blank">upgrade to an Enterprise subscription</a>, which covers an unlimited number of sites.', 'akismet'), 'https://akismet.com/account/upgrade/' ); ?>
<br /><br />
<?php printf( __( 'Please <a href="%s" target="_blank">contact our support team</a> with any questions.', 'akismet' ), 'https://akismet.com/contact/'); ?>
</p>
<?php endif; ?>
</div>
<?php elseif ( $type == 'usage-limit' && isset( Akismet::$limit_notices[ $code ] ) ) : ?>
<div class="error akismet-usage-limit-alert">
<div class="akismet-usage-limit-logo">
<img src="<?php echo esc_url( plugins_url( '../_inc/img/logo-a-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
<div class="akismet-usage-limit-text">
<h3>
<?php
switch ( Akismet::$limit_notices[ $code ] ) {
case 'FIRST_MONTH_OVER_LIMIT':
case 'SECOND_MONTH_OVER_LIMIT':
esc_html_e( 'Your Akismet account usage is over your plan&#8217;s limit', 'akismet' );
break;
case 'THIRD_MONTH_APPROACHING_LIMIT':
esc_html_e( 'Your Akismet account usage is approaching your plan&#8217;s limit', 'akismet' );
break;
case 'THIRD_MONTH_OVER_LIMIT':
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
esc_html_e( 'Your account has been restricted', 'akismet' );
break;
default:
}
?>
</h3>
<p>
<?php
switch ( Akismet::$limit_notices[ $code ] ) {
case 'FIRST_MONTH_OVER_LIMIT':
echo esc_html(
sprintf(
/* translators: The first placeholder is a date, the second is a (formatted) number, the third is another formatted number. */
__( 'Since %1$s, your account made %2$s API calls, compared to your plan&#8217;s limit of %3$s.', 'akismet' ),
esc_html( gmdate( 'F' ) . ' 1' ),
number_format( $api_calls ),
number_format( $usage_limit )
)
);
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
echo '</a>';
break;
case 'SECOND_MONTH_OVER_LIMIT':
echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for two consecutive months. Next month, we will restrict your account after you reach the limit. Please consider upgrading your plan.', 'akismet' ) );
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
echo '</a>';
break;
case 'THIRD_MONTH_APPROACHING_LIMIT':
echo esc_html( __( 'Your Akismet usage is nearing your plan&#8217;s limit for the third consecutive month. We will restrict your account after you reach the limit. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
echo '</a>';
break;
case 'THIRD_MONTH_OVER_LIMIT':
case 'FOUR_PLUS_MONTHS_OVER_LIMIT':
echo esc_html( __( 'Your Akismet usage has been over your plan&#8217;s limit for three consecutive months. We have restricted your account for the rest of the month. Upgrade your plan so Akismet can continue blocking spam.', 'akismet' ) );
echo '<a href="https://docs.akismet.com/akismet-api-usage-limits/" target="_blank">';
echo esc_html( __( 'Learn more about usage limits.', 'akismet' ) );
echo '</a>';
break;
default:
}
?>
</p>
</div>
<div class="akismet-usage-limit-cta">
<a href="<?php echo esc_attr( $upgrade_url ); ?>" class="button" target="_blank">
<?php
// If only a qty upgrade is required, show a more generic message.
if ( ! empty( $upgrade_type ) && 'qty' === $upgrade_type ) {
esc_html_e( 'Upgrade your Subscription Level', 'akismet' );
} else {
echo esc_html(
sprintf(
/* translators: The placeholder is the name of a subscription level, like "Plus" or "Enterprise" . */
__( 'Upgrade to %s', 'akismet' ),
$upgrade_plan
)
);
}
?>
</a>
</div>
</div>
<?php endif; ?>
@@ -0,0 +1,11 @@
<div class="akismet-box">
<h2><?php esc_html_e( 'Manual Configuration', 'akismet' ); ?></h2>
<p>
<?php
/* translators: %s is the wp-config.php file */
echo sprintf( esc_html__( 'An Akismet API key has been defined in the %s file for this site.', 'akismet' ), '<code>wp-config.php</code>' );
?>
</p>
</div>
@@ -0,0 +1,4 @@
<div class="akismet-setup-instructions">
<p><?php esc_html_e( 'Set up your Akismet account to enable spam filtering on this site.', 'akismet' ); ?></p>
<?php Akismet::view( 'get', array( 'text' => __( 'Set up your Akismet account' , 'akismet' ), 'classes' => array( 'akismet-button', 'akismet-is-primary' ) ) ); ?>
</div>
@@ -0,0 +1,31 @@
<?php
//phpcs:disable VariableAnalysis
// There are "undefined" variables here because they're defined in the code that includes this file as a template.
?>
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<div class="akismet-lower">
<?php Akismet_Admin::display_status();?>
<div class="akismet-boxes">
<?php
if ( Akismet::predefined_api_key() ) {
Akismet::view( 'predefined' );
} elseif ( $akismet_user && in_array( $akismet_user->status, array( 'active', 'active-dunning', 'no-sub', 'missing', 'cancelled', 'suspended' ) ) ) {
Akismet::view( 'connect-jp', compact( 'akismet_user' ) );
} else {
Akismet::view( 'activate' );
}
?>
</div>
</div>
</div>
@@ -0,0 +1,11 @@
<div id="akismet-plugin-container">
<div class="akismet-masthead">
<div class="akismet-masthead__inside-container">
<a href="<?php echo esc_url( Akismet_Admin::get_page_url() ); ?>" class="akismet-right"><?php esc_html_e( 'Anti-Spam Settings', 'akismet' ); ?></a>
<div class="akismet-masthead__logo-container">
<img class="akismet-masthead__logo" src="<?php echo esc_url( plugins_url( '../_inc/img/logo-full-2x.png', __FILE__ ) ); ?>" alt="Akismet" />
</div>
</div>
</div>
<iframe src="<?php echo esc_url( sprintf( 'https://tools.akismet.com/1.0/user-stats.php?blog=%s&api_key=%s&locale=%s', urlencode( get_option( 'home' ) ), esc_attr( Akismet::get_api_key() ), esc_attr( get_locale() ) ) ); ?>" width="100%" height="2500px" frameborder="0"></iframe>
</div>
@@ -0,0 +1,3 @@
<div class="centered akismet-box-header">
<h2><?php esc_html_e( 'Eliminate spam from your site', 'akismet' ); ?></h2>
</div>
+214
View File
@@ -0,0 +1,214 @@
<?php
global $wpcom_api_key, $akismet_api_host, $akismet_api_port;
$wpcom_api_key = defined( 'WPCOM_API_KEY' ) ? constant( 'WPCOM_API_KEY' ) : '';
$akismet_api_host = Akismet::get_api_key() . '.rest.akismet.com';
$akismet_api_port = 80;
function akismet_test_mode() {
return Akismet::is_test_mode();
}
function akismet_http_post( $request, $host, $path, $port = 80, $ip = null ) {
$path = str_replace( '/1.1/', '', $path );
return Akismet::http_post( $request, $path, $ip );
}
function akismet_microtime() {
return Akismet::_get_microtime();
}
function akismet_delete_old() {
return Akismet::delete_old_comments();
}
function akismet_delete_old_metadata() {
return Akismet::delete_old_comments_meta();
}
function akismet_check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
return Akismet::check_db_comment( $id, $recheck_reason );
}
function akismet_rightnow() {
if ( !class_exists( 'Akismet_Admin' ) )
return false;
return Akismet_Admin::rightnow_stats();
}
function akismet_admin_init() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_version_warning() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_load_js_and_css() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_nonce_field( $action = -1 ) {
return wp_nonce_field( $action );
}
function akismet_plugin_action_links( $links, $file ) {
return Akismet_Admin::plugin_action_links( $links, $file );
}
function akismet_conf() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_stats_display() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_stats() {
return Akismet_Admin::dashboard_stats();
}
function akismet_admin_warnings() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_comment_row_action( $a, $comment ) {
return Akismet_Admin::comment_row_actions( $a, $comment );
}
function akismet_comment_status_meta_box( $comment ) {
return Akismet_Admin::comment_status_meta_box( $comment );
}
function akismet_comments_columns( $columns ) {
_deprecated_function( __FUNCTION__, '3.0' );
return $columns;
}
function akismet_comment_column_row( $column, $comment_id ) {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_text_add_link_callback( $m ) {
return Akismet_Admin::text_add_link_callback( $m );
}
function akismet_text_add_link_class( $comment_text ) {
return Akismet_Admin::text_add_link_class( $comment_text );
}
function akismet_check_for_spam_button( $comment_status ) {
return Akismet_Admin::check_for_spam_button( $comment_status );
}
function akismet_submit_nonspam_comment( $comment_id ) {
return Akismet::submit_nonspam_comment( $comment_id );
}
function akismet_submit_spam_comment( $comment_id ) {
return Akismet::submit_spam_comment( $comment_id );
}
function akismet_transition_comment_status( $new_status, $old_status, $comment ) {
return Akismet::transition_comment_status( $new_status, $old_status, $comment );
}
function akismet_spam_count( $type = false ) {
return Akismet_Admin::get_spam_count( $type );
}
function akismet_recheck_queue() {
return Akismet_Admin::recheck_queue();
}
function akismet_remove_comment_author_url() {
return Akismet_Admin::remove_comment_author_url();
}
function akismet_add_comment_author_url() {
return Akismet_Admin::add_comment_author_url();
}
function akismet_check_server_connectivity() {
return Akismet_Admin::check_server_connectivity();
}
function akismet_get_server_connectivity( $cache_timeout = 86400 ) {
return Akismet_Admin::get_server_connectivity( $cache_timeout );
}
function akismet_server_connectivity_ok() {
_deprecated_function( __FUNCTION__, '3.0' );
return true;
}
function akismet_admin_menu() {
return Akismet_Admin::admin_menu();
}
function akismet_load_menu() {
return Akismet_Admin::load_menu();
}
function akismet_init() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_get_key() {
return Akismet::get_api_key();
}
function akismet_check_key_status( $key, $ip = null ) {
return Akismet::check_key_status( $key, $ip );
}
function akismet_update_alert( $response ) {
return Akismet::update_alert( $response );
}
function akismet_verify_key( $key, $ip = null ) {
return Akismet::verify_key( $key, $ip );
}
function akismet_get_user_roles( $user_id ) {
return Akismet::get_user_roles( $user_id );
}
function akismet_result_spam( $approved ) {
return Akismet::comment_is_spam( $approved );
}
function akismet_result_hold( $approved ) {
return Akismet::comment_needs_moderation( $approved );
}
function akismet_get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url ) {
return Akismet::get_user_comments_approved( $user_id, $comment_author_email, $comment_author, $comment_author_url );
}
function akismet_update_comment_history( $comment_id, $message, $event = null ) {
return Akismet::update_comment_history( $comment_id, $message, $event );
}
function akismet_get_comment_history( $comment_id ) {
return Akismet::get_comment_history( $comment_id );
}
function akismet_cmp_time( $a, $b ) {
return Akismet::_cmp_time( $a, $b );
}
function akismet_auto_check_update_meta( $id, $comment ) {
return Akismet::auto_check_update_meta( $id, $comment );
}
function akismet_auto_check_comment( $commentdata ) {
return Akismet::auto_check_comment( $commentdata );
}
function akismet_get_ip_address() {
return Akismet::get_ip_address();
}
function akismet_cron_recheck() {
return Akismet::cron_recheck();
}
function akismet_add_comment_nonce( $post_id ) {
return Akismet::add_comment_nonce( $post_id );
}
function akismet_fix_scheduled_recheck() {
return Akismet::fix_scheduled_recheck();
}
function akismet_spam_comments() {
_deprecated_function( __FUNCTION__, '3.0' );
return array();
}
function akismet_spam_totals() {
_deprecated_function( __FUNCTION__, '3.0' );
return array();
}
function akismet_manage_page() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_caught() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function redirect_old_akismet_urls() {
_deprecated_function( __FUNCTION__, '3.0' );
}
function akismet_kill_proxy_check( $option ) {
_deprecated_function( __FUNCTION__, '3.0' );
return 0;
}
function akismet_pingback_forwarded_for( $r, $url ) {
// This functionality is now in core.
return false;
}
function akismet_pre_check_pingback( $method ) {
return Akismet::pre_check_pingback( $method );
}
+167
View File
@@ -0,0 +1,167 @@
=== Canvas ===
Tags: theme, page, template
Requires at least: 4.0
Tested up to: 6.0
Requires PHP: 5.4
Stable tag: 2.3.9
Contributors: codesupplyco
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
== Description ==
A revolutionary block-based page builder used for building layouts, an interplay of the WordPress block editor features and exceptional UI design.
== Changelog ==
= 2.3.9 =
* Added string translation for gutenberg blocks.
= 2.3.8 =
* Added compatibility with PHP 8.1.
= 2.3.7 =
* Compatibility fixes for WordPress 6.0.
= 2.3.6 =
* Optimized JS\CSS files
= 2.3.5 =
* Fixed Block Gallery
= 2.3.4 =
* Added exclude categories and tags to posts block
= 2.3.3 =
* Added support laptop breakpoint
= 2.3.2 =
* Fixed Numbered Headings
= 2.3.1 =
* Updated flickity library
= 2.3.0 =
* Fixed Tag Cloud, Calendar, RSS and Latest Comments blocks.
= 2.2.9 =
* Improved compatibility tabs with WordPress 5.8.
= 2.2.8 =
* Added compatibility with php 8.0.
= 2.2.7 =
* Improved compatibility with WordPress 5.8.
* Improved Block Numbered.
= 2.2.6 =
* Improved Block Separator.
= 2.2.5 =
* Improved plugin security.
= 2.2.4 =
* Improved Block Group styles.
= 2.2.3 =
* Updated justifiedGallery library.
= 2.2.2 =
* Fixed rows block.
= 2.2.1 =
* Fixed in the editor basic possibilities of moving and adding blocks.
= 2.2.0 =
* Improved separator block.
= 2.1.9 =
* Improved performance.
= 2.1.8 =
* Compatibility fixes for WordPress 5.7.
= 2.1.7 =
* Added Background Image Section Panel.
= 2.1.6 =
* Improved Section Heading.
= 2.1.5 =
* Improved Dark Mode.
* Fixed interface styles for editor.
= 2.1.4 =
* Added compatibility with WordPress 5.6.
= 2.1.3 =
* Improved filter by categories in posts.
= 2.1.2 =
* Added support attachment for posts block.
= 2.1.1 =
* Added filter to select postTypes.
= 2.1.0 =
* Minor improvements.
= 2.0.9 =
* Added support taxonomy and term to query posts.
= 2.0.8 =
* Added responsive settings to Setcion Headings.
= 2.0.7 =
* Compatibility fixes for WordPress 5.5.
= 2.0.6 =
* Fixed js events in blocks for ajax content.
= 2.0.5 =
* Fixed compatibility wordpress 5.5.
= 2.0.4 =
* Fixed Responsive Settings.
= 2.0.3 =
* Remove column limit from Row Block.
= 2.0.2 =
* Improve blocks.
= 2.0.1 =
* Minor improvements.
= 2.0.0 =
* Added spacings controls.
* Added border controls.
* Added css variables to styles.
* Added feature to "Query Settings" for the WP Group.
* Added support responsive controls (for developers).
* Added support dark scheme (for developers).
* Improved compatibility with wp 5.4.
= 1.0.7 =
* Improve offset in Posts Block.
= 1.0.6 =
* Added search to categories and tags for filters.
= 1.0.5 =
* Integration Post Views Counter to Post Views Module.
= 1.0.4 =
* Minor improvements
= 1.0.3 =
* Fix canvas page template.
= 1.0.2 =
* Add preload for font icons.
= 1.0.1 =
* Improve blocks.
= 1.0 =
* Initial release.
@@ -0,0 +1,513 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/* Modules */
/*--------------------------------------------------------------*/
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.is-style-cnvs-heading-numbered {
--cnvs-heading-numbered-background: #ced4da;
--cnvs-heading-numbered-color: white;
--cnvs-heading-numbered-border-radius: 50rem;
}
/*--------------------------------------------------------------*/
.content,
.entry-content {
counter-reset: h2;
}
.content h2,
.entry-content h2 {
counter-reset: h3;
}
.content h3,
.entry-content h3 {
counter-reset: h4;
}
.content h4,
.entry-content h4 {
counter-reset: h5;
}
.content h5,
.entry-content h5 {
counter-reset: h6;
}
.is-style-cnvs-heading-numbered {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
}
.is-style-cnvs-heading-numbered:before {
margin-left: 0.5em;
}
h2.is-style-cnvs-heading-numbered:before {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding-right: 0.15em;
padding-left: 0.15em;
height: 1.25em;
-webkit-box-flex: 0;
-ms-flex: 0 0 1.25em;
flex: 0 0 1.25em;
border-radius: var(--cnvs-heading-numbered-border-radius);
background: var(--cnvs-heading-numbered-background);
color: var(--cnvs-heading-numbered-color);
counter-increment: h2;
content: counter(h2);
}
h3.is-style-cnvs-heading-numbered:before {
counter-increment: h3;
content: counter(h3);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3);
}
h4.is-style-cnvs-heading-numbered:before {
counter-increment: h4;
content: counter(h4);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4);
}
h5.is-style-cnvs-heading-numbered:before {
counter-increment: h5;
content: counter(h5);
}
h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h4) "." counter(h5);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4) "." counter(h5);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5);
}
h6.is-style-cnvs-heading-numbered:before {
counter-increment: h6;
content: counter(h6);
}
h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h5) "." counter(h6);
}
h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h4) "." counter(h5) "." counter(h6);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
[class*="is-style-cnvs-list-styled"] {
--cnvs-list-styled-line-height: 1.5;
--cnvs-list-styled-font-size: 1rem;
--cnvs-list-styled-children-font-size: 0.875rem;
--cnvs-list-styled-ul-box-background: #ced4da;
--cnvs-list-styled-ul-box-border-radius: 0;
--cnvs-list-styled-ul-positive-box-color: #28a745;
--cnvs-list-styled-ul-negative-box-color: #dc3545;
--cnvs-list-styled-ol-box-color: #495057;
--cnvs-list-styled-ol-box-font-size: 0.875rem;
--cnvs-list-styled-ol-box-font-weight: 600;
--cnvs-list-styled-ol-box-background-color: #e9ecef;
--cnvs-list-styled-ol-box-border-radius: 50%;
--cnvs-list-styled-ol-positive-box-background-color: #28a745;
--cnvs-list-styled-ol-negative-box-background-color: #dc3545;
--cnvs-list-styled-ol-positive-box-color: #fff;
--cnvs-list-styled-ol-negative-box-color: #fff;
}
/*--------------------------------------------------------------*/
.is-style-cnvs-list-styled,
.is-style-cnvs-list-styled-positive,
.is-style-cnvs-list-styled-negative {
line-height: var(--cnvs-list-styled-line-height);
list-style: none;
font-size: var(--cnvs-list-styled-font-size);
}
.is-style-cnvs-list-styled:not(:first-child),
.is-style-cnvs-list-styled-positive:not(:first-child),
.is-style-cnvs-list-styled-negative:not(:first-child) {
margin-top: 1.5rem;
}
.is-style-cnvs-list-styled:not(:last-child),
.is-style-cnvs-list-styled-positive:not(:last-child),
.is-style-cnvs-list-styled-negative:not(:last-child) {
margin-bottom: 1.5rem;
}
.is-style-cnvs-list-styled li:not(:first-child),
.is-style-cnvs-list-styled-positive li:not(:first-child),
.is-style-cnvs-list-styled-negative li:not(:first-child) {
margin-top: 0.5rem;
}
.is-style-cnvs-list-styled > li,
.is-style-cnvs-list-styled-positive > li,
.is-style-cnvs-list-styled-negative > li {
position: relative;
padding-right: 2.5rem;
}
.is-style-cnvs-list-styled > li:before,
.is-style-cnvs-list-styled-positive > li:before,
.is-style-cnvs-list-styled-negative > li:before {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
position: absolute;
right: 0;
top: 0;
}
ol.is-style-cnvs-list-styled,
ol.is-style-cnvs-list-styled-positive,
ol.is-style-cnvs-list-styled-negative {
counter-reset: ol;
}
ol.is-style-cnvs-list-styled > li:before,
ol.is-style-cnvs-list-styled-positive > li:before,
ol.is-style-cnvs-list-styled-negative > li:before {
width: 1.5rem;
height: 1.5rem;
content: counter(ol);
counter-increment: ol;
color: var(--cnvs-list-styled-ol-box-color);
font-size: var(--cnvs-list-styled-ol-box-font-size);
font-weight: var(--cnvs-list-styled-ol-box-font-weight);
background-color: var(--cnvs-list-styled-ol-box-background-color);
border-radius: var(--cnvs-list-styled-ol-box-border-radius);
line-height: 1;
}
ul.is-style-cnvs-list-styled > li:before {
content: '';
width: 0.25rem;
height: 0.25rem;
margin-top: 0.75rem;
right: 1rem;
background: var(--cnvs-list-styled-ul-box-background);
border-radius: var(--cnvs-list-styled-ul-box-border-radius);
}
ol.is-style-cnvs-list-styled ul,
ol.is-style-cnvs-list-styled ol,
ul.is-style-cnvs-list-styled ol,
ul.is-style-cnvs-list-styled ul {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
padding-right: 0;
font-size: var(--cnvs-list-styled-children-font-size);
}
ol.is-style-cnvs-list-styled ul > li:not(:first-child),
ol.is-style-cnvs-list-styled ol > li:not(:first-child),
ul.is-style-cnvs-list-styled ol > li:not(:first-child),
ul.is-style-cnvs-list-styled ul > li:not(:first-child) {
margin-top: 0.25rem;
}
ol.is-style-cnvs-list-styled-positive > li:before {
background-color: var(--cnvs-list-styled-ol-positive-box-background-color);
color: var(--cnvs-list-styled-ol-positive-box-color);
}
ol.is-style-cnvs-list-styled-negative > li:before {
background-color: var(--cnvs-list-styled-ol-negative-box-background-color);
color: var(--cnvs-list-styled-ol-negative-box-color);
}
ul.is-style-cnvs-list-styled-positive > li:before,
ul.is-style-cnvs-list-styled-negative > li:before {
width: 1.5rem;
font-family: 'canvas-icons';
}
ul.is-style-cnvs-list-styled-positive > li:before {
content: "\e912";
color: var(--cnvs-list-styled-ul-positive-box-color);
}
ul.is-style-cnvs-list-styled-negative > li:before {
content: "\e913";
color: var(--cnvs-list-styled-ul-negative-box-color);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.has-drop-cap {
--cnvs-drop-cap-color: black;
--cnvs-drop-cap-font-size: 2.5rem;
--cnvs-drop-cap-dark-background: black;
--cnvs-drop-cap-dark-color: #fff;
--cnvs-drop-cap-light-background: #f8f9fa;
--cnvs-drop-cap-light-color: inherit;
--cnvs-drop-cap-bordered-width: 1px;
--cnvs-drop-cap-bordered-color: #dee2e6;
}
.is-style-cnvs-paragraph-callout {
--cnvs-callout-font-size: 1.25rem;
--cnvs-callout-font-weight: 600;
}
/*--------------------------------------------------------------*/
.content .has-drop-cap.is-cnvs-dropcap-simple:after,
.content .has-drop-cap.is-cnvs-dropcap-bordered:after,
.content .has-drop-cap.is-cnvs-dropcap-border-right:after,
.content .has-drop-cap.is-cnvs-dropcap-bg-light:after,
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-simple:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:after {
content: "";
display: table;
clear: both;
padding-top: 14px;
}
.content .has-drop-cap.is-cnvs-dropcap-simple:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-simple:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter {
display: block;
float: right;
margin-top: 0.5rem;
margin-left: 2rem;
margin-bottom: 1rem;
color: var(--cnvs-drop-cap-color);
font-size: var(--cnvs-drop-cap-font-size);
line-height: 1;
text-align: center;
}
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter {
padding: 0.5rem 1rem;
background: var(--cnvs-drop-cap-dark-background);
color: var(--cnvs-drop-cap-dark-color);
}
.content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter {
padding: 0.5rem 1rem;
background: var(--cnvs-drop-cap-light-background);
color: var(--cnvs-drop-cap-light-color);
}
.content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter {
margin-top: 0.25rem;
padding: 0.5rem 1rem;
border: var(--cnvs-drop-cap-bordered-width) solid var(--cnvs-drop-cap-bordered-color);
}
.content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter {
padding-left: 2rem;
border-left: var(--cnvs-drop-cap-bordered-width) solid var(--cnvs-drop-cap-bordered-color);
border-radius: 0;
}
.content .is-style-cnvs-paragraph-callout,
.entry-content .is-style-cnvs-paragraph-callout {
font-size: var(--cnvs-callout-font-size);
font-weight: var(--cnvs-callout-font-weight);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.wp-block-separator {
--cnvs-wp-block-separator-color: #dee2e6;
}
/*--------------------------------------------------------------*/
.content .wp-block-separator:not(.has-text-color),
.entry-content .wp-block-separator:not(.has-text-color) {
color: var(--cnvs-wp-block-separator-color);
}
.content .wp-block-separator.is-style-cnvs-separator-double, .content .wp-block-separator.is-style-cnvs-separator-dotted, .content .wp-block-separator.is-style-cnvs-separator-dashed,
.entry-content .wp-block-separator.is-style-cnvs-separator-double,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed {
position: relative;
display: block;
height: 10px;
background-color: transparent !important;
border-bottom: none !important;
}
.content .wp-block-separator.is-style-cnvs-separator-double:after, .content .wp-block-separator.is-style-cnvs-separator-dotted:after, .content .wp-block-separator.is-style-cnvs-separator-dashed:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-double:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed:after {
content: '';
display: block;
position: absolute;
top: 50%;
right: 0;
left: 0;
margin-top: -1px;
border-bottom: 2px solid;
}
.content .wp-block-separator.is-style-cnvs-separator-double:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-double:after {
border-bottom-width: 4px !important;
border-bottom-style: double !important;
margin-top: -2px;
}
.content .wp-block-separator.is-style-cnvs-separator-dotted:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted:after {
border-bottom-style: dotted !important;
}
.content .wp-block-separator.is-style-cnvs-separator-dashed:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed:after {
border-bottom-style: dashed !important;
}
.amp-wp-article-content [class^="cnvs-icon-"],
.amp-wp-article-content [class*=" cnvs-icon-"] {
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.amp-wp-article-content .cnvs-icon-like:before {
content: '♡';
}
.amp-wp-article-content .cnvs-icon-comment:before {
content: '⚆';
}
.amp-wp-article-content .cnvs-alert {
border-right: #ced4da 2px solid;
position: relative;
padding: 0.5rem 1rem;
margin-bottom: 1rem;
background: #f8f9fa;
font-size: 0.875rem;
}
.amp-wp-article-content .cnvs-alert .cnvs-close {
display: none;
}
.amp-wp-article-content .cnvs-button {
background: black;
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
padding: 0.5rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: 0.5rem;
text-decoration: none;
color: #fff;
}
.amp-wp-article-content ul.is-style-cnvs-list-styled-positive > li:before {
content: '✓';
}
.amp-wp-article-content ul.is-style-cnvs-list-styled-negative > li:before {
content: '×';
}
@@ -0,0 +1,513 @@
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/* Modules */
/*--------------------------------------------------------------*/
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.is-style-cnvs-heading-numbered {
--cnvs-heading-numbered-background: #ced4da;
--cnvs-heading-numbered-color: white;
--cnvs-heading-numbered-border-radius: 50rem;
}
/*--------------------------------------------------------------*/
.content,
.entry-content {
counter-reset: h2;
}
.content h2,
.entry-content h2 {
counter-reset: h3;
}
.content h3,
.entry-content h3 {
counter-reset: h4;
}
.content h4,
.entry-content h4 {
counter-reset: h5;
}
.content h5,
.entry-content h5 {
counter-reset: h6;
}
.is-style-cnvs-heading-numbered {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start;
}
.is-style-cnvs-heading-numbered:before {
margin-right: 0.5em;
}
h2.is-style-cnvs-heading-numbered:before {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding-left: 0.15em;
padding-right: 0.15em;
height: 1.25em;
-webkit-box-flex: 0;
-ms-flex: 0 0 1.25em;
flex: 0 0 1.25em;
border-radius: var(--cnvs-heading-numbered-border-radius);
background: var(--cnvs-heading-numbered-background);
color: var(--cnvs-heading-numbered-color);
counter-increment: h2;
content: counter(h2);
}
h3.is-style-cnvs-heading-numbered:before {
counter-increment: h3;
content: counter(h3);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3);
}
h4.is-style-cnvs-heading-numbered:before {
counter-increment: h4;
content: counter(h4);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4);
}
h5.is-style-cnvs-heading-numbered:before {
counter-increment: h5;
content: counter(h5);
}
h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h4) "." counter(h5);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4) "." counter(h5);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5);
}
h6.is-style-cnvs-heading-numbered:before {
counter-increment: h6;
content: counter(h6);
}
h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h5) "." counter(h6);
}
h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h4) "." counter(h5) "." counter(h6);
}
h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
}
h2.is-style-cnvs-heading-numbered ~ h3.is-style-cnvs-heading-numbered ~ h4.is-style-cnvs-heading-numbered ~ h5.is-style-cnvs-heading-numbered ~ h6.is-style-cnvs-heading-numbered:before {
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
[class*="is-style-cnvs-list-styled"] {
--cnvs-list-styled-line-height: 1.5;
--cnvs-list-styled-font-size: 1rem;
--cnvs-list-styled-children-font-size: 0.875rem;
--cnvs-list-styled-ul-box-background: #ced4da;
--cnvs-list-styled-ul-box-border-radius: 0;
--cnvs-list-styled-ul-positive-box-color: #28a745;
--cnvs-list-styled-ul-negative-box-color: #dc3545;
--cnvs-list-styled-ol-box-color: #495057;
--cnvs-list-styled-ol-box-font-size: 0.875rem;
--cnvs-list-styled-ol-box-font-weight: 600;
--cnvs-list-styled-ol-box-background-color: #e9ecef;
--cnvs-list-styled-ol-box-border-radius: 50%;
--cnvs-list-styled-ol-positive-box-background-color: #28a745;
--cnvs-list-styled-ol-negative-box-background-color: #dc3545;
--cnvs-list-styled-ol-positive-box-color: #fff;
--cnvs-list-styled-ol-negative-box-color: #fff;
}
/*--------------------------------------------------------------*/
.is-style-cnvs-list-styled,
.is-style-cnvs-list-styled-positive,
.is-style-cnvs-list-styled-negative {
line-height: var(--cnvs-list-styled-line-height);
list-style: none;
font-size: var(--cnvs-list-styled-font-size);
}
.is-style-cnvs-list-styled:not(:first-child),
.is-style-cnvs-list-styled-positive:not(:first-child),
.is-style-cnvs-list-styled-negative:not(:first-child) {
margin-top: 1.5rem;
}
.is-style-cnvs-list-styled:not(:last-child),
.is-style-cnvs-list-styled-positive:not(:last-child),
.is-style-cnvs-list-styled-negative:not(:last-child) {
margin-bottom: 1.5rem;
}
.is-style-cnvs-list-styled li:not(:first-child),
.is-style-cnvs-list-styled-positive li:not(:first-child),
.is-style-cnvs-list-styled-negative li:not(:first-child) {
margin-top: 0.5rem;
}
.is-style-cnvs-list-styled > li,
.is-style-cnvs-list-styled-positive > li,
.is-style-cnvs-list-styled-negative > li {
position: relative;
padding-left: 2.5rem;
}
.is-style-cnvs-list-styled > li:before,
.is-style-cnvs-list-styled-positive > li:before,
.is-style-cnvs-list-styled-negative > li:before {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
position: absolute;
left: 0;
top: 0;
}
ol.is-style-cnvs-list-styled,
ol.is-style-cnvs-list-styled-positive,
ol.is-style-cnvs-list-styled-negative {
counter-reset: ol;
}
ol.is-style-cnvs-list-styled > li:before,
ol.is-style-cnvs-list-styled-positive > li:before,
ol.is-style-cnvs-list-styled-negative > li:before {
width: 1.5rem;
height: 1.5rem;
content: counter(ol);
counter-increment: ol;
color: var(--cnvs-list-styled-ol-box-color);
font-size: var(--cnvs-list-styled-ol-box-font-size);
font-weight: var(--cnvs-list-styled-ol-box-font-weight);
background-color: var(--cnvs-list-styled-ol-box-background-color);
border-radius: var(--cnvs-list-styled-ol-box-border-radius);
line-height: 1;
}
ul.is-style-cnvs-list-styled > li:before {
content: '';
width: 0.25rem;
height: 0.25rem;
margin-top: 0.75rem;
left: 1rem;
background: var(--cnvs-list-styled-ul-box-background);
border-radius: var(--cnvs-list-styled-ul-box-border-radius);
}
ol.is-style-cnvs-list-styled ul,
ol.is-style-cnvs-list-styled ol,
ul.is-style-cnvs-list-styled ol,
ul.is-style-cnvs-list-styled ul {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
padding-left: 0;
font-size: var(--cnvs-list-styled-children-font-size);
}
ol.is-style-cnvs-list-styled ul > li:not(:first-child),
ol.is-style-cnvs-list-styled ol > li:not(:first-child),
ul.is-style-cnvs-list-styled ol > li:not(:first-child),
ul.is-style-cnvs-list-styled ul > li:not(:first-child) {
margin-top: 0.25rem;
}
ol.is-style-cnvs-list-styled-positive > li:before {
background-color: var(--cnvs-list-styled-ol-positive-box-background-color);
color: var(--cnvs-list-styled-ol-positive-box-color);
}
ol.is-style-cnvs-list-styled-negative > li:before {
background-color: var(--cnvs-list-styled-ol-negative-box-background-color);
color: var(--cnvs-list-styled-ol-negative-box-color);
}
ul.is-style-cnvs-list-styled-positive > li:before,
ul.is-style-cnvs-list-styled-negative > li:before {
width: 1.5rem;
font-family: 'canvas-icons';
}
ul.is-style-cnvs-list-styled-positive > li:before {
content: "\e912";
color: var(--cnvs-list-styled-ul-positive-box-color);
}
ul.is-style-cnvs-list-styled-negative > li:before {
content: "\e913";
color: var(--cnvs-list-styled-ul-negative-box-color);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.has-drop-cap {
--cnvs-drop-cap-color: black;
--cnvs-drop-cap-font-size: 2.5rem;
--cnvs-drop-cap-dark-background: black;
--cnvs-drop-cap-dark-color: #fff;
--cnvs-drop-cap-light-background: #f8f9fa;
--cnvs-drop-cap-light-color: inherit;
--cnvs-drop-cap-bordered-width: 1px;
--cnvs-drop-cap-bordered-color: #dee2e6;
}
.is-style-cnvs-paragraph-callout {
--cnvs-callout-font-size: 1.25rem;
--cnvs-callout-font-weight: 600;
}
/*--------------------------------------------------------------*/
.content .has-drop-cap.is-cnvs-dropcap-simple:after,
.content .has-drop-cap.is-cnvs-dropcap-bordered:after,
.content .has-drop-cap.is-cnvs-dropcap-border-right:after,
.content .has-drop-cap.is-cnvs-dropcap-bg-light:after,
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-simple:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:after,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:after {
content: "";
display: table;
clear: both;
padding-top: 14px;
}
.content .has-drop-cap.is-cnvs-dropcap-simple:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-simple:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter {
display: block;
float: left;
margin-top: 0.5rem;
margin-right: 2rem;
margin-bottom: 1rem;
color: var(--cnvs-drop-cap-color);
font-size: var(--cnvs-drop-cap-font-size);
line-height: 1;
text-align: center;
}
.content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-dark:first-letter {
padding: 0.5rem 1rem;
background: var(--cnvs-drop-cap-dark-background);
color: var(--cnvs-drop-cap-dark-color);
}
.content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bg-light:first-letter {
padding: 0.5rem 1rem;
background: var(--cnvs-drop-cap-light-background);
color: var(--cnvs-drop-cap-light-color);
}
.content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-bordered:first-letter {
margin-top: 0.25rem;
padding: 0.5rem 1rem;
border: var(--cnvs-drop-cap-bordered-width) solid var(--cnvs-drop-cap-bordered-color);
}
.content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter,
.entry-content .has-drop-cap.is-cnvs-dropcap-border-right:first-letter {
padding-right: 2rem;
border-right: var(--cnvs-drop-cap-bordered-width) solid var(--cnvs-drop-cap-bordered-color);
border-radius: 0;
}
.content .is-style-cnvs-paragraph-callout,
.entry-content .is-style-cnvs-paragraph-callout {
font-size: var(--cnvs-callout-font-size);
font-weight: var(--cnvs-callout-font-weight);
}
/**
* All of the CSS for your public-facing functionality should be
* included in this file.
*/
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
.wp-block-separator {
--cnvs-wp-block-separator-color: #dee2e6;
}
/*--------------------------------------------------------------*/
.content .wp-block-separator:not(.has-text-color),
.entry-content .wp-block-separator:not(.has-text-color) {
color: var(--cnvs-wp-block-separator-color);
}
.content .wp-block-separator.is-style-cnvs-separator-double, .content .wp-block-separator.is-style-cnvs-separator-dotted, .content .wp-block-separator.is-style-cnvs-separator-dashed,
.entry-content .wp-block-separator.is-style-cnvs-separator-double,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed {
position: relative;
display: block;
height: 10px;
background-color: transparent !important;
border-bottom: none !important;
}
.content .wp-block-separator.is-style-cnvs-separator-double:after, .content .wp-block-separator.is-style-cnvs-separator-dotted:after, .content .wp-block-separator.is-style-cnvs-separator-dashed:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-double:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed:after {
content: '';
display: block;
position: absolute;
top: 50%;
left: 0;
right: 0;
margin-top: -1px;
border-bottom: 2px solid;
}
.content .wp-block-separator.is-style-cnvs-separator-double:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-double:after {
border-bottom-width: 4px !important;
border-bottom-style: double !important;
margin-top: -2px;
}
.content .wp-block-separator.is-style-cnvs-separator-dotted:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dotted:after {
border-bottom-style: dotted !important;
}
.content .wp-block-separator.is-style-cnvs-separator-dashed:after,
.entry-content .wp-block-separator.is-style-cnvs-separator-dashed:after {
border-bottom-style: dashed !important;
}
.amp-wp-article-content [class^="cnvs-icon-"],
.amp-wp-article-content [class*=" cnvs-icon-"] {
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.amp-wp-article-content .cnvs-icon-like:before {
content: '♡';
}
.amp-wp-article-content .cnvs-icon-comment:before {
content: '⚆';
}
.amp-wp-article-content .cnvs-alert {
border-left: #ced4da 2px solid;
position: relative;
padding: 0.5rem 1rem;
margin-bottom: 1rem;
background: #f8f9fa;
font-size: 0.875rem;
}
.amp-wp-article-content .cnvs-alert .cnvs-close {
display: none;
}
.amp-wp-article-content .cnvs-button {
background: black;
display: inline-block;
font-weight: 400;
text-align: center;
white-space: nowrap;
vertical-align: middle;
padding: 0.5rem 0.75rem;
font-size: 1rem;
line-height: 1.5;
border-radius: 0.5rem;
text-decoration: none;
color: #fff;
}
.amp-wp-article-content ul.is-style-cnvs-list-styled-positive > li:before {
content: '✓';
}
.amp-wp-article-content ul.is-style-cnvs-list-styled-negative > li:before {
content: '×';
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,4 @@
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
@@ -0,0 +1,4 @@
/**
* Environment for all styles (variables, additions, etc).
*/
/*--------------------------------------------------------------*/
@@ -0,0 +1,26 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="canvas-icons" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="comment" d="M854 256.667v512h-684v-598l86 86h598zM854 852.667c46 0 84-38 84-84v-512c0-46-38-86-84-86h-598l-170-170v768c0 46 38 84 84 84h684z" />
<glyph unicode="&#xe908;" glyph-name="up" d="M797.867 328.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733s42.667-17.067 59.733 0l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733z" />
<glyph unicode="&#xe90d;" glyph-name="minus" d="M810.667 469.334h-597.333c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h597.333c25.6 0 42.667 17.067 42.667 42.667s-17.067 42.667-42.667 42.667z" />
<glyph unicode="&#xe910;" glyph-name="arrow-left-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM682.667 469.334h-238.933l98.133 98.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-170.667-170.667c-4.267-4.267-8.533-8.533-8.533-12.8-4.267-8.533-4.267-21.333 0-34.133 4.267-4.267 4.267-8.533 8.533-12.8l170.667-170.667c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-98.133 98.133h238.933c25.6 0 42.667 17.067 42.667 42.667s-17.067 42.667-42.667 42.667z" />
<glyph unicode="&#xe911;" glyph-name="arrow-right-circle" d="M512 896c-260.267 0-469.333-209.067-469.333-469.333s209.067-469.333 469.333-469.333 469.333 209.067 469.333 469.333-209.067 469.333-469.333 469.333zM512 42.667c-213.333 0-384 170.667-384 384s170.667 384 384 384c213.333 0 384-170.667 384-384s-170.667-384-384-384zM721.067 443.734c-4.267 4.267-4.267 8.533-8.533 12.8l-170.667 170.667c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l98.133-98.133h-238.933c-25.6 0-42.667-17.067-42.667-42.667s17.067-42.667 42.667-42.667h238.933l-98.133-98.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8l170.667 170.667c4.267 4.267 8.533 8.533 8.533 12.8 4.267 12.8 4.267 21.333 0 34.133z" />
<glyph unicode="&#xe912;" glyph-name="check" d="M883.2 712.534c-17.067 17.067-42.667 17.067-59.733 0l-439.467-439.467-183.467 183.467c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l213.333-213.333c8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l469.333 469.333c17.067 17.067 17.067 42.667 0 59.733z" />
<glyph unicode="&#xe913;" glyph-name="x" d="M571.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-226.133-226.133-226.133 226.133c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l226.133 226.133 226.133-226.133c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
<glyph unicode="&#xe914;" glyph-name="chevron-right" d="M669.867 456.534l-256 256c-17.067 17.067-42.667 17.067-59.733 0s-17.067-42.667 0-59.733l226.133-226.133-226.133-226.133c-17.067-17.067-17.067-42.667 0-59.733 8.533-8.533 17.067-12.8 29.867-12.8s21.333 4.267 29.867 12.8l256 256c17.067 17.067 17.067 42.667 0 59.733z" />
<glyph unicode="&#xe915;" glyph-name="chevron-left" d="M443.733 426.667l226.133 226.133c17.067 17.067 17.067 42.667 0 59.733s-42.667 17.067-59.733 0l-256-256c-17.067-17.067-17.067-42.667 0-59.733l256-256c8.533-8.533 21.333-12.8 29.867-12.8s21.333 4.267 29.867 12.8c17.067 17.067 17.067 42.667 0 59.733l-226.133 226.133z" />
<glyph unicode="&#xe93d;" glyph-name="share" d="M691.797 166.486c1.067 1.408 2.048 2.859 2.987 4.437 0.853 1.493 1.621 3.029 2.304 4.565 3.115 4.608 6.656 8.917 10.581 12.843 15.488 15.488 36.736 25.003 60.331 25.003s44.843-9.515 60.331-25.003 25.003-36.736 25.003-60.331-9.515-44.843-25.003-60.331-36.736-25.003-60.331-25.003-44.843 9.515-60.331 25.003-25.003 36.736-25.003 60.331c0 13.867 3.285 26.923 9.131 38.485zM695.509 680.278c-0.384 0.725-0.768 1.451-1.195 2.176s-0.853 1.451-1.323 2.133c-6.571 12.075-10.325 25.941-10.325 40.747 0 23.595 9.515 44.843 25.003 60.331s36.736 25.003 60.331 25.003 44.843-9.515 60.331-25.003 25.003-36.736 25.003-60.331-9.515-44.843-25.003-60.331-36.736-25.003-60.331-25.003-44.843 9.515-60.331 25.003c-4.608 4.608-8.704 9.728-12.16 15.275zM328.491 471.723c0.384-0.725 0.768-1.451 1.195-2.176s0.853-1.451 1.323-2.133c6.571-12.075 10.325-25.941 10.325-40.747s-3.755-28.672-10.368-40.789c-0.469-0.683-0.896-1.408-1.323-2.133s-0.811-1.408-1.152-2.133c-3.456-5.547-7.552-10.667-12.16-15.275-15.488-15.488-36.736-25.003-60.331-25.003s-44.843 9.515-60.331 25.003-25.003 36.736-25.003 60.331 9.515 44.843 25.003 60.331 36.736 25.003 60.331 25.003 44.843-9.515 60.331-25.003c4.608-4.608 8.704-9.728 12.16-15.275zM603.733 678.912l-226.475-132.139c-0.171 0.213-0.384 0.384-0.597 0.597-30.805 30.805-73.557 49.963-120.661 49.963s-89.856-19.157-120.661-50.005-50.005-73.557-50.005-120.661 19.157-89.856 50.005-120.661 73.557-50.005 120.661-50.005 89.856 19.157 120.661 50.005c0.213 0.213 0.384 0.384 0.597 0.597l226.517-132.011c-4.181-14.805-6.443-30.464-6.443-46.592 0-47.104 19.157-89.856 50.005-120.661s73.557-50.005 120.661-50.005 89.856 19.157 120.661 50.005 50.005 73.557 50.005 120.661-19.157 89.856-50.005 120.661-73.557 50.005-120.661 50.005-89.856-19.157-120.661-50.005c-0.128-0.128-0.299-0.299-0.427-0.427l-226.645 132.053c4.181 14.763 6.4 30.293 6.4 46.379s-2.219 31.659-6.4 46.421l226.475 132.181c0.171-0.213 0.384-0.384 0.597-0.597 30.805-30.848 73.557-50.005 120.661-50.005s89.856 19.157 120.661 50.005 50.005 73.557 50.005 120.661-19.157 89.856-50.005 120.661-73.557 50.005-120.661 50.005-89.856-19.157-120.661-50.005-50.005-73.557-50.005-120.661c0-16.085 2.219-31.659 6.4-46.421z" />
<glyph unicode="&#xe93e;" glyph-name="eye" d="M4.523 445.739c-5.803-11.691-6.229-25.728 0-38.144 0 0 16.896-33.664 47.787-78.635 19.243-27.989 44.288-61.099 74.965-94.635 38.144-41.771 85.504-84.779 141.611-119.467 68.053-42.069 149.589-72.192 243.115-72.192s175.061 30.123 243.115 72.192c56.107 34.688 103.467 77.696 141.611 119.467 30.635 33.536 55.723 66.645 74.965 94.635 30.891 44.971 47.787 78.635 47.787 78.635 5.803 11.691 6.229 25.728 0 38.144 0 0-16.896 33.664-47.787 78.635-19.243 27.989-44.288 61.099-74.965 94.635-38.144 41.771-85.504 84.779-141.611 119.467-68.053 42.069-149.589 72.192-243.115 72.192s-175.061-30.123-243.115-72.192c-56.107-34.688-103.467-77.696-141.611-119.467-30.677-33.536-55.723-66.603-74.965-94.635-30.891-44.971-47.787-78.635-47.787-78.635zM91.307 426.667c6.955 11.989 17.365 29.056 31.317 49.408 17.493 25.429 40.107 55.296 67.627 85.376 34.347 37.589 75.733 74.923 123.477 104.448 57.6 35.584 123.776 59.435 198.272 59.435s140.672-23.851 198.229-59.435c47.744-29.525 89.131-66.859 123.477-104.448 27.477-30.080 50.133-59.947 67.627-85.376 13.995-20.352 24.405-37.376 31.317-49.408-6.955-11.989-17.365-29.056-31.317-49.408-17.493-25.429-40.107-55.296-67.627-85.376-34.347-37.589-75.733-74.923-123.477-104.448-57.557-35.584-123.733-59.435-198.229-59.435s-140.672 23.851-198.229 59.435c-47.744 29.525-89.131 66.859-123.477 104.448-27.477 30.080-50.133 59.947-67.627 85.376-13.995 20.352-24.405 37.419-31.36 49.408zM682.667 426.667c0 47.104-19.157 89.856-50.005 120.661s-73.557 50.005-120.661 50.005-89.856-19.157-120.661-50.005-50.005-73.557-50.005-120.661 19.157-89.856 50.005-120.661 73.557-50.005 120.661-50.005 89.856 19.157 120.661 50.005 50.005 73.557 50.005 120.661zM597.333 426.667c0-23.595-9.515-44.843-25.003-60.331s-36.736-25.003-60.331-25.003-44.843 9.515-60.331 25.003-25.003 36.736-25.003 60.331 9.515 44.843 25.003 60.331 36.736 25.003 60.331 25.003 44.843-9.515 60.331-25.003 25.003-36.736 25.003-60.331z" />
<glyph unicode="&#xe93f;" glyph-name="watch" d="M469.333 554.667v-128c0-11.776 4.779-22.443 12.501-30.165l64-64c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331l-51.499 51.499v110.336c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667zM654.080 116.224l-7.083-77.355c-1.024-11.349-6.272-21.12-14.208-28.075-7.68-6.784-17.707-10.795-28.587-10.795h-184.789c-11.52-0.043-21.76 4.267-29.44 11.477-7.467 6.997-12.416 16.597-13.397 27.435l-7.083 77.525c43.349-19.968 91.648-31.104 142.507-31.104 50.688 0 98.816 11.051 142.080 30.891zM349.312 624.342c44.245 36.48 100.864 58.325 162.688 58.325 70.699 0 134.656-28.587 181.035-74.965s74.965-110.336 74.965-181.035-28.587-134.656-74.965-181.035c-4.437-4.437-9.003-8.704-13.781-12.8-1.493-1.323-3.029-2.603-4.565-3.84-44.245-36.48-100.864-58.325-162.688-58.325-70.699 0-134.656 28.587-181.035 74.965s-74.965 110.336-74.965 181.035 28.587 134.656 74.965 181.035c4.437 4.437 9.003 8.704 13.781 12.8 1.493 1.323 3.029 2.603 4.565 3.84zM746.283 674.902l-13.44 147.413c-2.987 32.256-17.835 61.013-40.021 81.792-22.997 21.547-54.016 34.688-87.808 34.56h-185.771c-32.213-0.128-62.037-12.203-84.693-32.299-23.552-20.821-39.467-50.432-42.539-84.139l-13.397-146.475c-2.688-2.517-5.376-5.12-7.979-7.723-61.696-61.739-99.968-147.115-99.968-241.365s38.272-179.627 99.968-241.365c2.475-2.475 4.992-4.907 7.509-7.296l13.44-146.987c2.987-32.256 17.835-61.013 40.021-81.792 22.997-21.547 54.016-34.688 87.808-34.56h184.661c32.384-0.043 62.421 12.032 85.205 32.171 23.595 20.864 39.637 50.517 42.667 84.267l13.397 146.475c2.688 2.517 5.376 5.12 7.979 7.723 61.739 61.739 100.011 147.115 100.011 241.365s-38.272 179.627-99.968 241.365c-2.304 2.304-4.693 4.608-7.040 6.869zM369.92 737.11l7.083 77.355c1.024 11.307 6.272 21.077 14.123 28.032 7.637 6.784 17.579 10.795 28.459 10.837h185.429c11.52 0.043 21.76-4.267 29.44-11.477 7.467-6.997 12.416-16.597 13.397-27.435l7.083-77.696c-43.477 20.053-91.904 31.275-142.933 31.275-50.688 0-98.816-11.051-142.080-30.891z" />
<glyph unicode="&#xe940;" glyph-name="arrow-right" d="M481.835 695.168l225.835-225.835h-494.336c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667h494.336l-225.835-225.835c-16.683-16.683-16.683-43.691 0-60.331s43.691-16.683 60.331 0l298.667 298.667c3.925 3.925 7.083 8.619 9.259 13.824 4.309 10.453 4.309 22.229 0 32.683-2.091 5.035-5.163 9.728-9.259 13.824l-298.667 298.667c-16.683 16.683-43.691 16.683-60.331 0s-16.683-43.691 0-60.331z" />
<glyph unicode="&#xe941;" glyph-name="arrow-left" d="M542.165 158.166l-225.835 225.835h494.336c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667h-494.336l225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-298.667-298.667c-4.096-4.096-7.168-8.789-9.259-13.824-2.176-5.205-3.243-10.795-3.243-16.341 0-10.923 4.181-21.845 12.501-30.165l298.667-298.667c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331z" />
<glyph unicode="&#xe942;" glyph-name="arrow-down" d="M780.501 456.832l-225.835-225.835v494.336c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-494.336l-225.835 225.835c-16.683 16.683-43.691 16.683-60.331 0s-16.683-43.691 0-60.331l298.667-298.667c4.096-4.096 8.789-7.168 13.824-9.259s10.539-3.243 16.341-3.243c5.547 0 11.136 1.067 16.341 3.243 5.035 2.091 9.728 5.163 13.824 9.259l298.667 298.667c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0z" />
<glyph unicode="&#xe943;" glyph-name="arrow-up" d="M243.499 396.502l225.835 225.835v-494.336c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667v494.336l225.835-225.835c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331l-298.667 298.667c-4.096 4.096-8.789 7.168-13.824 9.259-5.205 2.176-10.795 3.243-16.341 3.243-10.923 0-21.845-4.181-30.165-12.501l-298.667-298.667c-16.683-16.683-16.683-43.691 0-60.331s43.691-16.683 60.331 0z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long
+56
View File
@@ -0,0 +1,56 @@
<?php
/**
* Plugin Name: Canvas
* Plugin URI: https://codesupply.co/cnvs/
* Description: A revolutionary block-based page builder used for building layouts, an interplay of the WordPress block editor features and exceptional UI design.
* Version: 2.3.9
* Author: Code Supply Co.
* Author URI: https://codesupply.co/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: canvas
* Domain Path: /languages
*
* @link https://codesupply.co
* @package Canvas
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Variables
*/
define( 'CNVS_URL', plugin_dir_url( __FILE__ ) );
define( 'CNVS_PATH', plugin_dir_path( __FILE__ ) );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-canvas-activator.php
*/
function cnvs_activate() {
do_action( 'cnvs_plugin_activation' );
}
register_activation_hook( __FILE__, 'cnvs_activate' );
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-canvas-deactivator.php
*/
function cnvs_deactivate() {
do_action( 'cnvs_plugin_deactivation' );
}
register_deactivation_hook( __FILE__, 'cnvs_deactivate' );
/**
* Language
*/
load_plugin_textdomain( 'canvas', false, plugin_basename( CNVS_PATH ) . '/languages' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require_once plugin_dir_path( __FILE__ ) . '/core/class-canvas.php';
@@ -0,0 +1,9 @@
/**
* All of the CSS for your block editor functionality should be
* included in this file.
*/
/*--------------------------------------------------------------*/
.cnvs-block-alert-inner {
margin-top: -27px;
margin-bottom: -27px;
}
@@ -0,0 +1,9 @@
/**
* All of the CSS for your block editor functionality should be
* included in this file.
*/
/*--------------------------------------------------------------*/
.cnvs-block-alert-inner {
margin-top: -27px;
margin-bottom: -27px;
}

Some files were not shown because too many files have changed in this diff Show More