Commit cb596cf3 by o.kimura

保留中ファイル追加

parent 0c0573ab
Showing with 4864 additions and 0 deletions
<?php
/*
Plugin Name: Contact Form 7 Multi-Step Forms
Plugin URI: http://www.mymonkeydo.com/contact-form-7-multi-step-module/
Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
Author: Webhead LLC.
Author URI: http://webheadcoder.com
Version: 4.2
Text Domain: contact-form-7-multi-step-module
*/
/* Copyright 2021 Webhead LLC (email: info at webheadcoder.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
if ( !defined( 'ABSPATH' ) ) {
exit;
}
if ( function_exists( 'cf7msm_fs' ) ) {
cf7msm_fs()->set_basename( false, __FILE__ );
} else {
// DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
if ( !function_exists( 'cf7msm_fs' ) ) {
// Create a helper function for easy SDK access.
function cf7msm_fs()
{
global $cf7msm_fs ;
if ( !isset( $cf7msm_fs ) ) {
// Include Freemius SDK.
require_once dirname( __FILE__ ) . '/freemius/start.php';
$cf7msm_fs = fs_dynamic_init( array(
'id' => '1614',
'slug' => 'contact-form-7-multi-step-module',
'type' => 'plugin',
'public_key' => 'pk_b445061ad8b540f6a89c2c4f4df19',
'is_premium' => false,
'premium_suffix' => '(Pro)',
'has_addons' => false,
'has_paid_plans' => true,
'menu' => array(
'first-path' => 'plugins.php',
'contact' => false,
'support' => false,
),
'is_live' => true,
) );
}
return $cf7msm_fs;
}
// Init Freemius.
cf7msm_fs();
// Signal that SDK was initiated.
do_action( 'cf7msm_fs_loaded' );
define( 'CF7MSM_VERSION', '4.2' );
define( 'CF7MSM_PLUGIN', __FILE__ );
define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
define( 'CF7MSM_MIN_CF7_VERSION', '4.8' );
define( 'CF7MSM_LEARN_MORE_URL', 'https://webheadcoder.com/contact-form-7-multi-step-forms/#pro' );
define( 'CF7MSM_COOKIE_SIZE_THRESHOLD', 3684 );
//4093 * 90%
/**
* Change update message
*/
function cf7msm_fs_custom_connect_message_on_update(
$message,
$user_first_name,
$plugin_title,
$user_login,
$site_link,
$freemius_link
)
{
$limited_time = '';
return cf7msm_kses( sprintf( __( 'Please help improve the %1$s plugin! I have chosen to use %2$s to get an idea of how users use my plugin.<br><br> If you opt-in, the administrator email and some data about your usage of %1$s will be sent to %2$s. If you skip this, that\'s okay! The plugin will still work just fine.', 'contact-form-7-multi-step-module' ), '<strong>' . $plugin_title . '</strong>', $freemius_link ) ) . $limited_time;
}
cf7msm_fs()->add_filter(
'connect_message_on_update',
'cf7msm_fs_custom_connect_message_on_update',
10,
6
);
/**
* Add account link if paying.
*/
function cf7msm_plugin_action_links( $links )
{
if ( !is_array( $links ) ) {
$links = array();
}
if ( cf7msm_fs()->is_not_paying() ) {
$links[] = '<a href="' . CF7MSM_LEARN_MORE_URL . '" target="_blank">' . __( 'Learn about PRO' ) . '</a>';
}
return $links;
}
add_filter( "plugin_action_links_" . plugin_basename( CF7MSM_PLUGIN ), 'cf7msm_plugin_action_links' );
/**
* Run on activation
*/
function cf7msm_activation()
{
$stats = get_option( '_cf7msm_stats', array() );
$install_date = ( !empty($stats['install_date']) ? $stats['install_date'] : 0 );
if ( empty($install_date) ) {
$stats['install_date'] = time();
update_option( '_cf7msm_stats', $stats );
}
update_option( '_cf7msm_version', CF7MSM_VERSION );
}
register_activation_hook( CF7MSM_PLUGIN, 'cf7msm_activation' );
/**
* Check if everything is up to date.
*/
function cf7msm_plugin_check()
{
$version = get_option( '_cf7msm_version', '' );
if ( $version !== CF7MSM_PLUGIN ) {
cf7msm_activation();
}
}
add_action( 'plugins_loaded', 'cf7msm_plugin_check' );
/**
* Run on deactivation
*/
function cf7msm_deactivation()
{
delete_option( '_cf7msm_stats' );
delete_option( '_cf7msm_version' );
}
register_deactivation_hook( CF7MSM_PLUGIN, 'cf7msm_deactivation' );
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'cf7msm.php';
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'cf7msm-admin.php';
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/common.php';
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-multistep.php';
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-session.php';
require_once plugin_dir_path( CF7MSM_PLUGIN ) . 'form-tags/module-back.php';
}
}
<?php
/**
* Remove br from hidden tags.
*/
function cf7msm_wpcf7_form_elements_return_false($form) {
return preg_replace_callback('/<p>(<input\stype="hidden"\sname="_cf7msm_multistep_tag"(?:.*?))<\/p>/ism', 'cf7msm_wpcf7_form_elements_return_false_callback', $form);
}
add_filter('wpcf7_form_elements', 'cf7msm_wpcf7_form_elements_return_false');
function cf7msm_wpcf7_form_elements_return_false_callback($matches = array()) {
return "\n".'<!-- CF7MSM -->'."\n".'<div style=\'display:none;\'>'.str_replace('<br>', '', str_replace('<br />', '', stripslashes_deep($matches[1]))).'</div>'."\n".'<!-- End CF7MSM -->'."\n";
}
\ No newline at end of file
.tag-generator-panel .control-box input.oneline.cf7msm-url {
width: 80%;
}
\ No newline at end of file
(function($) {
$('form.tag-generator-panel .cf7msm-multistep .cf7msm-multistep-values').change(function(){
var current_step = $('input[name="values_current_step"]', $(this.form)).val();
var total_steps = $('input[name="values_total_steps"]', $(this.form)).val();
var next_url = $('input[name="next_url"]', $(this.form)).val();
var value = current_step + '-' + total_steps;
if ( next_url.length > 0 ) {
value += '-' + next_url;
}
$('input[name="values"]', $(this.form)).val( value );
if ( total_steps > 3 ) {
$(".cf7msm-faq", $(this.form)).fadeIn();
}
else {
$(".cf7msm-faq", $(this.form)).fadeOut();
}
});
$('form.tag-generator-panel .cf7msm-multistep input[name="last_step"]').change(function() {
if ($(this).is(":checked")) {
$('input[name="send_email"]', $(this.form)).prop('checked', true);
}
});
})(jQuery);
\ No newline at end of file
<?php
/* Copyright 2016 Webhead LLC (email: info at webheadcoder.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Initialize this wpcf7 shortcode.
*/
function cf7msm_add_shortcode_back() {
if (function_exists('wpcf7_add_form_tag')) {
wpcf7_add_form_tag(
array( 'back', 'previous' ),
'cf7msm_back_shortcode_handler'
);
}
else if (function_exists('wpcf7_add_shortcode')) {
wpcf7_add_shortcode(
array( 'back', 'previous' ),
'cf7msm_back_shortcode_handler'
);
}
}
add_action( 'wpcf7_init', 'cf7msm_add_shortcode_back' );
/**
* Handle the back form shortcode.
*/
function cf7msm_back_shortcode_handler( $tag ) {
if (!class_exists('WPCF7_FormTag') || !function_exists('wpcf7_form_controls_class'))
return;
$tag = new WPCF7_FormTag( $tag );
$class = wpcf7_form_controls_class( $tag->type );
$atts = array();
$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
if ( empty( $value ) ) {
if ( $tag->type == 'previous') {
$value = esc_html( __( 'Previous', 'contact-form-7-multi-step-module' ) );
}
else {
//using old version
$value = esc_html( __( 'Back', 'contact-form-7-multi-step-module' ) );
}
}
$atts['type'] = 'button';
$atts['value'] = $value;
$atts = wpcf7_format_atts( $atts );
$html = sprintf( '<input %1$s />', $atts );
return $html;
}
/**
* Add to the wpcf7 tag generator.
*/
function cf7msm_add_tag_generator_back() {
if ( class_exists( 'WPCF7_TagGenerator' ) ) {
$tag_generator = WPCF7_TagGenerator::get_instance();
$tag_generator->add( 'previous', esc_html( __( 'previous', 'contact-form-7-multi-step-module' ) ),
'cf7msm_previous_tag_pane', array( 'nameless' => 1 ) );
}
else if ( function_exists( 'wpcf7_add_tag_generator' ) ) {
wpcf7_add_tag_generator( 'back', esc_html( __( 'Back button', 'contact-form-7-multi-step-module' ) ),
'wpcf7-cf7msm-back', 'wpcf7_cf7msm_back', array( 'nameless' => 1 ) );
}
}
add_action( 'admin_init', 'cf7msm_add_tag_generator_back', 55 );
/**
* Multistep tag pane.
*/
function cf7msm_previous_tag_pane( $contact_form, $args = '' ) {
$args = wp_parse_args( $args, array() );
?>
<div class="control-box cf7msm-multistep">
<fieldset>
<legend><?php cf7msm_form_tag_header_text( esc_html( __( 'Generate a form-tag for a previous button for a multistep form', 'contact-form-7-multi-step-module' ) ) ); ?></legend>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Label', 'contact-form-7-multi-step-module' ) ); ?></label></th>
<td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" />
<label for="tag-generator-panel-previous">
<span class="description"><?php echo esc_html( __( 'The label on the button.', 'contact-form-7-multi-step-module' ) ); ?></span>
</label></td>
</tr>
<tr>
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7-multi-step-module' ) ); ?></label></th>
<td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
</tr>
<tr>
<th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7-multi-step-module' ) ); ?></label></th>
<td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="insert-box">
<input type="text" name="previous" class="tag code" readonly="readonly" onfocus="this.select()" />
<div class="submitbox">
<input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7-multi-step-module' ) ); ?>" />
</div>
<br class="clear" />
<p class="description mail-tag"><label><?php echo esc_html( __( 'This field should not be used on the Mail tab.', 'contact-form-7-multi-step-module' ) ); ?></label></p>
<?php cf7msm_form_tag_footer_text();?>
</div>
<?php
}
/**
* Deprecated way to generate back tag.
*/
function wpcf7_cf7msm_back( $contact_form ) {
?>
<div id="wpcf7-cf7msm-back" class="hidden">
<form action="">
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'contact-form-7-multi-step-module' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'contact-form-7-multi-step-module' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Label', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'contact-form-7-multi-step-module' ) ); ?>)<br />
<input type="text" name="values" class="oneline" /></td>
<td></td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( 'Copy this code and paste it into the form left.', 'contact-form-7-multi-step-module' ) ); ?><br /><input type="text" name="back" class="tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>
<?php
/* Copyright 2012 Webhead LLC (email: info at webheadcoder.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Initialize this form shortcode.
*/
function cf7msm_add_shortcode_form_field()
{
if ( function_exists( 'wpcf7_add_form_tag' ) ) {
wpcf7_add_form_tag( array( 'multiform', 'multiform*' ), 'cf7msm_multiform_shortcode_handler', [
'name-attr' => false,
] );
} else {
if ( function_exists( 'wpcf7_add_shortcode' ) ) {
wpcf7_add_shortcode( array( 'multiform', 'multiform*' ), 'cf7msm_multiform_shortcode_handler', true );
}
}
}
add_action( 'wpcf7_init', 'cf7msm_add_shortcode_form_field' );
/* Shortcode handler */
function cf7msm_multiform_shortcode_handler( $tag )
{
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$values = (array) $tag['values'];
$field_name = '';
if ( !empty($values) ) {
$field_name = current( $values );
} else {
if ( !empty($name) ) {
$field_name = $name;
} else {
if ( !empty($options) ) {
// un-quoted field name
$field_name = $options[0];
}
}
}
if ( empty($field_name) ) {
return '';
}
$atts = '';
$id_att = '';
$class_att = '';
$size_att = '';
$maxlength_att = '';
$tabindex_att = '';
$title_att = '';
$class_att .= ' wpcf7-form';
foreach ( $options as $option ) {
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
$id_att = $matches[1];
}
}
if ( $id_att ) {
$id_att = trim( $id_att );
}
$value = '';
//return raw value, let filters sanitize if needed.
$cf7msm_posted_data = cf7msm_get( 'cf7msm_posted_data' );
if ( !empty($cf7msm_posted_data) && is_array( $cf7msm_posted_data ) ) {
$value = ( isset( $cf7msm_posted_data[$field_name] ) ? $cf7msm_posted_data[$field_name] : '' );
//check for free_text
if ( !empty($value) ) {
// if value is selected/not empty, set it to the free_text value.
if ( isset( $cf7msm_posted_data[CF7MSM_FREE_TEXT_PREFIX_RADIO . $field_name] ) ) {
$value = $cf7msm_posted_data[CF7MSM_FREE_TEXT_PREFIX_RADIO . $field_name];
} else {
if ( isset( $cf7msm_posted_data[CF7MSM_FREE_TEXT_PREFIX_CHECKBOX . $field_name] ) ) {
if ( is_array( $value ) ) {
end( $value );
$last_key = key( $value );
reset( $value );
$value[$last_key] = $cf7msm_posted_data[CF7MSM_FREE_TEXT_PREFIX_CHECKBOX . $field_name];
} else {
$value = $cf7msm_posted_data[CF7MSM_FREE_TEXT_PREFIX_CHECKBOX . $field_name];
}
}
}
}
}
if ( is_array( $value ) ) {
$value = implode( ", ", $value );
}
//wpcf7_form_field_value filter deprecated
$value = apply_filters_deprecated(
'wpcf7_form_field_value',
array( apply_filters_deprecated(
'wpcf7_form_field_value_' . $id_att,
array( $value ),
'3.0.4',
'cf7msm_form_field_value_' . $id_att
), $field_name, $value ),
'3.0.4',
'cf7msm_form_field_value'
);
$value = apply_filters(
'cf7msm_form_field_value',
apply_filters( 'cf7msm_form_field_value_' . $id_att, $value ),
$field_name,
$id_att,
$value
);
return wp_kses( $value, 'post' );
}
/**
* Add to the wpcf7 tag generator.
*/
function cf7msm_add_tag_generator_form_field()
{
if ( class_exists( 'WPCF7_TagGenerator' ) ) {
$tag_generator = WPCF7_TagGenerator::get_instance();
$tag_generator->add( 'form-field', esc_html( __( 'multiform', 'contact-form-7-multi-step-module' ) ), 'cf7msm_form_field_tag_pane' );
} else {
if ( function_exists( 'wpcf7_add_tag_generator' ) ) {
wpcf7_add_tag_generator( 'form', esc_html( __( 'Form value', 'contact-form-7-multi-step-module' ), 'wpcf7-tg-pane-form', 'wpcf7_tg_pane_form' ) );
}
}
}
add_action( 'admin_init', 'cf7msm_add_tag_generator_form_field', 30 );
/**
* Form tag pane.
*/
function cf7msm_form_field_tag_pane( $contact_form, $args = '' )
{
$args = wp_parse_args( $args, array() );
?>
<div class="control-box cf7msm-multistep">
<fieldset>
<legend><?php
cf7msm_form_tag_header_text( esc_html( __( 'Generate a form-tag to show a field from a previous form in a multistep form', 'contact-form-7-multi-step-module' ) ) );
?></legend>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="<?php
echo esc_attr( $args['content'] . '-name' ) ;
?>"><?php
echo esc_html( __( 'Name', 'contact-form-7-multi-step-module' ) ) ;
?></label></th>
<td><input type="text" name="values" class="tg-name oneline" id="tag-generator-panel-name" />
<br>
<label for="tag-generator-panel-name">
<span class="description"><?php
echo esc_html( __( 'The name of the field from a form in a previous step.' ) ) ;
?></span>
</label>
</td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<div class="insert-box">
<input type="hidden" name="values" value="" />
<input type="text" name="multiform" class="tag code" readonly="readonly" onfocus="this.select()" />
<div class="submitbox">
<input type="button" class="button button-primary insert-tag" value="<?php
echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ) ;
?>" />
</div>
<br class="clear" />
<p class="description mail-tag"><label><?php
echo esc_html( __( "This field should not be used on the Mail tab.", 'contact-form-7-multi-step-module' ) ) ;
?></label>
</p>
<?php
cf7msm_form_tag_footer_text();
?>
</div>
<?php
}
/**
* Deprecated way to generate form tag
*/
function wpcf7_tg_pane_form()
{
?>
<div id="wpcf7-tg-pane-form" class="hidden">
<form action="">
<table>
<tr><td><?php
echo esc_html( __( 'Name of previous form field', 'contact-form-7-multi-step-module' ) ) ;
?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
<tr>
<td><code>id</code> (<?php
echo esc_html( __( 'optional', 'contact-form-7-multi-step-module' ) ) ;
?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
</tr>
</table>
<div class="tg-tag"><?php
echo esc_html( __( 'Copy this code and paste it into the form left.', 'contact-form-7-multi-step-module' ) ) ;
?><br /><input type="text" name="form" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php
echo esc_html( __( 'Mail fields currently not supported.', 'contact-form-7-multi-step-module' ) ) ;
?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" readonly="readonly" /></div>
</form>
</div>
<?php
}
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-notice[data-id=license_not_whitelabeled].success,.fs-notice[data-id=license_whitelabeled].success{color:inherit;border-left-color:#00a0d2}.fs-notice[data-id=license_not_whitelabeled].success label.fs-plugin-title,.fs-notice[data-id=license_whitelabeled].success label.fs-plugin-title{display:none}#fs_account .postbox,#fs_account .widefat{max-width:800px}#fs_account h3{font-size:1.3em;padding:12px 15px;margin:0 0 12px 0;line-height:1.4;border-bottom:1px solid #f1f1f1}#fs_account h3 .dashicons{width:26px;height:26px;font-size:1.3em}#fs_account i.dashicons{font-size:1.2em;height:1.2em;width:1.2em}#fs_account .dashicons{vertical-align:middle}#fs_account .fs-header-actions{position:absolute;top:17px;right:15px;font-size:.9em}#fs_account .fs-header-actions ul{margin:0}#fs_account .fs-header-actions li{float:left}#fs_account .fs-header-actions li form{display:inline-block}#fs_account .fs-header-actions li a{text-decoration:none}#fs_account_details .button-group{float:right}.rtl #fs_account .fs-header-actions{left:15px;right:auto}.fs-key-value-table{width:100%}.fs-key-value-table form{display:inline-block}.fs-key-value-table tr td:first-child{text-align:right}.fs-key-value-table tr td:first-child nobr{font-weight:bold}.fs-key-value-table tr td:first-child form{display:block}.fs-key-value-table tr td.fs-right{text-align:right}.fs-key-value-table tr.fs-odd{background:#ebebeb}.fs-key-value-table td,.fs-key-value-table th{padding:10px}.fs-key-value-table code{line-height:28px}.fs-key-value-table var,.fs-key-value-table code,.fs-key-value-table input[type=text]{color:#0073aa;font-size:16px;background:none}.fs-key-value-table input[type=text]{width:100%;font-weight:bold}.fs-field-beta_program label{margin-left:7px}label.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error{background:#dc3232}#fs_sites .fs-scrollable-table .fs-table-body{max-height:200px;overflow:auto;border:1px solid #e5e5e5}#fs_sites .fs-scrollable-table .fs-table-body>table.widefat{border:none !important}#fs_sites .fs-scrollable-table .fs-main-column{width:100%}#fs_sites .fs-scrollable-table .fs-site-details td:first-of-type{text-align:right;color:gray;width:1px}#fs_sites .fs-scrollable-table .fs-site-details td:last-of-type{text-align:right}#fs_sites .fs-scrollable-table .fs-install-details table tr td{width:1px;white-space:nowrap}#fs_sites .fs-scrollable-table .fs-install-details table tr td:last-of-type{width:auto}#fs_addons h3{border:none;margin-bottom:0;padding:4px 5px}#fs_addons td{vertical-align:middle}#fs_addons thead{white-space:nowrap}#fs_addons td:first-child,#fs_addons th:first-child{text-align:left;font-weight:bold}#fs_addons td:last-child,#fs_addons th:last-child{text-align:right}#fs_addons th{font-weight:bold}#fs_billing_address{width:100%}#fs_billing_address tr td{width:50%;padding:5px}#fs_billing_address tr:first-of-type td{padding-top:0}#fs_billing_address span{font-weight:bold}#fs_billing_address input,#fs_billing_address select{display:block;width:100%;margin-top:5px}#fs_billing_address input::-moz-placeholder,#fs_billing_address select::-moz-placeholder{color:transparent;opacity:1}#fs_billing_address input:-ms-input-placeholder,#fs_billing_address select:-ms-input-placeholder{color:transparent}#fs_billing_address input::-webkit-input-placeholder,#fs_billing_address select::-webkit-input-placeholder{color:transparent}#fs_billing_address input.fs-read-mode,#fs_billing_address select.fs-read-mode{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode td span{display:none}#fs_billing_address.fs-read-mode input,#fs_billing_address.fs-read-mode select{border-color:transparent;color:#777;border-bottom:1px dashed #ccc;padding-left:0;background:none}#fs_billing_address.fs-read-mode input::-moz-placeholder,#fs_billing_address.fs-read-mode select::-moz-placeholder{color:#ccc;opacity:1}#fs_billing_address.fs-read-mode input:-ms-input-placeholder,#fs_billing_address.fs-read-mode select:-ms-input-placeholder{color:#ccc}#fs_billing_address.fs-read-mode input::-webkit-input-placeholder,#fs_billing_address.fs-read-mode select::-webkit-input-placeholder{color:#ccc}#fs_billing_address button{display:block;width:100%}@media screen and (max-width: 639px){#fs_account .fs-header-actions{position:static;padding:0 15px 12px 15px;margin:0 0 12px 0}#fs_account .fs-header-actions li{float:none;display:inline-block}#fs_account #fs_account_details{display:block}#fs_account #fs_account_details tbody,#fs_account #fs_account_details tr,#fs_account #fs_account_details td,#fs_account #fs_account_details th{display:block}#fs_account #fs_account_details tr td:first-child{text-align:left}#fs_account #fs_account_details tr td:nth-child(2){padding:0 12px}#fs_account #fs_account_details tr td:nth-child(2) code{margin:0;padding:0}#fs_account #fs_account_details tr td:nth-child(2) label{margin-left:0}#fs_account #fs_account_details tr td:nth-child(3){text-align:left}#fs_account #fs_account_details tr.fs-field-plan td:nth-child(2) .button-group{float:none;margin:12px 0}}
#fs_affiliation_content_wrapper #messages{margin-top:25px}#fs_affiliation_content_wrapper h3{font-size:24px;padding:0;margin-left:0}#fs_affiliation_content_wrapper ul li{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;list-style-type:none}#fs_affiliation_content_wrapper ul li:before{content:"✓";margin-right:10px;font-weight:bold}#fs_affiliation_content_wrapper p:not(.description),#fs_affiliation_content_wrapper li,#fs_affiliation_content_wrapper label{font-size:16px !important;line-height:26px !important}#fs_affiliation_content_wrapper .button{margin-top:20px;margin-bottom:7px;line-height:35px;height:40px;font-size:16px}#fs_affiliation_content_wrapper .button#cancel_button{margin-right:5px}#fs_affiliation_content_wrapper form .input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form .input-container .input-label{font-weight:bold;display:block;width:100%}#fs_affiliation_content_wrapper form .input-container.input-container-text label,#fs_affiliation_content_wrapper form .input-container.input-container-text input,#fs_affiliation_content_wrapper form .input-container.input-container-text textarea{display:block}#fs_affiliation_content_wrapper form .input-container #add_domain,#fs_affiliation_content_wrapper form .input-container .remove-domain{text-decoration:none;display:inline-block;margin-top:3px}#fs_affiliation_content_wrapper form .input-container #add_domain:focus,#fs_affiliation_content_wrapper form .input-container .remove-domain:focus{box-shadow:none}#fs_affiliation_content_wrapper form .input-container #add_domain.disabled,#fs_affiliation_content_wrapper form .input-container .remove-domain.disabled{color:#aaa;cursor:default}#fs_affiliation_content_wrapper form #extra_domains_container .description{margin-top:0;position:relative;top:-4px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container{margin-bottom:15px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain{display:inline-block;margin-right:5px}#fs_affiliation_content_wrapper form #extra_domains_container .extra-domain-input-container .domain:last-of-type{margin-bottom:0}
@media screen and (max-width: 782px){#wpbody-content{padding-bottom:0 !important}}
.fs-notice[data-id^=clone_resolution_options_notice]{padding:0;color:inherit !important}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-body{padding:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-notice-header{padding:5px 10px}.fs-notice[data-id^=clone_resolution_options_notice] ol{margin-top:0;margin-bottom:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{display:flex;flex-direction:row;padding:0 10px 10px}@media(max-width: 750px){.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-options-container{flex-direction:column}}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option{border:1px solid #ccc;padding:10px 10px 15px 10px;flex:auto;margin:5px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:first-child{margin-left:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option:last-child{margin-right:0}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-resolution-option strong{font-size:1.2em;padding:2px;line-height:1.5em}.fs-notice[data-id^=clone_resolution_options_notice] a{text-decoration:none}.fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:10px}.rtl .fs-notice[data-id^=clone_resolution_options_notice] .button{margin-right:0;margin-left:10px}.fs-notice[data-id^=clone_resolution_options_notice] .fs-clone-documentation-container{padding:0 10px 15px}.fs-notice[data-id=temporary_duplicate_notice] #fs_clone_resolution_error_message{border:1px solid #d3135a;background:#fee;color:#d3135a;padding:10px}.fs-notice[data-id=temporary_duplicate_notice] ol{margin-top:0}
.fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}.theme-browser .theme .fs-premium-theme-badge-container{position:absolute;right:0;top:0}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge{position:relative;top:0;margin-top:10px;text-align:center}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-premium-theme-badge{font-size:1.1em}.theme-browser .theme .fs-premium-theme-badge-container .fs-badge.fs-beta-theme-badge{background:#00a0d2}.fs-switch{position:relative;display:inline-block;color:#ccc;text-shadow:0 1px 1px rgba(255,255,255,.8);height:18px;padding:6px 6px 5px 6px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);background:#ececec;box-shadow:0 0 4px rgba(0,0,0,.1),inset 0 1px 3px 0 rgba(0,0,0,.1);cursor:pointer}.fs-switch span{display:inline-block;width:35px;text-transform:uppercase}.fs-switch .fs-toggle{position:absolute;top:1px;width:37px;height:25px;border:1px solid #ccc;border:1px solid rgba(0,0,0,.3);border-radius:4px;background:#fff;background-color:#fff;background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #ececec), color-stop(1, #fff));background-image:-webkit-linear-gradient(top, #ececec, #fff);background-image:-moz-linear-gradient(top, #ececec, #fff);background-image:-ms-linear-gradient(top, #ececec, #fff);background-image:-o-linear-gradient(top, #ececec, #fff);background-image:linear-gradient(top, bottom, #ececec, #fff);box-shadow:inset 0 1px 0 0 rgba(255,255,255,.5);z-index:999;-moz-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-o-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-ms-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);-webkit-transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1);transition:.4s cubic-bezier(0.54, 1.6, 0.5, 1)}.fs-switch.fs-off .fs-toggle{left:2%}.fs-switch.fs-on .fs-toggle{left:54%}.fs-switch.fs-round{top:8px;padding:4px 25px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round .fs-toggle{top:0;width:24px;height:24px;-moz-border-radius:24px;-webkit-border-radius:24px;border-radius:24px}.fs-switch.fs-round.fs-off .fs-toggle{left:-1px}.fs-switch.fs-round.fs-on{background:#0085ba}.fs-switch.fs-round.fs-on .fs-toggle{left:25px}.fs-switch.fs-small.fs-round{padding:1px 19px}.fs-switch.fs-small.fs-round .fs-toggle{top:0;width:18px;height:18px;-moz-border-radius:18px;-webkit-border-radius:18px;border-radius:18px}.fs-switch.fs-small.fs-round.fs-on .fs-toggle{left:19px}body.fs-loading,body.fs-loading *{cursor:wait !important}#fs_frame{line-height:0;font-size:0}.fs-full-size-wrapper{margin:40px 0 -65px -20px}@media(max-width: 600px){.fs-full-size-wrapper{margin:0 0 -65px -10px}}.fs-notice{position:relative}.fs-notice.fs-has-title{margin-bottom:30px !important}.fs-notice.success{color:green}.fs-notice.promotion{border-color:#00a0d2 !important;background-color:#f2fcff !important}.fs-notice .fs-notice-body{margin:.5em 0;padding:2px}.fs-notice .fs-close{cursor:pointer;color:#aaa;float:right}.fs-notice .fs-close:hover{color:#666}.fs-notice .fs-close>*{margin-top:7px;display:inline-block}.fs-notice label.fs-plugin-title{background:rgba(0,0,0,.3);color:#fff;padding:2px 10px;position:absolute;top:100%;bottom:auto;right:auto;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;left:10px;font-size:12px;font-weight:bold;cursor:auto}div.fs-notice.updated,div.fs-notice.success,div.fs-notice.promotion{display:block !important}.rtl .fs-notice .fs-close{float:left}.fs-secure-notice{position:fixed;top:32px;left:160px;right:0;background:#ebfdeb;padding:10px 20px;color:green;z-index:9999;-moz-box-shadow:0 2px 2px rgba(6,113,6,.3);-webkit-box-shadow:0 2px 2px rgba(6,113,6,.3);box-shadow:0 2px 2px rgba(6,113,6,.3);opacity:.95;filter:alpha(opacity=95)}.fs-secure-notice:hover{opacity:1;filter:alpha(opacity=100)}.fs-secure-notice a.fs-security-proof{color:green;text-decoration:none}@media screen and (max-width: 960px){.fs-secure-notice{left:36px}}@media screen and (max-width: 600px){.fs-secure-notice{display:none}}@media screen and (max-width: 1250px){#fs_promo_tab{display:none}}@media screen and (max-width: 782px){.fs-secure-notice{left:0;top:46px;text-align:center}}span.fs-submenu-item.fs-sub:before{content:"↳";padding:0 5px}.rtl span.fs-submenu-item.fs-sub:before{content:"↲"}.fs-submenu-item.pricing.upgrade-mode{color:#adff2f}.fs-submenu-item.pricing.trial-mode{color:#83e2ff}#adminmenu .update-plugins.fs-trial{background-color:#00b9eb}.fs-ajax-spinner{border:0;width:20px;height:20px;margin-right:5px;vertical-align:sub;display:inline-block;background:url("/wp-admin/images/wpspin_light-2x.gif");background-size:contain;margin-bottom:-2px}.wrap.fs-section h2{text-align:left}.plugins p.fs-upgrade-notice{border:0;background-color:#d54e21;padding:10px;color:#f9f9f9;margin-top:10px}
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.fs-switch-label{font-size:20px;line-height:31px;margin:0 5px}#fs_log_book table{font-family:Consolas,Monaco,monospace;font-size:12px}#fs_log_book table th{color:#ccc}#fs_log_book table tr{background:#232525}#fs_log_book table tr.alternate{background:#2b2b2b}#fs_log_book table tr td.fs-col--logger{color:#5a7435}#fs_log_book table tr td.fs-col--type{color:#ffc861}#fs_log_book table tr td.fs-col--function{color:#a7b7b1;font-weight:bold}#fs_log_book table tr td.fs-col--message,#fs_log_book table tr td.fs-col--message a{color:#9a73ac !important}#fs_log_book table tr td.fs-col--file{color:#d07922}#fs_log_book table tr td.fs-col--timestamp{color:#6596be}
.fs-notice[data-id^=gdpr_optin_actions] .underlined{text-decoration:underline}.fs-notice[data-id^=gdpr_optin_actions] ul .button,.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{vertical-align:middle}.fs-notice[data-id^=gdpr_optin_actions] ul .action-description{display:inline-block;margin-left:3px}
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
.fs-tooltip-trigger{position:relative}.fs-tooltip-trigger:not(a){cursor:help}.fs-tooltip-trigger .dashicons{float:none !important}.fs-tooltip-trigger .fs-tooltip{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:rgba(0,0,0,.8);color:#fff !important;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:-17px;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left;text-transform:none !important}.rtl .fs-tooltip-trigger .fs-tooltip{text-align:right;left:auto;right:-17px}.fs-tooltip-trigger .fs-tooltip::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:rgba(0,0,0,.8) transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl .fs-tooltip-trigger .fs-tooltip::after{right:21px;left:auto}.fs-tooltip-trigger:hover .fs-tooltip{visibility:visible;opacity:1}.fs-permissions .fs-permission.fs-disabled{color:#aaa}.fs-permissions .fs-permission.fs-disabled .fs-permission-description span{color:#aaa}.fs-permissions .fs-permission .fs-switch-feedback{position:absolute;right:15px;top:52px}.fs-permissions ul{height:0;overflow:hidden;margin:0}.fs-permissions ul li{padding:17px 15px;margin:0;position:relative}.fs-permissions ul li>i.dashicons{float:left;font-size:30px;width:30px;height:30px;padding:5px}.fs-permissions ul li .fs-switch{float:right}.fs-permissions ul li .fs-permission-description{margin-left:55px}.fs-permissions ul li .fs-permission-description span{font-size:14px;font-weight:500;color:#23282d}.fs-permissions ul li .fs-permission-description .fs-tooltip{font-size:13px;font-weight:bold}.fs-permissions ul li .fs-permission-description .fs-tooltip-trigger .dashicons{margin:-1px 2px 0 2px}.fs-permissions ul li .fs-permission-description p{margin:2px 0 0 0}.fs-permissions.fs-open{background:#fff}.fs-permissions.fs-open ul{overflow:initial;height:auto;margin:20px 0 10px 0}.fs-permissions .fs-switch-feedback .fs-ajax-spinner{margin-right:10px}.fs-permissions .fs-switch-feedback.success{color:#71ae00}.rtl .fs-permissions .fs-switch-feedback{right:auto;left:15px}.rtl .fs-permissions .fs-switch-feedback .fs-ajax-spinner{margin-left:10px;margin-right:0}.rtl .fs-permissions ul li .fs-permission-description{margin-right:55px;margin-left:0}.rtl .fs-permissions ul li .fs-switch{float:left}.rtl .fs-permissions ul li i.dashicons{float:right}.fs-modal-opt-out .fs-modal-footer .fs-opt-out-button{line-height:30px;margin-right:10px}.fs-modal-opt-out .fs-permissions{margin-top:0 !important}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-group-opt-out-button{float:right;line-height:1.1em}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-switch-feedback{float:right;line-height:1.1em;margin-right:10px}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header .fs-switch-feedback .fs-ajax-spinner{margin:-2px 0 0}.fs-modal-opt-out .fs-permissions .fs-permissions-section--header-title{font-size:1.1em;font-weight:600;text-transform:uppercase;display:block;line-height:1.1em;margin:.5em 0}.fs-modal-opt-out .fs-permissions .fs-permissions-section--desc{margin-top:0}.fs-modal-opt-out .fs-permissions hr{border:0;border-top:#eee solid 1px;margin:25px 0 20px 0}.fs-modal-opt-out .fs-permissions ul{border:1px solid #c3c4c7;border-radius:3px;margin:10px 0 0 0;box-shadow:0 1px 1px rgba(0,0,0,.04)}.fs-modal-opt-out .fs-permissions ul li{border-bottom:1px solid #d7dde1;border-left:4px solid #72aee6}.rtl .fs-modal-opt-out .fs-permissions ul li{border-left:none;border-right:4px solid #72aee6}.fs-modal-opt-out .fs-permissions ul li.fs-disabled{border-left-color:rgba(114,174,230,0)}.fs-modal-opt-out .fs-permissions ul li:last-child{border-bottom:none}
label.fs-tag,span.fs-tag{background:#ffba00;color:#fff;display:inline-block;border-radius:3px;padding:5px;font-size:11px;line-height:11px;vertical-align:baseline}label.fs-tag.fs-warn,span.fs-tag.fs-warn{background:#ffba00}label.fs-tag.fs-info,span.fs-tag.fs-info{background:#00a0d2}label.fs-tag.fs-success,span.fs-tag.fs-success{background:#46b450}label.fs-tag.fs-error,span.fs-tag.fs-error{background:#dc3232}.wp-list-table.plugins .plugin-title span.fs-tag{display:inline-block;margin-left:5px;line-height:10px}
#fs_customizer_upsell .fs-customizer-plan{padding:10px 20px 20px 20px;border-radius:3px;background:#fff}#fs_customizer_upsell .fs-customizer-plan h2{position:relative;margin:0;line-height:2em;text-transform:uppercase}#fs_customizer_upsell .fs-customizer-plan h2 .button-link{top:-2px}#fs_customizer_upsell .fs-feature{position:relative}#fs_customizer_upsell .dashicons-yes{color:#0085ba;font-size:2em;vertical-align:bottom;margin-left:-7px;margin-right:10px}.rtl #fs_customizer_upsell .dashicons-yes{margin-left:10px;margin-right:-7px}#fs_customizer_upsell .dashicons-editor-help{color:#bbb;cursor:help}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{opacity:0;visibility:hidden;-moz-transition:opacity .3s ease-in-out;-o-transition:opacity .3s ease-in-out;-ms-transition:opacity .3s ease-in-out;-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;position:absolute;background:#000;color:#fff;font-family:"arial",serif;font-size:12px;padding:10px;z-index:999999;bottom:100%;margin-bottom:5px;left:0;right:0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);line-height:1.3em;font-weight:bold;text-align:left}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc{text-align:right}#fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{content:" ";display:block;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#000 transparent transparent transparent;position:absolute;top:100%;left:21px}.rtl #fs_customizer_upsell .dashicons-editor-help .fs-feature-desc::after{right:21px;left:auto}#fs_customizer_upsell .dashicons-editor-help:hover .fs-feature-desc{visibility:visible;opacity:1}#fs_customizer_upsell .button-primary{display:block;text-align:center;margin-top:10px}#fs_customizer_support{display:block !important}#fs_customizer_support .button{float:right}#fs_customizer_support .button-group{width:100%;display:block;margin-top:10px}#fs_customizer_support .button-group .button{float:none;width:50%;text-align:center}#customize-theme-controls #accordion-section-freemius_upsell{border-top:1px solid #0085ba !important;border-bottom:1px solid #0085ba !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title{color:#fff;background-color:#0085ba;border-left:4px solid #0085ba;transition:.15s background-color ease-in-out,.15s border-color ease-in-out;outline:none;border-bottom:none !important}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:hover{background-color:#008ec2;border-left-color:#0073aa}#customize-theme-controls #accordion-section-freemius_upsell h3.accordion-section-title:after{color:#fff}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title{border-left:none;border-right:4px solid #0085ba}#customize-theme-controls #accordion-section-freemius_upsell .rtl h3.accordion-section-title:hover{border-right-color:#0073aa}
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
/*!
* jQuery postMessage - v0.5 - 9/11/2009
* http://benalman.com/projects/jquery-postmessage-plugin/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Non-jQuery fork by Jeff Lee
*
* This fork consists of the following changes:
* 1. Basic code cleanup and restructuring, for legibility.
* 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
* in terms of both function names and object scope. Scope is specified by
* the the "this" context of NoJQueryPostMessageMixin();
* 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
* at least three different GitHub users requesting the removal of this
* "Opera sniff" on the original project's Issues page, so I figured this
* would be a relatively safe change.
* 4. `postMessage` no longer uses `$.param` to serialize messages that are not
* strings. I actually prefer this structure anyway. `receiveMessage` does
* not implement a corresponding deserialization step, and as such it seems
* cleaner and more symmetric to leave both data serialization and
* deserialization to the client.
* 5. The use of `$.isFunction` is replaced by a functionally-identical check.
* 6. The `$:nomunge` YUI option is no longer necessary.
*/
function NoJQueryPostMessageMixin(postBinding, receiveBinding) {
var setMessageCallback, unsetMessageCallback, currentMsgCallback,
intervalId, lastHash, cacheBust = 1;
if (window.postMessage) {
if (window.addEventListener) {
setMessageCallback = function(callback) {
window.addEventListener('message', callback, false);
}
unsetMessageCallback = function(callback) {
window.removeEventListener('message', callback, false);
}
} else {
setMessageCallback = function(callback) {
window.attachEvent('onmessage', callback);
}
unsetMessageCallback = function(callback) {
window.detachEvent('onmessage', callback);
}
}
this[postBinding] = function(message, targetUrl, target) {
if (!targetUrl) {
return;
}
// The browser supports window.postMessage, so call it with a targetOrigin
// set appropriately, based on the targetUrl parameter.
target.postMessage( message, targetUrl.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) );
}
// Since the browser supports window.postMessage, the callback will be
// bound to the actual event associated with window.postMessage.
this[receiveBinding] = function(callback, sourceOrigin, delay) {
// Unbind an existing callback if it exists.
if (currentMsgCallback) {
unsetMessageCallback(currentMsgCallback);
currentMsgCallback = null;
}
if (!callback) {
return false;
}
// Bind the callback. A reference to the callback is stored for ease of
// unbinding.
currentMsgCallback = setMessageCallback(function(e) {
switch(Object.prototype.toString.call(sourceOrigin)) {
case '[object String]':
if (sourceOrigin !== e.origin) {
return false;
}
break;
case '[object Function]':
if (sourceOrigin(e.origin)) {
return false;
}
break;
}
callback(e);
});
};
} else {
this[postBinding] = function(message, targetUrl, target) {
if (!targetUrl) {
return;
}
// The browser does not support window.postMessage, so set the location
// of the target to targetUrl#message. A bit ugly, but it works! A cache
// bust parameter is added to ensure that repeat messages trigger the
// callback.
target.location = targetUrl.replace( /#.*$/, '' ) + '#' + (+new Date) + (cacheBust++) + '&' + message;
}
// Since the browser sucks, a polling loop will be started, and the
// callback will be called whenever the location.hash changes.
this[receiveBinding] = function(callback, sourceOrigin, delay) {
if (intervalId) {
clearInterval(intervalId);
intervalId = null;
}
if (callback) {
delay = typeof sourceOrigin === 'number'
? sourceOrigin
: typeof delay === 'number'
? delay
: 100;
intervalId = setInterval(function(){
var hash = document.location.hash,
re = /^#?\d+&/;
if ( hash !== lastHash && re.test( hash ) ) {
lastHash = hash;
callback({ data: hash.replace( re, '' ) });
}
}, delay );
}
};
}
return this;
}
\ No newline at end of file
/*
* nojquery-postmessage by Jeff Lee
* a non-jQuery fork of:
*
* jQuery postMessage - v0.5 - 9/11/2009
* http://benalman.com/projects/jquery-postmessage-plugin/
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
function NoJQueryPostMessageMixin(g,a){var b,h,e,d,f,c=1;if(window.postMessage){if(window.addEventListener){b=function(i){window.addEventListener("message",i,false)};h=function(i){window.removeEventListener("message",i,false)}}else{b=function(i){window.attachEvent("onmessage",i)};h=function(i){window.detachEvent("onmessage",i)}}this[g]=function(i,k,j){if(!k){return}j.postMessage(i,k.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))};this[a]=function(k,j,i){if(e){h(e);e=null}if(!k){return false}e=b(function(l){switch(Object.prototype.toString.call(j)){case"[object String]":if(j!==l.origin){return false}break;case"[object Function]":if(j(l.origin)){return false}break}k(l)})}}else{this[g]=function(i,k,j){if(!k){return}j.location=k.replace(/#.*$/,"")+"#"+(+new Date)+(c++)+"&"+i};this[a]=function(k,j,i){if(d){clearInterval(d);d=null}if(k){i=typeof j==="number"?j:typeof i==="number"?i:100;d=setInterval(function(){var m=document.location.hash,l=/^#?\d+&/;if(m!==f&&l.test(m)){f=m;k({data:m.replace(l,"")})}},i)}}}return this};
\ No newline at end of file
(function ($, undef) {
var global = this;
// Namespace.
global.FS = global.FS || {};
global.FS.PostMessage = function ()
{
var
_is_child = false,
_postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage'),
_callbacks = {},
_base_url,
_parent_url = decodeURIComponent(document.location.hash.replace(/^#/, '')),
_parent_subdomain = _parent_url.substring(0, _parent_url.indexOf('/', ('https://' === _parent_url.substring(0, ('https://').length)) ? 8 : 7)),
_init = function () {
_postman.receiveMessage(function (e) {
var data = JSON.parse(e.data);
if (_callbacks[data.type]) {
for (var i = 0; i < _callbacks[data.type].length; i++) {
// Execute type callbacks.
_callbacks[data.type][i](data.data);
}
}
}, _base_url);
},
_hasParent = ('' !== _parent_url),
$window = $(window),
$html = $('html');
return {
init : function (url, iframes)
{
_base_url = url;
_init();
// Automatically receive forward messages.
FS.PostMessage.receiveOnce('forward', function (data){
window.location = data.url;
});
iframes = iframes || [];
if (iframes.length > 0) {
$window.on('scroll', function () {
for (var i = 0; i < iframes.length; i++) {
FS.PostMessage.postScroll(iframes[i]);
}
});
}
},
init_child : function ()
{
this.init(_parent_subdomain);
_is_child = true;
// Post height of a child right after window is loaded.
$(window).bind('load', function () {
FS.PostMessage.postHeight();
// Post message that window was loaded.
FS.PostMessage.post('loaded');
});
},
hasParent : function ()
{
return _hasParent;
},
postHeight : function (diff, wrapper) {
diff = diff || 0;
wrapper = wrapper || '#wrap_section';
this.post('height', {
height: diff + $(wrapper).outerHeight(true)
});
},
postScroll : function (iframe) {
this.post('scroll', {
top: $window.scrollTop(),
height: ($window.height() - parseFloat($html.css('paddingTop')) - parseFloat($html.css('marginTop')))
}, iframe);
},
post : function (type, data, iframe)
{
console.debug('PostMessage.post', type);
if (iframe)
{
// Post to iframe.
_postman.postMessage(JSON.stringify({
type: type,
data: data
}), iframe.src, iframe.contentWindow);
}
else {
// Post to parent.
_postman.postMessage(JSON.stringify({
type: type,
data: data
}), _parent_url, window.parent);
}
},
receive: function (type, callback)
{
console.debug('PostMessage.receive', type);
if (undef === _callbacks[type])
_callbacks[type] = [];
_callbacks[type].push(callback);
},
receiveOnce: function (type, callback)
{
if (this.is_set(type))
return;
this.receive(type, callback);
},
// Check if any callbacks assigned to a specified message type.
is_set: function (type)
{
return (undef != _callbacks[type]);
},
parent_url: function ()
{
return _parent_url;
},
parent_subdomain: function ()
{
return _parent_subdomain;
}
};
}();
})(jQuery);
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 2.5.1
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class FS_Lock
*
* @author Vova Feldman (@svovaf)
* @since 2.5.1
*/
class FS_Lock {
/**
* @var int Random ID representing the current PHP thread.
*/
private static $_thread_id;
/**
* @var string
*/
private $_lock_id;
/**
* @param string $lock_id
*/
function __construct( $lock_id ) {
if ( ! fs_starts_with( $lock_id, WP_FS___OPTION_PREFIX ) ) {
$lock_id = WP_FS___OPTION_PREFIX . $lock_id;
}
$this->_lock_id = $lock_id;
if ( ! isset( self::$_thread_id ) ) {
self::$_thread_id = mt_rand( 0, 32000 );
}
}
/**
* Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
*
* @param int $expiration
*
* @return bool TRUE if successfully acquired lock.
*/
function try_lock( $expiration = 0 ) {
if ( $this->is_locked() ) {
// Already locked.
return false;
}
set_site_transient( $this->_lock_id, self::$_thread_id, $expiration );
if ( $this->has_lock() ) {
$this->lock($expiration);
return true;
}
return false;
}
/**
* Acquire lock regardless if it's already acquired by another locker or not.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @param int $expiration
*/
function lock( $expiration = 0 ) {
set_site_transient( $this->_lock_id, true, $expiration );
}
/**
* Checks if lock is currently acquired.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @return bool
*/
function is_locked() {
return ( false !== get_site_transient( $this->_lock_id ) );
}
/**
* Unlock the lock.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*/
function unlock() {
delete_site_transient( $this->_lock_id );
}
/**
* Checks if lock is currently acquired by the current locker.
*
* @return bool
*/
protected function has_lock() {
return ( self::$_thread_id == get_site_transient( $this->_lock_id ) );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'WP_FS__SECURITY_PARAMS_PREFIX', 's_' );
/**
* Class FS_Security
*/
class FS_Security {
/**
* @var FS_Security
* @since 1.0.3
*/
private static $_instance;
/**
* @var FS_Logger
* @since 1.0.3
*/
private static $_logger;
/**
* @return \FS_Security
*/
public static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new FS_Security();
self::$_logger = FS_Logger::get_logger(
WP_FS__SLUG,
WP_FS__DEBUG_SDK,
WP_FS__ECHO_DEBUG_SDK
);
}
return self::$_instance;
}
private function __construct() {
}
/**
* @param \FS_Scope_Entity $entity
* @param int $timestamp
* @param string $action
*
* @return string
*/
function get_secure_token( FS_Scope_Entity $entity, $timestamp, $action = '' ) {
return md5(
$timestamp .
$entity->id .
$entity->secret_key .
$entity->public_key .
$action
);
}
/**
* @param \FS_Scope_Entity $entity
* @param int|bool $timestamp
* @param string $action
*
* @return array
*/
function get_context_params( FS_Scope_Entity $entity, $timestamp = false, $action = '' ) {
if ( false === $timestamp ) {
$timestamp = time();
}
return array(
's_ctx_type' => $entity->get_type(),
's_ctx_id' => $entity->id,
's_ctx_ts' => $timestamp,
's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ),
);
}
}
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once WP_FS__DIR_INCLUDES . '/class-fs-lock.php';
/**
* Class FS_User_Lock
*/
class FS_User_Lock {
/**
* @var FS_Lock
*/
private $_lock;
#--------------------------------------------------------------------------------
#region Singleton
#--------------------------------------------------------------------------------
/**
* @var FS_User_Lock
*/
private static $_instance;
/**
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @return FS_User_Lock
*/
static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
#endregion
private function __construct() {
$current_user_id = Freemius::get_current_wp_user_id();
$this->_lock = new FS_Lock( "locked_{$current_user_id}" );
}
/**
* Try to acquire lock. If the lock is already set or is being acquired by another locker, don't do anything.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @param int $expiration
*
* @return bool TRUE if successfully acquired lock.
*/
function try_lock( $expiration = 0 ) {
return $this->_lock->try_lock( $expiration );
}
/**
* Acquire lock regardless if it's already acquired by another locker or not.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @param int $expiration
*/
function lock( $expiration = 0 ) {
$this->_lock->lock( $expiration );
}
/**
* Unlock the lock.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*/
function unlock() {
$this->_lock->unlock();
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.2.2.7
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Zerif_Customizer_Theme_Info_Main
*
* @since 1.0.0
* @access public
*/
class FS_Customizer_Support_Section extends WP_Customize_Section {
function __construct( $manager, $id, $args = array() ) {
$manager->register_section_type( 'FS_Customizer_Support_Section' );
parent::__construct( $manager, $id, $args );
}
/**
* The type of customize section being rendered.
*
* @since 1.0.0
* @access public
* @var string
*/
public $type = 'freemius-support-section';
/**
* @var Freemius
*/
public $fs = null;
/**
* Add custom parameters to pass to the JS via JSON.
*
* @since 1.0.0
*/
public function json() {
$json = parent::json();
$is_contact_visible = $this->fs->is_page_visible( 'contact' );
$is_support_visible = $this->fs->is_page_visible( 'support' );
$json['theme_title'] = $this->fs->get_plugin_name();
if ( $is_contact_visible && $is_support_visible ) {
$json['theme_title'] .= ' ' . $this->fs->get_text_inline( 'Support', 'support' );
}
if ( $is_contact_visible ) {
$json['contact'] = array(
'label' => $this->fs->get_text_inline( 'Contact Us', 'contact-us' ),
'url' => $this->fs->contact_url(),
);
}
if ( $is_support_visible ) {
$json['support'] = array(
'label' => $this->fs->get_text_inline( 'Support Forum', 'support-forum' ),
'url' => $this->fs->get_support_forum_url()
);
}
return $json;
}
/**
* Outputs the Underscore.js template.
*
* @since 1.0.0
*/
protected function render_template() {
?>
<li id="fs_customizer_support"
class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
<h3 class="accordion-section-title">
<span>{{ data.theme_title }}</span>
<# if ( data.contact && data.support ) { #>
<div class="button-group">
<# } #>
<# if ( data.contact ) { #>
<a class="button" href="{{ data.contact.url }}" target="_blank" rel="noopener noreferrer">{{ data.contact.label }} </a>
<# } #>
<# if ( data.support ) { #>
<a class="button" href="{{ data.support.url }}" target="_blank" rel="noopener noreferrer">{{ data.support.label }} </a>
<# } #>
<# if ( data.contact && data.support ) { #>
</div>
<# } #>
</h3>
</li>
<?php
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.2.2.7
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class FS_Customizer_Upsell_Control
*/
class FS_Customizer_Upsell_Control extends WP_Customize_Control {
/**
* Control type
*
* @var string control type
*/
public $type = 'freemius-upsell-control';
/**
* @var Freemius
*/
public $fs = null;
/**
* @param WP_Customize_Manager $manager the customize manager class.
* @param string $id id.
* @param array $args customizer manager parameters.
*/
public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
$manager->register_control_type( 'FS_Customizer_Upsell_Control' );
parent::__construct( $manager, $id, $args );
}
/**
* Enqueue resources for the control.
*/
public function enqueue() {
fs_enqueue_local_style( 'fs_customizer', 'customizer.css' );
}
/**
* Json conversion
*/
public function to_json() {
$pricing_cta = esc_html( $this->fs->get_pricing_cta_label() ) . '&nbsp;&nbsp;' . ( is_rtl() ? '&#x2190;' : '&#x27a4;' );
parent::to_json();
$this->json['button_text'] = $pricing_cta;
$this->json['button_url'] = $this->fs->is_in_trial_promotion() ?
$this->fs->get_trial_url() :
$this->fs->get_upgrade_url();
$api = FS_Plugin::is_valid_id( $this->fs->get_bundle_id() ) ?
$this->fs->get_api_bundle_scope() :
$this->fs->get_api_plugin_scope();
// Load features.
$pricing = $api->get( $this->fs->add_show_pending( "pricing.json" ) );
if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
// Add support features.
if ( is_array( $pricing->plans ) && 0 < count( $pricing->plans ) ) {
$support_features = array(
'kb' => 'Help Center',
'forum' => 'Support Forum',
'email' => 'Priority Email Support',
'phone' => 'Phone Support',
'skype' => 'Skype Support',
'is_success_manager' => 'Personal Success Manager',
);
for ( $i = 0, $len = count( $pricing->plans ); $i < $len; $i ++ ) {
if ( 'free' == $pricing->plans[$i]->name ) {
continue;
}
if ( ! isset( $pricing->plans[ $i ]->features ) ||
! is_array( $pricing->plans[ $i ]->features ) ) {
$pricing->plans[$i]->features = array();
}
foreach ( $support_features as $key => $label ) {
$key = ( 'is_success_manager' !== $key ) ?
"support_{$key}" :
$key;
if ( ! empty( $pricing->plans[ $i ]->{$key} ) ) {
$support_feature = new stdClass();
$support_feature->title = $label;
$pricing->plans[ $i ]->features[] = $support_feature;
}
}
}
$this->json['plans'] = $pricing->plans;
}
}
$this->json['strings'] = array(
'plan' => $this->fs->get_text_x_inline( 'Plan', 'as product pricing plan', 'plan' ),
);
}
/**
* Control content
*/
public function content_template() {
?>
<div id="fs_customizer_upsell">
<# if ( data.plans ) { #>
<ul class="fs-customizer-plans">
<# for (i in data.plans) { #>
<# if ( 'free' != data.plans[i].name && (null != data.plans[i].features && 0 < data.plans[i].features.length) ) { #>
<li class="fs-customizer-plan">
<div class="fs-accordion-section-open">
<h2 class="fs-accordion-section-title menu-item">
<span>{{ data.plans[i].title }}</span>
<button type="button" class="button-link item-edit" aria-expanded="true">
<span class="screen-reader-text">Toggle section: {{ data.plans[i].title }} {{ data.strings.plan }}</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
</h2>
<div class="fs-accordion-section-content">
<# if ( data.plans[i].description ) { #>
<h3>{{ data.plans[i].description }}</h3>
<# } #>
<# if ( data.plans[i].features ) { #>
<ul>
<# for ( j in data.plans[i].features ) { #>
<li><div class="fs-feature">
<span class="dashicons dashicons-yes"></span><span><# if ( data.plans[i].features[j].value ) { #>{{ data.plans[i].features[j].value }} <# } #>{{ data.plans[i].features[j].title }}</span>
<# if ( data.plans[i].features[j].description ) { #>
<span class="dashicons dashicons-editor-help"><span class="fs-feature-desc">{{ data.plans[i].features[j].description }}</span></span>
<# } #>
</div></li>
<# } #>
</ul>
<# } #>
<# if ( 'free' != data.plans[i].name ) { #>
<a href="{{ data.button_url }}" class="button button-primary" target="_blank">{{{ data.button_text }}}</a>
<# } #>
</div>
</div>
</li>
<# } #>
<# } #>
</ul>
<# } #>
</div>
<?php }
}
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.1.7.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.7.3
*
* Class Freemius_Debug_Bar_Panel
*/
class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
function init() {
$this->title( 'Freemius' );
}
static function requests_count() {
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
$logger = Freemius_Api_WordPress::GetLogger();
} else {
$logger = array();
}
return number_format( count( $logger ) );
}
static function total_time() {
if ( class_exists( 'Freemius_Api_WordPress' ) ) {
$logger = Freemius_Api_WordPress::GetLogger();
} else {
$logger = array();
}
$total_time = .0;
foreach ( $logger as $l ) {
$total_time += $l['total'];
}
return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
}
function render() {
?>
<div id='debug-bar-php'>
<?php fs_require_template( '/debug/api-calls.php' ) ?>
<br>
<?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
<br>
<?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
<br>
<?php fs_require_template( '/debug/logger.php' ) ?>
</div>
<?php
}
}
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.1.7.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! WP_FS__DEBUG_SDK ) {
return;
}
/**
* Initialize Freemius custom debug panels.
*
* @param array $panels Debug bar panels objects
*
* @return array Debug bar panels with your custom panels
*/
function fs_custom_panels_init( $panels ) {
if ( class_exists( 'Debug_Bar_Panel' ) ) {
if ( FS_API__LOGGER_ON ) {
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
$panels[] = new Freemius_Debug_Bar_Panel();
}
}
return $panels;
}
function fs_custom_status_init( $statuses ) {
if ( class_exists( 'Debug_Bar_Panel' ) ) {
if ( FS_API__LOGGER_ON ) {
require_once dirname( __FILE__ ) . '/class-fs-debug-bar-panel.php';
$statuses[] = array(
'fs_api_requests',
fs_text_inline( 'Freemius API' ),
Freemius_Debug_Bar_Panel::requests_count() . ' ' . fs_text_inline( 'Requests' ) .
' (' . Freemius_Debug_Bar_Panel::total_time() . ')'
);
}
}
return $statuses;
}
add_filter( 'debug_bar_panels', 'fs_custom_panels_init' );
add_filter( 'debug_bar_statuses', 'fs_custom_status_init' );
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.2.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_AffiliateTerms extends FS_Scope_Entity {
#region Properties
/**
* @var bool
*/
public $is_active;
/**
* @var string Enum: `affiliation` or `rewards`. Defaults to `affiliation`.
*/
public $type;
/**
* @var string Enum: `payout` or `credit`. Defaults to `payout`.
*/
public $reward_type;
/**
* If `first`, the referral will be attributed to the first visited source containing the affiliation link that
* was clicked.
*
* @var string Enum: `first` or `last`. Defaults to `first`.
*/
public $referral_attribution;
/**
* @var int Defaults to `30`, `0` for session cookie, and `null` for endless cookie (until cookies are cleaned).
*/
public $cookie_days;
/**
* @var int
*/
public $commission;
/**
* @var string Enum: `percentage` or `dollar`. Defaults to `percentage`.
*/
public $commission_type;
/**
* @var null|int Defaults to `0` (affiliate only on first payment). `null` for commission for all renewals. If
* greater than `0`, affiliate will get paid for all renewals for `commission_renewals_days` days after
* the initial upgrade/purchase.
*/
public $commission_renewals_days;
/**
* @var int Only cents and no percentage. In US cents, e.g.: 100 = $1.00. Defaults to `null`.
*/
public $install_commission;
/**
* @var string Required default target link, e.g.: pricing page.
*/
public $default_url;
/**
* @var string One of the following: 'all', 'new_customer', 'new_user'.
* If 'all' - reward for any user type.
* If 'new_customer' - reward only for new customers.
* If 'new_user' - reward only for new users.
*/
public $reward_customer_type;
/**
* @var int Defaults to `0` (affiliate only on directly affiliated links). `null` if an affiliate will get
* paid for all customers' lifetime payments. If greater than `0`, an affiliate will get paid for all
* customer payments for `future_payments_days` days after the initial payment.
*/
public $future_payments_days;
/**
* @var bool If `true`, allow referrals from social sites.
*/
public $is_social_allowed;
/**
* @var bool If `true`, allow conversions without HTTP referrer header at all.
*/
public $is_app_allowed;
/**
* @var bool If `true`, allow referrals from any site.
*/
public $is_any_site_allowed;
/**
* @var string $plugin_title Title of the plugin. This is used in case we are showing affiliate form for a Bundle instead of the `plugin` in context.
*/
public $plugin_title;
#endregion Properties
/**
* @author Leo Fajardo (@leorw)
*
* @return string
*/
function get_formatted_commission()
{
return ( 'dollar' === $this->commission_type ) ?
( '$' . $this->commission ) :
( $this->commission . '%' );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function has_lifetime_commission() {
return ( 0 !== $this->future_payments_days );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function is_session_cookie() {
return ( 0 == $this->cookie_days );
}
/**
* @author Leo Fajardo (@leorw)
*
* @return bool
*/
function has_renewals_commission() {
return ( is_null( $this->commission_renewals_days ) || $this->commission_renewals_days > 0 );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.2.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Affiliate extends FS_Scope_Entity {
#region Properties
/**
* @var string
*/
public $paypal_email;
/**
* @var number
*/
public $custom_affiliate_terms_id;
/**
* @var boolean
*/
public $is_using_custom_terms;
/**
* @var string status Enum: `pending`, `rejected`, `suspended`, or `active`. Defaults to `pending`.
*/
public $status;
/**
* @var string
*/
public $domain;
#endregion Properties
/**
* @author Leo Fajardo
*
* @return bool
*/
function is_active() {
return ( 'active' === $this->status );
}
/**
* @author Leo Fajardo
*
* @return bool
*/
function is_pending() {
return ( 'pending' === $this->status );
}
/**
* @author Leo Fajardo
*
* @return bool
*/
function is_suspended() {
return ( 'suspended' === $this->status );
}
/**
* @author Leo Fajardo
*
* @return bool
*/
function is_rejected() {
return ( 'rejected' === $this->status );
}
/**
* @author Leo Fajardo
*
* @return bool
*/
function is_blocked() {
return ( 'blocked' === $this->status );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius for EDD Add-On
* @copyright Copyright (c) 2016, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Billing extends FS_Entity {
#region Properties
/**
* @var int
*/
public $entity_id;
/**
* @var string (Enum) Linked entity type. One of: developer, plugin, user, install
*/
public $entity_type;
/**
* @var string
*/
public $business_name;
/**
* @var string
*/
public $first;
/**
* @var string
*/
public $last;
/**
* @var string
*/
public $email;
/**
* @var string
*/
public $phone;
/**
* @var string
*/
public $website;
/**
* @var string Tax or VAT ID.
*/
public $tax_id;
/**
* @var string
*/
public $address_street;
/**
* @var string
*/
public $address_apt;
/**
* @var string
*/
public $address_city;
/**
* @var string
*/
public $address_country;
/**
* @var string Two chars country code.
*/
public $address_country_code;
/**
* @var string
*/
public $address_state;
/**
* @var number Numeric ZIP code (cab be with leading zeros).
*/
public $address_zip;
#endregion Properties
/**
* @param object|bool $event
*/
function __construct( $event = false ) {
parent::__construct( $event );
}
static function get_type() {
return 'billing';
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Get object's public variables.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.0
*
* @param object $object
*
* @return array
*/
function fs_get_object_public_vars( $object ) {
return get_object_vars( $object );
}
class FS_Entity {
/**
* @var number
*/
public $id;
/**
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
*/
public $updated;
/**
* @var string Datetime value in 'YYYY-MM-DD HH:MM:SS' format.
*/
public $created;
/**
* @param bool|object $entity
*/
function __construct( $entity = false ) {
if ( ! ( $entity instanceof stdClass ) && ! ( $entity instanceof FS_Entity ) ) {
return;
}
$props = fs_get_object_public_vars( $this );
foreach ( $props as $key => $def_value ) {
$this->{$key} = isset( $entity->{$key} ) ?
$entity->{$key} :
$def_value;
}
}
static function get_type() {
return 'type';
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @param FS_Entity $entity1
* @param FS_Entity $entity2
*
* @return bool
*/
static function equals( $entity1, $entity2 ) {
if ( is_null( $entity1 ) && is_null( $entity2 ) ) {
return true;
} else if ( is_object( $entity1 ) && is_object( $entity2 ) ) {
return ( $entity1->id == $entity2->id );
} else if ( is_object( $entity1 ) ) {
return is_null( $entity1->id );
} else {
return is_null( $entity2->id );
}
}
private $_is_updated = false;
/**
* Update object property.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @param string|array[string]mixed $key
* @param string|bool $val
*
* @return bool
*/
function update( $key, $val = false ) {
if ( ! is_array( $key ) ) {
$key = array( $key => $val );
}
$is_updated = false;
foreach ( $key as $k => $v ) {
if ( $this->{$k} === $v ) {
continue;
}
if ( ( is_string( $this->{$k} ) && is_numeric( $v ) ||
( is_numeric( $this->{$k} ) && is_string( $v ) ) ) &&
$this->{$k} == $v
) {
continue;
}
// Update value.
$this->{$k} = $v;
$is_updated = true;
}
$this->_is_updated = $is_updated;
return $is_updated;
}
/**
* Checks if entity was updated.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_updated() {
return $this->_is_updated;
}
/**
* @param $id
*
* @author Vova Feldman (@svovaf)
* @since 1.1.2
*
* @return bool
*/
static function is_valid_id($id){
return is_numeric($id);
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.1
*
* @return string
*/
public static function get_class_name() {
return get_called_class();
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2016, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Payment extends FS_Entity {
#region Properties
/**
* @var number
*/
public $plugin_id;
/**
* @var number
*/
public $user_id;
/**
* @var number
*/
public $install_id;
/**
* @var number
*/
public $subscription_id;
/**
* @var number
*/
public $plan_id;
/**
* @var number
*/
public $license_id;
/**
* @var float
*/
public $gross;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @var string One of the following: `usd`, `gbp`, `eur`.
*/
public $currency;
/**
* @var number
*/
public $bound_payment_id;
/**
* @var string
*/
public $external_id;
/**
* @var string
*/
public $gateway;
/**
* @var string ISO 3166-1 alpha-2 - two-letter country code.
*
* @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
*/
public $country_code;
/**
* @var string
*/
public $vat_id;
/**
* @var float Actual Tax / VAT in $$$
*/
public $vat;
/**
* @var int Payment source.
*/
public $source = 0;
#endregion Properties
const CURRENCY_USD = 'usd';
const CURRENCY_GBP = 'gbp';
const CURRENCY_EUR = 'eur';
/**
* @param object|bool $payment
*/
function __construct( $payment = false ) {
parent::__construct( $payment );
}
static function get_type() {
return 'payment';
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.0
*
* @return bool
*/
function is_refund() {
return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
}
/**
* Checks if the payment was migrated from another platform.
*
* @author Vova Feldman (@svovaf)
* @since 2.0.2
*
* @return bool
*/
function is_migrated() {
return ( 0 != $this->source );
}
/**
* Returns the gross in this format:
* `{symbol}{amount | 2 decimal digits} {currency | uppercase}`
*
* Examples: £9.99 GBP, -£9.99 GBP.
*
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @return string
*/
function formatted_gross()
{
return (
( $this->gross < 0 ? '-' : '' ) .
$this->get_symbol() .
number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' .
strtoupper( $this->currency )
);
}
/**
* A map between supported currencies with their symbols.
*
* @var array<string,string>
*/
static $CURRENCY_2_SYMBOL;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @return string
*/
private function get_symbol() {
if ( ! isset( self::$CURRENCY_2_SYMBOL ) ) {
// Lazy load.
self::$CURRENCY_2_SYMBOL = array(
self::CURRENCY_USD => '$',
self::CURRENCY_GBP => '&pound;',
self::CURRENCY_EUR => '&euro;',
);
}
return self::$CURRENCY_2_SYMBOL[ $this->currency ];
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plugin_Info extends FS_Entity {
public $plugin_id;
public $description;
public $short_description;
public $banner_url;
public $card_banner_url;
public $selling_point_0;
public $selling_point_1;
public $selling_point_2;
public $screenshots;
/**
* @param stdClass|bool $plugin_info
*/
function __construct( $plugin_info = false ) {
parent::__construct( $plugin_info );
}
static function get_type() {
return 'plugin';
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.5
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class FS_Plugin_License
*/
class FS_Plugin_License extends FS_Entity {
#region Properties
/**
* @var number
*/
public $plugin_id;
/**
* @var number
*/
public $user_id;
/**
* @var number
*/
public $plan_id;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @var string
*/
public $parent_plan_name;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @var string
*/
public $parent_plan_title;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @var number
*/
public $parent_license_id;
/**
* @author Leo Fajardo (@leorw)
* @since 2.4.0
*
* @var array
*/
public $products;
/**
* @var number
*/
public $pricing_id;
/**
* @var int|null
*/
public $quota;
/**
* @var int
*/
public $activated;
/**
* @var int
*/
public $activated_local;
/**
* @var string
*/
public $expiration;
/**
* @var string
*/
public $secret_key;
/**
* @var bool
*/
public $is_whitelabeled;
/**
* @var bool $is_free_localhost Defaults to true. If true, allow unlimited localhost installs with the same
* license.
*/
public $is_free_localhost;
/**
* @var bool $is_block_features Defaults to true. If false, don't block features after license expiry - only
* block updates and support.
*/
public $is_block_features;
/**
* @var bool
*/
public $is_cancelled;
#endregion Properties
/**
* @param stdClass|bool $license
*/
function __construct( $license = false ) {
parent::__construct( $license );
}
/**
* Get entity type.
*
* @return string
*/
static function get_type() {
return 'license';
}
/**
* Check how many site activations left.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.5
*
* @return int
*/
function left() {
if ( ! $this->is_features_enabled() ) {
return 0;
}
if ( $this->is_unlimited() ) {
return 999;
}
return ( $this->quota - $this->activated - ( $this->is_free_localhost ? 0 : $this->activated_local ) );
}
/**
* Check if single site license.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.8.1
*
* @return bool
*/
function is_single_site() {
return ( is_numeric( $this->quota ) && 1 == $this->quota );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.5
*
* @return bool
*/
function is_expired() {
return ! $this->is_lifetime() && ( strtotime( $this->expiration ) < WP_FS__SCRIPT_START_TIME );
}
/**
* Check if license is not expired.
*
* @author Vova Feldman (@svovaf)
* @since 1.2.1
*
* @return bool
*/
function is_valid() {
return ! $this->is_expired();
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @return bool
*/
function is_lifetime() {
return is_null( $this->expiration );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.2.0
*
* @return bool
*/
function is_unlimited() {
return is_null( $this->quota );
}
/**
* Check if license is fully utilized.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @param bool|null $is_localhost
*
* @return bool
*/
function is_utilized( $is_localhost = null ) {
if ( is_null( $is_localhost ) ) {
$is_localhost = WP_FS__IS_LOCALHOST_FOR_SERVER;
}
if ( $this->is_unlimited() ) {
return false;
}
return ! ( $this->is_free_localhost && $is_localhost ) &&
( $this->quota <= $this->activated + ( $this->is_free_localhost ? 0 : $this->activated_local ) );
}
/**
* Check if license can be activated.
*
* @author Vova Feldman (@svovaf)
* @since 2.0.0
*
* @param bool|null $is_localhost
*
* @return bool
*/
function can_activate( $is_localhost = null ) {
return ! $this->is_utilized( $is_localhost ) && $this->is_features_enabled();
}
/**
* Check if license can be activated on a given number of production and localhost sites.
*
* @author Vova Feldman (@svovaf)
* @since 2.0.0
*
* @param int $production_count
* @param int $localhost_count
*
* @return bool
*/
function can_activate_bulk( $production_count, $localhost_count ) {
if ( $this->is_unlimited() ) {
return true;
}
/**
* For simplicity, the logic will work as following: when given X sites to activate the license on, if it's
* possible to activate on ALL of them, do the activation. If it's not possible to activate on ALL of them,
* do NOT activate on any of them.
*/
return ( $this->quota >= $this->activated + $production_count + ( $this->is_free_localhost ? 0 : $this->activated_local + $localhost_count ) );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.2.1
*
* @return bool
*/
function is_active() {
return ( ! $this->is_cancelled );
}
/**
* Check if license's plan features are enabled.
*
* - Either if plan not expired
* - If expired, based on the configuration to block features or not.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @return bool
*/
function is_features_enabled() {
return $this->is_active() && ( ! $this->is_block_features || ! $this->is_expired() );
}
/**
* Subscription considered to be new without any payments
* if the license expires in less than 24 hours
* from the license creation.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_first_payment_pending() {
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->expiration ) - strtotime( $this->created ) );
}
/**
* @return int
*/
function total_activations() {
return ( $this->activated + $this->activated_local );
}
/**
* @author Vova Feldman (@svovaf)
* @since 2.3.1
*
* @return string
*/
function get_html_escaped_masked_secret_key() {
return self::mask_secret_key_for_html( $this->secret_key );
}
/**
* @author Vova Feldman (@svovaf)
* @since 2.3.1
*
* @param string $secret_key
*
* @return string
*/
static function mask_secret_key_for_html( $secret_key ) {
return (
// Initial 6 chars - sk_ABC
htmlspecialchars( substr( $secret_key, 0, 6 ) ) .
// Masking
str_pad( '', ( strlen( $secret_key ) - 9 ) * 6, '&bull;' ) .
// Last 3 chars.
htmlspecialchars( substr( $secret_key, - 3 ) )
);
}
}
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.5
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class FS_Plugin_Plan
*
* @property FS_Pricing[] $pricing
*/
class FS_Plugin_Plan extends FS_Entity {
#region Properties
/**
* @var number
*/
public $plugin_id;
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $title;
/**
* @var string
*/
public $description;
/**
* @var bool Defaults to true. If true, allow unlimited localhost installs with the same license.
*/
public $is_free_localhost;
/**
* @var bool Defaults to true. If false, don't block features after license expiry - only block updates and
* support.
*/
public $is_block_features;
/**
* @var int
*/
public $license_type;
/**
* @var bool
*/
public $is_https_support;
/**
* @var int Trial days.
*/
public $trial_period;
/**
* @var string If true, require payment for trial.
*/
public $is_require_subscription;
/**
* @var string Knowledge Base URL.
*/
public $support_kb;
/**
* @var string Support Forum URL.
*/
public $support_forum;
/**
* @var string Support email address.
*/
public $support_email;
/**
* @var string Support phone.
*/
public $support_phone;
/**
* @var string Support skype username.
*/
public $support_skype;
/**
* @var bool Is personal success manager supported with the plan.
*/
public $is_success_manager;
/**
* @var bool Is featured plan.
*/
public $is_featured;
#endregion Properties
/**
* @param object|bool $plan
*/
function __construct( $plan = false ) {
parent::__construct( $plan );
if ( is_object( $plan ) ) {
$this->name = strtolower( $plan->name );
}
}
static function get_type() {
return 'plan';
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_free() {
return ( 'free' === $this->name );
}
/**
* Checks if this plan supports "Technical Support".
*
* @author Leo Fajardo (leorw)
* @since 1.2.0
*
* @return bool
*/
function has_technical_support() {
return ( ! empty( $this->support_email ) ||
! empty( $this->support_skype ) ||
! empty( $this->support_phone ) ||
! empty( $this->is_success_manager )
);
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function has_trial() {
return ! $this->is_free() &&
is_numeric( $this->trial_period ) && ( $this->trial_period > 0 );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2018, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plugin_Tag extends FS_Entity {
/**
* @var string
*/
public $version;
/**
* @var string
*/
public $url;
/**
* @var string
*/
public $requires_platform_version;
/**
* @var string
*/
public $requires_programming_language_version;
/**
* @var string
*/
public $tested_up_to_version;
/**
* @var bool
*/
public $has_free;
/**
* @var bool
*/
public $has_premium;
/**
* @var string One of the following: `pending`, `beta`, `unreleased`.
*/
public $release_mode;
function __construct( $tag = false ) {
parent::__construct( $tag );
}
static function get_type() {
return 'tag';
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.0
*
* @return bool
*/
function is_beta() {
return ( 'beta' === $this->release_mode );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plugin extends FS_Scope_Entity {
/**
* @since 1.0.6
* @var null|number
*/
public $parent_plugin_id;
/**
* @var string
*/
public $title;
/**
* @var string
*/
public $slug;
/**
* @author Leo Fajardo (@leorw)
* @since 2.2.1
*
* @var string
*/
public $premium_slug;
/**
* @since 1.2.2
*
* @var string 'plugin' or 'theme'
*/
public $type;
/**
* @author Leo Fajardo (@leorw)
*
* @since 1.2.3
*
* @var string|false false if the module doesn't have an affiliate program or one of the following: 'selected', 'customers', or 'all'.
*/
public $affiliate_moderation;
/**
* @var bool Set to true if the free version of the module is hosted on WordPress.org. Defaults to true.
*/
public $is_wp_org_compliant = true;
/**
* @author Leo Fajardo (@leorw)
* @since 2.2.5
*
* @var int
*/
public $premium_releases_count;
#region Install Specific Properties
/**
* @var string
*/
public $file;
/**
* @var string
*/
public $version;
/**
* @var bool
*/
public $auto_update;
/**
* @var FS_Plugin_Info
*/
public $info;
/**
* @since 1.0.9
*
* @var bool
*/
public $is_premium;
/**
* @author Leo Fajardo (@leorw)
* @since 2.2.1
*
* @var string
*/
public $premium_suffix;
/**
* @since 1.0.9
*
* @var bool
*/
public $is_live;
/**
* @since 2.2.3
* @var null|number
*/
public $bundle_id;
/**
* @since 2.3.1
* @var null|string
*/
public $bundle_public_key;
const AFFILIATE_MODERATION_CUSTOMERS = 'customers';
#endregion Install Specific Properties
/**
* @param stdClass|bool $plugin
*/
function __construct( $plugin = false ) {
parent::__construct( $plugin );
$this->is_premium = false;
$this->is_live = true;
if ( empty( $this->premium_slug ) && ! empty( $plugin->slug ) ) {
$this->premium_slug = "{$this->slug}-premium";
}
if ( empty( $this->premium_suffix ) ) {
$this->premium_suffix = '(Premium)';
}
if ( isset( $plugin->info ) && is_object( $plugin->info ) ) {
$this->info = new FS_Plugin_Info( $plugin->info );
}
}
/**
* Check if plugin is an add-on (has parent).
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @return bool
*/
function is_addon() {
return isset( $this->parent_plugin_id ) && is_numeric( $this->parent_plugin_id );
}
/**
* @author Leo Fajardo (@leorw)
* @since 1.2.3
*
* @return bool
*/
function has_affiliate_program() {
return ( ! empty( $this->affiliate_moderation ) );
}
static function get_type() {
return 'plugin';
}
}
\ No newline at end of file
<?php
/**
* @package Freemius for EDD Add-On
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Pricing extends FS_Entity {
#region Properties
/**
* @var number
*/
public $plan_id;
/**
* @var int
*/
public $licenses;
/**
* @var null|float
*/
public $monthly_price;
/**
* @var null|float
*/
public $annual_price;
/**
* @var null|float
*/
public $lifetime_price;
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.1
*
* @var string One of the following: `usd`, `gbp`, `eur`.
*/
public $currency;
#endregion Properties
/**
* @param object|bool $pricing
*/
function __construct( $pricing = false ) {
parent::__construct( $pricing );
}
static function get_type() {
return 'pricing';
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return bool
*/
function has_monthly() {
return ( is_numeric( $this->monthly_price ) && $this->monthly_price > 0 );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return bool
*/
function has_annual() {
return ( is_numeric( $this->annual_price ) && $this->annual_price > 0 );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return bool
*/
function has_lifetime() {
return ( is_numeric( $this->lifetime_price ) && $this->lifetime_price > 0 );
}
/**
* Check if unlimited licenses pricing.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return bool
*/
function is_unlimited() {
return is_null( $this->licenses );
}
/**
* Check if pricing has more than one billing cycle.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return bool
*/
function is_multi_cycle() {
$cycles = 0;
if ( $this->has_monthly() ) {
$cycles ++;
}
if ( $this->has_annual() ) {
$cycles ++;
}
if ( $this->has_lifetime() ) {
$cycles ++;
}
return $cycles > 1;
}
/**
* Get annual over monthly discount.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return int
*/
function annual_discount_percentage() {
return floor( $this->annual_savings() / ( $this->monthly_price * 12 * ( $this->is_unlimited() ? 1 : $this->licenses ) ) * 100 );
}
/**
* Get annual over monthly savings.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.8
*
* @return float
*/
function annual_savings() {
return ( $this->monthly_price * 12 - $this->annual_price ) * ( $this->is_unlimited() ? 1 : $this->licenses );
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.3.1
*
* @return bool
*/
function is_usd() {
return ( 'usd' === $this->currency );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Scope_Entity extends FS_Entity {
/**
* @var string
*/
public $public_key;
/**
* @var string
*/
public $secret_key;
/**
* @param bool|stdClass $scope_entity
*/
function __construct( $scope_entity = false ) {
parent::__construct( $scope_entity );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* @property int $blog_id
*/
class FS_Site extends FS_Scope_Entity {
/**
* @var number
*/
public $site_id;
/**
* @var number
*/
public $plugin_id;
/**
* @var number
*/
public $user_id;
/**
* @var string
*/
public $title;
/**
* @var string
*/
public $url;
/**
* @var string
*/
public $version;
/**
* @var string E.g. en-GB
*/
public $language;
/**
* @var string Platform version (e.g WordPress version).
*/
public $platform_version;
/**
* Freemius SDK version
*
* @author Leo Fajardo (@leorw)
* @since 1.2.2
*
* @var string SDK version (e.g.: 1.2.2)
*/
public $sdk_version;
/**
* @var string Programming language version (e.g PHP version).
*/
public $programming_language_version;
/**
* @var number|null
*/
public $plan_id;
/**
* @var number|null
*/
public $license_id;
/**
* @var number|null
*/
public $trial_plan_id;
/**
* @var string|null
*/
public $trial_ends;
/**
* @since 1.0.9
*
* @var bool
*/
public $is_premium = false;
/**
* @author Leo Fajardo (@leorw)
*
* @since 1.2.1.5
* @deprecated Since 2.5.1
* @todo Remove after a few releases.
*
* @var bool
*/
public $is_disconnected = false;
/**
* @since 2.0.0
*
* @var bool
*/
public $is_active = true;
/**
* @since 2.0.0
*
* @var bool
*/
public $is_uninstalled = false;
/**
* @author Edgar Melkonyan
*
* @since 2.4.2
*
* @var bool
*/
public $is_beta;
/**
* @param stdClass|bool $site
*/
function __construct( $site = false ) {
parent::__construct( $site );
if ( is_object( $site ) ) {
$this->plan_id = $site->plan_id;
}
if ( ! is_bool( $this->is_disconnected ) ) {
$this->is_disconnected = false;
}
}
static function get_type() {
return 'install';
}
/**
* @author Vova Feldman (@svovaf)
* @since 2.0.0
*
* @param string $url
*
* @return bool
*/
static function is_localhost_by_address( $url ) {
if ( false !== strpos( $url, '127.0.0.1' ) ||
false !== strpos( $url, 'localhost' )
) {
return true;
}
if ( ! fs_starts_with( $url, 'http' ) ) {
$url = 'http://' . $url;
}
$url_parts = parse_url( $url );
$subdomain = $url_parts['host'];
return (
// Starts with.
fs_starts_with( $subdomain, 'local.' ) ||
fs_starts_with( $subdomain, 'dev.' ) ||
fs_starts_with( $subdomain, 'test.' ) ||
fs_starts_with( $subdomain, 'stage.' ) ||
fs_starts_with( $subdomain, 'staging.' ) ||
// Ends with.
fs_ends_with( $subdomain, '.dev' ) ||
fs_ends_with( $subdomain, '.test' ) ||
fs_ends_with( $subdomain, '.staging' ) ||
fs_ends_with( $subdomain, '.local' ) ||
fs_ends_with( $subdomain, '.example' ) ||
fs_ends_with( $subdomain, '.invalid' ) ||
// GoDaddy test/dev.
fs_ends_with( $subdomain, '.myftpupload.com' ) ||
// ngrok tunneling.
fs_ends_with( $subdomain, '.ngrok.io' ) ||
// wpsandbox.
fs_ends_with( $subdomain, '.wpsandbox.pro' ) ||
// SiteGround staging.
fs_starts_with( $subdomain, 'staging' ) ||
// WPEngine staging.
fs_ends_with( $subdomain, '.staging.wpengine.com' ) ||
fs_ends_with( $subdomain, '.dev.wpengine.com' ) ||
fs_ends_with( $subdomain, '.wpengine.com' ) ||
// Pantheon
( fs_ends_with( $subdomain, 'pantheonsite.io' ) &&
( fs_starts_with( $subdomain, 'test-' ) || fs_starts_with( $subdomain, 'dev-' ) ) ) ||
// Cloudways
fs_ends_with( $subdomain, '.cloudwaysapps.com' ) ||
// Kinsta
( fs_starts_with( $subdomain, 'staging-' ) && ( fs_ends_with( $subdomain, '.kinsta.com' ) || fs_ends_with( $subdomain, '.kinsta.cloud' ) ) ) ||
// DesktopServer
fs_ends_with( $subdomain, '.dev.cc' ) ||
// Pressable
fs_ends_with( $subdomain, '.mystagingwebsite.com' ) ||
// WPMU DEV
( fs_ends_with( $subdomain, '.tempurl.host' ) || fs_ends_with( $subdomain, '.wpmudev.host' ) ) ||
// Vendasta
( fs_ends_with( $subdomain, '.websitepro-staging.com' ) || fs_ends_with( $subdomain, '.websitepro.hosting' ) ) ||
// InstaWP
fs_ends_with( $subdomain, '.instawp.xyz' )
);
}
function is_localhost() {
return ( WP_FS__IS_LOCALHOST_FOR_SERVER || self::is_localhost_by_address( $this->url ) );
}
/**
* Check if site in trial.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_trial() {
return is_numeric( $this->trial_plan_id ) && ( strtotime( $this->trial_ends ) > WP_FS__SCRIPT_START_TIME );
}
/**
* Check if user already utilized the trial with the current install.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_trial_utilized() {
return is_numeric( $this->trial_plan_id );
}
/**
* @author Edgar Melkonyan
*
* @return bool
*/
function is_beta() {
return ( isset( $this->is_beta ) && true === $this->is_beta );
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.5.1
*
* @param string $site_url
*
* @return bool
*/
function is_clone( $site_url ) {
$clone_install_url = trailingslashit( fs_strip_url_protocol( $this->url ) );
return ( $clone_install_url !== $site_url );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.9
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Subscription extends FS_Entity {
#region Properties
/**
* @var number
*/
public $user_id;
/**
* @var number
*/
public $install_id;
/**
* @var number
*/
public $plan_id;
/**
* @var number
*/
public $license_id;
/**
* @var float
*/
public $total_gross;
/**
* @var float
*/
public $amount_per_cycle;
/**
* @var int # of months
*/
public $billing_cycle;
/**
* @var float
*/
public $outstanding_balance;
/**
* @var int
*/
public $failed_payments;
/**
* @var string
*/
public $gateway;
/**
* @var string
*/
public $external_id;
/**
* @var string|null
*/
public $trial_ends;
/**
* @var string|null Datetime of the next payment, or null if cancelled.
*/
public $next_payment;
/**
* @since 2.3.1
*
* @var string|null Datetime of the cancellation.
*/
public $canceled_at;
/**
* @var string|null
*/
public $vat_id;
/**
* @var string Two characters country code
*/
public $country_code;
#endregion Properties
/**
* @param object|bool $subscription
*/
function __construct( $subscription = false ) {
parent::__construct( $subscription );
}
static function get_type() {
return 'subscription';
}
/**
* Check if subscription is active.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_active() {
if ( $this->is_canceled() ) {
return false;
}
return (
! empty( $this->next_payment ) &&
strtotime( $this->next_payment ) > WP_FS__SCRIPT_START_TIME
);
}
/**
* @author Vova Feldman (@svovaf)
* @since 2.3.1
*
* @return bool
*/
function is_canceled() {
return ! is_null( $this->canceled_at );
}
/**
* Subscription considered to be new without any payments
* if the next payment should be made within less than 24 hours
* from the subscription creation.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @return bool
*/
function is_first_payment_pending() {
return ( WP_FS__TIME_24_HOURS_IN_SEC >= strtotime( $this->next_payment ) - strtotime( $this->created ) );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.7
*/
function has_trial() {
return ! is_null( $this->trial_ends );
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_User extends FS_Scope_Entity {
#region Properties
/**
* @var string
*/
public $email;
/**
* @var string
*/
public $first;
/**
* @var string
*/
public $last;
/**
* @var bool
*/
public $is_verified;
/**
* @var string|null
*/
public $customer_id;
/**
* @var float
*/
public $gross;
#endregion Properties
/**
* @param object|bool $user
*/
function __construct( $user = false ) {
parent::__construct( $user );
}
function get_name() {
return trim( ucfirst( trim( is_string( $this->first ) ? $this->first : '' ) ) . ' ' . ucfirst( trim( is_string( $this->last ) ? $this->last : '' ) ) );
}
function is_verified() {
return ( isset( $this->is_verified ) && true === $this->is_verified );
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.4.2
*
* @return bool
*/
function is_beta() {
// Return `false` since this is just for backward compatibility.
return false;
}
static function get_type() {
return 'user';
}
}
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.2.1.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Retrieve the translation of $text.
*
* @since 1.2.1.6
*
* @param string $text
*
* @return string
*/
function _fs_text( $text ) {
// Avoid misleading Theme Check warning.
$fn = 'translate';
return $fn( $text, 'freemius' );
}
/**
* Retrieve translated string with gettext context.
*
* Quite a few times, there will be collisions with similar translatable text
* found in more than two places, but with different translated context.
*
* By including the context in the pot file, translators can translate the two
* strings differently.
*
* @since 1.2.1.6
*
* @param string $text
* @param string $context
*
* @return string
*/
function _fs_x( $text, $context ) {
// Avoid misleading Theme Check warning.
$fn = 'translate_with_gettext_context';
return $fn( $text, $context, 'freemius' );
}
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.1.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Cache_Manager {
/**
* @var FS_Option_Manager
*/
private $_options;
/**
* @var FS_Logger
*/
private $_logger;
/**
* @var FS_Cache_Manager[]
*/
private static $_MANAGERS = array();
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.3
*
* @param string $id
*/
private function __construct( $id ) {
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_cach_mngr_' . $id, WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
$this->_logger->entrance();
$this->_logger->log( 'id = ' . $id );
$this->_options = FS_Option_Manager::get_manager( $id, true, true, false );
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param $id
*
* @return FS_Cache_Manager
*/
static function get_manager( $id ) {
$id = strtolower( $id );
if ( ! isset( self::$_MANAGERS[ $id ] ) ) {
self::$_MANAGERS[ $id ] = new FS_Cache_Manager( $id );
}
return self::$_MANAGERS[ $id ];
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @return bool
*/
function is_empty() {
$this->_logger->entrance();
return $this->_options->is_empty();
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*/
function clear() {
$this->_logger->entrance();
$this->_options->clear( true );
}
/**
* Delete cache manager from DB.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*/
function delete() {
$this->_options->delete();
}
/**
* Check if there's a cached item.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
*
* @return bool
*/
function has( $key ) {
$cache_entry = $this->_options->get_option( $key, false );
return ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp )
);
}
/**
* Check if there's a valid cached item.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
* @param null|int $expiration Since 1.2.2.7
*
* @return bool
*/
function has_valid( $key, $expiration = null ) {
$cache_entry = $this->_options->get_option( $key, false );
$is_valid = ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp ) &&
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
);
if ( $is_valid &&
is_numeric( $expiration ) &&
isset( $cache_entry->created ) &&
is_numeric( $cache_entry->created ) &&
$cache_entry->created + $expiration < WP_FS__SCRIPT_START_TIME
) {
/**
* Even if the cache is still valid, since we are checking for validity
* with an explicit expiration period, if the period has past, return
* `false` as if the cache is invalid.
*
* @since 1.2.2.7
*/
$is_valid = false;
}
return $is_valid;
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
function get( $key, $default = null ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = $this->_options->get_option( $key, false );
if ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp )
) {
return $cache_entry->result;
}
return is_object( $default ) ? clone $default : $default;
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
* @param mixed $default
*
* @return mixed
*/
function get_valid( $key, $default = null ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = $this->_options->get_option( $key, false );
if ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp ) &&
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
) {
return $cache_entry->result;
}
return is_object( $default ) ? clone $default : $default;
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
* @param mixed $value
* @param int $expiration
* @param int $created Since 2.0.0 Cache creation date.
*/
function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $created = WP_FS__SCRIPT_START_TIME ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = new stdClass();
$cache_entry->result = $value;
$cache_entry->created = $created;
$cache_entry->timestamp = $created + $expiration;
$this->_options->set_option( $key, $cache_entry, true );
}
/**
* Get cached record expiration, or false if not cached or expired.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.7.3
*
* @param string $key
*
* @return bool|int
*/
function get_record_expiration( $key ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = $this->_options->get_option( $key, false );
if ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp ) &&
$cache_entry->timestamp > WP_FS__SCRIPT_START_TIME
) {
return $cache_entry->timestamp;
}
return false;
}
/**
* Purge cached item.
*
* @author Vova Feldman (@svovaf)
* @since 1.1.6
*
* @param string $key
*/
function purge( $key ) {
$this->_logger->entrance( 'key = ' . $key );
$this->_options->unset_option( $key, true );
}
/**
* Extend cached item caching period.
*
* @author Vova Feldman (@svovaf)
* @since 2.0.0
*
* @param string $key
* @param int $expiration
*
* @return bool
*/
function update_expiration( $key, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = $this->_options->get_option( $key, false );
if ( ! is_object( $cache_entry ) ||
! isset( $cache_entry->timestamp ) ||
! is_numeric( $cache_entry->timestamp )
) {
return false;
}
$this->set( $key, $cache_entry->result, $expiration, $cache_entry->created );
return true;
}
/**
* Set cached item as expired.
*
* @author Vova Feldman (@svovaf)
* @since 1.2.2.7
*
* @param string $key
*/
function expire( $key ) {
$this->_logger->entrance( 'key = ' . $key );
$cache_entry = $this->_options->get_option( $key, false );
if ( is_object( $cache_entry ) &&
isset( $cache_entry->timestamp ) &&
is_numeric( $cache_entry->timestamp )
) {
// Set to expired.
$cache_entry->timestamp = WP_FS__SCRIPT_START_TIME;
$this->_options->set_option( $key, $cache_entry, true );
}
}
#--------------------------------------------------------------------------------
#region Migration
#--------------------------------------------------------------------------------
/**
* Migrate options from site level.
*
* @author Vova Feldman (@svovaf)
* @since 2.0.0
*/
function migrate_to_network() {
$this->_options->migrate_to_network();
}
#endregion
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_GDPR_Manager {
/**
* @var FS_Option_Manager
*/
private $_storage;
/**
* @var array {
* @type bool $required Are GDPR rules apply on the current context admin.
* @type bool $show_opt_in_notice Should the marketing and offers opt-in message be shown to the admin or not. If not set, defaults to `true`.
* @type int $notice_shown_at Last time the special GDPR opt-in message was shown to the current admin.
* }
*/
private $_data;
/**
* @var int
*/
private $_wp_user_id;
/**
* @var string
*/
private $_option_name;
/**
* @var FS_Admin_Notices
*/
private $_notices;
#--------------------------------------------------------------------------------
#region Singleton
#--------------------------------------------------------------------------------
/**
* @var FS_GDPR_Manager
*/
private static $_instance;
/**
* @return FS_GDPR_Manager
*/
public static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
#endregion
private function __construct() {
$this->_storage = FS_Option_Manager::get_manager( WP_FS__GDPR_OPTION_NAME, true, true );
$this->_wp_user_id = Freemius::get_current_wp_user_id();
$this->_option_name = "u{$this->_wp_user_id}";
$this->_data = $this->_storage->get_option( $this->_option_name, array() );
$this->_notices = FS_Admin_Notices::instance( 'all_admins', '', '', true );
if ( ! is_array( $this->_data ) ) {
$this->_data = array();
}
}
/**
* Update a GDPR option for the current admin and store it.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @param string $name
* @param mixed $value
*/
private function update_option( $name, $value ) {
$this->_data[ $name ] = $value;
$this->_storage->set_option( $this->_option_name, $this->_data, true );
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.1.0
*
* @return bool|null
*/
public function is_required() {
return isset( $this->_data['required'] ) ?
$this->_data['required'] :
null;
}
/**
* @author Leo Fajardo (@leorw)
* @since 2.1.0
*
* @param bool $is_required
*/
public function store_is_required( $is_required ) {
$this->update_option( 'required', $is_required );
}
/**
* Checks if the GDPR opt-in sticky notice is currently shown.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @return bool
*/
public function is_opt_in_notice_shown() {
return $this->_notices->has_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
}
/**
* Remove the GDPR opt-in sticky notice.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*/
public function remove_opt_in_notice() {
$this->_notices->remove_sticky( "gdpr_optin_actions_{$this->_wp_user_id}", true );
$this->disable_opt_in_notice();
}
/**
* Prevents the opt-in message from being added/shown.
*
* @author Leo Fajardo (@leorw)
* @since 2.1.0
*/
public function disable_opt_in_notice() {
$this->update_option( 'show_opt_in_notice', false );
}
/**
* Checks if a GDPR opt-in message needs to be shown to the current admin.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @return bool
*/
public function should_show_opt_in_notice() {
return (
! isset( $this->_data['show_opt_in_notice'] ) ||
true === $this->_data['show_opt_in_notice']
);
}
/**
* Get the last time the GDPR opt-in notice was shown.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*
* @return false|int
*/
public function last_time_notice_was_shown() {
return isset( $this->_data['notice_shown_at'] ) ?
$this->_data['notice_shown_at'] :
false;
}
/**
* Update the timestamp of the last time the GDPR opt-in message was shown to now.
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*/
public function notice_was_just_shown() {
$this->update_option( 'notice_shown_at', WP_FS__SCRIPT_START_TIME );
}
/**
* @param string $message
* @param string|null $plugin_title
*
* @author Vova Feldman (@svovaf)
* @since 2.1.0
*/
public function add_opt_in_sticky_notice( $message, $plugin_title = null ) {
$this->_notices->add_sticky(
$message,
"gdpr_optin_actions_{$this->_wp_user_id}",
'',
'promotion',
true,
$this->_wp_user_id,
$plugin_title,
true
);
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_License_Manager /*extends FS_Abstract_Manager*/
{
//
//
// /**
// * @var FS_License_Manager[]
// */
// private static $_instances = array();
//
// static function instance( Freemius $fs ) {
// $slug = strtolower( $fs->get_slug() );
//
// if ( ! isset( self::$_instances[ $slug ] ) ) {
// self::$_instances[ $slug ] = new FS_License_Manager( $slug, $fs );
// }
//
// return self::$_instances[ $slug ];
// }
//
//// private function __construct($slug) {
//// parent::__construct($slug);
//// }
//
// function entry_id() {
// return 'licenses';
// }
//
// function sync( $id ) {
//
// }
//
// /**
// * @author Vova Feldman (@svovaf)
// * @since 1.0.5
// * @uses FS_Api
// *
// * @param number|bool $plugin_id
// *
// * @return FS_Plugin_License[]|stdClass Licenses or API error.
// */
// function api_get_user_plugin_licenses( $plugin_id = false ) {
// $api = $this->_fs->get_api_user_scope();
//
// if ( ! is_numeric( $plugin_id ) ) {
// $plugin_id = $this->_fs->get_id();
// }
//
// $result = $api->call( "/plugins/{$plugin_id}/licenses.json" );
//
// if ( ! isset( $result->error ) ) {
// for ( $i = 0, $len = count( $result->licenses ); $i < $len; $i ++ ) {
// $result->licenses[ $i ] = new FS_Plugin_License( $result->licenses[ $i ] );
// }
//
// $result = $result->licenses;
// }
//
// return $result;
// }
//
// function api_get_many() {
//
// }
//
// function api_activate( $id ) {
//
// }
//
// function api_deactivate( $id ) {
//
// }
/**
* @param FS_Plugin_License[] $licenses
*
* @return bool
*/
static function has_premium_license( $licenses ) {
if ( is_array( $licenses ) ) {
foreach ( $licenses as $license ) {
/**
* @var FS_Plugin_License $license
*/
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
return true;
}
}
}
return false;
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plan_Manager {
/**
* @var FS_Plan_Manager
*/
private static $_instance;
/**
* @return FS_Plan_Manager
*/
static function instance() {
if ( ! isset( self::$_instance ) ) {
self::$_instance = new FS_Plan_Manager();
}
return self::$_instance;
}
private function __construct() {
}
/**
* @param FS_Plugin_License[] $licenses
*
* @return bool
*/
function has_premium_license( $licenses ) {
if ( is_array( $licenses ) ) {
/**
* @var FS_Plugin_License[] $licenses
*/
foreach ( $licenses as $license ) {
if ( ! $license->is_utilized() && $license->is_features_enabled() ) {
return true;
}
}
}
return false;
}
/**
* Check if plugin has any paid plans.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.7
*
* @param FS_Plugin_Plan[] $plans
*
* @return bool
*/
function has_paid_plan( $plans ) {
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
return false;
}
/**
* @var FS_Plugin_Plan[] $plans
*/
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
if ( ! $plans[ $i ]->is_free() ) {
return true;
}
}
return false;
}
/**
* Check if plugin has any free plan, or is it premium only.
*
* Note: If no plans configured, assume plugin is free.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.7
*
* @param FS_Plugin_Plan[] $plans
*
* @return bool
*/
function has_free_plan( $plans ) {
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
return true;
}
/**
* @var FS_Plugin_Plan[] $plans
*/
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
if ( $plans[ $i ]->is_free() ) {
return true;
}
}
return false;
}
/**
* Find all plans that have trial.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @param FS_Plugin_Plan[] $plans
*
* @return FS_Plugin_Plan[]
*/
function get_trial_plans( $plans ) {
$trial_plans = array();
if ( is_array( $plans ) && 0 < count( $plans ) ) {
/**
* @var FS_Plugin_Plan[] $plans
*/
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
if ( $plans[ $i ]->has_trial() ) {
$trial_plans[] = $plans[ $i ];
}
}
}
return $trial_plans;
}
/**
* Check if plugin has any trial plan.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.9
*
* @param FS_Plugin_Plan[] $plans
*
* @return bool
*/
function has_trial_plan( $plans ) {
if ( ! is_array( $plans ) || 0 === count( $plans ) ) {
return true;
}
/**
* @var FS_Plugin_Plan[] $plans
*/
for ( $i = 0, $len = count( $plans ); $i < $len; $i ++ ) {
if ( $plans[ $i ]->has_trial() ) {
return true;
}
}
return false;
}
}
\ No newline at end of file
<?php
/**
* @package Freemius
* @copyright Copyright (c) 2015, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
* @since 1.0.6
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FS_Plugin_Manager {
/**
* @since 1.2.2
*
* @var string|number
*/
protected $_module_id;
/**
* @since 1.2.2
*
* @var FS_Plugin
*/
protected $_module;
/**
* @var FS_Plugin_Manager[]
*/
private static $_instances = array();
/**
* @var FS_Logger
*/
protected $_logger;
/**
* Option names
*
* @author Leo Fajardo (@leorw)
* @since 1.2.2
*/
const OPTION_NAME_PLUGINS = 'plugins';
const OPTION_NAME_THEMES = 'themes';
/**
* @param string|number $module_id
*
* @return FS_Plugin_Manager
*/
static function instance( $module_id ) {
$key = 'm_' . $module_id;
if ( ! isset( self::$_instances[ $key ] ) ) {
self::$_instances[ $key ] = new FS_Plugin_Manager( $module_id );
}
return self::$_instances[ $key ];
}
/**
* @param string|number $module_id
*/
protected function __construct( $module_id ) {
$this->_logger = FS_Logger::get_logger( WP_FS__SLUG . '_' . $module_id . '_' . 'plugins', WP_FS__DEBUG_SDK, WP_FS__ECHO_DEBUG_SDK );
$this->_module_id = $module_id;
$this->load();
}
protected function get_option_manager() {
return FS_Option_Manager::get_manager( WP_FS__ACCOUNTS_OPTION_NAME, true, true );
}
/**
* @author Leo Fajardo (@leorw)
* @since 1.2.2
*
* @param string|bool $module_type "plugin", "theme", or "false" for all modules.
*
* @return array
*/
protected function get_all_modules( $module_type = false ) {
$option_manager = $this->get_option_manager();
if ( false !== $module_type ) {
return fs_get_entities( $option_manager->get_option( $module_type . 's', array() ), FS_Plugin::get_class_name() );
}
return array(
self::OPTION_NAME_PLUGINS => fs_get_entities( $option_manager->get_option( self::OPTION_NAME_PLUGINS, array() ), FS_Plugin::get_class_name() ),
self::OPTION_NAME_THEMES => fs_get_entities( $option_manager->get_option( self::OPTION_NAME_THEMES, array() ), FS_Plugin::get_class_name() ),
);
}
/**
* Load plugin data from local DB.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*/
function load() {
$all_modules = $this->get_all_modules();
if ( ! is_numeric( $this->_module_id ) ) {
unset( $all_modules[ self::OPTION_NAME_THEMES ] );
}
foreach ( $all_modules as $modules ) {
/**
* @since 1.2.2
*
* @var $modules FS_Plugin[]
*/
foreach ( $modules as $module ) {
$found_module = false;
/**
* If module ID is not numeric, it must be a plugin's slug.
*
* @author Leo Fajardo (@leorw)
* @since 1.2.2
*/
if ( ! is_numeric( $this->_module_id ) ) {
if ( $this->_module_id === $module->slug ) {
$this->_module_id = $module->id;
$found_module = true;
}
} else if ( $this->_module_id == $module->id ) {
$found_module = true;
}
if ( $found_module ) {
$this->_module = $module;
break;
}
}
}
}
/**
* Store plugin on local DB.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @param bool|FS_Plugin $module
* @param bool $flush
*
* @return bool|\FS_Plugin
*/
function store( $module = false, $flush = true ) {
if ( false !== $module ) {
$this->_module = $module;
}
$all_modules = $this->get_all_modules( $this->_module->type );
$all_modules[ $this->_module->slug ] = $this->_module;
$options_manager = $this->get_option_manager();
$options_manager->set_option( $this->_module->type . 's', $all_modules, $flush );
return $this->_module;
}
/**
* Update local plugin data if different.
*
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @param \FS_Plugin $plugin
* @param bool $store
*
* @return bool True if plugin was updated.
*/
function update( FS_Plugin $plugin, $store = true ) {
if ( ! ($this->_module instanceof FS_Plugin ) ||
$this->_module->slug != $plugin->slug ||
$this->_module->public_key != $plugin->public_key ||
$this->_module->secret_key != $plugin->secret_key ||
$this->_module->parent_plugin_id != $plugin->parent_plugin_id ||
$this->_module->title != $plugin->title
) {
$this->store( $plugin, $store );
return true;
}
return false;
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @param FS_Plugin $plugin
* @param bool $store
*/
function set( FS_Plugin $plugin, $store = false ) {
$this->_module = $plugin;
if ( $store ) {
$this->store();
}
}
/**
* @author Vova Feldman (@svovaf)
* @since 1.0.6
*
* @return bool|\FS_Plugin
*/
function get() {
if ( isset( $this->_module ) ) {
return $this->_module;
}
if ( empty( $this->_module_id ) ) {
return false;
}
/**
* Return an FS_Plugin entity that has its `id` and `is_live` properties set (`is_live` is initialized in the FS_Plugin constructor) to avoid triggering an error that is relevant to these properties when the FS_Plugin entity is used before the `parse_settings()` method is called. This can happen when creating a regular WordPress site by cloning a subsite of a multisite network and the data that is stored in the network-level storage is not cloned.
*
* @author Leo Fajardo (@leorw)
* @since 2.5.0
*/
$plugin = new FS_Plugin();
$plugin->id = $this->_module_id;
return $plugin;
}
}
\ No newline at end of file
<?php
// Silence is golden.
// Hide file structure from users on unprotected servers.
\ No newline at end of file
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
exit;
}
if ( ! class_exists( 'Freemius_ArgumentNotExistException' ) ) {
class Freemius_ArgumentNotExistException extends Freemius_InvalidArgumentException {
}
}
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Freemius_InvalidArgumentException' ) ) {
exit;
}
if ( ! class_exists( 'Freemius_EmptyArgumentException' ) ) {
class Freemius_EmptyArgumentException extends Freemius_InvalidArgumentException {
}
}
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Freemius_Exception' ) ) {
/**
* Thrown when an API call returns an exception.
*
*/
class Freemius_Exception extends Exception {
protected $_result;
protected $_type;
protected $_code;
/**
* Make a new API Exception with the given result.
*
* @param array $result The result from the API server.
*/
public function __construct( $result ) {
$this->_result = $result;
$code = 0;
$message = 'Unknown error, please check GetResult().';
$type = '';
if ( isset( $result['error'] ) && is_array( $result['error'] ) ) {
if ( isset( $result['error']['code'] ) ) {
$code = $result['error']['code'];
}
if ( isset( $result['error']['message'] ) ) {
$message = $result['error']['message'];
}
if ( isset( $result['error']['type'] ) ) {
$type = $result['error']['type'];
}
}
$this->_type = $type;
$this->_code = $code;
parent::__construct( $message, is_numeric( $code ) ? $code : 0 );
}
/**
* Return the associated result object returned by the API server.
*
* @return array The result from the API server
*/
public function getResult() {
return $this->_result;
}
public function getStringCode() {
return $this->_code;
}
public function getType() {
return $this->_type;
}
/**
* To make debugging easier.
*
* @return string The string representation of the error
*/
public function __toString() {
$str = $this->getType() . ': ';
if ( $this->code != 0 ) {
$str .= $this->getStringCode() . ': ';
}
return $str . $this->getMessage();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment