Un utente ha chiesto 👇
Ciao,
Al momento mi trovo di fronte a una domanda molto strana che deve venire da Client Dash: quando disattivo il plugin, scompare.
Solo in questo fine settimana ricevo avvisi nella console JavaScript (e errori simili nel mio log degli errori di Apache) che dicono questo:
Failed to load <script> with source "http://myurl/wp-content/themes/JointsWP-CSS-masterC:xampphtdocswp-contentpluginsclient-dashcorelibraryrbm-field-helpers/assets/dist/js/rbm-field-helpers-admin.min.js?ver=1.4.3".
Ne ricevo molti ogni volta che viene caricata la pagina di amministrazione e non so da dove iniziare a trovare il problema. La stringa è in tutti questi errori
C:xampphtdocswp-contentpluginsclient-dashcorelibraryrbm-field-helpers
che sembrano interferire con questi percorsi altrimenti corretti. Dato che è il tuo plugin, ho pensato di farti una domanda prima!
Grazie! btw. è molto urgente, questa è probabilmente la causa del blocco del nostro sito Web che si verifica ogni pochi giorni …
Lanciatore di thread
(@additivefx)
1 anno, 11 mesi fa
Ora ho corretto l’errore. Dato che sto usando un sistema Windows e stai usando confronti cablati per prevenire problemi di ritmica con questa domanda:
in “rbm-field-helpers-php”:
if ( strpos( __FILE__, WP_PLUGIN_DIR ) !== false) {
define( 'RBM_FIELD_HELPERS_URI', plugins_url( '', __FILE__ ) );
define( 'RBM_FIELD_HELPERS_DIR', plugin_dir_path( __FILE__ ) );
} else {
$theme_dir = get_stylesheet_directory();
// Relative path from the Theme Directory to the directory holding RBM FH
$relative_from_theme_dir = dirname( str_replace( $theme_dir, '', __FILE__ ) );
// Build out our Constants for DIR and URI
// DIR could have been made using just dirname( __FILE__ ), but we needed the difference to create the URI anyway
define( 'RBM_FIELD_HELPERS_URI', get_stylesheet_directory_uri() . $relative_from_theme_dir );
define( 'RBM_FIELD_HELPERS_DIR', $theme_dir . $relative_from_theme_dir );
}
e questa è la mia soluzione ora.
//this fixes issues when comparing the string in the next step.
//Original result of "WP_PLUGIN_DIR" for me was C:xampphtdocswp-content/plugins" - and is being tested against a string with only "" in it.
$alternateString = str_replace( "/", "\", WP_PLUGIN_DIR);
if ( strpos( __FILE__, WP_PLUGIN_DIR ) !== false || strpos(__FILE__, $alternateString) !== false) {
define( 'RBM_FIELD_HELPERS_URI', plugins_url( '', __FILE__ ) );
define( 'RBM_FIELD_HELPERS_DIR', plugin_dir_path( __FILE__ ) );
} else {
$theme_dir = get_stylesheet_directory();
// Relative path from the Theme Directory to the directory holding RBM FH
$relative_from_theme_dir = dirname( str_replace( $theme_dir, '', __FILE__ ) );
// Build out our Constants for DIR and URI
// DIR could have been made using just dirname( __FILE__ ), but we needed the difference to create the URI anyway
define( 'RBM_FIELD_HELPERS_URI', get_stylesheet_directory_uri() . $relative_from_theme_dir );
define( 'RBM_FIELD_HELPERS_DIR', $theme_dir . $relative_from_theme_dir );
}
Autore del plugin
(@ d4mation)
1 anno, 11 mesi fa
@additivefx
Grazie per la segnalazione! Credo che questo possa essere risolto con wp_normalize_path (). Potresti provare quanto segue per me per il fissaggio? Non ho un server Windows per testarlo.
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
if ( strpos( __FILE__, $plugin_dir ) !== false ) {
define( 'RBM_FIELD_HELPERS_URI', plugins_url( '', __FILE__ ) );
define( 'RBM_FIELD_HELPERS_DIR', plugin_dir_path( __FILE__ ) );
}
else {
$theme_dir = get_stylesheet_directory();
// Relative path from the Theme Directory to the directory holding RBM FH
$relative_from_theme_dir = dirname( str_replace( $theme_dir, '', __FILE__ ) );
// Build out our Constants for DIR and URI
// DIR could have been made using just dirname( __FILE__ ), but we needed the difference to create the URI anyway
define( 'RBM_FIELD_HELPERS_URI', get_stylesheet_directory_uri() . $relative_from_theme_dir );
define( 'RBM_FIELD_HELPERS_DIR', $theme_dir . $relative_from_theme_dir );
}
Questa risposta è stata modificata 1 anno, 11 mesi fa da. Motivo: formattazione Questa risposta è stata modificata 1 anno, 11 mesi fa. Questa risposta è stata modificata 1 anno, 11 mesi fa da. Motivo: plugin autore della settimana
(@ d4mation)
1 anno, 11 mesi fa
Ho modificato quanto sopra alcune volte. Nel caso in cui tu fossi in possesso di una delle versioni precedenti, volevo che fossi a conoscenza 🙂
Lanciatore di thread
(@additivefx)
1 anno, 11 mesi fa
Ciao,
questo non risolve il problema, poiché cerca di abbinare questi due insiemi:
C: / xampp / htdocs / wp-content / plugins
C: xampp htdocs wp-content plugins client-dash core library rbm-field-helpers rbm-field-helpers.php
Devi normalizzare entrambi i fili, quindi ecco la disposizione che stai cercando:
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
$current_file_dir = wp_normalize_path ( __FILE__ );
if ( strpos( $current_file_dir, $plugin_dir ) !== false ) {
...
Autore del plugin
(@ d4mation)
1 anno, 9 mesi fa
@additivefx
Scusa per il ritardo. Devo aver perso le risposte e-mail su questo.
Eseguirò alcuni test su questo e ti avviserò quando avrò pubblicato un aggiornamento!
Autore del plugin
(@ d4mation)
1 anno, 9 mesi fa
@additivefx
Volevo informarti che ho rilasciato una correzione per questo in Client Dash v2.1.2. Ora dovrebbe funzionare correttamente sui server basati su Windows!
Was this helpful?
0 / 0