Plugin Directory

Changeset 2911473


Ignore:
Timestamp:
05/12/2023 07:25:29 AM (3 years ago)
Author:
clearsite
Message:

Import changes from GitHub for version 1.1.2

Location:
branded-social-images/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branded-social-images/trunk/info.json

    r2883247 r2911473  
    55  "Author": "Internetbureau Clearsite",
    66  "Author URI": "https://www.clearsite.nl/",
    7   "Version": "1.1.1",
     7  "Version": "1.1.2",
    88  "License": "GPL2"
    99}
  • branded-social-images/trunk/lib/class.og-image-admin.php

    r2883247 r2911473  
    108108    }
    109109
    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;
    114116        }
    115117
     
    338340    public static function show_editor($fields, $is_meta_panel = false)
    339341    {
    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() );
    341343
    342344        $text_settings = Plugin::getInstance()->text_options;
  • branded-social-images/trunk/lib/class.og-image-plugin.php

    r2775560 r2911473  
    178178         * url endpoint, the WordPress way
    179179         *
    180          * pros: 
    181          * 1. it works on non-standard hosts, 
     180         * pros:
     181         * 1. it works on non-standard hosts,
    182182         * 2. works on nginx hosts
    183          * cons: 
     183         * cons:
    184184         * 1. does not work for custom post-type archives
    185185         * 2. because it is in essence a page-modifier, WP considers this a page, therefore
     
    187187         * - confusing caching plugins into thinking the content-type should be text/html
    188188         * 3. the WP construction assumes an /endpoint/value/ set-up, requiring cleanup, see fileter rewrite_rules_array implementation below
    189          * 
     189         *
    190190         * Why this way?
    191          * 
     191         *
    192192         * Because an .htaccess RewriteRule, although improving performance 20-fold, would be web-server-software specific, blog-set-up specific and multi-site aware
    193193         * which makes it quite impossible to do universally. Unfortunately.
    194          * 
     194         *
    195195         * If you feel adventurous, you can always add it yourself! It should look something like this:
    196          * 
     196         *
    197197         * RewriteRule (.+)/social-image.(jpg|png)/?$ $1/?bsi_img=1 [QSA,L,NC]
    198          * 
     198         *
    199199         * If only for a certain domain, you can add a condition;
    200          * 
     200         *
    201201         * RewriteCond %{HTTP_HOST} yourdomain.com
    202202         * RewriteRule (.+)/social-image.(jpg|png)/?$ $1/?bsi_img=1 [QSA,L,NC]
    203          * 
     203         *
    204204         * For more information on apache rewrite rules, see
    205205         * @see https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
     
    258258            }
    259259            $rules = array_merge($pt_archives, $rules);
    260            
     260
    261261            /**
    262262             * changes the rewrite rules so the endpoint is value-less and more a tag, like 'feed' is for WordPress.
     
    10741074    private function evaluate_vertical(&$top, &$bottom)
    10751075    {
    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 ) );
    10811081        }
    10821082    }
     
    10841084    private function evaluate_horizontal(&$left, &$right)
    10851085    {
    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 ) );
    10911091        }
    10921092    }
  • branded-social-images/trunk/readme.txt

    r2883247 r2911473  
    33Tags: social image, Open Graph Image, OG Image, OG-image, open graph, open-graph, facebook image, featured image, branded, watermark, logo
    44Requires at least: 4.7
    5 Tested up to: 6.1.1
    6 Stable tag: 1.1.1
     5Tested up to: 6.2
     6Stable tag: 1.1.2
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    131131
    132132== Changelog ==
     133
     134= 1.1.2 =
     135* Fix issue with missing admin icon.
     136* Fix error log spam on PHP8.
    133137
    134138= 1.1.1 =
  • branded-social-images/trunk/wp-plugin.php

    r2883247 r2911473  
    66 * Author: Acato
    77 * Author URI: https://acato.nl
    8  * Version: 1.1.1
     8 * Version: 1.1.2
    99 * License: GPL2
    1010 */
Note: See TracChangeset for help on using the changeset viewer.