Skip to content
Permalink
Browse files

initial commit

pushing the WP code
  • Loading branch information
JoseSoteloCohen committed Aug 20, 2019
1 parent 3c2825d commit daee9fb318a6eb0aa9c47fa8be5648e07688b68c
Showing with 550 additions and 2 deletions.
  1. +24 −2 README.md
  2. +228 −0 mooelements.php
  3. +298 −0 plugin.php
@@ -1,2 +1,24 @@
# Moo Elements
WordPress plugin to integrate Moosend with Elementor Forms
# Moo Elements: Extend Elementor Forms to work with Moosend

Simple plugin that integrates Elementor Pro form widget with Moosend via API.

## 📖 How to use
As with any other WordPress plugin, you can follow this simple steps to install it:

* Install using the WordPress built-in Plugin installer, or extract the zip file and drop the contents in the wp-content/plugins/ directory of your WordPress installation.
* Activate the plugin through the ‘Plugins’ menu in WordPress.
* You now will find "moosend"" inside the "Actions after submit" dropdown.

## ⭐ Show your support
Please ⭐ this plugin if this project helped you!

Also, if it helped you it would be awesome if you could leave a review in WordPress, you can do that by [clicking here](https://wordpress.org/support/plugin/moo-elements/reviews/#new-post).

## Want to help?
If you like this plugin, feel free to donate:

* [Donation Page](https://compras.inboundlatino.com/moo-elements/?ref=github) (Paypal and Credit Card with Stripe)
* Bitcoin: 12Nth97LEFYFiWJ66PEhHfWbwFPT8fnznN
* Ethereum: 0x6a5bF47fef1fC52BC41ca190b11E05Ac95490D0a
* BAT (Basic Attention Token): 0x6a5bF47fef1fC52BC41ca190b11E05Ac95490D0a
* Litecoin: LLce6WFs2SVrp5s
@@ -0,0 +1,228 @@
<?php

/**
* Plugin Name: Moo Elements
* Description: Plugin to extend Elementor forms with Moosend.
* Version: 2.0.0
* Author: José Sotelo
* Author URI: https://inboundlatino.com/
* Text Domain: moo-elements
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

/**
* Main Moo Elements Extension Class
*
* The main class that initiates and runs the plugin.
*
* @since 1.0.0
*/
final class Moo_Elements {

/**
* Plugin Version
*
* @since 1.0.0
*
* @var string The plugin version.
*/
const VERSION = '1.0.0';

/**
* Minimum Elementor Version
*
* @since 1.0.0
*
* @var string Minimum Elementor version required to run the plugin.
*/
const MINIMUM_ELEMENTOR_VERSION = '2.5.0';

/**
* Minimum PHP Version
*
* @since 1.0.0
*
* @var string Minimum PHP version required to run the plugin.
*/
const MINIMUM_PHP_VERSION = '5.4';

/**
* Instance
*
* @since 1.0.0
*
* @access private
* @static
*
* @var Moo_Elements The single instance of the class.
*/
private static $_instance = null;

/**
* Instance
*
* Ensures only one instance of the class is loaded or can be loaded.
*
* @since 1.0.0
*
* @access public
* @static
*
* @return Moo_Elements An instance of the class.
*/
public static function instance() {

if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;

}

/**
* Constructor
*
* @since 1.0.0
*
* @access public
*/
public function __construct() {

add_action( 'init', [ $this, 'i18n' ] );
add_action( 'plugins_loaded', [ $this, 'init' ] );

}

/**
* Load Textdomain
*
* Load plugin localization files.
*
* Fired by `init` action hook.
*
* @since 1.0.0
*
* @access public
*/
public function i18n() {

load_plugin_textdomain( 'moo-elements' );

}

/**
* Initialize the plugin
*
* Load the plugin only after Elementor (and other plugins) are loaded.
* Checks for basic plugin requirements, if one check fail don't continue,
* if all check have passed load the files required to run the plugin.
*
* Fired by `plugins_loaded` action hook.
*
* @since 1.0.0
*
* @access public
*/
public function init() {

// Check if Elementor installed and activated
if ( ! did_action( 'elementor/loaded' ) ) {
add_action( 'admin_notices', [ $this, 'admin_notice_missing_main_plugin' ] );
return;
}

// Check for required Elementor version
if ( ! version_compare( ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=' ) ) {
add_action( 'admin_notices', [ $this, 'admin_notice_minimum_elementor_version' ] );
return;
}

// Check for required PHP version
if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', [ $this, 'admin_notice_minimum_php_version' ] );
return;
}

// Add Plugin actions
require_once('plugin.php');
}
/**
* Admin notice
*
* Warning when the site doesn't have Elementor installed or activated.
*
* @since 1.0.0
*
* @access public
*/
public function admin_notice_missing_main_plugin() {

if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );

$message = sprintf(
/* translators: 1: Plugin name 2: Elementor Pro*/
esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'moo-elements' ),
'<strong>' . esc_html__( 'Moo Elements', 'moo-elements' ) . '</strong>',
'<strong>' . esc_html__( 'Elementor Pro', 'moo-elements' ) . '</strong>'
);

printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );

}

/**
* Admin notice
*
* Warning when the site doesn't have a minimum required Elementor version.
*
* @since 1.0.0
*
* @access public
*/
public function admin_notice_minimum_elementor_version() {

if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );

$message = sprintf(
/* translators: 1: Plugin name 2: Elementor Pro 3: Required Elementor Pro version */
esc_html__( '"%1$s" requires "%2$s" version "%3$s" or greater.', 'moo-elements' ),
'<strong>' . esc_html__( 'Moo Elements', 'moo-elements' ) . '</strong>',
'<strong>' . esc_html__( 'Elementor Pro', 'moo-elements' ) . '</strong>',
self::MINIMUM_ELEMENTOR_VERSION
);

printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );

}

/**
* Admin notice
*
* Warning when the site doesn't have a minimum required PHP version.
*
* @since 1.0.0
*
* @access public
*/
public function admin_notice_minimum_php_version() {

if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );

$message = sprintf(
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'moo-elements' ),
'<strong>' . esc_html__( 'Moo Elements', 'moo-elements' ) . '</strong>',
'<strong>' . esc_html__( 'PHP', 'moo-elements' ) . '</strong>',
self::MINIMUM_PHP_VERSION
);

printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message );

}

}

Moo_Elements::instance();

0 comments on commit daee9fb

Please sign in to comment.
You can’t perform that action at this time.