Skip to content
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

add managewp.org button #36

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
50 changes: 49 additions & 1 deletion digg-digg/include/dd-class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2308,6 +2308,54 @@ public function constructLazyLoadURL($url, $title,$button, $postId){
}
}

/******************************************************************************************
*
* https://managewp.org
*
*/
class DD_ManageWP extends BaseDD {
var $name = "ManageWP.org";
var $websiteURL = "https://managewp.org";
var $apiURL = "http://managewp.org/resources";

var $baseURL = '<script type="text/javascript" src="//managewp.org/share.js" data-url="VOTE_URL" data-type="VOTE_BUTTON_DESIGN" data-title="VOTE_TITLE"></script>'; // vote button URL, before construt

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

var $float_button_design = self::DEFAULT_BUTTON_DESIGN;

var $buttonLayout = array(
"Normal" => "big",
"Compact" => "small"
);

// Default options
var $append_type = 'left_float';
var $button_design = self::DEFAULT_BUTTON_DESIGN;
var $ajax_left_float = 'on';
var $lazy_load = false;

var $button_weight_value = self::DEFAULT_BUTTON_WEIGHT;

const OPTION_APPEND_TYPE = "dd_managewp_appendType";
const OPTION_BUTTON_DESIGN = "dd_managewp_buttonDesign";
const OPTION_BUTTON_WEIGHT = "dd_managewp_button_weight";
const OPTION_AJAX_LEFT_FLOAT = "dd_managewp_ajax_left_float";
const OPTION_LAZY_LOAD = "dd_managewp_lazy_load";

public function DD_ManageWP()
{
$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($this->name, $this->websiteURL, $this->apiURL, $this->baseURL);
}

}

?>
11 changes: 8 additions & 3 deletions digg-digg/include/dd-global-variable.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
define('DD_BUTTON_FLATTR','dd_button_flattr');
define('DD_BUTTON_POCKET', 'dd_button_pocket');
define('DD_BUTTON_TUMBLR', 'dd_button_tumblr');
define('DD_BUTTON_MANAGEWP', 'dd_button_managewp');

/****************************************
* Digg Digg Global Display (Start)
Expand Down Expand Up @@ -150,6 +151,9 @@
define('DD_GLOBAL_FLATTR_OPTION','dd_global_flattr_option');
define('DD_GLOBAL_FLATTR_OPTION_UID','dd_global_flattr_option_uid');

define('DD_GLOBAL_MANAGEWP_OPTION', 'dd_global_managewp_option');
define('DD_GLOBAL_MANAGEWP_OPTION_SOURCE', 'dd_global_managewp_option_source');

global $ddGlobalConfig;
$ddGlobalConfig = array(
DD_GLOBAL_TWITTER_OPTION => array(
Expand Down Expand Up @@ -237,7 +241,8 @@
DD_BUTTON_PINTEREST => new DD_Pinterest(),
DD_BUTTON_FLATTR => new DD_Flattr(),
DD_BUTTON_POCKET => new DD_Pocket(),
DD_BUTTON_TUMBLR => new DD_Tumblr()
DD_BUTTON_TUMBLR => new DD_Tumblr(),
DD_BUTTON_MANAGEWP => new DD_ManageWP(),
),
DD_NORMAL_BUTTON_FINAL => array()
);
Expand Down Expand Up @@ -337,12 +342,12 @@
DD_BUTTON_PINTEREST => new DD_Pinterest(),
DD_BUTTON_FLATTR => new DD_Flattr(),
DD_BUTTON_POCKET => new DD_Pocket(),
DD_BUTTON_TUMBLR => new DD_Tumblr()
DD_BUTTON_TUMBLR => new DD_Tumblr(),
DD_BUTTON_MANAGEWP => new DD_ManageWP(),
),
DD_FLOAT_BUTTON_FINAL => array()
);

/*******
* Digg Digg Floating Display (End)
****************************************/
?>
14 changes: 13 additions & 1 deletion digg-digg/include/dd-manual.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"Compact" => "dd_buffer_generate('Compact')",
"No Count" => "dd_buffer_generate('No Count')"
),
"ManageWP.org" => array(
"Normal" => "dd_managewp_generate('Normal')",
"Compact" => "dd_managewp_generate('Compact')",
),
"FaceBook Like" => array(
"Like Standard" => "dd_fblike_generate('Like Standard')",
"Like Button Count" => "dd_fblike_generate('Like Button Count')",
Expand Down Expand Up @@ -376,6 +380,15 @@ function dd_tumblr_generate($buttonDesign='Normal'){
echo $dd_tumblr->finalURL;
}

function dd_managewp_generate($buttonDesign='Normal'){
$post_data = dd_getPostData();

$dd_managewp = new DD_ManageWP();
$dd_managewp->constructURL($post_data['link'],$post_data['title'],$buttonDesign,$post_data['id'],false);

echo $dd_managewp->finalURL;
}

function dd_getPostData() {
global $wp_query;
$post = $wp_query->post; //get post content
Expand All @@ -386,4 +399,3 @@ function dd_getPostData() {

return array( 'id' => $id, 'link' => $link[0], 'title' => $title );
}
?>