Skip to content

Commit

Permalink
Merge pull request #37 from JetixWP/release-v0.14.0
Browse files Browse the repository at this point in the history
Release v0.14.0
  • Loading branch information
lushkant committed Aug 23, 2024
2 parents 41a4203 + 8c371fc commit ac7612d
Show file tree
Hide file tree
Showing 17 changed files with 577 additions and 45 deletions.
27 changes: 27 additions & 0 deletions assets/css/admin-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,24 @@ body.settings_page_rsfv-settings #wpcontent {
margin-right: 4px;
}

.rsfv .forminp-media-image .media-image {
height: 80px;
width: auto;
max-width: 100%;
display: block;
margin-bottom: 10px;
}

.rsfv .forminp-media-image .rsfv-remove-image-btn {
margin-left: 10px;
}

.rsfv .form-table + div[class*="promo-"] {
margin-top: 30px;
}

.rsfv tr[class*="promo-"] label > a,
.rsfv tr[class*="promo-"] th > a,
.rsfv div[class*="promo-"] > a {
text-decoration: none;
color: currentColor;
Expand Down Expand Up @@ -388,6 +401,20 @@ body.settings_page_rsfv-settings #wpcontent {
outline: none;
}

.rsfv tr[class*="promo-"] img {
opacity: 0.6;
height: 80px;
width: auto;
}

.rsfv tr[class*="promo-"] a.disabled {
pointer-events: none;
cursor: none;
display: block;
margin-top: 10px;
opacity: 0.6;
}

.rsfv td[class*=" forminp-promo-"] select {
opacity: 0.7;
}
Expand Down
45 changes: 45 additions & 0 deletions assets/js/admin-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,51 @@
$( collBtn[ i ] ).trigger( 'click' );
}
}

$( 'body' ).on(
'click',
'.rsfv-upload-image-btn',
function (e) {
e.preventDefault();
const button = $( this ),
customUploader = wp.media(
{
title: data.uploader_title,
library: {
type: 'image'
},
button: {
text: data.uploader_btn_text // button label text.
},
multiple: false // for multiple image selection set to true.
}
).on(
'select',
function () {
// it also has "open" and "close" events.
const attachment = customUploader.state().get( 'selection' ).first().toJSON();
const image_element_id = $( button ).attr( 'data-element-id' );
$( `#${image_element_id}` ).attr( 'src', attachment.url );
$( button ).next().show();
$( button ).next().next().val( attachment.id );
}
)
.open();
}
);

// Removing video.
$( 'body' ).on(
'click',
'.rsfv-remove-image-btn',
function () {
const default_image = $( this ).attr( 'data-default-image' );
$( this ).prev().prev().attr( 'src', default_image );
$( this ).next().val( '' );
$( this ).hide();
return false;
}
);
}
);
}( jQuery, rsfv_settings_data ) );
2 changes: 1 addition & 1 deletion freemius/assets/css/admin/dialog-boxes.css

Large diffs are not rendered by default.

19 changes: 14 additions & 5 deletions freemius/includes/class-freemius.php
Original file line number Diff line number Diff line change
Expand Up @@ -4174,13 +4174,17 @@ function has_api_connectivity( $flush_if_no_connectivity = false ) {
! empty( $this->_storage->connectivity_test ) &&
isset( $this->_storage->connectivity_test['is_active'] )
) {
$is_active = $this->_storage->connectivity_test['is_active'];
$is_connected = isset( $this->_storage->connectivity_test['is_connected'] ) ?
$this->_storage->connectivity_test['is_connected'] :
null;
$is_active = ( $this->_storage->connectivity_test['is_active'] || is_object( $this->_site ) );
} else {
$is_active = $this->should_turn_fs_on( $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() ) );

$this->store_connectivity_info( (object) array( 'is_active' => $is_active ), null );
$is_connected = null;
$is_active = $this->should_turn_fs_on( $this->apply_filters( 'is_plugin_update', $this->is_plugin_update() ) );
}

$this->store_connectivity_info( (object) array( 'is_active' => $is_active ), $is_connected );

if ( $is_active ) {
$this->_is_on = true;
}
Expand Down Expand Up @@ -5484,7 +5488,12 @@ private function parse_settings( &$plugin_info ) {
'affiliate_moderation' => $this->get_option( $plugin_info, 'has_affiliation' ),
'bundle_id' => $this->get_option( $plugin_info, 'bundle_id', null ),
'bundle_public_key' => $this->get_option( $plugin_info, 'bundle_public_key', null ),
'opt_in_moderation' => $this->get_option( $plugin_info, 'opt_in', null ),
'opt_in_moderation' => $this->get_option(
$plugin_info,
'opt_in',
// For backward compatibility, we support both parameter names: opt_in and opt_in_moderation.
$this->get_option( $plugin_info, 'opt_in_moderation', null )
),
) );

if ( $plugin->is_updated() ) {
Expand Down
2 changes: 1 addition & 1 deletion freemius/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.7.2';
$this_sdk_version = '2.7.4';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion freemius/templates/account.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ class="dashicons dashicons-image-rotate"></i> <?php fs_esc_html_echo_x_inline( '
?>
<tr class="fs-field-<?php echo esc_attr( $p['id'] ) ?><?php if ( $odd ) : ?> alternate<?php endif ?>">
<td>
<nobr><?php echo esc_attr( $p['title'] ) ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
<nobr><?php echo esc_html( $p['title'] ) ?><?php echo ( ! empty( $p['title'] ) ) ? ':' : '' ?></nobr>
</td>
<td<?php if ( 'plan' === $p['id'] || 'bundle_plan' === $p['id'] ) { echo ' colspan="2"'; }?>>
<?php if ( in_array( $p['id'], array( 'license_key', 'site_secret_key' ) ) ) : ?>
Expand Down
1 change: 0 additions & 1 deletion freemius/templates/connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ class="wrap<?php if ( ! fs_is_network_admin() && ( ! $fs->is_enable_anonymous()

fs_require_once_template( 'plugin-icon.php', $vars );
?>
<!-- <img class="fs-connect-logo" width="--><?php //echo $size ?><!--" height="--><?php //echo $size ?><!--" src="//img.freemius.com/logo/connect.svg"/>-->
</div>
<div class="fs-box-container">
<div class="fs-content">
Expand Down
79 changes: 79 additions & 0 deletions includes/Compatibility/Plugins/Divi/class-compatibility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php
/**
* Divi compatibility handler.
*
* @package RSFV
*/

namespace RSFV\Compatibility\Plugins\Divi;

defined( 'ABSPATH' ) || exit;

use RSFV\Compatibility\Plugins\Base_Compatibility;

/**
* Class Compatibility
*
* @package RSFV
*/
class Compatibility extends Base_Compatibility {
/**
* Class instance.
*
* @var $instance
*/
protected static $instance;

/**
* A counter variable.
*
* @var int $counter
*/
protected $counter;

/**
* Constructor.
*/
public function __construct() {
parent::__construct();

$this->id = 'divi';

$this->setup();
}

/**
* Sets up hooks and filters.
*
* @return void
*/
public function setup() {
add_action( 'et_core_data_loaded', array( $this, 'run_extension' ) );
}

/**
* Runs extension hooks.
*
* @return void
*/
public function run_extension() {
if ( class_exists( 'WooCommerce' ) ) {
// Registers related settings tab.
add_filter( 'rsfv_get_settings_pages', array( $this, 'register_settings' ) );
}
}

/**
* Register Settings.
*
* @param array $settings Active settings file array.
*
* @return array
*/
public function register_settings( $settings ) {
// Settings.
$settings[] = include 'class-settings.php';

return $settings;
}
}
106 changes: 106 additions & 0 deletions includes/Compatibility/Plugins/Divi/class-settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
/**
* Divi Settings
*
* @package RSFV_Pro
*/

namespace RSFV\Compatibility\Plugins\Divi;

use RSFV\Plugin;
use RSFV\Settings\Settings_Page;
use RSFV\Settings\Admin_Settings;

if ( ! class_exists( '\RSFV\Settings\Admin_Settings' ) ) {
return;
}

defined( 'ABSPATH' ) || exit;

/**
* Integrations controls.
*/
class Settings extends Settings_Page {

/**
* Constructor.
*/
public function __construct() {
$this->id = 'divi';
$this->label = __( 'Divi', 'rsfv' );

parent::__construct();
}

/**
* Get sections.
*
* @return array
*/
public function get_sections() {
return apply_filters( 'rsfv_get_sections_' . $this->id, array() );
}

/**
* Get settings array.
*
* @param string $current_section Current section ID.
*
* @return array
*/
public function get_settings( $current_section = '' ) {
global $current_section;

$settings = array();

if ( '' === $current_section ) {
$settings = array();

if ( ! Plugin::get_instance()->has_pro_active() ) {
$settings = array_merge(
$settings,
array(
array(
'type' => 'title',
'id' => 'rsfv_pro_divi_woocommerce_title',
),
array(
'title' => __( 'Featured Video for Divi Woo Product Images', 'rsfv' ),
'desc' => __( 'When toggled on, it shows Featured Product Videos in Divi Woo Product Images Module/Widget. Turn it off if you\'re having problem with WooCommerce templates.', 'rsfv' ),
'id' => 'promo-has-divi-woo-featured_video',
'default' => false,
'type' => 'promo-checkbox',
),
array(
'type' => 'sectionend',
'id' => 'rsfv_pro_divi_woocommerce_title',
),
)
);
}

$settings = apply_filters(
'rsfv_' . $this->id . '_settings',
$settings
);
}

return apply_filters( 'rsfv_get_settings_' . $this->id, $settings );
}

/**
* Save settings.
*/
public function save() {
global $current_section;

$settings = $this->get_settings( $current_section );

Admin_Settings::save_fields( $settings );
if ( $current_section ) {
do_action( 'rsfv_update_options_' . $this->id . '_' . $current_section );
}
}
}

return new Settings();
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public static function woo_video_markup( $id, $wrapper_class = 'woocommerce-prod
if ( ! empty( $post_types ) ) {
if ( in_array( $post_type, $post_types, true ) ) {
$img_url = RSFV_PLUGIN_URL . 'assets/images/video_frame.png';
$thumbnail = apply_filters( 'rsfv_featured_video_thumbnail', $img_url );
$thumbnail = apply_filters( 'rsfv_default_woo_gallery_video_thumb', $img_url );
$gallery_thumbnail = wc_get_image_size( 'gallery_thumbnail' );

// Return early if thumbnail is only required.
Expand Down Expand Up @@ -337,7 +337,8 @@ public function get_woo_archives_video( $post_id = '' ) {
public function modify_body_classes( $classes ) {
$options = Options::get_instance();

$product_archives_visibility = $options->get( 'product_archives_visibility' );
// Default is enabled.
$product_archives_visibility = $options->has( 'product_archives_visibility' ) ? $options->get( 'product_archives_visibility' ) : true;

if ( $product_archives_visibility && ( is_shop() || is_product_category() || is_product_tag() ) ) {
$classes[] = 'rsfv-archives-support';
Expand Down
15 changes: 15 additions & 0 deletions includes/Compatibility/Plugins/WooCommerce/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ public function get_settings( $current_section = '' ) {
'type' => 'sectionend',
'id' => 'rsfv_pro_woocommerce',
),
array(
'type' => 'title',
'id' => 'rsfv_pro_change_default_gallery_thumb',
),
array(
'title' => __( 'Default Gallery Thumb', 'rsfv' ),
'desc' => __( 'Set default product gallery thumb on single product page.', 'rsfv' ),
'id' => 'promo-default-woo-gallery-video-thumb',
'default' => RSFV_PLUGIN_URL . 'assets/images/video_frame.png',
'type' => 'promo-media-image',
),
array(
'type' => 'sectionend',
'id' => 'rsfv_pro_change_default_gallery_thumb',
),
)
);
}
Expand Down
Loading

0 comments on commit ac7612d

Please sign in to comment.