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

Use vendorized version of scbFramework #507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
vendor/
composer.phar
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ env:
- WP_VERSION=3.9.8 WP_MULTISITE=0
- WP_VERSION=3.9.8 WP_MULTISITE=1

install:
- composer install
install: bin/build

before_script:
- bash bin/install-wp-tests.sh wordpress_test travis '' localhost $WP_VERSION
Expand Down
4 changes: 4 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#!/usr/bin/env bash

rm -rf vendor/
composer install

vendor/scribu/scb-framework/bin/vendorize P2P
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 8 additions & 14 deletions posts-to-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ function _p2p_load() {
P2P_Shortcodes::init();

register_uninstall_hook( __FILE__, array( 'P2P_Storage', 'uninstall' ) );

if ( is_admin() )
_p2p_load_admin();
}

function _p2p_load_admin() {
Expand All @@ -49,22 +46,19 @@ function _p2p_load_admin() {
new P2P_Tools_Page;
}

function _p2p_init() {
// Safe hook for calling p2p_register_connection_type()
do_action( 'p2p_init' );
if ( is_dir( dirname( __FILE__ ) . '/vendor' ) ) {
require_once dirname( __FILE__ ) . '/vendor/autoload.php';
}

if ( is_dir( dirname( __FILE__ ) . '/vendor' ) ) {
// Not using vendor/autload.php because scb-framework/load.php has better compatibility
_p2p_load();

if (!class_exists('Mustache_Autoloader')) {
require_once dirname( __FILE__ ) . '/vendor/mustache/mustache/src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
}
if ( is_admin() )
_p2p_load_admin();

require_once dirname( __FILE__ ) . '/vendor/scribu/scb-framework/load.php';
function _p2p_init() {
// Safe hook for calling p2p_register_connection_type()
do_action( 'p2p_init' );
}

scb_init( '_p2p_load' );
add_action( 'wp_loaded', '_p2p_init' );