Skip to content

Instantly share code, notes, and snippets.

@curtismchale
Last active January 13, 2024 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save curtismchale/3aa51f966c10fdc0512329be2daf5338 to your computer and use it in GitHub Desktop.
Save curtismchale/3aa51f966c10fdc0512329be2daf5338 to your computer and use it in GitHub Desktop.
[Nexcess - AutomateWoo Triggers] see blog post: https://www.nexcess.net/blog/adding-custom-triggers-to-automatewoo/ #woocommerce #automatewoo
<?php
/*
Plugin Name: Nexcess - AutomateWoo Triggers
Plugin URI: https://nexcess.net
Description: Adds custom triggers to AutomateWoo
Version: 1.0
Author: SFNdesign, Curtis McHale
Author URI: http://sfndesign.ca
License: GPLv2 or later
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Nexcess_Automatewoo_Triggers{
private static $instance;
/**
* Spins up the instance of the plugin so that we don't get many instances running at once
*
* @since 1.0
* @author SFNdesign, Curtis McHale
*
* @uses $instance->init() The main get it running function
*/
public static function instance(){
if ( ! self::$instance ){
self::$instance = new Nexcess_Automatewoo_Triggers();
self::$instance->init();
}
} // instance
/**
* Spins up all the actions/filters in the plugin to really get the engine running
*
* @since 1.0
* @author SFNdesign, Curtis McHale
*
* @uses $this->constants() Defines our constants
* @uses $this->includes() Gets any includes we have
*/
public function init(){
$this->constants();
$this->includes();
add_filter( 'automatewoo/triggers', array( $this, 'add_to_team_trigger' ), 10, 1 );
} // init
public static function add_to_team_trigger( $triggers ){
require_once( 'trigger-add-to-team.php' );
$triggers['nexcess_add_to_team'] = 'Nexcess_Add_To_Team_Trigger';
return $triggers;
}
/**
* Gives us any constants we need in the plugin
*
* @since 1.0
*/
public function constants(){
define( 'NEXCESS_AUTOMATEWOO_TRIGGERS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Includes any externals
*
* @since 1.0
* @author SFNdesign, Curtis McHale
* @access public
*/
public function includes(){
}
} // Nexcess_Automatewoo_Triggers
Nexcess_Automatewoo_Triggers::instance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment