-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from nileshc-bsf/new-mautic-user-pass
[NEW] - Mautic new connection option with Username and Password added.
- Loading branch information
Showing
6 changed files
with
419 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ | |
background-color: #b4b9be; | ||
padding: 3px 6px; | ||
color: #fff; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(function( $ ) { | ||
|
||
var ContactInMautic = { | ||
|
||
/** | ||
* Initializes the services logic. | ||
* | ||
* @return void | ||
* @since 1.0.3 | ||
*/ | ||
init: function() | ||
{ | ||
$( document ).on( 'change', '.bsfm-mautic-type', this._changeMauticType ); | ||
}, | ||
|
||
_changeMauticType: function() { | ||
var val = $( this ).val(); | ||
if( val != 'mautic_api' ) { | ||
$( '.contacts-in-mautic-text-bsfm-username' ).show(); | ||
$( '.contacts-in-mautic-text-bsfm-password' ).show(); | ||
|
||
$( '.contacts-in-mautic-text-bsfm-public-key' ).hide(); | ||
$( '.contacts-in-mautic-text-bsfm-secret-key' ).hide(); | ||
} else { | ||
$( '.contacts-in-mautic-text-bsfm-username' ).hide(); | ||
$( '.contacts-in-mautic-text-bsfm-password' ).hide(); | ||
|
||
$( '.contacts-in-mautic-text-bsfm-public-key' ).show(); | ||
$( '.contacts-in-mautic-text-bsfm-secret-key' ).show(); | ||
} | ||
} | ||
}; | ||
|
||
|
||
$ ( function() { | ||
ContactInMautic.init(); | ||
}); | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* Plugin auto update class. | ||
* | ||
* @package Contacts in Mautic | ||
* @author Brainstormforce | ||
* @link http://brainstormforce.com | ||
* @since 1.0.3 | ||
*/ | ||
|
||
/** | ||
* Bsf_CM_Auto_Update initial setup | ||
* | ||
* @since 1.0.3 | ||
*/ | ||
class Bsf_CM_Auto_Update { | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
// Plugin Updates. | ||
add_action( 'admin_init', __CLASS__ . '::init' ); | ||
} | ||
|
||
/** | ||
* Implement plugin auto update logic. | ||
* | ||
* @since 1.0.3 | ||
* @return void | ||
*/ | ||
public static function init() { | ||
|
||
// Get auto saved version number. | ||
$saved_version = get_option( 'bsf_contact_mautic_version' ); | ||
|
||
// If the version option not present then just create it. | ||
if ( false === $saved_version ) { | ||
add_option( 'bsf_contact_mautic_version', BSF_CONTACT_MAUTIC_VERSION ); | ||
} | ||
|
||
// If equals then return. | ||
if ( version_compare( $saved_version, BSF_CONTACT_MAUTIC_VERSION, '=' ) ) { | ||
return; | ||
} | ||
|
||
// Set the Mautic connection type option. | ||
$check_option = get_option( 'bsf_mautic_connection_type' ); | ||
if ( false === $check_option ){ | ||
add_option( 'bsf_mautic_connection_type', 'mautic_api' ); | ||
} | ||
|
||
// Update auto saved version number. | ||
update_option( 'bsf_contact_mautic_version', BSF_CONTACT_MAUTIC_VERSION ); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* calling 'Bsf_CM_Auto_Update' Constructor | ||
*/ | ||
new Bsf_CM_Auto_Update(); |
Oops, something went wrong.