Commit 1219ea6a authored by Martin Lees's avatar Martin Lees
Browse files

Adds the option to enable and disable the two way integration

parent 3f8ef13f
......@@ -152,6 +152,7 @@ class Steempress_sp_Admin {
$valid['delay'] = ((isset($input['delay']) && !empty($input['delay']) && is_numeric($input['delay']) && $input['delay'] >= 0)) ? htmlspecialchars($input['delay'], ENT_QUOTES) : "0";
$valid['featured'] = ((isset($input['featured']) && !empty($input['featured'])) && $input['featured'] == 'on') ? 'on' : "off";
$valid['footer'] = (isset($input['footer']) && !empty($input['footer'])) ? htmlspecialchars($input['footer'], ENT_QUOTES) : "<br /><center><hr/><em>Posted from my blog with <a href='https://wordpress.org/plugins/steempress/'>SteemPress</a> : [%original_link%] </em><hr/></center>";
$valid['twoway'] = ((isset($input['twoway']) && !empty($input['twoway'])) && $input['twoway'] == 'on') ? 'on' : "off";
$users = get_users();
......@@ -165,7 +166,6 @@ class Steempress_sp_Admin {
for ($i = 0; $i < sizeof($categories); $i++)
{
$valid['cat'.$categories[$i]->cat_ID] = ((isset($input['cat'.$categories[$i]->cat_ID]) && !empty($input['cat'.$categories[$i]->cat_ID])) && $input['cat'.$categories[$i]->cat_ID] == 'on') ? 'on' : "off";
}
......
......@@ -45,7 +45,8 @@
$options["featured"] = "on";
if (!isset($options["footer"]))
$options["footer"] = "<br /><center><hr/><em>Posted from my blog with <a href='https://wordpress.org/plugins/steempress/'>SteemPress</a> : [%original_link%] </em><hr/></center>";
if (!isset($options["twoway"]))
$options["twoway"] = "off";
$users = get_users();
$categories = get_categories(array('hide_empty' => FALSE));
......@@ -147,8 +148,14 @@
?>
<br/>
Two way integration : <br/>
These options are related to how the plugin will pull payout data and comments onto your wordpress blog. <br/>
<?php
echo "<input type='checkbox' id='".$this->plugin_name."-twoway' name='".$this->plugin_name."[twoway]' ".($options['twoway'] == "on" ? "checked='checked'" : "")."> Activate two way integration (BETA) ";
submit_button('Save all changes', 'primary','submit', TRUE); ?>
<?php submit_button('Save all changes', 'primary','submit', TRUE); ?>
</form>
<p><?php
......
......@@ -104,36 +104,46 @@ class Steempress_sp_Public {
public function steempress_sp_comments($content)
{
$id = get_the_ID();
$options = get_option($this->plugin_name);
$username = get_post_meta($id, "steempress_sp_username");
$permlink = get_post_meta($id, "steempress_sp_permlink");
$tag = get_post_meta($id, "steempress_sp_tag");
$payout = "";
$data = "";
$comments = "";
if (!isset($options["twoway"]))
$options["twoway"] = "off";
if (sizeof($username) == 1 and sizeof($permlink) == 1 and sizeof($tag) == 1)
{
if ($options['twoway'] == "on") {
$username = $username[0];
$permlink = $permlink[0];
$tag = $tag[0];
$id = get_the_ID();
$data = "<div id=\"steempress_sp_username\" style=\"display: none;\">".$username."</div>";
$data .= "<div id=\"steempress_sp_permlink\" style=\"display: none;\">".$permlink."</div>";
$data .= "<div id=\"steempress_sp_tag\" style=\"display: none;\">".$tag."</div>";
$username = get_post_meta($id, "steempress_sp_username");
$permlink = get_post_meta($id, "steempress_sp_permlink");
$tag = get_post_meta($id, "steempress_sp_tag");
$payout = "";
$data = "";
$comments = "";
$payout = "<div id='steempress_sp_price'>0.000$</div>";
if (sizeof($username) == 1 and sizeof($permlink) == 1 and sizeof($tag) == 1) {
// comment zone
$comments = "<br/><div id='steempress_sp_comments'></div>";
}
$username = $username[0];
$permlink = $permlink[0];
$tag = $tag[0];
$data = "<div id=\"steempress_sp_username\" style=\"display: none;\">" . $username . "</div>";
$data .= "<div id=\"steempress_sp_permlink\" style=\"display: none;\">" . $permlink . "</div>";
$data .= "<div id=\"steempress_sp_tag\" style=\"display: none;\">" . $tag . "</div>";
$payout = "<div id='steempress_sp_price'>0.000$</div>";
return $content.$data.$payout.$comments;
}
// comment zone
$comments = "<br/><div id='steempress_sp_comments'></div>";
}
return $content . $data . $payout . $comments;
} else
return $content;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment