protected function finalSuccess()
 {
     parent::finalSuccess();
     $this->updateRublonSettings();
     $updateMessage = 'PLUGIN_REGISTERED';
     RublonHelper::setMessage($updateMessage, 'updated', 'CR');
     RublonCookies::setAuthCookie();
     $pluginMeta = RublonHelper::preparePluginMeta();
     $pluginMeta['action'] = 'activation';
     RublonHelper::pluginHistoryRequest($pluginMeta);
     $other_settings = RublonHelper::getSettings('other');
     if (!empty($other_settings['newsletter_signup'])) {
         foreach ($other_settings['newsletter_signup'] as $email) {
             $rublon_req = new RublonRequests();
             $rublon_req->subscribeToNewsletter($email);
         }
         unset($other_settings['newsletter_signup']);
         RublonHelper::saveSettings($other_settings, 'other');
     }
     // Save project owner information
     RublonHelper::saveProjectOwner();
     // Clear features cache if it is not a Business Editions
     RublonFeature::getFeatures(false);
     if (!RublonFeature::isBusinessEdition()) {
         RublonFeature::deleteFeaturesFromCache();
     }
     $this->_redirect(admin_url(RublonHelper::WP_RUBLON_PAGE));
 }
예제 #2
0
 function pluginsLoaded()
 {
     // Append confirmation script only when Business Edition is enabled and operationconfirmation feature is active
     if (RublonFeature::isBusinessEdition() && RublonFeature::checkFeature(RublonAPIGetAvailableFeatures::FEATURE_OPERATION_CONFIRMATION)) {
         add_action('admin_head', array($this, 'appendScript'));
         add_action('admin_init', array($this, 'checkForAction'));
     }
 }
예제 #3
0
function rublon2factor_user_new_form()
{
    $roles = get_editable_roles();
    $roles_js = array();
    $roles_js['protection_levels'] = array();
    foreach ($roles as $role_name => $role) {
        $role_id = RublonHelper::prepareRoleId(esc_attr($role_name));
        $settings = RublonHelper::getSettings('additional');
        $role_protection_type = !empty($settings[$role_id]) ? $settings[$role_id] : '';
        switch ($role_protection_type) {
            case RublonHelper::PROTECTION_TYPE_MOBILE:
                $role_protection_level = 2;
                break;
            case RublonHelper::PROTECTION_TYPE_EMAIL:
                $role_protection_level = 1;
                break;
            default:
                $role_protection_level = 0;
        }
        $roles_js['protectionLevels'][esc_attr($role_name)] = $role_protection_level;
    }
    echo '<label class="hidden rublon-label rublon-label-newuserrole" for="rublon-newuserrole-dropdown">';
    echo '	<div class="rublon-lock-container rublon-locked-container rublon-newuserrole-locked"><img class="rublon-lock rublon-locked" src="' . RUBLON2FACTOR_PLUGIN_URL . '/assets/images/locked.png" /></div>';
    echo '</label>';
    if (RublonFeature::isBusinessEdition()) {
        echo '<div class="hidden rublon-secured-role-description"><span class="description">' . sprintf(__('The new user account will be automatically protected by <a href="%s" target="_blank">Rublon</a>.', 'rublon'), RublonHelper::rubloncomUrl()) . '</span></div>';
        echo '<script>//<![CDATA[
    			document.addEventListener(\'DOMContentLoaded\', function() {
    				if (RublonWP) {
    					RublonWP.roleProtectionLevels = ' . json_encode($roles_js) . ';
    					RublonWP.setUpNewUserRoleChangeListener("your-profile", "rublon-confirmation-form");
    				}
    			}, false);
    		//]]></script>';
    }
}
예제 #4
0
/**
 * Handle the additional Rublon columns for a given user
 * 
 * @param mixed $value Current column value
 * @param string $column_name Column name
 * @param int $user_id User's ID 
 * @return string
 */
function rublon2factor_manage_rublon_columns($value, $column_name, $user_id)
{
    if (RublonHelper::isSiteRegistered()) {
        // Retrieve Rublon users from prerender data.
        $rublon_mobile_users = RublonHelper::getPrerenderData(RublonHelper::PRERENDER_KEY_MOBILE_USERS);
        if ($column_name == 'rublon2factor_status') {
            $user = get_user_by('id', $user_id);
            $protectionType = array(RublonHelper::roleProtectionType($user), RublonHelper::userProtectionType($user));
            if (RublonHelper::isPersonalEdition() && RublonHelper::isProjectOwner($user_id) || RublonFeature::isBusinessEdition() && RublonRolesProtection::isGrater(RublonHelper::getUserProtectionType($user), RublonHelper::PROTECTION_TYPE_NONE)) {
                $lang = RublonHelper::getBlogLanguage();
                $value = sprintf('<a href="%s"', RublonHelper::rubloncomUrl()) . ' target="_blank"><img class="rublon-protected rublon-image" src="' . RUBLON2FACTOR_PLUGIN_URL . '/assets/images/rublon_logo_32x32.png' . '" title="' . __('Account protected by Rublon', 'rublon') . '" /></a>';
            }
        }
        return $value;
    }
}