apply WP coding standard, as tested by phpcs

This commit is contained in:
Martin Schütte 2014-06-10 18:04:52 +00:00 committed by Martin Schütte
parent 45a37680ee
commit d538e719db

View file

@ -3,7 +3,7 @@
Plugin Name: Freifunk Metadata Shortcodes
Plugin URI: http://mschuette.name/
Description: Defines shortcodes to display Freifunk metadata
Version: 0.3
Version: 0.4dev
Author: Martin Schuette
Author URI: http://mschuette.name/
*/
@ -143,7 +143,7 @@ class FF_Meta
function aux_get_all_locations() {
// gather all location data
if (false === ( $json_locs = get_transient("FF_metadata_json_locs") )) {
if ( false === ( $json_locs = get_transient( 'FF_metadata_json_locs' ) ) ) {
$all_locs = array();
$arr_select = array( 'lat' => 1, 'lon' => 1 );
foreach ( $this->dir as $tmp_city => $url ) {
@ -159,7 +159,7 @@ class FF_Meta
}
$json_locs = json_encode( $all_locs );
$cachetime = get_option( 'FF_meta_cachetime', FF_META_DEFAULT_CACHETIME ) * MINUTE_IN_SECONDS;
set_transient("FF_metadata_json_locs", $json_locs, $cachetime);
set_transient( 'FF_metadata_json_locs', $json_locs, $cachetime );
}
return $json_locs;
}
@ -167,12 +167,11 @@ class FF_Meta
function output_ff_location( $citydata ) {
// normal per-city code
$loc = new FF_Community( $citydata );
$outstr = $loc->format_address();
$json_locs = $this->aux_get_all_locations();
if ( ! empty( $loc_name ) && ! empty( $loc_name ) ) {
$icon_url = plugin_dir_url(__FILE__) . "freifunk_marker.png";
$icon_url = plugin_dir_url( __FILE__ ) . 'freifunk_marker.png';
$outstr .= <<<EOT
<div id="mapdiv_$loc_city" style="width: 75%; height: 15em;"></div>
@ -246,8 +245,8 @@ EOT;
}
if ( ! empty( $contact['twitter'] ) ) {
// catch username instead of URI
if ($contact['twitter'][0] === "@") {
$twitter_url = 'http://twitter.com/' . ltrim($contact['twitter'], "@");
if ( $contact['twitter'][0] === '@' ) {
$twitter_url = 'http://twitter.com/' . ltrim( $contact['twitter'], '@' );
$twitter_handle = $contact['twitter'];
} else {
$twitter_url = $contact['twitter'];
@ -306,10 +305,10 @@ EOT;
$outstr .= $this->output_ff_list();
break;
default:
$outstr .= "";
$outstr .= '';
break;
}
$outstr .= "</div>";
$outstr .= '</div>';
return $outstr;
}
@ -363,8 +362,9 @@ EOT;
function cachetime_callback() {
$time = get_option( 'ff_meta_cachetime', FF_META_DEFAULT_CACHETIME );
echo "<input type='number' name='ff_meta_cachetime' id='ff_meta_cachetime_id' class='small-text code' value='$time' /> minutes"
."<p class='description'>Data from external URLs is cached for this number of minutes.</p>";
echo "<input type='number' name='ff_meta_cachetime' id='ff_meta_cachetime_id'"
." class='small-text code' value='". intval( $time ) . ' /> minutes'.
"<p class='description'>Data from external URLs is cached for this number of minutes.</p>";
}
function city_callback() {
@ -378,9 +378,10 @@ EOT;
foreach ( array_keys( $directory ) as $city ) {
$prettycity = ucwords( str_replace( array( '_', '-' ), ' ', $city ) );
$selected = selected( $default_city, $city );
echo "<option value='$city' $selected>$prettycity</option>";
echo "<option value='" . esc attr( $city ) . "' $selected>"
. esc_html( $prettycity ) . '</option>';
}
echo "</select>";
echo '</select>';
echo "<p class='description'>This is the default city parameter.</p>";
}
@ -401,7 +402,6 @@ EOT;
delete_option( 'ff_meta_city' );
delete_option( 'ff_meta_cachetime' );
}
}
$ffmeta = new FF_Meta;