<?php class gdTemplateDB {
[...]
function rewrite_dependencies($section, $id) {
global $wpdb, $table_prefix;
/*var_dump($this);
die;*/
**include($this->plugin_path.'code/t2/templates.php');**
[...]
}
?>
I’m digging through the code of a wordpress plugin called GD star rating.
There are two “magical” things that I cannot figure out why:
- The class above apparently has no parents, but when I var_dump the $this pointer, it turns out to be an instance of another class called GDStarRating, and GDStarRating also has no parents! And, you know that the $this pointer cannot be abitrarily reinstantiated. So I can’t understand why the $this pointer behaves like that.
- The function
rewrite_dependenciesis statically called from another class (gdTemplateDB::rewrite_dependencies, not$instance->rewrite_dependencies) called gdsrAdmFunc, and that class also doesn’t have any parent-child relationships with GdStarRating. But it works just fine.
Please let me know, what can possibly cause those “magic” things?
here
a::aa()outputsHere $this in class a is object of class b because,
function
aaof classais called from functionbbclassb.function
bbof classbis called from object of classb.