Created
December 3, 2020 07:55
-
-
Save michaeluno/941e04edcd4f3a425ab08ee1d60678b8 to your computer and use it in GitHub Desktop.
A WordPress plugin that demonstrates the use of overloading magic method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Test - Overloading Magic Method | |
* Description: Tests overloading matic methods. | |
* Author: Michael Uno | |
* Author URI: http://en.michaeluno.jp/ | |
* Version: 0.0.1 | |
*/ | |
class TestOverloadingMagicMethod { | |
public function __construct() { | |
add_action( 'do_something', array( $this, 'doSomething' ) ); | |
add_action( 'plugins_loaded', array( $this, 'load' ) ); | |
} | |
public function load() { | |
do_action( 'do_something' ); | |
} | |
public function __call( $sName, $aArguments ) { | |
error_log( 'Called the method: ' . $sName ); | |
} | |
} | |
new TestOverloadingMagicMethod; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment