[wp-trac] [WordPress Trac] #11549: Enable loading of the WordPress environment from external php script
WordPress Trac
wp-trac at lists.automattic.com
Mon Dec 21 19:54:34 UTC 2009
#11549: Enable loading of the WordPress environment from external php script
-------------------------+--------------------------------------------------
Reporter: mp2300 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: General | Version:
Severity: minor | Keywords: assign by reference
-------------------------+--------------------------------------------------
For some integration projects, it is useful to load the WordPress
environment from an external php script. This can be done by including wp-
load.php
Afterwards all the WordPress functions can be used.
This is only possible if wp-load.php is included from the global scope. If
it is included from inside a function, it will fail. This limitation makes
it difficult to integrate WordPress with other projects.
wp-load.php fails because of the use of global objects and assign by
reference. A simple solution would be to declare $wpdb,
$wp_widget_factory, $_wp_deprecated_widgets_callbacks for global in wp-
settings.php
The creation of WP_Widget_Factory in wp-settings.php needs to be changed
from
$wp_widget_factory =& new WP_Widget_Factory();
to
$wp_widget_factory = new WP_Widget_Factory();
The syntax for creation of WP_Widget_Factory should be conditioned by the
PHP version, to maintain backwards compatibility with PHP 4.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11549>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list