This commit is contained in:
2026-10-06 18:51:23 -06:00
parent 8424dacd03
commit e2c26b7f21
4223 changed files with 737986 additions and 53 deletions
@@ -0,0 +1,71 @@
<?php
/**
* Load lite-specific scripts here.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'admin_enqueue_scripts', 'wpcode_admin_scripts_global_lite' );
add_action( 'admin_head', 'wpcode_listen_for_deploy_message' );
/**
* Load version-specific global scripts.
*
* @return void
*/
function wpcode_admin_scripts_global_lite() {
// Don't load global admin scripts if headers & footers mode is enabled.
if ( wpcode()->settings->get_option( 'headers_footers_mode' ) ) {
return;
}
wpcode_admin_scripts_global();
}
/**
* This is loaded after the plugin is activated and if the installation process was initiated
* from the WPCode Library site it will redirect the user to the appropriate page to continue
* that process.
*
* @return void
*/
function wpcode_listen_for_deploy_message() {
// Load this only in the plugins list.
$screen = get_current_screen();
$screens = array(
'plugins',
'plugin-install',
);
if ( ! isset( $screen->id ) || ! in_array( $screen->id, $screens, true ) ) {
return;
}
$click_page = add_query_arg(
array(
'page' => 'wpcode-click',
),
admin_url( 'admin.php' )
)
?>
<script>
if ( window.opener ) {
window.opener.postMessage(
'wpcode-plugin-installed',
'<?php echo esc_url( wpcode()->library_auth->library_url ); ?>'
);
}
window.addEventListener(
'message',
( event ) => {
if ( !event.isTrusted || '<?php echo esc_url( wpcode()->library_auth->library_url ); ?>' !== event.origin || 'wpcode-show-connect' !== event.data ) {
return;
}
window.location.href = '<?php echo esc_url( $click_page ); ?>&message=wpcode-deploy';
},
false
);
</script>
<?php
}
@@ -0,0 +1,116 @@
<?php
/**
* Lite-specific admin page loader.
* Extends the default pages with lite-specific items.
*
* @package WPCode
*/
/**
* Class WPCode_Admin_Page_Loader_Lite.
*/
class WPCode_Admin_Page_Loader_Lite extends WPCode_Admin_Page_Loader {
/**
* Load menu items from parent class and add class-specific ones.
*
* @return void
*/
public function hooks() {
parent::hooks();
add_action( 'admin_menu', array( $this, 'add_upgrade_menu_item' ), 40 );
add_action( 'admin_head', array( $this, 'adjust_pro_menu_item_class' ) );
add_action( 'admin_head', array( $this, 'admin_menu_styles' ), 11 );
}
/**
* Require lite-specific files.
*
* @return void
*/
public function require_files() {
require_once WPCODE_PLUGIN_PATH . 'includes/admin/pages/trait-wpcode-library-refresh-button.php';
parent::require_files();
}
/**
* Add lite-specific upgrade to pro menu item.
*
* @return void
*/
public function add_upgrade_menu_item() {
add_submenu_page(
'wpcode',
esc_html__( 'Upgrade to Pro', 'insert-headers-and-footers' ),
esc_html__( 'Upgrade to Pro', 'insert-headers-and-footers' ),
'wpcode_edit_snippets',
esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'wpcode-admin', 'admin-side-menu' ) )
);
}
/**
* Add the PRO badge to left sidebar menu item.
*
* @since 1.7.8
*/
public function adjust_pro_menu_item_class() {
global $submenu;
// Bail if plugin menu is not registered.
if ( ! isset( $submenu['wpcode'] ) ) {
return;
}
$upgrade_link_position = key(
array_filter(
$submenu['wpcode'],
static function ( $item ) {
return strpos( $item[2], 'https://wpcode.com/lite' ) !== false;
}
)
);
// Bail if "Upgrade to Pro" menu item is not registered.
if ( is_null( $upgrade_link_position ) ) {
return;
}
$screen = get_current_screen();
// Let's make sure we have an ID and the link is set in the menu.
if ( isset( $screen->id ) && isset( $submenu['wpcode'][ $upgrade_link_position ][2] ) ) {
// Let's clean up the screen id a bit.
$screen_id = str_replace(
array(
'code-snippets_page_',
'toplevel_page_',
),
'',
$screen->id
);
$submenu['wpcode'][ $upgrade_link_position ][2] = str_replace( 'wpcode-admin', $screen_id, $submenu['wpcode'][ $upgrade_link_position ][2] );
}
// Prepare a HTML class.
// phpcs:disable WordPress.WP.GlobalVariablesOverride.Prohibited
if ( isset( $submenu['wpcode'][ $upgrade_link_position ][4] ) ) {
$submenu['wpcode'][ $upgrade_link_position ][4] .= ' wpcode-sidebar-upgrade-pro';
} else {
$submenu['wpcode'][ $upgrade_link_position ][] = 'wpcode-sidebar-upgrade-pro';
}
// phpcs:enable WordPress.WP.GlobalVariablesOverride.Prohibited
}
/**
* Output inline styles for the admin menu.
*/
public function admin_menu_styles() {
$styles = 'a.wpcode-sidebar-upgrade-pro { background-color: #59A56D !important; color: #fff !important; font-weight: 600 !important; }';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( '<style>%s</style>', $styles );
}
}
@@ -0,0 +1,267 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WPCode Connect.
*
* WPCode Connect is our service that makes it easy to upgrade to WPCode Pro
* without having to manually install the WPCode Pro plugin.
*
* @since 2.0.9
*/
class WPCode_Connect {
/**
* Constructor.
*
* @since 2.0.9
*/
public function __construct() {
$this->hooks();
}
/**
* Hooks.
*
* @since 2.0.9
*/
public function hooks() {
add_action( 'wpcode_admin_page_content_wpcode-settings', array( $this, 'settings_enqueues' ) );
add_action( 'wp_ajax_wpcode_connect_url', array( $this, 'generate_url' ) );
add_action( 'wp_ajax_nopriv_wpcode_connect_process', array( $this, 'process' ) );
}
/**
* Settings page enqueues.
*
* @since 2.0.9
*/
public function settings_enqueues() {
$admin_asset_file = WPCODE_PLUGIN_PATH . 'build/connect.asset.php';
if ( ! file_exists( $admin_asset_file ) ) {
return;
}
$asset = require $admin_asset_file;
wp_enqueue_script( 'wpcode-connect-js', WPCODE_PLUGIN_URL . 'build/connect.js', $asset['dependencies'], $asset['version'], true );
}
/**
* Generate and return the WPCode Connect URL.
*
* @since 2.0.9
*/
public function generate_url() {
// Run a security check.
check_ajax_referer( 'wpcode_admin' );
// Check for permissions.
if ( ! current_user_can( 'install_plugins' ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'You are not allowed to install plugins.', 'insert-headers-and-footers' ) ) );
}
$key = ! empty( $_POST['key'] ) ? sanitize_text_field( wp_unslash( $_POST['key'] ) ) : '';
if ( empty( $key ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'Please enter your license key to connect.', 'insert-headers-and-footers' ) ) );
}
if ( class_exists( 'WPCode_Premium' ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'Only the Lite version can be upgraded.', 'insert-headers-and-footers' ) ) );
}
// Verify pro version is not installed.
$active = activate_plugin( 'wpcode-premium/wpcode.php', false, false, true );
if ( ! is_wp_error( $active ) ) {
update_option( 'wpcode_install', 1 ); // Run install routines.
// Deactivate Lite.
$plugin = plugin_basename( WPCODE_FILE );
deactivate_plugins( $plugin );
do_action( 'wpcode_plugin_deactivated', $plugin );
wp_send_json_success(
array(
'message' => esc_html__( 'WPCode Pro is installed but not activated.', 'insert-headers-and-footers' ),
'reload' => true,
)
);
}
// Generate URL.
$oth = hash( 'sha512', wp_rand() );
$hashed_oth = hash_hmac( 'sha512', $oth, wp_salt() );
update_option( 'wpcode_connect_token', $oth );
update_option( 'wpcode_connect', $key );
$version = WPCODE_VERSION;
$endpoint = admin_url( 'admin-ajax.php' );
$redirect = admin_url( 'admin.php?page=wpcode-settings' );
$url = add_query_arg(
array(
'key' => $key,
'oth' => $hashed_oth,
'endpoint' => $endpoint,
'version' => $version,
'siteurl' => admin_url(),
'homeurl' => home_url(),
'redirect' => rawurldecode( base64_encode( $redirect ) ), // phpcs:ignore
'v' => 2,
'php' => phpversion(),
'wp' => get_bloginfo( 'version' ),
),
'https://upgrade.wpcode.com/'
);
wp_send_json_success(
array(
'url' => $url,
'back_url' => add_query_arg(
array(
'action' => 'wpcode_connect',
'oth' => $oth,
),
$endpoint
),
)
);
}
/**
* Process WPCode Connect.
*
* @since 2.0.9
*/
public function process() {
$error = esc_html__( 'There was an error while installing an upgrade. Please download the plugin from wpcode.com and install it manually.', 'insert-headers-and-footers' );
// Verify params present (oth & download link).
$post_oth = ! empty( $_REQUEST['oth'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['oth'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification
$post_url = ! empty( $_REQUEST['file'] ) ? esc_url_raw( wp_unslash( $_REQUEST['file'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification
if ( empty( $post_oth ) || empty( $post_url ) ) {
wp_send_json_error( $error );
}
// Verify oth.
$oth = get_option( 'wpcode_connect_token' );
if ( hash_hmac( 'sha512', $oth, wp_salt() ) !== $post_oth ) {
wp_send_json_error( $error );
}
// Delete so cannot replay.
delete_option( 'wpcode_connect_token' );
// Set the current screen to avoid undefined notices.
set_current_screen( 'wpcode_page_wpcode-settings' );
// Prepare variables.
$url = esc_url_raw(
add_query_arg(
array( 'page' => 'wpcode-settings' ),
admin_url( 'admin.php' )
)
);
// Verify pro not activated.
if ( class_exists( 'WPCode_Premium' ) ) {
wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'insert-headers-and-footers' ) );
}
// Verify pro not installed.
$active = activate_plugin( 'wpcode-premium/wpcode.php', $url, false, true );
if ( ! is_wp_error( $active ) ) {
$plugin = plugin_basename( WPCODE_FILE );
deactivate_plugins( $plugin );
do_action( 'wpcode_plugin_deactivated', $plugin );
wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'insert-headers-and-footers' ) );
}
$creds = request_filesystem_credentials( $url, '', false, false, null );
// Check for file system permissions.
if ( false === $creds || ! WP_Filesystem( $creds ) ) {
wp_send_json_error(
esc_html__( 'There was an error while installing an upgrade. Please check file system permissions and try again. Also, you can download the plugin from wpcode.com and install it manually.', 'insert-headers-and-footers' )
);
}
/*
* We do not need any extra credentials if we have gotten this far, so let's install the plugin.
*/
// Do not allow WordPress to search/download translations, as this will break JS output.
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
wpcode_require_upgrader();
// Create the plugin upgrader with our custom skin.
$installer = new Plugin_Upgrader( new WPCode_Skin() );
// Error check.
if ( ! method_exists( $installer, 'install' ) ) {
wp_send_json_error( $error );
}
// Check license key.
$key = get_option( 'wpcode_connect', false );
if ( empty( $key ) ) {
wp_send_json_error(
new WP_Error(
'403',
esc_html__( 'No key provided.', 'insert-headers-and-footers' )
)
);
}
$installer->install( $post_url ); // phpcs:ignore
// Flush the cache and return the newly installed plugin basename.
wp_cache_flush();
$plugin_basename = $installer->plugin_info();
if ( $plugin_basename ) {
// Deactivate the lite version first.
$plugin = plugin_basename( WPCODE_FILE );
deactivate_plugins( $plugin );
do_action( 'wpcode_plugin_deactivated', $plugin );
// Activate the plugin silently.
$activated = activate_plugin( $plugin_basename, '', false, true );
if ( ! is_wp_error( $activated ) ) {
add_option( 'wpcode_install', 1 );
wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'insert-headers-and-footers' ) );
} else {
// Reactivate the lite plugin if pro activation failed.
activate_plugin( plugin_basename( WPCODE_FILE ), '', false, true );
wp_send_json_error( esc_html__( 'Pro version installed but needs to be activated on the Plugins page inside your WordPress admin.', 'insert-headers-and-footers' ) );
}
}
wp_send_json_error( $error );
}
}
new WPCode_Connect();
@@ -0,0 +1,328 @@
<?php
/**
* Class used for the lite-specific metabox.
*
* @package WPCode
*/
/**
* Class WPCode_Metabox_Snippets_Lite.
*/
class WPCode_Metabox_Snippets_Lite extends WPCode_Metabox_Snippets {
use WPCode_Revisions_Display_Lite;
/**
* Override the header tab content to make it specific to this class.
*
* @param WP_Post $post The post object.
*
* @return void
*/
public function output_tab_header( $post ) {
$this->form_for_scripts(
__( 'Header', 'insert-headers-and-footers' )
);
}
/**
* Override the footer tab content to make it specific to this class.
*
* @param WP_Post $post The post object.
*
* @return void
*/
public function output_tab_footer( $post ) {
$this->form_for_scripts(
__( 'Footer', 'insert-headers-and-footers' )
);
}
/**
* Override the body tab content to make it specific to this class.
*
* @param WP_Post $post The post object.
*
* @return void
*/
public function output_tab_body( $post ) {
$this->form_for_scripts(
__( 'Body', 'insert-headers-and-footers' )
);
}
/**
* Override the code tab content to make it specific to this class.
*
* @param WP_Post $post The post object.
*
* @return void
*/
public function output_tab_code( $post ) {
?>
<div class="wpcode-blur-area">
<p>
<?php esc_html_e( 'Choose the snippets you want to run on this page. Please note: only active snippets will be executed.', 'insert-headers-and-footers' ); ?>
</p>
<div class="wpcode-metabox-snippets">
<div id="wpcode-snippet-chooser">
<h3>
<?php esc_html_e( 'Select snippets', 'insert-headers-and-footers' ); ?>
<button class="wpcode-button-just-icon wpcode-drawer-toggle" id="wpcode-close-drawer">
<?php wpcode_icon( 'close' ); ?>
</button>
</h3>
<div class="wpcode-snippets-search">
<input type="text" id="wpcode-search-snippets" class="wpcode-input-text" placeholder="<?php esc_attr_e( 'Search snippets', 'insert-headers-and-footers' ); ?>"/>
<span class="wpcode-loading-spinner" id="wpcode-chooser-spinner"></span>
</div>
<div class="wpcode-chooser-fixed-height">
<div id="wpcode-choose-snippets"></div>
<div class="wpcode-choose-actions">
<button type="button" class="wpcode-button wpcode-button-secondary" id="wpcode-metabox-load-more"><?php esc_html_e( 'Load more snippets', 'insert-headers-and-footers' ); ?></button>
</div>
</div>
</div>
<div class="wpcode-picked-snippets-area">
<h3>
<button class="wpcode-button wpcode-drawer-toggle" id="wpcode-add-snippet-toggle" type="button">
<?php esc_html_e( '+ Choose Snippet', 'insert-headers-and-footers' ); ?>
</button>
</h3>
<div id="wpcode-picked-snippets">
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Show site currency</h3>
<label>Page location</label>
<select>
<option>Insert After Post</option>
</select>
</div>
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Banner Ad</h3>
<label>Page location</label>
<select>
<option>Insert Before Post</option>
</select>
</div>
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Subscribe Reminder</h3>
<label>Page location</label>
<select>
<option>Insert Before Content</option>
</select>
</div>
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Event Countdown</h3>
<label>Page location</label>
<select>
<option>Insert After Post</option>
</select>
</div>
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Banner Ad 2</h3>
<label>Page location</label>
<select>
<option>Insert After Content</option>
</select>
</div>
<div class="wpcode-list-item wpcode-selected-snippet-item wpcode-list-item-has-pill">
<h3>Free Download Button</h3>
<label>Page location</label>
<select>
<option>Insert After Post</option>
</select>
</div>
</div>
</div>
</div>
</div>
<?php
echo WPCode_Admin_Page::get_upsell_box( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
__( 'Page Scripts is a Pro Feature', 'insert-headers-and-footers' ),
sprintf(
'<p>%s</p>',
esc_html__( 'While you can always use global snippets, in the PRO version you can easily add page-specific scripts and snippets directly from the post edit screen.', 'insert-headers-and-footers' )
),
array(
'text' => esc_html__( 'Upgrade to Pro and Unlock Page Scripts', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'custom-snippets', 'upgrade-to-pro' ) ),
),
array(
'text' => esc_html__( 'Learn more about all the features', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'custom-snippets', 'features' ) ),
)
);
}
/**
* Get the markup for a form using a disabled CodeMirror instance (to avoid loading a script that won't be used).
*
* @param string $label The label for this tab section.
*
* @return void
*/
public function form_for_scripts( $label ) {
wp_enqueue_style( 'code-editor' );
?>
<div class="wpcode-blur-area">
<p>
<?php
printf(
// Translators: placeholder for the name of the section (header or footer).
esc_html__( 'Add scripts below to the %s section of this page.', 'insert-headers-and-footers' ),
esc_html( $label )
);
?>
</p>
<p>
<label>
<input type="checkbox"/>
<?php
printf(
// Translators: placeholder for the name of the section (header or footer).
esc_html__( 'Disable global %s scripts on this page', 'insert-headers-and-footers' ),
esc_html( $label )
);
?>
</label>
</p>
<div class="wpcode-input-row">
<label>
<?php
printf(
// Translators: placeholder for the name of the section (header or footer).
esc_html__( '%s - any device type', 'insert-headers-and-footers' ),
esc_html( $label )
);
?>
</label>
<div class="wpcode-smart-tags">
<button class="wpcode-smart-tags-toggle">
<?php wpcode_icon( 'tags', 20, 16, '0 0 20 16' ); ?>
<span class="wpcode-text-default">
<?php esc_html_e( 'Show Smart Tags', 'insert-headers-and-footers' ); ?>
</span>
</button>
</div>
<div class="CodeMirror cm-s-default CodeMirror-wrap">
<div class="CodeMirror-vscrollbar" style="width: 18px; pointer-events: none;">
<div style="min-width: 1px; height: 0;"></div>
</div>
<div class="CodeMirror-hscrollbar" style="height: 18px; pointer-events: none;">
<div style="height: 100%; min-height: 1px; width: 0;"></div>
</div>
<div class="CodeMirror-scrollbar-filler"></div>
<div class="CodeMirror-gutter-filler"></div>
<div class="CodeMirror-scroll" tabindex="-1">
<div class="CodeMirror-sizer" style="margin-left: 50px; margin-bottom: 0; border-right-width: 30px; min-height: 165px; padding-right: 0; padding-bottom: 0;">
<div style="position: relative; top: 0;">
<div class="CodeMirror-lines" role="presentation">
<div role="presentation" style="position: relative; outline: none;">
<div class="CodeMirror-measure"></div>
<div class="CodeMirror-measure"></div>
<div style="position: relative; z-index: 1;"></div>
<div class="CodeMirror-cursors"></div>
<div class="" role="presentation" tabindex="0" style="">
<div class="CodeMirror-activeline" style="position: relative;">
<div class="CodeMirror-activeline-background CodeMirror-linebackground"></div>
<div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: -46px; width: 46px;"></div>
<div class="CodeMirror-gutter-wrapper CodeMirror-activeline-gutter" style="left: -46px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 16px; width: 21px;">
1
</div>
</div>
<pre class="CodeMirror-line" role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket CodeMirror-matchingtag">&lt;</span><span class="cm-tag CodeMirror-matchingtag">script</span><span class=" CodeMirror-matchingtag"> </span><span class="cm-attribute CodeMirror-matchingtag">type</span><span class=" CodeMirror-matchingtag">=</span><span class="cm-string CodeMirror-matchingtag">"text/javascript"</span><span class="cm-tag cm-bracket CodeMirror-matchingtag">&gt;</span></span></pre>
</div>
<div style="position: relative;">
<div class="CodeMirror-gutter-wrapper" style="left: -46px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 16px; width: 21px;">
2
</div>
</div>
<pre class="CodeMirror-line" role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tab" role="presentation"> </span><span class="cm-variable">console</span>.<span class="cm-property">log</span>( <span class="cm-string">'header'</span> );</span></pre>
</div>
<div style="position: relative;">
<div class="CodeMirror-gutter-wrapper" style="left: -46px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 16px; width: 21px;">
3
</div>
</div>
<pre class="CodeMirror-line" role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-tag cm-bracket CodeMirror-matchingtag">&lt;/</span><span class="cm-tag CodeMirror-matchingtag">script</span><span class="cm-tag cm-bracket CodeMirror-matchingtag">&gt;</span></span></pre>
</div>
<div style="position: relative;">
<div class="CodeMirror-gutter-wrapper" style="left: -46px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 16px; width: 21px;">
4
</div>
</div>
<pre class="CodeMirror-line" role="presentation"><span role="presentation" style="padding-right: 0.1px;"></pre>
</div>
<div style="position: relative;">
<div class="CodeMirror-gutter-wrapper" style="left: -46px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 16px; width: 21px;">
5
</div>
</div>
<pre class="CodeMirror-line" role="presentation"><span role="presentation" style="padding-right: 0.1px;"></pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="position: absolute; height: 30px; width: 1px; border-bottom: 0 solid transparent; top: 165px;"></div>
<div class="CodeMirror-gutters" style="height: 195px;">
<div class="CodeMirror-gutter CodeMirror-lint-markers"></div>
<div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div>
</div>
</div>
</div>
</div>
</div>
<?php
echo WPCode_Admin_Page::get_upsell_box( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
__( 'Page Scripts is a Pro Feature', 'insert-headers-and-footers' ),
sprintf(
'<p>%s</p>',
esc_html__( 'While you can always use global snippets, in the PRO version you can easily add page-specific scripts and snippets directly from the post edit screen.', 'insert-headers-and-footers' )
),
array(
'text' => esc_html__( 'Upgrade to Pro and Unlock Page Scripts', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'main-' . sanitize_title( $label ), 'upgrade-to-pro' ) ),
),
array(
'text' => esc_html__( 'Learn more about all the features', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'main-' . sanitize_title( $label ), 'features' ) ),
)
);
}
/**
* Override the revisions tab content to make it specific to this class.
*
* @param WP_Post $post The post object.
*
* @return void
*/
public function output_tab_revisions( $post ) {
printf(
'<p>%s</p>',
esc_html__( 'As you make changes to your page scripts and save, you will get a list of previous versions with all the changes made in each revision. You can compare revisions to the current version or see changes as they have been saved by going through each revision. Any of the revisions can then be restored as needed without interfering with your post/page.', 'insert-headers-and-footers' )
);
echo $this->code_revisions_list_with_notice( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
esc_html__( 'Code Revisions is a Pro Feature', 'insert-headers-and-footers' ),
sprintf(
'<p>%s</p>',
esc_html__( 'Upgrade to WPCode Pro today and start tracking revisions and see exactly who, when and which changes were made to your page scripts.', 'insert-headers-and-footers' )
),
array(
'text' => esc_html__( 'Upgrade to Pro and Unlock Revisions', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'revisions', 'upgrade-to-pro' ) ),
),
array(
'text' => esc_html__( 'Learn more about all the features', 'insert-headers-and-footers' ),
'url' => esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'post-editor-metabox', 'revisions', 'features' ) ),
)
);
}
}
@@ -0,0 +1,32 @@
<?php
/**
* WPCode Usage Tracking Lite
*
* @package WPCode
* @since 2.0.10
*/
/**
* Class WPCode_Usage_Tracking_Lite
*/
class WPCode_Usage_Tracking_Lite extends WPCode_Usage_Tracking {
/**
* Get the type for the request.
*
* @return string The plugin type.
* @since 2.0.10
*/
public function get_type() {
return 'lite';
}
/**
* Is the usage tracking enabled?
*
* @return bool
*/
public function is_enabled() {
return boolval( wpcode()->settings->get_option( 'usage_tracking' ) );
}
}
@@ -0,0 +1,158 @@
<?php
/**
* Lite-specific admin notices.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'admin_init', 'wpcode_maybe_add_library_connect_notice' );
add_action( 'wpcode_admin_page', 'wpcode_maybe_add_lite_top_bar_notice', 4 );
add_action( 'wpcode_admin_page_content_wpcode-headers-footers', 'wpcode_headers_footers_bottom_notice', 250 );
/**
* Show a prompt to connect to the WPCode Library to get access to more snippets.
*
* @return void
*/
function wpcode_maybe_add_library_connect_notice() {
if ( ! isset( $_GET['page'] ) || 0 !== strpos( $_GET['page'], 'wpcode' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
return;
}
if ( ! isset( wpcode()->library_auth ) || wpcode()->library_auth->has_auth() ) {
return;
}
// Don't show if in headers & footers mode only.
if ( wpcode()->settings->get_option( 'headers_footers_mode' ) ) {
return;
}
$settings_url = add_query_arg(
array(
'page' => 'wpcode-settings',
),
admin_url( 'admin.php' )
);
$snippets_count = wpcode()->library->get_snippets_count();
// Translators: more here is used in the sense of "get access to more snippets" and gets replaced with the number of snippets if the library items are loaded correctly.
$more = $snippets_count > 0 ? $snippets_count : __( 'more', 'insert-headers-and-footers' );
WPCode_Notice::info(
sprintf(
// Translators: %1$s and %2$s add a link to the settings page. %3$s and %4$s make the text bold. %6$s is replaced with the number of snippets and %5$s adds a "new" icon.
__( '%5$s%1$sConnect to the WPCode Library%2$s to get access to %3$s%6$s FREE snippets%4$s!', 'insert-headers-and-footers' ),
'<a href="' . $settings_url . '" class="wpcode-start-auth">',
'</a>',
'<strong>',
'</strong>',
'<span class="wpcode-icon-new">&nbsp;NEW!</span>',
$more
),
array(
'dismiss' => WPCode_Notice::DISMISS_GLOBAL,
'slug' => 'wpcode-library-connect-lite',
)
);
}
/**
* Add a notice to consider more features with offer.
*
* @return void
*/
function wpcode_maybe_add_lite_top_bar_notice() {
// Only add this to the WPCode pages.
if ( ! isset( $_GET['page'] ) || 0 !== strpos( $_GET['page'], 'wpcode' ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
return;
}
// Don't show in H&F mode.
if ( wpcode()->settings->get_option( 'headers_footers_mode' ) ) {
return;
}
$screen = get_current_screen();
if ( isset( $screen->id ) && false !== strpos( $screen->id, 'code-snippets_page_wpcode-' ) ) {
$screen = str_replace( 'code-snippets_page_wpcode-', '', $screen->id );
} else {
$screen = 'snippets-list';
}
$upgrade_url = wpcode_utm_url(
'https://wpcode.com/lite/',
'top-notice',
$screen
);
WPCode_Notice::top(
sprintf(
// Translators: %1$s and %2$s add a link to the upgrade page. %3$s and %4$s make the text bold.
__( '%3$sYou\'re using WPCode Lite%4$s. To unlock more features consider %1$supgrading to Pro%2$s.', 'insert-headers-and-footers' ),
'<a href="' . $upgrade_url . '" target="_blank" rel="noopener noreferrer">',
'</a>',
'<strong>',
'</strong>'
),
array(
'dismiss' => WPCode_Notice::DISMISS_USER,
'slug' => 'consider-upgrading',
)
);
}
/**
* Show a notice with more features at the bottom of the Headers & Footers page.
*
* @return void
*/
function wpcode_headers_footers_bottom_notice() {
// Don't show if in headers & footers mode only.
if ( wpcode()->settings->get_option( 'headers_footers_mode' ) ) {
return;
}
// Don't show if other notices were already displayed on the page.
if ( ! empty( wpcode()->notice->notices ) ) {
return;
}
$html = '<h3>' . esc_html__( 'Get WPCode Pro and Unlock all the Powerful Features', 'insert-headers-and-footers' ) . '</h3>';
$html .= '<div class="wpcode-features-list">';
$html .= '<ul>';
$html .= '<li>' . esc_html__( 'Save & Reuse snippets in your private Cloud Library', 'insert-headers-and-footers' ) . '</li>';
$html .= '<li>' . esc_html__( 'Add page-specific scripts when editing a post/page.', 'insert-headers-and-footers' ) . '</li>';
$html .= '<li>' . esc_html__( 'Track all snippet changes with Advanced Code Revisions', 'insert-headers-and-footers' ) . '</li>';
$html .= '</ul>';
$html .= '<ul>';
$html .= '<li>' . esc_html__( 'Load snippets by device (mobile/desktop) with 1-click.', 'insert-headers-and-footers' ) . '</li>';
$html .= '<li>' . esc_html__( 'Easily insert and reuse content with Custom Shortcodes.', 'insert-headers-and-footers' ) . '</li>';
$html .= '<li>' . esc_html__( 'Precisely track eCommerce conversions for WooCommerce and EDD.', 'insert-headers-and-footers' ) . '</li>';
$html .= '</ul>';
$html .= '</div>';
$html .= sprintf(
'<p><a href="%1$s" target="_blank" rel="noopener noreferrer">%2$s</a></p>',
wpcode_utm_url( 'https://wpcode.com/lite/', 'headers-footers', 'notice', 'get-wpcode-pro' ),
esc_html__( 'Get WPCode Pro Today and Unlock all the Powerful Features »', 'insert-headers-and-footers' )
);
$html .= '<p>';
$html .= sprintf(
// Translators: Placeholders make the text bold.
esc_html__( '%1$sBonus:%2$s WPCode Lite users get %3$s$50 off regular price%4$s, automatically applied at checkout', 'insert-headers-and-footers' ),
'<strong>',
'</strong>',
'<strong style="color:#59A56D;">',
'</strong>'
);
$html .= '</p>';
// Add our custom notice for this page.
WPCode_Notice::info(
$html,
array(
'slug' => 'ihaf-snippets',
'dismiss' => WPCode_Notice::DISMISS_USER,
)
);
// Display notice we just added so that scripts are loaded.
wpcode()->notice->display();
}
@@ -0,0 +1,103 @@
<?php
/**
* Class to auto-insert snippets anywhere by a CSS selector.
*
* @package wpcode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WPCode_Auto_Insert_Anywhere.
*/
class WPCode_Auto_Insert_Anywhere_Lite extends WPCode_Auto_Insert_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'anywhere';
/**
* The category of this type.
*
* @var string
*/
public $category = 'global';
/**
* Not available to select.
*
* @var string
*/
public $code_type = 'pro';
/**
* Text to display next to optgroup label.
*
* @var string
*/
public $label_pill = 'PRO';
/**
* Load the available options and labels.
*
* @return void
*/
public function init() {
}
/**
* Load the label.
*
* @return void
*/
public function load_label() {
$this->label = __( 'Anywhere (CSS Selector)', 'insert-headers-and-footers' );
}
/**
* Load the available locations.
*
* @return void
*/
public function load_locations() {
$this->locations = array(
'before_css_selector' => array(
'label' => __( 'Before HTML Element', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the HTML element specified by the CSS selector.', 'insert-headers-and-footers' ),
),
'after_css_selector' => array(
'label' => __( 'After HTML Element', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the HTML element specified by the CSS selector.', 'insert-headers-and-footers' ),
),
'start_css_selector' => array(
'label' => __( 'At the start of HTML Element', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the content of the HTML element specified by CSS selector.', 'insert-headers-and-footers' ),
),
'end_css_selector' => array(
'label' => __( 'At the end of HTML Element', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the content of the HTML element specified by CSS selector.', 'insert-headers-and-footers' ),
),
'replace_css_selector' => array(
'label' => __( 'Replace HTML Element', 'insert-headers-and-footers' ),
'description' => __( 'Completely replace the HTML element specified by the CSS selector with the output of this snippet.', 'insert-headers-and-footers' ),
),
);
}
/**
* Load the upgrade strings.
*
* @return void
*/
public function load_upgrade_strings() {
$this->upgrade_title = __( 'Insert Anywhere by CSS Selector is a Premium feature', 'insert-headers-and-footers' );
$this->upgrade_text = __( 'Upgrade to PRO today and insert snippets anywhere on your site using CSS selectors to target any HTML element.', 'insert-headers-and-footers' );
$this->upgrade_link = wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'auto-insert', 'anywhere' );
}
}
new WPCode_Auto_Insert_Anywhere_Lite();
@@ -0,0 +1,117 @@
<?php
/**
* Class for auto-insert inside content.
*
* @package wpcode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WPCode_Auto_Insert_Single.
*/
class WPCode_Auto_Insert_Content_Lite extends WPCode_Auto_Insert_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'content';
/**
* The category of this type.
*
* @var string
*/
public $category = 'page';
/**
* Not available to select.
*
* @var string
*/
public $code_type = 'pro';
/**
* Text to display next to optgroup label.
*
* @var string
*/
public $label_pill = 'PRO';
/**
* Load the available options and labels.
*
* @return void
*/
public function init() {
}
/**
* Load the label.
*
* @return void
*/
public function load_label() {
$this->label = __( 'Content', 'insert-headers-and-footers' );
}
/**
* Load the available locations.
*
* @return void
*/
public function load_locations() {
$this->locations = array(
'after_words' => array(
'label' => esc_html__( 'Insert After # Words', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after a minimum number of words.', 'insert-headers-and-footers' ),
),
'every_words' => array(
'label' => esc_html__( 'Insert Every # Words', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet every # number of words.', 'insert-headers-and-footers' ),
),
'content_half' => array(
'label' => esc_html__( 'Insert in the Middle of the Content', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet in the middle of the post content.', 'insert-headers-and-footers' ),
),
'content_quarter' => array(
'label' => esc_html__( 'Insert after first Quarter (25%)', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after the first quarter of the post content.', 'insert-headers-and-footers' ),
),
'content_quarter_third' => array(
'label' => esc_html__( 'Insert after 3rd Quarter (75%)', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after the third quarter of the post content.', 'insert-headers-and-footers' ),
),
'content_one_third' => array(
'label' => esc_html__( 'Insert after first Third (33%)', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after the first third of the post content.', 'insert-headers-and-footers' ),
),
'content_two_thirds' => array(
'label' => esc_html__( 'Insert after second Third (66%)', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after the second third of the post content.', 'insert-headers-and-footers' ),
),
'content_80' => array(
'label' => esc_html__( 'Insert after 80%', 'insert-headers-and-footers' ),
'description' => esc_html__( 'Insert snippet after 80% of the post content.', 'insert-headers-and-footers' ),
),
);
}
/**
* Load the upgrade strings.
*
* @return void
*/
public function load_upgrade_strings() {
$this->upgrade_title = __( 'Word-based content locations are a PRO feature', 'insert-headers-and-footers' );
$this->upgrade_text = __( 'Upgrade to PRO today and get access to automatic word-count based insert locations.', 'insert-headers-and-footers' );
$this->upgrade_link = wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'auto-insert', 'content' );
}
}
new WPCode_Auto_Insert_Content_Lite();
@@ -0,0 +1,123 @@
<?php
/**
* Easy Digital Downloads specific auto-insert locations.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WPCode_Auto_Insert_EDD.
*/
class WPCode_Auto_Insert_EDD_Lite extends WPCode_Auto_Insert_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'edd';
/**
* The category of this type.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Not available to select.
*
* @var string
*/
public $code_type = 'pro';
/**
* Text to display next to optgroup label.
*
* @var string
*/
public $label_pill = 'PRO';
/**
* Load the available options and labels.
*
* @return void
*/
public function init() {
}
/**
* Load the label.
*
* @return void
*/
public function load_label() {
$this->label = 'Easy Digital Downloads';
}
/**
* Load the available locations.
*
* @return void
*/
public function load_locations() {
$this->locations = array(
'edd_purchase_link_top' => array(
'label' => __( 'Before the Purchase Button', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the EDD purchase button.', 'insert-headers-and-footers' ),
),
'edd_purchase_link_end' => array(
'label' => __( 'After the Purchase Button', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the EDD purchase button.', 'insert-headers-and-footers' ),
),
'edd_before_download_content' => array(
'label' => __( 'Before the Single Download', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the single EDD download content.', 'insert-headers-and-footers' ),
),
'edd_after_download_content' => array(
'label' => __( 'After the Single Download', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the single EDD download content.', 'insert-headers-and-footers' ),
),
'edd_before_cart' => array(
'label' => __( 'Before the Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the EDD cart.', 'insert-headers-and-footers' ),
),
'edd_after_cart' => array(
'label' => __( 'After the Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the EDD cart.', 'insert-headers-and-footers' ),
),
'edd_before_checkout_cart' => array(
'label' => __( 'Before the Checkout Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the EDD cart on the checkout page.', 'insert-headers-and-footers' ),
),
'edd_after_checkout_cart' => array(
'label' => __( 'After the Checkout Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the EDD cart on the checkout page.', 'insert-headers-and-footers' ),
),
'edd_before_purchase_form' => array(
'label' => __( 'Before the Checkout Form', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the EDD checkout form on the checkout page.', 'insert-headers-and-footers' ),
),
'edd_after_purchase_form' => array(
'label' => __( 'After the Checkout Form', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the EDD checkout form on the checkout page', 'insert-headers-and-footers' ),
),
);
}
/**
* Load the upgrade strings.
*
* @return void
*/
public function load_upgrade_strings() {
$this->upgrade_title = __( 'Easy Digital Downloads Locations are a PRO feature', 'insert-headers-and-footers' );
$this->upgrade_text = __( 'Upgrade to PRO today and get access to advanced eCommerce auto-insert locations and conditional logic rules for your needs.', 'insert-headers-and-footers' );
$this->upgrade_link = wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'auto-insert', 'edd' );
}
}
new WPCode_Auto_Insert_EDD_Lite();
@@ -0,0 +1,115 @@
<?php
/**
* MemberPress-specific auto-insert locations.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WPCode_Auto_Insert_MemberPress_Lite.
*/
class WPCode_Auto_Insert_MemberPress_Lite extends WPCode_Auto_Insert_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'memberpress';
/**
* The category of this type.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Not available to select.
*
* @var string
*/
public $code_type = 'pro';
/**
* Text to display next to optgroup label.
*
* @var string
*/
public $label_pill = 'PRO';
/**
* Load the available options and labels.
*
* @return void
*/
public function init() {
}
/**
* Load the label.
*
* @return void
*/
public function load_label() {
$this->label = 'MemberPress';
}
/**
* Load the available locations.
*
* @return void
*/
public function load_locations() {
$this->locations = array(
'mepr-above-checkout-form' => array(
'label' => __( 'Before the Registration Form', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the MemberPress registration form used for checkout.', 'insert-headers-and-footers' ),
),
'mepr-checkout-before-submit' => array(
'label' => __( 'Before Checkout Submit Button', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet right before the MemberPress checkout submit button.', 'insert-headers-and-footers' ),
),
'mepr-checkout-before-coupon-field' => array(
'label' => __( 'Before Checkout Coupon Field', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the MemberPress checkout coupon field.', 'insert-headers-and-footers' ),
),
'mepr-account-home-before-name' => array(
'label' => __( 'Before Account First Name', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet to the Home tab of the MemberPress Account page before First Name field.', 'insert-headers-and-footers' ),
),
'mepr_before_account_subscriptions' => array(
'label' => __( 'Before Subscriptions Content', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet at the beginning of the Subscriptions tab on the MemberPress Account page.', 'insert-headers-and-footers' ),
),
'mepr-login-form-before-submit' => array(
'label' => __( 'Before Login Form Submit', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the Remember Me checkbox on the MemberPress Login page.', 'insert-headers-and-footers' ),
),
'mepr_unauthorized_message_before' => array(
'label' => __( 'Before the Unauthorized Message', 'insert-headers-and-footers' ),
'description' => __( 'Insert a snippet before the notice that access to the content is unauthorized. ', 'insert-headers-and-footers' ),
),
'mepr_unauthorized_message_after' => array(
'label' => __( 'After the Unauthorized Message', 'insert-headers-and-footers' ),
'description' => __( 'Insert a snippet after the notice that access to the content is unauthorized. ', 'insert-headers-and-footers' ),
),
);
}
/**
* Load the upgrade strings.
*
* @return void
*/
public function load_upgrade_strings() {
$this->upgrade_title = __( 'MemberPress Locations are a PRO feature', 'insert-headers-and-footers' );
$this->upgrade_text = __( 'Upgrade to PRO today and get access to advanced eCommerce auto-insert locations and conditional logic rules for your needs.', 'insert-headers-and-footers' );
$this->upgrade_link = wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'auto-insert', 'memberpress' );
}
}
new WPCode_Auto_Insert_MemberPress_Lite();
@@ -0,0 +1,136 @@
<?php
/**
* WooCommerce-specific auto-insert locations.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class WPCode_Auto_Insert_WooCommerce_Lite.
*/
class WPCode_Auto_Insert_WooCommerce_Lite extends WPCode_Auto_Insert_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'woocommerce';
/**
* The category of this type.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Not available to select.
*
* @var string
*/
public $code_type = 'pro';
/**
* Text to display next to optgroup label.
*
* @var string
*/
public $label_pill = 'PRO';
/**
* Load the available options and labels.
*
* @return void
*/
public function init() {
}
/**
* Load the label.
*
* @return void
*/
public function load_label() {
$this->label = 'WooCommerce';
}
/**
* Load the available locations.
*
* @return void
*/
public function load_locations() {
$this->locations = array(
'wc_before_products_list' => array(
'label' => __( 'Before the List of Products', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the list of products on a WooCommerce page.', 'insert-headers-and-footers' ),
),
'wc_after_products_list' => array(
'label' => __( 'After the List of Products', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the list of products on a WooCommerce page.', 'insert-headers-and-footers' ),
),
'wc_before_single_product' => array(
'label' => __( 'Before the Single Product', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the content on the single WooCommerce product page.', 'insert-headers-and-footers' ),
),
'wc_after_single_product' => array(
'label' => __( 'After the Single Product', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the content on the single WooCommerce product page.', 'insert-headers-and-footers' ),
),
'wc_before_single_product_summary' => array(
'label' => __( 'Before the Single Product Summary', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the product summary on the single WooCommerce product page.', 'insert-headers-and-footers' ),
),
'wc_after_single_product_summary' => array(
'label' => __( 'After the Single Product Summary', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the product summary on the single WooCommerce product page.', 'insert-headers-and-footers' ),
),
'woocommerce_before_cart' => array(
'label' => __( 'Before the Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the cart on WooCommerce pages.', 'insert-headers-and-footers' ),
),
'woocommerce_after_cart' => array(
'label' => __( 'After the Cart', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the cart on WooCommerce pages.', 'insert-headers-and-footers' ),
),
'woocommerce_before_checkout_form' => array(
'label' => __( 'Before the Checkout Form', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the checkout form on the WooCommerce checkout page.', 'insert-headers-and-footers' ),
),
'woocommerce_after_checkout_form' => array(
'label' => __( 'After the Checkout Form', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the checkout form on the WooCommerce checkout page.', 'insert-headers-and-footers' ),
),
'woocommerce_checkout_order_review_19' => array(
'label' => __( 'Before Checkout Payment Button', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the checkout payment button on the WooCommerce checkout page.', 'insert-headers-and-footers' ),
),
'woocommerce_checkout_order_review_21' => array(
'label' => __( 'After Checkout Payment Button', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet after the checkout payment button on the WooCommerce checkout page.', 'insert-headers-and-footers' ),
),
'woocommerce_before_thankyou' => array(
'label' => __( 'Before the Thank You Page', 'insert-headers-and-footers' ),
'description' => __( 'Insert snippet before the thank you page content for WooCommerce.', 'insert-headers-and-footers' ),
),
);
}
/**
* Load the upgrade strings.
*
* @return void
*/
public function load_upgrade_strings() {
$this->upgrade_title = __( 'WooCommerce Locations are a PRO feature', 'insert-headers-and-footers' );
$this->upgrade_text = __( 'Upgrade to PRO today and get access to advanced eCommerce auto-insert locations and conditional logic rules for your needs.', 'insert-headers-and-footers' );
$this->upgrade_link = wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'auto-insert', 'woocommerce' );
}
}
new WPCode_Auto_Insert_WooCommerce_Lite();
@@ -0,0 +1,100 @@
<?php
/**
* WPCode_Admin_Bar_Info_Lite class.
*
* @package WPCode
*/
/**
* Class WPCode_Admin_Bar_Info_Lite.
*
* @extends WPCode_Admin_Bar_Info
*/
class WPCode_Admin_Bar_Info_Lite extends WPCode_Admin_Bar_Info {
/**
* Add the WPCode info to the admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
*/
public function add_admin_bar_info( $wp_admin_bar ) {
parent::add_admin_bar_info( $wp_admin_bar );
// Only show this on pages where the page scripts is an option.
if ( is_singular() ) {
$wp_admin_bar->add_menu(
array(
'id' => 'wpcode-page-scripts',
'parent' => 'wpcode-admin-bar-info',
'title' => esc_html__( 'Page Scripts', 'insert-headers-and-footers' ) . $this->get_pro_indicator(),
'meta' => array(
'class' => 'wpcode-admin-bar-has-upsell-submenu',
),
)
);
$wp_admin_bar->add_menu(
array(
'id' => 'wpcode-page-scripts-upgrade',
'parent' => 'wpcode-page-scripts',
'meta' => array(
'class' => 'wpcode-admin-bar-upsell-submenu',
'html' => $this->get_upsell_markup(),
),
)
);
}
}
/**
* Get the pro indicator.
*
* @return string
*/
public function get_pro_indicator() {
return ' <span class="wpcode-pro-indicator">PRO</span>';
}
/**
* Add upgrade link to the admin bar.
*
* @param WP_Admin_Bar $wp_admin_bar The admin bar instance.
*
* @return void
*/
public function add_admin_bar_quick_links( $wp_admin_bar ) {
parent::add_admin_bar_quick_links( $wp_admin_bar );
$wp_admin_bar->add_menu(
array(
'id' => 'wpcode-upgrade',
'parent' => 'wpcode-admin-bar-info',
'title' => esc_html__( 'Upgrade to Pro', 'insert-headers-and-footers' ),
'meta' => array(
'class' => 'wpcode-admin-bar-info-submenu',
'target' => '_blank',
'rel' => 'noopener noreferrer',
),
'href' => wpcode_utm_url( 'https://wpcode.com/lite/', 'admin-bar', 'upgrade-to-pro' ),
)
);
}
/**
* Get the upsell markup.
*
* @return string
*/
public function get_upsell_markup() {
$html = '<div class="wpcode-admin-bar-submenu-upsell">';
$html .= '<span class="wpcode-heading">' . esc_html__( 'Page Scripts is a Pro Feature', 'insert-headers-and-footers' ) . '</span>';
$html .= '<p>' . esc_html__( 'While you can always use global snippets, in the PRO version you can easily add page-specific scripts and snippets directly from the post edit screen.', 'insert-headers-and-footers' ) . '</p>';
$html .= '<a class="wpcode-button" href="' . esc_url( wpcode_utm_url( 'https://wpcode.com/lite/', 'admin-bar', 'page-scripts' ) ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Upgrade to Pro and Unlock Page Scripts', 'insert-headers-and-footers' ) . '</a>';
$html .= '</div>';
return $html;
}
}
@@ -0,0 +1,40 @@
<?php
/**
* Smart tags class for the lite version.
*
* @package WPCode
*/
/**
* WPCode_Smart_Tags_Lite class.
*/
class WPCode_Smart_Tags_Lite extends WPCode_Smart_Tags {
/**
* UTM medium parameter.
*
* @var string
*/
public $utm_medium = 'snippet-manager';
/**
* UTM content parameter.
*
* @var string
*/
public $utm_content = 'upgrade-cta';
/**
* Upgrade notice data.
*
* @return array
*/
public function upgrade_notice_data() {
return array(
'title' => __( 'Smart Tags are a Premium feature', 'insert-headers-and-footers' ),
'text' => __( 'Upgrade to PRO today and simplify the way you write advanced snippets using smart tags without having to write any PHP code.', 'insert-headers-and-footers' ),
'button' => __( 'Upgrade to PRO', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', $this->utm_medium, 'smart-tags', $this->utm_content ),
);
}
}
@@ -0,0 +1,113 @@
<?php
/**
* Placeholder Class that handles conditional logic for device type
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_Device_Lite class.
*/
class WPCode_Conditional_Device_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'device';
/**
* The type category.
*
* @var string
*/
public $category = 'who';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = __( 'Device', 'insert-headers-and-footers' ) . ' (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'device_type' => array(
'label' => __( 'Device Type', 'insert-headers-and-footers' ),
'description' => __( 'Target either desktop or mobile devices.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'Device Type Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced device type conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'device-type' ),
),
'options' => array(
array(
'label' => __( 'Desktop', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Mobile', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
),
),
'browser' => array(
'label' => __( 'Browser Type', 'insert-headers-and-footers' ),
'description' => __( 'Target specific visitor web browsers.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'Browser Type Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced device conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'browser' ),
),
),
'os' => array(
'label' => __( 'Operating System', 'insert-headers-and-footers' ),
'description' => __( 'Target operating systems like Windows, Mac OS or Linux.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'Operating System Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced operating system conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'os' ),
),
),
'cookie_name' => array(
'label' => __( 'Cookie Name', 'insert-headers-and-footers' ),
'description' => __( 'Load or hide a snippet by cookie name.', 'insert-headers-and-footers' ),
'type' => 'text',
'upgrade' => array(
'title' => __( 'Cookie-based Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced cookie conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'cookie-name' ),
),
),
'cookie_value' => array(
'label' => __( 'Cookie Value', 'insert-headers-and-footers' ),
'description' => __( 'Load or hide a snippet by cookie value.', 'insert-headers-and-footers' ),
'type' => 'text',
'upgrade' => array(
'title' => __( 'Cookie-based Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced cookie conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'cookie-value' ),
),
),
);
}
}
new WPCode_Conditional_Device_Lite();
@@ -0,0 +1,88 @@
<?php
/**
* Class that handles conditional logic related to Easy Digital Downloads.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_EDD class.
*/
class WPCode_Conditional_EDD_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'edd';
/**
* The type category.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = 'Easy Digital Downloads (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'edd_page' => array(
'label' => __( 'EDD Page', 'insert-headers-and-footers' ),
'description' => __( 'Load the snippet on specific Easy Digital Downloads pages.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'Easy Digital Downloads Page Rules is a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced conditional logic rules for Easy Digital Downloads by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'edd-page' ),
),
'options' => array(
array(
'label' => __( 'Checkout Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Confirmation Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Single Download Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Download Category Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Download Tag Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
),
),
);
}
}
new WPCode_Conditional_EDD_Lite();
@@ -0,0 +1,74 @@
<?php
/**
* Placeholder class that handles conditional logic based on location.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_Location class.
*/
class WPCode_Conditional_Location_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'location';
/**
* The type category.
*
* @var string
*/
public $category = 'who';
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'country' => array(
'label' => __( 'Country', 'insert-headers-and-footers' ),
'description' => __( 'Limit loading the snippet based on the visitor\'s country.', 'insert-headers-and-footers' ),
'type' => 'select',
'options' => array(),
'upgrade' => array(
'title' => __( 'Location Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to location-based conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'location-country' ),
),
),
'continent' => array(
'label' => __( 'Continent', 'insert-headers-and-footers' ),
'description' => __( 'Target entire continents with ease.', 'insert-headers-and-footers' ),
'type' => 'select',
'options' => array(),
'upgrade' => array(
'title' => __( 'Location Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to location-based conditional logic rules by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'location-continent' ),
),
),
);
}
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = __( 'Location', 'insert-headers-and-footers' ) . ' (PRO)';
}
}
new WPCode_Conditional_Location_Lite();
@@ -0,0 +1,91 @@
<?php
/**
* Class that handles conditional logic related to MemberPress.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_MemberPress class.
*/
class WPCode_Conditional_MemberPress_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'memberpress';
/**
* The type category.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = 'MemberPress (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'memberpress_page' => array(
'label' => __( 'MemberPress Page', 'insert-headers-and-footers' ),
'description' => __( 'Load the snippet on specific MemberPress pages.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'MemberPress Page Rules is a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced conditional logic rules for MemberPress by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'memberpress-page' ),
),
'options' => array(
array(
'label' => __( 'Registration Page', 'insert-headers-and-footers' ),
'value' => 'registration',
),
array(
'label' => __( 'Thank You Page', 'insert-headers-and-footers' ),
'value' => 'thankyou',
),
array(
'label' => __( 'Account Page', 'insert-headers-and-footers' ),
'value' => 'account',
),
array(
'label' => __( 'Login Page', 'insert-headers-and-footers' ),
'value' => 'login',
),
),
),
'memberpress_user' => array(
'label' => __( 'User active membership', 'insert-headers-and-footers' ),
'description' => __( 'Check if the current user has a specific MemberPress subscription active.', 'insert-headers-and-footers' ),
'type' => 'select',
'options' => array(),
'upgrade' => array(
'title' => __( 'MemberPress Active Membership Rules is a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced conditional logic rules for MemberPress by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'memberpress-user' ),
),
),
);
}
}
new WPCode_Conditional_MemberPress_Lite();
@@ -0,0 +1,80 @@
<?php
/**
* Class that handles conditional logic for scheduling snippets.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_Schedule_Lite class.
*/
class WPCode_Conditional_Schedule_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'schedule';
/**
* The type category.
*
* @var string
*/
public $category = 'advanced';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = __( 'Schedule', 'insert-headers-and-footers' ) . ' (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'date_is' => array(
'label' => __( 'Date', 'insert-headers-and-footers' ),
'description' => __( 'Check whether today is before or after a date.', 'insert-headers-and-footers' ),
'type' => 'date',
),
'time_is' => array(
'label' => __( 'Date & Time', 'insert-headers-and-footers' ),
'description' => __( 'Get more specific by also including a specific time.', 'insert-headers-and-footers' ),
'type' => 'datetime',
),
'weekday' => array(
'label' => __( 'Day of the Week', 'insert-headers-and-footers' ),
'description' => __( 'Load the snippet on specific days of the week.', 'insert-headers-and-footers' ),
'type' => 'select',
'multiple' => true,
),
'time' => array(
'label' => __( 'Current time', 'insert-headers-and-footers' ),
'description' => __( 'Check whether it\'s before or after a specific time', 'insert-headers-and-footers' ),
'type' => 'time',
),
);
foreach ( $this->options as $key => $value ) {
$this->options[ $key ]['upgrade'] = array(
'title' => __( 'Scheduling rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Upgrade today and get access to advanced scheduling conditional logic rules.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'schedule' ),
);
}
}
}
new WPCode_Conditional_Schedule_Lite();
@@ -0,0 +1,63 @@
<?php
/**
* Class that handles conditional logic for snippets type
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_Snippet class.
*/
class WPCode_Conditional_Snippet_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'snippet';
/**
* The type category.
*
* @var string
*/
public $category = 'advanced';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = __( 'Snippet', 'insert-headers-and-footers' ) . ' (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'snippet_loaded' => array(
'label' => __( 'WPCode Snippet', 'insert-headers-and-footers' ),
'description' => __( 'Load this snippet based on another snippet being loaded.', 'insert-headers-and-footers' ),
'type' => 'select',
'options' => array(),
'upgrade' => array(
'title' => __( 'WPCode Snippet Loaded Rules are a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Upgrade today and use conditional logic rules based on other WPCode snippets being loaded.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'snippet' ),
),
),
);
}
}
new WPCode_Conditional_Snippet_Lite();
@@ -0,0 +1,114 @@
<?php
/**
* Class that handles conditional logic related to WooCommerce.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The WPCode_Conditional_WooCommerce class.
*/
class WPCode_Conditional_WooCommerce_Lite extends WPCode_Conditional_Type {
/**
* The type unique name (slug).
*
* @var string
*/
public $name = 'woocommerce';
/**
* The type category.
*
* @var string
*/
public $category = 'ecommerce';
/**
* Set the translatable label.
*
* @return void
*/
protected function set_label() {
$this->label = 'WooCommerce (PRO)';
}
/**
* Set the type options for the admin mainly.
*
* @return void
*/
public function load_type_options() {
$this->options = array(
'wc_page' => array(
'label' => __( 'WooCommerce Page', 'insert-headers-and-footers' ),
'description' => __( 'Load the snippet on specific WooCommerce pages.', 'insert-headers-and-footers' ),
'type' => 'select',
'upgrade' => array(
'title' => __( 'WooCommerce Page Rules is a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced conditional logic rules for WooCommerce by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'woocommerce-page' ),
),
'options' => array(
array(
'label' => __( 'Checkout Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Thank You Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Cart Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Single Product Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Shop Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Product Category Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'Product Tag Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
array(
'label' => __( 'My Account Page', 'insert-headers-and-footers' ),
'value' => '',
'disabled' => true,
),
),
),
'wc_cart' => array(
'label' => __( 'WooCommerce Cart', 'insert-headers-and-footers' ),
'description' => __( 'Load the snippet based on the WooCommerce Cart Contents.', 'insert-headers-and-footers' ),
'type' => 'select',
'options' => array(),
'upgrade' => array(
'title' => __( 'WooCommerce Cart Contents Rule is a Pro Feature', 'insert-headers-and-footers' ),
'text' => __( 'Get access to advanced conditional logic rules for WooCommerce by upgrading to PRO today.', 'insert-headers-and-footers' ),
'link' => wpcode_utm_url( 'https://wpcode.com/lite/', 'edit-snippet', 'conditional-logic', 'woocommerce-cart' ),
),
),
);
}
}
new WPCode_Conditional_WooCommerce_Lite();
@@ -0,0 +1,69 @@
<?php
/**
* File used for importing lite-only files.
*
* @package WPCode
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( is_admin() || defined( 'DOING_CRON' ) && DOING_CRON ) {
// Revisions display trait lite.
require_once WPCODE_PLUGIN_PATH . 'includes/admin/pages/trait-wpcode-revisions-display.php';
// Class used for loading the scripts metabox.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/class-wpcode-metabox-snippets-lite.php';
// Load lite-specific scripts.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/admin-scripts.php';
// Load lite notices.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/notices.php';
// Lite-specific admin page loader.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/class-wpcode-admin-page-loader-lite.php';
// Connect to upgrade.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/class-wpcode-connect.php';
// Usage tracking abstract.
require_once WPCODE_PLUGIN_PATH . 'includes/admin/class-wpcode-usage-tracking.php';
// Usage tracking lite.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/admin/class-wpcode-usage-tracking-lite.php';
// Load smart tags class.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/class-wpcode-smart-tags-lite.php';
}
// Load the admin bar info.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/class-wpcode-admin-bar-info-lite.php';
add_action( 'plugins_loaded', 'wpcode_plugins_loaded_load_lite_files', 2 );
/**
* Require files on plugins_loaded.
*
* @return void
*/
function wpcode_plugins_loaded_load_lite_files() {
// Make sure this is loaded in older versions of WP.
require_once WPCODE_PLUGIN_PATH . 'includes/auto-insert/class-wpcode-auto-insert-type.php';
// Load WooCommerce auto-insert locations.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/auto-insert/class-wpcode-auto-insert-woocommerce.php';
// Load EDD auto-insert locations.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/auto-insert/class-wpcode-auto-insert-edd.php';
// Load MemberPress auto-insert locations.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/auto-insert/class-wpcode-auto-insert-memberpress.php';
// Load the insert-anywhere class.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/auto-insert/class-wpcode-auto-insert-anywhere.php';
// Load the content class.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/auto-insert/class-wpcode-auto-insert-content.php';
// Load Device type conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-device.php';
// Load Location conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-location.php';
// Load WooCommerce conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-woocommerce.php';
// Load EDD conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-edd.php';
// Load MemberPress conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-memberpress.php';
// Load Snippet conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-snippet.php';
// Load Schedule conditional logic.
require_once WPCODE_PLUGIN_PATH . 'includes/lite/conditional-logic/class-wpcode-conditional-schedule.php';
}