Esempio n. 1
0
/**
 * Hooks the licensing system into WordPress.
 */
function wprss_licensing()
{
    static $licensing = null;
    if (is_null($licensing)) {
        // Get licensing class instances
        $manager = wprss_licensing_get_manager();
        $settingsController = wprss_licensing_get_settings_controller();
        $ajaxController = wprss_licensing_get_ajax_controller();
        // Set up Ajax Controller pointers
        $ajaxController->setManager($manager);
        $ajaxController->setSettingsController($settingsController);
        // Licensing Ajax Controller hooks
        add_action('wp_ajax_wprss_ajax_manage_license', array($ajaxController, 'handleAjaxManageLicense'));
        add_action('wp_ajax_wprss_ajax_fetch_license', array($ajaxController, 'handleAjaxFetchLicense'));
        // Licensing Settings Controller hooks
        add_action('wprss_admin_init', array($settingsController, 'registerSettings'), 100);
        add_action('admin_init', array($settingsController, 'handleLicenseStatusChange'), 10);
        add_action('wprss_settings_license_key_is_valid', array($settingsController, 'validateLicenseKeyForSave'));
        $licensing = (object) compact('manager', 'settingsController', 'ajaxController');
        // Action for hooking after licensing has been initialized
        do_action('wprss_init_licensing');
        // Backwards compatibility with old licensing lib
        // This ensures that, if an addon is loading an older version of the licensing library, the old method for initializing the updaters is called.
        if (method_exists($manager, 'initUpdaterInstances')) {
            add_action('admin_init', array($manager, 'initUpdaterInstances'));
        }
    }
    return $licensing;
}
Esempio n. 2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     $this->_setManager(wprss_licensing_get_manager());
     // Only load notices if on admin side
     if (is_main_site() && is_admin()) {
         $this->_initNotices();
     }
 }
/**
 * Hooks the licensing system into WordPress.
 */
function wprss_init_licensing()
{
    // Get licensing class instances
    $manager = wprss_licensing_get_manager();
    $settingsController = wprss_licensing_get_settings_controller();
    $ajaxController = wprss_licensing_get_ajax_controller();
    // Set up Ajax Controller pointers
    $ajaxController->setManager($manager);
    $ajaxController->setSettingsController($settingsController);
    // Licensing Manager hooks
    add_action('admin_init', array($manager, 'initUpdaterInstances'));
    // Licensing Ajax Controller hooks
    add_action('wp_ajax_wprss_ajax_manage_license', array($ajaxController, 'handleAjaxManageLicense'));
    add_action('wp_ajax_wprss_ajax_fetch_license', array($ajaxController, 'handleAjaxFetchLicense'));
    // Licensing Settings Controller hooks
    add_action('wprss_admin_init', array($settingsController, 'registerSettings'), 100);
    add_action('admin_init', array($settingsController, 'handleLicenseStatusChange'), 10);
    add_action('wprss_settings_license_key_is_valid', array($settingsController, 'validateLicenseKeyForSave'));
}
/**
 * Print the premium help section with inline support form.
 *
 * @since 4.7
 */
function wprss_premium_help_display()
{
    // Get the first valid license.
    $addon = '';
    $statuses = get_option('wprss_settings_license_statuses', array());
    foreach ($statuses as $key => $value) {
        // If we're looking at a license status key...
        if (strpos($key, '_license_status') !== FALSE) {
            // ...and the license is valid...
            if ($value === 'valid') {
                $addon = substr($key, 0, strpos($key, '_license_status'));
                break;
            }
        }
    }
    // If we didn't find an add-on with a valid license, show the free help text.
    if ($addon === '') {
        wprss_free_help_display();
        return;
    }
    // Get the full license info so we can prefill the name and email
    $license = wprss_licensing_get_manager()->checkLicense($addon, 'ALL');
    $customer_name = is_object($license) ? $license->customer_name : '';
    $customer_email = is_object($license) ? $license->customer_email : '';
    echo '<h3>' . __('Email Support', WPRSS_TEXT_DOMAIN) . '</h3>';
    echo wpautop(__("If you still can't find an answer to your query after reading the documentation and going through the FAQ, just fill out the support request form below. We'll be happy to help you out.", WPRSS_TEXT_DOMAIN));
    ?>

		<form method="post">
			<table>
				<tr>
					<td><strong><?php 
    _e('From: ', WPRSS_TEXT_DOMAIN);
    ?>
</strong></td>
					<td><input type='text' name='support-name' value="<?php 
    echo esc_attr($customer_name);
    ?>
" placeholder='<?php 
    echo esc_attr('Name', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
					<td><input type='text' name='support-email' value="<?php 
    echo esc_attr($customer_email);
    ?>
" placeholder='<?php 
    echo esc_attr('Email', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
				</tr>
				<tr>
					<td colspan="3" style="text-align:right;"><small><?php 
    _e('Replies will be sent to this email address.');
    ?>
</small></td>
				</tr>
				<tr>
					<td colspan="3"><input type='text' name='support-subject' placeholder='<?php 
    echo esc_attr('Subject', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
				</tr>
				<tr>
					<td colspan="3"><textarea name='support-message' rows='10' cols='80' placeholder='<?php 
    echo esc_attr('Message', WPRSS_TEXT_DOMAIN);
    ?>
'></textarea></td>
				</tr>
				<tr>
					<td colspan="3"><strong><?php 
    _e('Attachments', WPRSS_TEXT_DOMAIN);
    ?>
: </strong></td>
				</tr>
				<tr>
					<td colspan="3"><input type='checkbox' name='support-include-log' value='checked' checked><?php 
    _e('WP RSS Aggregator log file', WPRSS_TEXT_DOMAIN);
    ?>
</td>
				</tr>
				<tr>
					<td colspan="3"><input type='checkbox' name='support-include-sys' value='checked' checked><?php 
    _e('WordPress debugging information', WPRSS_TEXT_DOMAIN);
    ?>
</td>
				</tr>
			</table>
		</form>
		<div style='line-height:2.3em; margin-top:10px;'>
			<button id='send-message-btn' class='button button-primary'><?php 
    _e('Send Message', WPRSS_TEXT_DOMAIN);
    ?>
</button>
			<span id='support-error'></span>
		</div>

		<?php 
}
Esempio n. 5
0
/**
 * Print the premium help section with inline support form.
 *
 * @since 4.7
 */
function wprss_premium_help_display()
{
    // Addon and license object, both detected in the below algorithm that searches for a
    // premium addon that is activated with a valid license
    $addon = null;
    $license = null;
    // Get license statuses option
    $statuses = get_option('wprss_settings_license_statuses', array());
    // Iterate all statuses
    foreach ($statuses as $_key => $_value) {
        // If not a license status key, continue to next
        $_keyPos = strpos($_key, '_license_status');
        if ($_keyPos === FALSE) {
            continue;
        }
        // If the status is not valid, contine to next
        if ($_value !== 'valid') {
            continue;
        }
        // Get the addon ID
        $_addonId = substr($_key, 0, $_keyPos);
        // Get the license
        $_license = wprss_licensing_get_manager()->checkLicense($_addonId, 'ALL');
        // If the license is not null
        if ($_license !== null) {
            // Save its details
            $addon = $_addonId;
            $license = $_license;
            // And stop iterating
            break;
        }
    }
    // If we didn't find an add-on with a valid license, show the free help text.
    if ($addon === null || $license === null) {
        wprss_free_help_display();
        return;
    }
    // Get the full license info so we can prefill the name and email
    $customer_name = is_object($license) ? $license->customer_name : '';
    $customer_email = is_object($license) ? $license->customer_email : '';
    echo '<h3>' . __('Email Support', WPRSS_TEXT_DOMAIN) . '</h3>';
    echo wpautop(__("If you still can't find an answer to your query after reading the documentation and going through the FAQ, just fill out the support request form below. We'll be happy to help you out.", WPRSS_TEXT_DOMAIN));
    ?>

		<form method="post">
			<table>
				<tr>
					<td><strong><?php 
    _e('From: ', WPRSS_TEXT_DOMAIN);
    ?>
</strong></td>
					<td><input type='text' name='support-name' value="<?php 
    echo esc_attr($customer_name);
    ?>
" placeholder='<?php 
    echo esc_attr('Name', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
					<td><input type='text' name='support-email' value="<?php 
    echo esc_attr($customer_email);
    ?>
" placeholder='<?php 
    echo esc_attr('Email', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
				</tr>
				<tr>
					<td colspan="3" style="text-align:right;"><small><?php 
    _e('Replies will be sent to this email address.');
    ?>
</small></td>
				</tr>
				<tr>
					<td colspan="3"><input type='text' name='support-subject' placeholder='<?php 
    echo esc_attr('Subject', WPRSS_TEXT_DOMAIN);
    ?>
' style='width:100%;'></td>
				</tr>
				<tr>
					<td colspan="3"><textarea name='support-message' rows='10' cols='80' placeholder='<?php 
    echo esc_attr('Message', WPRSS_TEXT_DOMAIN);
    ?>
'></textarea></td>
				</tr>
				<tr>
					<td colspan="3"><strong><?php 
    _e('Attachments', WPRSS_TEXT_DOMAIN);
    ?>
: </strong></td>
				</tr>
				<tr>
					<td colspan="3"><input type='checkbox' name='support-include-log' value='checked' checked><?php 
    _e('WP RSS Aggregator log file', WPRSS_TEXT_DOMAIN);
    ?>
</td>
				</tr>
				<tr>
					<td colspan="3"><input type='checkbox' name='support-include-sys' value='checked' checked><?php 
    _e('WordPress debugging information', WPRSS_TEXT_DOMAIN);
    ?>
</td>
				</tr>
			</table>
		</form>
		<div style='line-height:2.3em; margin-top:10px;'>
			<button id='send-message-btn' class='button button-primary'><?php 
    _e('Send Message', WPRSS_TEXT_DOMAIN);
    ?>
</button>
			<span id='support-error'></span>
		</div>

		<?php 
}