Changeset 1801340
- Timestamp:
- 01/11/2018 06:36:11 PM (8 years ago)
- Location:
- dsdownloadlist
- Files:
-
- 14 added
- 8 edited
-
tags/1.3 (added)
-
tags/1.3/classes (added)
-
tags/1.3/classes/Action.class.php (added)
-
tags/1.3/classes/DownloadList.class.php (added)
-
tags/1.3/classes/Renderer.class.php (added)
-
tags/1.3/classes/Shortcode.class.php (added)
-
tags/1.3/dsdownloadlist.php (added)
-
tags/1.3/readme.txt (added)
-
tags/1.3/views (added)
-
tags/1.3/views/css (added)
-
tags/1.3/views/css/dsdownloadlist.css (added)
-
tags/1.3/views/js (added)
-
tags/1.3/views/js/dsdownloadlist.js (added)
-
tags/1.3/views/list.phtml (added)
-
trunk/classes/Action.class.php (modified) (2 diffs)
-
trunk/classes/DownloadList.class.php (modified) (2 diffs)
-
trunk/classes/Shortcode.class.php (modified) (1 diff)
-
trunk/dsdownloadlist.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/views/css/dsdownloadlist.css (modified) (2 diffs)
-
trunk/views/js/dsdownloadlist.js (modified) (1 diff)
-
trunk/views/list.phtml (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dsdownloadlist/trunk/classes/Action.class.php
r1733921 r1801340 24 24 $atts = @unserialize(base64_decode($_REQUEST['atts'])); 25 25 26 $path = DownloadList::clearPath(WP_CONTENT_DIR.'/'.$atts['root'].'/'.$_REQUEST['path']); 26 $arPath = array_merge(DownloadList::explodePath(WP_CONTENT_DIR.'/'.@$atts['root']), DownloadList::explodePath($_REQUEST['path'])); 27 $PrePath = implode('/', array_slice($arPath, 0, sizeof($arPath) - 1)); 28 $RootPath = implode('/', DownloadList::explodePath(WP_CONTENT_DIR.'/'.$atts['root'])); 27 29 28 if (substr($path, 0, strlen(WP_CONTENT_DIR)) != WP_CONTENT_DIR) die(__('Access denied!', 'dsdl')); 29 30 $PrePath = substr($PrePath, strlen($RootPath)); 31 if ($PrePath === "") $PrePath = '/'; 32 33 $path = implode(DIRECTORY_SEPARATOR, $arPath); 34 30 35 $arFiles = downloadlist::getFiles($path, $atts); 31 36 … … 34 39 $oRenderer->view['arFiles'] = $arFiles; 35 40 $oRenderer->view['isRoot'] = ((DownloadList::clearPath($atts['root'].'/'.$_REQUEST['path']) != DownloadList::clearPath($atts['root']))?false:true); 36 $oRenderer->view['PrePath'] = DownloadList::clearPath($_REQUEST['path'].'../');41 $oRenderer->view['PrePath'] = $PrePath; 37 42 $oRenderer->view['path'] = DownloadList::clearPath($_REQUEST['path']); 38 43 $oRenderer->view['atts'] = $atts; -
dsdownloadlist/trunk/classes/DownloadList.class.php
r1730034 r1801340 12 12 { 13 13 14 public static function explodePath($path) 15 { 16 17 $path = \wp_normalize_path($path); 18 19 $arPath = explode('/', $path); 20 21 foreach ($arPath as $k => $v) if (trim($v) === '') unset($arPath[$k]); 22 23 return $arPath; 24 25 } 26 14 27 public static function clearPath($path) 15 28 { 16 29 30 $path = \wp_normalize_path($path); 31 17 32 $path = preg_replace("/\/+/", "/", '/'.$path.'/'); 18 33 … … 43 58 public static function getFiles($path, $atts) 44 59 { 45 46 $root = DownloadList::clearPath(WP_CONTENT_DIR.'/'.$atts['root']); 47 48 $arFiles = scandir($path); 60 61 $arFiles = scandir(DownloadList::clearPath($path).'/'); 49 62 $arReturn = array(); 50 63 51 64 foreach ($arFiles as $f) 52 65 { 53 66 54 67 if (!in_array($f, array('.', '..'))) 55 { 56 57 $file_path = DownloadList::clearPath($path.'/'.$f); 58 68 { 69 70 // Real Path 71 $real_path = implode('/', DownloadList::explodePath($path.'/'.$f)); 72 $root_path = implode('/', DownloadList::explodePath(WP_CONTENT_DIR.'/'.$atts['root'])); 73 59 74 $arReturn[] = array( 60 75 'filename' => $f, 61 76 'abspath' => $path.'/'.$f, 62 'path' => substr($ file_path, strlen($root)),77 'path' => substr($real_path, strlen($root_path)), 63 78 'filesize' => ((is_file($path.'/'.$f))?filesize($path.'/'.$f):0), 64 79 'type' => ((is_file($path.'/'.$f))?'file':'dir') -
dsdownloadlist/trunk/classes/Shortcode.class.php
r1733921 r1801340 15 15 { 16 16 17 if (!is_array($atts)) $atts = array(); 18 17 19 $atts = array_merge(array( 18 'root' => ' /',20 'root' => '', 19 21 'dateformat' => 'Y-m-d H:i:s' 20 22 ), $atts); 21 22 $root = DownloadList::clearPath(WP_CONTENT_DIR.$atts['root']); 23 24 if (substr($root, 0, strlen(WP_CONTENT_DIR)) == WP_CONTENT_DIR) 25 { 26 27 $arFiles = downloadlist::getFiles($root, $atts); 28 29 } 30 else 31 { 32 33 return __('DsDownloadList: Ungültiges Wurzelverzeichnis gesetzt.', 'dsdl'); 34 35 } 23 24 $arPath = downloadList::explodePath(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$atts['root']); 25 $arFiles = downloadlist::getFiles(implode(DIRECTORY_SEPARATOR, $arPath), $atts); 36 26 37 27 $oRenderer = new Renderer(); 28 38 29 $oRenderer->view['arFiles'] = $arFiles; 39 30 $oRenderer->view['isRoot'] = true; -
dsdownloadlist/trunk/dsdownloadlist.php
r1733921 r1801340 9 9 * Plugin URI: https://daschmi.de/dsdownloadlist/ 10 10 * Description: Downloadlist from Shortcode 11 * Version: 1. 211 * Version: 1.3 12 12 * Author: Daniel Schmitzer 13 13 * Author URI: https://daschmi.de/ -
dsdownloadlist/trunk/readme.txt
r1733921 r1801340 5 5 Requires at least: 3.0.1 6 6 Tested up to: 4.9 7 Stable tag: 1. 27 Stable tag: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 39 39 = 1.2 = 40 40 * Added rootline path 41 42 = 1.3 = 43 * Layout changes -
dsdownloadlist/trunk/views/css/dsdownloadlist.css
r1730034 r1801340 1 1 .dsdownloadlist { width:100%; font-family:monospace; margin-bottom:30px; } 2 2 .dsdownloadlist .head { background-color:#F6F6F6; font-size:1rem; padding:5px 15px; } 3 .dsdownloadlist .head .separator:before { content:'/'; margin-left:2px; margin-right:2px; } 3 4 .dsdownloadlist table { table-layout:auto; width:100%; border-collapse:collapse; border:0px; border-spacing:0px; margin:0px; } 4 5 .dsdownloadlist table tr > * { padding-left:15px; } 5 .dsdownloadlist table tr > *. icon { width:35px; padding-right:0px; }6 .dsdownloadlist table tr > *. icon img { max-width:100%; height:auto; }6 .dsdownloadlist table tr > *.td_icon { width:35px; padding-right:0px; } 7 .dsdownloadlist table tr > *.td_icon img { max-width:100%; height:auto; } 7 8 .dsdownloadlist table tr > *.size { width:125px; } 8 9 .dsdownloadlist table tr > *.mtime { width:100px; text-align:left; white-space: nowrap; } … … 11 12 .dsdownloadlist .dsdl_loading { margin:-15px; box-sizing:content-box; padding:15px; position:absolute; width:100%; height:100%; left:0px; top:0px; background-color:rgba(0, 0, 0, 0.5); } 12 13 .dsdownloadlist .dsdl_loading img { 13 max-width: 100px; height:auto; position:absolute; left:50%; top:50%; margin-left:-50px; margin-top:-50px;14 max-width:50px !important; height:auto; position:absolute; left:50%; top:50%; margin-left:-50px; margin-top:-50px; 14 15 -webkit-animation:spin 1s linear infinite; 15 16 -moz-animation:spin 1s linear infinite; -
dsdownloadlist/trunk/views/js/dsdownloadlist.js
r1730034 r1801340 16 16 function dsdl_finishloading(jqSel, data) 17 17 { 18 18 19 19 jqSel.find('.dsdl_loading').remove(); 20 20 jqSel.attr("style", ""); -
dsdownloadlist/trunk/views/list.phtml
r1733921 r1801340 15 15 <div class="head"><?php 16 16 17 $arPath = explode(DIRECTORY_SEPARATOR, DownloadList::clearPath($this->view['path'])); 18 $arCurrentPath = array(); 19 20 foreach ($arPath as $k => $v) if (trim($v) === '') unset($arPath[$k]); 21 17 $arPath = DownloadList::explodePath($this->view['path']) 18 22 19 ?><a href="#" data-atts="<?php echo base64_encode(serialize($this->view['atts'])); ?>" onclick="return dsdl_changeDir(jQuery(this), '<?php echo DownloadList::clearPath(implode(DIRECTORY_SEPARATOR, $arCurrentPath)); ?>');"><?php echo preg_replace('/^\/|\/$/', '', $this->view['atts']['root']); ?></a><?php 23 20 24 echo DIRECTORY_SEPARATOR;21 echo '<span class="separator"></span>'; 25 22 26 23 $i = 0; foreach ($arPath as $p) 27 24 { 28 25 29 $arCurrentPath[] = $p;30 31 26 ?><a href="#" data-atts="<?php echo base64_encode(serialize($this->view['atts'])); ?>" onclick="return dsdl_changeDir(jQuery(this), '<?php echo DownloadList::clearPath(implode(DIRECTORY_SEPARATOR, $arCurrentPath)); ?>');"><?php echo $p; ?></a><?php 32 27 33 echo DIRECTORY_SEPARATOR;28 echo '<span class="separator"></span>'; 34 29 35 30 $i ++; … … 45 40 <thead> 46 41 <tr> 47 <th class=" icon"></th>42 <th class="td_icon"></th> 48 43 <th class="filename"><?php echo __('Filename', 'dsdl'); ?></th> 49 44 <th class="size"><?php echo __('Size', 'dsdl'); ?></th> … … 56 51 <?php if ($this->view['isRoot'] != true) { ?> 57 52 <tr> 58 <td class=" icon">53 <td class="td_icon"> 59 54 <img src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDYwIDYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA2MCA2MDsiIHhtbDpzc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8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K" /> 60 55 </td> … … 69 64 <?php foreach ($this->view['arFiles'] as $f) { ?> 70 65 <tr> 71 <td class=" icon">66 <td class="td_icon"> 72 67 73 68 <?php if ($f['type'] === 'dir') { ?>
Note: See TracChangeset
for help on using the changeset viewer.