Skip to content

Commit

Permalink
Merge branch 'hotfix/1.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
abrain committed Aug 16, 2016
2 parents 79464de + d3fc021 commit 690c20a
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 74 deletions.
35 changes: 18 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: php

notifications:
email:
on_success: change
on_success: never
on_failure: always

php:
Expand All @@ -14,34 +14,35 @@ php:
- hhvm

env:
- WP_VERSION=3.7.13 WP_MULTISITE=0
- WP_VERSION=3.8.13 WP_MULTISITE=0
- WP_VERSION=3.9.11 WP_MULTISITE=0
- WP_VERSION=4.0.10 WP_MULTISITE=0
- WP_VERSION=4.1.10 WP_MULTISITE=0
- WP_VERSION=4.2.7 WP_MULTISITE=0
- WP_VERSION=4.3.3 WP_MULTISITE=0
- WP_VERSION=4.4.2 WP_MULTISITE=0
- WP_VERSION=3.7.15 WP_MULTISITE=0
- WP_VERSION=3.8.15 WP_MULTISITE=0
- WP_VERSION=3.9.13 WP_MULTISITE=0
- WP_VERSION=4.0.12 WP_MULTISITE=0
- WP_VERSION=4.1.12 WP_MULTISITE=0
- WP_VERSION=4.2.9 WP_MULTISITE=0
- WP_VERSION=4.3.5 WP_MULTISITE=0
- WP_VERSION=4.4.4 WP_MULTISITE=0
- WP_VERSION=4.5.3 WP_MULTISITE=0
- WP_VERSION=nightly WP_MULTISITE=0

matrix:
exclude:
- php: '5.5'
env: WP_VERSION=3.7.13 WP_MULTISITE=0
env: WP_VERSION=3.7.15 WP_MULTISITE=0
- php: '5.6'
env: WP_VERSION=3.7.13 WP_MULTISITE=0
env: WP_VERSION=3.7.15 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=3.7.13 WP_MULTISITE=0
env: WP_VERSION=3.7.15 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=3.8.13 WP_MULTISITE=0
env: WP_VERSION=3.8.15 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=3.9.11 WP_MULTISITE=0
env: WP_VERSION=3.9.13 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=4.0.10 WP_MULTISITE=0
env: WP_VERSION=4.0.12 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=4.1.10 WP_MULTISITE=0
env: WP_VERSION=4.1.12 WP_MULTISITE=0
- php: '7.0'
env: WP_VERSION=4.2.7 WP_MULTISITE=0
env: WP_VERSION=4.2.9 WP_MULTISITE=0
allow_failures:
- php: hhvm
- env: WP_VERSION=nightly WP_MULTISITE=0
Expand Down
14 changes: 10 additions & 4 deletions bin/install-wp-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
exit 1
fi

Expand All @@ -10,6 +10,7 @@ DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}

WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
Expand Down Expand Up @@ -81,11 +82,11 @@ install_test_suite() {
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
# remove all forward slashes in the end
WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
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
Expand All @@ -95,6 +96,11 @@ install_test_suite() {
}

install_db() {

if [ ${SKIP_DB_CREATE} = "true" ]; then
return 0
fi

# parse DB_HOST for port or socket references
local PARTS=(${DB_HOST//\:/ })
local DB_HOSTNAME=${PARTS[0]};
Expand Down
17 changes: 17 additions & 0 deletions src/einsatzverwaltung-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct($core, $utilities)
private function addHooks()
{
add_action('add_meta_boxes_einsatz', array($this, 'addMetaBoxes'));
add_action('admin_menu', array($this, 'adjustTaxonomies'));
add_action('admin_enqueue_scripts', array($this, 'enqueueEditScripts'));
add_filter('manage_edit-einsatz_columns', array($this, 'filterColumnsEinsatz'));
add_action('manage_einsatz_posts_custom_column', array($this, 'filterColumnContentEinsatz'), 10, 2);
Expand Down Expand Up @@ -66,6 +67,21 @@ public function addMetaBoxes()
);
}

/**
* Nimmt Anpassungen in Bezug auf Taxonomien vor
*/
public function adjustTaxonomies()
{
// Kategorieauswahl beim Bearbeiten von Einsatzberichten entfernen
remove_meta_box('categorydiv', 'einsatz', 'side');

// Kategorien als Untermenüpunkt von Einsatzberichten verstecken
remove_submenu_page(
'edit.php?post_type=einsatz',
'edit-tags.php?taxonomy=category&amp;post_type=einsatz'
);
}

/**
* Zusätzliche Skripte im Admin-Bereich einbinden
*
Expand Down Expand Up @@ -257,6 +273,7 @@ public function filterColumnsEinsatz($columns)
{
unset($columns['author']);
unset($columns['date']);
unset($columns['categories']);
$columns['title'] = __('Einsatzbericht', 'einsatzverwaltung');
$columns['e_nummer'] = __('Nummer', 'einsatzverwaltung');
$columns['e_alarmzeit'] = __('Alarmzeit', 'einsatzverwaltung');
Expand Down
4 changes: 2 additions & 2 deletions src/einsatzverwaltung-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class Core
{
const VERSION = '1.2.2';
const VERSION = '1.2.3';
const DB_VERSION = 10;

public $pluginFile;
Expand Down Expand Up @@ -91,7 +91,7 @@ class Core
'edit_published_posts' => 'edit_published_einsatzberichte'
),
'menu_position' => 5,
'taxonomies' => array('post_tag'),
'taxonomies' => array('post_tag', 'category'),
'delete_with_user' => false,
);

Expand Down
102 changes: 54 additions & 48 deletions src/einsatzverwaltung-taxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private function addHooks()
add_action('manage_exteinsatzmittel_custom_column', array($this, 'columnContentExteinsatzmittel'), 10, 3);
add_action('edited_term', array($this, 'saveTerm'), 10, 3);
add_action('created_term', array($this, 'saveTerm'), 10, 3);
add_action('delete_term', array($this, 'deleteTerm'), 10, 4);
add_action('delete_term', array($this, 'deleteTerm'), 10, 3);
add_action('split_shared_term', array($this, 'splitSharedTerms'), 10, 4);
}

Expand All @@ -64,11 +64,11 @@ public function addFieldsExteinsatzmittelNew()
*/
public function addFieldsExteinsatzmittelEdit($tag)
{
$exteinsatzmittel_url = self::getTermField($tag->term_id, 'exteinsatzmittel', 'url', '');
$exteinsatzmittelUrl = self::getTermField($tag->term_id, 'exteinsatzmittel', 'url', '');

echo '<tr class="form-field">';
echo '<th scope="row"><label for="url">URL</label></th>';
echo '<td><input name="url" id="url" type="text" value="'.esc_attr($exteinsatzmittel_url).'" size="40" />';
echo '<td><input name="url" id="url" type="text" value="'.esc_attr($exteinsatzmittelUrl).'" size="40" />';
echo '<p class="description">URL zu mehr Informationen &uuml;ber ein externes Einsatzmittel, beispielsweise dessen Webseite.</p></td>';
echo '</tr>';
}
Expand Down Expand Up @@ -99,12 +99,12 @@ public function addFieldsFahrzeugNew()
*/
public function addFieldsFahrzeugEdit($tag)
{
$fahrzeug_pid = self::getTermField($tag->term_id, 'fahrzeug', 'fahrzeugpid', '');
$fahrzeugPid = self::getTermField($tag->term_id, 'fahrzeug', 'fahrzeugpid', '');

echo '<tr class="form-field">';
echo '<th scope="row"><label for="fahrzeugpid">Fahrzeugseite</label></th><td>';
$this->utilities->dropdownPosts(array(
'selected' => $fahrzeug_pid,
'selected' => $fahrzeugPid,
'name' => 'fahrzeugpid',
'post_type' => $this->getFahrzeugPostTypes()
));
Expand All @@ -126,20 +126,23 @@ public function addFieldsFahrzeugEdit($tag)
*/
public function customColumnsFahrzeug($columns)
{
// Fahrzeugseite nach der Spalte 'Beschreibung' einblenden, ansonsten am Ende
$filteredColumns = array();
if (array_key_exists('description', $columns)) {
foreach ($columns as $slug => $name) {
$filteredColumns[$slug] = $name;
if ($slug == 'description') {
$filteredColumns['fahrzeugpage'] = 'Fahrzeugseite';
$filteredColumns['vehicleorder'] = 'Reihenfolge';
}
}
} else {

// Fahrzeugseite nach der Spalte 'Beschreibung' einblenden, ansonsten am Ende
if (!array_key_exists('description', $columns)) {
$filteredColumns['fahrzeugpage'] = 'Fahrzeugseite';
$filteredColumns['vehicleorder'] = 'Reihenfolge';
return $filteredColumns;
}

foreach ($columns as $slug => $name) {
$filteredColumns[$slug] = $name;
if ($slug == 'description') {
$filteredColumns['fahrzeugpage'] = 'Fahrzeugseite';
$filteredColumns['vehicleorder'] = 'Reihenfolge';
}
}

return $filteredColumns;
}

Expand All @@ -159,16 +162,16 @@ public function columnContentFahrzeug($string, $columnName, $termId)
$fahrzeugpid = self::getTermField($termId, 'fahrzeug', 'fahrzeugpid');
if (false === $fahrzeugpid) {
return '&nbsp;';
} else {
$url = get_permalink($fahrzeugpid);
$title = get_the_title($fahrzeugpid);
return sprintf(
'<a href="%1$s" title="&quot;%2$s&quot; ansehen" target="_blank">%3$s</a>',
esc_attr($url),
esc_attr($title),
esc_html($title)
);
}

$url = get_permalink($fahrzeugpid);
$title = get_the_title($fahrzeugpid);
return sprintf(
'<a href="%1$s" title="&quot;%2$s&quot; ansehen" target="_blank">%3$s</a>',
esc_attr($url),
esc_attr($title),
esc_html($title)
);
break;
case 'vehicleorder':
$vehicleOrder = self::getTermField($termId, 'fahrzeug', 'vehicleorder');
Expand All @@ -190,16 +193,18 @@ public function customColumnsExteinsatzmittel($columns)
{
// URL nach der Spalte 'Beschreibung' einblenden, ansonsten am Ende
$filteredColumns = array();
if (array_key_exists('description', $columns)) {
foreach ($columns as $slug => $name) {
$filteredColumns[$slug] = $name;
if ($slug == 'description') {
$filteredColumns['exturl'] = 'URL';
}
}
} else {
if (!array_key_exists('description', $columns)) {
$filteredColumns['exturl'] = 'URL';
return $filteredColumns;
}

foreach ($columns as $slug => $name) {
$filteredColumns[$slug] = $name;
if ($slug == 'description') {
$filteredColumns['exturl'] = 'URL';
}
}

return $filteredColumns;
}

Expand All @@ -217,13 +222,13 @@ public function columnContentExteinsatzmittel($string, $columnName, $termId)
$url = self::getTermField($termId, 'exteinsatzmittel', 'url');
if (false === $url) {
return '&nbsp;';
} else {
return sprintf(
'<a href="%1$s" title="%1$s besuchen" target="_blank">%2$s</a>',
esc_attr($url),
esc_html($url)
);
}

return sprintf(
'<a href="%1$s" title="%1$s besuchen" target="_blank">%2$s</a>',
esc_attr($url),
esc_html($url)
);
}

/**
Expand All @@ -235,21 +240,23 @@ public function columnContentExteinsatzmittel($string, $columnName, $termId)
*/
public function saveTerm($termId, $ttId, $taxonomy)
{
$evw_taxonomies = $this->getTaxonomies();
$evwTaxonomies = $this->getTaxonomies();

if (!array_key_exists($taxonomy, $evw_taxonomies) || !is_array($evw_taxonomies[$taxonomy])) {
if (!array_key_exists($taxonomy, $evwTaxonomies) || !is_array($evwTaxonomies[$taxonomy])) {
return;
}

foreach ($evw_taxonomies[$taxonomy] as $field) {
foreach ($evwTaxonomies[$taxonomy] as $field) {
if (isset($field) && !empty($field) && isset($_POST[$field])) {
$value = $_POST[$field]; //FIXME sanitize
$key = self::getTermOptionKey($termId, $taxonomy, $field);

if (empty($value)) {
delete_option($key);
} else {
update_option($key, $value);
continue;
}

update_option($key, $value);
}
}
}
Expand All @@ -260,21 +267,20 @@ public function saveTerm($termId, $ttId, $taxonomy)
* @param int $termId Term ID
* @param int $ttId Term taxonomy ID
* @param string $taxonomy Taxonomy slug
* @param mixed $deletedTerm Kopie des bereits gelöschten Terms
*/
public function deleteTerm($termId, $ttId, $taxonomy, $deletedTerm)
public function deleteTerm($termId, $ttId, $taxonomy)
{
if (!isset($taxonomy)) {
return;
}

$evw_taxonomies = $this->getTaxonomies();
$evwTaxonomies = $this->getTaxonomies();

if (!array_key_exists($taxonomy, $evw_taxonomies) || !is_array($evw_taxonomies[$taxonomy])) {
if (!array_key_exists($taxonomy, $evwTaxonomies) || !is_array($evwTaxonomies[$taxonomy])) {
return;
}

foreach ($evw_taxonomies[$taxonomy] as $field) {
foreach ($evwTaxonomies[$taxonomy] as $field) {
if (isset($field) && !empty($field)) {
delete_option(self::getTermOptionKey($termId, $taxonomy, $field));
}
Expand Down
2 changes: 1 addition & 1 deletion src/einsatzverwaltung.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Einsatzverwaltung
Plugin URI: https://einsatzverwaltung.abrain.de
Description: Verwaltung und Darstellung von Einsatzberichten der Feuerwehr und anderer Hilfsorganisationen
Version: 1.2.2
Version: 1.2.3
Author: Andreas Brain
Author URI: https://www.abrain.de
License: GPLv2
Expand Down
13 changes: 11 additions & 2 deletions src/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: abrain
Donate link: https://einsatzverwaltung.abrain.de/unterstuetzen/
Tags: Feuerwehr, Einsatz, Rettung, Rettungsdienst, THW, HiOrg, Wasserwacht, Bergrettung
Requires at least: 3.7.0
Tested up to: 4.5
Stable tag: 1.2.2
Tested up to: 4.6
Stable tag: 1.2.3
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -70,6 +70,15 @@ Nein, mehr gibt es [hier](https://einsatzverwaltung.abrain.de/faq/).

== Changelog ==

= 1.2.3 =
Verbesserungen:

* Kompatibilit&auml;t von Einsatzberichten und Kategorien verbessert

Sonstiges:

* Getestet mit WordPress 4.6

= 1.2.2 =
Verbesserungen:

Expand Down

0 comments on commit 690c20a

Please sign in to comment.