Conversation
supportSorry, but FAQ section not helpful with not registered PC class problem inside new plugins. And I still can’t understand, how enable your cool plugin inside plugins development. Examples inside your answers in this topic https://wordpress.org/support/topic/support-for-plugin-debug/ not helped me. Thank you for help. This topic was modified 6 years, 12 months ago by viter-z-bayraku . This topic was modified 6 years, 12 months ago by viter-z-bayraku . This topic was modified 6 years, 12 months ago by viter-z-bayraku .
There’s a FAQ. The PC class is used to print variables in your Chrome JavaScript console. For example <?php $foo = 'bar'; add_action( 'plugins_loaded', function () use ( $foo ) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag( $foo ); } ); This will output bar in your Chrome console. This reply was modified 6 years, 12 months ago by Fulvio Notarstefano .
Thank you, Fulvio. I understand it. But this class working only in theme templates. But I can not understand, how it integrate for debugging new plugin.. In other plugin I have unavailable PC class error.. This reply was modified 6 years, 12 months ago by viter-z-bayraku .
Are you able to use the other functions of the plugin, like the console terminal or the Google Chrome JavaScript console for variable and error dumping?
I want to use your plugin to debug errors from other new plugin in Google Chrome Development Tool (Javascript Console)
PC::debug("test"); inside this plugin returning Fatal error: Uncaught Error: Class 'PC' not found
I’m sorry. Your code in previous messages is helpful. Thank you!
One question. Can be your code used as a public function inside another class? Like: public function debug($foo){ add_action( 'plugins_loaded', function () use ( $foo ) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag( $foo ); } ); }
I certainly believe so. Mind that this is intended for temporary debugging and you shouldn’t roll PHP Console on a production site. If you need to debug some variable in WordPress, another way of doing it is to store the data you want to output in the console in a WordPress option, e.g. update_option( 'my_test', $data ); Then in the console you’d do return get_option( 'my_test' ); from the terminal and check results.
It’s only for temporary debugging. I’m looking for quick solution for plugin development, based on php classes.
That is helpful for me.. Thank you 🙂 add_action( 'plugins_loaded', array( 'Test_Class', 'init' )); class Test_Class { public static function init() { $class = __CLASS__; new $class; } public function __construct() { Test_Class::my_debug(555777); //construct what you see fit here... } public function my_debug($foo) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag($foo); } //etc... }
There’s a FAQ. The PC class is used to print variables in your Chrome JavaScript console. For example <?php $foo = 'bar'; add_action( 'plugins_loaded', function () use ( $foo ) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag( $foo ); } ); This will output bar in your Chrome console. This reply was modified 6 years, 12 months ago by Fulvio Notarstefano .
Thank you, Fulvio. I understand it. But this class working only in theme templates. But I can not understand, how it integrate for debugging new plugin.. In other plugin I have unavailable PC class error.. This reply was modified 6 years, 12 months ago by viter-z-bayraku .
Are you able to use the other functions of the plugin, like the console terminal or the Google Chrome JavaScript console for variable and error dumping?
I want to use your plugin to debug errors from other new plugin in Google Chrome Development Tool (Javascript Console)
PC::debug("test"); inside this plugin returning Fatal error: Uncaught Error: Class 'PC' not found
I’m sorry. Your code in previous messages is helpful. Thank you!
One question. Can be your code used as a public function inside another class? Like: public function debug($foo){ add_action( 'plugins_loaded', function () use ( $foo ) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag( $foo ); } ); }
I certainly believe so. Mind that this is intended for temporary debugging and you shouldn’t roll PHP Console on a production site. If you need to debug some variable in WordPress, another way of doing it is to store the data you want to output in the console in a WordPress option, e.g. update_option( 'my_test', $data ); Then in the console you’d do return get_option( 'my_test' ); from the terminal and check results.
It’s only for temporary debugging. I’m looking for quick solution for plugin development, based on php classes.
That is helpful for me.. Thank you 🙂 add_action( 'plugins_loaded', array( 'Test_Class', 'init' )); class Test_Class { public static function init() { $class = __CLASS__; new $class; } public function __construct() { Test_Class::my_debug(555777); //construct what you see fit here... } public function my_debug($foo) { if ( ! class_exists( 'PC', false ) ) { PhpConsole\Helper::register(); } PC::my_tag($foo); } //etc... }