first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
@@ -0,0 +1,67 @@
.arve-license-input {
width: 280px;
}
.arve-btn {
padding-left: 3px;
}
.arve-icon:before {
content: "\f236" !important; /* dashicon-video-alt */
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block {
padding-top: .4em;
padding-bottom: .4em;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block label {
display: inline-block;
margin: 0;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .field-block label:first-child {
width: 110px;
}
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-upload_date input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-aspect_ratio input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-url input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-title input,
.edit-shortcode-form-fields.shortcode-ui-edit-arve .shortcode-ui-attribute-description input {
width: 700px;
}
.arve-list-small {
font-size: .85em;
list-style: square;
padding-left: 20px;
}
.arve-list-small li {
margin-bottom: 2px;
}
.arve-settings-page-ad {
margin: 0;
padding-right: .7rem !important;
}
.arve-corner-spacer {
float: right;
width: 20px;
height: 38px;
}
@media all and (min-width: 1024px) {
.arve-settings-page-ad {
position: absolute !important;
right: 0;
width: 320px;
}
.arve-options-wrap {
padding-right: 350px;
position: relative;
}
}
@@ -0,0 +1,108 @@
(function ( $ ) {
'use strict';
/*global ajaxurl */
/*global sui */
/*global tb_show */
// Options Page
$('.arve-settings-section').each( function() {
$(this).insertBefore( $(this).parent() );
});
$('.arve-settings-section').each( function() {
var id = $(this).attr( 'id' );
var classs = $(this).attr( 'class' );
var title = $(this).attr( 'title' );
$(this).nextUntil( '.arve-settings-section' ).wrapAll( '<section id="' + id + '" class="' + classs + '" />' );
$( '<a href="#" data-target="#' + id + '" class="nav-tab">' + title + '</a>' ).appendTo( '.arve-settings-tabs' );
$(this).remove();
});
function show_tab( target ) {
$('.arve-settings-section').show();
$( target ).prependTo( '.arve-options-form' );
$('.arve-settings-section').not( target ).hide();
$('.arve-settings-tabs a').removeClass( 'nav-tab-active' );
$('.arve-settings-tabs a[data-target="' + target + '"]').addClass( 'nav-tab-active' );
}
if ( $( '#arve_options_main\\[last_settings_tab\\]' ).length && $( '#arve_options_main\\[last_settings_tab\\]' ).val().length ) {
show_tab( $( '#arve_options_main\\[last_settings_tab\\]' ).val() );
}
$(document).on( 'click', '.arve-settings-tabs a', function(e) {
e.preventDefault();
var target = $(this).attr('data-target');
show_tab( target );
$( '#arve_options_main\\[last_settings_tab\\]' ).val( target );
} );
$(document).on( 'click', '[data-image-upload]', function(e) {
e.preventDefault();
var target = $( this ).attr('data-image-upload');
var image = wp.media({
title: 'Upload Image',
// mutiple: true if you want to upload multiple files at once
multiple: false
}).open()
.on('select', function(){
// This will return the selected image from the Media Uploader, the result is an object
var uploaded_image = image.state().get('selection').first();
// We convert uploaded_image to a JSON object to make accessing it easier
// Output to the console uploaded_image
var attachment_id = uploaded_image.toJSON().id;
// Let's assign the url value to the input field
$( target ).val(attachment_id);
});
});
$(document).on( 'click', '.arve-pro-notice .notice-dismiss', function() {
jQuery.ajax({
url: ajaxurl,
data: {
action: 'arve_ajax_dismiss_pro_notice'
}
});
});
$(document).on( 'click', '[data-nj-notice-id] .notice-dismiss', function() {
var id = $(this).closest('[data-nj-notice-id]').attr('data-nj-notice-id');
jQuery.ajax({
url: ajaxurl,
data: {
action: id
}
});
});
$(document).on( 'click', '#arve-btn', function() {
if ( typeof( sui ) !== 'undefined' ) {
var arve_shortcode = sui.utils.shortcodeViewConstructor.parseShortcodeString( '[arve]' );
wp.media({
frame : 'post',
state : 'shortcode-ui',
currentShortcode : arve_shortcode
}).open();
} else {
tb_show( 'ARVE Optional Features', '#TB_inline?inlineId=arve-thickbox' );
}
} );
}(jQuery));
@@ -0,0 +1,74 @@
function arve_extract_url( changed, collection, shortcode ) {
function attr_by_name( name ) {
return _.find(
collection,
function( viewModel ) {
return name === viewModel.model.get( 'attr' );
}
);
}
var val = changed.value,
short_val = changed.value,
input = attr_by_name( 'url' ).$el.find( 'input' );
if( typeof val === 'undefined' ) {
return;
}
if( val.match(/src="?([^\s"]+)/) ) {
var test_url = val.match(/src="?([^\s"]+)/),
only_url = test_url && test_url[1];
input.val( only_url ).trigger( 'input' );
}
}
function arve_mode_select_listener( changed, collection, shortcode ) {
function attr_by_name(name) {
return _.find(
collection,
function( viewModel ) {
return name === viewModel.model.get('attr');
}
);
}
var val = changed.value,
autoplay = attr_by_name( 'autoplay' ),
grow = attr_by_name( 'grow' ),
align = attr_by_name( 'align' ),
hide_title = attr_by_name( 'hide_title' );
if( typeof val === 'undefined' ) {
return;
}
if ( 'lazyload-lightbox' === val ) {
align.$el.show();
autoplay.$el.hide();
grow.$el.hide();
hide_title.$el.show();
} else if ( 'lazyload' === val ) {
align.$el.show();
autoplay.$el.hide();
grow.$el.show();
hide_title.$el.show();
} else if ( 'link-lightbox' === val ) {
align.$el.hide();
autoplay.$el.hide();
grow.$el.hide();
hide_title.$el.hide();
} else { // normal
align.$el.show();
autoplay.$el.show();
grow.$el.hide();
hide_title.$el.hide();
}
}
wp.shortcake.hooks.addAction( 'arve.mode', arve_mode_select_listener );
wp.shortcake.hooks.addAction( 'arve.url', arve_extract_url );
@@ -0,0 +1,61 @@
<?php
class ARVE_Admin_Notice_Factory {
private $notice_id;
private $notice;
private $dismiss_forever;
public function __construct( $notice_id, $notice, $dismiss_forever = true, $capabilities = 'activate_plugins' ) {
if ( ! current_user_can( $capabilities ) ) {
return;
}
$this->notice_id = "admin-notice-factory-$notice_id";
$this->notice = $notice;
$this->dismiss_forever = $dismiss_forever;
if ( 'admin-notice-factory-arve_dismiss_pro_notice' === $this->notice_id ) {
$this->notice_id = 'arve_dismiss_pro_notice';
}
add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );
add_action( 'wp_ajax_' . $this->notice_id, array( $this, 'ajax_call' ) );
}
public function action_admin_notices() {
if ( apply_filters( 'nj_debug_admin_message', false ) ) {
delete_user_meta( get_current_user_id(), $this->notice_id );
delete_transient( $this->notice_id );
}
$user_id = get_current_user_id();
$user_meta = get_user_meta( $user_id, $this->notice_id );
if ( $this->dismiss_forever && ! empty( $user_meta ) ) {
return;
} elseif ( get_transient( $this->notice_id ) ) {
return;
}
printf(
'<div class="notice is-dismissible updated" data-nj-notice-id="%s">%s</div>',
esc_attr( $this->notice_id ),
$this->notice // phpcs:ignore
);
}
public function ajax_call() {
$user_id = get_current_user_id();
if ( $this->dismiss_forever ) {
add_user_meta( $user_id, $this->notice_id, true );
} else {
set_transient( $this->notice_id, true, HOUR_IN_SECONDS );
}
wp_die();
}
}
@@ -0,0 +1,586 @@
<?php
// phpcs:disable
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.19
*/
class Nextgenthemes_Plugin_Updater {
private $api_url = '';
private $api_data = array();
private $name = '';
private $slug = '';
private $version = '';
private $wp_override = false;
private $cache_key = '';
private $health_check_timeout = 5;
/**
* Class constructor.
*
* @uses plugin_basename()
* @uses hook()
*
* @param string $_api_url The URL pointing to the custom API endpoint.
* @param string $_plugin_file Path to the plugin file.
* @param array $_api_data Optional data to send with API calls.
*/
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
global $edd_plugin_data;
$this->api_url = trailingslashit( $_api_url );
$this->api_data = $_api_data;
$this->name = plugin_basename( $_plugin_file );
$this->slug = basename( $_plugin_file, '.php' );
$this->version = $_api_data['version'];
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
$this->cache_key = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
$edd_plugin_data[ $this->slug ] = $this->api_data;
/**
* Fires after the $edd_plugin_data is setup.
*
* @since x.x.x
*
* @param array $edd_plugin_data Array of EDD SL plugin data.
*/
do_action( 'post_edd_sl_plugin_updater_setup', $edd_plugin_data );
// Set up hooks.
$this->init();
}
/**
* Set up WordPress filters to hook into WP's update process.
*
* @uses add_filter()
*
* @return void
*/
public function init() {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
add_action( 'admin_init', array( $this, 'show_changelog' ) );
}
/**
* Check for Updates at the defined API endpoint and modify the update array.
*
* This function dives into the update API just when WordPress creates its update array,
* then adds a custom API call and injects the custom plugin data retrieved from the API.
* It is reassembled from parts of the native WordPress plugin update code.
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
*
* @uses api_request()
*
* @param array $_transient_data Update array build by WordPress.
* @return array Modified update array with custom plugin data.
*/
public function check_update( $_transient_data ) {
global $pagenow;
if ( ! is_object( $_transient_data ) ) {
$_transient_data = new stdClass;
}
if ( 'plugins.php' == $pagenow && is_multisite() ) {
return $_transient_data;
}
if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
return $_transient_data;
}
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
$this->set_version_info_cache( $version_info );
}
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$_transient_data->response[ $this->name ] = $version_info;
// Make sure the plugin property is set to the plugin's name/location. See issue 1463 on Software Licensing's GitHub repo.
$_transient_data->response[ $this->name ]->plugin = $this->name;
}
$_transient_data->last_checked = time();
$_transient_data->checked[ $this->name ] = $this->version;
}
return $_transient_data;
}
/**
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
*
* @param string $file
* @param array $plugin
*/
public function show_update_notification( $file, $plugin ) {
if ( is_network_admin() ) {
return;
}
if( ! current_user_can( 'update_plugins' ) ) {
return;
}
if( ! is_multisite() ) {
return;
}
if ( $this->name != $file ) {
return;
}
// Remove our filter on the site transient
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
$update_cache = get_site_transient( 'update_plugins' );
$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
$version_info = $this->get_cached_version_info();
if ( false === $version_info ) {
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
// Since we disabled our filter for the transient, we aren't running our object conversion on banners, sections, or icons. Do this now:
if ( isset( $version_info->banners ) && ! is_array( $version_info->banners ) ) {
$version_info->banners = $this->convert_object_to_array( $version_info->banners );
}
if ( isset( $version_info->sections ) && ! is_array( $version_info->sections ) ) {
$version_info->sections = $this->convert_object_to_array( $version_info->sections );
}
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->icons ) && ! is_array( $version_info->icons ) ) {
$version_info->icons = $this->convert_object_to_array( $version_info->icons );
}
if ( isset( $version_info->contributors ) && ! is_array( $version_info->contributors ) ) {
$version_info->contributors = $this->convert_object_to_array( $version_info->contributors );
}
$this->set_version_info_cache( $version_info );
}
if ( ! is_object( $version_info ) ) {
return;
}
if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
$update_cache->response[ $this->name ] = $version_info;
}
$update_cache->last_checked = time();
$update_cache->checked[ $this->name ] = $this->version;
set_site_transient( 'update_plugins', $update_cache );
} else {
$version_info = $update_cache->response[ $this->name ];
}
// Restore our filter
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
// build a plugin list row, with update notification
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
echo '<td colspan="3" class="plugin-update colspanchange">';
echo '<div class="update-message notice inline notice-warning notice-alt">';
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
if ( empty( $version_info->download_link ) ) {
printf(
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
esc_html( $version_info->name ),
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
esc_html( $version_info->new_version ),
'</a>'
);
} else {
printf(
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
esc_html( $version_info->name ),
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
esc_html( $version_info->new_version ),
'</a>',
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
'</a>'
);
}
do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
echo '</div></td></tr>';
}
}
/**
* Updates information on the "View version x.x details" page with custom data.
*
* @uses api_request()
*
* @param mixed $_data
* @param string $_action
* @param object $_args
* @return object $_data
*/
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
if ( $_action != 'plugin_information' ) {
return $_data;
}
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
return $_data;
}
$to_send = array(
'slug' => $this->slug,
'is_ssl' => is_ssl(),
'fields' => array(
'banners' => array(),
'reviews' => false,
'icons' => array(),
)
);
$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
// Get the transient where we store the api request for this plugin for 24 hours
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
if ( empty( $edd_api_request_transient ) ) {
$api_response = $this->api_request( 'plugin_information', $to_send );
// Expires in 3 hours
$this->set_version_info_cache( $api_response, $cache_key );
if ( false !== $api_response ) {
$_data = $api_response;
}
} else {
$_data = $edd_api_request_transient;
}
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
$_data->sections = $this->convert_object_to_array( $_data->sections );
}
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
$_data->banners = $this->convert_object_to_array( $_data->banners );
}
// Convert icons into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->icons ) && ! is_array( $_data->icons ) ) {
$_data->icons = $this->convert_object_to_array( $_data->icons );
}
// Convert contributors into an associative array, since we're getting an object, but Core expects an array.
if ( isset( $_data->contributors ) && ! is_array( $_data->contributors ) ) {
$_data->contributors = $this->convert_object_to_array( $_data->contributors );
}
if( ! isset( $_data->plugin ) ) {
$_data->plugin = $this->name;
}
return $_data;
}
/**
* Convert some objects to arrays when injecting data into the update API
*
* Some data like sections, banners, and icons are expected to be an associative array, however due to the JSON
* decoding, they are objects. This method allows us to pass in the object and return an associative array.
*
* @since 3.6.5
*
* @param stdClass $data
*
* @return array
*/
private function convert_object_to_array( $data ) {
$new_data = array();
foreach ( $data as $key => $value ) {
$new_data[ $key ] = is_object( $value ) ? $this->convert_object_to_array( $value ) : $value;
}
return $new_data;
}
/**
* Disable SSL verification in order to prevent download update failures
*
* @param array $args
* @param string $url
* @return object $array
*/
public function http_request_args( $args, $url ) {
$verify_ssl = $this->verify_ssl();
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
$args['sslverify'] = $verify_ssl;
}
return $args;
}
/**
* Calls the API and, if successfull, returns the object delivered by the API.
*
* @uses get_bloginfo()
* @uses wp_remote_post()
* @uses is_wp_error()
*
* @param string $_action The requested action.
* @param array $_data Parameters for the API action.
* @return false|object
*/
private function api_request( $_action, $_data ) {
global $wp_version, $edd_plugin_url_available;
$verify_ssl = $this->verify_ssl();
// Do a quick status check on this domain if we haven't already checked it.
$store_hash = md5( $this->api_url );
if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
$test_url_parts = parse_url( $this->api_url );
$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme'] : 'http';
$host = ! empty( $test_url_parts['host'] ) ? $test_url_parts['host'] : '';
$port = ! empty( $test_url_parts['port'] ) ? ':' . $test_url_parts['port'] : '';
if ( empty( $host ) ) {
$edd_plugin_url_available[ $store_hash ] = false;
} else {
$test_url = $scheme . '://' . $host . $port;
$response = wp_remote_get( $test_url, array( 'timeout' => $this->health_check_timeout, 'sslverify' => $verify_ssl ) );
$edd_plugin_url_available[ $store_hash ] = is_wp_error( $response ) ? false : true;
}
}
if ( false === $edd_plugin_url_available[ $store_hash ] ) {
return;
}
$data = array_merge( $this->api_data, $_data );
if ( $data['slug'] != $this->slug ) {
return;
}
if( $this->api_url == trailingslashit ( home_url() ) ) {
return false; // Don't allow a plugin to ping itself
}
$api_params = array(
'edd_action' => 'get_version',
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
'version' => isset( $data['version'] ) ? $data['version'] : false,
'slug' => $data['slug'],
'author' => $data['author'],
'url' => home_url(),
'beta' => ! empty( $data['beta'] ),
);
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
if ( ! is_wp_error( $request ) ) {
$request = json_decode( wp_remote_retrieve_body( $request ) );
}
if ( $request && isset( $request->sections ) ) {
$request->sections = maybe_unserialize( $request->sections );
} else {
$request = false;
}
if ( $request && isset( $request->banners ) ) {
$request->banners = maybe_unserialize( $request->banners );
}
if ( $request && isset( $request->icons ) ) {
$request->icons = maybe_unserialize( $request->icons );
}
if( ! empty( $request->sections ) ) {
foreach( $request->sections as $key => $section ) {
$request->$key = (array) $section;
}
}
return $request;
}
public function show_changelog() {
global $edd_plugin_data;
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
return;
}
if( empty( $_REQUEST['plugin'] ) ) {
return;
}
if( empty( $_REQUEST['slug'] ) ) {
return;
}
if( ! current_user_can( 'update_plugins' ) ) {
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
}
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
$beta = ! empty( $data['beta'] ) ? true : false;
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
$version_info = $this->get_cached_version_info( $cache_key );
if( false === $version_info ) {
$api_params = array(
'edd_action' => 'get_version',
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
'slug' => $_REQUEST['slug'],
'author' => $data['author'],
'url' => home_url(),
'beta' => ! empty( $data['beta'] )
);
$verify_ssl = $this->verify_ssl();
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
if ( ! is_wp_error( $request ) ) {
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
}
if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
$version_info->sections = maybe_unserialize( $version_info->sections );
} else {
$version_info = false;
}
if( ! empty( $version_info ) ) {
foreach( $version_info->sections as $key => $section ) {
$version_info->$key = (array) $section;
}
}
$this->set_version_info_cache( $version_info, $cache_key );
}
if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
}
exit;
}
public function get_cached_version_info( $cache_key = '' ) {
if( empty( $cache_key ) ) {
$cache_key = $this->cache_key;
}
$cache = get_option( $cache_key );
if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
return false; // Cache is expired
}
// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
$cache['value'] = json_decode( $cache['value'] );
if ( ! empty( $cache['value']->icons ) ) {
$cache['value']->icons = (array) $cache['value']->icons;
}
return $cache['value'];
}
public function set_version_info_cache( $value = '', $cache_key = '' ) {
if( empty( $cache_key ) ) {
$cache_key = $this->cache_key;
}
$data = array(
'timeout' => strtotime( '+3 hours', time() ),
'value' => json_encode( $value )
);
update_option( $cache_key, $data, 'no' );
}
/**
* Returns if the SSL of the store should be verified.
*
* @since 1.6.13
* @return bool
*/
private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}
}
@@ -0,0 +1,643 @@
<?php
function arve_action_admin_init_setup_messages() {
if ( defined( 'ARVE_PRO_VERSION' ) && version_compare( ARVE_PRO_VERSION_REQUIRED, ARVE_PRO_VERSION, '>' ) ) {
$msg = sprintf(
__( 'Your ARVE Pro Addon is outdated, you need version %1$s or later. If you have setup your license <a href="%2$s">here</a> semi auto updates (Admin panel notice and auto install on confirmation) should work again. If not please <a href="%3$s">report it</a> and manually update as <a href="%4$s">described here.</a>', ARVE_SLUG ),
ARVE_PRO_VERSION_REQUIRED,
get_admin_url() . 'admin.php?page=nextgenthemes-licenses',
'https://nextgenthemes.com/support/',
'https://nextgenthemes.com/plugins/arve/documentation/installing-and-license-management/'
);
new ARVE_Admin_Notice_Factory( 'arve-pro-outdated', "<p>$msg</p>", false );
}
if ( arve_display_pro_ad() ) {
$pro_ad_message = __( '<p>Hi, this is Nico(las Jonas) the author of the ARVE - Advanced Responsive Video Embedder plugin. If you are interrested in additional features and/or want to support the work I do on this plugin please consider buying the Pro Addon.</p>', ARVE_SLUG );
$pro_ad_message .= file_get_contents( ARVE_PATH . 'admin/pro-ad.html' );
new ARVE_Admin_Notice_Factory( 'arve_dismiss_pro_notice', $pro_ad_message, true );
}
}
function arve_add_tinymce_plugin( $plugin_array ) {
$plugin_array['arve'] = ARVE_ADMIN_URL . 'tinymce.js';
return $plugin_array;
}
function arve_display_pro_ad() {
$inst = (int) get_option( 'arve_install_date' );
if ( ! current_user_can( 'update_plugins' ) || ! apply_filters( 'arve_pro_ad', true ) || current_time( 'timestamp' ) < strtotime( '+1 week', $inst ) ) {
return false;
}
return true;
}
function arve_widget_text() {
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<p>';
printf( '<a href="%s">Documentation</a>, ', 'https://nextgenthemes.com/plugins/arve/documentation/' );
printf( '<a href="%s">Support</a>, ', 'https://nextgenthemes.com/support/' );
printf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=advanced-responsive-video-embedder' ), __( 'Settings', ARVE_SLUG ) );
echo '</p>';
printf( '<a href="%s">ARVE Pro Addon Features</a>:', 'https://nextgenthemes.com/plugins/arve-pro/' );
echo file_get_contents( ARVE_PATH . 'admin/pro-ad.html' );
}
function arve_add_dashboard_widget() {
if ( ! arve_display_pro_ad() ) {
return false;
}
wp_add_dashboard_widget(
'arve_dashboard_widget', // Widget slug.
'Advanced Responsive Video Embedder', // Title.
'arve_widget_text' // Display function.
);
// phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
// Globalize the metaboxes array, this holds all the widgets for wp-admin.
global $wp_meta_boxes, $pagenow;
if ( 'index.php' === $pagenow ) {
// Get the regular dashboard widgets array.
// (which has our new widget already but at the end).
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
// Backup and delete our new dashboard widget from the end of the array.
$arve_widget_backup = array( 'arve_dashboard_widget' => $normal_dashboard['arve_dashboard_widget'] );
unset( $normal_dashboard['arve_dashboard_widget'] );
// Merge the two arrays together so our widget is at the beginning.
$sorted_dashboard = array_merge( $arve_widget_backup, $normal_dashboard );
// Save the sorted array back into the original metaboxes.
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
}
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 1.0.0
*/
function arve_add_plugin_admin_menu() {
$plugin_screen_hook_suffix = add_options_page(
__( 'Advanced Responsive Video Embedder Settings', ARVE_SLUG ),
__( 'ARVE', ARVE_SLUG ),
'manage_options',
ARVE_SLUG, # menu-slug
function() {
require_once plugin_dir_path( __FILE__ ) . 'html-settings-page.php';
}
);
add_submenu_page(
'nextgenthemes', # parent_slug
__( 'Advanced Responsive Video Embedder Settings', ARVE_SLUG ), # Page Title
__( 'ARVE', ARVE_SLUG ), # Menu Title
'manage_options', # capability
ARVE_SLUG # menu-slug
);
}
/**
* Add settings action link to the plugins page.
*
* @since 1.0.0
*/
function arve_add_action_links( $links ) {
if ( ! is_plugin_active( 'arve-pro/arve-pro.php' ) ) {
$extra_links['buy_pro_addon'] = sprintf(
'<a href="%s"><strong style="display: inline;">%s</strong></a>',
'https://nextgenthemes.com/plugins/arve-pro/',
__( 'Buy Pro Addon', ARVE_SLUG )
);
}
$extra_links['donate'] = sprintf( '<a href="https://nextgenthemes.com/donate/"><strong style="display: inline;">%s</strong></a>', __( 'Donate', ARVE_SLUG ) );
$extra_links['settings'] = sprintf( '<a href="%s">%s</a>', admin_url( 'options-general.php?page=' . ARVE_SLUG ), __( 'Settings', ARVE_SLUG ) );
return array_merge( $extra_links, $links );
}
/**
* Action to add a custom button to the content editor
*
* @since 4.3.0
*/
function arve_add_media_button() {
$options = arve_get_options();
add_thickbox();
$p1 = __( 'This button can open a optional ARVE a Shortcode creation dialog. ARVE needs the <a href="%s">Shortcode UI plugin</a> active for this fuctionality.', ARVE_SLUG );
$p2 = __( 'The "Shortcake (Shortcode UI)" plugin also adds What You See Is What You Get functionality to WordPress visual post editor.', ARVE_SLUG );
$p3 = __( 'It is perfectly fine to pass on this and <a href="%s">manually</a> write shortcodes or don\'t use shortcodes at all, but it makes things easier.', ARVE_SLUG );
printf(
"<div id='arve-thickbox' style='display:none;'><p>$p1</p><p>$p2</p><p>$p3</p></div>",
nextgenthemes_admin_install_search_url( 'Shortcode+UI' ),
esc_url( 'https://nextgenthemes.com/plugins/arve/documentation/' )
);
printf(
'<button id="arve-btn" title="%s" data-mode="%s" class="arve-btn button add_media" type="button"><span class="wp-media-buttons-icon arve-icon"></span> %s</button>',
esc_attr__( 'ARVE Advanced Responsive Video Embedder', ARVE_SLUG ),
esc_attr( $options['mode'] ),
esc_html__( 'Embed Video (ARVE)', ARVE_SLUG )
);
}
function arve_register_shortcode_ui() {
$attrs = arve_get_settings_definitions();
if ( function_exists( 'arve_pro_get_settings_definitions' ) ) {
$attrs = array_merge( $attrs, arve_pro_get_settings_definitions() );
}
foreach ( $attrs as $key => $values ) {
if ( isset( $values['hide_from_sc'] ) && $values['hide_from_sc'] ) {
continue;
}
$sc_attrs[] = $values;
}
shortcode_ui_register_for_shortcode(
'arve',
array(
'label' => esc_html( 'ARVE' ),
'listItemImage' => 'dashicons-format-video',
'attrs' => $sc_attrs,
)
);
}
function arve_input( $args ) {
$out = sprintf( '<input%s>', arve_attr( $args['input_attr'] ) );
if ( ! empty( $args['option_values']['attr'] ) && 'thumbnail_fallback' === $args['option_values']['attr'] ) {
// jQuery
wp_enqueue_script( 'jquery' );
// This will enqueue the Media Uploader script
wp_enqueue_media();
$out .= sprintf(
'<a %s>%s</a>',
arve_attr(
array(
'data-image-upload' => sprintf( '[name="%s"]', $args['input_attr']['name'] ),
'class' => 'button-secondary',
)
),
__( 'Upload Image', ARVE_SLUG )
);
}
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
function arve_textarea( $args ) {
unset( $args['input_attr']['type'] );
$out = sprintf( '<textarea%s></textarea>', arve_attr( $args['input_attr'] ) );
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
function arve_select( $args ) {
unset( $args['input_attr']['type'] );
foreach ( $args['option_values']['options'] as $key => $value ) {
if (
2 === count( $args['option_values']['options'] ) &&
array_key_exists( 'yes', $args['option_values']['options'] ) &&
array_key_exists( 'no', $args['option_values']['options'] )
) {
$current_option = $args['input_attr']['value'] ? 'yes' : 'no';
} else {
$current_option = $args['input_attr']['value'];
}
$options[] = sprintf(
'<option value="%s" %s>%s</option>',
esc_attr( $key ),
selected( $current_option, $key, false ),
esc_html( $value )
);
}
$select_attr = $args['input_attr'];
unset( $select_attr['value'] );
$out = sprintf( '<select%s>%s</select>', arve_attr( $select_attr ), implode( '', $options ) );
if ( ! empty( $args['description'] ) ) {
$out = $out . '<p class="description">' . $args['description'] . '</p>';
}
echo $out;
}
/**
*
*
* @since 2.6.0
*/
function arve_register_settings() {
$options = arve_get_options();
// Main
$main_title = __( 'Main Options', ARVE_SLUG );
add_settings_section(
'main_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-main" title="%s"></span>%s', esc_attr( $main_title ), esc_html( $main_title ) ),
null,
ARVE_SLUG
);
foreach ( arve_get_settings_definitions() as $key => $value ) {
if ( ! empty( $value['hide_from_settings'] ) ) {
continue;
};
if ( empty( $value['meta'] ) ) {
$value['meta'] = array();
};
if ( isset( $value['options'][''] ) ) {
unset( $value['options'][''] );
}
if ( in_array( $value['type'], array( 'text', 'number', 'url' ), true ) ) {
$callback_function = 'arve_input';
} else {
$callback_function = 'arve_' . $value['type'];
}
add_settings_field(
"arve_options_main[{$value['attr']}]", // ID
$value['label'], // title
$callback_function, // callback
ARVE_SLUG, // page
'main_section', // section
array( // args
'label_for' => ( 'radio' === $value['type'] ) ? null : "arve_options_main[{$value['attr']}]",
'input_attr' => $value['meta'] + array(
'type' => $value['type'],
'value' => $options[ $value['attr'] ],
'id' => "arve_options_main[{$value['attr']}]",
'name' => "arve_options_main[{$value['attr']}]",
),
'description' => ! empty( $value['description'] ) ? $value['description'] : null,
'option_values' => $value,
)
);
}
add_settings_field(
'arve_options_main[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'main_section',
array(
'reset_name' => 'arve_options_main[reset]',
)
);
// Params
$params_title = __( 'URL Parameters', ARVE_SLUG );
add_settings_section(
'params_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-params" title="%s"></span>%s', esc_attr( $params_title ), esc_html( $params_title ) ),
'arve_params_section_description',
ARVE_SLUG
);
// Options
foreach ( $options['params'] as $provider => $params ) {
add_settings_field(
"arve_options_params[$provider]",
ucfirst( $provider ),
'arve_input',
ARVE_SLUG,
'params_section',
array(
'label_for' => "arve_options_params[$provider]",
'input_attr' => array(
'type' => 'text',
'value' => $params,
'id' => "arve_options_params[$provider]",
'name' => "arve_options_params[$provider]",
'class' => 'large-text'
),
)
);
}
add_settings_field(
'arve_options_params[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'params_section',
array(
'reset_name' => 'arve_options_params[reset]',
)
);
// Shortcode Tags
$shortcodes_title = __( 'Shortcode Tags', ARVE_SLUG );
add_settings_section(
'shortcodes_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-shortcodes" title="%s"></span>%s', esc_attr( $shortcodes_title ), esc_html( $shortcodes_title ) ),
'arve_shortcodes_section_description',
ARVE_SLUG
);
foreach ( $options['shortcodes'] as $provider => $shortcode ) {
add_settings_field(
"arve_options_shortcodes[$provider]",
ucfirst( $provider ),
'arve_input',
ARVE_SLUG,
'shortcodes_section',
array(
'label_for' => "arve_options_shortcodes[$provider]",
'input_attr' => array(
'type' => 'text',
'value' => $shortcode,
'id' => "arve_options_shortcodes[$provider]",
'name' => "arve_options_shortcodes[$provider]",
'class' => 'medium-text'
),
)
);
}
add_settings_field(
'arve_options_shortcodes[reset]',
null,
'arve_submit_reset',
ARVE_SLUG,
'shortcodes_section',
array(
'reset_name' => 'arve_options_shortcodes[reset]',
)
);
register_setting( 'arve-settings-group', 'arve_options_main', 'arve_validate_options_main' );
register_setting( 'arve-settings-group', 'arve_options_params', 'arve_validate_options_params' );
register_setting( 'arve-settings-group', 'arve_options_shortcodes', 'arve_validate_options_shortcodes' );
}
/**
*
*
* @since 6.0.6
*/
function arve_register_settings_debug() {
// Debug Information
$debug_title = __( 'Debug Info', ARVE_SLUG );
add_settings_section(
'debug_section',
sprintf( '<span class="arve-settings-section" id="arve-settings-section-debug" title="%s"></span>%s', esc_attr( $debug_title ), esc_html( $debug_title ) ),
'arve_debug_section_description',
ARVE_SLUG
);
}
function arve_submit_reset( $args ) {
submit_button( __( 'Save Changes', ARVE_SLUG ), 'primary', 'submit', false );
echo '&nbsp;&nbsp;';
submit_button( __( 'Reset This Settings Section', ARVE_SLUG ), 'secondary', $args['reset_name'], false );
}
function arve_shortcodes_section_description() {
$desc = __( 'This shortcodes exist for backwards compatiblity only. It is not recommended to use them at all, please use the <code>[arve]</code> shortcode. You can change the old shortcode tags here. You may need this to prevent conflicts with other plugins you want to use.', ARVE_SLUG );
echo "<p>$desc</p>";
}
function arve_params_section_description() {
$desc = sprintf(
__(
'This parameters will be added to the <code>iframe src</code> urls, you can control the video players behavior with them. Please read <a href="%s" target="_blank">the documentation</a> on.',
ARVE_SLUG
),
esc_url( 'https://nextgenthemes.com/arve/documentation' )
);
echo "<p>$desc</p>";
?>
<p>
See
<a target="_blank" href="https://developers.google.com/youtube/player_parameters">Youtube Parameters</a>,
<a target="_blank" href="http://www.dailymotion.com/doc/api/player.html#parameters">Dailymotion Parameters</a>,
<a target="_blank" href="https://developer.vimeo.com/player/embedding">Vimeo Parameters</a>,
<a target="_blank" href="https://nextgenthemes.com/arve-pro/documentation">Vimeo Parameters</a>,
</p>
<?php
}
function arve_get_plugin_version_and_status( $folder_and_filename ) {
$file = WP_PLUGIN_DIR . '/' . $folder_and_filename;
if ( ! is_file( $file ) ) {
return 'NOT INSTALLED';
}
$data = get_plugin_data( $file );
$out = $data['Version'];
if ( ! is_plugin_active( $folder_and_filename ) ) {
$out .= ' INACTIVE';
}
return $out;
}
function arve_debug_section_description() {
global $wp_version;
$arve_version = arve_get_plugin_version_and_status( 'advanced-responsive-video-embedder/advanced-responsive-video-embedder.php' );
$arve_pro_version = arve_get_plugin_version_and_status( 'arve-pro/arve-pro.php' );
if ( ! is_plugin_active( 'arve-pro/arve-pro.php' ) ) {
$pro_options_dump = '';
} else {
$pro_options = get_option( 'arve_options_pro' );
unset( $pro_options['key'] );
ob_start();
var_dump( $pro_options ); // phpcs:ignore
$pro_options_dump = ob_get_clean();
}
include_once plugin_dir_path( __FILE__ ) . 'html-debug-info.php';
}
/**
*
*
* @since 2.6.0
*/
function arve_validate_options_main( $input ) {
// Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
$output['align'] = sanitize_text_field( $input['align'] );
$output['mode'] = sanitize_text_field( $input['mode'] );
$output['last_settings_tab'] = sanitize_text_field( $input['last_settings_tab'] );
$output['controlslist'] = sanitize_text_field( $input['controlslist'] );
$output['vimeo_api_token'] = sanitize_text_field( $input['vimeo_api_token'] );
$output['always_enqueue_assets'] = ( 'yes' === $input['always_enqueue_assets'] ) ? true : false;
$output['autoplay'] = ( 'yes' === $input['autoplay'] ) ? true : false;
$output['promote_link'] = ( 'yes' === $input['promote_link'] ) ? true : false;
$output['wp_video_override'] = ( 'yes' === $input['wp_video_override'] ) ? true : false;
$output['youtube_nocookie'] = ( 'yes' === $input['youtube_nocookie'] ) ? true : false;
$output['wp_image_cache_time'] = (int) $input['wp_image_cache_time'];
if ( (int) $input['video_maxwidth'] > 100 ) {
$output['video_maxwidth'] = (int) $input['video_maxwidth'];
} else {
$output['video_maxwidth'] = '';
}
if ( (int) $input['align_maxwidth'] > 100 ) {
$output['align_maxwidth'] = (int) $input['align_maxwidth'];
}
$options_defaults = arve_get_options_defaults( 'main' );
// Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_validate_options_params( $input ) {
// Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
$output = array();
foreach ( $input as $key => $var ) {
$output[ $key ] = preg_replace( '!\s+!', '&', trim( $var ) );
$output[ $key ] = preg_replace( '!\s+!', '&', trim( $var ) );
}
$options_defaults = arve_get_options_defaults( 'params' );
//* Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_validate_options_shortcodes( $input ) {
$output = array();
//* Storing the Options Section as a empty array will cause the plugin to use defaults
if ( isset( $input['reset'] ) ) {
return array();
}
foreach ( $input as $key => $var ) {
$var = preg_replace( '/[_]+/', '_', $var ); // remove multiple underscores
$var = preg_replace( '/[^A-Za-z0-9_]/', '', $var ); // strip away everything except a-z,0-9 and underscores
if ( strlen( $var ) < 3 ) {
continue;
}
$output[ $key ] = $var;
}
$options_defaults = arve_get_options_defaults( 'shortcodes' );
//* Store only the options in the database that are different from the defaults.
return array_diff_assoc( $output, $options_defaults );
}
function arve_admin_enqueue_styles() {
wp_enqueue_style( ARVE_SLUG, ARVE_ADMIN_URL . 'arve-admin.css', array(), ARVE_VERSION, 'all' );
}
function arve_mce_css( $mce_css ) {
$min = arve_get_min_suffix();
if ( ! empty( $mce_css ) ) {
$mce_css .= ',';
}
$mce_css .= ARVE_PUBLIC_URL . "arve{$min}.css";
return $mce_css;
}
/**
* Register the JavaScript for the dashboard.
*
* @since 1.0.0
*/
function arve_admin_enqueue_scripts() {
wp_enqueue_script( ARVE_SLUG, ARVE_ADMIN_URL . 'arve-admin.js', array( 'jquery' ), ARVE_VERSION, true );
if ( is_plugin_active( 'shortcode-ui/shortcode-ui.php' ) ) {
wp_enqueue_script( ARVE_SLUG . '-sc-ui', ARVE_ADMIN_URL . 'arve-shortcode-ui.js', array( 'shortcode-ui' ), ARVE_VERSION, true );
}
}
@@ -0,0 +1,621 @@
<?php
add_action( 'admin_init', 'nextgenthemes_init_edd_updaters', 0 );
add_action( 'admin_init', 'nextgenthemes_activation_notices' );
add_action( 'admin_init', 'nextgenthemes_register_settings' );
add_action( 'admin_menu', 'nextgenthemes_menus' );
function nextgenthemes_admin_install_search_url( $search_term ) {
$path = "plugin-install.php?s={$search_term}&tab=search&type=term";
if ( is_multisite() ) {
return network_admin_url( $path );
} else {
return admin_url( $path );
}
}
function nextgenthemes_ads_page() { ?>
<style>
body {
background: hsl(210, 13%, 16%);
}
#wpcontent {
padding: 0;
}
#wpbody-content {
/* padding-bottom: 2rem; */
}
#wpfooter {
display: none;
}
#nextgenthemes-ads {
padding: 1.7rem;
column-width: 40rem;
column-gap: 1.7rem;
}
@media only screen and (max-device-width: 400px) {
#nextgenthemes-ads {
padding-left: 0;
padding-right: 0;
}
}
#nextgenthemes-ads,
#nextgenthemes-ads * {
box-sizing: border-box;
}
#nextgenthemes-ads::after {
content: "";
display: table;
clear: both;
}
#nextgenthemes-ads {
color: white;
}
#nextgenthemes-ads h1,
#nextgenthemes-ads h2,
#nextgenthemes-ads h3 {
color: inherit;
margin-left: 2rem;
margin-right: 1.7rem;
}
#nextgenthemes-ads h1 {
line-height: 1;
}
#nextgenthemes-ads img {
width: 100%;
height: auto;
}
#nextgenthemes-ads > a {
text-decoration: none;
position: relative;
display: inline-block;
width: 100%;
background-color: hsl(210, 13%, 13%);
border: 1px solid hsl(207, 48%, 30%);
transition: box-shadow .3s, background-color .3s, border-color .3s;
color: #eee;
font-size: 1.05rem;
margin-bottom: 2rem;
line-height: 1.4;
}
#nextgenthemes-ads > a:hover {
background-color: hsl(210, 13%, 10%);
box-shadow: 0 0 10px hsla(207, 48%, 50%, 1);
border-color: hsl(207, 48%, 40%);
}
#nextgenthemes-ads p {
margin-left: 2rem;
margin-right: 1.7rem;
font-size: 1.2rem;
}
#nextgenthemes-ads ul {
list-style: square;
margin-left: 2.5rem;
margin-right: .7rem;
}
#nextgenthemes-ads > a > span {
position: absolute;
padding: .6rem 1rem;
right: 0px;
bottom: 0px;
font-size: 2rem;
color: white;
background-color: hsl(207, 48%, 30%);
border-top-left-radius: 3px;
//transform: rotate(3deg);
}
#nextgenthemes-ads figure {
margin: 1rem;
}
</style>
<?php
$img_dir = plugin_dir_url( __FILE__ ) . 'product-images/';
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
?>
<div id="nextgenthemes-ads">
<?php if ( ! defined( 'ARVE_PRO_VERSION' ) ) : ?>
<a href="https://nextgenthemes.com/plugins/arve-pro/">
<figure><img src="<?php echo $img_dir; ?>arve.svg" alt"ARVE"></figure>
<?php nextgenthemes_feature_list_html( ARVE_PATH . 'readme/html/20-description-features-pro.html' ); ?>
<span>Paid</span>
</a>
<?php endif; ?>
<?php if ( ! defined( 'ARVE_AMP_VERSION' ) ) : ?>
<a href="https://nextgenthemes.com/plugins/arve-accelerated-mobile-pages-addon/">
<figure><img src="<?php echo $img_dir; ?>arve.svg" alt"ARVE"></figure>
<?php nextgenthemes_feature_list_html( ARVE_PATH . 'readme/html/25-description-features-amp.html' ); ?>
<span>Paid</span>
</a>
<?php endif; ?>
<?php if ( ! is_plugin_active( 'regenerate-thumbnails-reminder/regenerate-thumbnails-reminder.php' ) ) : ?>
<a href="<?php echo nextgenthemes_admin_install_search_url( 'Regenerate+Thumbnails+Reminder' ); ?>">
<h1>Regenerate Thumbnails Reminder</h1>
<p>Get a reminder when you change your thumbnail sizes to regenerate them. Note Thumbnails sizes change automatically if you swtich themes.</p>
<span>Free</span>
</a>
<?php endif; ?>
</div>
<?php
}
function nextgenthemes_feature_list_html( $filepath ) {
echo strip_tags( file_get_contents( $filepath ), '<ul></ul><li></li><h3></h3>' );
}
function nextgenthemes_activation_notices() {
$products = nextgenthemes_get_products();
foreach ( $products as $key => $value ) {
if ( $value['active'] && ! $value['valid_key'] ) {
$msg = sprintf(
__( 'Hi there, thanks for your purchase. One last step, please activate your %1$s <a href="%2$s">here now</a>.', ARVE_SLUG ),
$value['name'],
get_admin_url() . 'admin.php?page=nextgenthemes-licenses'
);
new ARVE_Admin_Notice_Factory( $key . '-activation-notice', "<p>$msg</p>", false );
}
}
}
function nextgenthemes_get_products() {
$products = array(
'arve_pro' => array(
'name' => 'ARVE Pro',
'id' => 1253,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-pro/',
),
'arve_amp' => array(
'name' => 'ARVE AMP',
'id' => 16941,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-amp/',
),
'arve_random_video' => array(
'name' => 'ARVE Random Video',
'id' => 31933,
'type' => 'plugin',
'author' => 'Nicolas Jonas',
'url' => 'https://nextgenthemes.com/plugins/arve-random-video/',
)
);
$products = apply_filters( 'nextgenthemes_products', $products );
foreach ( $products as $key => $value ) {
$products[ $key ]['slug'] = $key;
$products[ $key ]['installed'] = false;
$products[ $key ]['active'] = false;
$products[ $key ]['valid_key'] = nextgenthemes_has_valid_key( $key );
$version_define = strtoupper( $key ) . '_VERSION';
$file_define = strtoupper( $key ) . '_FILE';
if ( defined( $version_define ) ) {
$products[ $key ]['version'] = constant( $version_define );
}
if ( defined( $file_define ) ) {
$products[ $key ]['file'] = constant( $file_define );
}
$version_define = "\\nextgenthemes\\$key\\VERSION";
$file_define = "\\nextgenthemes\\$key\\FILE";
if ( defined( $version_define ) ) {
$products[ $key ]['version'] = constant( $version_define );
}
if ( defined( $file_define ) ) {
$products[ $key ]['file'] = constant( $file_define );
}
if ( 'plugin' === $value['type'] ) {
$file_slug = str_replace( '_', '-', $key );
$products[ $key ]['installed'] = nextgenthemes_is_plugin_installed( "$file_slug/$file_slug.php" );
$products[ $key ]['active'] = is_plugin_active( "$file_slug/$file_slug.php" );
}
}
return $products;
}
function nextgenthemes_is_plugin_installed( $plugin_basename ) {
$plugins = get_plugins();
if ( array_key_exists( $plugin_basename, $plugins ) ) {
return true;
} else {
return false;
}
}
/**
* Register the administration menu for this plugin into the WordPress Dashboard menu.
*
* @since 1.0.0
*/
function nextgenthemes_menus() {
$plugin_screen_hook_suffix = add_options_page(
__( 'ARVE Licenses', ARVE_SLUG ),
__( 'ARVE Licenses', ARVE_SLUG ),
'manage_options',
'nextgenthemes-licenses',
'nextgenthemes_licenses_page'
);
}
function nextgenthemes_register_settings() {
add_settings_section(
'keys', # id,
__( 'Licenses', ARVE_SLUG ), # title,
'__return_empty_string', # callback,
'nextgenthemes-licenses' # page
);
foreach ( nextgenthemes_get_products() as $product_slug => $product ) :
$option_basename = "nextgenthemes_{$product_slug}_key";
$option_keyname = $option_basename . '[key]';
add_settings_field(
$option_keyname, # id,
$product['name'], # title,
'nextgenthemes_key_callback', # callback,
'nextgenthemes-licenses', # page,
'keys', # section
array( # args
'product' => $product,
'label_for' => $option_keyname,
'option_basename' => $option_basename,
'attr' => array(
'type' => 'text',
'id' => $option_keyname,
'name' => $option_keyname,
'class' => 'arve-license-input',
'value' => nextgenthemes_get_defined_key( $product_slug ) ? __( 'is defined (wp-config.php?)', ARVE_SLUG ) : nextgenthemes_get_key( $product_slug, 'option_only' ),
)
)
);
register_setting(
'nextgenthemes', # option_group
$option_basename, # option_name
'nextgenthemes_validate_license' # validation callback
);
endforeach;
}
function nextgenthemes_key_callback( $args ) {
echo '<p>';
printf(
'<input%s>',
arve_attr(
array(
'type' => 'hidden',
'id' => $args['option_basename'] . '[product]',
'name' => $args['option_basename'] . '[product]',
'value' => $args['product']['slug'],
)
)
);
printf(
'<input%s%s>',
arve_attr( $args['attr'] ),
nextgenthemes_get_defined_key( $args['product']['slug'] ) ? ' disabled' : ''
);
$defined_key = nextgenthemes_get_defined_key( $args['product']['slug'] );
$key = nextgenthemes_get_key( $args['product']['slug'] );
if ( $defined_key || ! empty( $key ) ) {
submit_button( __( 'Activate License', ARVE_SLUG ), 'primary', $args['option_basename'] . '[activate_key]', false );
submit_button( __( 'Deactivate License', ARVE_SLUG ), 'secondary', $args['option_basename'] . '[deactivate_key]', false );
submit_button( __( 'Check License', ARVE_SLUG ), 'secondary', $args['option_basename'] . '[check_key]', false );
}
echo '</p>';
echo '<p>';
echo __( 'License Status: ', ARVE_SLUG ) . nextgenthemes_get_key_status( $args['product']['slug'] );
echo '</p>';
if ( $args['product']['installed'] && ! $args['product']['active'] ) {
printf( '<strong>%s</strong>', __( 'Plugin is installed but not activated', ARVE_SLUG ) );
} elseif ( ! $args['product']['active'] ) {
printf(
'<a%s>%s</a>',
arve_attr(
array(
'href' => $args['product']['url'],
'class' => 'button button-primary',
)
),
__( 'Not installed, check it out', ARVE_SLUG )
);
}
}
function nextgenthemes_validate_license( $input ) {
if ( ! is_array( $input ) ) {
return sanitize_text_field( $input );
}
$product = $input['product'];
$defined_key = nextgenthemes_get_defined_key( $product );
if ( $defined_key ) {
$option_key = $defined_key;
$key = $defined_key;
} else {
$key = sanitize_text_field( $input['key'] );
$option_key = nextgenthemes_get_key( $product );
}
if ( ( $key !== $option_key ) || isset( $input['activate_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'activate' );
} elseif ( isset( $input['deactivate_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'deactivate' );
} elseif ( isset( $input['check_key'] ) ) {
nextgenthemes_api_update_key_status( $product, $key, 'check' );
}
return $key;
}
function nextgenthemes_get_key( $product, $option_only = false ) {
$defined_key = nextgenthemes_get_defined_key( $product );
if ( ! $option_only && $defined_key ) {
return $defined_key;
}
return get_option( "nextgenthemes_{$product}_key" );
}
function nextgenthemes_get_key_status( $product ) {
return get_option( "nextgenthemes_{$product}_key_status" );
}
function nextgenthemes_update_key_status( $product, $key ) {
update_option( "nextgenthemes_{$product}_key_status", $key );
}
function nextgenthemes_has_valid_key( $product ) {
return ( 'valid' === nextgenthemes_get_key_status( $product ) ) ? true : false;
}
function nextgenthemes_api_update_key_status( $product, $key, $action ) {
$products = nextgenthemes_get_products();
$key_status = nextgenthemes_api_action( $products[ $product ]['id'], $key, $action );
nextgenthemes_update_key_status( $product, $key_status );
}
function nextgenthemes_get_defined_key( $slug ) {
$constant_name = str_replace( '-', '_', strtoupper( $slug . '_KEY' ) );
if ( defined( $constant_name ) && constant( $constant_name ) ) {
return constant( $constant_name );
} else {
return false;
}
}
function nextgenthemes_licenses_page() {
?>
<div class="wrap">
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<form method="post" action="options.php">
<?php do_settings_sections( 'nextgenthemes-licenses' ); ?>
<?php settings_fields( 'nextgenthemes' ); ?>
<?php submit_button( __( 'Save Changes' ), 'primary', 'submit', false ); ?>
</form>
</div>
<?php
}
function nextgenthemes_init_edd_updaters() {
$products = nextgenthemes_get_products();
foreach ( $products as $product ) {
if ( 'plugin' === $product['type'] && ! empty( $product['file'] ) ) {
nextgenthemes_init_plugin_updater( $product );
} elseif ( 'theme' === $product['type'] ) {
nextgenthemes_init_theme_updater( $product );
}
}
}
function nextgenthemes_init_plugin_updater( $product ) {
// setup the updater
new Nextgenthemes_Plugin_Updater(
apply_filters( 'nextgenthemes_api_url', 'https://nextgenthemes.com' ),
$product['file'],
array(
'version' => $product['version'],
'license' => nextgenthemes_get_key( $product['slug'] ),
'item_id' => $product['id'],
'author' => $product['author']
)
);
}
function nextgenthemes_init_theme_updater( $product ) {
new EDD_Theme_Updater(
array(
'remote_api_url' => 'https://nextgenthemes.com',
'version' => $product['version'],
'license' => nextgenthemes_get_key( $product['slug'] ),
'item_id' => $product['name'],
'author' => $product['id'],
'theme_slug' => $product['slug'],
'download_id' => $product['download_id'], // Optional, used for generating a license renewal link
#'renew_url' => $product['renew_link'], // Optional, allows for a custom license renewal link
),
array(
'theme-license' => __( 'Theme License', ARVE_SLUG ),
'enter-key' => __( 'Enter your theme license key.', ARVE_SLUG ),
'license-key' => __( 'License Key', ARVE_SLUG ),
'license-action' => __( 'License Action', ARVE_SLUG ),
'deactivate-license' => __( 'Deactivate License', ARVE_SLUG ),
'activate-license' => __( 'Activate License', ARVE_SLUG ),
'status-unknown' => __( 'License status is unknown.', ARVE_SLUG ),
'renew' => __( 'Renew?', ARVE_SLUG ),
'unlimited' => __( 'unlimited', ARVE_SLUG ),
'license-key-is-active' => __( 'License key is active.', ARVE_SLUG ),
'expires%s' => __( 'Expires %s.', ARVE_SLUG ),
'expires-never' => __( 'Lifetime License.', ARVE_SLUG ),
'%1$s/%2$-sites' => __( 'You have %1$s / %2$s sites activated.', ARVE_SLUG ),
'license-key-expired-%s' => __( 'License key expired %s.', ARVE_SLUG ),
'license-key-expired' => __( 'License key has expired.', ARVE_SLUG ),
'license-keys-do-not-match' => __( 'License keys do not match.', ARVE_SLUG ),
'license-is-inactive' => __( 'License is inactive.', ARVE_SLUG ),
'license-key-is-disabled' => __( 'License key is disabled.', ARVE_SLUG ),
'site-is-inactive' => __( 'Site is inactive.', ARVE_SLUG ),
'license-status-unknown' => __( 'License status is unknown.', ARVE_SLUG ),
'update-notice' => __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.", ARVE_SLUG ),
'update-available' => __( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4$s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.', ARVE_SLUG ),
)
);
}
function nextgenthemes_api_action( $item_id, $key, $action ) {
if ( ! in_array( $action, array( 'activate', 'deactivate', 'check' ), true ) ) {
wp_die( 'invalid action' );
}
// data to send in our API request
$api_params = array(
'edd_action' => $action . '_license',
'license' => sanitize_text_field( $key ),
'item_id' => $item_id,
'url' => home_url()
);
// Call the custom API.
$response = wp_remote_post(
'https://nextgenthemes.com',
array(
'timeout' => 15,
'sslverify' => true,
'body' => $api_params
)
);
// make sure the response came back okay
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
if ( is_wp_error( $response ) ) {
$message = $response->get_error_message();
} else {
$message = __( 'An error occurred, please try again.', ARVE_SLUG );
}
} else {
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
if ( false === $license_data->success ) {
switch ( $license_data->error ) {
case 'expired':
$message = sprintf(
__( 'Your license key expired on %s.' ),
date_i18n( get_option( 'date_format' ), strtotime( $license_data->expires, current_time( 'timestamp' ) ) )
);
break;
case 'revoked':
$message = __( 'Your license key has been disabled.', ARVE_SLUG );
break;
case 'missing':
$message = __( 'Invalid license.', ARVE_SLUG );
break;
case 'invalid':
case 'site_inactive':
$message = __( 'Your license is not active for this URL.', ARVE_SLUG );
break;
case 'item_name_mismatch':
$message = sprintf( __( 'This appears to be an invalid license key for %s.' ), ARVE_SLUG );
break;
case 'no_activations_left':
$message = __( 'Your license key has reached its activation limit.', ARVE_SLUG );
break;
default:
$message = __( 'An error occurred, please try again.', ARVE_SLUG );
break;
}
}
}
if ( empty( $message ) ) {
if ( empty( $license_data->license ) ) {
$textarea_dump = arve_textarea_dump( $response );
$message = sprintf(
__( 'Error. Please report the following:<br> %s', ARVE_SLUG ),
$textarea_dump
);
} else {
$message = $license_data->license;
}
}
return $message;
}
function arve_dump( $var ) {
ob_start();
var_dump( $var ); // phpcs:ignore
return ob_get_clean();
}
function arve_textarea_dump( $var ) {
return sprintf( '<textarea style="width: 100%; height: 70vh;">%s</textarea>', esc_textarea( arve_dump( $var ) ) );
}
@@ -0,0 +1,60 @@
<?php
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped, WordPress.PHP.DevelopmentFunctions.error_log_var_dump
?>
<textarea style="font-family: monospace; width: 100%" rows="25">
ARVE Version: <?php echo $arve_version . "\n"; ?>
ARVE-Pro Version: <?php echo $arve_pro_version . "\n"; ?>
WordPress Version: <?php echo $wp_version . "\n"; ?>
PHP Version: <?php echo phpversion() . "\n"; ?>
ACTIVE PLUGINS:
<?php
$get_plugins = get_plugins();
$active_plugins = get_option( 'active_plugins', array() );
foreach ( $get_plugins as $plugin_path => $plugin ) {
// If the plugin isn't active, don't show it.
if ( ! in_array( $plugin_path, $active_plugins, true ) ) {
continue;
}
echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
if ( is_multisite() ) :
?>
NETWORK ACTIVE PLUGINS:
<?php
$netw_plugins = wp_get_active_network_plugins();
$active_plugins = get_site_option( 'active_sitewide_plugins', array() );
foreach ( $netw_plugins as $plugin_path ) {
$plugin_base = plugin_basename( $plugin_path );
// If the plugin isn't active, don't show it.
if ( ! array_key_exists( $plugin_base, $active_plugins ) ) {
continue;
}
$plugin = get_plugin_data( $plugin_path );
echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n";
}
endif;
?>
ARVE OPTIONS:
<?php var_dump( get_option( 'arve_options_main' ) ); ?>
<?php var_dump( get_option( 'arve_options_params' ) ); ?>
<?php var_dump( get_option( 'arve_options_shortcodes' ) ); ?>
<?php if ( is_plugin_active( 'arve-pro/arve-pro.php' ) ) : ?>
ARVE PRO OPTIONS:
<?php
$pro_options = get_option( 'arve_options_pro' );
unset( $pro_options['key'] );
var_dump( $pro_options );
?>
<?php endif; ?>
</textarea>
@@ -0,0 +1,75 @@
<?php
/**
* Represents the view for the administration dashboard.
*
* This includes the header, options, and other information that should provide
* The User Interface to the end user.
*
* @package Advanced_Responsive_Video_Embedder
* @author Nicolas Jonas
* @license GPL-3.0+
* @link http://nextgenthemes.com
* @copyright 2013 Nicolas Jonas
*/
$options = arve_get_options();
?>
<div class="wrap arve-options-wrap">
<?php if ( arve_display_pro_ad() ) : ?>
<div class="arve-settings-page-ad notice is-dismissible updated">
<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>
<div class="arve-corner-spacer"></div>
<h3>Please rate</h3>
It would really help to get a <a href="https://wordpress.org/support/plugin/advanced-responsive-video-embedder/reviews/#new-post">5 star rating from you.</a>
<h3><a href="https://nextgenthemes.com/plugins/arve-pro/">Pro Addon</a></h3>
<strong><big>10% off</big></strong> first year with discount code <code>settingspage</code></p>
<p>This plugin is financed by purchases of the <a href="https://nextgenthemes.com/plugins/arve-pro/">Pro Addon</a>. The development and support of this plugins has become a job for me so I hope you understand that I can not make all features gratis and that you <a href="https://nextgenthemes.com/plugins/arve-pro/">purchase it</a> to get extra features and support the development.</p>
<ul>
<li><strong>Disable links in embeds (killer feature!)</strong><br>
For example: Clicking on a title in a YouTube embed will not open a new popup/tab/window. <strong>Prevent video hosts to lead your visitors away from your site!</strong> Note this also breaks sharing functionality and is not possible when the provider requires flash. Try it on <a href="https://nextgenthemes.com/plugins/arve-pro/">this page</a>. Right click on links still works.</li>
<li><strong>Lazyload mode</strong><br>
Make your site load <strong>faster</strong> by loading only a image instead of the entire video player on pageload. </li>
<li><strong>Lazyload -> Lightbox</strong><br>
Shows the Video in a Lightbox after clicking a preview image</li>
<li><strong>Link -> Lightbox</strong><br>
Use simple links as triggers for lightboxed videos</li>
<li>Automatic or custom thumbnail images</li>
<li>Automatic or custom titles on top of your thumbnails</li>
<li>'Expand on click' feature</li>
<li>3 hover styles</li>
<li>2 play icon styles to choose from</li>
<li>Responsive thumbnails using cutting edge HTML5 technology</li>
<li><strong>Feel good about yourself</strong><br>
for supporting my 5+ years work on this plugin. Tons of hours, weekends … always worked on improving it.</li>
<li>Show the latest video of a YouTube channel by using the channel URL (updated/cached hourly)</li>
<li><strong><a href="https://nextgenthemes.com/plugins/arve-pro/">Get the ARVE Pro Addon</a></strong></li>
</ul>
</div>
<?php endif; ?>
<h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
<h2 class="nav-tab-wrapper arve-settings-tabs"></h2>
<form class="arve-options-form" method="post" action="options.php">
<?php do_settings_sections( ARVE_SLUG ); ?>
<?php settings_fields( 'arve-settings-group' ); ?>
<input type="hidden" id="arve_options_main[last_settings_tab]" name="arve_options_main[last_settings_tab]" value="<?php echo esc_attr( $options['last_settings_tab'] ); ?>">
</form>
</div>
@@ -0,0 +1 @@
<?php // Silence is golden
@@ -0,0 +1,14 @@
<ul class="arve-list-small">
<li><strong>Disable links in embeds</strong><br>
For example: Clicking on a title in a YouTube embed will not open a new popup/tab/window. <strong>Prevent video hosts to lead your visitors away from your site!</strong> Note this also breaks sharing functionality and is not possible when the provider requires flash.</li>
<li><strong>Lazyload mode</strong><br>
Make your site load <strong>faster</strong> by loading only a image instead of the entire video player on pageload. </li>
<li><strong>Lazyload -> Lightbox</strong><br>
Shows the Video in a Lightbox after clicking a preview image</li>
<li><strong>Link -> Lightbox</strong><br>
Use simple links as triggers for lightboxed videos</li>
<li>Automatic or custom titles and thumbnails images</li>
<li>'Expand on click' feature</li>
<li>Show the latest video of a YouTube channel by using the channel URL (updated/cached hourly)</li>
<li>And more, for a <strong><a href="https://nextgenthemes.com/plugins/arve-pro/">complete feature list</a></strong> and purchase please visit the <strong><a href="https://nextgenthemes.com/plugins/arve-pro/">official site</a></strong></li>
</ul>
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 63 KiB