PHP Callback Method

Jeremy

in memoriam 1991-2020
Has anyone figured out how XenForo checks to see if a callback method is valid? I'm trying to do some validation for the BB Code Manager that checks one of two things:
a) That you don't define both methods of replacement (Simple & PHP)
b) That the PHP call back method is valid.

Now, I'm mainly looking at b) here (still trying to figure out how to setup checking the inputted data, but I'll get that soon). I have read and reread the add-on DataWriter and Controller. I'm at a loss here. Its probably something simple I'm missing again. (The last one was extremely simple, solved by Shadab.)
 
It uses the following code (from library/XenForo/DataWriter/CodeEventListener.php)
PHP:
		if ($this->isChanged('callback_class') || $this->isChanged('callback_method'))
		{
			$class = $this->get('callback_class');
			$method = $this->get('callback_method');

			if (!XenForo_Application::autoload($class) || !method_exists($class, $method))
			{
				$this->error(new XenForo_Phrase('please_enter_valid_callback_method'), 'callback_method');
			}
		}

You haven't found the code in the add-on datawriter as XenForo doesn't seem to check if add-on install/uninstall callbacks are valid, but it checks if callbacks defined for event listeners and pages are valid.
 
It uses the following code (from library/XenForo/DataWriter/CodeEventListener.php)
PHP:
		if ($this->isChanged('callback_class') || $this->isChanged('callback_method'))
		{
			$class = $this->get('callback_class');
			$method = $this->get('callback_method');

			if (!XenForo_Application::autoload($class) || !method_exists($class, $method))
			{
				$this->error(new XenForo_Phrase('please_enter_valid_callback_method'), 'callback_method');
			}
		}

You haven't found the code in the add-on datawriter as XenForo doesn't seem to check if add-on install/uninstall callbacks are valid, but it checks if callbacks defined for event listeners and pages are valid.

Thank you. I could have sworn add-ons checked it. It was driving me crazy that I couldn't find it. *sigh* I guess that's what you get for trying to read it in a hurry then again at 1 am.
 
Top Bottom