1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +02:00

updated themes to use e107::library(). e107::getCache()->clearAll() now accepts 'library' as an option.

This commit is contained in:
Cameron
2017-01-29 15:10:32 -08:00
parent 8c542c9e82
commit 8c507c964d
10 changed files with 123 additions and 76 deletions

View File

@@ -309,7 +309,7 @@ class ecache {
/** /**
* Clear Full Cache * Clear Full Cache
* @param string $type: content | system| browser | db | image * @param string $type: content | system| browser | db | image | js | css | library
* @example clearAll('db'); * @example clearAll('db');
*/ */
@@ -323,42 +323,48 @@ class ecache {
return; return;
} }
if($type == 'system') if($type === 'system')
{ {
$this->clear_sys(); $this->clear_sys();
return; return;
} }
if($type == 'browser') if($type === 'browser')
{ {
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false); e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
return; return;
} }
if($type == 'db') if($type === 'db')
{ {
$path = e_CACHE_DB; $path = e_CACHE_DB;
$mask = ($mask == null) ? '.*\.php' : $mask; $mask = ($mask == null) ? '.*\.php' : $mask;
} }
if($type == 'image') if($type === 'image')
{ {
$path = e_CACHE_IMAGE; $path = e_CACHE_IMAGE;
$mask = ($mask == null) ? '.*\.cache\.bin' : $mask; $mask = ($mask == null) ? '.*\.cache\.bin' : $mask;
} }
if($type == 'js') if($type === 'js')
{ {
$path = e_WEB."cache/"; $path = e_WEB."cache/";
$mask = ($mask == null) ? '.*\.js' : $mask; $mask = ($mask == null) ? '.*\.js' : $mask;
} }
if($type == 'css') if($type === 'css')
{ {
$path = e_WEB."cache/"; $path = e_WEB."cache/";
$mask = ($mask == null) ? '.*\.css' : $mask; $mask = ($mask == null) ? '.*\.css' : $mask;
} }
if($type === 'library')
{
$path = e_CACHE_CONTENT;
$mask = ($mask == null) ? 'S_Library_.*\.cache\.php' : $mask;
}
if((null == $path) || (null == $mask)) if((null == $path) || (null == $mask))
{ {
return; return;
@@ -367,6 +373,7 @@ class ecache {
$fl = e107::getFile(false); $fl = e107::getFile(false);
$fl->mode = 'fname'; $fl->mode = 'fname';
$files = $fl->get_files($path, $mask); $files = $fl->get_files($path, $mask);
if($files) if($files)
{ {
foreach ($files as $file) foreach ($files as $file)

View File

@@ -1582,15 +1582,16 @@ class themeHandler
} }
} }
if($pref->dataHasChanged()) // if($pref->dataHasChanged())
{ {
e107::getCache()->clearAll('system'); // Need to clear cache in order to refresh library information.
e107::getCache()->clearAll('library'); // Need to clear cache in order to refresh library information.
} }
return true; return true;
} }
e107::getCache()->clearAll('system'); e107::getCache()->clearAll('library');
return call_user_func(array(&$this->themeConfigObj, 'process')); //pre v2.1.4 return call_user_func(array(&$this->themeConfigObj, 'process')); //pre v2.1.4
} }
} }
@@ -2352,12 +2353,39 @@ class themeHandler
if(!empty($this->themeArray[$name]['preferences'])) if(!empty($this->themeArray[$name]['preferences']))
{ {
$themePrefs = $this->themeArray[$name]['preferences'];
e107::getMessage()->addDebug("ThemePrefs found in theme.xml");
$this->id = $name;
$this->loadThemeConfig();
$name = get_class($this->themeConfigObj);
if($name === 'theme_config') // new way. 2.1.4
{
$themeConfig = e107::getThemeConfig($name);
e107::getMessage()->addDebug("Saving theme prefs to their own row. ");
foreach($themePrefs as $key=>$val)
{
$themeConfig->add($key,$val);
}
$themeConfig->save(false,true,false);
}
else // old way.
{
e107::getMessage()->addDebug("Saving theme prefs to sitetheme_ref");
$core->set('sitetheme_pref', $this->themeArray[$name]['preferences']); $core->set('sitetheme_pref', $this->themeArray[$name]['preferences']);
} }
// $core->set('sitetheme_releaseUrl', $this->themeArray[$name]['releaseUrl']);
}
if($contentCheck === true) if($contentCheck === true)
{ {
@@ -2367,6 +2395,7 @@ class themeHandler
e107::getCache()->clear(); e107::getCache()->clear();
e107::getCache()->clearAll('js'); e107::getCache()->clearAll('js');
e107::getCache()->clearAll('css'); e107::getCache()->clearAll('css');
e107::getCache()->clearAll('library');
if($core->save()) if($core->save())
{ {
@@ -2377,25 +2406,19 @@ class themeHandler
$med->import('_common_image', e_THEME.$name, "^.*?logo.*?(\.png|\.jpeg|\.jpg|\.JPG|\.GIF|\.PNG)$"); $med->import('_common_image', e_THEME.$name, "^.*?logo.*?(\.png|\.jpeg|\.jpg|\.JPG|\.GIF|\.PNG)$");
$med->import('_common_image', e_THEME.$name, '', 'min-size=20000'); $med->import('_common_image', e_THEME.$name, '', 'min-size=20000');
if($contentCheck === true) if($contentCheck === true)
{ {
$this->installContentCheck($name); $this->installContentCheck($name);
} }
$this->theme_adminlog('01', $name.', style.css'); $this->theme_adminlog('01', $name.', style.css');
return true;
return TRUE;
} }
else else
{ {
// $mes->add(TPVLAN_3." <b>'".$name."'</b>", E_MESSAGE_ERROR); // $mes->add(TPVLAN_3." <b>'".$name."'</b>", E_MESSAGE_ERROR);
return FALSE; return true;
} }
} }

View File

@@ -43,4 +43,9 @@
</menuPresets> </menuPresets>
</layout> </layout>
</layouts> </layouts>
<themePrefs>
<pref name='branding'>sitename</pref>
<pref name='nav_alignment'>right</pref>
<pref name='usernav_placement'>top</pref>
</themePrefs>
</e107Theme> </e107Theme>

View File

@@ -14,7 +14,6 @@ class theme_config implements e_theme_config
$brandingOpts = array('sitename'=>LAN_THEMEPREF_04, 'logo' => LAN_THEMEPREF_05, 'sitenamelogo'=>LAN_THEMEPREF_06); $brandingOpts = array('sitename'=>LAN_THEMEPREF_04, 'logo' => LAN_THEMEPREF_05, 'sitenamelogo'=>LAN_THEMEPREF_06);
$bootswatch = array( $bootswatch = array(
// '' => LAN_DEFAULT,
"cerulean"=> 'Cerulean', "cerulean"=> 'Cerulean',
"cosmo"=> 'Cosmo', "cosmo"=> 'Cosmo',
"cyborg"=> 'Cyborg', "cyborg"=> 'Cyborg',
@@ -40,7 +39,7 @@ class theme_config implements e_theme_config
'branding' => array('title'=>LAN_THEMEPREF_00, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $brandingOpts)), 'branding' => array('title'=>LAN_THEMEPREF_00, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $brandingOpts)),
'nav_alignment' => array('title'=>LAN_THEMEPREF_01, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('left'=> LAN_THEMEPREF_07,'right'=> LAN_THEMEPREF_08))), 'nav_alignment' => array('title'=>LAN_THEMEPREF_01, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('left'=> LAN_THEMEPREF_07,'right'=> LAN_THEMEPREF_08))),
'usernav_placement' => array('title'=>LAN_THEMEPREF_02, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('top'=> LAN_THEMEPREF_09, 'bottom'=> LAN_THEMEPREF_10))), 'usernav_placement' => array('title'=>LAN_THEMEPREF_02, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> array('top'=> LAN_THEMEPREF_09, 'bottom'=> LAN_THEMEPREF_10))),
'bootswatch' => array('title'=>LAN_THEMEPREF_03, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $bootswatch, 'post'=>$previewLink)), 'bootswatch' => array('title'=>LAN_THEMEPREF_03, 'type'=>'dropdown', 'writeParms'=>array('optArray'=> $bootswatch, 'post'=>$previewLink, 'default'=>LAN_DEFAULT)),
); );
return $fields; return $fields;

View File

@@ -34,7 +34,7 @@ class theme_library
{ {
$bootswatch = e107::pref('theme', 'bootswatch', false); $bootswatch = e107::pref('theme', 'bootswatch', false);
if($bootswatch) if(!empty($bootswatch))
{ {
// Disable Bootstrap CSS. // Disable Bootstrap CSS.
unset($libraries['cdn.bootstrap']['files']['css']); unset($libraries['cdn.bootstrap']['files']['css']);

View File

@@ -16,12 +16,15 @@ e107::lan('theme');
$cndPref = e107::pref('theme', 'cdn','cdnjs'); $cndPref = e107::pref('theme', 'cdn','cdnjs');
e107::library('load', 'bootstrap');
e107::library('load', 'fontawesome');
switch($cndPref) switch($cndPref)
{ {
case "jsdelivr": case "jsdelivr":
e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap.min.css'); // e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.7/css/bootstrap.min.css');
e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css'); // e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.7.0/css/font-awesome.min.css');
e107::js("footer", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery'); // e107::js("footer", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery');
e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js", 'jquery'); e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js", 'jquery');
@@ -32,9 +35,9 @@ switch($cndPref)
break; */ break; */
case "cdnjs": case "cdnjs":
default: default:
e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'); // e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css');
e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'); // e107::css('url', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js", 'jquery', 2); // e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js", 'jquery', 2);
e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js", 'jquery', 2); e107::js("footer", "https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js", 'jquery', 2);

View File

@@ -46,4 +46,7 @@
<glyphicons> <glyphicons>
<glyph name='ionicons' pattern='\.(ion-[a-z-]*):before\{' path='css/ionicons.min.css' prefix='ion-' tag='i' /> <glyph name='ionicons' pattern='\.(ion-[a-z-]*):before\{' path='css/ionicons.min.css' prefix='ion-' tag='i' />
</glyphicons> </glyphicons>
<themePrefs>
<pref name='usernav_placement'>top</pref>
</themePrefs>
</e107Theme> </e107Theme>

View File

@@ -4,7 +4,6 @@ if (!defined('e107_INIT')) { exit; }
e107::lan('theme', 'admin',true); e107::lan('theme', 'admin',true);
// Dummy Theme Configuration File.
class theme_config implements e_theme_config class theme_config implements e_theme_config
{ {
@@ -23,8 +22,8 @@ class theme_config implements e_theme_config
'videomobilebackground' => array('title' => LAN_LZ_THEMEPREF_01, 'type'=>'image', 'help'=>''), 'videomobilebackground' => array('title' => LAN_LZ_THEMEPREF_01, 'type'=>'image', 'help'=>''),
'videoposter' => array('title' => LAN_LZ_THEMEPREF_02, 'type'=>'image', 'help'=>''), 'videoposter' => array('title' => LAN_LZ_THEMEPREF_02, 'type'=>'image', 'help'=>''),
'videourl' => array('title' => LAN_LZ_THEMEPREF_03, 'type'=>'text', 'writeParms'=>array('size'=>'xxlarge'),'help'=>''), 'videourl' => array('title' => LAN_LZ_THEMEPREF_03, 'type'=>'text', 'writeParms'=>array('size'=>'xxlarge'),'help'=>''),
'usernav_placement' => array('title' => LAN_LZ_THEMEPREF_04, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>array(LAN_LZ_THEMEPREF_05, LAN_LZ_THEMEPREF_06), 'useValues'=>1)), 'usernav_placement' => array('title' => LAN_LZ_THEMEPREF_04, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>array('top'=>LAN_LZ_THEMEPREF_05, 'bottom'=>LAN_LZ_THEMEPREF_06))),
'cdn' => array('title' => 'CDN', 'type'=>'dropdown', 'writeParms'=>array('optArray'=>array( 'cdnjs' => 'CDNJS (Cloudflare)', 'jsdelivr' => 'jsDelivr'))) // 'cdn' => array('title' => 'CDN', 'type'=>'dropdown', 'writeParms'=>array('optArray'=>array( 'cdnjs' => 'CDNJS (Cloudflare)', 'jsdelivr' => 'jsDelivr')))
); );
return $fields; return $fields;

View File

@@ -115,38 +115,41 @@ class theme_shortcodes extends e_shortcode
return e107::getParser()->toHtml($text, true, 'SUMMARY'); return e107::getParser()->toHtml($text, true, 'SUMMARY');
} }
function sc_xurl_icons() {
//@todo Replace with social template.
function sc_xurl_icons()
{
$social = array( $social = array(
'rss' => array('href'=> (e107::isInstalled('rss_menu') ? e107::url('rss_menu', 'index', array('rss_url'=>'news')) : ''), 'title'=>'RSS/Atom Feed'), 'rss' => array('href' => (e107::isInstalled('rss_menu') ? e107::url('rss_menu', 'index', array('rss_url' => 'news')) : ''), 'title' => 'RSS/Atom Feed'),
'facebook' => array('href'=> deftrue('XURL_FACEBOOK'), 'title'=>'Facebook'), 'facebook' => array('href' => deftrue('XURL_FACEBOOK'), 'title' => 'Facebook'),
'twitter' => array('href'=> deftrue('XURL_TWITTER'), 'title'=>'Twitter'), 'twitter' => array('href' => deftrue('XURL_TWITTER'), 'title' => 'Twitter'),
'google' => array('href'=> deftrue('XURL_GOOGLE'), 'title'=>'Google Plus'), 'google' => array('href' => deftrue('XURL_GOOGLE'), 'title' => 'Google Plus'),
'linkedin' => array('href'=> deftrue('XURL_LINKEDIN'), 'title'=>'LinkedIn'), 'linkedin' => array('href' => deftrue('XURL_LINKEDIN'), 'title' => 'LinkedIn'),
'github' => array('href'=> deftrue('XURL_GITHUB'), 'title'=>'Github'), 'github' => array('href' => deftrue('XURL_GITHUB'), 'title' => 'Github'),
'pinterest' => array('href'=> deftrue('XURL_PINTEREST'), 'title'=>'Pinterest'), 'pinterest' => array('href' => deftrue('XURL_PINTEREST'), 'title' => 'Pinterest'),
'flickr' => array('href'=> deftrue('XURL_FLICKR'), 'title'=>'Flickr'), 'flickr' => array('href' => deftrue('XURL_FLICKR'), 'title' => 'Flickr'),
'instagram' => array('href'=> deftrue('XURL_INSTAGRAM'), 'title'=>'Instagram'), 'instagram' => array('href' => deftrue('XURL_INSTAGRAM'), 'title' => 'Instagram'),
'youtube' => array('href'=> deftrue('XURL_YOUTUBE'), 'title'=>'YouTube'), 'youtube' => array('href' => deftrue('XURL_YOUTUBE'), 'title' => 'YouTube'),
'question-circle' => array('href'=> deftrue('XURL_VIMEO'), 'title'=>'e107 HELP') 'question-circle' => array('href' => deftrue('XURL_VIMEO'), 'title' => 'e107 HELP')
); );
//Fixme - GooglePlus not working. //Fixme - GooglePlus not working.
$text = ''; $text = '';
$textstart ='<ul class="list-inline lz-social-icons">'; $textstart = '<ul class="list-inline lz-social-icons">';
$textend = '</ul>'; $textend = '</ul>';
foreach($social as $id => $data) foreach($social as $id => $data)
{ {
if($data['href'] != '') if($data['href'] != '')
{ {
$text .= ' $text .= '
<li><a rel="nofollow" target="_blank" href="'.$data['href'].'" title="'.$data['title'].'"><i class="icon-lg ion-social-'.$id.'-outline"></i></a>&nbsp;</li>'; <li><a rel="nofollow" target="_blank" href="' . $data['href'] . '" title="' . $data['title'] . '"><i class="icon-lg ion-social-' . $id . '-outline"></i></a>&nbsp;</li>';
$text .= "\n"; $text .= "\n";
} }
} }
if($text !='') if($text != '')
{ {
return $textstart.$text.$textend; return $textstart . $text . $textend;
} }
} }

View File

@@ -20,9 +20,14 @@ define('VIEWPORT', "width=device-width, initial-scale=1.0");
// Warning: Some bootstrap CDNs are not compiled with popup.js // Warning: Some bootstrap CDNs are not compiled with popup.js
// use https if e107 is using https. // use https if e107 is using https.
e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery', 2); /*e107::js("url", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery', 2);
e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css'); e107::css('url', 'https://cdn.jsdelivr.net/bootstrap/3.3.6/css/bootstrap.min.css');
e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css'); e107::css('url', 'https://cdn.jsdelivr.net/fontawesome/4.5.0/css/font-awesome.min.css');*/
e107::library('load', 'bootstrap');
e107::library('load', 'fontawesome');
e107::css('url', 'http://fonts.googleapis.com/css?family=Bad+Script|Raleway:400,500,600,700,300|Lora:400'); e107::css('url', 'http://fonts.googleapis.com/css?family=Bad+Script|Raleway:400,500,600,700,300|Lora:400');
// e107::css('theme','voux.css'); // e107::css('theme','voux.css');
e107::css('url', 'http://fonts.googleapis.com/css?family=Montserrat:400,700&ver=4.2.4'); e107::css('url', 'http://fonts.googleapis.com/css?family=Montserrat:400,700&ver=4.2.4');