Skip to content

Added Karmacracy button #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions digg-digg/include/dd-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2119,4 +2119,75 @@ public function DD_Serpd() {
parent::BaseDD(self::NAME, self::URL_WEBSITE, self::URL_API, self::BASEURL);
}
}
/******************************************************************************************
*
* http://www.karmacracy.com
*
*/
class DD_Karmacracy extends BaseDD{

const NAME = "Karmacracy";
const URL_WEBSITE = "http://www.karmacracy.com";
const URL_API = "http://karmacracy.com/sections/widget/button/button.php";
const BASEURL = "<div class=\"kcy_karmacracy_widget_h_#ID#\"></div><script defer=\"defer\" src=\"http://rodney.karmacracy.com/widget-2.0/?id=#ID#&button=1&display=#TYPE#&show-tooltip=#SHOW_TOOLTIP##CADSID#\"></script>";

const OPTION_APPEND_TYPE = "dd_karmacracy_appendType";
const OPTION_BUTTON_DESIGN = "dd_karmacracy_buttonDesign";
const OPTION_BUTTON_WEIGHT = "dd_karmacracy_button_weight";
const OPTION_AJAX_LEFT_FLOAT = "dd_karmacracy_ajax_left_float";
const OPTION_LAZY_LOAD = "dd_karmacracy_lazy_load";

const DEFAULT_BUTTON_WEIGHT = "80";

var $islazyLoadAvailable = false;
var $isEncodeRequired = true;

var $buttonLayout = array(
"Normal" => "over",
"Compact" => "right"
);

const BUTTON_TYPE_TAG="#TYPE#";
const BUTTON_ID="#ID#";
const BUTTON_SHOW_TOOLTIP="#SHOW_TOOLTIP#";
const BUTTON_CADS="#CADSID#";

public function DD_Karmacracy() {

$this->option_append_type = self::OPTION_APPEND_TYPE;
$this->option_button_design = self::OPTION_BUTTON_DESIGN;
$this->option_button_weight = self::OPTION_BUTTON_WEIGHT;
$this->option_ajax_left_float = self::OPTION_AJAX_LEFT_FLOAT;
$this->option_lazy_load = self::OPTION_LAZY_LOAD;

$this->button_weight_value = self::DEFAULT_BUTTON_WEIGHT;

parent::BaseDD(self::NAME, self::URL_WEBSITE, self::URL_API, self::BASEURL);
}
public function constructURL($url, $title,$button, $postId, $lazy, $globalcfg = ''){


$rnd=rand(1,999999);
$result = str_replace(self::BUTTON_TYPE_TAG,$this->getButtonDesign($button),$this->baseURL);
$result = str_replace(self::BUTTON_ID,$rnd,$result);

if($globalcfg!=''){
$cads = $globalcfg[DD_GLOBAL_KARMACRACY_OPTION][DD_GLOBAL_KARMACRACY_OPTION_CADS];
$showtooltip=$globalcfg[DD_GLOBAL_KARMACRACY_OPTION][DD_GLOBAL_KARMACRACY_OPTION_TOOLTIP];

}
if ($cads) {
$result = str_replace(self::BUTTON_CADS,"&medio-id=".$cads,$result);
} else {
$result = str_replace(self::BUTTON_CADS,"",$result);
}
if ($showtooltip) {
$result=str_replace(self::BUTTON_SHOW_TOOLTIP,"1",$result);
} else {
$result=str_replace(self::BUTTON_SHOW_TOOLTIP,"0",$result);
}

$this->finalURL = $result;
}
}
?>
17 changes: 14 additions & 3 deletions digg-digg/include/dd-global-variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
define('DD_GLOBAL_FLATTR_OPTION','dd_global_flattr_option');
define('DD_GLOBAL_FLATTR_OPTION_UID','dd_global_flattr_option_uid');

define('DD_GLOBAL_KARMACRACY_OPTION','dd_global_karmacracy_option');
define('DD_GLOBAL_KARMACRACY_OPTION_TOOLTIP','dd_global_karmacracy_option_tooltip');
define('DD_GLOBAL_KARMACRACY_OPTION_CADS','dd_global_karmacracy_option_cadsid');


global $ddGlobalConfig;
$ddGlobalConfig = array(
DD_GLOBAL_TWITTER_OPTION => array(
Expand All @@ -174,7 +179,11 @@
),
DD_GLOBAL_FLATTR_OPTION => array(
DD_GLOBAL_FLATTR_OPTION_UID => DD_EMPTY_VALUE
)
),
DD_GLOBAL_KARMACRACY_OPTION => array(
DD_GLOBAL_KARMACRACY_OPTION_TOOLTIP =>DD_CHECK_BOX_ON,
DD_GLOBAL_KARMACRACY_OPTION_CADS =>DD_EMPTY_VALUE
),
);
/*******
* Digg Digg Global Display (End)
Expand Down Expand Up @@ -233,7 +242,8 @@
DD_BUTTON_GOOGLE1 => new DD_Google1(),
DD_BUTTON_BUFFER => new DD_Buffer(),
DD_BUTTON_PINTEREST => new DD_Pinterest(),
DD_BUTTON_FLATTR => new DD_Flattr()
DD_BUTTON_FLATTR => new DD_Flattr(),
DD_BUTTON_KARMACRACY=>new DD_Karmacracy()
),
DD_NORMAL_BUTTON_FINAL => array()
);
Expand Down Expand Up @@ -327,7 +337,8 @@
DD_BUTTON_GOOGLE1 => new DD_Google1(),
DD_BUTTON_BUFFER => new DD_Buffer(),
DD_BUTTON_PINTEREST => new DD_Pinterest(),
DD_BUTTON_FLATTR => new DD_Flattr()
DD_BUTTON_FLATTR => new DD_Flattr(),
DD_BUTTON_KARMACRACY => new DD_Karmacracy()
),
DD_FLOAT_BUTTON_FINAL => array()
);
Expand Down
32 changes: 30 additions & 2 deletions digg-digg/include/template/dd-template-global.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,38 @@ function dd_print_global_form($ddGlobalConfig){
</div>
</div>
<!-- End Topsy Config -->

<div class="stuffbox">
<h3><label for="link_name">7. Karmacracy configuration</label></h3>
<div class="inside">
<table class="form-table">
<tr valign="top">
<th scope="row">7.1 Show community tooltip</th>
<td>
<INPUT TYPE=CHECKBOX NAME="<?php echo DD_GLOBAL_KARMACRACY_OPTION_TOOLTIP?>"
<?php echo ($ddGlobalConfig[DD_GLOBAL_KARMACRACY_OPTION][DD_GLOBAL_KARMACRACY_OPTION_TOOLTIP]==DD_DISPLAY_ON) ? DD_CHECK_BOX_ON : DD_CHECK_BOX_OFF ?>>
</td>
</tr>

<tr valign="top">
<th scope="row">7.2 cAds certificate media ID</th>
<td>
<input type="text" value="<?php echo $ddGlobalConfig[DD_GLOBAL_KARMACRACY_OPTION][DD_GLOBAL_KARMACRACY_OPTION_CADS]; ?>" name="<?php echo DD_GLOBAL_KARMACRACY_OPTION_CADS;?>" />
<p>Enter your cAds media id if you are a <a href="http://cads.me" target="_blank">cAds certificate site</a>. </p>
</td>
</tr>
</table>

<div class="submit">
<input class="button-primary" name="<?php echo DD_FORM_SAVE; ?>" value="Save changes" type="submit" style="width:100px;" />
</div>
</div>
</div>
<!-- End Topsy Config -->


<div class="stuffbox">
<h3><label for="link_name">7. Reset Global Configuration Settings</label></h3>
<h3><label for="link_name">8. Reset Global Configuration Settings</label></h3>
<div class="inside">
<br />
<p>Reset all "Global Configuration" settings to their default values.</p>
Expand All @@ -272,7 +300,7 @@ function dd_print_global_form($ddGlobalConfig){

<?php // XXX: This seems pretty drastic... I doubt many people do this one! ?>
<div class="stuffbox">
<h3><label for="link_name">8. Reset Everything</label></h3>
<h3><label for="link_name">9. Reset Everything</label></h3>
<div class="inside">
<br />
<p>Reset all settings (everything) to their default values.</p>
Expand Down