Skip to content

Commit

Permalink
Removed hard coded path for print.css and upped all theme version num…
Browse files Browse the repository at this point in the history
…bers

For #1052

By Geeklog 3.0.0 - Article should not depend on hardcoded file locations for print.css for a theme. Use PLG_getThemeItem('core-file-print-css', 'core'); instead

Also update all theme versions since updated in Geeklog v2.2.1sr1
  • Loading branch information
eSilverStrike committed Mar 28, 2020
1 parent ed0507b commit 3a5218c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 31 deletions.
38 changes: 24 additions & 14 deletions public_html/article.php
Expand Up @@ -179,24 +179,34 @@ function extractExternalLinks($text) {
}
$articleTemplate->set_var('direction', $LANG_DIRECTION);

$theme = $_CONF['theme'];
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$paths = array(
'denim' => 'layout/' . $theme . '/css_' . $dir . '/print.css',
'professional' => 'layout/' . $theme . '/print.css',
'other' => 'layout/' . $theme . '/css/print.css',
);

global $_SCRIPTS;
foreach ($paths as $path) {
if (file_exists($_CONF['path_html'] . $path)) {
$_SCRIPTS->setCssFile('print', '/' . $path, true, array('media' => 'print'));
$printCssPath = PLG_getThemeItem('core-file-print-css', 'core');
if (empty($printCssFile)) {
// Depreciated. Article should not depend on hardcoded file locations for print.css for a theme. Use PLG_getThemeItem('core-file-print-css', 'core'); instead
COM_deprecatedLog(__FILE__, '2.2.1sr1', '3.0.0', 'Use PLG_getThemeItem with \'core-file-print-css\' instead to retrieve themes print.css file');

$theme = $_CONF['theme'];
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$paths = array(
'denim' => 'layout/' . $theme . '/css_' . $dir . '/print.css',
'professional' => 'layout/' . $theme . '/print.css',
'other' => 'layout/' . $theme . '/css/print.css',
);

foreach ($paths as $path) {
if (file_exists($_CONF['path_html'] . $path)) {
$_SCRIPTS->setCssFile('print', '/' . $path, true, array('media' => 'print'));
}
}
} else {
if (file_exists($_CONF['path_html'] . $printCssPath)) {
$_SCRIPTS->setCssFile('print', '/' . $printCssPath, true, array('media' => 'print'));
}
}

// Override style for <a> tags
$_SCRIPTS->setCSS('a { color: blue !important; text-decoration: underline !important; }');

// Add Cookie Consent ( https://cookieconsent.osano.com )
if (isset($_CONF['cookie_consent']) && $_CONF['cookie_consent']) {
$_SCRIPTS->setCssFile(
Expand All @@ -221,7 +231,7 @@ function extractExternalLinks($text) {
}

$articleTemplate->set_var('plg_headercode', $_SCRIPTS->getHeader());

$articleTemplate->set_var('plg_footercode', $_SCRIPTS->getFooter());

$page_title = $article->DisplayElements('page_title');
Expand Down
4 changes: 4 additions & 0 deletions public_html/docs/history
Expand Up @@ -25,6 +25,10 @@ For more in-depth explanation of the issues below see: https://github.com/Geeklo

The following items are all current Geeklog API, functions, and/or global variables that are planned to be either required or depreciated by a current Geeklog version. Plugin and Theme developers please take note of these changes in case they affect you.

Since Geeklog v2.2.1sr1

- [Depreciated] [#1052] By Geeklog 3.0.0 - Article should not depend on hardcoded file locations for print.css for a theme. Use PLG_getThemeItem('core-file-print-css', 'core'); instead

Since Geeklog v2.2.1

- [Depreciated] [#872] By Geeklog 3.0.0 - Global $topic variable. Please use function TOPIC_getTopic or TOPIC_setTopic instead to determine Geeklog topic
Expand Down
12 changes: 10 additions & 2 deletions public_html/docs/japanese/history.html
Expand Up @@ -50,8 +50,16 @@ <h2>March ? 2020 (2.2.1sr1)</h2>
<li>[Bug] [#1049] Fixed Print Pages for Articles and Staticpages javascript crashing issue [Tom]</li>
</ul>

<p>The following items are all current Geeklog API, functions, and/or global variables that are planned to be either required or depreciated by a current Geeklog version. Plugin and Theme developers please take note of these changes in case they affect you.<br>
Since Geeklog v2.2.1</p>
<p>The following items are all current Geeklog API, functions, and/or global variables that are planned to be either required or depreciated by a current Geeklog version. Plugin and Theme developers please take note of these changes in case they affect you.</p>

<p>Since Geeklog v2.2.1sr1</p>

<ul>
<li>[Depreciated] [#1052] By Geeklog 3.0.0 - Article should not depend on hardcoded file locations for print.css for a theme. Use PLG_getThemeItem('core-file-print-css', 'core'); instead</li>
</ul>


<p>Since Geeklog v2.2.1</p>

<ul>
<li>[Depreciated] [#872] By Geeklog 3.0.0 - Global $topic variable. Please use function TOPIC_getTopic or TOPIC_setTopic instead to determine Geeklog topic</li>
Expand Down
12 changes: 9 additions & 3 deletions public_html/layout/denim/functions.php
Expand Up @@ -85,8 +85,8 @@ function theme_config_denim()

return array(
'theme_name' => 'Denim',
'theme_version' => '1.1.2',
'theme_gl_version' => '2.2.1',
'theme_version' => '1.1.3', // Released Geeklog v2.2.1sr1
'theme_gl_version' => '2.2.1', // Minimum Geeklog version theme is compatible with
'theme_description' => '',
'theme_author' => 'dengen',
'theme_homepage' => 'https://www.geeklog.net/',
Expand Down Expand Up @@ -345,6 +345,12 @@ function theme_getThemeItem_denim($item)
$retval = '';

switch ($item) {
case 'core-file-print-css': // Return Common CSS file to be used for print pages - New item as of GL v2.2.1sr1
global $_CONF, $LANG_DIRECTION;
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$retval = 'layout/' . $_CONF['theme'] . '/css_' . $dir . '/print.css';
break;

// ***************************
// Item names used for lists created by COM_makeList
// These original list items css classes which were defined way back in Geeklog 1.3. Most are not in use anymore by any updated theme
Expand Down Expand Up @@ -378,7 +384,7 @@ function theme_getThemeItem_denim($item)
case 'core-css-list-feed': // Return 1 or more CSS Classes - For RSS Feed Portal Block - replacing "list-feed"
case 'article-css-list-directory': // Return 1 or more CSS Classes - For Article Directory page - New item as of GL v2.2.1
case 'article-css-list-related': // Return 1 or more CSS Classes - For Article Page What's Related List - replacing 'list-whats-related'
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like - New item as of GL v2.2.1sr1
case 'article-css-list-older': // Return 1 or more CSS Classes - For Older Articles Block - replacing "list-older-stories"
case 'topic-css-list-related': // Return 1 or more CSS Classes - For Autotags Related Topic items list - New item as of GL v2.2.1

Expand Down
12 changes: 9 additions & 3 deletions public_html/layout/denim_curve/functions.php
Expand Up @@ -85,8 +85,8 @@ function theme_config_denim_curve()

return array(
'theme_name' => 'Denim Curve',
'theme_version' => '1.0.1',
'theme_gl_version' => '2.2.1',
'theme_version' => '1.0.3', // Released Geeklog v2.2.1sr1
'theme_gl_version' => '2.2.1', // Minimum Geeklog version theme is compatible with
'theme_description' => '',
'theme_author' => 'dengen',
'theme_homepage' => 'https://www.geeklog.net/',
Expand Down Expand Up @@ -347,6 +347,12 @@ function theme_getThemeItem_denim_curve($item)
$retval = '';

switch ($item) {
case 'core-file-print-css': // Return Common CSS file to be used for print pages - New item as of GL v2.2.1sr1
global $_CONF, $LANG_DIRECTION;
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$retval = 'layout/' . $_CONF['theme'] . '/css_' . $dir . '/print.css';
break;

// ***************************
// Item names used for lists created by COM_makeList
// These original list items css classes which were defined way back in Geeklog 1.3. Most are not in use anymore by any updated theme
Expand Down Expand Up @@ -380,7 +386,7 @@ function theme_getThemeItem_denim_curve($item)
case 'core-css-list-feed': // Return 1 or more CSS Classes - For RSS Feed Portal Block - replacing "list-feed"
case 'article-css-list-directory': // Return 1 or more CSS Classes - For Article Directory page - New item as of GL v2.2.1
case 'article-css-list-related': // Return 1 or more CSS Classes - For Article Page What's Related List - replacing 'list-whats-related'
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like - New item as of GL v2.2.1sr1
case 'article-css-list-older': // Return 1 or more CSS Classes - For Older Articles Block - replacing "list-older-stories"
case 'topic-css-list-related': // Return 1 or more CSS Classes - For Autotags Related Topic items list - New item as of GL v2.2.1

Expand Down
12 changes: 9 additions & 3 deletions public_html/layout/denim_three/functions.php
Expand Up @@ -59,8 +59,8 @@ function theme_config_denim_three()

return array(
'theme_name' => 'Denim Three',
'theme_version' => '1.0.2',
'theme_gl_version' => '2.2.1',
'theme_version' => '1.0.3', // Released Geeklog v2.2.1sr1
'theme_gl_version' => '2.2.1', // Minimum Geeklog version theme is compatible with
'theme_description' => '',
'theme_author' => 'dengen',
'theme_homepage' => 'https://www.geeklog.net/',
Expand Down Expand Up @@ -293,6 +293,12 @@ function theme_getThemeItem_denim_three($item)
$retval = '';

switch ($item) {
case 'core-file-print-css': // Return Common CSS file to be used for print pages - New item as of GL v2.2.1sr1
global $_CONF, $LANG_DIRECTION;
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$retval = 'layout/' . $_CONF['theme'] . '/css_' . $dir . '/print.css';
break;

// ***************************
// Item names used for lists created by COM_makeList
// These original list items css classes which were defined way back in Geeklog 1.3. Most are not in use anymore by any updated theme
Expand Down Expand Up @@ -326,7 +332,7 @@ function theme_getThemeItem_denim_three($item)
case 'core-css-list-feed': // Return 1 or more CSS Classes - For RSS Feed Portal Block - replacing "list-feed"
case 'article-css-list-directory': // Return 1 or more CSS Classes - For Article Directory page - New item as of GL v2.2.1
case 'article-css-list-related': // Return 1 or more CSS Classes - For Article Page What's Related List - replacing 'list-whats-related'
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like - New item as of GL v2.2.1sr1
case 'article-css-list-older': // Return 1 or more CSS Classes - For Older Articles Block - replacing "list-older-stories"
case 'topic-css-list-related': // Return 1 or more CSS Classes - For Autotags Related Topic items list - New item as of GL v2.2.1

Expand Down
12 changes: 9 additions & 3 deletions public_html/layout/glnet_curve/functions.php
Expand Up @@ -87,8 +87,8 @@ function theme_config_glnet_curve()

return array(
'theme_name' => 'GLNet Curve',
'theme_version' => '1.0.1',
'theme_gl_version' => '2.2.1',
'theme_version' => '1.0.2', // Released Geeklog v2.2.1sr1
'theme_gl_version' => '2.2.1', // Minimum Geeklog version theme is compatible with
'theme_description' => 'Based on Denim Curve theme by dengen. Only slight changes made. When updating use Denim Curve as it\'s base.',
'theme_author' => 'Laugh',
'theme_homepage' => 'https://www.geeklog.net/',
Expand Down Expand Up @@ -354,6 +354,12 @@ function theme_getThemeItem_glnet_curve($item)
$retval = '';

switch ($item) {
case 'core-file-print-css': // Return Common CSS file to be used for print pages - New item as of GL v2.2.1sr1
global $_CONF, $LANG_DIRECTION;
$dir = isset($LANG_DIRECTION) && ($LANG_DIRECTION === 'rtl') ? 'rtl' : 'ltr';
$retval = 'layout/' . $_CONF['theme'] . '/css_' . $dir . '/print.css';
break;

// ***************************
// Item names used for lists created by COM_makeList
// These original list items css classes which were defined way back in Geeklog 1.3. Most are not in use anymore by any updated theme
Expand Down Expand Up @@ -387,7 +393,7 @@ function theme_getThemeItem_glnet_curve($item)
case 'core-css-list-feed': // Return 1 or more CSS Classes - For RSS Feed Portal Block - replacing "list-feed"
case 'article-css-list-directory': // Return 1 or more CSS Classes - For Article Directory page - New item as of GL v2.2.1
case 'article-css-list-related': // Return 1 or more CSS Classes - For Article Page What's Related List - replacing 'list-whats-related'
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like - New item as of GL v2.2.1sr1
case 'article-css-list-older': // Return 1 or more CSS Classes - For Older Articles Block - replacing "list-older-stories"
case 'topic-css-list-related': // Return 1 or more CSS Classes - For Autotags Related Topic items list - New item as of GL v2.2.1

Expand Down
7 changes: 4 additions & 3 deletions public_html/layout/modern_curve/functions.php
Expand Up @@ -46,8 +46,8 @@ function theme_config_modern_curve()
{
return array(
'theme_name' => 'Modern Curve',
'theme_version' => '1.0.1',
'theme_gl_version' => '2.2.1',
'theme_version' => '1.0.2', // Released Geeklog v2.2.1sr1
'theme_gl_version' => '2.2.1', // Minimum Geeklog version theme is compatible with
'theme_description' => '',
'theme_author' => '',
'theme_homepage' => 'https://www.geeklog.net/',
Expand Down Expand Up @@ -271,9 +271,10 @@ function theme_getThemeItem_modern_curve($item)
case 'comment-width-user-avatar': // Return width in pixels of user photos in comments - New item as of GL v2.2.1
case 'article-css-list-directory': // Return 1 or more CSS Classes - For Article Directory page - New item as of GL v2.2.1
case 'article-css-list-related': // Return 1 or more CSS Classes - For Article Page What's Related List - replacing 'list-whats-related'
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like
case 'article-css-list-related-articles': // Return 1 or more CSS Classes - For Article Page You might also like - New item as of GL v2.2.1sr1
case 'article-css-list-older': // Return 1 or more CSS Classes - For Older Articles Block - replacing "list-older-stories"
case 'topic-css-list-related': // Return 1 or more CSS Classes - For Autotags Related Topic items list - New item as of GL v2.2.1
case 'core-file-print-css': // Return Common CSS file to be used for print pages - New item as of GL v2.2.1sr1

// If any other items requested return empty string
default:
Expand Down

0 comments on commit 3a5218c

Please sign in to comment.