From aa6e449aeea3ae399699250a15f1c56840f63b10 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 12 Jun 2021 16:18:51 -0700 Subject: [PATCH] New shortcode added on News view page: {NEWS_AUTHOR_REALNAME} Tagcloud menu can now be sorted via shortcode parms. eg. {MENU: path=tagcloud&order=tag,asc&limit=20} Animate.css library loading example added to bootstrap5/theme.xml --- e107_admin/theme.php | 2 +- .../shortcodes/batch/news_shortcodes.php | 8 ++++++ e107_handlers/media_class.php | 14 +++++++--- e107_plugins/news/news.php | 2 +- e107_plugins/tagcloud/tagcloud_menu.php | 27 ++++++++++++++++++- e107_themes/bootstrap5/theme.xml | 1 + 6 files changed, 47 insertions(+), 7 deletions(-) diff --git a/e107_admin/theme.php b/e107_admin/theme.php index a6f7e158d..19e6d98e9 100644 --- a/e107_admin/theme.php +++ b/e107_admin/theme.php @@ -492,7 +492,7 @@ class theme_admin_ui extends e_admin_ui if(empty($_POST) && deftrue('e_DEVELOPER') || deftrue('e_DEBUG')) // check for new theme media and import. { $name = e107::getPref('sitetheme'); - e107::getMedia()->import('_common_image', e_THEME.$name, '', 'min-size=10000'); + e107::getMedia()->import('_common_image', e_THEME.$name, '', array('min-size'=>10000)); e107::getMessage()->addInfo('Developer/Debug Mode: Scanning theme images folder for new media to import.'); } diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 9b2869bf9..e12f74fd4 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -99,6 +99,12 @@ class news_shortcodes extends e_shortcode } + function sc_news_author_realname($parm=null) + { + return !empty($this->news_item['user_login']) ? $this->news_item['user_login'] : null; + } + + function sc_news_author($parm=null) { @@ -117,6 +123,8 @@ class news_shortcodes extends e_shortcode } + + function sc_newscomments($parm=null) { diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index a4903cbdb..d93824d2d 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -100,7 +100,7 @@ class e_media $img_array = $fl->get_files($epath, $fmask,'',2); - if(!count($img_array)) + if(empty($img_array)) { e107::getMessage()->addDebug("Media-Import could not find any files in ".$epath." with fmask: ".$fmask); return $this; @@ -119,11 +119,13 @@ class e_media if(vartrue($options['min-width']) && ($f['img-width'] < $options['min-width'])) { + $mes->addDebug("Skipped: ".$f['fname']); continue; } if(vartrue($options['min-size']) && ($f['fsize'] < $options['min-size'])) { + $mes->addDebug("Skipped: ".$f['fname']); continue; } @@ -145,7 +147,7 @@ class e_media 'media_tags' => '', 'media_type' => $f['mime'] ); - + if(!$sql->select('core_media','media_url',"media_url = '".$fullpath."' LIMIT 1")) { @@ -159,11 +161,15 @@ class e_media $mes->addError("Media not imported: ".$f['fname']); } } + else + { + $mes->addDebug("Skipped (already exists): ".$f['fname']); + } } - // if($count) + if(!empty($count)) { - // $mes->addSuccess("Imported {$count} Media items."); + $mes->addDebug("Imported {$count} Media items."); } return $this; diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php index 3eeb22c04..d1a23ed3c 100644 --- a/e107_plugins/news/news.php +++ b/e107_plugins/news/news.php @@ -1167,7 +1167,7 @@ class news_front else {*/ $query = " - SELECT n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, + SELECT n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, u.user_login, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id diff --git a/e107_plugins/tagcloud/tagcloud_menu.php b/e107_plugins/tagcloud/tagcloud_menu.php index e5fedbbc2..4852e8ac7 100644 --- a/e107_plugins/tagcloud/tagcloud_menu.php +++ b/e107_plugins/tagcloud/tagcloud_menu.php @@ -18,6 +18,11 @@ if (!e107::isInstalled('tagcloud')) return ''; } +/** + * @example {MENU: path=tagcloud&order=size,desc} + * @example {MENU: path=tagcloud&order=tag,asc&limit=20} + */ + require_once('tagcloud_class.php'); @@ -40,6 +45,11 @@ if(!class_exists('tagcloud_menu')) $cloud = new TagCloud(); $sql = e107::getDb(); + if(is_string($parm)) + { + parse_str($parm,$parm); + } + e107::getCache()->setMD5(e_LANGUAGE); if ($text = e107::getCache()->retrieve('tagcloud', 5, false)) @@ -86,10 +96,25 @@ if(!class_exists('tagcloud_menu')) return $text; }); - $cloud->setOrder('size', 'DESC'); + + + if(!empty($parm['order'])) + { + list($o1,$o2) = explode(',', $parm['order']); + $cloud->setOrder($o1, strtoupper($o2)); + } + else + { + $cloud->setOrder('size', 'DESC'); + } $limit = !empty($parm['tagcloud_limit']) ? intval($parm['tagcloud_limit']) : 50; + if(!empty($parm['limit'])) + { + $limit = (int) $parm['limit']; + } + $cloud->setLimit($limit); $text = $cloud->render(); diff --git a/e107_themes/bootstrap5/theme.xml b/e107_themes/bootstrap5/theme.xml index 437a7a868..e54ec4ec9 100644 --- a/e107_themes/bootstrap5/theme.xml +++ b/e107_themes/bootstrap5/theme.xml @@ -16,6 +16,7 @@ +