Changeset 1344313
- Timestamp:
- 02/05/2016 09:53:34 PM (10 years ago)
- Location:
- click-tweet
- Files:
-
- 17 added
- 1 deleted
- 3 edited
-
tags/0.6.3 (added)
-
tags/0.6.3/assets (added)
-
tags/0.6.3/assets/css (added)
-
tags/0.6.3/assets/css/click-and-tweet-editor.css (added)
-
tags/0.6.3/assets/css/click-and-tweet.css (added)
-
tags/0.6.3/assets/img (added)
-
tags/0.6.3/assets/img/twitter-logo-white.png (added)
-
tags/0.6.3/assets/img/twitter-logo.png (added)
-
tags/0.6.3/assets/js (added)
-
tags/0.6.3/assets/js/click-and-tweet-admin.js (added)
-
tags/0.6.3/assets/js/click-and-tweet-tinymce-plugin.js (added)
-
tags/0.6.3/assets/js/click-and-tweet.js (added)
-
tags/0.6.3/assets/js/tinymce (added)
-
tags/0.6.3/assets/js/tinymce/noneditable.js (added)
-
tags/0.6.3/click-and-tweet.php (added)
-
tags/0.6.3/license.txt (added)
-
tags/0.6.3/readme.txt (added)
-
trunk/assets/js/click-and-tweet-admin.js (modified) (2 diffs)
-
trunk/click-and-tweet.php (modified) (7 diffs)
-
trunk/languages (deleted)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
click-tweet/trunk/assets/js/click-and-tweet-admin.js
r1338428 r1344313 8 8 }); 9 9 10 $('[name="click_and_tweet_settings[url_shorteners]"]').on('change', function(){ 11 if ($(this).val() == "bitly") { 12 $('.bitly-shortener').show(); 13 } else { 14 $('.bitly-shortener').hide(); 15 } 16 }); 17 10 18 var myOptions = { 11 19 defaultColor: false, … … 13 21 palettes: ['#55acee','','','',''] 14 22 }; 15 23 16 24 $('.tweet-color-field').wpColorPicker(myOptions); 17 25 -
click-tweet/trunk/click-and-tweet.php
r1338428 r1344313 4 4 * Plugin URI: http://spacestud.io 5 5 * Description: Quote text in your WordPress posts for easy sharing on twitter. 6 * Version: 0. 6.36 * Version: 0.8 7 7 * Author: Space Studio 8 8 * Author URI: http://spacestud.io … … 57 57 * @var string 58 58 */ 59 protected $version = '0. 6.3';59 protected $version = '0.8'; 60 60 61 61 /** … … 103 103 'none' => 'None', 104 104 'wp' => 'WordPress', 105 'google' => 'Google' 105 'google' => 'Google', 106 'bitly' => 'Bitly' 106 107 ]; 107 108 … … 435 436 ); 436 437 438 add_settings_field( 439 $id = 'bitly_access_code', 440 $title = '', 441 $callback = array($this, 'callbackBitlyShortenerField'), 442 $page = 'click_and_tweet_settings', 443 $section = 'url_shortener_section', 444 $args = ['class' => (isset($this->settings['url_shorteners']) && $this->settings['url_shorteners'] == 'bitly') ? 'bitly-shortener' : 'bitly-shortener hidden'] 445 ); 437 446 438 447 add_settings_section( … … 586 595 } 587 596 597 /** 598 * callback function for the bitly shortener field. 599 */ 600 public function callbackBitlyShortenerField() 601 { 602 $setting = isset($this->settings['bitly_access_code']) ? ($this->settings['bitly_access_code']) : ''; 603 $html = "<p><strong>Access Token</strong></p>"; 604 $html .= "<input type='text' name='click_and_tweet_settings[bitly_access_code]' value='$setting' class='regular-text' placeholder='Bitly Access Token'/>"; 605 $html .= '<p class="description"><a href=\https://space-studio.gitbooks.io/click-tweet-plugin/content/PLUGINSETTINGS.html\>Read Documentation</a></p>'; 606 echo $html; 607 } 588 608 /** 589 609 * sanitizes the setting for the twitter handle and adds '@' to the beginning. … … 729 749 730 750 return $url = $this->getGoogleShortUrl(); 751 } 752 if($this->settings['url_shorteners'] == 'bitly') { 753 754 return $url = $this->getBitlyShortUrl(); 731 755 } 732 756 } … … 901 925 902 926 /** 927 * shortens the url using bitly 928 * @return $bitlyShortUrl 929 */ 930 public function getBitlyShortUrl() 931 { 932 global $post; 933 934 if (!$accessToken = $this->settings['bitly_access_code']) { 935 return $bitlyShortUrl = get_permalink(); 936 } 937 938 $url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$accessToken.'&longUrl='.get_permalink(); 939 $bitlyShortUrl = get_permalink(); 940 941 if(! $bitlyShortUrl = get_post_meta($post->ID, 'click_and_tweet_bitly_url', true)) { 942 943 $response = wp_remote_post( $url, array( 944 'method' => 'GET', 945 'headers' => array('content-type' => 'application/json'), 946 'body' => json_encode(array('longUrl' => get_permalink())) 947 )); 948 949 $urlBody = json_decode(($response['body']), true); 950 $urlData = $urlBody['data']; 951 952 if(in_array('url', $urlData)) { 953 $bitlyShortUrl = $urlData['url']; 954 add_post_meta($post->ID, 'click_and_tweet_bitly_url', $bitlyShortUrl); 955 } 956 957 } 958 959 return $bitlyShortUrl; 960 } 961 962 /** 903 963 * Checks to see if the post was updated to get new permalink. 904 964 */ -
click-tweet/trunk/readme.txt
r1338428 r1344313 47 47 48 48 == Changelog == 49 = 0.8 = 50 * Added bitly integration. 51 49 52 = 0.6.3 = 50 53 * Styling enhancements.
Note: See TracChangeset
for help on using the changeset viewer.