| Server IP : 52.25.153.185 / Your IP : 216.73.217.131 Web Server : Apache System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64 User : daemon ( 1) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/testify/ |
Upload File : |
<?php
/*
Plugin Name: Testify
Plugin URI: https://wpzone.co/product/testify
Description: The Ultimate Testimonial Plugin for WordPress
Version: 2.1.11
Author: WP Zone
Author URI: https://wpzone.co/
License: GPL3
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
Text Domain: testify-testify
Domain Path: /languages
GitLab Plugin URI: https://gitlab.com/aspengrovestudios/testify/
AGS Info: ids.aspengrove 2946 ids.divispace 2946 legacy.key AGS_TESTIFY_license_key legacy.status AGS_TESTIFY_license_status adminPage edit.php?post_type=testify-testimonial&page=testify-about
/*
Note: The Testify plugin is licensed under GNU General Public License version 3 only; this modifies the following. See license.txt
Copyright (C) 2022 WP Zone
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Constants
define('AGS_TESTIFY_VER', '2.1.11');
define('AGS_TESTIFY_STORE_URL', 'https://wpzone.co/');
define('AGS_TESTIFY_PLUGIN_FILE', __FILE__);
define('TESTIFY_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define('TESTIFY_INTEGRATIONS_DIR', TESTIFY_PLUGIN_DIR . '/includes/integrations/');
require( TESTIFY_PLUGIN_DIR . '/updater/updater.php' );
require( TESTIFY_PLUGIN_DIR . '/includes/helpers.php' );
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'testify_plugin_action_links');
function testify_plugin_action_links($links) {
$links[] = '<a href="edit.php?post_type=testify-testimonial&page=testify-about">'. __("About & Instructions" , "testify-testify") . '</a>';
return $links;
}
function testify_scripts() {
$theme_name = wp_get_theme();
wp_enqueue_style( 'testify-style', plugins_url('/css/style.css', __FILE__ ), array(), AGS_TESTIFY_VER);
wp_enqueue_style( 'flexslider', plugins_url('/css/flexslider.css', __FILE__ ), array(), null);
wp_enqueue_script( 'flexslider', plugins_url('js/jquery.flexslider.min.js',__FILE__ ), array('jquery'), '1.2', true);
wp_enqueue_script( 'readmore-js', plugins_url('/js/readmore.min.js',__FILE__ ), array('jquery'), '1.1', true);
if ( 'Divi' !== $theme_name->name ) {
$bundle_url = plugins_url("scripts/frontend-bundle.min.js", __FILE__ );
wp_enqueue_script( "testify-frontend-bundle", $bundle_url, array('jquery', 'flexslider'), '1.0', true );
}
if( function_exists( 'et_fb_is_enabled' ) && et_fb_is_enabled() ) { // Divi Visual Builder enabled
wp_enqueue_style('testify-divi-visual-builder', plugins_url('/css/divi-visual-builder.min.css', __FILE__ ), array(), AGS_TESTIFY_VER );
}
}
add_action( 'wp_enqueue_scripts', 'testify_scripts' );
// These script and style enqueues are not limited to a specific admin page but may be required to support
// the TinyMCE extension that could appear anywhere that a WordPress TinyMCE instance is loaded.
function testify_admin_scripts() {
wp_enqueue_style('testify-admin-style', plugins_url('/css/admin.css', __FILE__), array(), AGS_TESTIFY_VER);
wp_enqueue_script('testify-admin-js', plugins_url('/js/admin.js', __FILE__), array('jquery', 'testify-alpha-color-picker'), AGS_TESTIFY_VER);
wp_enqueue_script('jquery-modal', plugins_url('/js/jquery.modal.min.js', __FILE__), array('jquery'), null);
wp_enqueue_style('jquery-modal', plugins_url('/css/jquery.modal.min.css', __FILE__), array(), null);
wp_enqueue_style('testify-alpha-color-picker', plugins_url('/includes/alpha-color-picker/alpha-color-picker.css', __FILE__), array('wp-color-picker'), null);
wp_enqueue_script('testify-alpha-color-picker', plugins_url('/includes/alpha-color-picker/alpha-color-picker.js', __FILE__), array('jquery', 'wp-color-picker'), null);
wp_enqueue_style('testify-divi-visual-builder', plugins_url('/css/divi-visual-builder.min.css', __FILE__ ), array(), AGS_TESTIFY_VER ); // for backend editor
}
add_action('admin_enqueue_scripts', 'testify_admin_scripts');
add_shortcode( 'testify', 'testify_shortcode' );
function testify_shortcode($atts) {
global $testify_id;
ob_start();
include_once( TESTIFY_PLUGIN_DIR . '/includes/shortcode.php');
testify_shortcode_output($atts);
return ob_get_clean();
}
function testify_customize_register( $wp_customize ) {
include( TESTIFY_PLUGIN_DIR . '/includes/customizer.php');
}
add_action( 'customize_register', 'testify_customize_register' );
function testify_wp_head() {
$testifyOptionsDefaults = testify_get_options_defaults();
$qMark = get_theme_mod('testify_qmark', $testifyOptionsDefaults['qmark']);
?>
<style id="testify-settings">
.testify-testimonials {
background-color: <?php echo esc_html(get_theme_mod('testify_bgcolor', $testifyOptionsDefaults['bgcolor'])); ?>;
text-align: <?php echo esc_html($align = get_theme_mod('testify_align', $testifyOptionsDefaults['align'])); ?>;
font-size: <?php echo esc_html($fontSize = get_theme_mod('testify_font_size', $testifyOptionsDefaults['font_size'])); ?>px;
visibility: hidden;
}
.testify-testimonials .controls {
margin-top: -<?php echo esc_html($spacing = get_theme_mod('testify_thumb_spacing', $testifyOptionsDefaults['thumb_spacing'])); ?>px;
margin-left: -<?php echo esc_html($spacing/2); ?>px;
margin-right: -<?php echo esc_html($spacing/2); ?>px;
}
.testify-testimonials .testify-flex-control-thumbs {
background-color: <?php echo esc_html($thumbRowBgColor = get_theme_mod('testify_thumb_row_bgcolor', $testifyOptionsDefaults['thumb_row_bgcolor'])); ?>;
bottom: -<?php echo esc_html($spacing); ?>px;
}
.testify-testimonials .testify-flex-control-thumbs li{
background-color: <?php echo esc_html(get_theme_mod('testify_thumb_inactive_color', $testifyOptionsDefaults['thumb_inactive_color'])); ?>;
border-left: <?php echo esc_html($spacing/2); ?>px solid <?php echo esc_html($thumbRowBgColor); ?>;
border-right: <?php echo esc_html($spacing/2); ?>px solid <?php echo esc_html($thumbRowBgColor); ?>;
border-bottom: <?php echo esc_html($spacing); ?>px solid <?php echo esc_html($thumbRowBgColor); ?>;
}
<?php if (!empty($qMark)) { ?>
.testify-testimonials .quotation-mark {
width: <?php echo esc_html($qMarkWidth = get_theme_mod('testify_qmark_width', $testifyOptionsDefaults['qmark_width'])); ?>px;
height: <?php echo esc_html($qMarkWidth/38 * 50); ?>px;
}
<?php } ?>
<?php
if (!empty($qMark)) {
$sidePadding = ($fontSize / 2) + $qMarkWidth;
$sidePaddingTablet = (($fontSize * 0.8) / 2) + ($qMarkWidth * 0.6);
}
$navArrows = get_theme_mod('testify_font_size', $testifyOptionsDefaults['nav_arrows']);
if (!empty($navArrows)) {
// If arrows are displayed, we need at least 50px padding on the sides
$sidePadding = (empty($sidePadding) ? 50 : max(50, $sidePadding));
$sidePaddingTablet = (empty($sidePaddingTablet) ? 50 : max(50, $sidePaddingTablet));
}
if (!empty($sidePadding)) { ?>
.testify-testimonials .testimonial-outer {
padding: 0 <?php echo esc_html($sidePadding-$sidePaddingTablet); ?>px;
}
.testify-testimonials .testimonial {
padding: 0 <?php echo esc_html($sidePaddingTablet); ?>px;
}
<?php } ?>
<?php
$imageWidth = get_theme_mod('testify_image_width', $testifyOptionsDefaults['image_width']);
$imageWidth900 = get_theme_mod('testify_image_width_900', $testifyOptionsDefaults['image_width_900']);
$imageWidth600 = get_theme_mod('testify_image_width_600', $testifyOptionsDefaults['image_width_600']);
$imageWidth400 = get_theme_mod('testify_image_width_400', $testifyOptionsDefaults['image_width_400']);
?>
.testify-testimonials .slides .testimonial-image {
<?php if ($imageWidth && 'thumbnails' !== get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type'])) { ?>
display: block;
max-width: <?php echo esc_html($imageWidth); ?>px;
<?php } ?>
<?php if ($align == 'center') { ?>
margin-left: auto;
margin-right: auto;
<?php } else if ($align == 'right') { ?>
float: right;
<?php } ?>
border: <?php echo esc_html(get_theme_mod('testify_image_border_width', $testifyOptionsDefaults['image_border_width'])); ?>px solid <?php echo esc_html(get_theme_mod('testify_image_border_color', $testifyOptionsDefaults['image_border_color'])); ?>;
<?php if (get_theme_mod('testify_image_shadow', $testifyOptionsDefaults['image_shadow'])) { ?>
-moz-box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
-webkit-box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
box-shadow: 0 0 5px 0 rgba(0,0,0,0.5);
<?php } ?>
<?php if (get_theme_mod('testify_image_shape', $testifyOptionsDefaults['image_shape']) == 'circle') { ?>
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
<?php } ?>
}
.testify-testimonials .testimonial-body {
color: <?php echo esc_html(get_theme_mod('testify_text_color', $testifyOptionsDefaults['text_color'])); ?>;
font-family: <?php echo esc_html(get_theme_mod('testify_font_family', $testifyOptionsDefaults['font_family'])); ?>;
font-weight: <?php echo esc_html(get_theme_mod('testify_font_weight', $testifyOptionsDefaults['font_weight'])); ?>;
font-style: <?php echo esc_html(get_theme_mod('testify_font_italic', $testifyOptionsDefaults['font_italic']) ? 'italic' : 'normal'); ?>;
text-transform: <?php echo esc_html(get_theme_mod('testify_text_uppercase', $testifyOptionsDefaults['text_uppercase']) ? 'uppercase' : 'none'); ?>;
}
.testify-testimonials .person-name {
font-size: <?php echo esc_html(get_theme_mod('testify_font_size_author', $testifyOptionsDefaults['font_size_author'])); ?>px;
}
.testify-testimonials .person-name p, .testify-testimonials .person-name p a {
color: <?php echo esc_html(get_theme_mod('testify_text_color_author', $testifyOptionsDefaults['text_color_author'])); ?>;
font-family: <?php echo esc_html(get_theme_mod('testify_font_family_author', $testifyOptionsDefaults['font_family_author'])); ?>;
font-weight: <?php echo esc_html(get_theme_mod('testify_font_weight_author', $testifyOptionsDefaults['font_weight_author'])); ?>;
font-style: <?php echo esc_html(get_theme_mod('testify_font_italic_author', $testifyOptionsDefaults['font_italic_author']) ? 'italic' : 'normal'); ?>;
text-transform: <?php echo esc_html(get_theme_mod('testify_text_uppercase_author', $testifyOptionsDefaults['text_uppercase_author']) ? 'uppercase' : 'none'); ?>;
}
.testify-testimonials .testify-link-readmore, .testify-testimonials .testify-link-readless {
color: <?php echo esc_html(get_theme_mod('testify_readmore_color', $testifyOptionsDefaults['readmore_color'])); ?>;
font-size: <?php echo esc_html(get_theme_mod('testify_readmore_font_size', $testifyOptionsDefaults['readmore_font_size'])); ?>px;
letter-spacing: <?php echo esc_html(get_theme_mod('testify_readmore_letter_spacing', $testifyOptionsDefaults['readmore_letter_spacing'])); ?>px;
}
.testify-testimonials .testify-link-readmore-text, .testify-testimonials .testify-link-readless-text {/* redone all of these ^v - confirmed */
font-family: <?php echo esc_html(get_theme_mod('testify_readmore_font', $testifyOptionsDefaults['readmore_font'])); ?>;
}
<?php if (($sepColor = get_theme_mod('testify_sep_color', $testifyOptionsDefaults['sep_color'])) != $testifyOptionsDefaults['sep_color']) { ?>
.testify-testimonials .testimonial-sep {
height: <?php echo esc_html(get_theme_mod('testify_sep_height', $testifyOptionsDefaults['sep_height'])); ?>px;
background-color: <?php echo esc_html($sepColor); ?>;
<?php if ($align == 'center') { ?>
margin-left: auto;
margin-right: auto;
<?php } else if ($align == 'right') { ?>
float: right;
<?php } ?>
}
<?php } ?>
<?php if (get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type']) == 'thumbnails') { ?>
.testify-testimonials ul.slides {
margin-top: <?php echo esc_html($fontSize * 1.5); ?>px;
}
<?php } ?>
@media (max-width: 900px) {
.testify-testimonials .slides .testimonial-image {
<?php if ($imageWidth900 && 'thumbnails' !== get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type'])) { ?>
display: block;
max-width: <?php echo esc_html($imageWidth900); ?>px;
<?php } else { ?>
display: none;
<?php } ?>
}
}
@media (max-width: 600px) {
.testify-testimonials .slides .testimonial-image {
<?php if ($imageWidth600 && 'thumbnails' !== get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type'])) { ?>
display: block;
max-width: <?php echo esc_html($imageWidth600); ?>px;
<?php } else { ?>
display: none;
<?php } ?>
}
}
@media (max-width: 400px) {
.testify-testimonials .slides .testimonial-image {
<?php if ($imageWidth400 && 'thumbnails' !== get_theme_mod('testify_nav_type', $testifyOptionsDefaults['nav_type'])) { ?>
display: block;
max-width: <?php echo esc_html($imageWidth400); ?>px;
<?php } else { ?>
display: none;
<?php } ?>
}
}
</style>
<?php
}
add_action( 'wp_head', 'testify_wp_head' );
function testify_admin_menu() {
$hasLicenseKey = AGS_TESTIFY_has_license_key();
//
// "Customize" menu item
if ($hasLicenseKey) {
// from testify/includes/instructions.php
if ( isset($_SERVER['REQUEST_URI'][0]) && $_SERVER['REQUEST_URI'][0] == '/' ) {
$returnUrl = wp_sanitize_redirect($_SERVER['REQUEST_URI']);
}
add_submenu_page('edit.php?post_type=testify-testimonial', '', __('Customize', 'testify-testify'), 'edit_theme_options', 'customize.php?autofocus[panel]=testify_panel'.(isset($returnUrl) ? '&return=' . rawurlencode($returnUrl) : '') );
}
// Admin page
add_submenu_page('edit.php?post_type=testify-testimonial', esc_html__('About & Instructions', 'testify-testify'), esc_html__('About & Instructions', 'testify-testify'), 'edit_posts', 'testify-about', 'testify_admin_page');
// License key check
global $pagenow;
if (!$hasLicenseKey &&
// phpcs:disable WordPress.Security.NonceVerification -- this is a read-only function so a nonce is not necessary
(($pagenow == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'testify-testimonial' && (!isset($_GET['page']) || $_GET['page'] != 'testify-about'))
|| ($pagenow == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'testify-testimonial')
|| ($pagenow == 'edit-tags.php' && isset($_GET['taxonomy']) && ($_GET['taxonomy'] == 'testify-cat' || $_GET['taxonomy'] == 'testify-tag')))) {
// phpcs:enable WordPress.Security.NonceVerification -- this is a read-only function so a nonce is not necessary
wp_redirect(admin_url(AGS_TESTIFY_PLUGIN_PAGE));
exit;
}
}
add_action('admin_menu', 'testify_admin_menu');
function testify_admin_page() {
(AGS_TESTIFY_has_license_key() ? include( TESTIFY_PLUGIN_DIR . '/includes/instructions.php') : AGS_TESTIFY_activate_page());
}
add_action( 'init', 'testify_init', 1);
function testify_init() {
// Load textdomain
load_plugin_textdomain('testify-testify', false, TESTIFY_PLUGIN_DIR . '/lang');
include( TESTIFY_PLUGIN_DIR . '/includes/post-types.php');
include( TESTIFY_PLUGIN_DIR . '/includes/meta.php');
// Load integrations
if (defined('CFCORE_VER')) { // Caldera Forms
require_once(TESTIFY_INTEGRATIONS_DIR.'CalderaTestifyIntegration.class.php');
CalderaTestifyIntegration::testifyIntegrationInit();
}
if (class_exists( 'WPForms' ))
{
require_once(TESTIFY_INTEGRATIONS_DIR.'WPForms.class.php');
WPFormsIntegration::init();
}
if (class_exists( 'WPCF7' ))
{
require_once(TESTIFY_INTEGRATIONS_DIR.'WPCF7.class.php');
WPCF7Integration::init();
}
// Temporarily disabled
/*if (class_exists('FrmAppController'))
{
require_once(TESTIFY_INTEGRATIONS_DIR.'Formidable.class.php');
FormidableIntegration::init();
}*/
}
// For register action in Ninja Forms
add_filter( 'ninja_forms_register_actions', 'testify_init_integration_ninja_forms' );
/**
* register action in ninja Email & Action tab
*/
function testify_init_integration_ninja_forms( $actions ) {
require_once( TESTIFY_INTEGRATIONS_DIR . 'ninja-forms/NinjaFormsTestifyIntegration.php' );
$actions['ags_testify'] = new AGS_NF_Testify_Action();
return $actions;
}
// Gravity Forms integration
add_action('gform_loaded', 'testify_init_integration_gravity_forms');
function testify_init_integration_gravity_forms() {
if (method_exists('GFForms', 'include_feed_addon_framework')) {
require_once(TESTIFY_INTEGRATIONS_DIR.'GravityFormsTestifyIntegration.class.php');
GravityFormsTestifyIntegration::testifyIntegrationInit();
}
}
add_action( 'widgets_init', 'testify_widgets_init');
function testify_widgets_init() {
register_widget('Testify_Widget');
}
// The following function includes code based on and/or copied from WordPress
// See license.txt for copyright and licensing details
// Modified by Jonathan Hall, Dominika Rauk and/or others; last modified 2020-08-28
function testify_get_options() {
global $testify_options;
if (!isset($testify_options)) {
$customizerLabelsAllowedHtml = array('code');
$fontWeightOptions = array(
100 => 100,
200 => 200,
300 => 300,
400 => __('400 (normal)', 'testify-testify'),
500 => 500,
600 => 600,
700 => __('700 (bold)', 'testify-testify'),
800 => 800,
900 => 900
);
$thumbPerRowOptions = array(0=>0,1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,10=>10,11=>11,12=>12);
$testify_options = array(
'testimonials' => array(
'name' => __('Testimonials', 'testify-testify'),
'settings' => array(
'sep_show' => array(
'name' => __('Show Separator', 'testify-testify'),
'type' => 'checkbox',
'default' => 1
),
'sep_height' => array(
'name' => __('Separator Thickness (px)', 'testify-testify'),
'type' => 'integer',
'default' => 2
),
'count' => array(
'name' => __( 'Number of Testimonials', 'testify-testify' ),
'type' => 'integer',
'default' => 10
),
'order' => array(
'name' => __( 'Testimonial Order', 'testify-testify' ),
'type' => 'select',
'options' => array(
'date_desc' => __( 'Newest First', 'testify-testify' ),
'date_asc' => __( 'Oldest First', 'testify-testify' ),
'random' => __( 'Random', 'testify-testify' )
),
'default' => 'date_desc',
'sanitize_cb' => 'testify_sanitize_order'
),
'align' => array(
'name' => __( 'Alignment', 'testify-testify' ),
'type' => 'select',
'options' => array(
'left' => __( 'Left', 'testify-testify' ),
'center' => __( 'Center', 'testify-testify' ),
'right' => __( 'Right', 'testify-testify' )
),
'default' => 'center',
'sanitize_cb' => 'testify_sanitize_align'
),
'nav_type' => array(
'name' => __( 'Navigation Type', 'testify-testify' ),
'type' => 'select',
'options' => array(
'' => __( 'None', 'testify-testify' ),
'dots' => __( 'Dots', 'testify-testify' ),
'thumbnails' => __( 'Thumbnails', 'testify-testify' )
),
'default' => 'thumbnails',
'sanitize_cb' => 'testify_sanitize_nav_type'
),
'readmore' => array(
'name' => __( 'Show Read More Button', 'testify-testify' ),
'type' => 'checkbox',
'default' => 'off'
),
'readmore_limit' => array(
'name' => __( 'Testimonial length', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
),
'readmore_morelink' => array(
'name' => __( 'Read More Text', 'testify-testify' ),
'type' => 'text',
'description' => wp_kses(__( 'Change link text to show when text is collapsed.', 'testify-testify' ), $customizerLabelsAllowedHtml),
'default' => 'Read More'
),
'readmore_lesslink' => array(
'name' => __( 'Read Less Text', 'testify-testify' ),
'type' => 'text',
'description' => wp_kses(__( 'Change link text to show when text is expanded.', 'testify-testify'), $customizerLabelsAllowedHtml),
'default' => 'Read Less'
),
'readmore_font' => array(
'name' => __( 'Read More Font', 'testify-testify' ),
'type' => 'select',
'options' => testify_get_fonts_options(),
'default' => 'Arial',
),
'readmore_font_size' => array(
'name' => __( 'Read More Font Size', 'testify-testify' ),
'type' => 'range',
'mobile_options' => true,
'default' => '16',
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
),
'readmore_color' => array(
'name' => __( 'Read More Text Color', 'testify-testify' ),
'type' => 'color',
'custom_color' => true,
'default' => '#2ea3f2'
),
'readmore_letter_spacing' => array(
'name' => __( 'Read More Letter Spacing', 'testify-testify' ),
'type' => 'range',
'mobile_options' => true,
'default' => '2',
'range_settings' => array(
'min' => '0',
'max' => '100',
'step' => '1',
),
),
'readmore_use_icon' => array(
'name' => __( 'Add Read More Icon', 'testify-testify' ),
'type' => 'checkbox',
'default' => 'on',
'options' => array(
'on' => __( 'Yes', 'testify-testify' ),
'off' => __( 'No', 'testify-testify' ),
),
'label' => __( 'Read More Icon', 'testify-testify' ),
'title' => __( 'Read More Icon', 'testify-testify' )
),
'readmore_icon' => array(
'name' => __( 'Read More Icon', 'testify-testify' ),
'type' => 'icon',
'class' => array( 'testify-font-icon' ),
'default' => '%%21%%',
),
'readmore_icon_color' => array(
'name' => __( 'Read More Icon Color', 'testify-testify' ),
'type' => 'color',
'custom_color' => true,
'default' => '#2ea3f2'
),
'readmore_icon_placement' => array(
'name' => __( 'Read More Icon Placement', 'testify-testify' ),
'type' => 'select',
'options' => array(
'right' => __( 'Right', 'testify-testify' ),
'left' => __( 'Left', 'testify-testify' ),
),
'default' => 'right',
),
'readmore_less_icon' => array(
'name' => __( 'Read Less Icon', 'testify-testify' ),
'type' => 'icon',
'class' => array( 'testify-font-icon' ),
'default' => '%%24%%',
),
'readmore_less_icon_color' => array(
'name' => __( 'Read Less Icon Color', 'testify-testify' ),
'type' => 'color',
'custom_color' => true,
'default' => '#2ea3f2'
),
'readmore_less_icon_placement' => array(
'name' => __( 'Read Less Icon Placement', 'testify-testify' ),
'type' => 'select',
'options' => array(
'right' => __( 'Right', 'testify-testify' ),
'left' => __( 'Left', 'testify-testify' ),
),
'default' => 'right',
),
'nav_arrows' => array(
'name' => __( 'Show Prev./Next Arrows', 'testify-testify' ),
'type' => 'checkbox',
'default' => 0,
'desc' => wp_kses(__('Arrows will not be visible on devices with small screens.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'qmark' => array(
'name' => __( 'Quotation Mark Image', 'testify-testify' ),
'type' => 'qmark',
'default' => 1
),
'qmark_width' => array(
'name' => __( 'Quotation Mark Size', 'testify-testify' ),
'type' => 'integer',
'default' => 38,
'desc' => wp_kses(__('Width in pixels. Height will be scaled proportionally. Do not include <code>px</code>.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'font_family' => array(
'name' => __( 'Testimonial Font Family', 'testify-testify' ),
'type' => 'font',
'default' => 'Georgia, Times New Roman, serif',
),
'font_italic' => array(
'name' => __( 'Italic', 'testify-testify' ),
'type' => 'checkbox',
'default' => 0
),
'text_uppercase' => array(
'name' => __( 'Uppercase', 'testify-testify' ),
'type' => 'checkbox',
'default' => 0
),
'font_weight' => array(
'name' => __( 'Testimonial Font Weight', 'testify-testify' ),
'type' => 'select',
'options' => $fontWeightOptions,
'default' => 400,
'sanitize_cb' => 'testify_sanitize_font_weight'
),
'font_size' => array(
'name' => __( 'Testimonial Font Size (px)', 'testify-testify' ),
'type' => 'integer',
'default' => 34,
'desc' => wp_kses(__('Do not include <code>px</code>.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'font_family_author' => array(
'name' => __( 'Author Font Family', 'testify-testify' ),
'type' => 'font',
'default' => 'Georgia, Times New Roman, serif'
),
'font_italic_author' => array(
'name' => __( 'Italic', 'testify-testify' ),
'type' => 'checkbox',
'default' => 0
),
'text_uppercase_author' => array(
'name' => __( 'Uppercase', 'testify-testify' ),
'type' => 'checkbox',
'default' => 0
),
'font_weight_author' => array(
'name' => __( 'Author Font Weight', 'testify-testify' ),
'type' => 'select',
'options' => $fontWeightOptions,
'default' => 400,
'sanitize_cb' => 'testify_sanitize_font_weight'
),
'font_size_author' => array(
'name' => __( 'Author Font Size (px)', 'testify-testify' ),
'type' => 'integer',
'default' => 20,
'desc' => wp_kses(__('Do not include <code>px</code>.', 'testify-testify'), $customizerLabelsAllowedHtml)
)
)
),
'testimonial_images' => array(
'name' => __( 'Testimonial Images', 'testify-testify' ),
'short_name' => __( 'Images', 'testify-testify' ),
'settings' => array(
'image_width' => array(
'name' => __( 'Maximum Image Width', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
'desc' => wp_kses(__('Do not include <code>px</code>. Specify <code>0</code> to hide.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_width_900' => array(
'name' => __( 'Maximum Image Width (<= 900px)', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
'desc' => wp_kses(__('Do not include <code>px</code>. Specify <code>0</code> to hide.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_width_600' => array(
'name' => __( 'Maximum Image Width (<= 600px)', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
'desc' => wp_kses(__('Do not include <code>px</code>. Specify <code>0</code> to hide.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_width_400' => array(
'name' => __( 'Maximum Image Width (<= 400px)', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
'desc' => wp_kses(__('Do not include <code>px</code>. Specify <code>0</code> to hide.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_size' => array(
'name' => __( 'Image Resolution (px)', 'testify-testify' ),
'type' => 'integer',
'default' => 0,
'desc' => wp_kses(__('Pixel resolution of the testimonial image to request from WordPress (example: enter <code>150</code> for 150x150). Does not affect the display size of the image. Do not include <code>px</code>. Enter <code>0</code> to use the original (non-resized) image.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_shape' => array(
'name' => __( 'Image Shape', 'testify-testify' ),
'type' => 'select',
'options' => array('square' => 'Square', 'circle' => 'Circle'),
'default' => 'circle',
'sanitize_cb' => 'testify_sanitize_image_shape'
),
'image_border_width' => array(
'name' => __( 'Border Width', 'testify-testify' ),
'type' => 'integer',
'default' => 5,
'desc' => wp_kses(__('Do not include <code>px</code>. Specify <code>0</code> to hide.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'image_shadow' => array(
'name' => __( 'Show drop shadow', 'testify-testify' ),
'type' => 'checkbox',
'default' => 1
),
)
),
'thumbnails' => array(
'name' => __( 'Thumbnail Navigation', 'testify-testify' ),
'short_name' => __( 'Thumbnail Nav.', 'testify-testify' ),
'settings' => array(
'thumb_per_row' => array(
'name' => __( 'Thumbnails Per Row', 'testify-testify' ),
'type' => 'select',
'options' => $thumbPerRowOptions,
'default' => 5,
'sanitize_cb' => 'testify_sanitize_thumb_per_row'
),
'thumb_per_row_900' => array(
'name' => __( 'Thumbnails Per Row (<= 900px)', 'testify-testify' ),
'type' => 'select',
'options' => $thumbPerRowOptions,
'default' => 5,
'sanitize_cb' => 'testify_sanitize_thumb_per_row'
),
'thumb_per_row_600' => array(
'name' => __( 'Thumbnails Per Row (<= 600px)', 'testify-testify' ),
'type' => 'select',
'options' => $thumbPerRowOptions,
'default' => 5,
'sanitize_cb' => 'testify_sanitize_thumb_per_row'
),
'thumb_per_row_400' => array(
'name' => __( 'Thumbnails Per Row (<= 400px)', 'testify-testify' ),
'type' => 'select',
'options' => $thumbPerRowOptions,
'default' => 3,
'sanitize_cb' => 'testify_sanitize_thumb_per_row'
),
'thumb_width' => array(
'name' => __( 'Thumbnail Image Resolution (px)', 'testify-testify' ),
'type' => 'integer',
'default' => 150,
'desc' => wp_kses(__('Pixel resolution of the thumbnail image to request from WordPress (example: enter <code>150</code> for 150x150). Does not affect the display size of the thumbnails. Do not include <code>px</code>. Enter <code>0</code> to use the original (non-resized) images.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'thumb_spacing' => array(
'name' => __( 'Thumbnail Spacing (px)', 'testify-testify' ),
'type' => 'integer',
'default' => 0,
'desc' => wp_kses(__('Do not include <code>px</code>.', 'testify-testify'), $customizerLabelsAllowedHtml)
)
)
),
'colors' => array(
'name' => __( 'Colors', 'testify-testify' ),
'settings' => array(
'thumb_row_bgcolor' => array(
'name' => __( 'Thumbnail Row Background Color', 'testify-testify' ),
'type' => 'color',
'default' => '#ffffff'
),
'thumb_inactive_color' => array(
'name' => __( 'Inactive Thumbnail Color', 'testify-testify' ),
'type' => 'color',
'default' => '#ffffff'
),
'bgcolor' => array(
'name' => __( 'Testimonial Background Color', 'testify-testify' ),
'type' => 'color',
'default' => 'rgba(255,255,255,0)'
),
'text_color' => array(
'name' => __( 'Testimonial Text Color', 'testify-testify' ),
'type' => 'color',
'default' => '#222222'
),
'text_color_author' => array(
'name' => __( 'Author Text Color', 'testify-testify' ),
'type' => 'color',
'default' => '#222222'
),
'qmark_color' => array(
'name' => __( 'Quotation Mark Color', 'testify-testify' ),
'type' => 'color',
'default' => '#666666'
),
'sep_color' => array(
'name' => __( 'Separator Color', 'testify-testify' ),
'type' => 'color',
'default' => '#cccccc'
),
'image_border_color' => array(
'name' => __( 'Image Border Color', 'testify-testify' ),
'type' => 'color',
'default' => '#ffffff'
),
)
),
'transitions' => array(
'name' => __( 'Slideshow', 'testify-testify' ),
'settings' => array(
'autoplay_duration' => array(
'name' => __( 'Autoplay Duration (milliseconds)', 'testify-testify' ),
'type' => 'integer',
'default' => 4000,
'desc' => wp_kses(__('Set to <code>0</code> to disable autoplay.', 'testify-testify'), $customizerLabelsAllowedHtml)
),
'transition_type' => array(
'name' => __( 'Transition Type', 'testify-testify' ),
'type' => 'select',
'options' => array(
'none' => __( 'None', 'testify-testify' ),
'fade' => __( 'Fade', 'testify-testify' ),
'slide' => __( 'Slide', 'testify-testify' )
),
'default' => 'fade'
),
'transition_duration' => array(
'name' => __( 'Transition Duration (milliseconds)', 'testify-testify' ),
'type' => 'integer',
'default' => 500
)
)
)
);
}
return $testify_options;
}
function testify_get_options_defaults() {
global $testify_options_defaults;
if (!isset($testify_options_defaults)) {
$testify_options_defaults = array();
foreach (testify_get_options() as $category) {
foreach ($category['settings'] as $settingId => $setting) {
$testify_options_defaults[$settingId] = $setting['default'];
}
}
}
// The following defaults are only used in the Divi integration
$testify_options_defaults['readmore_icon_et'] = '%%18%%';
$testify_options_defaults['readmore_less_icon_et'] = '%%17%%';
return $testify_options_defaults;
}
function testify_get_options_current() {
$defaultOptions = testify_get_options_defaults();
$currentOptions = array();
$skipSettings = array('readmore_icon_et','readmore_less_icon_et');
foreach ($defaultOptions as $settingId => $defaultValue) {
if (in_array($settingId, $skipSettings)) {
$currentOptions[$settingId] = $defaultValue;
} else {
$currentOptions[$settingId] = get_theme_mod('testify_'.$settingId, $defaultValue);
if ($settingId == 'readmore_icon' || $settingId == 'readmore_less_icon') {
// For some reason, these setting values sometimes only have one % at start and end
$valueLength = strlen($currentOptions[$settingId]);
if (
$valueLength > 2
&& $currentOptions[$settingId][0] == '%' && $currentOptions[$settingId][1] != '%'
&& $currentOptions[$settingId][$valueLength - 1] == '%' && $currentOptions[$settingId][$valueLength - 2] != '%'
) {
$currentOptions[$settingId] = '%'.$currentOptions[$settingId].'%';
}
}
}
}
return $currentOptions;
}
add_filter('mce_buttons', 'testify_mce_buttons', 9999);
function testify_mce_buttons($buttons) {
$buttons[] = 'testify';
return $buttons;
}
add_filter('mce_external_plugins', 'testify_mce_external_plugins');
function testify_mce_external_plugins($plugins) {
$plugins['testify'] = plugins_url('/js/tinymce-plugin.js', __FILE__ );
return $plugins;
}
add_filter('tiny_mce_before_init', 'testify_tiny_mce_before_init');
function testify_tiny_mce_before_init($params) {
$params['testify_shortcode_dialog_nonce'] = wp_create_nonce('testify_shortcode_dialog');
return $params;
}
add_action('wp_ajax_testify_shortcode_dialog', 'testify_shortcode_dialog');
function testify_shortcode_dialog() {
check_ajax_referer('testify_shortcode_dialog', 'nonce');
include( TESTIFY_PLUGIN_DIR . '/includes/shortcode-dialog.php');
wp_die();
}
add_action('wp_ajax_testify_get_shortcode', 'testify_get_shortcode');
function testify_get_shortcode() {
check_ajax_referer('testify_get_shortcode', 'nonce');
$testifyOptions = array();
foreach (testify_get_options() as $category) {
$testifyOptions = array_merge($testifyOptions, $category['settings']);
}
foreach ($testifyOptions as $settingId => $setting) {
if ($setting['type'] == 'checkbox') {
if (!isset($_POST[$settingId])) {
$_POST[$settingId] = 0;
}
}
}
$params = array();
foreach (array_intersect_key($_POST, $testifyOptions) as $key => $value) {
if (!empty($testifyOptions[$key]['sanitize_cb'])) {
$params[$key] = call_user_func($testifyOptions[$key]['sanitize_cb'], $value);
} else {
switch ($testifyOptions[$key]['type']) {
case 'integer':
case 'qmark':
$params[$key] = call_user_func('testify_sanitize_integer', $value);
break;
case 'decimal':
$params[$key] = call_user_func('testify_sanitize_decimal', $value);
break;
case 'checkbox':
$params[$key] = call_user_func('testify_sanitize_boolean', $value);
break;
default:
$params[$key] = call_user_func('testify_sanitize_text', $value);
}
}
}
if (!empty($_POST['tax_input']['testify-cat'])) {
// phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized -- there is a numeric type check for each array element in the loop
foreach ((array) $_POST['tax_input']['testify-cat'] as $catId) {
if (is_numeric($catId)) {
$params['category'] .= (empty($params['category']) ? '' : ',').$catId;
}
}
}
if (!empty($_POST['tax_input']['testify-tag'])) {
// phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized -- there is a numeric type check for each array element in the loop
foreach ((array) $_POST['tax_input']['testify-tag'] as $tagId) {
if (is_numeric($tagId)) {
$params['tag'] .= (empty($params['tag']) ? '' : ',').$tagId;
}
}
}
$shortcode = '[testify';
foreach ($params as $key => $value) {
$shortcode .= ' '.$key.'='.(is_numeric($value) ? $value : '"'.str_replace('"', '\'', $value).'"');
}
$shortcode .= ']';
echo(wp_json_encode(array('shortcode' => $shortcode)));
wp_die();
}
add_action('wp_ajax_testify_refresh_vb', 'testify_visual_builder_refresh');
function testify_visual_builder_refresh() {
// phpcs:disable WordPress.Security.NonceVerification -- this is a read-only function so a nonce is not necessary
if ( isset( $_POST['props'] ) ) {
// phpcs:ignore ET.Sniffs.ValidatedSanitizedInput.InputNotSanitized -- the input will be validated via the json function below and when rendering the shortcode (as needed)
$component_props = $_POST['props'];
$component_props_obj = json_decode(wp_unslash($component_props), TRUE);
define('AGS_TESTIFY_AJAX_RENDERING', true);
require_once(TESTIFY_PLUGIN_DIR.'/includes/modules/Testify/Testify.php');
$result = ags_testify_get_html($component_props_obj);
echo wp_json_encode( $result );
}
wp_die();
// phpcs:enable WordPress.Security.NonceVerification
}
/*
* Widget code copied from WordPress - wp-includes/widgets/class-wp-widget-text.php
* See license.txt for licensing details
* Modified by Jonathan Hall, Dominika Rauk and/or others; last modified 2020-08-28
*/
class Testify_Widget extends WP_Widget {
public function __construct() {
$widget_ops = array(
'classname' => 'testify-widget',
'description' => __( 'Display testimonials from the Testify plugin.', 'testify-testify' ),
/*'customize_selective_refresh' => true,*/
// https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/
);
parent::__construct( 'testify_widget', __( 'Testify', 'testify-testify' ), $widget_ops );
}
public function widget( $args, $instance ) {
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
$widget_text = ! empty( $instance['text'] ) ? $instance['text'] : '';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- this arg can include HTML and should be passed HTML-safe
echo $args['before_widget'];
if ( ! empty( $title ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- before/after args can include HTML and should be passed HTML-safe; title may be escaped by filter
echo $args['before_title'] . $title . $args['after_title'];
}
require_once( TESTIFY_PLUGIN_DIR . '/includes/shortcode.php');
testify_shortcode_output($instance);
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- this arg can include HTML and should be passed HTML-safe
echo $args['after_widget'];
}
public function update( $new_instance, $old_instance ) {
$testifyOptions = array();
foreach (testify_get_options() as $category) {
$testifyOptions = array_merge($testifyOptions, $category['settings']);
}
foreach ($testifyOptions as $settingId => $setting) {
if ($setting['type'] == 'checkbox') {
if (!isset($new_instance[$settingId])) {
$new_instance[$settingId] = 0;
}
}
}
$instance = array();
foreach (array_intersect_key(array_merge(testify_get_options_defaults(), $old_instance, $new_instance), $testifyOptions) as $key => $value) {
if (!empty($testifyOptions[$key]['sanitize_cb'])) {
$instance[$key] = call_user_func($testifyOptions[$key]['sanitize_cb'], $value);
} else {
switch ($testifyOptions[$key]['type']) {
case 'integer':
case 'qmark':
$instance[$key] = call_user_func('testify_sanitize_integer', $value);
break;
case 'decimal':
$instance[$key] = call_user_func('testify_sanitize_decimal', $value);
break;
case 'checkbox':
$instance[$key] = call_user_func('testify_sanitize_boolean', $value);
break;
default:
$instance[$key] = call_user_func('testify_sanitize_text', $value);
}
}
}
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['category'] = array();
if (isset($new_instance['category'])) {
foreach ($new_instance['category'] as $catId) {
if (is_numeric($catId)) {
$instance['category'][] = $catId;
}
}
}
$instance['tag'] = array();
if (isset($new_instance['tag'])) {
foreach ($new_instance['tag'] as $tagId) {
if (is_numeric($tagId)) {
$instance['tag'][] = $tagId;
}
}
}
return $instance;
}
public function form( $instance ) {
$testifyOptions = testify_get_options();
$testifyOptionsCurrent = testify_get_options_current();
$instance = wp_parse_args( (array) $instance, $testifyOptionsCurrent );
include( TESTIFY_PLUGIN_DIR . '/includes/widget-form.php');
}
}
// End widget code copied from WordPress
// Add Caldera affiliate ID
add_filter( 'caldera_forms_affiliate_id', 'testify_caldera_forms_affiliate_id');
function testify_caldera_forms_affiliate_id() {
return 57;
}
/* Divi */
if ( ! function_exists( 'testify_initialize_extension' ) ) {
/**
* Creates the extension's main class instance.
*
* @since 1.0.0
*/
function testify_initialize_extension() {
require_once plugin_dir_path(__FILE__) . 'includes/Testify.php';
}
add_action('divi_extensions_init', 'testify_initialize_extension');
}
/**
* Manage "Testify Testimonial" post type columns
*
* Adds new columns:
* - Image
* - Author
* - Content
* - Rating
*/
add_filter('manage_testify-testimonial_posts_columns', 'testify_post_type_columns');
function testify_post_type_columns($columns) {
return array(
'cb' => $columns['cb'],
'testimonial-image' => '',
'title' => __('Title', 'testify-testify'),
'testimonial-author' => __('Testimonial Author', 'testify-testify'),
'testimonial-content' => __('Testimonial Content', 'testify-testify'),
'testimonial-rating' => __('Rating', 'testify-testify'),
'taxonomy-testify-cat' => __('Testimonial Categories', 'testify-testify'),
'date' => __('Date', 'testify-testify')
);
}
add_action('manage_testify-testimonial_posts_custom_column', 'fill_testify_post_type_columns', 10, 2);
function fill_testify_post_type_columns($column, $testimonial_id) {
switch ( $column ) {
case 'testimonial-image' :
if ( has_post_thumbnail($testimonial_id) ) {
$image = get_the_post_thumbnail_url($testimonial_id, 'thumbnail');
} else {
$image = plugin_dir_url(__FILE__) . '/img/thumbnail-placeholder.png';
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML oputput
echo '<img src="' . esc_url($image) . '" width="30px" height="30px" alt>';
break;
case 'testimonial-author' :
$author = get_post_meta($testimonial_id, 'testimonial-author', true);
echo esc_html($author) ?:
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML oputput
'<span aria-hidden="true">—</span>';
break;
case 'testimonial-content' :
$content = wp_trim_words(apply_filters('the_content', get_post_field('post_content', $testimonial_id)), 13, '...');
echo esc_html($content) ?:
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML oputput
'<span aria-hidden="true">—</span>';
break;
case 'testimonial-rating' :
$rating = get_post_meta($testimonial_id, 'testimonial-rating', true);
echo esc_html($rating) ?:
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- HTML oputput
'<span aria-hidden="true">—</span>';
break;
}
}