Skip to content

Commit

Permalink
Merge pull request #129 from dshanske/closingdiv
Browse files Browse the repository at this point in the history
Add template and bump version
  • Loading branch information
dshanske authored Dec 8, 2018
2 parents b8401d9 + a12b92a commit 5b789b2
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 50 deletions.
46 changes: 5 additions & 41 deletions includes/class-hcard-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public static function get_rel_me( $author_id = null ) {
* returns a formatted <ul> list of rel=me to supported silos
*/
public static function rel_me_list( $author_id = null, $include_rel = false ) {
echo self::get_rel_me_list( $author_id, $include_rel );
echo self::get_rel_me_list( $author_id, $include_rel ); // phpcs:ignore
}

/**
Expand Down Expand Up @@ -520,46 +520,10 @@ public static function hcard( $user, $args = array() ) {
$url = $user->has_prop( 'user_url' ) ? $user->get( 'user_url' ) : $url = get_author_posts_url( $user->ID );
$name = $user->get( 'display_name' );
$email = $user->get( 'user_email' );

$return = '<div class="hcard-display h-card vcard p-author">';
$return .= '<div class="hcard-header">';
$return .= '<a class="u-url url fn u-uid" href="' . $url . '" rel="author">';
if ( ! $avatar ) {
$return .= '<p class="hcard-name p-name n">' . $name . '</p></a>';
} else {
$return .= $avatar . '</a>';
$return .= '<p class="hcard-name p-name n">' . $name . '</p>';
}
if ( $args['email'] ) {
$return .= '<p class="u-email"><a rel="me" href="mailto:' . $email . '">' . $email . '</a></p>';
}
$return .= '</div>';
$return .= '<div class="hcard-body">';
$return .= '<ul class="hcard-properties">';
if ( $args['location'] && ( $user->has_prop( 'locality' ) || $user->has_prop( 'region' ) || $user->has_prop( 'country-name' ) ) ) {
$return .= '<li class="h-adr adr">';
if ( $user->has_prop( 'locality' ) ) {
$return .= '<span class="p-locality locality">' . $user->get( 'locality' ) . '</span>, ';
}
if ( $user->has_prop( 'region' ) ) {
$return .= '<span class="p-region region">' . $user->get( 'region' ) . '</span> ';
}
if ( $user->has_prop( 'country-name' ) ) {
$return .= '<span class="p-country-name country-name">' . $user->get( 'country-name' ) . '</span>';
}
$return .= '</li>';
}
if ( $user->has_prop( 'tel' ) && $user->get( 'tel' ) ) {
$return .= '<li><a class="p-tel tel" href="tel:' . $user->get( 'tel' ) . '">' . $user->get( 'tel' ) . '</a></li>';
}
$return .= '</ul>';
if ( $args['me'] ) {
$return .= '<p>' . self::get_rel_me_list( $user->ID ) . '</p>';
}
if ( $args['notes'] ) {
$return .= '<p class="p-note note">' . $user->get( 'description' ) . '</p>';
}
$return .= '</div>';
ob_start();
include dirname( __FILE__ ) . '/../templates/h-card.php';
$return = ob_get_contents();
ob_end_clean();
return $return;
}
}
4 changes: 2 additions & 2 deletions indieweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Interested in connecting your WordPress site to the IndieWeb?
* Author: IndieWebCamp WordPress Outreach Club
* Author URI: https://indieweb.org/WordPress_Outreach_Club
* Version: 3.3.13
* Version: 3.3.14
* License: MIT
* License URI: http://opensource.org/licenses/MIT
* Text Domain: indieweb
Expand All @@ -26,7 +26,7 @@
*/
class IndieWeb_Plugin {

public static $version = '3.3.13';
public static $version = '3.3.14';

/**
* Initialize the plugin, registering WordPress hooks.
Expand Down
4 changes: 2 additions & 2 deletions languages/wordpress-indieweb.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: IndieWeb 3.3.13\n"
"Project-Id-Version: IndieWeb 3.3.14\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/indieweb\n"
"POT-Creation-Date: 2018-12-04 00:54:25+00:00\n"
"POT-Creation-Date: 2018-12-08 01:54:44+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
3 changes: 2 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<description>WordPress Indieweb Standards</description>
<file>./indieweb.php</file>
<file>./includes/</file>
<config name="minimum_supported_wp_version" value="4.7"/>
<config name="minimum_supported_wp_version" value="4.8"/>
<exclude-pattern>*/includes/*\.(inc|css|js|svg)</exclude-pattern>
<exclude-pattern>*/includes/getting-started.php</exclude-pattern>
<exclude-pattern>*/includes/class-connekt-plugin-installer.php</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="5.3-"/>
Expand Down
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
**Tags:** indieweb, webmention, POSSE, indieauth
**Requires at least:** 4.7
**Requires PHP:** 5.3
**Tested up to:** 4.9.8
**Stable tag:** 3.3.13
**Tested up to:** 5.0
**Stable tag:** 3.3.14
**License:** MIT
**License URI:** http://opensource.org/licenses/MIT

Expand Down Expand Up @@ -82,6 +82,10 @@ One could certainly download, install, and activate some or all of these plugins

Project maintained on github at [indieweb/wordpress-indieweb](https://github.com/indieweb/wordpress-indieweb).

### 3.3.14 ###
* Fixed issue with missing closing tag on h-card widget
* Turned h-card widget into an HTML template to allow for easier customization

### 3.3.13 ###
* Typo causing rel-me error. Sorry folks.

Expand Down
8 changes: 6 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Donate link: https://indieweb.org/how-to-sponsor
Tags: indieweb, webmention, POSSE, indieauth
Requires at least: 4.7
Requires PHP: 5.3
Tested up to: 4.9.8
Stable tag: 3.3.13
Tested up to: 5.0
Stable tag: 3.3.14
License: MIT
License URI: http://opensource.org/licenses/MIT

Expand Down Expand Up @@ -82,6 +82,10 @@ One could certainly download, install, and activate some or all of these plugins

Project maintained on github at [indieweb/wordpress-indieweb](https://github.com/indieweb/wordpress-indieweb).

= 3.3.14 =
* Fixed issue with missing closing tag on h-card widget
* Turned h-card widget into an HTML template to allow for easier customization

= 3.3.13 =
* Typo causing rel-me error. Sorry folks.

Expand Down
46 changes: 46 additions & 0 deletions templates/h-card.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<div class="hcard-display h-card vcard p-author">
<div class="hcard-header">
<?php if ( ! $avatar ) { ?>
<a class="u-url url fn u-uid" href="<?php echo esc_url( $url ); ?>" rel="author">
<p class="hcard-name p-name n"><?php echo $name; ?></p>
</a>
<?php } else { ?>
<a class="u-url url fn u-uid" href="<?php echo esc_url( $url ); ?>" rel="author"><?php echo $avatar; ?></a>
<p class="hcard-name p-name n"><?php echo $name; ?></p>
<?php }
if ( $args['email'] ) { ?>
<p class="u-email">
<a rel="me" href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a>
</p>
<?php } ?>
</div> <!-- end hcard-header -->
<div class="hcard-body">
<ul class="hcard-properties">
<?php if ( $args['location'] && ( $user->has_prop( 'locality' ) || $user->has_prop( 'region' ) || $user->has_prop( 'country-name' ) ) ) { ?>
<li class="h-adr adr">
<?php if ( $user->has_prop( 'locality' ) ) { ?>
<span class="p-locality locality"><?php echo $user->get( 'locality' ); ?></span>
<?php }
if ( $user->has_prop( 'region' ) ) { ?>
<span class="p-region region"><?php echo $user->get( 'region' ); ?></span>
<?php }
if ( $user->has_prop( 'country-name' ) ) { ?>
<span class="p-country-name country-name"><?php echo $user->get( 'country-name' ); ?></span>
<?php } ?>
</li>
<?php }
if ( $user->has_prop( 'tel' ) && $user->get( 'tel' ) ) { ?>
<li>
<a class="p-tel tel" href="tel:<?php echo $user->get( 'tel' ); ?>"><?php echo $user->get( 'tel' ); ?></a>
</li>
<?php } ?>
</ul> <!-- end hcard-properties -->
<?php if ( $args['me'] ) { ?>
<?php self::rel_me_list( $user->ID, is_front_page() ); ?>
<?php }
if ( $args['notes'] && $user->has_prop( 'description' ) ) { ?>
<p class="p-note note"><?php echo $user->get( 'description' ); ?></p>
<?php } ?>
</div> <!-- end hcard-body -->
</div><!-- end hcard-display -->
<?php

0 comments on commit 5b789b2

Please sign in to comment.