code cleanup continued

This commit is contained in:
nobody 2022-02-24 13:00:41 -08:00
parent 4b4f24057b
commit 4dd6c376aa
15 changed files with 57 additions and 32 deletions

View file

@ -126,7 +126,7 @@ class Themes
} }
} }
$screenshot = array(get_theme_screenshot($theme), t('Screenshot')); $screenshot = array(Theme::get_screenshot($theme), t('Screenshot'));
if (!stristr($screenshot[0], $theme)) { if (!stristr($screenshot[0], $theme)) {
$screenshot = null; $screenshot = null;
} }
@ -142,7 +142,7 @@ class Themes
'$plugin' => $theme, '$plugin' => $theme,
'$status' => $status, '$status' => $status,
'$action' => $action, '$action' => $action,
'$info' => get_theme_info($theme), '$info' => Theme::get_info($theme),
'$function' => 'themes', '$function' => 'themes',
'$admin_form' => $admin_form, '$admin_form' => $admin_form,
'$str_author' => t('Author: '), '$str_author' => t('Author: '),

View file

@ -4,6 +4,7 @@ namespace Code\Module;
use App; use App;
use Code\Web\Controller; use Code\Web\Controller;
use Code\Render\Theme;
class Theme_info extends Controller class Theme_info extends Controller
{ {
@ -32,7 +33,7 @@ class Theme_info extends Controller
$theme_config = $th_config->get(); $theme_config = $th_config->get();
} }
} }
$info = get_theme_info($theme); $info = Theme::get_info($theme);
if ($info) { if ($info) {
// unfortunately there will be no translation for this string // unfortunately there will be no translation for this string
$desc = $info['description']; $desc = $info['description'];
@ -46,7 +47,7 @@ class Theme_info extends Controller
$ret = [ $ret = [
'theme' => $theme, 'theme' => $theme,
'img' => get_theme_screenshot($theme), 'img' => Theme::get_screenshot($theme),
'desc' => $desc, 'desc' => $desc,
'version' => $version, 'version' => $version,
'credits' => $credits, 'credits' => $credits,

View file

@ -179,7 +179,7 @@ class Theme
return ''; return '';
} }
static public function get_info($theme) { public static function get_info($theme) {
$info = null; $info = null;
if (is_file("view/theme/$theme/$theme.yml")) { if (is_file("view/theme/$theme/$theme.yml")) {
@ -192,7 +192,7 @@ class Theme
} }
static public function get_email_template($s, $root = '') public static function get_email_template($s, $root = '')
{ {
$testroot = ($root=='') ? $testroot = "ROOT" : $root; $testroot = ($root=='') ? $testroot = "ROOT" : $root;
$t = App::template_engine(); $t = App::template_engine();
@ -216,7 +216,7 @@ class Theme
} }
} }
static public function get_template($s, $root = '') public static function get_template($s, $root = '')
{ {
$testroot = ($root=='') ? $testroot = "ROOT" : $root; $testroot = ($root=='') ? $testroot = "ROOT" : $root;
@ -242,10 +242,30 @@ class Theme
} }
/**
* @brief Returns the theme's screenshot.
*
* The screenshot is expected as view/theme/$theme/img/screenshot.[png|jpg].
*
* @param string $theme The name of the theme
* @return string
*/
public static function get_screenshot($theme)
{
$exts = array('.png', '.jpg');
foreach ($exts as $ext) {
if (file_exists('view/theme/' . $theme . '/img/screenshot' . $ext)) {
return(z_root() . '/view/theme/' . $theme . '/img/screenshot' . $ext);
}
}
return(z_root() . '/images/blank.png');
}
public function debug() public static function debug()
{ {
logger('system_theme: ' . self::$system_theme); logger('system_theme: ' . self::$system_theme);
logger('session_theme: ' . self::$session_theme); logger('session_theme: ' . self::$session_theme);

View file

@ -1,8 +1,8 @@
INPUT = README.md index.php boot.php include/ install/ util/ view/ Code/ INPUT = README.md index.php boot.php include/ install/ util/ view/ Code/
RECURSIVE = YES RECURSIVE = YES
PROJECT_NAME = "Hubzilla" PROJECT_NAME = "Streams"
PROJECT_LOGO = images/rm-64.png PROJECT_LOGO = images/streams-64.png
EXCLUDE = .htconfig.php library/ doc/ store/ vendor/ .git/ util/zotsh/easywebdav/ util/generate-hooks-index/ EXCLUDE = .htconfig.php library/ doc/ store/ vendor/ .git/ util/generate-hooks-index/
EXCLUDE_PATTERNS = *smarty3* *strings.php *.out *test* EXCLUDE_PATTERNS = *smarty3* *strings.php *.out *test*
OUTPUT_DIRECTORY = doc OUTPUT_DIRECTORY = doc
GENERATE_HTML = YES GENERATE_HTML = YES

View file

@ -102,7 +102,7 @@ When strings are added or modified in source, you could run
to extract strings from source files and join them with the existing .po file: to extract strings from source files and join them with the existing .po file:
new strings are added, the existing are not overwritten. new strings are added, the existing are not overwritten.
If you already translated the Hubzilla using strings.php, you could import your old If you already translated the project using strings.php, you could import your old
translation to messages.po. Run: translation to messages.po. Run:
$ php util/php2po.php view/<language>/strings.php $ php util/php2po.php view/<language>/strings.php

View file

@ -7,7 +7,7 @@ use Code\Daemon\Run;
use Code\Lib\Channel; use Code\Lib\Channel;
if(!file_exists('include/cli_startup.php')) { if(!file_exists('include/cli_startup.php')) {
echo 'Run dcp from the top level Hubzilla web directory, as util/dcp <args>' . PHP_EOL; echo 'Run dcp from the top level web directory, as util/dcp <args>' . PHP_EOL;
exit(1); exit(1);
} }

View file

@ -8,7 +8,7 @@ use Code\Lib\Channel;
// file import to DAV utility // file import to DAV utility
if(!file_exists('include/cli_startup.php')) { if(!file_exists('include/cli_startup.php')) {
echo 'Run dmkdir from the top level Hubzilla web directory, as util/dmkdir <args>' . PHP_EOL; echo 'Run dmkdir from the top level web directory, as util/dmkdir <args>' . PHP_EOL;
exit(1); exit(1);
} }

View file

@ -1,12 +1,12 @@
# Generate hooks # Generate hooks
This program generates hooks.html documentation from the Hubzilla source. This program generates hooks.html documentation from the project source.
## Usage ## Usage
Download and install leiningen Download and install leiningen
Change directory into hubzilla/util/generate-hooks-index Change directory into util/generate-hooks-index
At shell prompt, do: At shell prompt, do:
@ -14,7 +14,7 @@ At shell prompt, do:
lein run lein run
``` ```
Hooks docs will get dumped into hubzilla/doc/hooks.html Hooks docs will get dumped into doc/hooks.html
## Requirements ## Requirements

View file

@ -1,6 +1,6 @@
(defproject generate-hooks-index "0.1.0-SNAPSHOT" (defproject generate-hooks-index "0.1.0-SNAPSHOT"
:description "Generates Hooks docs for Hubzilla" :description "Generates Hooks docs from source code"
:url "https://framagit.org/hubzilla/core/" :url "https://codeberg.org/streams/streams"
:license {:name "Eclipse Public License" :license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"} :url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]

View file

@ -1,10 +1,10 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
// Hubzilla thumbnails storage convertor // thumbnails storage convertor
function usage() { function usage() {
echo <<< EOT echo <<< EOT
Hubzilla thumbnails storage convertor thumbnails storage convertor
Usage: Usage:
util/storageconv stats # show current stats util/storageconv stats # show current stats

View file

@ -1901,3 +1901,7 @@ dl.bb-dl > dd > li {
margin: 0 10px; margin: 0 10px;
padding: 10px 0; padding: 10px 0;
} }
.screenshot img {
max-width: 100%;
}

View file

@ -17,10 +17,10 @@ class RedbasicConfig {
if(in_array('view/theme/redbasic/schema/default.php', $files)) { if(in_array('view/theme/redbasic/schema/default.php', $files)) {
$scheme_choices['---'] = t('Default'); $scheme_choices['---'] = t('Default');
$scheme_choices['focus'] = t('Focus (Hubzilla default)'); $scheme_choices['focus'] = t('Focus (default)');
} }
else { else {
$scheme_choices['---'] = t('Focus (Hubzilla default)'); $scheme_choices['---'] = t('Focus (default)');
} }
foreach($files as $file) { foreach($files as $file) {

View file

@ -2,7 +2,7 @@
/** /**
* * Name: Redbasic * * Name: Redbasic
* * Description: Hubzilla standard theme * * Description: standard theme
* * Version: 2.1 * * Version: 2.1
* * Author: Fabrixxm * * Author: Fabrixxm
* * Maintainer: Mike Macgirvin * * Maintainer: Mike Macgirvin

View file

@ -160,7 +160,7 @@ function update_inroom(inroom) {
memberChange = chatRoomMembersChange(inroom); // get list of arrivals and departures memberChange = chatRoomMembersChange(inroom); // get list of arrivals and departures
if(memberChange.membersArriving.length > 0) { if(memberChange.membersArriving.length > 0) {
// Issue pop-up notification if anyone enters the room. // Issue pop-up notification if anyone enters the room.
chat_issue_notification(JSON.stringify(memberChange.membersArriving.pop().name) + ' entered the room', 'Hubzilla Chat'); chat_issue_notification(JSON.stringify(memberChange.membersArriving.pop().name) + ' entered the room', 'Chat');
} }
$('#chatMembers').html(html); $('#chatMembers').html(html);
} }
@ -201,7 +201,7 @@ function update_chats(chats) {
else { else {
newNode.setAttribute('class', 'chat-item clear'); newNode.setAttribute('class', 'chat-item clear');
$(newNode).html('<img class="chat-item-photo" src="' + item.img + '" alt="' + item.name + '" /><div class="chat-body"><div class="chat-item-title wall-item-ago"><span class="chat-item-name">' + item.name + ' </span><span class="autotime chat-item-time" title="' + item.isotime + '">' + item.localtime + '</span></div><div class="chat-item-text">' + item.text + '</div></div>'); $(newNode).html('<img class="chat-item-photo" src="' + item.img + '" alt="' + item.name + '" /><div class="chat-body"><div class="chat-item-title wall-item-ago"><span class="chat-item-name">' + item.name + ' </span><span class="autotime chat-item-time" title="' + item.isotime + '">' + item.localtime + '</span></div><div class="chat-item-text">' + item.text + '</div></div>');
chat_issue_notification(item.name + ':\n' + item.text, 'Hubzilla Chat'); chat_issue_notification(item.name + ':\n' + item.text, 'Chat');
} }
$('#chatLineHolder').append(newNode); $('#chatLineHolder').append(newNode);
$(".autotime").timeago(); $(".autotime").timeago();

View file

@ -6,21 +6,21 @@
<Property <Property
type="http://www.oexchange.org/spec/0.8/prop/vendor">Code</Property> type="http://www.oexchange.org/spec/0.8/prop/vendor">Code</Property>
<Property <Property
type="http://www.oexchange.org/spec/0.8/prop/title">Hubzilla</Property> type="http://www.oexchange.org/spec/0.8/prop/title">Streams</Property>
<Property <Property
type="http://www.oexchange.org/spec/0.8/prop/name">Hubzilla</Property> type="http://www.oexchange.org/spec/0.8/prop/name">Streams</Property>
<Property <Property
type="http://www.oexchange.org/spec/0.8/prop/prompt">Send to Hubzilla</Property> type="http://www.oexchange.org/spec/0.8/prop/prompt">Send to Streams</Property>
<Link <Link
rel="icon" rel="icon"
href="{{$base}}/images/hz-16.png" href="{{$base}}/images/streams-16.png"
type="image/png" type="image/png"
/> />
<Link <Link
rel="icon32" rel="icon32"
href="{{$base}}/images/hz-32.png" href="{{$base}}/images/streams-32.png"
type="image/png" type="image/png"
/> />