1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01: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
* @param string $type: content | system| browser | db | image
* @param string $type: content | system| browser | db | image | js | css | library
* @example clearAll('db');
*/
@ -323,42 +323,48 @@ class ecache {
return;
}
if($type == 'system')
if($type === 'system')
{
$this->clear_sys();
return;
}
if($type == 'browser')
if($type === 'browser')
{
e107::getConfig()->set('e_jslib_browser_cache', time())->save(false);
return;
}
if($type == 'db')
if($type === 'db')
{
$path = e_CACHE_DB;
$mask = ($mask == null) ? '.*\.php' : $mask;
}
if($type == 'image')
if($type === 'image')
{
$path = e_CACHE_IMAGE;
$mask = ($mask == null) ? '.*\.cache\.bin' : $mask;
}
if($type == 'js')
if($type === 'js')
{
$path = e_WEB."cache/";
$mask = ($mask == null) ? '.*\.js' : $mask;
}
if($type == 'css')
if($type === 'css')
{
$path = e_WEB."cache/";
$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))
{
return;
@ -367,6 +373,7 @@ class ecache {
$fl = e107::getFile(false);
$fl->mode = 'fname';
$files = $fl->get_files($path, $mask);
if($files)
{
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;
}
e107::getCache()->clearAll('system');
e107::getCache()->clearAll('library');
return call_user_func(array(&$this->themeConfigObj, 'process')); //pre v2.1.4
}
}
@ -2352,13 +2353,40 @@ class themeHandler
if(!empty($this->themeArray[$name]['preferences']))
{
$core->set('sitetheme_pref', $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_releaseUrl', $this->themeArray[$name]['releaseUrl']);
if($contentCheck === true)
{
$sql->delete("menus", "menu_layout !='' ");
@ -2367,6 +2395,7 @@ class themeHandler
e107::getCache()->clear();
e107::getCache()->clearAll('js');
e107::getCache()->clearAll('css');
e107::getCache()->clearAll('library');
if($core->save())
{
@ -2375,27 +2404,21 @@ class themeHandler
$med = e107::getMedia();
$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)
{
$this->installContentCheck($name);
}
$this->theme_adminlog('01', $name.', style.css');
return TRUE;
return true;
}
else
{
// $mes->add(TPVLAN_3." <b>'".$name."'</b>", E_MESSAGE_ERROR);
return FALSE;
return true;
}
}

View File

@ -43,4 +43,9 @@
</menuPresets>
</layout>
</layouts>
<themePrefs>
<pref name='branding'>sitename</pref>
<pref name='nav_alignment'>right</pref>
<pref name='usernav_placement'>top</pref>
</themePrefs>
</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);
$bootswatch = array(
// '' => LAN_DEFAULT,
"cerulean"=> 'Cerulean',
"cosmo"=> 'Cosmo',
"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)),
'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))),
'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;

View File

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

View File

@ -15,13 +15,16 @@ define('VIEWPORT', "width=device-width, initial-scale=1.0");
e107::lan('theme');
$cndPref = e107::pref('theme', 'cdn','cdnjs');
e107::library('load', 'bootstrap');
e107::library('load', 'fontawesome');
switch($cndPref)
{
case "jsdelivr":
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::js("footer", "https://cdn.jsdelivr.net/bootstrap/3.3.6/js/bootstrap.min.js", 'jquery');
// 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::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');
@ -32,9 +35,9 @@ switch($cndPref)
break; */
case "cdnjs":
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/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::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::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);

View File

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

View File

@ -4,7 +4,6 @@ if (!defined('e107_INIT')) { exit; }
e107::lan('theme', 'admin',true);
// Dummy Theme Configuration File.
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'=>''),
'videoposter' => array('title' => LAN_LZ_THEMEPREF_02, 'type'=>'image', '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)),
'cdn' => array('title' => 'CDN', 'type'=>'dropdown', 'writeParms'=>array('optArray'=>array( 'cdnjs' => 'CDNJS (Cloudflare)', 'jsdelivr' => 'jsDelivr')))
'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')))
);
return $fields;

View File

@ -113,42 +113,45 @@ class theme_shortcodes extends e_shortcode
$text .= ' '.$sitedisclaimer;
return e107::getParser()->toHtml($text, true, 'SUMMARY');
}
function sc_xurl_icons() {
$social = array(
'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'),
'twitter' => array('href'=> deftrue('XURL_TWITTER'), 'title'=>'Twitter'),
'google' => array('href'=> deftrue('XURL_GOOGLE'), 'title'=>'Google Plus'),
'linkedin' => array('href'=> deftrue('XURL_LINKEDIN'), 'title'=>'LinkedIn'),
'github' => array('href'=> deftrue('XURL_GITHUB'), 'title'=>'Github'),
'pinterest' => array('href'=> deftrue('XURL_PINTEREST'), 'title'=>'Pinterest'),
'flickr' => array('href'=> deftrue('XURL_FLICKR'), 'title'=>'Flickr'),
'instagram' => array('href'=> deftrue('XURL_INSTAGRAM'), 'title'=>'Instagram'),
'youtube' => array('href'=> deftrue('XURL_YOUTUBE'), 'title'=>'YouTube'),
'question-circle' => array('href'=> deftrue('XURL_VIMEO'), 'title'=>'e107 HELP')
);
//Fixme - GooglePlus not working.
}
$text = '';
$textstart ='<ul class="list-inline lz-social-icons">';
$textend = '</ul>';
foreach($social as $id => $data)
{
if($data['href'] != '')
{
$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>';
$text .= "\n";
}
}
if($text !='')
{
return $textstart.$text.$textend;
}
}
//@todo Replace with social template.
function sc_xurl_icons()
{
$social = array(
'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'),
'twitter' => array('href' => deftrue('XURL_TWITTER'), 'title' => 'Twitter'),
'google' => array('href' => deftrue('XURL_GOOGLE'), 'title' => 'Google Plus'),
'linkedin' => array('href' => deftrue('XURL_LINKEDIN'), 'title' => 'LinkedIn'),
'github' => array('href' => deftrue('XURL_GITHUB'), 'title' => 'Github'),
'pinterest' => array('href' => deftrue('XURL_PINTEREST'), 'title' => 'Pinterest'),
'flickr' => array('href' => deftrue('XURL_FLICKR'), 'title' => 'Flickr'),
'instagram' => array('href' => deftrue('XURL_INSTAGRAM'), 'title' => 'Instagram'),
'youtube' => array('href' => deftrue('XURL_YOUTUBE'), 'title' => 'YouTube'),
'question-circle' => array('href' => deftrue('XURL_VIMEO'), 'title' => 'e107 HELP')
);
//Fixme - GooglePlus not working.
$text = '';
$textstart = '<ul class="list-inline lz-social-icons">';
$textend = '</ul>';
foreach($social as $id => $data)
{
if($data['href'] != '')
{
$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>';
$text .= "\n";
}
}
if($text != '')
{
return $textstart . $text . $textend;
}
}
function sc_lz_subscribe()

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
// 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/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('theme','voux.css');
e107::css('url', 'http://fonts.googleapis.com/css?family=Montserrat:400,700&ver=4.2.4');