diff --git a/.gitignore b/.gitignore
index 8eb312a..bee1b7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ node_modules/*
sass/.sass-cache/*
sass/svg/intermediate/*
sass/symbol/*
+vendor/*
diff --git a/.travis.yml b/.travis.yml
index 37411a7..c1f45e8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,34 +1,108 @@
+sudo: false
+dist: trusty
language: php
-dist: precise
-sudo: required
notifications:
email:
on_success: never
on_failure: change
-php:
-- 5.3
-- 5.6
-- 7
+cache:
+ directories:
+ - vendor
+ - $HOME/.composer/cache
after_success: curl -L https://raw.githubusercontent.com/miya0001/travis2wpplugin/master/deploy.sh
| bash
env:
matrix:
- WP_VERSION=latest WP_MULTISITE=0
global:
+ - WP_TRAVISCI=travis:phpunit
- SVN_REPO: https://plugins.svn.wordpress.org/indieweb-post-kinds/
- GH_REF: https://github.com/dshanske/indieweb-post-kinds.git
- secure: SKEHj0zThPfUhTyTKtgNuzqPp+uvdUUcMWT0ZqyARjnOGII6dO2UDzQIUc5WolgFd/HYIFfaDzBd3+FPdDTunPiwIHxIYcyr2EjvEQLJYM1zqTAUtjEPpztemKRtrnbNd1TQgWIIqIaNk//WuYkuW7+vc/HsyyTm6PGEbHK6zj11UG8ZYT8ru/Sw+PxHebwlz3d+8H6iEvFSX/rkc1kMpntwNMoFYb9PgwhkvtJ6KkVRKu4uMCkXf6BnlVqJSAGdTn+XckDeY+pwgsWGIAPakLD9MKxAq2MMqfmCxTK8uMN3VBetlbbkT7JMaYyU95gw3+3QrcPLlmRLNdbiuguD39J820wjtflEUNCJ3Heg8JF0q4z/69s6n3LEinDxtJNesK/0G//nYjsLaKXARFfnvLSRbhZvxeePsmEWTxEGt9KvoW7iD/vnwYmf1aYeobwBfkCkvA7t5FSNUTMvI8yo33DWdOyFKdWRL0V2JaaOh0H81kaXOEBayplmDfdbNX7y77/bLU863V0JkORSsJNv7ZGl8zR77ja/s1Ep0F3d43QhIoQk40w8SckpLEx+2bUs3J2jNpBeike5cut7RuSPTt7G2AiipTfmPa666f+CsmfNAjd2MYFfB2NL5ZHwjmOuxYE6hicdKt2vwOjLa31hLY/u3bT8s346w+DzIPZmItU=
matrix:
include:
+ - php: 7.2
+ - php: 7.1
+ - php: 7.0
- php: 5.6
- env: WP_VERSION=latest WP_MULTISITE=1 WP_PULUGIN_DEPLOY=1
+ - php: 5.6
+ env: WP_PULUGIN_DEPLOY=1
+ - php: 5.6
+ env: WP_TRAVISCI=travis:phpcs
+ - php: 5.5
+ - php: 5.4
+ - php: 5.3
+ dist: precise
before_script:
-- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
- if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then
- composer global require "phpunit/phpunit=5.7.*"
- elif [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
- composer global require "phpunit/phpunit=4.8.*"
+ # Remove Xdebug for a huge performance increase:
+ if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
+ phpenv config-rm xdebug.ini
+ else
+ echo "xdebug.ini does not exist"
fi
-- bash bin/install-wp-tests.sh wordpress root '' localhost $WP_VERSION
-script: phpunit
+- |
+ # Export Composer's global bin dir to PATH:
+ composer config --list --global
+ export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
+- |
+ # Install the specified version of PHPUnit depending on the PHP version:
+ if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
+ case "$TRAVIS_PHP_VERSION" in
+ 7.2|7.1|7.0|nightly)
+ echo "Using PHPUnit 6.x"
+ composer global require "phpunit/phpunit:^6"
+ ;;
+ 5.6|5.5|5.4|5.3)
+ echo "Using PHPUnit 4.x"
+ composer global require "phpunit/phpunit:^4"
+ ;;
+ 5.2)
+ # Do nothing, use default PHPUnit 3.6.x
+ echo "Using default PHPUnit, hopefully 3.6"
+ ;;
+ *)
+ echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
+ exit 1
+ ;;
+ esac
+ fi
+ if [[ "$WP_TRAVISCI" == "travis:phpcs" ]] ; then
+ composer install
+ fi
+
+- mysql --version
+- phpenv versions
+- php --version
+- php -m
+- which phpunit
+- phpunit --version
+- curl --version
+- grunt --version
+- git --version
+- svn --version
+- locale -a
+before_install:
+- export PATH="$HOME/.composer/vendor/bin:$PATH"
+- |
+ if [[ ! -z "$WP_VERSION" ]] ; then
+ set -e
+ bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
+ set +e
+ fi
+script:
+ - |
+ if [[ ! -z "$WP_VERSION" ]] ; then
+ # Run the build because otherwise there will be a bunch of warnings about
+ # failed `stat` calls from `filemtime()`.
+ echo Running with the following versions:
+ php -v
+ phpunit --version
+ # Run PHPUnit tests
+ phpunit || exit 1
+ WP_MULTISITE=1 phpunit || exit 1
+ fi
+ - |
+ if [[ "$WP_TRAVISCI" == "travis:phpcs" ]] ; then
+ ./vendor/bin/phpcs -p -s -v -n --standard=./phpcs.ruleset.xml --extensions=php
+ fi
diff --git a/bin/patches/README.md b/bin/patches/README.md
new file mode 100644
index 0000000..8ea482c
--- /dev/null
+++ b/bin/patches/README.md
@@ -0,0 +1,2 @@
+This directory contains patches required to build
+older versions of PHP on trusty.
\ No newline at end of file
diff --git a/bin/patches/node.patch b/bin/patches/node.patch
new file mode 100644
index 0000000..e5dbab7
--- /dev/null
+++ b/bin/patches/node.patch
@@ -0,0 +1,51 @@
+--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800
++++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800
+@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
+ RETVAL_FALSE;
+ } else {
+ if (mode == 0) {
++#ifdef LIBXML2_NEW_BUFFER
++ ret = xmlOutputBufferGetSize(buf);
++#else
+ ret = buf->buffer->use;
++#endif
+ if (ret > 0) {
++#ifdef LIBXML2_NEW_BUFFER
++ RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
++#else
+ RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
++#endif
+ } else {
+ RETVAL_EMPTY_STRING();
+ }
+--- ext/dom/documenttype.c 2012-08-06 18:02:16.019640870 +0800
++++ ext/dom/documenttype.c 2012-08-06 18:06:16.612228905 +0800
+@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
+ if (buff != NULL) {
+ xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
+ xmlOutputBufferFlush(buff);
++
++#ifdef LIBXML2_NEW_BUFFER
++ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
++ xmlOutputBufferGetSize(buff), 1);
++#else
+ ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
++#endif
+ (void)xmlOutputBufferClose(buff);
+ return SUCCESS;
+ }
+--- ext/simplexml/simplexml.c 2012-08-06 18:10:44.621017026 +0800
++++ ext/simplexml/simplexml.c 2012-08-06 18:12:48.016270419 +0800
+@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
+
+ xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
+ xmlOutputBufferFlush(outbuf);
++#ifdef LIBXML2_NEW_BUFFER
++ RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
++ xmlOutputBufferGetSize(outbuf), 1);
++#else
+ RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
++#endif
+ xmlOutputBufferClose(outbuf);
+ }
+ } else {
diff --git a/bin/patches/openssl.patch b/bin/patches/openssl.patch
new file mode 100644
index 0000000..3b0e010
--- /dev/null
+++ b/bin/patches/openssl.patch
@@ -0,0 +1,52 @@
+--- ext/openssl/xp_ssl.c
++++ ext/openssl/xp_ssl.c
+@@ -328,10 +328,12 @@ static inline int php_openssl_setup_cryp
+ sslsock->is_client = 1;
+ method = SSLv23_client_method();
+ break;
++#ifndef OPENSSL_NO_SSL2
+ case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
+ sslsock->is_client = 1;
+ method = SSLv2_client_method();
+ break;
++#endif
+ case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
+ sslsock->is_client = 1;
+ method = SSLv3_client_method();
+@@ -348,10 +350,12 @@ static inline int php_openssl_setup_cryp
+ sslsock->is_client = 0;
+ method = SSLv3_server_method();
+ break;
++#ifndef OPENSSL_NO_SSL2
+ case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
+ sslsock->is_client = 0;
+ method = SSLv2_server_method();
+ break;
++#endif
+ case STREAM_CRYPTO_METHOD_TLS_SERVER:
+ sslsock->is_client = 0;
+ method = TLSv1_server_method();
+@@ -629,9 +633,11 @@ static inline int php_openssl_tcp_sockop
+ case STREAM_CRYPTO_METHOD_SSLv23_CLIENT:
+ sock->method = STREAM_CRYPTO_METHOD_SSLv23_SERVER;
+ break;
++#ifndef OPENSSL_NO_SSL2
+ case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
+ sock->method = STREAM_CRYPTO_METHOD_SSLv2_SERVER;
+ break;
++#endif
+ case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
+ sock->method = STREAM_CRYPTO_METHOD_SSLv3_SERVER;
+ break;
+@@ -911,9 +917,11 @@ php_stream *php_openssl_ssl_socket_facto
+ if (strncmp(proto, "ssl", protolen) == 0) {
+ sslsock->enable_on_connect = 1;
+ sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
++#ifndef OPENSSL_NO_SSL2
+ } else if (strncmp(proto, "sslv2", protolen) == 0) {
+ sslsock->enable_on_connect = 1;
+ sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
++#endif
+ } else if (strncmp(proto, "sslv3", protolen) == 0) {
+ sslsock->enable_on_connect = 1;
+ sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..d3f0f29
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,10 @@
+{
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.4",
+ "wimg/php-compatibility": "dev-master",
+ "wp-coding-standards/wpcs": "dev-master"
+ },
+ "scripts": {
+ "lint": "phpcs"
+ }
+}
diff --git a/includes/class-kind-config.php b/includes/class-kind-config.php
index 5d6328e..9ffe7f3 100644
--- a/includes/class-kind-config.php
+++ b/includes/class-kind-config.php
@@ -70,8 +70,10 @@ public static function init() {
public static function admin_init() {
add_settings_section(
'iwt-content',
- __( 'Content Options',
- 'indieweb-post-kinds' ),
+ __(
+ 'Content Options',
+ 'indieweb-post-kinds'
+ ),
array( 'Kind_Config', 'options_callback' ),
'iwt_options'
);
@@ -94,26 +96,27 @@ public static function admin_init() {
'embeds',
__( 'Embed Sites into your Response', 'indieweb-post-kinds' ),
array( 'Kind_Config', 'checkbox_callback' ),
- 'iwt_options', 'iwt-content' , array( 'name' => 'kind_embeds' )
+ 'iwt_options', 'iwt-content' , array(
+ 'name' => 'kind_embeds',
+ )
);
add_settings_field(
'display',
__( 'Display Before Kind', 'indieweb-post-kinds' ),
array( 'Kind_Config', 'radio_callback' ),
- 'iwt_options', 'iwt-content' ,
- array(
+ 'iwt_options', 'iwt-content' ,
+ array(
'name' => 'kind_display',
'class' => Kind_Taxonomy::before_kind() ? '' : 'hidden',
'options' => array(
'icon' => __( 'Show Icon', 'indieweb-post-kinds' ),
'text' => __( 'Show Text', 'indieweb-post-kinds' ),
- 'hide' => __( 'Display Nothing', 'indieweb-post-kinds' )
- )
+ 'hide' => __( 'Display Nothing', 'indieweb-post-kinds' ),
+ ),
)
);
-
if ( POST_KINDS_KSES ) {
add_settings_field(
'contentelements',
@@ -121,7 +124,9 @@ public static function admin_init() {
array( 'Kind_Config', 'textbox_callback' ),
'iwt_options',
'iwt-content',
- array( 'name' => 'kind_kses' )
+ array(
+ 'name' => 'kind_kses',
+ )
);
}
// Add Query Var to Admin
@@ -129,7 +134,7 @@ public static function admin_init() {
}
- public static function query_var($vars) {
+ public static function query_var( $vars ) {
$vars[] = 'kindurl';
return $vars;
}
@@ -161,7 +166,6 @@ public static function admin_menu() {
* @access public
*/
public static function options_callback() {
- esc_html_e( '', 'indieweb-post-kinds' );
}
/**
@@ -169,9 +173,9 @@ public static function options_callback() {
*
* @access public
* @param array $args {
- * Arguments.
+ * Arguments.
*
- * @type string $name Checkbox Name.
+ * @type string $name Checkbox Name.
*/
public static function checkbox_callback( array $args ) {
$option = get_option( $args['name'] );
@@ -194,7 +198,7 @@ public static function textbox_callback( array $args ) {
if ( is_array( $option ) ) {
$option = print_r( $option, true );
}
- echo " ';
+ echo " ';
}
/**
@@ -208,7 +212,7 @@ public static function termcheck_callback() {
$termslist = get_option( 'kind_termslist' );
foreach ( $terms as $key => $value ) {
if ( $value['show'] ) {
- echo "' . $value['singular_name'] . ' - ' . $value['description'] . '
';
+ echo "' . $value['singular_name'] . ' - ' . $value['description'] . '
';
}
}
}
@@ -226,7 +230,7 @@ public static function defaultkind_callback() {
$defaultkind = get_option( 'kind_default' );
foreach ( $terms as $term ) {
- echo '' . Kind_Taxonomy::get_kind_info( $term, 'singular_name' ) . '
';
+ echo '' . Kind_Taxonomy::get_kind_info( $term, 'singular_name' ) . '
';
}
}
@@ -238,7 +242,7 @@ public static function defaultkind_callback() {
public static function radio_callback( array $args ) {
$display = get_option( 'kind_display' );
foreach ( $args['options'] as $key => $value ) {
- echo '' . $value . '
';
+ echo '' . $value . '
';
}
}
@@ -252,9 +256,9 @@ public static function radio_callback( array $args ) {
public static function options_form() {
Kind_Taxonomy::kind_defaultterms();
echo '
'; - esc_html_e( 'Adds support for responding and interacting with other sites.', 'Post kinds' ); + esc_html_e( 'Adds support for responding and interacting with other sites.', 'indieweb-post-kinds' ); echo '