Plugin Directory

Changeset 2881948


Ignore:
Timestamp:
03/17/2023 01:48:05 PM (3 years ago)
Author:
likecoin
Message:
  • Version 3.0.4
Location:
likecoin
Files:
161 added
4 edited

Legend:

Unmodified
Added
Removed
  • likecoin/trunk/admin/matters.php

    r2865465 r2881948  
    3535 */
    3636function likecoin_generate_matters_player_widget( $filename ) {
     37    if ( ! class_exists( 'DOMDocument' ) ) {
     38        return '';
     39    }
    3740    $dom_document          = new DOMDocument();
    3841    $libxml_previous_state = libxml_use_internal_errors( true );
     
    7477function likecoin_replace_matters_attachment_url( $content, $params ) {
    7578    $post_id = $params ['post_id'];
    76     if ( ! $content ) {
     79    if ( ! $content || ! class_exists( 'DOMDocument' ) ) {
    7780        return $content;
    7881    }
     
    109112            $attachment_id = $class_id[1];
    110113        }
    111         if ( ! $attachment_id && $url ) {
     114        if ( ! $attachment_id && ! empty( $url ) ) {
    112115            $attachment_id = attachment_url_to_postid( $url );
    113116            // if its url image.
     
    368371    $post_id = $post->ID;
    369372    $content = $post->post_content;
    370     if ( ! $content ) {
     373    if ( ! $content || ! class_exists( 'DOMDocument' ) ) {
    371374        return $content;
    372375    }
     
    397400        $current_image_urls[ $url ] = $image;
    398401        $image_url                  = $url;
     402        if ( empty( $url ) ) {
     403            continue;
     404        }
    399405        // if it's uploaded image, then skip likecoin_post_url_image_to_matters.
    400406        $classes       = $image->getAttribute( 'class' );
     
    546552    $headers        = get_headers( $file_path, true );
    547553    $file_mime_type = $headers['Content-Type'];
     554    if ( is_array( $file_mime_type ) ) {
     555        $file_mime_type = end( $file_mime_type );
     556    }
    548557    if ( ! ( substr( $file_mime_type, 0, 5 ) === 'image' ) ) {
    549558        return;
  • likecoin/trunk/admin/post.php

    r2840245 r2881948  
    257257 */
    258258function likecoin_get_post_content_with_relative_image_url( $post ) {
    259     $image_urls            = array();
    260     $content               = apply_filters( 'the_content', $post->post_content );
     259    $image_urls = array();
     260    $content    = apply_filters( 'the_content', $post->post_content );
     261    if ( ! class_exists( 'DOMDocument' ) ) {
     262        // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
     263        trigger_error( 'DOMDocument not found! Please install PHP DOM extension', E_USER_WARNING );
     264        return array(
     265            'content' => $content,
     266            'images'  => $image_urls,
     267        );
     268    }
    261269    $dom_document          = new DOMDocument();
    262270    $libxml_previous_state = libxml_use_internal_errors( true );
     
    265273    libxml_use_internal_errors( $libxml_previous_state );
    266274    if ( false === $dom_content ) {
    267         return $content;
     275        return array(
     276            'content' => $content,
     277            'images'  => $image_urls,
     278        );
    268279    }
    269280    $images          = $dom_document->getElementsByTagName( 'img' );
     
    280291        $parsed        = wp_parse_url( $url );
    281292        $host          = $parsed['host'];
    282         if ( $attachment_id > 0 || $host === $site_host ) {
     293        if ( $attachment_id > 0 || ( $host === $site_host && ! empty( $url ) ) ) {
    283294            $image_key = $key + 1; // 0 is for featured image.
    284295            $image->setAttribute( 'src', './' . $image_key );
  • likecoin/trunk/likecoin.php

    r2869121 r2881948  
    1414 * Plugin URI:   https://github.com/likecoin/likecoin-wordpress
    1515 * Description:  Publishes your posts to the blockchain. Sell your posts, share your work, build community, preserve content.
    16  * Version:      3.0.3
     16 * Version:      3.0.4
    1717 * Author:       LikeCoin
    1818 * Author URI:   https://like.co/
     
    4242define( 'LC_PLUGIN_SLUG', 'likecoin' );
    4343define( 'LC_PLUGIN_NAME', 'Web3Press By LikeCoin' );
    44 define( 'LC_PLUGIN_VERSION', '3.0.3' );
     44define( 'LC_PLUGIN_VERSION', '3.0.4' );
    4545
    4646require_once dirname( __FILE__ ) . '/includes/constant/options.php';
  • likecoin/trunk/readme.txt

    r2869121 r2881948  
    77Tested up to: 6.1
    88Requires PHP: 5.4
    9 Stable tag: 3.0.3
     9Stable tag: 3.0.4
    1010License: GPLv3
    1111License URI: https://www.gnu.org/licenses/gpl-3.0.html
    1212
    13 Web3Press - Earn as you write, Collect as you read.
     13Web3Press - Publish your posts as NFT and sell it right away; build your community in the Web3 way.
    1414
    1515== Description ==
     
    150150
    151151== Changelog ==
     152
     153= 3.0.4 =
     154
     155- Fix invalid array index access when post images contain redirect
     156- Mitigate API crash when PHP DOM extension is not installed. Note that DOM extension is required for image upload to work properly when publishing.
    152157
    153158= 3.0.3 =
Note: See TracChangeset for help on using the changeset viewer.