Changeset 2911473
- Timestamp:
- 05/12/2023 07:25:29 AM (3 years ago)
- Location:
- branded-social-images/trunk
- Files:
-
- 2 added
- 5 edited
-
img/admin-icon.svg (added)
-
info.json (modified) (1 diff)
-
lib/class.og-image-admin.php (modified) (2 diffs)
-
lib/class.og-image-plugin.php (modified) (5 diffs)
-
public (added)
-
readme.txt (modified) (2 diffs)
-
wp-plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branded-social-images/trunk/info.json
r2883247 r2911473 5 5 "Author": "Internetbureau Clearsite", 6 6 "Author URI": "https://www.clearsite.nl/", 7 "Version": "1.1. 1",7 "Version": "1.1.2", 8 8 "License": "GPL2" 9 9 } -
branded-social-images/trunk/lib/class.og-image-admin.php
r2883247 r2911473 108 108 } 109 109 110 public static function admin_icon(): string 111 { 112 if ( is_file( dirname( __DIR__ ) . '/assets/' . basename( '/' . Plugin::ADMIN_ICON ) ) ) { 113 return plugins_url( '/assets/' . basename( '/' . Plugin::ADMIN_ICON ), __DIR__ ); 110 public static function admin_icon(): string { 111 $icon_file = '/img/' . basename( '/' . Plugin::ADMIN_ICON ); 112 if ( is_file( dirname( __DIR__ ) . $icon_file ) ) { 113 $icon_url = plugins_url( $icon_file, __DIR__ ); 114 115 return $icon_url; 114 116 } 115 117 … … 338 340 public static function show_editor($fields, $is_meta_panel = false) 339 341 { 340 $fields['text']['current_value'] = trim( $fields['text']['current_value']) ? $fields['text']['current_value'] : self::array_first(Plugin::text_fallback_chain());342 $fields['text']['current_value'] = trim( $fields['text']['current_value'] ?? "" ) ? $fields['text']['current_value'] : self::array_first( Plugin::text_fallback_chain() ); 341 343 342 344 $text_settings = Plugin::getInstance()->text_options; -
branded-social-images/trunk/lib/class.og-image-plugin.php
r2775560 r2911473 178 178 * url endpoint, the WordPress way 179 179 * 180 * pros: 181 * 1. it works on non-standard hosts, 180 * pros: 181 * 1. it works on non-standard hosts, 182 182 * 2. works on nginx hosts 183 * cons: 183 * cons: 184 184 * 1. does not work for custom post-type archives 185 185 * 2. because it is in essence a page-modifier, WP considers this a page, therefore … … 187 187 * - confusing caching plugins into thinking the content-type should be text/html 188 188 * 3. the WP construction assumes an /endpoint/value/ set-up, requiring cleanup, see fileter rewrite_rules_array implementation below 189 * 189 * 190 190 * Why this way? 191 * 191 * 192 192 * Because an .htaccess RewriteRule, although improving performance 20-fold, would be web-server-software specific, blog-set-up specific and multi-site aware 193 193 * which makes it quite impossible to do universally. Unfortunately. 194 * 194 * 195 195 * If you feel adventurous, you can always add it yourself! It should look something like this: 196 * 196 * 197 197 * RewriteRule (.+)/social-image.(jpg|png)/?$ $1/?bsi_img=1 [QSA,L,NC] 198 * 198 * 199 199 * If only for a certain domain, you can add a condition; 200 * 200 * 201 201 * RewriteCond %{HTTP_HOST} yourdomain.com 202 202 * RewriteRule (.+)/social-image.(jpg|png)/?$ $1/?bsi_img=1 [QSA,L,NC] 203 * 203 * 204 204 * For more information on apache rewrite rules, see 205 205 * @see https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html … … 258 258 } 259 259 $rules = array_merge($pt_archives, $rules); 260 260 261 261 /** 262 262 * changes the rewrite rules so the endpoint is value-less and more a tag, like 'feed' is for WordPress. … … 1074 1074 private function evaluate_vertical(&$top, &$bottom) 1075 1075 { 1076 if ( substr($top, -1) == '%') {1077 $top = intval( floor(intval($top) / 100 * $this->height));1078 } 1079 if ( substr($bottom, -1) == '%') {1080 $bottom = intval( ceil(intval($bottom) / 100 * $this->height));1076 if ( ! empty( $top ) && '%' === substr( $top, - 1 ) ) { 1077 $top = intval( floor( intval( $top ) / 100 * $this->height ) ); 1078 } 1079 if ( ! empty( $bottom ) && '%' === substr( $bottom, - 1 ) ) { 1080 $bottom = intval( ceil( intval( $bottom ) / 100 * $this->height ) ); 1081 1081 } 1082 1082 } … … 1084 1084 private function evaluate_horizontal(&$left, &$right) 1085 1085 { 1086 if ( substr($left, -1) == '%') {1087 $left = intval( floor(intval($left) / 100 * $this->width));1088 } 1089 if ( substr($right, -1) == '%') {1090 $right = intval( ceil(intval($right) / 100 * $this->width));1086 if ( ! empty( $left ) && '%' === substr( $left, - 1 ) ) { 1087 $left = intval( floor( intval( $left ) / 100 * $this->width ) ); 1088 } 1089 if ( ! empty( $right ) && '%' === substr( $right, - 1 ) ) { 1090 $right = intval( ceil( intval( $right ) / 100 * $this->width ) ); 1091 1091 } 1092 1092 } -
branded-social-images/trunk/readme.txt
r2883247 r2911473 3 3 Tags: social image, Open Graph Image, OG Image, OG-image, open graph, open-graph, facebook image, featured image, branded, watermark, logo 4 4 Requires at least: 4.7 5 Tested up to: 6. 1.16 Stable tag: 1.1. 15 Tested up to: 6.2 6 Stable tag: 1.1.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 131 131 132 132 == Changelog == 133 134 = 1.1.2 = 135 * Fix issue with missing admin icon. 136 * Fix error log spam on PHP8. 133 137 134 138 = 1.1.1 = -
branded-social-images/trunk/wp-plugin.php
r2883247 r2911473 6 6 * Author: Acato 7 7 * Author URI: https://acato.nl 8 * Version: 1.1. 18 * Version: 1.1.2 9 9 * License: GPL2 10 10 */
Note: See TracChangeset
for help on using the changeset viewer.