Prechádzať zdrojové kódy

Many improvements

 - Added icon cache to reduce time load from external CDN
 - Added Plasma Breeze icon pack and syntax
 - Updated CDN url
Giuseppe Di Terlizzi 7 rokov pred
rodič
commit
b9d99920a7
9 zmenil súbory, kde vykonal 53 pridanie a 15 odobranie
  1. 3 2
      conf/default.php
  2. 2 1
      conf/metadata.php
  3. 34 0
      syntax/breeze.php
  4. 1 1
      syntax/fa.php
  5. 1 1
      syntax/fl.php
  6. 9 8
      syntax/icon.php
  7. 1 1
      syntax/material.php
  8. 1 0
      syntax/oxygen.php
  9. 1 1
      syntax/ra.php

+ 3 - 2
conf/default.php

@@ -10,8 +10,9 @@
 $conf['defaultSize']       = '16';
 $conf['defaultPack']       = 'fa';
 
-$conf['fugueURL']          = 'https://raw.githubusercontent.com/yusukekamiyamane/fugue-icons/master';
-$conf['oxygenURL']         = 'https://raw.githubusercontent.com/pasnox/oxygen-icons-png/master/oxygen';
+$conf['fugueURL']          = 'https://cdn.rawgit.com/yusukekamiyamane/fugue-icons/master';
+$conf['oxygenURL']         = 'https://cdn.rawgit.com/KDE/oxygen-icons/tree/master';
+$conf['breeezeURL']        = 'https://cdn.rawgit.com/KDE/breeze-icons/tree/master/icons';
 $conf['silkURL']           = 'http://icons.iconarchive.com/icons/famfamfam/silk/16';
 $conf['flagURL']           = 'http://icons.iconarchive.com/icons/famfamfam/flag/16';
 

+ 2 - 1
conf/metadata.php

@@ -8,7 +8,7 @@
  */
 
 $meta['defaultSize']       = array('string');
-$meta['defaultPack']       = array('multichoice','_choices' => array('fa', 'ra', 'typcn', 'glyphicon', 'fugue', 'oxygen', 'fl', 'material'));
+$meta['defaultPack']       = array('multichoice','_choices' => array('fa', 'ra', 'typcn', 'glyphicon', 'fl', 'material', 'fugue', 'oxygen', 'breeze'));
 
 $meta['loadFontAwesome']   = array('onoff');
 $meta['loadTypicons']      = array('onoff');
@@ -18,5 +18,6 @@ $meta['loadRpgAwesome']    = array('onoff');
 
 $meta['fugueURL']          = array('string');
 $meta['oxygenURL']         = array('string');
+$meta['breezeURL']         = array('string');
 $meta['silkURL']           = array('string');
 $meta['flagURL']           = array('string');

+ 34 - 0
syntax/breeze.php

@@ -0,0 +1,34 @@
+<?php
+/**
+ * Plugin Icons: Plasma Breeze helper
+ *
+ * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author     Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
+ * @copyright  (C) 2015-2018, Giuseppe Di Terlizzi
+ */
+
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+require_once(dirname(__FILE__).'/icon.php');
+
+class syntax_plugin_icons_breeze extends syntax_plugin_icons_icon {
+
+  const IS_ICON      = true;
+  const IS_FONT_ICON = false;
+
+  protected $pattern = '{{breeze>.+?}}|{{\sbreeze>.+?}}';
+
+  public static function makePath($icon, $size, $base_url) {
+
+    $sizes = array(8, 16, 22, 32, 48, 64, 128, 256, 512);
+    $size  = (($size > max($sizes)) ? max($sizes) : $size);
+
+    list($category, $icon) = explode('/', $icon);
+
+    return "$base_url/$category/$size/$icon.svg";
+
+  }
+
+}
+

+ 1 - 1
syntax/fa.php

@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin Icons: Font Awesome helper
+ * Plugin Icons: Font-Awesome helper
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>

+ 1 - 1
syntax/fl.php

@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin Icons: Glyphicons helper
+ * Plugin Icons: Font-Linux helper
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>

+ 9 - 8
syntax/icon.php

@@ -129,14 +129,15 @@ class syntax_plugin_icons_icon extends DokuWiki_Syntax_Plugin {
 
     if ($this->isIcon()) {
 
-      $icon_size   = $this->getFlag('size');
-      $icon_pack   = $this->getFlag('pack');
-      $base_path   = rtrim($this->getConf(sprintf('%sURL', $icon_pack)), '/');
-      $icon_path   = $this->makePath($icon, $icon_size, $base_path);
-      $icon_markup = sprintf('<img src="%s" title="%s" class="%s" style="%s" />',
-                             $icon_path, $title,
-                             $this->toClassString($this->getClasses()),
-                             $this->toInlineStyle($this->getStyles()));
+      $icon_size       = $this->getFlag('size');
+      $icon_pack       = $this->getFlag('pack');
+      $icon_base_url   = rtrim($this->getConf(sprintf('%sURL', $icon_pack)), '/');
+      $icon_url        = $this->makePath($icon, $icon_size, $icon_base_url);
+      $cached_icon_url = ml($icon_url, array('cache' => 'recache', 'w' => $icon_size, 'h' => $icon_size));
+      $icon_markup     = sprintf('<img src="%s" title="%s" class="%s" style="%s" />',
+                                  $cached_icon_url, $title,
+                                  $this->toClassString($this->getClasses()),
+                                  $this->toInlineStyle($this->getStyles()));
 
     } else {
 

+ 1 - 1
syntax/material.php

@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin Icons: Typicons helper
+ * Plugin Icons: Material Icons helper
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>

+ 1 - 0
syntax/oxygen.php

@@ -29,3 +29,4 @@ class syntax_plugin_icons_oxygen extends syntax_plugin_icons_icon {
   }
 
 }
+

+ 1 - 1
syntax/ra.php

@@ -1,6 +1,6 @@
 <?php
 /**
- * Plugin Icons: Font Awesome helper
+ * Plugin Icons: RPG-Awesome helper
  *
  * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
  * @author     Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>