Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Danny Froberg
steempress_amn
Commits
c3cc1926
Commit
c3cc1926
authored
Jul 27, 2018
by
Martin Lees
Browse files
work in progress here and there
parent
c204bba9
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/class-steempress_sp.php
View file @
c3cc1926
...
...
@@ -194,7 +194,6 @@ class Steempress_sp {
$this
->
loader
->
add_action
(
'wp_enqueue_scripts'
,
$plugin_public
,
'enqueue_styles'
);
$this
->
loader
->
add_action
(
'wp_enqueue_scripts'
,
$plugin_public
,
'enqueue_scripts'
);
$this
->
loader
->
add_filter
(
'the_content'
,
$plugin_public
,
'steempress_sp_comments'
);
}
/**
...
...
public/class-steempress_sp-public.php
View file @
c3cc1926
...
...
@@ -100,6 +100,25 @@ class Steempress_sp_Public {
}
private
function
steempress_sp_steem_comments
(
$id
,
$username
,
$permlink
)
{
$data
=
array
(
"jsonrpc"
=>
"2.0"
,
"method"
=>
"get_content_replies"
,
"params"
=>
[
$username
,
$permlink
]
);
$result
=
wp_remote_post
(
"https://api.steemit.com"
,
array
(
'headers'
=>
array
(
'Content-Type'
=>
'application/json; charset=utf-8'
),
'body'
=>
json_encode
(
$data
),
'method'
=>
'POST'
));
return
$result
[
'body'
];
}
public
function
steempress_sp_comments
(
$content
)
{
...
...
@@ -108,23 +127,30 @@ class Steempress_sp_Public {
$username
=
get_post_meta
(
$id
,
"steempress_sp_username"
);
$permlink
=
get_post_meta
(
$id
,
"steempress_sp_permlink"
);
$payout
=
""
;
$data
=
""
;
$comments
=
""
;
if
(
sizeof
(
$username
)
==
1
and
sizeof
(
$permlink
)
==
1
)
{
$data
=
"<div id=
\"
steempress_sp_username
\"
style=
\"
display: none;
\"
>"
.
$username
[
0
]
.
"</div>"
;
$data
.
=
"<div id=
\"
steempress_sp_permlink
\"
style=
\"
display: none;
\"
>"
.
$permlink
[
0
]
.
"</div>"
;
$username
=
$username
[
0
];
$permlink
=
$permlink
[
0
];
$data
=
"<div id=
\"
steempress_sp_username
\"
style=
\"
display: none;
\"
>"
.
$username
.
"</div>"
;
$data
.
=
"<div id=
\"
steempress_sp_permlink
\"
style=
\"
display: none;
\"
>"
.
$permlink
.
"</div>"
;
$payout
=
"<div id='steempress_sp_price'>0.000$</div>"
;
// comment zone
$comments
=
"<div id='steempress_sp_price'>0.000$</div>"
;
echo
(
$this
->
steempress_sp_steem_comments
(
$id
,
$username
,
$permlink
))
;
}
return
$content
.
$data
.
$payout
;
}
}
public/js/steempress_sp-public.js
View file @
c3cc1926
...
...
@@ -33,8 +33,8 @@
$
(
window
).
load
(
function
()
{
const
username
=
"
howo
"
//
$("#steempress_sp_username")[0].innerText;
const
permlink
=
"
my-steemniversary-one-year-going-from-oh-this-looks-cool-to-well-this-is-now-my-job
"
//
$("#steempress_sp_permlink")[0].innerText;
const
username
=
$
(
"
#steempress_sp_username
"
)[
0
].
innerText
;
const
permlink
=
$
(
"
#steempress_sp_permlink
"
)[
0
].
innerText
;
console
.
log
(
permlink
);
steem
.
api
.
getContent
(
username
,
permlink
,
function
(
err
,
response
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment