diff --git a/includes/class-kind-config.php b/includes/class-kind-config.php index 62a341a..bcfb88f 100644 --- a/includes/class-kind-config.php +++ b/includes/class-kind-config.php @@ -36,80 +36,80 @@ public static function admin_init() { 'type' => 'array', 'description' => 'Kinds Enabled on This Site', 'show_in_rest' => true, - 'default' => array( 'article', 'reply', 'bookmark' ) + 'default' => array( 'article', 'reply', 'bookmark' ), ); register_setting( 'iwt_options', 'kind_termslist', $args ); $args = array( 'type' => 'string', 'description' => 'Default Kind', 'show_in_rest' => true, - 'default' => 'note' + 'default' => 'note', ); register_setting( 'iwt_options', 'kind_default', $args ); $args = array( 'type' => 'boolean', 'description' => 'Rich Embed Support for Whitelisted Sites', 'show_in_rest' => true, - 'default' => 1 + 'default' => 1, ); register_setting( 'iwt_options', 'kind_embeds', $args ); $args = array( 'type' => 'boolean', 'description' => 'Disable Content Protection on Responses', 'show_in_rest' => true, - 'default' => 0 + 'default' => 0, ); register_setting( 'iwt_options', 'kind_protection', $args ); $args = array( 'type' => 'string', 'description' => 'KSES Content Protection on Responses', 'show_in_rest' => true, - 'default' => str_replace( '},"',"},\r\n\"", wp_json_encode( wp_kses_allowed_html( 'post' ), JSON_PRETTY_PRINT ) ) + 'default' => str_replace( '},"',"},\r\n\"", wp_json_encode( wp_kses_allowed_html( 'post' ), JSON_PRETTY_PRINT ) ), ); register_setting( 'iwt_options', 'kind_kses', $args ); - add_settings_section( - 'iwt-content', - __( 'Content Options', - 'indieweb-post-kinds' ), - array( 'Kind_Config', 'options_callback' ), - 'iwt_options' + add_settings_section( + 'iwt-content', + __( 'Content Options', + 'indieweb-post-kinds' ), + array( 'Kind_Config', 'options_callback' ), + 'iwt_options' ); - add_settings_field( - 'termslist', + add_settings_field( + 'termslist', __( 'Select All Kinds You Wish to Use', 'indieweb-post-kinds' ), array( 'Kind_Config', 'termcheck_callback' ), 'iwt_options', - 'iwt-content' + 'iwt-content' ); - add_settings_field( - 'defaultkind', + add_settings_field( + 'defaultkind', __( 'Default Kind', 'indieweb-post-kinds' ), array( 'Kind_Config', 'defaultkind_callback' ), 'iwt_options', 'iwt-content' ); - add_settings_field( - 'embeds', - __( 'Add Rich Embed Support for Whitelisted Sites', 'indieweb-post-kinds' ), - array( 'Kind_Config', 'checkbox_callback' ), - 'iwt_options', 'iwt-content' , array( 'name' => 'kind_embeds' ) + add_settings_field( + 'embeds', + __( 'Use Rich Embed Support for Responses to Whitelisted Sites', 'indieweb-post-kinds' ), + array( 'Kind_Config', 'checkbox_callback' ), + 'iwt_options', 'iwt-content' , array( 'name' => 'kind_embeds' ) ); - add_settings_field( - 'protection', - __( 'Disable Content Protection on Responses', 'indieweb-post-kinds' ), + add_settings_field( + 'protection', + __( 'Disable KSES Content Protection on Responses(Advanced Feature)', 'indieweb-post-kinds' ), array( 'Kind_Config', 'checkbox_callback' ), 'iwt_options', 'iwt-content', array( 'name' => 'kind_protection' ) ); if ( 1 == get_option( 'kind_protection' ) ) { - add_settings_field( - 'contentelements', - __( 'Response Content Allowed Html Elements', 'indieweb-post-kinds' ) . ' *', + add_settings_field( + 'contentelements', + __( 'Response Content Allowed Html Elements', 'indieweb-post-kinds' ) . ' *', array( 'Kind_Config', 'textbox_callback' ), - 'iwt_options', + 'iwt_options', 'iwt-content', array( 'name' => 'kind_kses' ) ); @@ -194,15 +194,15 @@ public static function textbox_callback( array $args ) { * @access public */ public static function termcheck_callback() { - $terms = Kind_Taxonomy::get_strings(); + $terms = Kind_Taxonomy::get_kind_info( 'all', 'all' ); // Hide these terms until ready for use for now. $hide = array( 'note', 'weather', 'exercise', 'travel', 'itinerary', 'tag', 'follow', 'drink', 'eat', 'trip', 'checkin', 'recipe', 'mood' ); foreach ( $hide as $hid ) { unset( $terms[ $hid ] ); } - $termslist = get_option('kind_termslist'); + $termslist = get_option( 'kind_termslist' ); foreach ( $terms as $key => $value ) { - echo "' . $value . '
'; + echo "' . $value['singular_name'] . ' - ' . $value['description'] . '
'; } } @@ -213,14 +213,13 @@ public static function termcheck_callback() { * @access public */ public static function defaultkind_callback() { - $terms = get_option('kind_termslist'); + $terms = get_option( 'kind_termslist' ); $terms[] = 'note'; - $strings = Kind_Taxonomy::get_strings(); - $defaultkind = get_option('kind_default'); + $defaultkind = get_option( 'kind_default' ); foreach ( $terms as $term ) { - echo '' . $strings[$term] . '
'; + echo '' . Kind_Taxonomy::get_kind_info( $term, 'singular_name' ) . '
'; } } diff --git a/includes/class-kind-meta.php b/includes/class-kind-meta.php index fee8476..c077bb2 100644 --- a/includes/class-kind-meta.php +++ b/includes/class-kind-meta.php @@ -144,7 +144,7 @@ public static function sanitize_content( $value ) { if ( 1 == get_option( 'kind_protection' ) ) { $allowed = json_decode( get_option( 'kind_kses' ), true ); } - return wp_kses( ( string ) $value , $allowed ); + return wp_kses( $value , $allowed ); } public static function sanitize_text( $value ) { @@ -168,17 +168,17 @@ public static function sanitize_text( $value ) { public function build_meta( $raw ) { $raw = apply_filters( 'kind_build_meta', $raw ); $kind = get_post_kind_slug( $this->post ); + $property = Kind_Taxonomy::get_kind_info( $kind, 'property' ); if ( isset( $raw['url'] ) ) { /** * Allows additional changes to the kind data after parsing. * * @param array $raw An array of properties. */ - $map = array_filter( Kind_Taxonomy::get_kind_properties() ); if ( isset( $kind ) ) { - if ( array_key_exists( $kind, $map ) ) { - $this->meta[ $map[ $kind ] ] = $raw['url']; - unset( $raw['url'] ); + if ( ! empty( $property ) ) { + $this->meta[ $property ] = $raw['url']; + unset( $raw['url'] ); } } } @@ -195,7 +195,7 @@ public function get_url( ) { return false; } $kind = get_post_kind_slug( $this->post ); - $map = Kind_Taxonomy::get_kind_properties(); + $property = Kind_Taxonomy::get_kind_info( $kind, 'property' ); if ( array_key_exists( 'cite', $this->meta ) ) { if ( array_key_exists( 'url', $this->meta['cite'] ) ) { return $this->meta['cite']['url']; @@ -204,14 +204,14 @@ public function get_url( ) { if ( ! $kind ) { return false; } - if ( array_key_exists( $kind, $map ) ) { - if ( array_key_exists( $map[ $kind ], $this->meta ) ) { - if ( is_string( $this->meta[ $map[ $kind ] ] ) ) { - return $this->meta[ $map[ $kind ] ]; + if ( ! empty( $property ) ) { + if ( array_key_exists( $property, $this->meta ) ) { + if ( is_string( $this->meta[ $property ] ) ) { + return $this->meta[ $property ]; + } + if ( is_array( $this->meta[ $property ] ) ) { + return $this->meta[ $property ][0]; } - if ( is_array( $this->meta[ $map[ $kind ] ] ) ) { - return $this->meta[ $map [ $kind ] ][0]; - } } } return false; @@ -228,11 +228,9 @@ public function set_url( $url ) { } $url = self::sanitize_text( $url ); $kind = get_post_kind_slug( $this->post ); - $map = array_diff( Kind_Taxonomy::get_kind_properties(), array( '' ) ); - if ( $kind ) { - if ( array_key_exists( $kind, $map ) ) { - $this->meta[ $map[ $kind ] ] = array( $url ); - } + $property = Kind_Taxonomy::get_kind_info( $kind, 'property' ); + if ( ! empty ( $property ) ) { + $this->meta[ $property ] = array( $url ); } if ( ! array_key_exists( 'cite', $this->meta ) ) { $this->meta['url'] = $url; @@ -436,7 +434,7 @@ public function get( $key ) { } public function set( $key, $value) { - $this->meta[$key] = self::sanitize_text( $value ); + $this->meta[ $key ] = self::sanitize_text( $value ); } public function del( $key ) { diff --git a/includes/class-kind-plugins.php b/includes/class-kind-plugins.php new file mode 100755 index 0000000..c470cfa --- /dev/null +++ b/includes/class-kind-plugins.php @@ -0,0 +1,141 @@ +comment_type || ! get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_canonical', true ) ) { + return $text; + } + // check comment type + $comment_type = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_type', true ); + if ( ! $comment_type || ! in_array( $comment_type, array_keys( SemanticLinkbacksPlugin::get_comment_type_strings() ) ) ) { + $comment_type = 'mention'; + } + $_kind = get_the_terms( $comment->comment_post_ID, 'kind' ); + if ( ! empty( $_kind ) ) { + $kind = array_shift( $_kind ); + $kindstrings = self::get_strings(); + $post_format = $kindstrings[ $kind->slug ]; + } else { + $post_format = get_post_format( $comment->comment_post_ID ); + // replace "standard" with "Article" + if ( ! $post_format || 'standard' === $post_format ) { + $post_format = 'Article'; + } else { + $post_formatstrings = get_post_format_strings(); + // get the "nice" name + $post_format = $post_formatstrings[ $post_format ]; + } + } + // generate the verb, for example "mentioned" or "liked" + $comment_type_excerpts = SemanticLinkbacksPlugin::get_comment_type_excerpts(); + // get URL canonical url... + $url = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_canonical', true ); + // ...or fall back to source + if ( ! $url ) { + $url = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_source', true ); + } + // parse host + $host = parse_url( $url, PHP_URL_HOST ); + // strip leading www, if any + $host = preg_replace( '/^www\./', '', $host ); + // generate output + $text = sprintf( $comment_type_excerpts[ $comment_type ], get_comment_author_link( $comment->comment_ID ), 'this ' . $post_format, $url, $host ); + return apply_filters( 'semantic_linkbacks_excerpt', $text ); + } + + /** + * Take mf2 properties and set a post kind + * + * @param array $input Micropub Request in JSON + * @param array $wp_args Arguments passed to insert or update posts + */ + + public static function micropub_set_kind( $input, $wp_args ) { + // Only continue if create or update + if ( ! $wp_args ) { + return; + } + if ( isset( $input['properties']['rsvp'] ) ) { + set_post_kind( $wp_args['ID'], 'rsvp' ); + return; + } + if ( isset( $input['properties']['in-reply-to'] ) ) { + set_post_kind( $wp_args['ID'], 'reply' ); + return; + } + + if ( isset( $input['properties']['repost-of'] ) ) { + set_post_kind( $wp_args['ID'], 'repost' ); + return; + } + + if ( isset( $input['properties']['like-of'] ) ) { + set_post_kind( $wp_args['ID'], 'like' ); + return; + } + if ( isset( $input['properties']['photo'] ) ) { + set_post_kind( $wp_args['ID'], 'photo' ); + return; + } + + if ( isset( $input['properties']['bookmark-of'] ) || isset( $input['properties']['bookmark'] ) ) { + set_post_kind( $wp_args['ID'], 'bookmark' ); + return; + } + + // This basically adds Teacup support + if ( isset( $input['properties']['p3k-food'] ) ) { + if ( isset( $input['properties']['p3k-type'] ) ) { + if ( 'drink' === $input['properties']['p3k-type'] ) { + set_post_kind( $wp_args['ID'], 'drink' ); + return; + } + set_post_kind( $wp_args['ID'], 'eat' ); + return; + } + } + if ( ! empty( $input['properties']['name'] ) ) { + $name = trim( $input['properties']['name'] ); + $content = trim( $input['properties']['content']); + if ( 0 !== strpos( $content, $name ) ) { + set_post_kind( $wp_args['ID'], 'article' ); + return; + } + } + set_post_kind( $wp_args['ID'], 'note' ); + } + + public static function post_formats( $input, $wp_args ) { + $kind = get_post_kind_slug( $wp_args['ID'] ); + set_post_format( $wp_args['ID'], Kind_Taxonomy::get_kind_info( $kind, 'property' ) ); + } + +} // End Class Kind_Plugins + +?> diff --git a/includes/class-kind-tabmeta.php b/includes/class-kind-tabmeta.php index 25ac400..9998ae8 100755 --- a/includes/class-kind-tabmeta.php +++ b/includes/class-kind-tabmeta.php @@ -61,7 +61,7 @@ public static function enqueue_admin_scripts() { wp_localize_script( 'kindmeta-response', 'rest_object', array( 'api_nonce' => wp_create_nonce( 'wp_rest' ), - 'api_url' => site_url('/wp-json/link-preview/1.0/'), + 'api_url' => rest_url('/link-preview/1.0/'), 'link_preview_success_message' => __( 'Your URL has been successfully retrieved and parsed', 'indieweb-post-kinds' ) ) ); diff --git a/includes/class-kind-taxonomy.php b/includes/class-kind-taxonomy.php index 6d02843..faae76d 100755 --- a/includes/class-kind-taxonomy.php +++ b/includes/class-kind-taxonomy.php @@ -10,82 +10,31 @@ class Kind_Taxonomy { public static function init() { + // Add the Correct Archive Title to Kind Archives. + add_filter( 'get_the_archive_title', array( 'Kind_Taxonomy', 'kind_archive_title' ), 10 ); + add_filter( 'get_the_archive_description', array( 'Kind_Taxonomy', 'kind_archive_description' ), 10 ); + // Add Kind Permalinks. add_filter( 'post_link', array( 'Kind_Taxonomy', 'kind_permalink' ) , 10, 3 ); add_filter( 'post_type_link', array( 'Kind_Taxonomy', 'kind_permalink' ) , 10 , 3 ); + // Add Dropdown + add_action( 'restrict_manage_posts', array( 'Kind_Taxonomy', 'kind_dropdown' ), 10, 2 ); + + // Add Links to Ping to the Webmention Sender. + add_filter( 'webmention_links', array( 'Kind_Taxonomy', 'webmention_links' ), 11, 2 ); + // Add Classes to Post and Body. add_filter( 'post_class', array( 'Kind_Taxonomy', 'post_class' ) ); add_filter( 'body_class', array( 'Kind_Taxonomy', 'body_class' ) ); // Trigger Webmention on Change in Post Status. add_filter( 'transition_post_status', array( 'Kind_Taxonomy', 'transition' ), 10, 3 ); - // On Post Publish Invalidate any Stored Response. + // On Post Save Set Post Format add_action( 'save_post', array( 'Kind_Taxonomy', 'post_formats' ), 99, 3 ); - - // Add the Correct Archive Title to Kind Archives. - add_filter( 'get_the_archive_title', array( 'Kind_Taxonomy', 'kind_archive_title' ) , 10 , 3 ); - - // Set Post Kind for Micropub Inputs. - add_action( 'after_micropub', array( 'Kind_Taxonomy', 'micropub_set_kind' ), 10, 2 ); - - // Override Post Type in Semantic Linkbacks. - add_filter( 'semantic_linkbacks_post_type', array( 'Kind_Taxonomy', 'semantic_post_type' ), 11, 2 ); - - // Add Links to Ping to the Webmention Sender. - add_filter( 'webmention_links', array( 'Kind_Taxonomy', 'webmention_links' ), 11, 2 ); - - // Remove the Automatic Post Generation that the Micropub Plugin Offers - remove_filter( 'before_micropub', array( 'Micropub', 'generate_post_content' ) ); - - // Add Dropdown - add_action( 'restrict_manage_posts', array( 'Kind_Taxonomy', 'kind_dropdown' ), 10, 2 ); } - /** - * Sets Post Format for Post Kind. - * - * @param int $post_ID Post ID - * @param WP_Post $post Post Object - * @param boolean $update, - */ - public static function post_formats( $post_ID, $post, $update ) { - $kind = get_post_kind_slug( $post_ID ); - switch ( $kind ) { - case 'note': - set_post_format( $post_ID, 'aside' ); - break; - case 'article': - set_post_format( $post_ID, '' ); - break; - case 'favorite': - case 'bookmark': - case 'like': - case 'reply': - set_post_format( $post_ID, 'link' ); - break; - case 'quote': - set_post_format( $post_ID, 'quote' ); - break; - case 'listen': - case 'jam': - set_post_format( $post_ID, 'audio'); - break; - case 'watch': - set_post_format( $post_ID, 'video'); - break; - case 'photo': - set_post_format( $post_ID, 'image' ); - break; - case 'play': - case 'read': - case 'rsvp': - set_post_format( $post_ID, 'status'); - break; - } - } - /** * To Be Run on Plugin Activation. */ @@ -145,12 +94,12 @@ public static function register() { * Sets up Default Terms for Kind Taxonomy. */ public static function kind_defaultterms () { - $terms = self::get_strings(); + $terms = self::get_kind_info( 'all', 'all' ); foreach ( $terms as $key => $value ) { if ( ! term_exists( $key, 'kind' ) ) { wp_insert_term( $key, 'kind', array( - 'description' => $value, + 'description' => $value['description'], 'slug' => $key, ) ); } @@ -169,21 +118,38 @@ public static function kind_permalink($permalink, $post_id, $leavename) { } else { $taxonomy_slug = 'note'; } return str_replace( '%kind%', $taxonomy_slug, $permalink ); } - public static function kind_archive_title($title) { - $strings = self::get_strings_plural(); + + public static function kind_archive_title( $title ) { if ( is_tax( 'kind' ) ) { - foreach ( $strings as $key => $string ) { - if ( is_tax( 'kind', $key ) ) { - $title = $string; - return $title; - } - } + $term = get_queried_object(); + return self::get_kind_info( $term->slug, 'name' ); } return $title; } + public static function kind_archive_description( $title ) { + if ( is_tax( 'kind' ) ) { + $term = get_queried_object(); + return self::get_kind_info( $term->slug, 'description' ); + } + return $title; + } + + /** + * Sets Post Format for Post Kind. + * + * @param int $post_ID Post ID + * @param WP_Post $post Post Object + * @param boolean $update, + */ + public static function post_formats( $post_ID, $post, $update ) { + $kind = get_post_kind_slug( $post_ID ); + if ( ! $update ) { + set_post_format( $post_ID, self::get_kind_info( $kind, 'property' ) ); + } + } + public static function select_metabox( $post ) { - $strings = self::get_strings(); $include = get_option( 'kind_termslist' ); $include = array_merge( $include, array( 'note', 'reply', 'article' ) ); // If Simple Location is Enabled, include the check-in type @@ -196,7 +162,7 @@ public static function select_metabox( $post ) { if ( isset( $_GET['kind'] ) ) { $default = get_term_by( 'slug', $_GET['kind'], 'kind' ); } else { - $default = get_term_by( 'slug', get_option('kind_default'), 'kind' ); + $default = get_term_by( 'slug', get_option( 'kind_default' ), 'kind' ); } $terms = get_terms( 'kind', array( 'hide_empty' => 0 ) ); $postterms = get_the_terms( $post->ID, 'kind' ); @@ -211,7 +177,8 @@ public static function select_metabox( $post ) { echo "
  • '; } @@ -220,205 +187,276 @@ public static function select_metabox( $post ) { } /** - * Returns an array of post kind slugs to their translated and pretty display versions - * - * @return array The array of translated post kind names. - */ - public static function get_strings() { - $strings = array( - 'article' => _x( 'Article', 'indieweb-post-kinds' ), - 'note' => _x( 'Note', 'indieweb-post-kinds' ), - 'reply' => _x( 'Reply', 'indieweb-post-kinds' ), - 'repost' => _x( 'Repost', 'indieweb-post-kinds' ), - 'like' => _x( 'Like', 'indieweb-post-kinds' ), - 'favorite' => _x( 'Favorite', 'indieweb-post-kinds' ), - 'bookmark' => _x( 'Bookmark', 'indieweb-post-kinds' ), - 'photo' => _x( 'Photo', 'indieweb-post-kinds' ), - 'tag' => _x( 'Tag', 'indieweb-post-kinds' ), - 'rsvp' => _x( 'RSVP', 'indieweb-post-kinds' ), - 'listen' => _x( 'Listen', 'indieweb-post-kinds' ), - 'watch' => _x( 'Watch', 'indieweb-post-kinds' ), - 'checkin' => _x( 'Checkin', 'indieweb-post-kinds' ), - 'wish' => _x( 'Wish', 'indieweb-post-kinds' ), - 'play' => _x( 'Play', 'indieweb-post-kinds' ), - 'weather' => _x( 'Weather', 'indieweb-post-kinds' ), - 'exercise' => _x( 'Exercise', 'indieweb-post-kinds' ), - 'trip' => _x( 'Travel', 'indieweb-post-kinds' ), - 'itinerary' => _x( 'Itinerary', 'indieweb-post-kinds' ), - 'eat' => _x( 'Eat', 'indieweb-post-kinds' ), - 'drink' => _x( 'Drink', 'indieweb-post-kinds' ), - 'follow' => _x( 'Follow', 'indieweb-post-kinds' ), - 'jam' => _x( 'Jam', 'indieweb-post-kinds' ), - 'read' => _x( 'Read', 'indieweb-post-kinds' ), - 'quote' => _x( 'Quote', 'indieweb-post-kinds' ), - 'mood' => _x( 'Mood', 'indieweb-post-kinds' ), - 'recipe' => _x( 'Recipe', 'indieweb-post-kinds' ), - ); - return apply_filters( 'kind_strings', $strings ); - } - - /** - * Returns an array of post kind slugs to their pluralized translated and pretty display versions - * - * @return array The array of translated post kind names. - */ - public static function get_strings_plural() { - $strings = array( - 'article' => _x( 'Articles', 'indieweb-post-kinds' ), - 'note' => _x( 'Notes', 'indieweb-post-kinds' ), - 'reply' => _x( 'Replies', 'indieweb-post-kinds' ), - 'repost' => _x( 'Reposts', 'indieweb-post-kinds' ), - 'like' => _x( 'Likes', 'indieweb-post-kinds' ), - 'favorite' => _x( 'Favorites', 'indieweb-post-kinds' ), - 'bookmark' => _x( 'Bookmarks', 'indieweb-post-kinds' ), - 'photo' => _x( 'Photos', 'indieweb-post-kinds' ), - 'tag' => _x( 'Tags', 'indieweb-post-kinds' ), - 'rsvp' => _x( 'RSVPs', 'indieweb-post-kinds' ), - 'listen' => _x( 'Listens', 'indieweb-post-kinds' ), - 'watch' => _x( 'Watches', 'indieweb-post-kinds' ), - 'checkin' => _x( 'Checkins', 'indieweb-post-kinds' ), - 'wish' => _x( 'Wishlist', 'indieweb-post-kinds' ), - 'play' => _x( 'Plays', 'indieweb-post-kinds' ), - 'weather' => _x( 'Weather', 'indieweb-post-kinds' ), - 'exercise' => _x( 'Exercises', 'indieweb-post-kinds' ), - 'trip' => _x( 'Travels', 'indieweb-post-kinds' ), - 'itinerary' => _x( 'Itineraries', 'indieweb-post-kinds' ), - 'eat' => _x( 'Eat', 'indieweb-post-kinds' ), - 'drink' => _x( 'Drinks', 'indieweb-post-kinds' ), - 'follow' => _x( 'Follows', 'indieweb-post-kinds' ), - 'jam' => _x( 'Jams', 'indieweb-post-kinds' ), - 'read' => _x( 'Read', 'indieweb-post-kinds' ), - 'quote' => _x( 'Quotes', 'indieweb-post-kinds' ), - 'mood' => _x( 'Moods', 'indieweb-post-kinds' ), - 'recipe' => _x( 'Recipes', 'indieweb-post-kinds' ), - ); - return apply_filters( 'kind_strings_plural', $strings ); - } - - /** - * Returns an array of post kind slugs to their translated verbs - * - * @return array The array of translated post kind verbs. - */ - public static function get_verb_strings() { - $strings = array( - 'article' => _x( ' ', 'indieweb-post-kinds' ), - 'note' => _x( ' ', 'indieweb-post-kinds' ), - 'reply' => _x( 'In Reply To', 'indieweb-post-kinds' ), - 'repost' => _x( 'Reposted', 'indieweb-post-kinds' ), - 'like' => _x( 'Liked', 'indieweb-post-kinds' ), - 'favorite' => _x( 'Favorited', 'indieweb-post-kinds' ), - 'bookmark' => _x( 'Bookmarked', 'indieweb-post-kinds' ), - 'photo' => _x( ' ', 'indieweb-post-kinds' ), - 'tag' => _x( 'Tagged', 'indieweb-post-kinds' ), - 'rsvp' => _x( 'RSVPed', 'indieweb-post-kinds' ), - 'listen' => _x( 'Listened to ', 'indieweb-post-kinds' ), - 'watch' => _x( 'Watched', 'indieweb-post-kinds' ), - 'checkin' => _x( 'Checked In At', 'indieweb-post-kinds' ), - 'wish' => _x( 'Desires', 'indieweb-post-kinds' ), - 'play' => _x( 'Played', 'indieweb-post-kinds' ), - 'weather' => _x( 'Weathered', 'indieweb-post-kinds' ), - 'exercise' => _x( 'Exercised', 'indieweb-post-kinds' ), - 'trip' => _x( 'Traveled', 'indieweb-post-kinds' ), - 'itinerary' => _x( 'Traveled', 'indieweb-post-kinds' ), - 'eat' => _x( 'Ate', 'indieweb-post-kinds' ), - 'drink' => _x( 'Drank', 'indieweb-post-kinds' ), - 'follow' => _x( 'Followed', 'indieweb-post-kinds' ), - 'jam' => _x( 'Listened to', 'indieweb-post-kinds' ), - 'read' => _x( 'Is Reading', 'indieweb-post-kinds' ), - 'quote' => _x( 'Quoted', 'indieweb-post-kinds' ), - 'mood' => _x( 'Felt', 'indieweb-post-kinds' ), - 'recipe' => _x( 'Cooked', 'indieweb-post-kinds' ), - - ); - return apply_filters( 'kind_verbs', $strings ); - } - - /** - * Returns an array of properties associated with kinds. + * Returns all translated strings. * - * @return array The array of properties. + * @param $kind Post Kind to return. + * @param $property The individual property + * @return string|array Return kind-property. If either is set to all, return all. */ - public static function get_kind_properties() { - $strings = array( - 'article' => '', - 'note' => '', - 'reply' => 'in-reply-to', - 'repost' => 'repost-of', - 'like' => 'like-of', - 'favorite' => 'favorite-of', - 'bookmark' => 'bookmark-of', - 'photo' => 'photo', - 'tag' => 'tag', - 'rsvp' => 'rsvp', - 'listen' => 'listen', - 'watch' => 'watch', - 'checkin' => 'checkin', - 'wish' => 'wish', - 'play' => 'play', - 'weather' => 'weather', - 'exercise' => 'exercise', - 'trip' => 'trip', - 'itinerary' => 'itinerary', - 'eat' => 'p3k-food', - 'drink' => 'p3k-food', - 'follow' => 'u-follow-of', - 'jam' => 'jam', - 'read' => 'read', - 'quote' => 'u-quotation-of', - 'mood' => 'mood', - 'recipe' => 'recipe', + public static function get_kind_info( $kind, $property ) { + if ( ! $kind || ! $property ) { + return false; + } + $kinds = array( + 'article' => array( + 'singular_name' => _x( 'Article', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Articles', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( ' ', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => '', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'traditional long form content: a post with an explicit title and body', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/article', + ), + 'note' => array( + 'singular_name' => _x( 'Note', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Notes', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( ' ', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => '', // microformats 2 property + 'format' => 'aside', // Post Format that maps to this + 'description' => __( 'short content: a post or status update with just plain content and typically without a title', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/note', + ), + 'reply' => array( + 'singular_name' => _x( 'Reply', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Replies', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Replied', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'in-reply-to', // microformats 2 property + 'format' => 'link', // Post Format that maps to this + 'description' => __( 'a reply to content typically on another site', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/reply', + ), + 'repost' => array( + 'singular_name' => _x( 'Repost', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Reposts', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Reposted', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'repost-of', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'a complete reposting of content from another site', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/repost', + ), + 'like' => array( + 'singular_name' => _x( 'Like', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Likes', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Liked', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'like-of', // microformats 2 property + 'format' => 'link', // Post Format that maps to this + 'description' => __( 'a way to pay compliments to the original post/poster of external content', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/like', + ), + 'favorite' => array( + 'singular_name' => _x( 'Favorite', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Favorites', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Favorited', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'favorite-of', // microformats 2 property + 'format' => 'link', // Post Format that maps to this + 'description' => __( 'special to the author', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/favorite', + ), + 'bookmark' => array( + 'singular_name' => _x( 'Bookmark', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Bookmarks', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Bookmarked', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'bookmark-of', // microformats 2 property + 'format' => 'link', // Post Format that maps to this + 'description' => __( 'storing a link/bookmark for personal use or sharing with others', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/bookmark', + ), + 'photo' => array( + 'singular_name' => _x( 'Photo', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Photos', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( ' ', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'photo', // microformats 2 property + 'format' => 'image', // Post Format that maps to this + 'description' => __( 'a post with an embedded image/photo as its primary focus', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/photo', + ), + 'tag' => array( + 'singular_name' => _x( 'Tag', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Tags', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Tagged', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'tag', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'allows you to tag a post as being of a specific category or tag, or for person tagging', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/tag', + ), + 'rsvp' => array( + 'singular_name' => _x( 'RSVP', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'RSVPs', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'RSVPed', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'in-reply-to', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'a specific type of reply regarding attendance of an event', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/rsvp', + ), + 'listen' => array( + 'singular_name' => _x( 'Listen', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Listens', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Listened', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'listen-of', // microformats 2 property + 'format' => 'audio', // Post Format that maps to this + 'description' => __( 'listening to audio; sometimes called a scrobble', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/listen', + ), + 'watch' => array( + 'singular_name' => _x( 'Watch', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Watches', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Watched', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'watch', // microformats 2 property + 'format' => 'video-of', // Post Format that maps to this + 'description' => __( 'watching a movie, television show, online video, play or other visual-based event', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/watch', + ), + 'checkin' => array( + 'singular_name' => _x( 'Checkin', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Checkins', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Checked into', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'checkin', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'identifying you are at a particular geographic location', 'indieweb-post-kinds' ), + 'description-url' => 'http://indieweb.org/checkin', + ), + 'wish' => array( + 'singular_name' => _x( 'Wish', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Wishes', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Wished', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'wish', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'a post indicating a desire/wish. The archive of which would be a wishlist, such as a gift registry or similar', 'indieweb-post-kinds' ), + 'description-url' => '', + ), + 'play' => array( + 'singular_name' => _x( 'Play', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Playing', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Played', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'play', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'playing a game', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/game_play', + ), + 'weather' => array( + 'singular_name' => _x( 'Weather', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Weather', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( ' ', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'weather', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'current weather conditions', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/weather', + ), + 'exercise' => array( + 'singular_name' => _x( 'Exercise', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Exercise', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Exercised', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'exercise', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'some form of physical activity or workout (examples: walk, run, cycle, hike, yoga, etc.)', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/exercise', + ), + 'trip' => array( + 'singular_name' => _x( 'Trip', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Trips', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Travelled', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'trip', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'represents a geographic journey', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/trip', + ), + 'itinerary' => array( + 'singular_name' => _x( 'Itinerary', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Itineraries', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Travelled', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'itinerary', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'parts of a scheduled trip including transit by car, plane, train, etc.', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/trip', + ), + 'eat' => array( + 'singular_name' => _x( 'Eat', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Eat', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Ate', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'food', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'what you are eating, perhaps for a food dairy', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/food', + ), + 'drink' => array( + 'singular_name' => _x( 'Drink', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Drinks', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Drank', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'food', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'what you are drinking, perhaps for a food dairy', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/food', + ), + 'follow' => array( + 'singular_name' => _x( 'Follow', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Follows', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Followed', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'follow', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'indicating you are now following or subscribing to another person`s activities online', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/follow', + ), + 'jam' => array( + 'singular_name' => _x( 'Jam', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Jams', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Listened to', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'jam-of', // microformats 2 property + 'format' => 'audio', // Post Format that maps to this + 'description' => __( 'a particularly personally meaningful song (a listen with added emphasis)', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/jam', + ), + 'read' => array( + 'singular_name' => _x( 'Read', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Reads', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Read', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'read', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'reading a book, magazine, newspaper, other physical document, or online post', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/read', + ), + 'quote' => array( + 'singular_name' => _x( 'Quote', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Quotes', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Quoted', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'quotation-of', // microformats 2 property + 'format' => 'quote', // Post Format that maps to this + 'description' => __( 'quoted content', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/quote', + ), + 'mood' => array( + 'singular_name' => _x( 'Mood', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Moods', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Felt', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'mood', // microformats 2 property + 'format' => 'status', // Post Format that maps to this + 'description' => __( 'how you are feeling (example: happy, sad, indifferent, etc.)', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/mood', + ), + 'recipe' => array( + 'singular_name' => _x( 'Recipe', 'indieweb-post-kinds' ), // Name for one instance of the kind + 'name' => _x( 'Recipes', 'indieweb-post-kinds' ), // General name for the kind plural + 'verb' => _x( 'Cooked', 'indieweb-post-kinds' ), // The string for the verb or action (liked this) + 'property' => 'recipe', // microformats 2 property + 'format' => '', // Post Format that maps to this + 'description' => __( 'list of ingredients and directions for making food or drink', 'indieweb-post-kinds' ), + 'description-url' => 'https://indieweb.org/recipe', + ), ); - return apply_filters( 'kind_properties', $strings ); - } - - // Replaces need for Replacing the Entire Excerpt - public static function semantic_post_type($post_type, $post_id) { - return _x( 'this', 'indieweb-post-kinds' ) . ' ' . strtolower( get_post_kind( $post_id ) ); - } - - // Replacement for the Semantic Linkbacks Comment Excerpt - public static function comment_text_excerpt($text, $comment = null, $args = array()) { - // only change text for pingbacks/trackbacks/webmentions - if ( ! $comment || '' === $comment->comment_type || ! get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_canonical', true ) ) { - return $text; + $kinds = apply_filters( 'kind_info', $kinds ); + if ( 'all' === $kind ) { + return $kinds; } - // check comment type - $comment_type = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_type', true ); - if ( ! $comment_type || ! in_array( $comment_type, array_keys( SemanticLinkbacksPlugin::get_comment_type_strings() ) ) ) { - $comment_type = 'mention'; + if ( ! array_key_exists( $kind, $kinds ) ) { + return false; } - $_kind = get_the_terms( $comment->comment_post_ID, 'kind' ); - if ( ! empty( $_kind ) ) { - $kind = array_shift( $_kind ); - $kindstrings = self::get_strings(); - $post_format = $kindstrings[ $kind->slug ]; - } else { - $post_format = get_post_format( $comment->comment_post_ID ); - // replace "standard" with "Article" - if ( ! $post_format || 'standard' === $post_format ) { - $post_format = 'Article'; - } else { - $post_formatstrings = get_post_format_strings(); - // get the "nice" name - $post_format = $post_formatstrings[ $post_format ]; - } + $k = $kinds[ $kind ]; + if ( 'all' === $property ) { + return $k; } - // generate the verb, for example "mentioned" or "liked" - $comment_type_excerpts = SemanticLinkbacksPlugin::get_comment_type_excerpts(); - // get URL canonical url... - $url = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_canonical', true ); - // ...or fall back to source - if ( ! $url ) { - $url = get_comment_meta( $comment->comment_ID, 'semantic_linkbacks_source', true ); + if ( ! array_key_exists( $property, $k ) ) { + return false; } - // parse host - $host = parse_url( $url, PHP_URL_HOST ); - // strip leading www, if any - $host = preg_replace( '/^www\./', '', $host ); - // generate output - $text = sprintf( $comment_type_excerpts[ $comment_type ], get_comment_author_link( $comment->comment_ID ), 'this ' . $post_format, $url, $host ); - return apply_filters( 'semantic_linkbacks_excerpt', $text ); + return $k[ $property ]; } public static function webmention_links( $links, $post_ID ) { @@ -437,18 +475,18 @@ public static function webmention_links( $links, $post_ID ) { public static function kind_dropdown( $post_type, $which ) { if ( 'post' === $post_type ) { $taxonomy = 'kind'; - $selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : ''; - $kind_taxonomy = get_taxonomy($taxonomy); + $selected = isset( $_GET[ $taxonomy ] ) ? $_GET[ $taxonomy ] : ''; + $kind_taxonomy = get_taxonomy( $taxonomy ); wp_dropdown_categories( array( - 'show_option_all' => __("All {$kind_taxonomy->label}", 'indieweb-post-kinds' ), - 'taxonomy' => $taxonomy, - 'name' => $taxonomy, - 'orderby' => 'name', - 'selected' => $selected, - 'hierarchical' => false, - 'show_count' => true, - 'hide_empty' => true, - 'value_field' => 'slug' + 'show_option_all' => __( "All {$kind_taxonomy->label}", 'indieweb-post-kinds' ), + 'taxonomy' => $taxonomy, + 'name' => $taxonomy, + 'orderby' => 'name', + 'selected' => $selected, + 'hierarchical' => false, + 'show_count' => true, + 'hide_empty' => true, + 'value_field' => 'slug', ) ); } } @@ -458,7 +496,7 @@ public static function publish ( $ID, $post = null ) { return; } if ( count( wp_get_post_terms( $ID,'kind' ) ) <= 0 ) { - set_post_kind( $ID, get_option('kind_default') ); + set_post_kind( $ID, get_option( 'kind_default' ) ); } } @@ -488,6 +526,9 @@ public static function kinds_as_type($classes) { } public static function post_class($classes) { + if ( 'post' !== get_post_type() ) { + return $classes; + } // Adds kind classes to post if ( ! is_singular() ) { $classes = self::kinds_as_type( $classes ); @@ -497,6 +538,9 @@ public static function post_class($classes) { } public static function body_class($classes) { + if ( 'post' !== get_post_type() ) { + return $classes; + } // Adds kind classes to body if ( is_singular() ) { $classes = self::kinds_as_type( $classes ); @@ -504,19 +548,6 @@ public static function body_class($classes) { return $classes; } - /** - * Returns true if kind is a response type kind. - * This means dynamically generated content is added - * - * @param string $kind The post kind slug. - * @return true/false. - */ - public static function response_kind( $kind ) { - $not_responses = array( 'article', 'note' , 'photo' ); - if ( in_array( $kind, $not_responses ) ) { return false; - } else { return true; } - } - /** * Returns a pretty, translated version of a post kind slug * @@ -524,8 +555,8 @@ public static function response_kind( $kind ) { * @return string The translated post format name. */ public static function get_post_kind_string( $slug ) { - $strings = self::get_strings(); - return ( isset( $strings[ $slug ] ) ) ? $strings[ $slug ] : ''; + $string = self::get_kind_info( $slug, 'singular_name' ); + return $slug ? $slug : ''; } /** @@ -554,8 +585,8 @@ public static function get_post_kind_slug( $post = null ) { public static function get_post_kind( $post = null ) { $kind = get_post_kind_slug( $post ); if ( $kind ) { - $strings = self::get_strings(); - return $strings[ $kind ]; + return self::get_kind_info( $kind, 'singular_name' ); + ; } else { return false; } @@ -591,10 +622,10 @@ public static function has_post_kind( $kinds = array(), $post = null ) { public static function set_post_kind( $post, $kind = 'article' ) { $post = get_post( $post ); if ( empty( $post ) ) { - return new WP_Error( 'invalid_post', __( 'Invalid post' ) ); } + return new WP_Error( 'invalid_post', __( 'Invalid post', 'indieweb-post-kinds' ) ); } $kind = sanitize_key( $kind ); - if ( ! array_key_exists( $kind, self::get_strings() ) ) { - $kind = 'article'; + if ( ! self::get_kind_info( $kind, 'all' ) ) { + return new WP_Error( 'invalid_kind', __( 'Invalid Kind', 'indieweb-post-kinds' ) ); } return wp_set_post_terms( $post->ID, $kind, 'kind' ); } @@ -604,54 +635,6 @@ public static function get_icon( $kind ) { $sprite = apply_filters( 'kind_icon_sprite', plugin_dir_url( __FILE__ ) . 'kind-sprite.svg', $kind ); return ''; } - - /** - * Take mf2 properties and set a post kind - * - * @param array $input Micropub Request in JSON - * @param array $wp_args Arguments passed to insert or update posts - */ - - public static function micropub_set_kind( $input, $wp_args ) { - // Only continue if create or update - if ( ! $wp_args ) { - return; - } - // If there are no properties in the request set it as note - if ( ! isset( $input['properties'] ) ) { - set_post_kind( $wp_args['ID'], 'note' ); - } - if ( isset( $input['properties']['rsvp'] ) ) { - set_post_kind( $wp_args['ID'], 'rsvp' ); - return; - } - if ( isset( $input['properties']['in-reply-to'] ) ) { - set_post_kind( $wp_args['ID'], 'reply' ); - return; - } - if ( isset( $input['properties']['bookmark-of'] ) || isset( $input['properties']['bookmark'] ) ) { - set_post_kind( $wp_args['ID'], 'bookmark' ); - return; - } - if ( isset( $input['properties']['in-reply-to'] ) ) { - set_post_kind( $wp_args['ID'], 'reply' ); - return; - } - // This basically adds Teacup support - if ( isset( $input['properties']['p3k-food'] ) ) { - if ( isset( $input['properties']['p3k-type'] ) ) { - if ( 'drink' === $input['properties']['p3k-type'] ) { - set_post_kind( $wp_args['ID'], 'drink' ); - return; - } - set_post_kind( $post_id, 'eat' ); - return; - } - } - // If it got all the way down here assume it is a note - set_post_kind( $wp_args['ID'], 'note' ); - } - } // End Class Kind_Taxonomy ?> diff --git a/includes/class-kind-view.php b/includes/class-kind-view.php index 6b95826..9d0719e 100644 --- a/includes/class-kind-view.php +++ b/includes/class-kind-view.php @@ -139,7 +139,10 @@ public static function get_embed( $url ) { * * @return array A translated post type string for specific domain or 'a post' */ - public static function get_post_type_string($url) { + public static function get_post_type_string( $url ) { + if ( ! $url ) { + return ' '; + } $strings = array( 'twitter.com' => _x( 'a tweet', 'indieweb-post-kinds' ), 'vimeo.com' => _x( 'a video', 'indieweb-post-kinds' ), @@ -239,7 +242,7 @@ public static function get_cite_title($cite, $url) { if ( is_array( $url ) ) { $url = $url[0]; } - if ( ! array_key_exists( 'name', $cite ) && ! empty( $url ) ) { + if ( ! array_key_exists( 'name', $cite ) ) { $cite['name'] = self::get_post_type_string( $url ); } if ( isset( $url ) ) { diff --git a/includes/class-link-preview.php b/includes/class-link-preview.php index 0199c8a..b26efdc 100755 --- a/includes/class-link-preview.php +++ b/includes/class-link-preview.php @@ -100,6 +100,14 @@ public static function parse( $request ) { } return new WP_Error( 'invalid_url' , __( 'Missing or Invalid URL' , 'indieweb-post-kinds' ), array( 'status' => 400 ) ); } + + public static function localparse( $url ) { + if ( ! $url ) { + return new WP_Error( 'invalid_url' , __( 'Missing or Invalid URL' , 'indieweb-post-kinds' ), array( 'status' => 400 ) ); + } + $content = Parse_Mf2::fetch( $url ); + return self::mergeparse( $content, $url ); + } diff --git a/indieweb-post-kinds.php b/indieweb-post-kinds.php index 497f0c2..bc64de2 100755 --- a/indieweb-post-kinds.php +++ b/indieweb-post-kinds.php @@ -7,7 +7,7 @@ * Plugin Name: Post Kinds * Plugin URI: https://wordpress.org/plugins/indieweb-post-kinds/ * Description: Ever want to reply to someone else's post with a post on your own site? Or to "like" someone else's post, but with your own site? - * Version: 2.5.1 + * Version: 2.5.2 * Author: David Shanske * Author URI: https://david.shanske.com * Text Domain: indieweb-post-kinds @@ -23,7 +23,7 @@ add_action( 'init', array( 'Post_Kinds_Plugin', 'init' ) ); class Post_Kinds_Plugin { - public static $version = '2.5.1'; + public static $version = '2.5.2'; public static function init() { // Add Kind Taxonomy. require_once plugin_dir_path( __FILE__ ) . 'includes/class-kind-taxonomy.php'; @@ -38,6 +38,10 @@ public static function plugins_loaded() { // Add Kind Global Functions. require_once plugin_dir_path( __FILE__ ) . '/includes/kind-functions.php'; + // Plugin Specific Kind Customizations + require_once plugin_dir_path( __FILE__ ) . '/includes/class-kind-plugins.php'; + add_action( 'init' , array( 'Kind_Plugins', 'init' ) ); + // Config Settings. require_once plugin_dir_path( __FILE__ ) . 'includes/class-kind-config.php'; add_action( 'init' , array( 'Kind_Config', 'init' ) ); diff --git a/languages/post_kinds.pot b/languages/post_kinds.pot index 158251c..4c48d64 100644 --- a/languages/post_kinds.pot +++ b/languages/post_kinds.pot @@ -2,10 +2,10 @@ # This file is distributed under the same license as the Post Kinds package. msgid "" msgstr "" -"Project-Id-Version: Post Kinds 2.5.0\n" +"Project-Id-Version: Post Kinds 2.5.2\n" "Report-Msgid-Bugs-To: " "http://wordpress.org/support/plugin/indieweb-post-kinds\n" -"POT-Creation-Date: 2017-03-18 04:07:31+00:00\n" +"POT-Creation-Date: 2017-04-14 17:41:45+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -27,11 +27,11 @@ msgid "Default Kind" msgstr "" #: includes/class-kind-config.php:94 -msgid "Add Rich Embed Support for Whitelisted Sites" +msgid "Use Rich Embed Support for Responses to Whitelisted Sites" msgstr "" #: includes/class-kind-config.php:101 -msgid "Disable Content Protection on Responses" +msgid "Disable KSES Content Protection on Responses(Advanced Feature)" msgstr "" #: includes/class-kind-config.php:110 @@ -42,19 +42,19 @@ msgstr "" msgid "Post Kinds" msgstr "" -#: includes/class-kind-config.php:237 +#: includes/class-kind-config.php:236 msgid "Indieweb Post Kinds" msgstr "" -#: includes/class-kind-config.php:239 +#: includes/class-kind-config.php:238 msgid "Adds support for responding and interacting with other sites." msgstr "" -#: includes/class-kind-config.php:251 includes/class-kind-tabmeta.php:179 +#: includes/class-kind-config.php:250 includes/class-kind-tabmeta.php:179 msgid "Post Properties" msgstr "" -#: includes/class-kind-config.php:252 +#: includes/class-kind-config.php:251 msgid "" "\n" "\t\t\t\t

    The Post Properties tab represents the Microformats properties " @@ -121,11 +121,135 @@ msgstr "" msgid "RSVP" msgstr "" -#: includes/class-kind-taxonomy.php:594 +#: includes/class-kind-taxonomy.php:207 +msgid "traditional long form content: a post with an explicit title and body" +msgstr "" + +#: includes/class-kind-taxonomy.php:216 +msgid "" +"short content: a post or status update with just plain content and " +"typically without a title" +msgstr "" + +#: includes/class-kind-taxonomy.php:225 +msgid "a reply to content typically on another site" +msgstr "" + +#: includes/class-kind-taxonomy.php:234 +msgid "a complete reposting of content from another site" +msgstr "" + +#: includes/class-kind-taxonomy.php:243 +msgid "a way to pay compliments to the original post/poster of external content" +msgstr "" + +#: includes/class-kind-taxonomy.php:252 +msgid "special to the author" +msgstr "" + +#: includes/class-kind-taxonomy.php:261 +msgid "storing a link/bookmark for personal use or sharing with others" +msgstr "" + +#: includes/class-kind-taxonomy.php:270 +msgid "a post with an embedded image/photo as its primary focus" +msgstr "" + +#: includes/class-kind-taxonomy.php:279 +msgid "" +"allows you to tag a post as being of a specific category or tag, or for " +"person tagging" +msgstr "" + +#: includes/class-kind-taxonomy.php:288 +msgid "a specific type of reply regarding attendance of an event" +msgstr "" + +#: includes/class-kind-taxonomy.php:297 +msgid "listening to audio; sometimes called a scrobble" +msgstr "" + +#: includes/class-kind-taxonomy.php:306 +msgid "" +"watching a movie, television show, online video, play or other visual-based " +"event" +msgstr "" + +#: includes/class-kind-taxonomy.php:315 +msgid "identifying you are at a particular geographic location" +msgstr "" + +#: includes/class-kind-taxonomy.php:324 +msgid "" +"a post indicating a desire/wish. The archive of which would be a wishlist, " +"such as a gift registry or similar" +msgstr "" + +#: includes/class-kind-taxonomy.php:333 +msgid "playing a game" +msgstr "" + +#: includes/class-kind-taxonomy.php:342 +msgid "current weather conditions" +msgstr "" + +#: includes/class-kind-taxonomy.php:351 +msgid "" +"some form of physical activity or workout (examples: walk, run, cycle, " +"hike, yoga, etc.)" +msgstr "" + +#: includes/class-kind-taxonomy.php:360 +msgid "represents a geographic journey" +msgstr "" + +#: includes/class-kind-taxonomy.php:369 +msgid "parts of a scheduled trip including transit by car, plane, train, etc." +msgstr "" + +#: includes/class-kind-taxonomy.php:378 +msgid "what you are eating, perhaps for a food dairy" +msgstr "" + +#: includes/class-kind-taxonomy.php:387 +msgid "what you are drinking, perhaps for a food dairy" +msgstr "" + +#: includes/class-kind-taxonomy.php:396 +msgid "" +"indicating you are now following or subscribing to another person`s " +"activities online" +msgstr "" + +#: includes/class-kind-taxonomy.php:405 +msgid "a particularly personally meaningful song (a listen with added emphasis)" +msgstr "" + +#: includes/class-kind-taxonomy.php:414 +msgid "reading a book, magazine, newspaper, other physical document, or online post" +msgstr "" + +#: includes/class-kind-taxonomy.php:423 +msgid "quoted content" +msgstr "" + +#: includes/class-kind-taxonomy.php:432 +msgid "how you are feeling (example: happy, sad, indifferent, etc.)" +msgstr "" + +#: includes/class-kind-taxonomy.php:441 +msgid "list of ingredients and directions for making food or drink" +msgstr "" + +#: includes/class-kind-taxonomy.php:625 msgid "Invalid post" msgstr "" -#: includes/class-link-preview.php:101 +#: includes/class-kind-taxonomy.php:628 +msgid "Invalid Kind" +msgstr "" + +#: includes/class-link-preview.php:101 includes/class-link-preview.php:106 msgid "Missing or Invalid URL" msgstr "" @@ -233,488 +357,478 @@ msgstr "" msgid "https://david.shanske.com" msgstr "" -#: includes/class-kind-taxonomy.php:106 +#: includes/class-kind-plugins.php:25 +msgctxt "indieweb-post-kinds" +msgid "this" +msgstr "" + +#: includes/class-kind-taxonomy.php:55 msgctxt "indieweb-post-kinds" msgid "Kinds" msgstr "" -#: includes/class-kind-taxonomy.php:107 +#: includes/class-kind-taxonomy.php:56 msgctxt "indieweb-post-kinds" msgid "Kind" msgstr "" -#: includes/class-kind-taxonomy.php:108 +#: includes/class-kind-taxonomy.php:57 msgctxt "indieweb-post-kinds" msgid "Search Kinds" msgstr "" -#: includes/class-kind-taxonomy.php:109 +#: includes/class-kind-taxonomy.php:58 msgctxt "indieweb-post-kinds" msgid "Popular Kinds" msgstr "" -#: includes/class-kind-taxonomy.php:110 +#: includes/class-kind-taxonomy.php:59 msgctxt "indieweb-post-kinds" msgid "All Kinds" msgstr "" -#: includes/class-kind-taxonomy.php:111 +#: includes/class-kind-taxonomy.php:60 msgctxt "indieweb-post-kinds" msgid "Parent Kind" msgstr "" -#: includes/class-kind-taxonomy.php:112 +#: includes/class-kind-taxonomy.php:61 msgctxt "indieweb-post-kinds" msgid "Parent Kind:" msgstr "" -#: includes/class-kind-taxonomy.php:113 +#: includes/class-kind-taxonomy.php:62 msgctxt "indieweb-post-kinds" msgid "Edit Kind" msgstr "" -#: includes/class-kind-taxonomy.php:114 +#: includes/class-kind-taxonomy.php:63 msgctxt "indieweb-post-kinds" msgid "View Kind" msgstr "" -#: includes/class-kind-taxonomy.php:115 +#: includes/class-kind-taxonomy.php:64 msgctxt "indieweb-post-kinds" msgid "Update Kind" msgstr "" -#: includes/class-kind-taxonomy.php:116 +#: includes/class-kind-taxonomy.php:65 msgctxt "indieweb-post-kinds" msgid "Add New Kind" msgstr "" -#: includes/class-kind-taxonomy.php:117 +#: includes/class-kind-taxonomy.php:66 msgctxt "indieweb-post-kinds" msgid "New Kind" msgstr "" -#: includes/class-kind-taxonomy.php:118 +#: includes/class-kind-taxonomy.php:67 msgctxt "indieweb-post-kinds" msgid "Separate kinds with commas" msgstr "" -#: includes/class-kind-taxonomy.php:119 +#: includes/class-kind-taxonomy.php:68 msgctxt "indieweb-post-kinds" msgid "Add or remove kinds" msgstr "" -#: includes/class-kind-taxonomy.php:120 +#: includes/class-kind-taxonomy.php:69 msgctxt "indieweb-post-kinds" msgid "Choose from the most used kinds" msgstr "" -#: includes/class-kind-taxonomy.php:121 +#: includes/class-kind-taxonomy.php:70 msgctxt "indieweb-post-kinds" msgid "No kinds found" msgstr "" -#: includes/class-kind-taxonomy.php:122 +#: includes/class-kind-taxonomy.php:71 msgctxt "indieweb-post-kinds" msgid "No kinds" msgstr "" -#: includes/class-kind-taxonomy.php:229 +#: includes/class-kind-taxonomy.php:202 msgctxt "indieweb-post-kinds" msgid "Article" msgstr "" -#: includes/class-kind-taxonomy.php:230 +#: includes/class-kind-taxonomy.php:203 msgctxt "indieweb-post-kinds" -msgid "Note" -msgstr "" - -#: includes/class-kind-taxonomy.php:231 -msgctxt "indieweb-post-kinds" -msgid "Reply" -msgstr "" - -#: includes/class-kind-taxonomy.php:232 -msgctxt "indieweb-post-kinds" -msgid "Repost" -msgstr "" - -#: includes/class-kind-taxonomy.php:233 -msgctxt "indieweb-post-kinds" -msgid "Like" -msgstr "" - -#: includes/class-kind-taxonomy.php:234 -msgctxt "indieweb-post-kinds" -msgid "Favorite" +msgid "Articles" msgstr "" -#: includes/class-kind-taxonomy.php:235 +#: includes/class-kind-taxonomy.php:204 includes/class-kind-taxonomy.php:213 +#: includes/class-kind-taxonomy.php:267 includes/class-kind-taxonomy.php:339 msgctxt "indieweb-post-kinds" -msgid "Bookmark" +msgid " " msgstr "" -#: includes/class-kind-taxonomy.php:236 +#: includes/class-kind-taxonomy.php:211 msgctxt "indieweb-post-kinds" -msgid "Photo" +msgid "Note" msgstr "" -#: includes/class-kind-taxonomy.php:237 +#: includes/class-kind-taxonomy.php:212 msgctxt "indieweb-post-kinds" -msgid "Tag" +msgid "Notes" msgstr "" -#: includes/class-kind-taxonomy.php:238 +#: includes/class-kind-taxonomy.php:220 msgctxt "indieweb-post-kinds" -msgid "RSVP" +msgid "Reply" msgstr "" -#: includes/class-kind-taxonomy.php:239 +#: includes/class-kind-taxonomy.php:221 msgctxt "indieweb-post-kinds" -msgid "Listen" +msgid "Replies" msgstr "" -#: includes/class-kind-taxonomy.php:240 +#: includes/class-kind-taxonomy.php:222 msgctxt "indieweb-post-kinds" -msgid "Watch" +msgid "Replied" msgstr "" -#: includes/class-kind-taxonomy.php:241 +#: includes/class-kind-taxonomy.php:229 msgctxt "indieweb-post-kinds" -msgid "Checkin" +msgid "Repost" msgstr "" -#: includes/class-kind-taxonomy.php:242 +#: includes/class-kind-taxonomy.php:230 msgctxt "indieweb-post-kinds" -msgid "Wish" +msgid "Reposts" msgstr "" -#: includes/class-kind-taxonomy.php:243 +#: includes/class-kind-taxonomy.php:231 msgctxt "indieweb-post-kinds" -msgid "Play" +msgid "Reposted" msgstr "" -#: includes/class-kind-taxonomy.php:244 includes/class-kind-taxonomy.php:282 +#: includes/class-kind-taxonomy.php:238 msgctxt "indieweb-post-kinds" -msgid "Weather" +msgid "Like" msgstr "" -#: includes/class-kind-taxonomy.php:245 +#: includes/class-kind-taxonomy.php:239 msgctxt "indieweb-post-kinds" -msgid "Exercise" +msgid "Likes" msgstr "" -#: includes/class-kind-taxonomy.php:246 +#: includes/class-kind-taxonomy.php:240 msgctxt "indieweb-post-kinds" -msgid "Travel" +msgid "Liked" msgstr "" #: includes/class-kind-taxonomy.php:247 msgctxt "indieweb-post-kinds" -msgid "Itinerary" +msgid "Favorite" msgstr "" -#: includes/class-kind-taxonomy.php:248 includes/class-kind-taxonomy.php:286 +#: includes/class-kind-taxonomy.php:248 msgctxt "indieweb-post-kinds" -msgid "Eat" +msgid "Favorites" msgstr "" #: includes/class-kind-taxonomy.php:249 msgctxt "indieweb-post-kinds" -msgid "Drink" +msgid "Favorited" msgstr "" -#: includes/class-kind-taxonomy.php:250 +#: includes/class-kind-taxonomy.php:256 msgctxt "indieweb-post-kinds" -msgid "Follow" +msgid "Bookmark" msgstr "" -#: includes/class-kind-taxonomy.php:251 +#: includes/class-kind-taxonomy.php:257 msgctxt "indieweb-post-kinds" -msgid "Jam" +msgid "Bookmarks" msgstr "" -#: includes/class-kind-taxonomy.php:252 includes/class-kind-taxonomy.php:290 +#: includes/class-kind-taxonomy.php:258 msgctxt "indieweb-post-kinds" -msgid "Read" +msgid "Bookmarked" msgstr "" -#: includes/class-kind-taxonomy.php:253 +#: includes/class-kind-taxonomy.php:265 msgctxt "indieweb-post-kinds" -msgid "Quote" +msgid "Photo" msgstr "" -#: includes/class-kind-taxonomy.php:254 +#: includes/class-kind-taxonomy.php:266 msgctxt "indieweb-post-kinds" -msgid "Mood" +msgid "Photos" msgstr "" -#: includes/class-kind-taxonomy.php:255 +#: includes/class-kind-taxonomy.php:274 msgctxt "indieweb-post-kinds" -msgid "Recipe" +msgid "Tag" msgstr "" -#: includes/class-kind-taxonomy.php:267 +#: includes/class-kind-taxonomy.php:275 msgctxt "indieweb-post-kinds" -msgid "Articles" +msgid "Tags" msgstr "" -#: includes/class-kind-taxonomy.php:268 +#: includes/class-kind-taxonomy.php:276 msgctxt "indieweb-post-kinds" -msgid "Notes" +msgid "Tagged" msgstr "" -#: includes/class-kind-taxonomy.php:269 +#: includes/class-kind-taxonomy.php:283 msgctxt "indieweb-post-kinds" -msgid "Replies" +msgid "RSVP" msgstr "" -#: includes/class-kind-taxonomy.php:270 +#: includes/class-kind-taxonomy.php:284 msgctxt "indieweb-post-kinds" -msgid "Reposts" +msgid "RSVPs" msgstr "" -#: includes/class-kind-taxonomy.php:271 +#: includes/class-kind-taxonomy.php:285 msgctxt "indieweb-post-kinds" -msgid "Likes" +msgid "RSVPed" msgstr "" -#: includes/class-kind-taxonomy.php:272 +#: includes/class-kind-taxonomy.php:292 msgctxt "indieweb-post-kinds" -msgid "Favorites" +msgid "Listen" msgstr "" -#: includes/class-kind-taxonomy.php:273 +#: includes/class-kind-taxonomy.php:293 msgctxt "indieweb-post-kinds" -msgid "Bookmarks" +msgid "Listens" msgstr "" -#: includes/class-kind-taxonomy.php:274 +#: includes/class-kind-taxonomy.php:294 msgctxt "indieweb-post-kinds" -msgid "Photos" +msgid "Listened" msgstr "" -#: includes/class-kind-taxonomy.php:275 +#: includes/class-kind-taxonomy.php:301 msgctxt "indieweb-post-kinds" -msgid "Tags" +msgid "Watch" msgstr "" -#: includes/class-kind-taxonomy.php:276 +#: includes/class-kind-taxonomy.php:302 msgctxt "indieweb-post-kinds" -msgid "RSVPs" +msgid "Watches" msgstr "" -#: includes/class-kind-taxonomy.php:277 +#: includes/class-kind-taxonomy.php:303 msgctxt "indieweb-post-kinds" -msgid "Listens" +msgid "Watched" msgstr "" -#: includes/class-kind-taxonomy.php:278 +#: includes/class-kind-taxonomy.php:310 msgctxt "indieweb-post-kinds" -msgid "Watches" +msgid "Checkin" msgstr "" -#: includes/class-kind-taxonomy.php:279 +#: includes/class-kind-taxonomy.php:311 msgctxt "indieweb-post-kinds" msgid "Checkins" msgstr "" -#: includes/class-kind-taxonomy.php:280 +#: includes/class-kind-taxonomy.php:312 msgctxt "indieweb-post-kinds" -msgid "Wishlist" +msgid "Checked into" msgstr "" -#: includes/class-kind-taxonomy.php:281 +#: includes/class-kind-taxonomy.php:319 msgctxt "indieweb-post-kinds" -msgid "Plays" +msgid "Wish" msgstr "" -#: includes/class-kind-taxonomy.php:283 +#: includes/class-kind-taxonomy.php:320 msgctxt "indieweb-post-kinds" -msgid "Exercises" +msgid "Wishes" msgstr "" -#: includes/class-kind-taxonomy.php:284 +#: includes/class-kind-taxonomy.php:321 msgctxt "indieweb-post-kinds" -msgid "Travels" +msgid "Wished" msgstr "" -#: includes/class-kind-taxonomy.php:285 +#: includes/class-kind-taxonomy.php:328 msgctxt "indieweb-post-kinds" -msgid "Itineraries" +msgid "Play" msgstr "" -#: includes/class-kind-taxonomy.php:287 +#: includes/class-kind-taxonomy.php:329 msgctxt "indieweb-post-kinds" -msgid "Drinks" +msgid "Playing" msgstr "" -#: includes/class-kind-taxonomy.php:288 +#: includes/class-kind-taxonomy.php:330 msgctxt "indieweb-post-kinds" -msgid "Follows" +msgid "Played" msgstr "" -#: includes/class-kind-taxonomy.php:289 +#: includes/class-kind-taxonomy.php:337 includes/class-kind-taxonomy.php:338 msgctxt "indieweb-post-kinds" -msgid "Jams" +msgid "Weather" msgstr "" -#: includes/class-kind-taxonomy.php:291 +#: includes/class-kind-taxonomy.php:346 includes/class-kind-taxonomy.php:347 msgctxt "indieweb-post-kinds" -msgid "Quotes" +msgid "Exercise" msgstr "" -#: includes/class-kind-taxonomy.php:292 +#: includes/class-kind-taxonomy.php:348 msgctxt "indieweb-post-kinds" -msgid "Moods" +msgid "Exercised" msgstr "" -#: includes/class-kind-taxonomy.php:293 +#: includes/class-kind-taxonomy.php:355 msgctxt "indieweb-post-kinds" -msgid "Recipes" +msgid "Trip" msgstr "" -#: includes/class-kind-taxonomy.php:305 includes/class-kind-taxonomy.php:306 -#: includes/class-kind-taxonomy.php:312 +#: includes/class-kind-taxonomy.php:356 msgctxt "indieweb-post-kinds" -msgid " " +msgid "Trips" msgstr "" -#: includes/class-kind-taxonomy.php:307 +#: includes/class-kind-taxonomy.php:357 includes/class-kind-taxonomy.php:366 msgctxt "indieweb-post-kinds" -msgid "In Reply To" +msgid "Travelled" msgstr "" -#: includes/class-kind-taxonomy.php:308 +#: includes/class-kind-taxonomy.php:364 msgctxt "indieweb-post-kinds" -msgid "Reposted" +msgid "Itinerary" msgstr "" -#: includes/class-kind-taxonomy.php:309 +#: includes/class-kind-taxonomy.php:365 msgctxt "indieweb-post-kinds" -msgid "Liked" +msgid "Itineraries" msgstr "" -#: includes/class-kind-taxonomy.php:310 +#: includes/class-kind-taxonomy.php:373 includes/class-kind-taxonomy.php:374 msgctxt "indieweb-post-kinds" -msgid "Favorited" +msgid "Eat" msgstr "" -#: includes/class-kind-taxonomy.php:311 +#: includes/class-kind-taxonomy.php:375 msgctxt "indieweb-post-kinds" -msgid "Bookmarked" +msgid "Ate" msgstr "" -#: includes/class-kind-taxonomy.php:313 +#: includes/class-kind-taxonomy.php:382 msgctxt "indieweb-post-kinds" -msgid "Tagged" +msgid "Drink" msgstr "" -#: includes/class-kind-taxonomy.php:314 +#: includes/class-kind-taxonomy.php:383 msgctxt "indieweb-post-kinds" -msgid "RSVPed" +msgid "Drinks" msgstr "" -#: includes/class-kind-taxonomy.php:315 +#: includes/class-kind-taxonomy.php:384 msgctxt "indieweb-post-kinds" -msgid "Listened to " +msgid "Drank" msgstr "" -#: includes/class-kind-taxonomy.php:316 +#: includes/class-kind-taxonomy.php:391 msgctxt "indieweb-post-kinds" -msgid "Watched" +msgid "Follow" msgstr "" -#: includes/class-kind-taxonomy.php:317 +#: includes/class-kind-taxonomy.php:392 msgctxt "indieweb-post-kinds" -msgid "Checked In At" +msgid "Follows" msgstr "" -#: includes/class-kind-taxonomy.php:318 +#: includes/class-kind-taxonomy.php:393 msgctxt "indieweb-post-kinds" -msgid "Desires" +msgid "Followed" msgstr "" -#: includes/class-kind-taxonomy.php:319 +#: includes/class-kind-taxonomy.php:400 msgctxt "indieweb-post-kinds" -msgid "Played" +msgid "Jam" msgstr "" -#: includes/class-kind-taxonomy.php:320 +#: includes/class-kind-taxonomy.php:401 msgctxt "indieweb-post-kinds" -msgid "Weathered" +msgid "Jams" msgstr "" -#: includes/class-kind-taxonomy.php:321 +#: includes/class-kind-taxonomy.php:402 msgctxt "indieweb-post-kinds" -msgid "Exercised" +msgid "Listened to" msgstr "" -#: includes/class-kind-taxonomy.php:322 includes/class-kind-taxonomy.php:323 +#: includes/class-kind-taxonomy.php:409 includes/class-kind-taxonomy.php:411 msgctxt "indieweb-post-kinds" -msgid "Traveled" +msgid "Read" msgstr "" -#: includes/class-kind-taxonomy.php:324 +#: includes/class-kind-taxonomy.php:410 msgctxt "indieweb-post-kinds" -msgid "Ate" +msgid "Reads" msgstr "" -#: includes/class-kind-taxonomy.php:325 +#: includes/class-kind-taxonomy.php:418 msgctxt "indieweb-post-kinds" -msgid "Drank" +msgid "Quote" msgstr "" -#: includes/class-kind-taxonomy.php:326 +#: includes/class-kind-taxonomy.php:419 msgctxt "indieweb-post-kinds" -msgid "Followed" +msgid "Quotes" msgstr "" -#: includes/class-kind-taxonomy.php:327 +#: includes/class-kind-taxonomy.php:420 msgctxt "indieweb-post-kinds" -msgid "Listened to" +msgid "Quoted" msgstr "" -#: includes/class-kind-taxonomy.php:328 +#: includes/class-kind-taxonomy.php:427 msgctxt "indieweb-post-kinds" -msgid "Is Reading" +msgid "Mood" msgstr "" -#: includes/class-kind-taxonomy.php:329 +#: includes/class-kind-taxonomy.php:428 msgctxt "indieweb-post-kinds" -msgid "Quoted" +msgid "Moods" msgstr "" -#: includes/class-kind-taxonomy.php:330 +#: includes/class-kind-taxonomy.php:429 msgctxt "indieweb-post-kinds" msgid "Felt" msgstr "" -#: includes/class-kind-taxonomy.php:331 +#: includes/class-kind-taxonomy.php:436 msgctxt "indieweb-post-kinds" -msgid "Cooked" +msgid "Recipe" msgstr "" -#: includes/class-kind-taxonomy.php:377 +#: includes/class-kind-taxonomy.php:437 msgctxt "indieweb-post-kinds" -msgid "this" +msgid "Recipes" +msgstr "" + +#: includes/class-kind-taxonomy.php:438 +msgctxt "indieweb-post-kinds" +msgid "Cooked" msgstr "" -#: includes/class-kind-view.php:144 +#: includes/class-kind-view.php:147 msgctxt "indieweb-post-kinds" msgid "a tweet" msgstr "" -#: includes/class-kind-view.php:145 includes/class-kind-view.php:146 +#: includes/class-kind-view.php:148 includes/class-kind-view.php:149 msgctxt "indieweb-post-kinds" msgid "a video" msgstr "" -#: includes/class-kind-view.php:147 +#: includes/class-kind-view.php:150 msgctxt "indieweb-post-kinds" msgid "an image" msgstr "" -#: includes/class-kind-view.php:153 +#: includes/class-kind-view.php:156 msgctxt "indieweb-post-kinds" msgid "a post" msgstr "" \ No newline at end of file diff --git a/readme.md b/readme.md index f1a28a4..3208431 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # Post Kinds # **Contributors:** dshanske **Tags:** indieweb, interaction, posts, webmention, share, like -**Stable tag:** 2.5.1 +**Stable tag:** 2.5.2 **Requires at least:** 4.7 **Tested up to:** 4.7.2 **License:** GPLv2 or later @@ -158,6 +158,13 @@ Indieweb Post Kinds had support for replying to Twitter posts using the Social N developer of this plugin. ## Changelog ## + = Version 2.5.2 = + * Generation of strings being moved from individual functions to one unified function to make management easier + * Description now appears on Archives + * Description now appears on settings page + * Adding of `kind-type` css class only to posts + * Enhance setting of kind based on micropub properties + * Only set post format on initial save not subsequent ones = Version 2.5.1 = * Fix bug hiding metabox * Add drop down filter for Kinds to View Posts diff --git a/readme.txt b/readme.txt index f91ba3f..4628d9d 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Post Kinds === Contributors: dshanske Tags: indieweb, interaction, posts, webmention, share, like -Stable tag: 2.5.1 +Stable tag: 2.5.2 Requires at least: 4.7 Tested up to: 4.7.2 License: GPLv2 or later @@ -154,6 +154,13 @@ Indieweb Post Kinds had support for replying to Twitter posts using the Social N developer of this plugin. == Changelog == + = Version 2.5.2 = + * Generation of strings being moved from individual functions to one unified function to make management easier + * Description now appears on Archives + * Description now appears on settings page + * Adding of `kind-type` css class only to posts + * Enhance setting of kind based on micropub properties + * Only set post format on initial save not subsequent ones = Version 2.5.1 = * Fix bug hiding metabox * Add drop down filter for Kinds to View Posts