From b8523621a698d8fa7cadbafd5842581b56cba961 Mon Sep 17 00:00:00 2001 From: Milos Colakovic Date: Tue, 26 Nov 2013 12:07:54 +0100 Subject: [PATCH] add managewp.org button --- digg-digg/include/dd-class.php | 50 +++++++++++++++++++++++- digg-digg/include/dd-global-variable.php | 11 ++++-- digg-digg/include/dd-manual.php | 14 ++++++- 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/digg-digg/include/dd-class.php b/digg-digg/include/dd-class.php index 6773bc5..4ec993a 100644 --- a/digg-digg/include/dd-class.php +++ b/digg-digg/include/dd-class.php @@ -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 = ''; // 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); + } + +} -?> diff --git a/digg-digg/include/dd-global-variable.php b/digg-digg/include/dd-global-variable.php index 9dddd9e..e2babba 100644 --- a/digg-digg/include/dd-global-variable.php +++ b/digg-digg/include/dd-global-variable.php @@ -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) @@ -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( @@ -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() ); @@ -337,7 +342,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_FLOAT_BUTTON_FINAL => array() ); @@ -345,4 +351,3 @@ /******* * Digg Digg Floating Display (End) ****************************************/ -?> \ No newline at end of file diff --git a/digg-digg/include/dd-manual.php b/digg-digg/include/dd-manual.php index 0f0c1fc..fe87ec8 100644 --- a/digg-digg/include/dd-manual.php +++ b/digg-digg/include/dd-manual.php @@ -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')", @@ -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 @@ -386,4 +399,3 @@ function dd_getPostData() { return array( 'id' => $id, 'link' => $link[0], 'title' => $title ); } -?> \ No newline at end of file