Plugin Directory

Changeset 1988115


Ignore:
Timestamp:
12/07/2018 04:38:47 PM (7 years ago)
Author:
iconpress
Message:

Fixes

Location:
iconpress-lite/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • iconpress-lite/trunk/iconpress.php

    r1947810 r1988115  
    77 * DomainPath: /languages
    88 * Author: IconPress team
    9  * Version: 1.4.0
     9 * Version: 1.4.1
    1010 * Author URI: https://iconpress.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
    1111 */
     
    2626}
    2727
    28 define( 'ICONPRESSLITE_VERSION', '1.4.0' );
     28define( 'ICONPRESSLITE_VERSION', '1.4.1' );
    2929define( 'ICONPRESSLITE_DIR', plugin_dir_path( __FILE__ ) );
    3030define( 'ICONPRESSLITE_URI', plugin_dir_url( __FILE__ ) );
  • iconpress-lite/trunk/lib/db/Icons.php

    r1947810 r1988115  
    262262                'internal_id' => 'local_' . $value->ID,
    263263                'preview_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg#' . $value->name,
    264                 'download_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg#' . $value->name,
     264                'download_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg',
    265265                'is_premium' => false,
    266266                'is_last' => false,
     
    304304                    'internal_id' => 'local_' . $value->ID,
    305305                    'preview_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg#' . $value->name,
    306                     'download_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg#' . $value->name,
     306                    'download_url' => 'svg/' . $value->collection_identifier . '/symbol/svg/sprite.symbol.svg',
    307307                    'is_premium' => false,
    308308                ];
  • iconpress-lite/trunk/lib/helpers/FileSystem.php

    r1947810 r1988115  
    175175     * @return null|string|string[]
    176176     */
    177     public static function __cleanupSvgFile( $svg = '', $internal_id = '' )
     177    public static function __cleanupSvgFile( $svg = '', $internal_id = '', $gen_sprite = false )
    178178    {
    179179
     
    194194
    195195        $svg->attributes()->xmlns = "http://www.w3.org/2000/svg";
     196
     197        // if method called for generate sprite,
     198        // override width and height attributes
     199        // firefox embed svg fix
     200        if( $gen_sprite ) {
     201            if ( $svg->attributes()->width ) {
     202                $svg->attributes()->width = '100%';
     203            }
     204            else {
     205                $svg->addAttribute( "width", '100%' );
     206            }
     207
     208            if ( $svg->attributes()->height ) {
     209                $svg->attributes()->height = '100%';
     210            }
     211            else {
     212                $svg->addAttribute( "height", '100%' );
     213            }
     214        }
    196215
    197216        // Sanitize
     
    315334    and return its content (as SVG, not symbol)
    316335     */
    317     public static function parseSvg( $icon, $download_url, $download_method, $cleanup = false )
     336    public static function parseSvg( $icon, $download_url, $download_method, $cleanup = false, $generate_sprite = false )
    318337    {
    319338        if ( empty( $download_url ) ) {
     
    373392            // if it's an svg file, get the content of it & replace id attribute
    374393            if ( $download_method == 'svg_file' ) {
    375                 return self::__cleanupSvgFile( $svg, $icon['internal_id'] );
     394                return self::__cleanupSvgFile( $svg, $icon['internal_id'], $generate_sprite );
    376395            }
    377396
     
    388407                        }
    389408                        $value->attributes()->xmlns = "http://www.w3.org/2000/svg";
     409
    390410                        $svg_content = $value->asXML();
    391411                        return str_replace( '</symbol', '</svg', str_replace( '<symbol', '<svg', $svg_content ) );
     
    393413                }
    394414            }
     415
    395416        }
    396417        return false;
     
    408429        $download_info = apply_filters( 'iconpress/download_info', [
    409430            'local' => [
    410                 'download_url' => ICONPRESSLITE_URI . $icon['download_url'],
     431                'download_url' => ICONPRESSLITE_DIR . $icon['download_url'],
    411432                'download_method' => 'svg_sprite'
    412433            ],
     
    504525                if ( isset( $icon['local_url'] ) && $download_url = $icon['local_url'] ) {
    505526                    // download & parse SVG
    506                     $svg_content = self::parseSvg( $icon, self::$uploadsDirPath . $download_url, 'svg_file' );
     527                    $svg_content = self::parseSvg( $icon, self::$uploadsDirPath . $download_url, 'svg_file', false, true );
    507528                    $content .= str_replace( '</svg', '</symbol', str_replace( '<svg', '<symbol', $svg_content ) );
    508529                }
     
    512533        $final_svg_content = $start . $content . $end;
    513534
    514 
    515535        $sprite_path = self::$uploadsDirPath . self::$uploads__IconPressDirPath . self::$collection_name . '.svg';
    516 
    517 
    518536
    519537        if ( self::$_fsCache->put_contents( $sprite_path, $final_svg_content ) ) {
  • iconpress-lite/trunk/lib/integrations/Base.php

    r1947810 r1988115  
    66use IconPressLite\Helpers\FileSystem;
    77use IconPressLite\Helpers\Option;
     8use IconPressLite\Helpers\RestAPI;
    89
    910if ( ! defined( 'ABSPATH' ) ) {
     
    5152            // URLS
    5253            'url' => get_site_url(),
     54            'rest_url' => esc_url_raw( rest_url( RestAPI::ICONPRESS_NAMESPACE ) ),
    5355            'plugin_url' => ICONPRESSLITE_URI,
    5456            'panel_url' => wp_nonce_url( admin_url( 'admin.php?page=' . IpBase::PLUGIN_SLUG . '_insert_icon' ), 'open_insert_panel', 'ip_nonce' ),
Note: See TracChangeset for help on using the changeset viewer.