is_licensed()) { $this->lic = get_option($this->wp_option); } else { $this->lic = $lic; } } function um_validate_license($field, $value, $existing_value) { $error = false; $this->check($value); if ($this->active()) { $error = false; }else{ $error = true; $field['msg'] = 'Invalid License'; } $return['value'] = $value; if ($error == true) { $return['error'] = $field; } return $return; } public function um_options($sections) { $sections[] = array( 'icon' => 'um-icon-code-working', 'title' => __('Ajax', AJAXY_UM_FORMS_TEXT_DOMAIN), 'fields' => array( array( 'id' => 'um_ajax_enable', 'type' => 'switch', 'title' => __('Ajax Enabled', AJAXY_UM_FORMS_TEXT_DOMAIN), 'default' => 1, 'desc' => 'Enable/disable ajax on the forms', 'on' => __('On', AJAXY_UM_FORMS_TEXT_DOMAIN), 'off' => __('Off', AJAXY_UM_FORMS_TEXT_DOMAIN), ), array( 'id' => 'um_ajax_account_enable', 'type' => 'switch', 'title' => __('Profile Ajax Validation Enabled', AJAXY_UM_FORMS_TEXT_DOMAIN), 'default' => 0, 'desc' => 'Enable/disable profile validation via ajax', 'on' => __('On', AJAXY_UM_FORMS_TEXT_DOMAIN), 'off' => __('Off', AJAXY_UM_FORMS_TEXT_DOMAIN), ), array( 'id' => 'um_reset_message', 'type' => 'textarea', // bug with wp 4.4? should be editor 'title' => __('Reset Password Success Message', AJAXY_UM_FORMS_TEXT_DOMAIN), 'default' => __('Your password has been reset successfully!An email with instructions has been sent to your registered email address', AJAXY_UM_FORMS_TEXT_DOMAIN), 'desc' => __('Reset Password form message when submitted successfully.', AJAXY_UM_FORMS_TEXT_DOMAIN) ), array( 'id' => 'Ajaxy_UM_Forms_License', 'type' => 'text', // bug with wp 4.4? should be editor 'title' => __('License', AJAXY_UM_FORMS_TEXT_DOMAIN), 'subtitle' => $this->is_licensed() ? 'Already Activated' : '', 'readonly' => $this->is_licensed(), //'class' =>$this->is_licensed() ? 'notice-green' : '', 'default' => __('', AJAXY_UM_FORMS_TEXT_DOMAIN), 'desc' => __('Unlimited forms, Get a license from Ajaxy.org.', AJAXY_UM_FORMS_TEXT_DOMAIN), 'validate_callback' => array($this, 'um_validate_license') ) ) ); return $sections; } /** * check for current product if licensed * @return boolean */ public function is_licensed() { $lic = get_option($this->wp_option); if (!empty($lic)) { return true; } return false; } public function license_menu() { add_submenu_page(AJAXY_UM_FORMS_TEXT_DOMAIN, 'Ajax', 'Ajax', 'manage_options', 'um-ajax-settings', array($this, 'settings_page')); } public function settings_page() { echo '