Changeset 2459994
- Timestamp:
- 01/20/2021 09:34:07 PM (5 years ago)
- Location:
- wp-bitly/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
admin/class-wp-bitly-admin.php (modified) (3 diffs)
-
includes/class-wp-bitly-auth.php (modified) (2 diffs)
-
includes/class-wp-bitly-deactivator.php (modified) (1 diff)
-
uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-bitly/trunk/README.txt
r2459172 r2459994 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Use Bitly generated shortlinks for all your WordPress posts and pages, including custom post types.11 Create short links to your content with Bitly’s WordPress Plugin. 12 12 13 13 == Description == 14 14 15 Love WordPress? Love Bitly? What if you could access an interface between both? Now, you can. WP-bitly allows WordPress users to quickly and easily generate shortlinks for any page, post or custom post type.15 Love WordPress? Love Bitly? After installing this plugin, you’ll be able to shorten a link and view clicks right from WordPress. Your new links will be saved to Bitly for reference and deeper analysis. 16 16 17 What's more, these shortlinks may also be embedded using a php function or a WordPress shortcode. No matter the type of site you own (from a personal blog to an ecommerce store and everything in between) WP-bitly makes it easy to share your links as and when you please. 17 *To do that, you must have a Bitly account to use the plugin. Your account is where you store, edit, and view metrics for your links. Register at bitly.com.* 18 18 19 Getting started is easy as pie. Simply install the plugin, visit the settings page, and authorize with your Bitly account. Pick the post types you want shortlinks generated for, and voila! You're ready to start sharing posts with speed and ease. 20 21 After all, texting a shortlink is far simpler and quicker than texting the full URL. 22 23 **PS:** *WP Bitly also offers insights into the way in which your links do the rounds. Who's clicking? Who's sharing? With WP-bitly, you'll always know.* 24 19 No matter the type of site you own (from a personal blog to an ecommerce store and everything in between) Bitly makes it easy to create shorter links and keep an eye on your clicks. Whether you share your links on social, SMS, or email, a short link is easier to manage and remember. 25 20 26 21 == Installation == 27 Note: you must have a Bitly account in order to use this plugin. Any level of account will work. 28 * Either install automatically through the WordPress admin, or download the .zip file, unzip to a folder, and upload the folder to your /wp-content/plugins/ directory. Read Installing Plugins in the WordPress Codex for details. 29 * Activate the plugin through the Plugins menu in WordPress. 22 # Installing the plugin 30 23 31 Settings for this plugin are found on the Settings->Writing page. You can also access this page directly via the Settings link under this plugin on the Plugins page. 24 You must have a Bitly account to connect to. You can create one at bitly.com. Your account is where you store, edit, and view metrics for your links. 25 If you're familiar with adding a plugin to WordPress directly, you can download the ZIP file and upload it to /wp-content/plugins/ after step 2. Otherwise, follow these steps: 26 1. Go to your WordPress plugins settings. 27 2. Click Add New. 28 3. Search for Bitly's WordPress Plugin. 29 4. Click Install Now. 30 5. Click Activate. 31 6. Scroll down the list of your installed plugins, find 32 Bitly, and click Settings. 33 7. Now you'll connect the plugin to your Bitly account. Scroll down to Bitly's WordPress Plugin and click Authorize. 34 8. Sign in to Bitly, if necessary, and click Allow. The plugin will retrieve an authorization from Bitly and update the Bitly OAuth Token field. 35 9. Scroll down and click Save Changes. 36 10. Select which types of entries you'll be creating short links for. 37 11. If your Bitly account has more than one group, select a group. This is the group where your short links will be saved in Bitly. 38 12. If your Bitly account has more than one custom domain, select a domain. This is the domain that will be used for your short links. 39 13. Click Save Changes. 32 40 33 To begin using this plugin, you must first obtain an Authorization Token. 34 To do so, in a separate browser tab login to the Bitly account to which you would like to connect. 35 Back on the WordPress Writing Settings page, simply click the large Authorize button next 36 to "Connect with Bitly". If that works successfully the "Bitly OAuth Token" field will be populated with an Authorization Token string. Save these settings. 41 Now you can shorten links when you create a new post! 37 42 38 Once you have an Authorization Token in place, you can proceed with the related configuration settings. 39 * **Post Types:** Check which available post types will automatically have shortlinks created automatically upon creation. 40 * **Default Group:** This select box will allow users with [Enterprise] (https://bitly.com/pages/pricing) level accounts to choose which Group the shortlinks will be associated with. Other account levels will just see their default Group listed. 41 * **Default Domain:** This select box will allow users with [Basic or Enterprise] (https://bitly.com/pages/pricing) level accounts to choose the shortlink domain that will be used for link creation. By default (and the only option for Free users) this is bit.ly. 42 * **Debug WP Bitly:** Checking this will create a debug log in /wp-content/plugins/wp-bitly/log/debug.txt. 43 # Creating a short link 43 44 45 After publishing a page or post, you’ll see the Bitly's Wordpress Plugin option in the settings. Click Get Shortlink to create a link to the current content. The link will be saved in your Bitly account, and you’ll be able to view the number of clicks it receives right from this setting. 46 47 # Viewing a link’s click data 48 49 Click metrics for a short link will appear in the post’s or page’s settings. They include the number of clicks today, the total number clicks over time, and a graph of the number of clicks over the last 7 days.0 44 50 45 51 == Frequently Asked Questions == … … 47 53 = After installation, do I need to update all my posts for short links to be created? = 48 54 49 No. The first time a shortlink is requested for a particular post, WP Bitly will automatically generate one. 50 51 = What happens if I change a posts permalink? = 52 53 WP Bitly verifies all shortlink requests against Bitly. If the URL has changed it will see this and request a new shortlink. 54 55 = Can I include the shortlink directly in a post? = 56 57 The shortcode `[wpbitly]` accepts all the same arguments as the_shortlink(). You can also set a "post_id" directly if you wish. 58 59 = How do I include a shortlink using PHP? = 60 61 Return a shortlink for the current post: 62 `wpbitly_shortlink();` 63 64 Returns a shortlink for the specified post ID: 65 `wpbitly_shortlink(42);` 55 No. The first time a shortlink is requested for a particular post, the plugin will automatically generate one. 66 56 67 57 == Changelog == -
wp-bitly/trunk/admin/class-wp-bitly-admin.php
r2459218 r2459994 166 166 167 167 168 $token = $_GET['access_token'];169 $login = $_GET['login'];168 $token = sanitize_text_field($_GET['access_token']); 169 $login = sanitize_text_field($_GET['login']); 170 170 171 171 $this->wp_bitly_logger->wpbitly_debug_log(array('Referer' => $_SERVER['HTTP_REFERER'], 'Query String' => $_SERVER['QUERY_STRING']), 'Authorizing Env'); … … 201 201 public function authorization_successful_notice() 202 202 { 203 $token = $_GET['access_token'];203 $token = sanitize_text_field($_GET['access_token']); 204 204 205 205 if ($this->wp_bitly_auth->isAuthorized()) { … … 234 234 } 235 235 236 $post_id = (int) $_GET['post'];236 $post_id = (int)sanitize_text_field($_GET['post']); 237 237 238 238 $this->wp_bitly_shortlink->wpbitly_generate_shortlink($post_id, 1); -
wp-bitly/trunk/includes/class-wp-bitly-auth.php
r2459218 r2459994 108 108 exit; 109 109 } 110 111 $code = sanitize_text_field($_POST['code']); 110 112 111 113 $param_arr = array( 112 114 'client_id' => WPBITLY_OAUTH_CLIENT_ID, 113 115 'client_secret' => WPBITLY_OAUTH_CLIENT_SECRET, 114 'code' => $ _POST['code'],116 'code' => $code, 115 117 'redirect_uri' => WPBITLY_OAUTH_REDIRECT_URI, 116 118 ); … … 158 160 $this->wp_bitly_logger->wpbitly_debug_log( $curl_response, 'class-wp-bitly-auth.php: Processed curl response' ); 159 161 160 $access_token = isset( $curl_response['access_token'] ) ? $curl_response['access_token']: NULL;161 $login = isset( $curl_response['login'] ) ? $curl_response['login']: NULL;162 $access_token = isset( $curl_response['access_token'] ) ? sanitize_text_field($curl_response['access_token']) : NULL; 163 $login = isset( $curl_response['login'] ) ? sanitize_text_field($curl_response['login']) : NULL; 162 164 163 165 if( !$access_token ) { -
wp-bitly/trunk/includes/class-wp-bitly-deactivator.php
r2459218 r2459994 23 23 class Wp_Bitly_Deactivator { 24 24 25 /**26 * Short Description. (use period)27 *28 * Long Description.29 *30 * @since 2.6.031 */32 public static function deactivate() {25 /** 26 * Short Description. (use period) 27 * 28 * Long Description. 29 * 30 * @since 2.6.0 31 */ 32 public static function deactivate() { 33 33 34 delete_option(WPBITLY_OPTIONS); 35 delete_option(WPBITLY_AUTHORIZED); 34 //No actions to be taken at this time. 36 35 37 // Grab all posts with an attached shortlink 38 $posts = get_posts('numberposts=-1&post_type=any&meta_key=_wpbitly'); 39 40 // And remove our meta information from them 41 // @TODO benchmark this against deleting it with a quick SQL query. Probably quicker, any conflict? 42 foreach ($posts as $post) { 43 delete_post_meta($post->ID, '_wpbitly'); 44 } 45 46 } 36 } 47 37 48 49 38 } -
wp-bitly/trunk/uninstall.php
r1808926 r2459994 12 12 13 13 /** 14 * Some people just don't know how cool this plugin is. When they realize15 * it and come back later, let's make sure they have to start all over.16 14 * 17 15 * @return void … … 26 24 27 25 // And remove our meta information from them 28 // @TODO benchmark this against deleting it with a quick SQL query. Probably quicker, any conflict? 29 foreach ($posts as $post) 26 foreach ($posts as $post){ 30 27 delete_post_meta($post->ID, '_wpbitly'); 28 } 31 29 32 30 } 33 34 // G'bye!35 31 wpbitly_uninstall();
Note: See TracChangeset
for help on using the changeset viewer.