moved all aptches from cipf plugin to fbpatch
This commit is contained in:
@@ -16,7 +16,6 @@ if (!defined('ABSPATH')) {
|
||||
*
|
||||
*/
|
||||
class Fbpatch {
|
||||
|
||||
const SLUG_TOOGLE_ADMIN_MENU = ['_name'=>'toogle_admin_menu_url_fbpatch', 'toggle'=>'toggle', 'show'=>'show', 'hide'=>'hide'];
|
||||
const OPTION_TOGGLE_MENU = ['_name'=>'toggle_admin_menu_option_fbpatch', 'show'=>'show', 'hide'=>'hide'];
|
||||
const NONCE = ['_name'=>'nonce_name', '_action'=>'action_name'];
|
||||
@@ -24,12 +23,22 @@ class Fbpatch {
|
||||
|
||||
private static $_patches = [
|
||||
'_name'=>'fbpatch_list_of_patches',
|
||||
'calculations'=>['checked'=>false, 'title'=>'calculations title', 'description'=>'calculation description'],
|
||||
'hide_show' =>['checked'=>false, 'title'=>'hide/show title', 'description'=>'hide/show description'],
|
||||
'calculations'=>['checked'=>true, 'title'=>'calculations title', 'description'=>'calculation description'],
|
||||
'hide_show' =>['checked'=>true, 'title'=>'hide/show title', 'description'=>'hide/show description'],
|
||||
'modals' =>['checked'=>false, 'title'=>'modals title', 'description'=>'modals description'],
|
||||
'urls' =>['checked'=>false, 'title'=>'urls title', 'description'=>'urls description'],
|
||||
];
|
||||
//private static $_patches = ['_name'=>'fbpatch_list_of_patches', 'hide_show'];
|
||||
//private static $_patches = ['_name'=>'fbpatch_list_of_patches'];
|
||||
|
||||
public static function root_path() {
|
||||
return plugin_dir_path(__DIR__);
|
||||
}
|
||||
public static function root_url() {
|
||||
return plugin_dir_url(__DIR__);
|
||||
}
|
||||
|
||||
|
||||
private static function set_option_patches() {
|
||||
/*
|
||||
* get the list of patches in option
|
||||
@@ -116,7 +125,7 @@ class Fbpatch {
|
||||
$patches = Fbpatch::get_patches();
|
||||
foreach($patches as $patch => $data) {
|
||||
if ($data['checked'] === true) {
|
||||
include_once(plugin_dir_path(__DIR__) . '/php/'.$patch.'.php');
|
||||
include_once(self::root_path() . '/php/patches/'.$patch.'.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
|
||||
*/
|
||||
function add_form_builder_calculations_patch() {
|
||||
$handle = 'form_builder_calculations_patch';
|
||||
$url = plugin_dir_url(__DIR__) . '/js/calculations.js';
|
||||
$url = Fbpatch::root_url() . '/js/calculations.js';
|
||||
$dependencies = array('de_fb_calc');
|
||||
$version = null;
|
||||
$defer = true;
|
||||
52
plugins/fbpatch/php/patches/hide_show.php
Normal file
52
plugins/fbpatch/php/patches/hide_show.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/*
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
/*
|
||||
* 4674 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/modules/Form/Form.php
|
||||
*
|
||||
*/
|
||||
//function form_partner_before_render_CIPF() {
|
||||
// PLGNTLS_class::debug_infos();
|
||||
//
|
||||
// $cipf_form_partner = new PLGNTLS_class();
|
||||
// $cipf_form_partner->add_to_front(array(
|
||||
// 'css/hide_show_form_elements.css',
|
||||
// ));
|
||||
//}
|
||||
//add_action('de_fb_before_form_render', 'form_partner_before_render_CIPF');
|
||||
|
||||
|
||||
/*
|
||||
* 305 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*
|
||||
*/
|
||||
function form_partner_before_process($form_id, $post_array, $form_type) {
|
||||
error_log("form_id: " . json_encode($form_id));
|
||||
error_log("post_array: " . json_encode($post_array));
|
||||
error_log("form_type: " . json_encode($form_type));
|
||||
}
|
||||
add_action('df_before_process', __NAMESPACE__.'\form_partner_before_process', 10, 3);
|
||||
|
||||
/*
|
||||
* 506 : ../../../../wordpress_docker/volumes/wp_volume/wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php
|
||||
*
|
||||
*/
|
||||
function form_partner_before_insert($form_id, $post_array) {
|
||||
error_log("form_id: " . json_encode($form_id));
|
||||
error_log("post_array: " . json_encode($post_array));
|
||||
}
|
||||
add_action('df_before_insert_post', __NAMESPACE__.'\form_partner_before_insert', 10, 2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
25
plugins/fbpatch/php/patches/modals.php
Normal file
25
plugins/fbpatch/php/patches/modals.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/**
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
function test_modal() {
|
||||
$handle = 'form_builder_modals_patch';
|
||||
$url = Fbpatch::root_url() . '/js/modals.js';
|
||||
$dependencies = array();
|
||||
$version = null;
|
||||
$defer = true;
|
||||
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_shortcode('test_modal', __NAMESPACE__.'\test_modal');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
30
plugins/fbpatch/php/patches/urls.php
Normal file
30
plugins/fbpatch/php/patches/urls.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace FBPATCH;
|
||||
|
||||
/**
|
||||
* it means someone outside wp is accessing the file, in this case kill it.
|
||||
*/
|
||||
if (!defined('ABSPATH')) {
|
||||
die('You can not access this file!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* in `wp-content/plugins/divi-form-builder/includes/DiviFormBuilder.php`
|
||||
* also :
|
||||
* - Undefined variable: min_length in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5933
|
||||
* - Undefined variable: use_icon in /var/www/html/wp-content/plugins/divi-form-builder/includes/modules/FormField/FormField.php on line 5984
|
||||
*/
|
||||
function add_my_jquery_patch() {
|
||||
$handle = 'jquery_validator_url_patch';
|
||||
$url = Fbpatch::root_url() . 'js/urls.js';
|
||||
$dependencies = array('de_fb_validate');
|
||||
$version = null;
|
||||
$defer = true;
|
||||
wp_enqueue_script( $handle, $url, $dependencies, $version, $defer);
|
||||
}
|
||||
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_my_jquery_patch');
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user