Created
March 28, 2016 20:45
-
-
Save atwellpub/b6c16ab8f3341a06e517 to your computer and use it in GitHub Desktop.
Inbound Now Ninja Forms Main File
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
<?php | |
/* | |
Plugin Name: Inbound Extension - Ninja Forms | |
Plugin URI: http://www.inboundnow.com/market/support-will-complete | |
Description: Provides Ninja Forms 3.0 integration & field mapping | |
Version: 1.0.1 | |
Author: Inbound Now | |
Author URI: http://www.inboundnow.com/ | |
*/ | |
if (!class_exists('Inbound_Ninja_Forms')) { | |
class Inbound_Ninja_Forms { | |
/** | |
* Initialize class | |
*/ | |
public function __construct() { | |
self::define_constants(); | |
self::load_files(); | |
self::load_hooks(); | |
} | |
/** | |
* Define constants | |
*/ | |
public static function define_constants() { | |
/* Define constants */ | |
define('INBOUND_NOW_ACTIVATE', __FILE__ ); | |
define('INBOUND_NINJA_FORMS_CURRENT_VERSION', '2.0.4' ); | |
define('INBOUND_NINJA_FORMS_LABEL' , 'Zapier Integration' ); | |
define('INBOUND_NINJA_FORMS_FILE' , __FILE__ ); | |
define('INBOUND_NINJA_FORMS_SLUG' , 'inbound-zapier'); | |
define('INBOUND_NINJA_FORMS_TEXT_DOMAIN' , 'inbound-pro' ); | |
define('INBOUND_NINJA_FORMS_REMOTE_ITEM_NAME' , 'ninja-forms-integration' ); | |
define('INBOUND_NINJA_FORMS_PATH', realpath(dirname(__FILE__)) . '/'); | |
$upload_dir = wp_upload_dir(); | |
$url = ( !strstr( INBOUND_NINJA_FORMS_PATH , 'plugins' )) ? $upload_dir['basedir'] . '/inbound-pro/extensions/' .plugin_basename( basename(__DIR__) ) : WP_PLUGIN_URL.'/'.plugin_basename( dirname(__FILE__) ).'/' ; | |
define('INBOUND_NINJA_FORMS_URLPATH', $url ); | |
} | |
/** | |
* Load hooks and filters | |
*/ | |
public static function load_hooks() { | |
/* Setup Automatic Updating & Licensing */ | |
add_action('admin_init', array( __CLASS__ , 'license_setup') ); | |
/* | |
* Optional. If your extension processes or alters form submission data on a per form basis... | |
*/ | |
add_filter( 'ninja_forms_register_actions', array(__CLASS__ , 'register_actions')); | |
} | |
/* | |
* Setups Software Update API | |
*/ | |
public static function license_setup() { | |
/* ignore these hooks if inbound pro is active */ | |
if (defined('INBOUND_PRO_CURRENT_VERSION')) { | |
return; | |
} | |
/*PREPARE THIS EXTENSION FOR LICESNING*/ | |
if ( class_exists( 'Inbound_License' ) ) { | |
$license = new Inbound_License( INBOUND_NINJA_FORMS_FILE , INBOUND_NINJA_FORMS_LABEL , INBOUND_NINJA_FORMS_SLUG , INBOUND_NINJA_FORMS_CURRENT_VERSION , INBOUND_NINJA_FORMS_REMOTE_ITEM_NAME ) ; | |
} | |
} | |
/** | |
* If your extension processes or alters form submission data on a per form basis... | |
*/ | |
public static function register_actions($actions) { | |
$actions[ 'inbound-now-integration' ] = new NF_Actions_Inbound_Store_Lead(); | |
return $actions; | |
} | |
/** | |
* Extend inbound form settings to enable/disable zapier communication | |
*/ | |
public static function load_files() { | |
include_once INBOUND_NINJA_FORMS_PATH . 'actions/store-lead.php'; | |
} | |
} | |
add_action('plugins_loaded' , 'load_inbound_ninja_forms' , 1); | |
function load_inbound_ninja_forms() { | |
new Inbound_Ninja_Forms; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment