From 4dc739713e9d37901284e02b7b6f0d484bceb0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=BCtte?= Date: Mon, 16 Jun 2014 19:05:51 +0200 Subject: [PATCH 1/7] bump version --- freifunkmeta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freifunkmeta.php b/freifunkmeta.php index 8818cb7..7faa142 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -3,7 +3,7 @@ Plugin Name: Freifunk Metadata Shortcodes Plugin URI: http://mschuette.name/ Description: Defines shortcodes to display Freifunk metadata -Version: 0.4dev +Version: 0.4 Author: Martin Schuette Author URI: http://mschuette.name/ */ From 92823fe3eb6a51573eefae9cd821e93586d2051f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=BCtte?= Date: Fri, 25 Sep 2015 10:26:44 +0200 Subject: [PATCH 2/7] test travis-ci containers see http://docs.travis-ci.com/user/migrating-from-legacy/ --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 215bc4a..38b233c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: php +sudo: false php: - 5.3 From 19f565e7ebaceb9c30865696242998997b45e052 Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Fri, 9 Oct 2015 07:56:18 -0700 Subject: [PATCH 3/7] Use proper tests checkout for WP_VERSION=latest --- bin/install-wp-tests.sh | 64 +++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 15 deletions(-) diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh index 1e39064..0aaf09f 100644 --- a/bin/install-wp-tests.sh +++ b/bin/install-wp-tests.sh @@ -12,23 +12,50 @@ DB_HOST=${4-localhost} WP_VERSION=${5-latest} WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib} -WP_CORE_DIR=/tmp/wordpress/ +WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/} + +download() { + if [ `which curl` ]; then + curl -s "$1" > "$2"; + elif [ `which wget` ]; then + wget -nv -O "$2" "$1" + fi +} + +if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then + WP_TESTS_TAG="tags/$WP_VERSION" +else + # http serves a single offer, whereas https serves multiple. we only want one + download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json + LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + if [[ -z "$LATEST_VERSION" ]]; then + echo "Latest WordPress version could not be found" + exit 1 + fi + WP_TESTS_TAG="tags/$LATEST_VERSION" +fi set -ex install_wp() { + + if [ -d $WP_CORE_DIR ]; then + return; + fi + mkdir -p $WP_CORE_DIR - if [ $WP_VERSION == 'latest' ]; then + if [ $WP_VERSION == 'latest' ]; then local ARCHIVE_NAME='latest' else local ARCHIVE_NAME="wordpress-$WP_VERSION" fi - wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/${ARCHIVE_NAME}.tar.gz + download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR - wget -nv -O $WP_CORE_DIR/wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php + download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php } install_test_suite() { @@ -39,17 +66,24 @@ install_test_suite() { local ioption='-i' fi - # set up testing suite - mkdir -p $WP_TESTS_DIR - cd $WP_TESTS_DIR - svn co --quiet http://develop.svn.wordpress.org/trunk/tests/phpunit/includes/ + # set up testing suite if it doesn't yet exist + if [ ! -d $WP_TESTS_DIR ]; then + # set up testing suite + mkdir -p $WP_TESTS_DIR + svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes + fi + + cd $WP_TESTS_DIR + + if [ ! -f wp-tests-config.php ]; then + download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php + sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php + fi - wget -nv -O wp-tests-config.php http://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php - sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" wp-tests-config.php - sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" wp-tests-config.php - sed $ioption "s/yourusernamehere/$DB_USER/" wp-tests-config.php - sed $ioption "s/yourpasswordhere/$DB_PASS/" wp-tests-config.php - sed $ioption "s|localhost|${DB_HOST}|" wp-tests-config.php } install_db() { @@ -60,7 +94,7 @@ install_db() { local EXTRA="" if ! [ -z $DB_HOSTNAME ] ; then - if [[ "$DB_SOCK_OR_PORT" =~ ^[0-9]+$ ]] ; then + if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" elif ! [ -z $DB_SOCK_OR_PORT ] ; then EXTRA=" --socket=$DB_SOCK_OR_PORT" From b1342025240501e6db4dac6b00002ee50221b124 Mon Sep 17 00:00:00 2001 From: 4ndr3 <4ndr3@users.noreply.github.com> Date: Sat, 10 Oct 2015 15:28:47 +0200 Subject: [PATCH 4/7] Ausgabe der Dienste tabellarisiert --- freifunkmeta.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/freifunkmeta.php b/freifunkmeta.php index 7faa142..72ea73f 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -294,15 +294,16 @@ EOT; return ''; } $services = $citydata['services']; - $outstr = '
    '; - foreach ( $services as $service ) { - $outstr .= sprintf( - '
  • %s (%s): %s
  • ', - $service['serviceName'], $service['serviceDescription'], - $service['internalUri'], $service['internalUri'] - ); - } - $outstr .= '
'; + $outstr = ''; + foreach ( $services as $service ) { + $outstr .= sprintf( + '', + $service['serviceName'], $service['serviceDescription'], + $service['internalUri'], $service['internalUri'], + $service['externalUri'], $service['externalUri'] + ); + } + $outstr .= '
DienstBeschreibungFreifunk URIInternet URI
%s%s%s%s
'; return $outstr; } From 47d64c8cceb43fcee9d4ef8385792145a37e02c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=BCtte?= Date: Fri, 11 Mar 2016 15:25:29 +0100 Subject: [PATCH 5/7] fix test_output_ff_services --- tests/test-LowLevelTests.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test-LowLevelTests.php b/tests/test-LowLevelTests.php index 4651be0..e6fa392 100644 --- a/tests/test-LowLevelTests.php +++ b/tests/test-LowLevelTests.php @@ -126,9 +126,13 @@ class LowLevelTests extends PHPUnit_Framework_TestCase { 'serviceName' => 'jabber', 'serviceDescription' => 'chat', 'internalUri' => 'xmpp://jabber.local', + 'externalUri' => 'xmpp://jabber.example.org', ))); $ret = $this->FFM->output_ff_services($data); - $this->assertEquals('', $ret); + $this->assertEquals(''. + ''. + ''. + '
DienstBeschreibungFreifunk URIInternet URI
jabberchatxmpp://jabber.localxmpp://jabber.example.org
', $ret); } function test_output_ff_contact_null() { From 9bf0a5fad8a62daa2f7adf0f55476dddba5920b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=BCtte?= Date: Fri, 11 Mar 2016 15:35:39 +0100 Subject: [PATCH 6/7] handle service without `externalUri` backward compatibility, issue found in unit tests --- freifunkmeta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freifunkmeta.php b/freifunkmeta.php index 72ea73f..235e39c 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -300,7 +300,7 @@ EOT; '%s%s%s%s', $service['serviceName'], $service['serviceDescription'], $service['internalUri'], $service['internalUri'], - $service['externalUri'], $service['externalUri'] + $service['externalUri']?:'#', $service['externalUri']?:'' ); } $outstr .= ''; From 766f7772a5d852d1647f5d0d73868e58560f2660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=BCtte?= Date: Fri, 11 Mar 2016 16:17:20 +0100 Subject: [PATCH 7/7] bugfix, again --- freifunkmeta.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/freifunkmeta.php b/freifunkmeta.php index 235e39c..ca39e8e 100644 --- a/freifunkmeta.php +++ b/freifunkmeta.php @@ -296,11 +296,13 @@ EOT; $services = $citydata['services']; $outstr = ''; foreach ( $services as $service ) { + $internalUri = isset($service['internalUri']) ? $service['internalUri'] : ''; + $externalUri = isset($service['externalUri']) ? $service['externalUri'] : ''; $outstr .= sprintf( '', - $service['serviceName'], $service['serviceDescription'], - $service['internalUri'], $service['internalUri'], - $service['externalUri']?:'#', $service['externalUri']?:'' + $service['serviceName'], $service['serviceDescription'], + $internalUri, $internalUri, + $externalUri, $externalUri ); } $outstr .= '
DienstBeschreibungFreifunk URIInternet URI
%s%s%s%s
';