Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix better asset routing #36

Merged
merged 6 commits into from
Mar 29, 2016
Merged

Conversation

georgestephanis
Copy link
Member

This resolves several issues with the plugin folder being extra fragile from potentially being misnamed from o2 to something else.

Also adds some extra consistency within the project regarding the inclusion of files and adds some PHP 5.2 compat to boot by removing __DIR__

Previously, if you installed O2 by downloading `o2-master.zip` and
installed that zip file, it would go into
`/wp-content/plugins/o2-master/o2.php` and such -- which this method of
specifying the path to assets would fail on.

By being more dynamic as to specifying what folder we're in, we'll be
more reliable however we're used.
__DIR__ is PHP 5.3+ only, and will not function in PHP 5.2

Where possible, swap it out with a `O2__DIR__` constant for less code
churn and easier discoverability later.
This will grant us greater flexibility if we want to move the class to a
subfolder at some point.
This is for consistency with the coding styles in the rest of the
project.
@@ -17,7 +17,7 @@ static function should_load_ui( $load ) {
}

static function enqueue_scripts() {
wp_enqueue_script( 'o2-suggestions', plugins_url( 'js/suggestions.js', __FILE__ ), array( 'jquery' ) );
wp_enqueue_script( 'o2-suggestions', plugins_url( 'modules/suggestions/js/suggestions.js', , O2__FILE__ ), array( 'jquery' ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you got a copy-paste typo with the commas here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@georgestephanis georgestephanis merged commit 7c9632f into master Mar 29, 2016
@georgestephanis georgestephanis deleted the fix/better-asset-routing branch March 29, 2016 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants