Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Feeds
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MickGe
Feeds
Commits
4325c30a
Commit
4325c30a
authored
4 years ago
by
Andrew Dolgov
Browse files
Options
Downloads
Patches
Plain Diff
share: markup cleanup
parent
273ada73
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/share/init.php
+65
-83
65 additions, 83 deletions
plugins/share/init.php
with
65 additions
and
83 deletions
plugins/share/init.php
+
65
−
83
View file @
4325c30a
...
@@ -96,7 +96,7 @@ class Share extends Plugin {
...
@@ -96,7 +96,7 @@ class Share extends Plugin {
$id
=
$row
[
"ref_id"
];
$id
=
$row
[
"ref_id"
];
$owner_uid
=
$row
[
"owner_uid"
];
$owner_uid
=
$row
[
"owner_uid"
];
print
$this
->
format_article
(
$id
,
$owner_uid
);
$this
->
format_article
(
$id
,
$owner_uid
);
return
;
return
;
}
}
...
@@ -125,8 +125,6 @@ class Share extends Plugin {
...
@@ -125,8 +125,6 @@ class Share extends Plugin {
WHERE id = ? AND ref_id = id AND owner_uid = ?"
);
WHERE id = ? AND ref_id = id AND owner_uid = ?"
);
$sth
->
execute
([
$id
,
$owner_uid
]);
$sth
->
execute
([
$id
,
$owner_uid
]);
$rv
=
''
;
if
(
$line
=
$sth
->
fetch
())
{
if
(
$line
=
$sth
->
fetch
())
{
$line
[
"tags"
]
=
Article
::
_get_tags
(
$id
,
$owner_uid
,
$line
[
"tag_cache"
]);
$line
[
"tags"
]
=
Article
::
_get_tags
(
$id
,
$owner_uid
,
$line
[
"tag_cache"
]);
...
@@ -142,106 +140,90 @@ class Share extends Plugin {
...
@@ -142,106 +140,90 @@ class Share extends Plugin {
},
},
$line
);
$line
);
$enclosures
=
Article
::
_get_enclosures
(
$line
[
"id"
]);
list
(
$og_image
,
$og_stream
)
=
Article
::
_get_image
(
$enclosures
,
$line
[
'content'
],
$line
[
"site_url"
]);
$content_decoded
=
html_entity_decode
(
$line
[
"title"
],
ENT_NOQUOTES
|
ENT_HTML401
);
$parsed_updated
=
TimeHelper
::
make_local_datetime
(
$line
[
"updated"
],
true
,
$owner_uid
,
true
);
$line
[
'content'
]
=
DiskCache
::
rewrite_urls
(
$line
[
'content'
]);
$line
[
'content'
]
=
DiskCache
::
rewrite_urls
(
$line
[
'content'
]);
header
(
"Content-Type: text/html"
);
ob_start
(
);
$rv
.
=
"<!DOCTYPE html>
?>
<html><head>
<!DOCTYPE html>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<html>
<title>"
.
$line
[
"title"
]
.
"</title>"
.
<head>
javascript_tag
(
"lib/prototype.js"
)
.
<meta
http-equiv=
'Content-Type'
content=
'text/html; charset=utf-8'
/>
javascript_tag
(
"js/utility.js"
)
.
"
<title>
<?=
$line
[
"title"
]
?>
</title>
<?=
javascript_tag
(
"lib/prototype.js"
)
?>
<?=
javascript_tag
(
"js/utility.js"
)
?>
<style
type=
'text/css'
>
<style
type=
'text/css'
>
@media (prefers-color-scheme: dark) {
@media
(
prefers-color-scheme
:
dark
)
{
body
{
body
{
background
:
#222
;
background
:
#222
;
}
}
}
}
body.css_loading * {
body
.css_loading
*
{
display
:
none
;
display
:
none
;
}
}
</style>
</style>
<link rel='shortcut icon' type='image/png' href='images/favicon.png'>
<link
rel=
'shortcut icon'
type=
'image/png'
href=
'images/favicon.png'
>
<link rel='icon' type='image/png' sizes='72x72' href='images/favicon-72px.png'>"
;
<link
rel=
'icon'
type=
'image/png'
sizes=
'72x72'
href=
'images/favicon-72px.png'
>
$rv
.
=
"<meta property='og:title' content=
\"
"
.
htmlspecialchars
(
html_entity_decode
(
$line
[
"title"
],
ENT_NOQUOTES
|
ENT_HTML401
))
.
"
\"
/>
\n
"
;
<meta
property=
'og:title'
content=
"
<?=
htmlspecialchars
(
$content_decoded
)
?>
"
>
$rv
.
=
"<meta property='og:description' content=
\"
"
.
<meta
property=
'og:description'
content=
"
<?=
htmlspecialchars
(
htmlspecialchars
(
truncate_string
(
truncate_string
(
preg_replace
(
"/[
\r\n\t
]/"
,
""
,
preg_replace
(
"/[
\r\n\t
]/"
,
""
,
preg_replace
(
"/
{
1,
}
/"
,
" "
,
preg_replace
(
"/
{
1,
}
/"
,
" "
,
strip_tags
(
html_entity_decode
(
$line
[
"content"
],
ENT_NOQUOTES
|
ENT_HTML401
)
)
strip_tags
(
$content_decoded
)
)
)
),
500
,
"..."
)
),
500
,
"..."
))
?>
"
>
)
.
"
\"
/>
\n
"
;
</head>
$rv
.
=
"</head>"
;
<?php
if
(
$og_image
)
{
?>
<meta
property=
'og:image'
content=
"
<?=
htmlspecialchars
(
$og_image
)
?>
"
>
$enclosures
=
Article
::
_get_enclosures
(
$line
[
"id"
]);
<?php
}
?>
list
(
$og_image
,
$og_stream
)
=
Article
::
_get_image
(
$enclosures
,
$line
[
'content'
],
$line
[
"site_url"
]);
<body
class=
'flat ttrss_utility ttrss_zoom css_loading'
>
if
(
$og_image
)
{
<div
class=
'container'
>
$rv
.
=
"<meta property='og:image' content=
\"
"
.
htmlspecialchars
(
$og_image
)
.
"
\"
/>"
;
}
<?php
if
(
!
empty
(
$line
[
"link"
]))
{
?>
<h1>
$rv
.
=
"<body class='flat ttrss_utility ttrss_zoom css_loading'>"
;
<a
target=
'_blank'
rel=
'noopener noreferrer'
$rv
.
=
"<div class='container'>"
;
href=
"
<?=
htmlspecialchars
(
$line
[
"link"
])
?>
"
>
<?=
htmlspecialchars
(
$line
[
"title"
])
?>
</a>
</h1>
if
(
$line
[
"link"
])
{
<?php
}
else
{
?>
$rv
.
=
"<h1><a target='_blank' rel='noopener noreferrer'
<h1>
<?=
$line
[
"title"
]
?>
</h1>
title=
\"
"
.
htmlspecialchars
(
$line
[
'title'
])
.
"
\"
<?php
}
?>
href=
\"
"
.
htmlspecialchars
(
$line
[
"link"
])
.
"
\"
>"
.
$line
[
"title"
]
.
"</a></h1>"
;
}
else
{
<div
class=
'content post'
>
$rv
.
=
"<h1>"
.
$line
[
"title"
]
.
"</h1>"
;
<div
class=
'header'
>
}
<div
class=
'row'
>
<div>
<?=
$line
[
'author'
]
?>
</div>
$rv
.
=
"<div class='content post'>"
;
<div>
<?=
$parsed_updated
?>
</div>
</div>
/* header */
</div>
$rv
.
=
"<div class='header'>"
;
<div
class=
'content'
lang=
"
<?=
$line
[
'lang'
]
?
$line
[
'lang'
]
:
"en"
?>
"
>
$rv
.
=
"<div class='row'>"
;
# row
<?=
$line
[
"content"
]
?>
</div>
//$entry_author = $line["author"] ? " - " . $line["author"] : "";
</div>
$parsed_updated
=
TimeHelper
::
make_local_datetime
(
$line
[
"updated"
],
true
,
</body>
$owner_uid
,
true
);
</html>
<?php
$rv
.
=
"<div>"
.
$line
[
'author'
]
.
"</div>"
;
$rv
.
=
"<div>
$parsed_updated
</div>"
;
$rv
.
=
"</div>"
;
# row
$rv
.
=
"</div>"
;
# header
/* content */
$lang
=
$line
[
'lang'
]
?
$line
[
'lang'
]
:
"en"
;
$rv
.
=
"<div class='content' lang='
$lang
'>"
;
/* content body */
$rv
.
=
$line
[
"content"
];
/* $rv .= Article::format_article_enclosures($id,
$line["always_display_enclosures"],
$line["content"],
$line["hide_images"]); */
$rv
.
=
"</div>"
;
# content
$rv
.
=
"</div>"
;
# post
$rv
=
ob_get_contents
();
ob_end_clean
();
}
PluginHost
::
getInstance
()
->
chain_hooks_callback
(
PluginHost
::
HOOK_FORMAT_ARTICLE
,
PluginHost
::
getInstance
()
->
chain_hooks_callback
(
PluginHost
::
HOOK_FORMAT_ARTICLE
,
function
(
$result
)
use
(
&
$rv
)
{
function
(
$result
)
use
(
&
$rv
)
{
$rv
=
$result
;
$rv
=
$result
;
},
},
$rv
,
$line
);
$rv
,
$line
);
return
$rv
;
print
$rv
;
}
}
}
function
shareDialog
()
{
function
shareDialog
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment