Skip to content

Commit c6b5be7

Browse files
authored
Merge pull request #25 from jdarwood007/cleanUp
Finish support for 1.39 and refactor code
2 parents e422042 + 52fadaa commit c6b5be7

18 files changed

+319
-26
lines changed

.gitattributes

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# Force our line endings to be LF, even for Windows
2-
* text eol=lf
2+
* text eol=lf
3+
4+
# Set certain files to be binary
5+
*.png binary
6+
*.jpg binary
7+
*.gif binary
8+
*.tgz binary
9+
*.zip binary
10+
*.tar.gz binary
11+
*.ttf binary

.github/workflows/Syntax-Check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
operating-system: [ ubuntu-latest ]
11-
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1' ]
11+
php: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
1212
name: PHP ${{ matrix.php }} Syntax Check
1313
steps:
1414
- uses: actions/checkout@master

README.md

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
## smfCurve - Curve Skin for MediaWiki
2-
32
This is Mediawiki Skin based on Curve for SMF development repository.
43
Parts of this theme are licensed under [BSD 3-clause license](https://www.opensource.org/licenses/BSD-3-Clause), Others are [GPL](https://www.gnu.org/copyleft/gpl.html)
54

65
#### Versions
7-
* **1.x**: Compatible with SMF2.0
86
* **2.x**: Compatible with SMF2.1
7+
* **1.x**: Compatible with SMF2.0 [No longer actively developed]
98

109
#### Branches organization:
11-
* ***master*** - main branch, v2.0 (smfCurve2) compatible with **SMF2.1**, Supporting MediaWiki 1.39+
10+
* ***master*** - main branch, v2.1 (smfCurve2) compatible with **SMF2.1**, Supporting MediaWiki 1.39+
1211
* ***2.0*** - main branch, v2.0 (smfCurve2) compatible with **SMF2.1**, Supporting MediaWiki 1.31-1.35
13-
* ***1.0*** - for old MediaWiki installs (Prior to 1.23)
14-
* ***1.1*** - for MediaWiki 1.23 (LTS)
15-
* ***1.2*** - for MediaWiki 1.25+
16-
* ***1.3*** - for MediaWiki 1.27 (LTS)
1712
* ***1.4*** - for MediaWiki 1.31-1.35 (LTS)
18-
19-
[Installing](https://github.com/SimpleMachines/smfcurve/wiki/Installing) - [Upgrading](https://github.com/SimpleMachines/smfcurve/wiki/Upgrading)
13+
* ***1.3*** - for MediaWiki 1.27 (LTS)
14+
* ***1.2*** - for MediaWiki 1.25+
15+
* ***1.1*** - for MediaWiki 1.23 (LTS)
16+
* ***1.0*** - for old MediaWiki installs (Prior to 1.23)
2017

2118
#### Notes:
22-
2319
Feel free to fork this repository and make your desired changes.
2420

2521
Please see the [Developer's Certificate of Origin](https://github.com/SimpleMachines/smfcurve/blob/master/DCO.txt) in the repository:
@@ -29,7 +25,56 @@ by signing off your contributions, you acknowledge that you can and do license y
2925
* fork the repository. If you are not used to Github, please check out [fork a repository](http://help.github.com/fork-a-repo).
3026
* branch your repository, to commit the desired changes.
3127
* sign-off your commits, to acknowledge your submission under the license of the project.
32-
* an easy way to do so, is to define an alias for the git commit command, which includes -s switch (reference: [How to create Git aliases](http://githacks.com/post/1168909216/how-to-create-git-aliases))
28+
* an easy way to do so, is to define an alias for the git commit command, which includes -s switch (reference: [How to create Git aliases](https://githacks.com/post/1168909216/how-to-create-git-aliases))
3329
* send a pull request to us.
3430

3531
Finally, feel free to play around. That's what we're doing. ;)
32+
33+
## Installing
34+
Add to your LocalSettings.php
35+
```
36+
wfLoadSkin( 'smfcurve2' );
37+
```
38+
39+
To set as the default skin:
40+
```
41+
$wgDefaultSkin = "smfcurve2";
42+
```
43+
44+
## Customizing
45+
We provide a few simple and more advanced methods to customizing the skin.
46+
47+
### Simple
48+
49+
#### Adding the forum main menu
50+
Add to your LocalSettings.php (After your wfLoadSkin line)
51+
```
52+
$wgsmfRoot = '/path/to/forum';
53+
$wgshowSMFmenu = true;
54+
```
55+
56+
#### Adding the Wiki logo where the SMF logo shows
57+
```
58+
$wguseLogoImage = true;
59+
```
60+
61+
#### Adding the search to the sidebar
62+
```
63+
$wguseSideSearchBox = true;
64+
```
65+
66+
### Advanced
67+
To do more advance customizing, several files can be changed. However they are designed to allow extending the base skin.
68+
69+
First set in your LocalSettings.php
70+
```
71+
$wgDefaultSkin = "smfcurve2custom";
72+
```
73+
74+
You can modify the following files depending on your needs:
75+
- /inclues/smfCurve2SkinCustom.php
76+
- /inclues/smfCurve2TemplateCustom.php
77+
- /resources/script/custom.js
78+
- /resources/css/custom.css
79+
80+
We have included some sample code to show how modifications may be made.

includes/Skinsmfcurve2.php renamed to includes/smfCurve2Skin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
* https://www.gnu.org/copyleft/gpl.html
1919
*
20-
* Copyright 2022, Simple Machines and Individual Contributors
20+
* Copyright 2023, Simple Machines and Individual Contributors
2121
*
2222
* Based On smfcurve by Labradoodle-360
2323
*
@@ -34,7 +34,7 @@
3434
*
3535
* @ingroup Skins
3636
*/
37-
class Skinsmfcurve2 extends SkinTemplate
37+
class smfCurve2Skin extends SkinTemplate
3838
{
3939
/**
4040
* @inheritDoc

includes/smfCurve2SkinCustom.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* SMF Curve 2
4+
*
5+
** This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation; either version 2 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along
16+
* with this program; if not, write to the Free Software Foundation, Inc.,
17+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
* https://www.gnu.org/copyleft/gpl.html
19+
*
20+
* Copyright 2023, Simple Machines and Individual Contributors
21+
*
22+
* Based On smfcurve by Labradoodle-360
23+
*
24+
* Images under separate license
25+
* @license https://www.simplemachines.org/about/smf/license.php BSD
26+
*/
27+
28+
namespace MediaWiki\Skin\smfcurve2;
29+
30+
use SkinTemplate;
31+
32+
/*
33+
* This is a sample of how to extend and modify the main template, without requiring changes to the main template.
34+
* Keeps your customizations separated from the logic that builds the base theme
35+
*/
36+
class smfCurve2SkinCustom extends smfCurve2Skin
37+
{
38+
public function __construct(
39+
array $options = []
40+
) {
41+
$out = $this->getOutput();
42+
/**
43+
* Some shortcuts to more commonly used/needed methods.
44+
* This is a incomplete list, see /includes/OutputPage.php for the complete list.
45+
*
46+
* $out->addStyle
47+
* @param string $style URL to the file
48+
* @param string $media To specify a media type, 'screen', 'printable', 'handheld' or any.
49+
* @param string $condition For IE conditional comments, specifying an IE version
50+
* @param string $dir Set to 'rtl' or 'ltr' for direction-specific sheets
51+
*
52+
* $out->addInlineStyle
53+
* @param mixed $style_css Inline CSS
54+
* @param string $flip Set to 'flip' to flip the CSS if needed
55+
*
56+
* $out->addScript
57+
* !!! Add your own <script> tags, added just before </body>.
58+
* @param string $script Raw HTML
59+
*
60+
* $out->addScriptFile
61+
* !!! Added just before </body>
62+
* @param string $file URL to file (absolute path, protocol-relative, or full url)
63+
* @param string|null $unused Previously used to change the cache-busting query parameter
64+
*
65+
* $out->addInlineScript
66+
* !!! Wrapped in <script> tags, no additional paramters. Added just before </body>
67+
* @param string $script JavaScript text, no script tags
68+
*
69+
* $out->addMeta
70+
* @param string $name Name of the meta tag
71+
* @param string $val Value of the meta tag
72+
*
73+
* $out->addLink
74+
* @param array $linkarr Associative array of attributes.
75+
*
76+
* $out->setCanonicalUrl
77+
* @param string $url
78+
*
79+
* $out->addBodyClasses
80+
* @param string|string[] $classes One or more classes to add
81+
*/
82+
83+
// Add some additional css.
84+
$out->addStyle('https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap', 'screen', '');
85+
86+
parent::__construct( $options );
87+
}
88+
}

includes/smfCurve2Template.php

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1818
* https://www.gnu.org/copyleft/gpl.html
1919
*
20-
* Copyright 2022, Simple Machines and Individual Contributors
20+
* Copyright 2023, Simple Machines and Individual Contributors
2121
*
2222
* Based On smfcurve by Labradoodle-360
2323
*
@@ -48,7 +48,7 @@
4848
* And Set $showSMFmenu to true in line 94
4949
*/
5050
// require_once("path/to/SSI.php");
51-
class smfcurve2Template extends BaseTemplate
51+
class smfCurve2Template extends BaseTemplate
5252
{
5353
/** @var array */
5454
protected $pileOfTools;
@@ -78,7 +78,7 @@ class smfcurve2Template extends BaseTemplate
7878
/**
7979
* @return Config
8080
*/
81-
private function getConfig() {
81+
protected function getConfig() {
8282
return $this->config;
8383
}
8484

@@ -89,13 +89,34 @@ private function setupCustomization()
8989
{
9090
global $wgRequest;
9191

92-
$ssi = $this->getConfig()->get('smfRoot')['value'];
93-
if (!empty($ssi) && file_exists($ssi . '/SSI.php'))
92+
// SMF's massive globals.
93+
global $maintenance, $msubject, $mmessage, $mbname, $language;
94+
global $boardurl, $boarddir, $sourcedir, $webmaster_email, $cookiename, $db_character_set;
95+
global $db_type, $db_server, $db_name, $db_user, $db_prefix, $db_persist, $db_error_send, $db_last_error, $db_show_debug;
96+
global $db_connection, $db_port, $modSettings, $context, $sc, $user_info, $topic, $board, $txt;
97+
global $smcFunc, $ssi_db_user, $scripturl, $ssi_db_passwd, $db_passwd, $cache_enable, $cachedir;
98+
global $auth_secret, $cache_accelerator, $cache_memcached;
99+
100+
// Add to your LocalSettings: $wgsmfRoot = '';
101+
// If you have the ForumSSoProvider installed you could do: $wgsmfRoot = $wgFSPPath;
102+
$ssi = $this->getConfig()->get('smfRoot');
103+
if (!empty($ssi) && is_string($ssi) && file_exists($ssi . '/SSI.php'))
104+
{
105+
include($ssi . '/Settings.php');
94106
require_once($ssi . '/SSI.php');
107+
}
108+
109+
// Add to your LocalSettings: $wgshowSMFmenu = true;
110+
if (is_bool($this->getConfig()->get('showSMFmenu')))
111+
$this->showSMFmenu = $this->getConfig()->get('showSMFmenu');
112+
113+
// Add to your LocalSettings: $wguseLogoImage = true;
114+
if (is_bool($this->getConfig()->get('useLogoImage')))
115+
$this->useLogoImage = $this->getConfig()->get('useLogoImage');
95116

96-
$this->showSMFmenu = $this->getConfig()->get('showSMFmenu')['value'];
97-
$this->useLogoImage = $this->getConfig()->get('useLogoImage')['value'];
98-
$this->useSideSearchBox = $this->getConfig()->get('useSideSearchBox')['value'];
117+
// Add to your LocalSettings: $wguseSideSearchBox = true;
118+
if (is_bool($this->getConfig()->get('useSideSearchBox')))
119+
$this->useSideSearchBox = $this->getConfig()->get('useSideSearchBox');
99120

100121
$this->skin = $skin = $this->data['skin'];
101122

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* SMF Curve 2
4+
*
5+
** This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation; either version 2 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License along
16+
* with this program; if not, write to the Free Software Foundation, Inc.,
17+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18+
* https://www.gnu.org/copyleft/gpl.html
19+
*
20+
* Copyright 2023, Simple Machines and Individual Contributors
21+
*
22+
* Based On smfcurve by Labradoodle-360
23+
*
24+
* Images under separate license
25+
* @license https://www.simplemachines.org/about/smf/license.php BSD
26+
*/
27+
28+
namespace MediaWiki\Skin\smfcurve2;
29+
30+
use BaseTemplate;
31+
use File;
32+
use Html;
33+
use Linker;
34+
use MediaWiki\MediaWikiServices;
35+
use MWDebug;
36+
use ResourceLoaderSkinModule;
37+
use Sanitizer;
38+
use SpecialPage;
39+
use Xml;
40+
use Hooks;
41+
Use RequestContext;
42+
43+
/*
44+
* This is a sample of how to extend and modify the main template, without requiring changes to the main template.
45+
* Keeps your customizations separated from the logic that builds the base theme
46+
*/
47+
class smfCurve2TemplateCustom extends smfCurve2Template
48+
{
49+
public function customTopSection()
50+
{
51+
// Only show the user page and preferences.
52+
// Additional options removed: ['uls', 'mytalk', 'watchlist', 'mycontris']
53+
$this->userMenu(['userpage', 'preferences']);
54+
55+
// Split the menu.
56+
echo '<div class="floatright">';
57+
$this->userMenu(['userpage', 'preferences'], true, 'ue');
58+
echo '</div>';
59+
60+
}
61+
62+
public function customPageFooterExtra()
63+
{
64+
echo '
65+
<div class="clear">
66+
<ul>
67+
<li class="copyright">Copyright &copy; ' . date('Y') . ' All Rights Reserved.</li>
68+
<li class="floatright">Page created in ', sprintf('%01.3f', microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']), ' seconds.</li>
69+
</ul>
70+
</div>';
71+
}
72+
}

resources/css/custom.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.align_right
2+
{
3+
float: right;
4+
}
5+
6+
#usermenuextra .genericmenu #top_info
7+
{
8+
padding: 0;
9+
}
10+
11+
#usermenuextra #pt-uls .uls-trigger
12+
{
13+
padding-top: 0.2em !important;
14+
}

resources/images/file_icon.png

1 Byte
Loading
6 Bytes
Loading

0 commit comments

Comments
 (0)