diff --git a/README.md b/README.md index bf6d716..036500d 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ * Contributors: UkaThemes * Tags: share buttons, wordpress * Requires at least: 4.7 -* Tested up to: 5.3 -* Stable tag: 1.0.1 +* Tested up to: 5.5 +* Stable tag: 1.1.0 * License: GPLv2 or later * License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -28,8 +28,11 @@ There is 1 function available to use: 'uka_share_buttons' returns html of share ## Changelog ## -**1.0.1 - March 08 2020** +**1.1.0 - December 09, 2020** +* Added social share URLs. + +**1.0.1 - March 08, 2020** * Some small fixes. -**1.0.0 - March 07 2020** +**1.0.0 - March 07, 2020** * Initial release. diff --git a/README.txt b/README.txt index 3372d84..2d904cc 100644 --- a/README.txt +++ b/README.txt @@ -2,8 +2,8 @@ Contributors: UkaThemes Tags: share buttons, wordpress Requires at least: 4.7 -Tested up to: 5.3 -Stable tag: 1.0.1 +Tested up to: 5.5 +Stable tag: 1.1.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -28,8 +28,11 @@ There is 1 function available to use: 'uka_share_buttons' returns html of share == Changelog == -= 1.0.1 - March 08 2020 = += 1.1.0 - December 09, 2020 = +* Added social share URLs. + += 1.0.1 - March 08, 2020 = * Some small fixes. -= 1.0.0 - March 07 2020 = += 1.0.0 - March 07, 2020 = * Initial release. diff --git a/admin/class-uka-share-buttons-admin.php b/admin/class-uka-share-buttons-admin.php index 95160ab..14fde54 100644 --- a/admin/class-uka-share-buttons-admin.php +++ b/admin/class-uka-share-buttons-admin.php @@ -2,7 +2,7 @@ /** * The admin-specific functionality of the plugin. * - * @since 1.0.0 + * @since 1.1.0 * * @package Uka_Share_Buttons * @subpackage Uka_Share_Buttons/admin @@ -46,24 +46,24 @@ public function register_settings() { ); add_settings_field( - 'social_services', - esc_html__( 'Social Services', 'uka-share-buttons' ), - array( $this, 'social_services_field'), + 'share_text', + esc_html__( 'Share Text', 'uka-share-buttons' ), + array( $this, 'share_text_field'), 'share-buttons', 'main_settings', array( - 'label_for' => 'social_services', + 'label_for' => 'share_text', ) ); add_settings_field( - 'share_text', - esc_html__( 'Share Text', 'uka-share-buttons' ), - array( $this, 'share_text_field'), + 'social_services', + esc_html__( 'Social Services', 'uka-share-buttons' ), + array( $this, 'social_services_field'), 'share-buttons', 'main_settings', array( - 'label_for' => 'share_text', + 'label_for' => 'social_services', ) ); @@ -72,10 +72,11 @@ public function register_settings() { /** * Sanitize_options for settings page. * - * @since 1.0.0 + * @since 1.1.0 */ public function sanitize_options( $input ) { + $input[ 'share_text' ] = sanitize_text_field( $input[ 'share_text' ] ); $input[ 'facebook' ] = sanitize_text_field( $input[ 'facebook' ] ); $input[ 'twitter' ] = sanitize_text_field( $input[ 'twitter' ] ); $input[ 'reddit' ] = sanitize_text_field( $input[ 'reddit' ] ); @@ -83,7 +84,16 @@ public function sanitize_options( $input ) { $input[ 'pinterest' ] = sanitize_text_field( $input[ 'pinterest' ] ); $input[ 'telegram' ] = sanitize_text_field( $input[ 'telegram' ] ); $input[ 'vk' ] = sanitize_text_field( $input[ 'vk' ] ); - $input[ 'share_text' ] = sanitize_text_field( $input[ 'share_text' ] ); + $input[ 'whatsapp' ] = sanitize_text_field( $input[ 'whatsapp' ] ); + $input[ 'skype' ] = sanitize_text_field( $input[ 'skype' ] ); + $input[ 'google' ] = sanitize_text_field( $input[ 'google' ] ); + $input[ 'pocket' ] = sanitize_text_field( $input[ 'pocket' ] ); + $input[ 'ok' ] = sanitize_text_field( $input[ 'ok' ] ); + $input[ 'evernote' ] = sanitize_text_field( $input[ 'evernote' ] ); + $input[ 'tumblr' ] = sanitize_text_field( $input[ 'tumblr' ] ); + $input[ 'blogger' ] = sanitize_text_field( $input[ 'blogger' ] ); + $input[ 'livejournal' ] = sanitize_text_field( $input[ 'livejournal' ] ); + $input[ 'email' ] = sanitize_text_field( $input[ 'email' ] ); return $input; @@ -92,19 +102,29 @@ public function sanitize_options( $input ) { /** * Output the social services settings field. * - * @since 1.0.0 + * @since 1.1.0 */ public function social_services_field() { $options = get_option( 'uka_share_buttons_options' ); - $facebook = $options[ 'services-settings' ][ 'facebook' ]; - $twitter = $options[ 'services-settings' ][ 'twitter' ]; - $reddit = $options[ 'services-settings' ][ 'reddit' ]; - $linkedin = $options[ 'services-settings' ][ 'linkedin' ]; - $pinterest = $options[ 'services-settings' ][ 'pinterest' ]; - $telegram = $options[ 'services-settings' ][ 'telegram' ]; - $vk = $options[ 'services-settings' ][ 'vk' ]; + $facebook = $options[ 'services-settings' ][ 'facebook' ]; + $twitter = $options[ 'services-settings' ][ 'twitter' ]; + $reddit = $options[ 'services-settings' ][ 'reddit' ]; + $linkedin = $options[ 'services-settings' ][ 'linkedin' ]; + $pinterest = $options[ 'services-settings' ][ 'pinterest' ]; + $telegram = $options[ 'services-settings' ][ 'telegram' ]; + $vk = $options[ 'services-settings' ][ 'vk' ]; + $whatsapp = $options[ 'services-settings' ][ 'whatsapp' ]; + $skype = $options[ 'services-settings' ][ 'skype' ]; + $google = $options[ 'services-settings' ][ 'google' ]; + $pocket = $options[ 'services-settings' ][ 'pocket' ]; + $ok = $options[ 'services-settings' ][ 'ok' ]; + $evernote = $options[ 'services-settings' ][ 'evernote' ]; + $tumblr = $options[ 'services-settings' ][ 'tumblr' ]; + $blogger = $options[ 'services-settings' ][ 'blogger' ]; + $livejournal = $options[ 'services-settings' ][ 'livejournal' ]; + $email = $options[ 'services-settings' ][ 'email' ]; $html = '
'; $html .= sprintf( '%1$s', esc_html__( 'Share Buttons Settings', 'uka-share-buttons' ) ); @@ -151,8 +171,68 @@ public function social_services_field() { $html .= sprintf( '%1$s', esc_html__( 'VK', 'uka-share-buttons' ) ); $html .= '
'; + $html .= '', esc_html__( 'WhatsApp', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Skype', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Google Bookmarks', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Pocket', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Odnoklassniki', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Evernote', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Tumblr', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Blogger', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'LiveJournal', 'uka-share-buttons' ) ); + $html .= '
'; + + $html .= '', esc_html__( 'Email', 'uka-share-buttons' ) ); + $html .= '
'; + $html .= '
'; - + echo $html; } diff --git a/includes/class-uka-share-buttons-activator.php b/includes/class-uka-share-buttons-activator.php index 6fb3df3..0b6bdc0 100644 --- a/includes/class-uka-share-buttons-activator.php +++ b/includes/class-uka-share-buttons-activator.php @@ -2,7 +2,7 @@ /** * Fired during plugin activation. * - * @since 1.0.0 + * @since 1.1.0 * * @package Uka_Share_Buttons * @subpackage Uka_Share_Buttons/includes @@ -13,13 +13,13 @@ class Uka_Share_Buttons_Activator { /** * Compare WordPress version and set up the default option values. * - * @since 1.0.0 + * @since 1.1.0 */ public static function activate() { // Compare WordPress version global $wp_version; - + if ( version_compare( $wp_version, '4.7', '<' ) ) { wp_die( sprintf( esc_html__( 'This plugin requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'uka-share-buttons' ), $wp_version ) ); } @@ -27,13 +27,23 @@ public static function activate() { // Set default plugin parameters $default_options = array( 'services-settings' => array( - 'facebook' => 'on', - 'twitter' => 'on', - 'reddit' => 'off', - 'linkedin' => 'off', - 'pinterest' => 'off', - 'telegram' => 'on', - 'vk' => 'off', + 'facebook' => 'on', + 'twitter' => 'on', + 'reddit' => 'off', + 'linkedin' => 'off', + 'pinterest' => 'off', + 'telegram' => 'on', + 'vk' => 'off', + 'whatsapp' => 'off', + 'skype' => 'off', + 'google' => 'off', + 'pocket' => 'off', + 'ok' => 'off', + 'evernote' => 'off', + 'tumblr' => 'off', + 'blogger' => 'off', + 'livejournal' => 'off', + 'email' => 'off', ), 'share-text' => esc_html__( 'Share:', 'uka-share-buttons' ), ); diff --git a/includes/class-uka-share-buttons.php b/includes/class-uka-share-buttons.php index 230a752..13789df 100644 --- a/includes/class-uka-share-buttons.php +++ b/includes/class-uka-share-buttons.php @@ -5,7 +5,7 @@ * A class definition that includes attributes and functions used across both the * public-facing side of the site and the admin area. * - * @since 1.0.0 + * @since 1.1.0 * * @package Uka_Share_Buttons * @subpackage Uka_Share_Buttons/includes @@ -64,7 +64,7 @@ public function __construct() { if ( defined( 'UKA_SHARE_BUTTONS_VERSION' ) ) { $this->version = UKA_SHARE_BUTTONS_VERSION; } else { - $this->version = '1.0.0'; + $this->version = '1.1.0'; } $this->plugin_name = 'uka-share-buttons'; @@ -127,7 +127,7 @@ private function load_dependencies() { * %2$s - title * %3$s - image * - * @since 1.0.0 + * @since 1.1.0 * @return string Supported services. */ public static function get_services() { @@ -151,12 +151,12 @@ public static function get_services() { 'linkedin' => array( 'id' => 'linkedin', 'title' => esc_html__( 'LinkedIn' ), - 'url' => 'https://www.linkedin.com/shareArticle?mini=true&url=%1$s&title=%2$s', + 'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=%1$s', ), 'pinterest' => array( 'id' => 'pinterest', 'title' => esc_html__( 'Pinterest' ), - 'url' => 'https://www.pinterest.com/pin/create/button/?url=%1$s', + 'url' => 'http://pinterest.com/pin/create/button/?url=%1$s', ), 'telegram' => array( 'id' => 'telegram', @@ -168,6 +168,56 @@ public static function get_services() { 'title' => esc_html__( 'VK' ), 'url' => 'http://vk.com/share.php?url=%1$s&title=%2$s', ), + 'whatsapp' => array( + 'id' => 'whatsapp', + 'title' => esc_html__( 'WhatsApp' ), + 'url' => 'https://api.whatsapp.com/send?text=%2$s %1$s', + ), + 'skype' => array( + 'id' => 'skype', + 'title' => esc_html__( 'Skype' ), + 'url' => 'https://web.skype.com/share?url=%1$s&text=%2$s', + ), + 'google' => array( + 'id' => 'google', + 'title' => esc_html__( 'Google Bookmarks' ), + 'url' => 'https://www.google.com/bookmarks/mark?op=edit&bkmk=%1$s&title=%2$s', + ), + 'pocket' => array( + 'id' => 'pocket', + 'title' => esc_html__( 'Pocket' ), + 'url' => 'https://getpocket.com/edit?url=%1$s', + ), + 'ok' => array( + 'id' => 'ok', + 'title' => esc_html__( 'Odnoklassniki' ), + 'url' => 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl=%1$s', + ), + 'evernote' => array( + 'id' => 'evernote', + 'title' => esc_html__( 'Evernote' ), + 'url' => 'https://www.evernote.com/clip.action?url=%1$s&title=%2$s', + ), + 'tumblr' => array( + 'id' => 'tumblr', + 'title' => esc_html__( 'Tumblr' ), + 'url' => 'https://www.tumblr.com/widgets/share/tool?canonicalUrl=%1$s&title=%2$s', + ), + 'blogger' => array( + 'id' => 'blogger', + 'title' => esc_html__( 'Blogger' ), + 'url' => 'https://www.blogger.com/blog-this.g?u=%1$s&n=%2$s', + ), + 'livejournal' => array( + 'id' => 'livejournal', + 'title' => esc_html__( 'LiveJournal' ), + 'url' => 'http://www.livejournal.com/update.bml?subject=%2$s&event=%1$s', + ), + 'email' => array( + 'id' => 'email', + 'title' => esc_html__( 'Email' ), + 'url' => 'mailto:?subject=%2$s&body=%1$s', + ), ); return $services; diff --git a/languages/uka-share-buttons.pot b/languages/uka-share-buttons.pot index 1c129a0..b9fe8d4 100644 --- a/languages/uka-share-buttons.pot +++ b/languages/uka-share-buttons.pot @@ -20,25 +20,53 @@ msgstr "" msgid "Adds Share Buttons for posts and pages." msgstr "" -#: admin/class-uka-share-buttons-admin.php:115 +#: admin/class-uka-share-buttons-admin.php:219 +msgid "Blogger" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:231 +msgid "Email" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:207 +msgid "Evernote" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:135 #: includes/class-uka-share-buttons.php:138 msgid "Facebook" msgstr "" +#: admin/class-uka-share-buttons-admin.php:189 +msgid "Google Bookmarks" +msgstr "" + #. URI of the plugin #. Author URI of the plugin msgid "https://ukathemes.com/" msgstr "" -#: admin/class-uka-share-buttons-admin.php:133 +#: admin/class-uka-share-buttons-admin.php:153 msgid "Linkedin" msgstr "" -#: admin/class-uka-share-buttons-admin.php:139 +#: admin/class-uka-share-buttons-admin.php:225 +msgid "LiveJournal" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:201 +msgid "Odnoklassniki" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:159 msgid "Pinterest" msgstr "" -#: admin/class-uka-share-buttons-admin.php:127 +#: admin/class-uka-share-buttons-admin.php:195 +msgid "Pocket" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:147 msgid "Reddit" msgstr "" @@ -51,24 +79,28 @@ msgid "Share Buttons" msgstr "" #: admin/class-uka-share-buttons-admin.php:21 -#: admin/class-uka-share-buttons-admin.php:110 -#: admin/class-uka-share-buttons-admin.php:183 +#: admin/class-uka-share-buttons-admin.php:130 +#: admin/class-uka-share-buttons-admin.php:263 msgid "Share Buttons Settings" msgstr "" -#: admin/class-uka-share-buttons-admin.php:61 +#: admin/class-uka-share-buttons-admin.php:50 msgid "Share Text" msgstr "" -#: includes/class-uka-share-buttons-activator.php:38 +#: includes/class-uka-share-buttons-activator.php:48 msgid "Share:" msgstr "" -#: admin/class-uka-share-buttons-admin.php:50 +#: admin/class-uka-share-buttons-admin.php:183 +msgid "Skype" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:61 msgid "Social Services" msgstr "" -#: admin/class-uka-share-buttons-admin.php:145 +#: admin/class-uka-share-buttons-admin.php:165 msgid "Telegram" msgstr "" @@ -79,7 +111,11 @@ msgid "" "%s. Please upgrade and try again." msgstr "" -#: admin/class-uka-share-buttons-admin.php:121 +#: admin/class-uka-share-buttons-admin.php:213 +msgid "Tumblr" +msgstr "" + +#: admin/class-uka-share-buttons-admin.php:141 msgid "Twitter" msgstr "" @@ -91,6 +127,10 @@ msgstr "" msgid "UkaThemes" msgstr "" -#: admin/class-uka-share-buttons-admin.php:151 +#: admin/class-uka-share-buttons-admin.php:171 msgid "VK" msgstr "" + +#: admin/class-uka-share-buttons-admin.php:177 +msgid "WhatsApp" +msgstr "" diff --git a/public/js/uka-share-buttons-public.js b/public/js/uka-share-buttons-public.js index f090b66..c981479 100644 --- a/public/js/uka-share-buttons-public.js +++ b/public/js/uka-share-buttons-public.js @@ -2,10 +2,14 @@ 'use strict'; $( ".uka-share-button" ).on( 'click.uka-share-buttons', function() { + if ( $( this ).hasClass( 'uka-share-button--email' ) ) { + return; + } + var window_size = "width=585, height=511"; var url = this.href; var domain = url.split("/")[2]; - + switch( domain ) { case "twitter.com": window_size = "width=585, height=261"; @@ -17,7 +21,7 @@ window_size = "width=570, height=494"; break; } - + window.open( url, '', 'menubar=no, toolbar=no, resizable=yes, scrollbars=yes,' + window_size ); return false; } ); diff --git a/uka-share-buttons.php b/uka-share-buttons.php index 08543cf..7f8f983 100644 --- a/uka-share-buttons.php +++ b/uka-share-buttons.php @@ -3,7 +3,7 @@ * Plugin Name: Uka Share Buttons * Plugin URI: https://ukathemes.com/ * Description: Adds Share Buttons for posts and pages. - * Version: 1.0.1 + * Version: 1.1.0 * Author: UkaThemes * Author URI: https://ukathemes.com/ * License: GPL-2.0+ @@ -11,7 +11,7 @@ * Text Domain: uka-share-buttons * Domain Path: /languages * - * @since 1.0.0 + * @since 1.1.0 * @package Uka_Share_Buttons */ @@ -23,7 +23,7 @@ /** * Currently plugin version. */ -define( 'UKA_SHARE_BUTTONS_VERSION', '1.0.1' ); +define( 'UKA_SHARE_BUTTONS_VERSION', '1.1.0' ); /** * The code that runs during plugin activation.