Changeset 1988115
- Timestamp:
- 12/07/2018 04:38:47 PM (7 years ago)
- Location:
- iconpress-lite/trunk
- Files:
-
- 4 edited
-
iconpress.php (modified) (2 diffs)
-
lib/db/Icons.php (modified) (2 diffs)
-
lib/helpers/FileSystem.php (modified) (9 diffs)
-
lib/integrations/Base.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
iconpress-lite/trunk/iconpress.php
r1947810 r1988115 7 7 * DomainPath: /languages 8 8 * Author: IconPress team 9 * Version: 1.4. 09 * Version: 1.4.1 10 10 * Author URI: https://iconpress.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash 11 11 */ … … 26 26 } 27 27 28 define( 'ICONPRESSLITE_VERSION', '1.4. 0' );28 define( 'ICONPRESSLITE_VERSION', '1.4.1' ); 29 29 define( 'ICONPRESSLITE_DIR', plugin_dir_path( __FILE__ ) ); 30 30 define( 'ICONPRESSLITE_URI', plugin_dir_url( __FILE__ ) ); -
iconpress-lite/trunk/lib/db/Icons.php
r1947810 r1988115 262 262 'internal_id' => 'local_' . $value->ID, 263 263 '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', 265 265 'is_premium' => false, 266 266 'is_last' => false, … … 304 304 'internal_id' => 'local_' . $value->ID, 305 305 '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', 307 307 'is_premium' => false, 308 308 ]; -
iconpress-lite/trunk/lib/helpers/FileSystem.php
r1947810 r1988115 175 175 * @return null|string|string[] 176 176 */ 177 public static function __cleanupSvgFile( $svg = '', $internal_id = '' )177 public static function __cleanupSvgFile( $svg = '', $internal_id = '', $gen_sprite = false ) 178 178 { 179 179 … … 194 194 195 195 $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 } 196 215 197 216 // Sanitize … … 315 334 and return its content (as SVG, not symbol) 316 335 */ 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 ) 318 337 { 319 338 if ( empty( $download_url ) ) { … … 373 392 // if it's an svg file, get the content of it & replace id attribute 374 393 if ( $download_method == 'svg_file' ) { 375 return self::__cleanupSvgFile( $svg, $icon['internal_id'] );394 return self::__cleanupSvgFile( $svg, $icon['internal_id'], $generate_sprite ); 376 395 } 377 396 … … 388 407 } 389 408 $value->attributes()->xmlns = "http://www.w3.org/2000/svg"; 409 390 410 $svg_content = $value->asXML(); 391 411 return str_replace( '</symbol', '</svg', str_replace( '<symbol', '<svg', $svg_content ) ); … … 393 413 } 394 414 } 415 395 416 } 396 417 return false; … … 408 429 $download_info = apply_filters( 'iconpress/download_info', [ 409 430 'local' => [ 410 'download_url' => ICONPRESSLITE_ URI. $icon['download_url'],431 'download_url' => ICONPRESSLITE_DIR . $icon['download_url'], 411 432 'download_method' => 'svg_sprite' 412 433 ], … … 504 525 if ( isset( $icon['local_url'] ) && $download_url = $icon['local_url'] ) { 505 526 // 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 ); 507 528 $content .= str_replace( '</svg', '</symbol', str_replace( '<svg', '<symbol', $svg_content ) ); 508 529 } … … 512 533 $final_svg_content = $start . $content . $end; 513 534 514 515 535 $sprite_path = self::$uploadsDirPath . self::$uploads__IconPressDirPath . self::$collection_name . '.svg'; 516 517 518 536 519 537 if ( self::$_fsCache->put_contents( $sprite_path, $final_svg_content ) ) { -
iconpress-lite/trunk/lib/integrations/Base.php
r1947810 r1988115 6 6 use IconPressLite\Helpers\FileSystem; 7 7 use IconPressLite\Helpers\Option; 8 use IconPressLite\Helpers\RestAPI; 8 9 9 10 if ( ! defined( 'ABSPATH' ) ) { … … 51 52 // URLS 52 53 'url' => get_site_url(), 54 'rest_url' => esc_url_raw( rest_url( RestAPI::ICONPRESS_NAMESPACE ) ), 53 55 'plugin_url' => ICONPRESSLITE_URI, 54 56 '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.