Skip to content

Commit

Permalink
Merge pull request #321 from WPChill/3.0.0
Browse files Browse the repository at this point in the history
3.0.0
  • Loading branch information
giucu91 authored Jul 18, 2022
2 parents 9325f43 + d73aa8b commit c3eb878
Show file tree
Hide file tree
Showing 71 changed files with 1,900 additions and 1,323 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "includes/submodules/banner"]
path = includes/submodules/banner
url = https://github.com/WPChill/wpchill-welcome-banner
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ module.exports = function( grunt ) {

clean: {
css: [ 'assets/css/*.min.css', '!assets/css/jquery-ui.min.css' ],
js: [ 'public/js/*.min.js', 'public/js/**/*.min.js' ],
init: {
src: ['build/']
},
Expand Down
277 changes: 79 additions & 198 deletions admin/about/class-strong-testimonials-welcome.php

Large diffs are not rendered by default.

23 changes: 0 additions & 23 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ function wpmtst_update_check() {
if ( $version == WPMTST_VERSION ) {
return;
}
// Redirect to About page afterwards. On new install or (de)activation only.
if ( false === $version ) {
add_option( 'wpmtst_do_activation_redirect', true );
}

Strong_Testimonials_Updater::update();
}
Expand All @@ -52,12 +48,6 @@ function wpmtst_update_check() {
* Initialize.
*/
function wpmtst_admin_init() {
/**
* Redirect to About page for new installs only
*
* @since 2.28.4
*/
wpmtst_activation_redirect();

/**
* Custom action hooks
Expand Down Expand Up @@ -85,19 +75,6 @@ function wpmtst_action_captcha_options_changed() {

add_action( 'admin_action_captcha-options-changed', 'wpmtst_action_captcha_options_changed' );

/**
* Redirect to About page.
*
* @since 2.28.4
*/
function wpmtst_activation_redirect() {
if ( get_option( 'wpmtst_do_activation_redirect', false ) ) {
delete_option( 'wpmtst_do_activation_redirect' );
wp_redirect( admin_url( 'index.php?page=wpmtst-getting-started' ) );
exit;
}
}

/**
* Are we on a testimonial admin screen?
*
Expand Down
115 changes: 115 additions & 0 deletions admin/challenge/modal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/**
* Challenge main class
*
* @since 2.6.8
*
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}


class ST_Challenge_Modal{


public function __construct(){

if( is_admin() && $this->show_challenge() && 1 == get_option( 'wpmtst-challenge', 1 ) ){
add_action( 'admin_footer', array( $this, 'challenge_render' ), 99 );
add_action( 'admin_enqueue_scripts', array( $this, 'challenge_scripts' ) );
add_action( 'wp_ajax_wpmtst_challenge_hide', array( $this, 'wpmtst_challenge_hide' ) );
}

}

public function challenge_render(){

$new_gallery_url = add_query_arg(
array(
'post_type' => 'wpm-testimonial',
),
admin_url( 'post-new.php' )
);

?>
<div class="wpmtst-challenge-wrap">
<div class="wpmtst-challenge-header">
<span id="wpmtst-challenge-close" class="dashicons dashicons-no-alt"></span>
<p><?php echo wp_kses_post( __( 'Start enjoying <strong>Strong Testimonials</strong> by adding your first testimonial.', 'strong-testimonials' ) ); ?></p>
</div>
<div class="wpmtst-challenge-list">
<p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Primul lucru din lista', 'strong-testimonials' ); ?></p>
<p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 2-lea lucru din lista', 'strong-testimonials' ); ?></p>
<p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 3-lea lucru din lista', 'strong-testimonials' ); ?></p>
<p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 4-lea lucru din lista', 'strong-testimonials' ); ?></p>
<p><span class="wpmtst-challenge-marker"></span> <?php esc_html_e( 'Al 5-lea lucru din lista', 'strong-testimonials' ); ?></p>
</div>
<div class="wpmtst-challenge-footer">
<img src="<?php echo esc_url( WPMTST_URL . 'admin/img/mascot.png' ); ?>" class="wpmtst-challenge-logo"/>
<div>
<h3>Strong Testimonials</h3>
<p><span class="wpmtst-challenge-time">5:00</span> remaining.</p>
</div>
</div>
<div class="wpmtst-challenge-footer-button">
<a id="wpmtst-challenge-button" href="<?php echo esc_url( $new_gallery_url ); ?>" class="wpmtst-btn wpmtst-challenge-btn"><?php esc_html_e( 'Create First Gallery', 'strong-testimonials' ); ?></a>
</div>

</div>
<?php
}

public function challenge_scripts( $hook ) {

wp_enqueue_style( 'wpmtst-challenge-style', WPMTST_URL . 'assets/css/challenge.css', array(), true );
wp_enqueue_script( 'wpmtst-challenge-script', WPMTST_URL . 'assets/js/challenge.js', array( 'jquery' ), '1.0.0', true );
$args = array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'wpmtst-challenge' ),
);
wp_localize_script( 'wpmtst-challenge-script', 'wpmtstChallenge', $args );

}

public function show_challenge(){
$args = array(
'numberposts' => 1,
'post_status' => 'any, trash',
'post_type' => 'wpm-testimonial'
);

if( !isset( $_GET['post_type'] ) || 'wpm-testimonial' !== $_GET['post_type'] ){
return false;
}

if( empty( get_posts( $args ) ) ){
return true;
}

return false;

}
public function wpmtst_challenge_hide(){

$nonce = '';

if( isset( $_POST['nonce'] ) ){

$nonce = $_POST['nonce'];
}

if ( ! wp_verify_nonce( $nonce, 'wpmtst-challenge' ) ) {
wp_send_json_error();
die();
}

update_option( 'wpmtst-challenge', 0 );
wp_send_json_success();
wp_die();
}

}
new ST_Challenge_Modal();
?>
11 changes: 10 additions & 1 deletion admin/class-strong-testimonials-addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,16 @@ public function reload_extensions() {
die;
}


/**
* Retrieves ST addons
*
* @return Array
*
* @since 2.51.7
*/
public function get_addons() {
return $this->check_for_addons();
}

}

Expand Down
2 changes: 1 addition & 1 deletion admin/class-strong-testimonials-admin-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static function edit_columns( $columns ) {
// 4. add custom fields
foreach ( $fields as $key => $field ) {

if ( $field['admin_table'] ) {
if ( isset( $field['admin_table'] ) ) {

if ( 'post_title' == $field['name'] ) {
continue;
Expand Down
24 changes: 7 additions & 17 deletions admin/class-strong-testimonials-admin-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,7 @@ public static function admin_register() {
WPMTST_ASSETS_CSS . 'admin-global.css',
array(),
$plugin_version );

wp_register_style(
'wpmtst-admin-welcome-style',
WPMTST_ASSETS_CSS . 'admin-welcome.css',
array(),
$plugin_version );

wp_register_style(
'wpmtst-admin-upsells-style',
WPMTST_ASSETS_CSS . 'admin-upsells.css',
array(),
$plugin_version );


wp_register_style(
'wpmtst-admin-style',
WPMTST_ASSETS_CSS . 'admin.css',
Expand All @@ -89,6 +77,11 @@ public static function admin_register() {
array( ),
$plugin_version );

wp_register_style( 'wpmtst-lite-vs-pro',
WPMTST_ADMIN_URL . 'css/lite-vs-pro.css',
array( ),
$plugin_version );

wp_register_script( 'wpmtst-custom-spinner',
WPMTST_ADMIN_URL . 'js/custom-spinner.js',
array( 'jquery' ),
Expand Down Expand Up @@ -267,10 +260,7 @@ public static function admin_enqueue_scripts() {
'templateTagTitle' => esc_html__( 'click to insert into message at caret', 'strong-testimonials' ),
)
);

if ( $screen->id === 'dashboard_page_wpmtst-getting-started' ) {
wp_enqueue_style( 'wpmtst-admin-welcome-style' );
}

}

/**
Expand Down
138 changes: 138 additions & 0 deletions admin/class-strong-testimonials-lite-vs-pro-page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php
/**
* Class Strong_Testimonials_Addons
*
*/
class Strong_Testimonials_Lite_vs_PRO_page {

public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
add_filter( 'wpmtst_submenu_pages', array( $this, 'add_submenu' ) );

// Upgrade to PRO plugin action link
add_filter( 'plugin_action_links_' . WPMTST_PLUGIN, array( $this, 'filter_action_links' ), 60 );
}

/**
* Add the Upgrade to PRO plugin action link
*
* @param $links
*
* @return array
*
* @since 2.51.7
*/
public function filter_action_links( $links ) {

if ( apply_filters( 'st_plugins_upgrade_pro', true ) ) {

$links = array_merge( array ( '<a target="_blank" class="wpmtst-lite-vs-pro" href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials-lite&utm_medium=plugin_settings&utm_campaign=upsell">' . esc_html__( 'Upgrade to PRO!', 'strong-testimonials' ) . '</a>' ), $links );
}
return $links;
}
/**
* Add submenu page.
*
* @param $pages
*
* @return mixed
*/
public function add_submenu( $pages ) {
$pages[99] = $this->get_submenu();
return $pages;
}

public function admin_enqueue_scripts(){
wp_enqueue_style( 'wpmtst-lite-vs-pro' );
}

/**
* Return submenu page parameters.
*
* @return array
*/
public function get_submenu() {
return array(
'page_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
'menu_title' => esc_html__( 'Lite vs Pro', 'strong-testimonials' ),
'capability' => 'strong_testimonials_options',
'menu_slug' => 'strong-testimonials-lite-vs-pro',
'function' => array( $this, 'render_page' ),
);
}

public function render_page(){

$addons = new Strong_Testimonials_Addons();
?>
<div class="wrap wpmtst-lite-vs-premium">
<hr class="wp-header-end" />
<h1><?php echo esc_html__( 'LITE vs PRO', 'strong-testimonials' ); ?> </h1>
<div class="free-vs-premium">
<!-- Table header -->
<div class="wpchill-plans-table table-header">
<div class="wpchill-pricing-package wpchill-empty">
<!--This is an empty div so that we can have an empty corner-->
</div>
<div class="wpchill-pricing-package wpchill-title">
<p class="wpchill-name"><strong>PRO</strong></p>
</div>
<div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">
<p class="wpchill-name"><strong>LITE</strong></p>
</div>
</div>
<!-- Table content -->

<?php
foreach ( $addons->get_addons() as $pro ) {
?>
<div class="wpchill-plans-table">
<div class="wpchill-pricing-package feature-name">
<h3><?php echo esc_html( $pro['name']); ?></h3>
<p class="tab-header-description wpmtst-tooltip-content">
<?php echo esc_html( $pro['description'] ); ?>
</p>
</div>
<div class="wpchill-pricing-package">
<span class="dashicons dashicons-saved"></span>
</div>
<div class="wpchill-pricing-package">
<span class="dashicons dashicons-no-alt"></span>
</div>
</div>
<?php
}
?>
<!-- Support -->
<div class="wpchill-plans-table">
<div class="wpchill-pricing-package feature-name">
<h3><?php esc_html_e( 'Support', 'strong-testimonials' ); ?></h3>
</div>
<div class="wpchill-pricing-package">Priority</div>
<div class="wpchill-pricing-package"><a href="https://wordpress.org/support/plugin/strong-testimonials/"
target="_blank">wp.org</a>
</div>
</div>
<!-- Table footer -->
<div class="wpchill-plans-table tabled-footer">
<div class="wpchill-pricing-package wpchill-empty">
<!--This is an empty div so that we can have an empty corner-->
</div>
<div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-grid-gallery-business">

<a href="https://strongtestimonials.com/pricing/?utm_source=strong-testimonials&utm_medium=lite-vs-pro&utm_campaign=upsell" target="_blank"
class="button button-primary button-hero "><span class="dashicons dashicons-cart"></span>
<?php esc_html_e( 'Upgrade now!', 'strong-testimonials' ); ?> </a>

</div>
<div class="wpchill-pricing-package wpchill-title wpchill-wpmtst-lite">


</div>
</div>
</div>
</div>
<?php
}
}
new Strong_Testimonials_Lite_vs_PRO_page();
Loading

0 comments on commit c3eb878

Please sign in to comment.