first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventCF7 extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'CF7' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "CF7";
}
public function getName() {
return "Contact Form 7";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'contact-form-7/wp-contact-form-7.php' );
}
function getForms(){
global $wpdb;
$forms = wp_cache_get( 'cf7-forms' );
if ( empty( $forms ) ) {
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT ID, post_title FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_status = %s', "wpcf7_contact_form", "publish"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'post_title', 'ID' );
wp_cache_add( 'cf7-forms', $forms );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return EventsCustom
*/
function FormEventCF7() {
return FormEventCF7::instance();
}
FormEventCF7();

View File

@@ -0,0 +1,88 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventFluentForm extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'Fluentform' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "fluentform";
}
public function getName() {
return "Fluentform";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'fluentform/fluentform.php' );
}
function getForms(){
global $wpdb, $table_prefix;
$forms = array();
if ( empty( $forms ) ) {
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT id, title FROM '.$table_prefix.'fluentform_forms WHERE `status` = %s ORDER BY %s DESC', "published", "created_at"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'title', 'id' );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return FormEventFluentForm
*/
function FormEventFluentForm() {
return FormEventFluentForm::instance();
}
FormEventFluentForm();

View File

@@ -0,0 +1,91 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventFormidable extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'Formidable' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "formidable";
}
public function getName() {
return "Formidable";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'formidable/formidable.php' );
}
function getForms(){
global $wpdb, $table_prefix;
$forms = array();
if ( empty( $forms ) ) {
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT id, name FROM `'.$table_prefix.'frm_forms` WHERE `status` LIKE %s ORDER BY created_at DESC', "published"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'name', 'id' );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return EventsCustom
*/
function FormEventFormidable() {
return FormEventFormidable::instance();
}
FormEventFormidable();

View File

@@ -0,0 +1,88 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventNinjaForm extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'NinjaForm' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "ninjaform";
}
public function getName() {
return "Ninja Form";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'ninja-forms/ninja-forms.php' );
}
function getForms(){
global $wpdb, $table_prefix;
$forms = array();
if ( empty( $forms ) ) {
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT id, title FROM '.$table_prefix.'nf3_forms ORDER BY %s DESC', "created_at"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'title', 'id' );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return FormEventNinjaForm
*/
function FormEventNinjaForm() {
return FormEventNinjaForm::instance();
}
FormEventNinjaForm();

View File

@@ -0,0 +1,88 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventWPForms extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'WPForms' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "wpforms";
}
public function getName() {
return "WPForms";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'wpforms-lite/wpforms.php' );
}
function getForms(){
global $wpdb;
$forms = array();
if ( empty( $forms ) ) {
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT ID, post_title FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_status = %s', "wpforms", "publish"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'post_title', 'ID' );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return EventsCustom
*/
function FormEventWPForms() {
return FormEventWPForms::instance();
}
FormEventWPForms();

View File

@@ -0,0 +1,88 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
class FormEventForminator extends Settings implements FormEventsFactory {
private static $_instance;
public static function instance() {
if ( is_null( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
parent::__construct( 'forminator' );
$this->locateOptions(
PYS_FREE_PATH . '/includes/formEvents/options_fields.json',
PYS_FREE_PATH . '/includes/formEvents/options_defaults.json'
);
if($this->isActivePlugin()){
add_filter("pys_form_event_factory",[$this,"register"]);
}
}
function register($list) {
$list[] = $this;
return $list;
}
public function getSlug() {
return "forminator";
}
public function getName() {
return "Forminator";
}
function isEnabled()
{
return $this->getOption( 'enabled' );
}
function isActivePlugin()
{
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
return is_plugin_active( 'forminator/forminator.php' );
}
function getForms(){
global $wpdb;
$forms = array();
if ( empty( $forms ) ) {
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = $wpdb->get_results(
$wpdb->prepare(
'SELECT ID, post_title FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_status = %s', "forminator_forms", "publish"
)
);
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery
$forms = wp_list_pluck( $forms, 'post_title', 'ID' );
}
return $forms;
}
function getOptions() {
return array(
"name" => $this->getName(),
"enabled" => $this->getOption( "enabled"),
"form_ID_event" => $this->getOption( "form_ID_event")
);
}
}
/**
* @return EventsCustom
*/
function FormEventForminator() {
return FormEventForminator::instance();
}
FormEventForminator();

View File

@@ -0,0 +1,18 @@
<?php
namespace PixelYourSite;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
interface FormEventsFactory {
public function getSlug();
public function getName();
public function isEnabled();
public function isActivePlugin();
public function getOptions();
public function getForms();
}

View File

@@ -0,0 +1,4 @@
{
"enabled": true,
"form_ID_event": ""
}

View File

@@ -0,0 +1,4 @@
{
"enabled": "checkbox",
"form_ID_event": "array_v"
}