diff --git a/.travis.yml b/.travis.yml index 7bf3a799..7b5c19ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,12 +31,12 @@ install: - npm rebuild node-sass - composer install before_script: -- bash core/bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION +- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION script: - # yarn run gulp build # Because Mimizuku builded after composer install - ls -la resources/style.css resources/index.php vendor/autoload.php - composer test -- bash core/bin/create-release-branch.sh +- bash bin/create-release-branch.sh after_success: - pwd - ls -al diff --git a/README.md b/README.md index abf31920..e3df9312 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Mimizuku is a WordPress starter theme or theme framework for child themes development. - + * GitHub: https://github.com/inc2734/mimizuku/ * Packagist: https://packagist.org/packages/inc2734/mimizuku @@ -85,16 +85,15 @@ themes/mimizuku ### Template hierarchical #### Layout templates -1. /core/templates/\*\*/\*.php +1. /vendor/inc2734/mimizuku-core/src/view/templates/\*\*/\*.php 2. /resources/templates/\*\*/\*.php #### Custo page templates -1. /core/page-templates/\*.php -2. /resources/page-templates/\*.php -3. /page-templats/\*.php +1. /resources/page-templates/\*.php +2. /page-templats/\*.php #### Base templates -1. /core/\*.php +1. /vendor/inc2734/mimizuku-core/src/view/\*.php 2. /resources/\*.php 3. /\*.php diff --git a/core/bin/create-release-branch.sh b/bin/create-release-branch.sh similarity index 100% rename from core/bin/create-release-branch.sh rename to bin/create-release-branch.sh diff --git a/core/bin/install-wp-tests.sh b/bin/install-wp-tests.sh similarity index 100% rename from core/bin/install-wp-tests.sh rename to bin/install-wp-tests.sh diff --git a/core/bin/phpunit.sh b/bin/phpunit.sh similarity index 100% rename from core/bin/phpunit.sh rename to bin/phpunit.sh diff --git a/core/bin/scaffold-tests.sh b/bin/scaffold-tests.sh similarity index 80% rename from core/bin/scaffold-tests.sh rename to bin/scaffold-tests.sh index d8ca758b..33035b09 100644 --- a/core/bin/scaffold-tests.sh +++ b/bin/scaffold-tests.sh @@ -19,15 +19,15 @@ else exit 1; fi -phar extract -f $(which wp) "$themedir/core/bin/wp.phar">/dev/null 2>&1 -wpclidir="$themedir/core/bin/wp.phar$(which wp)" +phar extract -f $(which wp) "$themedir/bin/wp.phar">/dev/null 2>&1 +wpclidir="$themedir/bin/wp.phar$(which wp)" -if [ ! -e "$themedir/core/bin" ]; then - echo "$themedir/core/bin is not exsists." +if [ ! -e "$themedir/bin" ]; then + echo "$themedir/bin is not exsists." exit 1; fi -cp -f "$wpclidir/templates/install-wp-tests.sh" "$themedir/core/bin/install-wp-tests.sh" +cp -f "$wpclidir/templates/install-wp-tests.sh" "$themedir/bin/install-wp-tests.sh" cp -f "$wpclidir/templates/phpunit.xml.dist" "$themedir/phpunit.xml" @@ -51,5 +51,5 @@ else echo "$themedir/tests/test-sample.php is alerady exsists." fi -rm -rf "$themedir/core/bin/wp.phar" +rm -rf "$themedir/bin/wp.phar" echo "done!" diff --git a/core/bin/server.sh b/bin/server.sh similarity index 100% rename from core/bin/server.sh rename to bin/server.sh diff --git a/core/bin/theme-unit-test-ja.sh b/bin/theme-unit-test-ja.sh similarity index 100% rename from core/bin/theme-unit-test-ja.sh rename to bin/theme-unit-test-ja.sh diff --git a/core/bin/theme-unit-test.sh b/bin/theme-unit-test.sh similarity index 100% rename from core/bin/theme-unit-test.sh rename to bin/theme-unit-test.sh diff --git a/core/bin/wpphpunit.sh b/bin/wpphpunit.sh similarity index 68% rename from core/bin/wpphpunit.sh rename to bin/wpphpunit.sh index 424103c7..46990d22 100644 --- a/core/bin/wpphpunit.sh +++ b/bin/wpphpunit.sh @@ -11,7 +11,7 @@ fi cd ${themedir} -if [ -e ${themedir}/core/bin/install-wp-tests.sh ]; then +if [ -e ${themedir}/bin/install-wp-tests.sh ]; then echo 'DROP DATABASE IF EXISTS wordpress_test;' | mysql -u root if [ -e /tmp/wordpress ]; then @@ -22,8 +22,8 @@ if [ -e ${themedir}/core/bin/install-wp-tests.sh ]; then rm -fr /tmp/wordpress-tests-lib fi - bash "${themedir}/core/bin/install-wp-tests.sh" wordpress_test root '' localhost latest; + bash "${themedir}/bin/install-wp-tests.sh" wordpress_test root '' localhost latest; vendor/bin/phpunit --configuration= ${themedir}/phpunit.xml else - echo "${themedir}/core/bin/install-wp-tests.sh not found." + echo "${themedir}/bin/install-wp-tests.sh not found." fi; diff --git a/composer.json b/composer.json index 8bf9f9c9..f2a55e4a 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Mimizuku is a WordPress starter theme or theme framework for child themes development.", "type": "wordpress-theme", "license": "GPL-2.0+", - "version": "4.0.0", + "version": "4.0.1", "authors": [ { "name": "Takashi Kitajima", @@ -19,6 +19,10 @@ "doctrine/instantiator": "1.0.4", "phpunit/php-token-stream": "1.4.11" }, + "require": { + "php": ">=5.6", + "inc2734/mimizuku-core": "^0.1.0" + }, "config": { "process-timeout": 0 }, @@ -27,14 +31,14 @@ "vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs", "vendor/bin/phpcs -p -s -v -n . --standard=./codesniffer.ruleset.xml --extensions=php", "vendor/bin/phpmd ./ text phpmd.ruleset.xml --suffixes php --exclude /vendor/,/tests/", - "bash core/bin/phpunit.sh" + "bash bin/phpunit.sh" ], - "server": "bash core/bin/server.sh", - "scaffold-tests": "bash core/bin/scaffold-tests.sh", - "theme-unit-test": "bash core/bin/theme-unit-test.sh", - "theme-unit-test-ja": "bash core/bin/theme-unit-test-ja.sh", - "wpphpunit": "bash core/bin/wpphpunit.sh", - "phpunit": "bash core/bin/phpunit.sh", + "server": "bash bin/server.sh", + "scaffold-tests": "bash bin/scaffold-tests.sh", + "theme-unit-test": "bash bin/theme-unit-test.sh", + "theme-unit-test-ja": "bash bin/theme-unit-test-ja.sh", + "wpphpunit": "bash bin/wpphpunit.sh", + "phpunit": "bash bin/phpunit.sh", "post-install-cmd": [ "cd vendor/inc2734/wp-basis && yarn install && yarn upgrade && cd ../../../ && yarn run gulp build" ], @@ -46,19 +50,5 @@ "psr-4": { "Mimizuku\\": "" } - }, - "require": { - "php": ">=5.6", - "inc2734/wp-breadcrumbs": "~0.3.1", - "inc2734/wp-oembed-blog-card": "~0.2.4", - "inc2734/wp-view-controller": "~2.1.2", - "inc2734/wp-basis": "~0.4.1", - "inc2734/wp-customizer-framework": "~2.0.4", - "inc2734/wp-github-theme-updater": "~0.1.0", - "inc2734/wp-share-buttons": "~0.5.0", - "inc2734/wp-seo": "~0.3.1", - "inc2734/wp-like-me-box": "~0.1.0", - "inc2734/wp-pure-css-gallery": "~0.1.0", - "inc2734/wp-awesome-widgets": "~0.2.0" } } diff --git a/composer.lock b/composer.lock index 6cadb940..02b8fb31 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,59 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "30047adf3214fb5f0b96b8d7d7eeb687", - "content-hash": "51b02c559ec98fa36bd187858c3b774d", + "hash": "b7b559e05f3e8c8c76d54e5490ec620a", + "content-hash": "a4158f683f1b6eac5515445f6654afd6", "packages": [ + { + "name": "inc2734/mimizuku-core", + "version": "0.1.0", + "source": { + "type": "git", + "url": "https://github.com/inc2734/mimizuku-core.git", + "reference": "bfbc5a3d0065d5fd080e783ce38cb5c29ba2fe6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/inc2734/mimizuku-core/zipball/bfbc5a3d0065d5fd080e783ce38cb5c29ba2fe6d", + "reference": "bfbc5a3d0065d5fd080e783ce38cb5c29ba2fe6d", + "shasum": "" + }, + "require": { + "inc2734/wp-awesome-widgets": "~0.2.0", + "inc2734/wp-basis": "~0.4.1", + "inc2734/wp-breadcrumbs": "~0.3.1", + "inc2734/wp-customizer-framework": "~2.0.4", + "inc2734/wp-github-theme-updater": "~0.1.0", + "inc2734/wp-like-me-box": "~0.1.0", + "inc2734/wp-oembed-blog-card": "~0.2.4", + "inc2734/wp-pure-css-gallery": "~0.1.0", + "inc2734/wp-seo": "~0.3.1", + "inc2734/wp-share-buttons": "~0.5.0", + "inc2734/wp-view-controller": "~2.1.2", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "Inc2734\\Mimizuku_Core\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Takashi Kitajima", + "email": "inc@2inc.org" + } + ], + "description": "This library is core of WordPress theme mimizuku", + "time": "2017-08-14 00:55:07" + }, { "name": "inc2734/wp-awesome-widgets", "version": "0.2.0", diff --git a/core/404.php b/core/404.php deleted file mode 100644 index 72d2f577..00000000 --- a/core/404.php +++ /dev/null @@ -1,10 +0,0 @@ -layout( 'wrapper' ); -$controller->render( '404' ); diff --git a/core/app/bootstrap.php b/core/app/bootstrap.php deleted file mode 100644 index 9bd96064..00000000 --- a/core/app/bootstrap.php +++ /dev/null @@ -1,82 +0,0 @@ - [ - '../core', - ], - 'page-templates' => [ - 'page-templates', - '../core/page-templates', - ], - 'layout' => [ - 'templates/layout/wrapper', - '../core/templates/layout/wrapper', - ], - 'header' => [ - 'templates/layout/header', - '../core/templates/layout/header', - ], - 'sidebar' => [ - 'templates/layout/sidebar', - '../core/templates/layout/sidebar', - ], - 'footer' => [ - 'templates/layout/footer', - '../core/templates/layout/footer', - ], - 'view' => [ - 'templates/view', - '../core/templates/view', - ], - 'static' => [ - 'templates/view/static', - ], - ]; -} ); - -/** - * - Sets up the hooked functions - * - Sets up the customizer - * - Sets up the custom template tags - */ -$includes = array( - '/controller', - '/setup', -); -foreach ( $includes as $include ) { - foreach ( glob( __DIR__ . $include . '/*.php' ) as $file ) { - $template_name = '../core/app/' . str_replace( array( trailingslashit( __DIR__ ), '.php' ), '', $file ); - get_template_part( $template_name ); - } -} diff --git a/core/app/controller/controller.php b/core/app/controller/controller.php deleted file mode 100644 index 973d9220..00000000 --- a/core/app/controller/controller.php +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - layout( 'wrapper' ); -if ( have_posts() ) { - $controller->render( 'archive', get_post_type() ); -} else { - $controller->render( 'none' ); -} diff --git a/core/attachment.php b/core/attachment.php deleted file mode 100644 index 4fdcb915..00000000 --- a/core/attachment.php +++ /dev/null @@ -1,17 +0,0 @@ -layout( 'blank' ); -$controller->render( 'attachment' ); diff --git a/core/footer.php b/core/footer.php deleted file mode 100644 index bda56b4c..00000000 --- a/core/footer.php +++ /dev/null @@ -1,9 +0,0 @@ -layout( 'wrapper' ); -$controller->render( 'front-page' ); diff --git a/core/header.php b/core/header.php deleted file mode 100644 index 9f5a14a3..00000000 --- a/core/header.php +++ /dev/null @@ -1,9 +0,0 @@ -layout( 'wrapper' ); -if ( have_posts() ) { - $controller->render( 'archive', get_post_type() ); -} else { - $controller->render( 'none' ); -} diff --git a/core/search.php b/core/search.php deleted file mode 100644 index a16b18cc..00000000 --- a/core/search.php +++ /dev/null @@ -1,14 +0,0 @@ -layout( 'wrapper' ); -if ( have_posts() ) { - $controller->render( 'archive', 'search' ); -} else { - $controller->render( 'no-match' ); -} diff --git a/core/sidebar.php b/core/sidebar.php deleted file mode 100644 index 9f9f8ee1..00000000 --- a/core/sidebar.php +++ /dev/null @@ -1,9 +0,0 @@ -layout( 'wrapper' ); -$controller->render( 'content', get_post_type() ); diff --git a/core/template-parts/head.php b/core/template-parts/head.php deleted file mode 100644 index 0380998c..00000000 --- a/core/template-parts/head.php +++ /dev/null @@ -1,10 +0,0 @@ - -
- - diff --git a/core/templates/layout/footer/footer.php b/core/templates/layout/footer/footer.php deleted file mode 100644 index bdd5e30e..00000000 --- a/core/templates/layout/footer/footer.php +++ /dev/null @@ -1,10 +0,0 @@ - - diff --git a/core/templates/layout/header/header.php b/core/templates/layout/header/header.php deleted file mode 100644 index 4f8e1972..00000000 --- a/core/templates/layout/header/header.php +++ /dev/null @@ -1,10 +0,0 @@ - -
-
-
-
-
- -
- - diff --git a/core/templates/view/none.php b/core/templates/view/none.php deleted file mode 100644 index 269989ab..00000000 --- a/core/templates/view/none.php +++ /dev/null @@ -1,10 +0,0 @@ - -- -
diff --git a/gulpfile.js b/gulpfile.js index f1534c47..5bab177b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -166,8 +166,8 @@ gulp.task('release', function(){ '!node_modules/**', '!vendor', '!vendor/**', - '!core/bin', - '!core/bin/**', + '!bin', + '!bin/**', '!release', '!release/**', '!codesniffer.ruleset.xml', diff --git a/core/mimizuku.svg b/mimizuku.svg similarity index 100% rename from core/mimizuku.svg rename to mimizuku.svg diff --git a/resources/functions.php b/resources/functions.php index c130226b..7a3c2a23 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -5,10 +5,31 @@ * @license GPL-2.0+ */ +use Inc2734\Mimizuku_Core\Core; + +/** +* Uses composer autoloader +*/ +require_once( get_theme_file_path( '/../vendor/autoload.php' ) ); + +/** + * Make theme available for translation + * + * @return void + */ +load_theme_textdomain( 'mimizuku', get_template_directory() . '/languages' ); + /** * Loads Mimizuku Bootstrap */ -include_once( __DIR__ . '/../core/app/bootstrap.php' ); +new Core(); + +/** + * Sets the content width in pixels, based on the theme's design and stylesheet. + */ +if ( ! isset( $content_width ) ) { + $content_width = apply_filters( 'mimizuku_content_width', 1152 ); +} /** * Loads theme setup files diff --git a/resources/templates/layout/wrapper/blank.php b/resources/templates/layout/wrapper/blank.php index 4479bbd3..71fdd509 100644 --- a/resources/templates/layout/wrapper/blank.php +++ b/resources/templates/layout/wrapper/blank.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + > view(); ?> diff --git a/resources/templates/layout/wrapper/left-sidebar.php b/resources/templates/layout/wrapper/left-sidebar.php index 9f6c95de..34eac6d9 100644 --- a/resources/templates/layout/wrapper/left-sidebar.php +++ b/resources/templates/layout/wrapper/left-sidebar.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + > diff --git a/resources/templates/layout/wrapper/one-column-fluid.php b/resources/templates/layout/wrapper/one-column-fluid.php index 2768cc6e..d9d390aa 100644 --- a/resources/templates/layout/wrapper/one-column-fluid.php +++ b/resources/templates/layout/wrapper/one-column-fluid.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + > diff --git a/resources/templates/layout/wrapper/one-column-slim.php b/resources/templates/layout/wrapper/one-column-slim.php index 7995879d..60303c8d 100644 --- a/resources/templates/layout/wrapper/one-column-slim.php +++ b/resources/templates/layout/wrapper/one-column-slim.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + > diff --git a/resources/templates/layout/wrapper/one-column.php b/resources/templates/layout/wrapper/one-column.php index 063b1c63..6cfb30a7 100644 --- a/resources/templates/layout/wrapper/one-column.php +++ b/resources/templates/layout/wrapper/one-column.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + > diff --git a/resources/templates/layout/wrapper/right-sidebar.php b/resources/templates/layout/wrapper/right-sidebar.php index 0039c3f0..e5000c8f 100644 --- a/resources/templates/layout/wrapper/right-sidebar.php +++ b/resources/templates/layout/wrapper/right-sidebar.php @@ -7,7 +7,7 @@ ?> data-sticky-footer="true"> - + >