updated plgntls :

- renamed PLGNTLS_class -> Plgntls
- changed method 'add_to_front()' to static method
- moved fetch script as inline script, so the plgntls file is single
- improved the way inline script and styles are added
This commit is contained in:
asus
2024-03-29 21:56:12 +01:00
parent 42e8cbc4e9
commit ade0be87ce
41 changed files with 457 additions and 421 deletions

View File

@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
* menu plugin
*/
function cipf_plugin_menu_CIPF() {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
$menu_page_title = 'cipf';
$menu_title = 'cipf';
$menu_capability = 'manage_options';
@@ -40,11 +40,11 @@ ajax
use $_POST['property_name']
*/
//function cipfcard_menu_fetch_handler() {
// PLGNTLS_class::debug_infos();
// Plgntls::debug_infos();
// return new WP_REST_Response('hello', 200);
//}
//function cipfcard_menu_endpoint() {
// PLGNTLS_class::debug_infos();
// Plgntls::debug_infos();
// register_rest_route('plgntls', '/get_data', array(
// 'methods' => 'POST',
// 'callback' => 'cipfcard_menu_fetch_handler',

View File

@@ -12,8 +12,8 @@ if (!defined('ABSPATH')) {
function toggle_menu_CIPF($menu_page_title, $menu_title, $menu_capability, $menu_slug, $menu_callback) {
PLGNTLS_class::debug_infos();
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
Plgntls::debug_infos();
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
if (false === get_option($toggle_menu['_name'])) {
add_option($toggle_menu['_name'], $toggle_menu['hide'], '', 'no');
@@ -39,9 +39,9 @@ function toggle_menu_CIPF($menu_page_title, $menu_title, $menu_capability, $menu
*
*/
function add_link_to_custer_plugin_CIPF($links) {
PLGNTLS_class::debug_infos();
$slug_toggle = PLGNTLS_class::SLUG_TOOGLE_ADMIN_MENU;
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
Plgntls::debug_infos();
$slug_toggle = Plgntls::SLUG_TOOGLE_ADMIN_MENU;
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
$toggle = get_option($toggle_menu['_name']);
@@ -63,16 +63,16 @@ add_filter('plugin_action_links_cipf_plugin/cipf_plugin.php', 'add_link_to_custe
*
*/
function toggle_custer_plugin_menu_CIPF() {
PLGNTLS_class::debug_infos(2);
$slug_toggle = PLGNTLS_class::SLUG_TOOGLE_ADMIN_MENU;
$toggle_menu = PLGNTLS_class::TOGGLE_ADMIN_MENU;
Plgntls::debug_infos(2);
$slug_toggle = Plgntls::SLUG_TOOGLE_ADMIN_MENU;
$toggle_menu = Plgntls::TOGGLE_ADMIN_MENU;
global $wp;
$current_slug = $wp->request;
if ($current_slug !== $slug_toggle['_name']) {
return;
}
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
$show = null;
if (!isset($_GET)) {

View File

@@ -11,34 +11,34 @@ if (!defined('ABSPATH')) {
function add_plugin_content_CIPF() {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
/*
* paypal
*
*/
$admin_post_paypal = PLGNTLS_class::ADMIN_POST_PAYPAL;
$nonce_paypal = PLGNTLS_class::ADMIN_MENU_NONCE_PAYPAL;
$admin_post_paypal = Plgntls::ADMIN_POST_PAYPAL;
$nonce_paypal = Plgntls::ADMIN_MENU_NONCE_PAYPAL;
$paypal_credentials = get_paypal_options_CIPF();
/*
* registration email
*
*/
$admin_post_email_registration = PLGNTLS_class::ADMIN_POST_EMAIL_REGISTRATION;
$nonce_email = PLGNTLS_class::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
$admin_post_email_registration = Plgntls::ADMIN_POST_EMAIL_REGISTRATION;
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
$email_registration = get_email_registration_option_CIPF();
/*
* registration email
*
*/
$admin_post_payment_messages = PLGNTLS_class::ADMIN_POST_PAYMENT_MESSAGES;
$nonce_payment_messages = PLGNTLS_class::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
$admin_post_payment_messages = Plgntls::ADMIN_POST_PAYMENT_MESSAGES;
$nonce_payment_messages = Plgntls::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
$payment_messages = get_payment_messages_option_CIPF();
ob_start();
include(PLGNTLS_class::root_path() . '/html/menu/cipf_menu.html');
include(Plgntls::root_path() . '/html/menu/cipf_menu.html');
$html = ob_get_clean();
echo $html;
}
@@ -53,7 +53,7 @@ function add_plugin_content_CIPF() {
*
*/
function redirect_menu_referer_CIPF($post) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
if (!isset($post)) {
wp_redirect(admin_url(), 301);
exit;

View File

@@ -22,8 +22,8 @@ if (!defined('ABSPATH')) {
*
*/
function change_email_registration_CIPF() {
PLGNTLS_class::debug_infos();
$nonce_email = PLGNTLS_class::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
Plgntls::debug_infos();
$nonce_email = Plgntls::ADMIN_MENU_NONCE_EMAIL_REGISTRATION;
if (!isset($_POST[$nonce_email['_name']])) {
redirect_menu_referer_CIPF($_POST);
@@ -39,14 +39,14 @@ function change_email_registration_CIPF() {
redirect_menu_referer_CIPF($_POST);
}
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_EMAIL_REGISTRATION, 'change_email_registration_CIPF');
add_action('admin_post_'.Plgntls::ADMIN_POST_EMAIL_REGISTRATION, 'change_email_registration_CIPF');
function update_email_registration_option_CIPF($post) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
/*

View File

@@ -22,8 +22,8 @@ if (!defined('ABSPATH')) {
*
*/
function change_payment_messages_CIPF() {
PLGNTLS_class::debug_infos();
$nonce_payment_messages = PLGNTLS_class::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
Plgntls::debug_infos();
$nonce_payment_messages = Plgntls::ADMIN_MENU_NONCE_PAYMENT_MESSAGES;
if (!isset($_POST[$nonce_payment_messages['_name']])) {
redirect_menu_referer_CIPF($_POST);
@@ -39,14 +39,14 @@ function change_payment_messages_CIPF() {
redirect_menu_referer_CIPF($_POST);
}
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_PAYMENT_MESSAGES, 'change_payment_messages_CIPF');
add_action('admin_post_'.Plgntls::ADMIN_POST_PAYMENT_MESSAGES, 'change_payment_messages_CIPF');
function update_payment_messages_option_CIPF($post) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
error_log("post: " . json_encode($post));

View File

@@ -21,8 +21,8 @@ if (!defined('ABSPATH')) {
*
*/
function paypal_credentials_CIPF() {
PLGNTLS_class::debug_infos();
$nonce_paypal = PLGNTLS_class::ADMIN_MENU_NONCE_PAYPAL;
Plgntls::debug_infos();
$nonce_paypal = Plgntls::ADMIN_MENU_NONCE_PAYPAL;
if (!isset($_POST[$nonce_paypal['_name']])) {
redirect_menu_referer_CIPF($_POST);
@@ -38,14 +38,14 @@ function paypal_credentials_CIPF() {
redirect_menu_referer_CIPF($_POST);
}
add_action('admin_post_'.PLGNTLS_class::ADMIN_POST_PAYPAL, 'paypal_credentials_CIPF');
add_action('admin_post_'.Plgntls::ADMIN_POST_PAYPAL, 'paypal_credentials_CIPF');
function update_paypal_credentials_CIPF($post) {
PLGNTLS_class::debug_infos();
Plgntls::debug_infos();
/*