Changeset 3036280
- Timestamp:
- 02/15/2024 12:44:23 PM (2 years ago)
- Location:
- findkit
- Files:
-
- 14 edited
- 1 copied
-
tags/0.5.9 (copied) (copied from findkit/trunk)
-
tags/0.5.9/.github/workflows/test.yml (modified) (1 diff)
-
tags/0.5.9/CHANGELOG.md (modified) (1 diff)
-
tags/0.5.9/package.json (modified) (1 diff)
-
tags/0.5.9/plugin.php (modified) (1 diff)
-
tags/0.5.9/readme.txt (modified) (1 diff)
-
tags/0.5.9/src/PageMeta.php (modified) (5 diffs)
-
tags/0.5.9/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/.github/workflows/test.yml (modified) (1 diff)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/plugin.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/src/PageMeta.php (modified) (5 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
findkit/tags/0.5.9/.github/workflows/test.yml
r3008127 r3036280 36 36 run: npm run tsc 37 37 38 - name: Check prettier 39 run: npm run prettier-check 40 38 41 - name: Build assets 39 42 run: npm run build 40 -
findkit/tags/0.5.9/CHANGELOG.md
r3028254 r3036280 1 ## v0.5.9 2 3 2024-02-15 4 5 - Ensure meta tag is rendered on all pages [e2f20ac](https://github.com/findkit/wp-findkit/commit/e2f20ac) - Esa-Matti Suuronen 6 - check prettier in ci [efea203](https://github.com/findkit/wp-findkit/commit/efea203) - Esa-Matti Suuronen 7 8 All changes https://github.com/findkit/wp-findkit/compare/v0.5.8...v0.5.9 9 1 10 ## v0.5.8 2 11 -
findkit/tags/0.5.9/package.json
r3028254 r3036280 12 12 "zip": "./tools/zip", 13 13 "prettier-write": "prettier --write src plugin.php", 14 "prettier-check": "prettier --check src plugin.php", 14 15 "dev": "git valu-hide-changes build && wp-scripts start src/scripts/*.ts*", 15 16 "build": "git valu-hide-changes build && wp-scripts build src/scripts/*.ts*", -
findkit/tags/0.5.9/plugin.php
r3028254 r3036280 10 10 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details 11 11 * Author: Findkit Team <findkit@findkit.com> 12 * Version: 0.5. 812 * Version: 0.5.9 13 13 * License: GPLv2 or later 14 14 */ -
findkit/tags/0.5.9/readme.txt
r3028254 r3036280 4 4 Requires at least: 6.0 5 5 Tested up to: 6.4.1 6 Stable tag: 0.5. 86 Stable tag: 0.5.9 7 7 Requires PHP: 7.2 8 8 Donate link: https://www.findkit.com/ -
findkit/tags/0.5.9/src/PageMeta.php
r3011329 r3036280 1 1 <?php 2 2 3 declare(strict_types=1); 3 4 … … 17 18 function __action_wp_head() 18 19 { 19 $ post = \get_queried_object();20 $object = \get_queried_object(); 20 21 21 if (!($post instanceof \WP_Post)) { 22 return; 23 } 24 25 $meta = self::get($post); 22 $meta = self::get($object); 26 23 27 24 if (empty($meta)) { … … 50 47 * See https://docs.findkit.com/crawler/meta-tag/ 51 48 */ 52 static function get( \WP_Post $post)49 static function get($object) 53 50 { 54 $public = $post->post_status === 'publish';51 $public = true; 55 52 56 $url_parts = parse_url(\home_url()); 57 $domain = $url_parts['host']; 53 if ($object instanceof \WP_Post) { 54 $public = $object->post_status === 'publish'; 55 } 58 56 59 $domain = \apply_filters('findkit_page_meta_domain', $domain, $post); 57 $meta = [ 58 // Do not show archive pages in search by default because commonly 59 // they contain only a lists of posts which is already indexed as 60 // the individual posts. 61 'showInSearch' => \is_archive() ? false : $public, 62 ]; 63 64 $domain = \apply_filters( 65 'findkit_page_meta_domain', 66 parse_url(\home_url())['host'], 67 $object 68 ); 60 69 61 70 $blogname_slug = \sanitize_title(self::get_blog_name()); … … 67 76 'wordpress', 68 77 'domain/' . $domain . '/' . 'wordpress', 69 'wp_post_type/' . $post->post_type,70 'domain/' . $domain . '/' . 'wp_post_type/' . $post->post_type,71 78 'wp_blog_name/' . $blogname_slug, 72 79 $blog_name_tag, … … 74 81 ]; 75 82 76 $public_taxonomies = \get_taxonomies(['public' => true], 'names'); 77 $post_taxonomies = \get_the_taxonomies($post->ID); 83 if ($object instanceof \WP_Post) { 84 $meta['title'] = $object->post_title; 85 $meta['created'] = \get_the_date('c', $object); 86 $meta['modified'] = \get_the_modified_date('c', $object); 78 87 79 foreach ($post_taxonomies as $taxonomy_key => $taxonomy_value) { 80 // only expose public taxonomies as tags 81 if (in_array($taxonomy_key, $public_taxonomies)) { 82 $terms = \get_the_terms($post, $taxonomy_key); 83 foreach ($terms as $term) { 84 array_push( 85 $tags, 86 'domain/' . 87 $domain . 88 '/' . 89 'wp_taxonomy/' . 90 $taxonomy_key . 91 '/' . 92 $term->slug 93 ); 94 array_push( 95 $tags, 96 'wp_taxonomy/' . $taxonomy_key . '/' . $term->slug 97 ); 98 } 88 // Defaults to true. Only used to explicitly disable showing the page in the findkit search. 89 if ( 90 \get_post_meta($object->ID, '_findkit_show_in_search', true) === 91 'no' 92 ) { 93 $meta['showInSearch'] = false; 99 94 } 100 }101 95 102 $title = \wp_specialchars_decode( 103 \is_archive() ? \get_the_archive_title() : $post->post_title 104 ); 96 $tags[] = 'wp_post_type/' . $object->post_type; 97 $tags[] = 98 'domain/' . 99 $domain . 100 '/' . 101 'wp_post_type/' . 102 $object->post_type; 105 103 106 $created = \get_the_date('c', $post); 107 $modified = \get_the_modified_date('c', $post); 108 $show_in_search = \is_archive() ? false : $public; 104 $public_taxonomies = \get_taxonomies(['public' => true], 'names'); 105 $post_taxonomies = \get_the_taxonomies($object->ID); 109 106 110 // Defaults to true. Only used to explicitly disable showing the page in the findkit search. 111 if ( 112 \get_post_meta($post->ID, '_findkit_show_in_search', true) === 'no' 113 ) { 114 $show_in_search = false; 115 } 116 117 $meta = [ 118 'showInSearch' => $show_in_search, 119 'title' => \html_entity_decode($title), 120 'created' => $created, 121 'modified' => $modified, 122 'tags' => $tags, 123 ]; 124 125 $superwords = \get_post_meta($post->ID, '_findkit_superwords', true); 126 127 if ($superwords) { 128 $superwords = trim($superwords); 129 if (!empty($superwords)) { 130 $meta['superwords'] = []; 131 foreach (preg_split('/\s+/', $superwords) as $word) { 132 $word = trim($word); 133 if ($word) { 134 $meta['superwords'][] = $word; 107 foreach ($post_taxonomies as $taxonomy_key => $taxonomy_value) { 108 // only expose public taxonomies as tags 109 if (in_array($taxonomy_key, $public_taxonomies)) { 110 $terms = \get_the_terms($object, $taxonomy_key); 111 foreach ($terms as $term) { 112 array_push( 113 $tags, 114 'domain/' . 115 $domain . 116 '/' . 117 'wp_taxonomy/' . 118 $taxonomy_key . 119 '/' . 120 $term->slug 121 ); 122 array_push( 123 $tags, 124 'wp_taxonomy/' . $taxonomy_key . '/' . $term->slug 125 ); 135 126 } 136 127 } 137 128 } 129 130 $superwords = \get_post_meta( 131 $object->ID, 132 '_findkit_superwords', 133 true 134 ); 135 136 if ($superwords) { 137 $superwords = trim($superwords); 138 if (!empty($superwords)) { 139 $meta['superwords'] = []; 140 foreach (preg_split('/\s+/', $superwords) as $word) { 141 $word = trim($word); 142 if ($word) { 143 $meta['superwords'][] = $word; 144 } 145 } 146 } 147 } 148 149 $content_no_highlight = \get_post_meta( 150 $object->ID, 151 '_findkit_content_no_highlight', 152 true 153 ); 154 155 if ($content_no_highlight) { 156 $content_no_highlight = trim($content_no_highlight); 157 if (!empty($content_no_highlight)) { 158 $meta['contentNoHighlight'] = $content_no_highlight; 159 } 160 } 161 162 // Use the post language if using polylang instead of the blog locale. 163 if (function_exists('\pll_get_post_language')) { 164 $meta['language'] = \pll_get_post_language($object->ID, 'slug'); 165 } 166 } elseif (\is_archive()) { 167 $meta['title'] = \get_the_archive_title(); 138 168 } 139 169 140 $content_no_highlight = \get_post_meta( 141 $post->ID, 142 '_findkit_content_no_highlight', 143 true 144 ); 170 $meta['title'] ??= \get_the_title(); 171 $meta['language'] ??= substr(\get_bloginfo('language'), 0, 2); 145 172 146 if ($content_no_highlight) { 147 $content_no_highlight = trim($content_no_highlight); 148 if (!empty($content_no_highlight)) { 149 $meta['contentNoHighlight'] = $content_no_highlight; 150 } 151 } 173 $meta['title'] = \wp_specialchars_decode($meta['title']); 174 $meta['tags'] = $tags; 152 175 153 // Use the post language if using polylang instead of the blog locale. 154 if (function_exists('\pll_get_post_language')) { 155 $meta['language'] = \pll_get_post_language($post->ID, 'slug'); 156 } else { 157 $meta['language'] = substr(\get_bloginfo('language'), 0, 2); 158 } 159 160 return apply_filters('findkit_page_meta', $meta, $post); 176 return apply_filters('findkit_page_meta', $meta, $object); 161 177 } 162 178 } -
findkit/tags/0.5.9/vendor/composer/installed.php
r3028254 r3036280 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' f0df1a718534e4b61ae70dfc5110b032626b42a3',6 'reference' => '2c615750627ca35925d06839acdeb8d74e679015', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' f0df1a718534e4b61ae70dfc5110b032626b42a3',16 'reference' => '2c615750627ca35925d06839acdeb8d74e679015', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../', -
findkit/trunk/.github/workflows/test.yml
r3008127 r3036280 36 36 run: npm run tsc 37 37 38 - name: Check prettier 39 run: npm run prettier-check 40 38 41 - name: Build assets 39 42 run: npm run build 40 -
findkit/trunk/CHANGELOG.md
r3028254 r3036280 1 ## v0.5.9 2 3 2024-02-15 4 5 - Ensure meta tag is rendered on all pages [e2f20ac](https://github.com/findkit/wp-findkit/commit/e2f20ac) - Esa-Matti Suuronen 6 - check prettier in ci [efea203](https://github.com/findkit/wp-findkit/commit/efea203) - Esa-Matti Suuronen 7 8 All changes https://github.com/findkit/wp-findkit/compare/v0.5.8...v0.5.9 9 1 10 ## v0.5.8 2 11 -
findkit/trunk/package.json
r3028254 r3036280 12 12 "zip": "./tools/zip", 13 13 "prettier-write": "prettier --write src plugin.php", 14 "prettier-check": "prettier --check src plugin.php", 14 15 "dev": "git valu-hide-changes build && wp-scripts start src/scripts/*.ts*", 15 16 "build": "git valu-hide-changes build && wp-scripts build src/scripts/*.ts*", -
findkit/trunk/plugin.php
r3028254 r3036280 10 10 * Description: WordPress Plugin for Findkit Site Search. See findkit.com for details 11 11 * Author: Findkit Team <findkit@findkit.com> 12 * Version: 0.5. 812 * Version: 0.5.9 13 13 * License: GPLv2 or later 14 14 */ -
findkit/trunk/readme.txt
r3028254 r3036280 4 4 Requires at least: 6.0 5 5 Tested up to: 6.4.1 6 Stable tag: 0.5. 86 Stable tag: 0.5.9 7 7 Requires PHP: 7.2 8 8 Donate link: https://www.findkit.com/ -
findkit/trunk/src/PageMeta.php
r3011329 r3036280 1 1 <?php 2 2 3 declare(strict_types=1); 3 4 … … 17 18 function __action_wp_head() 18 19 { 19 $ post = \get_queried_object();20 $object = \get_queried_object(); 20 21 21 if (!($post instanceof \WP_Post)) { 22 return; 23 } 24 25 $meta = self::get($post); 22 $meta = self::get($object); 26 23 27 24 if (empty($meta)) { … … 50 47 * See https://docs.findkit.com/crawler/meta-tag/ 51 48 */ 52 static function get( \WP_Post $post)49 static function get($object) 53 50 { 54 $public = $post->post_status === 'publish';51 $public = true; 55 52 56 $url_parts = parse_url(\home_url()); 57 $domain = $url_parts['host']; 53 if ($object instanceof \WP_Post) { 54 $public = $object->post_status === 'publish'; 55 } 58 56 59 $domain = \apply_filters('findkit_page_meta_domain', $domain, $post); 57 $meta = [ 58 // Do not show archive pages in search by default because commonly 59 // they contain only a lists of posts which is already indexed as 60 // the individual posts. 61 'showInSearch' => \is_archive() ? false : $public, 62 ]; 63 64 $domain = \apply_filters( 65 'findkit_page_meta_domain', 66 parse_url(\home_url())['host'], 67 $object 68 ); 60 69 61 70 $blogname_slug = \sanitize_title(self::get_blog_name()); … … 67 76 'wordpress', 68 77 'domain/' . $domain . '/' . 'wordpress', 69 'wp_post_type/' . $post->post_type,70 'domain/' . $domain . '/' . 'wp_post_type/' . $post->post_type,71 78 'wp_blog_name/' . $blogname_slug, 72 79 $blog_name_tag, … … 74 81 ]; 75 82 76 $public_taxonomies = \get_taxonomies(['public' => true], 'names'); 77 $post_taxonomies = \get_the_taxonomies($post->ID); 83 if ($object instanceof \WP_Post) { 84 $meta['title'] = $object->post_title; 85 $meta['created'] = \get_the_date('c', $object); 86 $meta['modified'] = \get_the_modified_date('c', $object); 78 87 79 foreach ($post_taxonomies as $taxonomy_key => $taxonomy_value) { 80 // only expose public taxonomies as tags 81 if (in_array($taxonomy_key, $public_taxonomies)) { 82 $terms = \get_the_terms($post, $taxonomy_key); 83 foreach ($terms as $term) { 84 array_push( 85 $tags, 86 'domain/' . 87 $domain . 88 '/' . 89 'wp_taxonomy/' . 90 $taxonomy_key . 91 '/' . 92 $term->slug 93 ); 94 array_push( 95 $tags, 96 'wp_taxonomy/' . $taxonomy_key . '/' . $term->slug 97 ); 98 } 88 // Defaults to true. Only used to explicitly disable showing the page in the findkit search. 89 if ( 90 \get_post_meta($object->ID, '_findkit_show_in_search', true) === 91 'no' 92 ) { 93 $meta['showInSearch'] = false; 99 94 } 100 }101 95 102 $title = \wp_specialchars_decode( 103 \is_archive() ? \get_the_archive_title() : $post->post_title 104 ); 96 $tags[] = 'wp_post_type/' . $object->post_type; 97 $tags[] = 98 'domain/' . 99 $domain . 100 '/' . 101 'wp_post_type/' . 102 $object->post_type; 105 103 106 $created = \get_the_date('c', $post); 107 $modified = \get_the_modified_date('c', $post); 108 $show_in_search = \is_archive() ? false : $public; 104 $public_taxonomies = \get_taxonomies(['public' => true], 'names'); 105 $post_taxonomies = \get_the_taxonomies($object->ID); 109 106 110 // Defaults to true. Only used to explicitly disable showing the page in the findkit search. 111 if ( 112 \get_post_meta($post->ID, '_findkit_show_in_search', true) === 'no' 113 ) { 114 $show_in_search = false; 115 } 116 117 $meta = [ 118 'showInSearch' => $show_in_search, 119 'title' => \html_entity_decode($title), 120 'created' => $created, 121 'modified' => $modified, 122 'tags' => $tags, 123 ]; 124 125 $superwords = \get_post_meta($post->ID, '_findkit_superwords', true); 126 127 if ($superwords) { 128 $superwords = trim($superwords); 129 if (!empty($superwords)) { 130 $meta['superwords'] = []; 131 foreach (preg_split('/\s+/', $superwords) as $word) { 132 $word = trim($word); 133 if ($word) { 134 $meta['superwords'][] = $word; 107 foreach ($post_taxonomies as $taxonomy_key => $taxonomy_value) { 108 // only expose public taxonomies as tags 109 if (in_array($taxonomy_key, $public_taxonomies)) { 110 $terms = \get_the_terms($object, $taxonomy_key); 111 foreach ($terms as $term) { 112 array_push( 113 $tags, 114 'domain/' . 115 $domain . 116 '/' . 117 'wp_taxonomy/' . 118 $taxonomy_key . 119 '/' . 120 $term->slug 121 ); 122 array_push( 123 $tags, 124 'wp_taxonomy/' . $taxonomy_key . '/' . $term->slug 125 ); 135 126 } 136 127 } 137 128 } 129 130 $superwords = \get_post_meta( 131 $object->ID, 132 '_findkit_superwords', 133 true 134 ); 135 136 if ($superwords) { 137 $superwords = trim($superwords); 138 if (!empty($superwords)) { 139 $meta['superwords'] = []; 140 foreach (preg_split('/\s+/', $superwords) as $word) { 141 $word = trim($word); 142 if ($word) { 143 $meta['superwords'][] = $word; 144 } 145 } 146 } 147 } 148 149 $content_no_highlight = \get_post_meta( 150 $object->ID, 151 '_findkit_content_no_highlight', 152 true 153 ); 154 155 if ($content_no_highlight) { 156 $content_no_highlight = trim($content_no_highlight); 157 if (!empty($content_no_highlight)) { 158 $meta['contentNoHighlight'] = $content_no_highlight; 159 } 160 } 161 162 // Use the post language if using polylang instead of the blog locale. 163 if (function_exists('\pll_get_post_language')) { 164 $meta['language'] = \pll_get_post_language($object->ID, 'slug'); 165 } 166 } elseif (\is_archive()) { 167 $meta['title'] = \get_the_archive_title(); 138 168 } 139 169 140 $content_no_highlight = \get_post_meta( 141 $post->ID, 142 '_findkit_content_no_highlight', 143 true 144 ); 170 $meta['title'] ??= \get_the_title(); 171 $meta['language'] ??= substr(\get_bloginfo('language'), 0, 2); 145 172 146 if ($content_no_highlight) { 147 $content_no_highlight = trim($content_no_highlight); 148 if (!empty($content_no_highlight)) { 149 $meta['contentNoHighlight'] = $content_no_highlight; 150 } 151 } 173 $meta['title'] = \wp_specialchars_decode($meta['title']); 174 $meta['tags'] = $tags; 152 175 153 // Use the post language if using polylang instead of the blog locale. 154 if (function_exists('\pll_get_post_language')) { 155 $meta['language'] = \pll_get_post_language($post->ID, 'slug'); 156 } else { 157 $meta['language'] = substr(\get_bloginfo('language'), 0, 2); 158 } 159 160 return apply_filters('findkit_page_meta', $meta, $post); 176 return apply_filters('findkit_page_meta', $meta, $object); 161 177 } 162 178 } -
findkit/trunk/vendor/composer/installed.php
r3028254 r3036280 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' f0df1a718534e4b61ae70dfc5110b032626b42a3',6 'reference' => '2c615750627ca35925d06839acdeb8d74e679015', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-main', 15 15 'version' => 'dev-main', 16 'reference' => ' f0df1a718534e4b61ae70dfc5110b032626b42a3',16 'reference' => '2c615750627ca35925d06839acdeb8d74e679015', 17 17 'type' => 'wordpress-plugin', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.