Changeset 3348890
- Timestamp:
- 08/23/2025 07:56:57 AM (5 months ago)
- Location:
- shareopenly/trunk
- Files:
-
- 2 added
- 5 edited
-
images (added)
-
images/logo.svg (added)
-
inc/add-sharing-link.php (modified) (1 diff)
-
inc/settings.php (modified) (8 diffs)
-
inc/shared.php (modified) (3 diffs)
-
readme.txt (modified) (5 diffs)
-
shareopenly.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
shareopenly/trunk/inc/add-sharing-link.php
r3137745 r3348890 34 34 $url = home_url( add_query_arg( array(), $wp->request ) ); 35 35 36 $content .= '<div class="shareopenly"><img src=" https://shareopenly.org/images/logo.svg" alt="ShareOpenly logo"> <a href="https://shareopenly.org/share/?url=' . $url . '&text=' . $title . '">' . $settings['text']. '</a></div>';36 $content .= '<div class="shareopenly"><img src="' . esc_url( plugins_url( '../images/logo.svg', __FILE__ ) ) . '" alt="" referrerpolicy="no-referrer"> <a href="https://shareopenly.org/share/?url=' . $url . '&text=' . $title . '" loading="lazy" decoding="async" aria-hidden="true" />' . esc_html( $settings['text'] ) . '</a></div>'; 37 37 } 38 38 } -
shareopenly/trunk/inc/settings.php
r3137745 r3348890 5 5 * Assorted functions to add and create settings. 6 6 * 7 * @package plugin-slug7 * @package shareopenly 8 8 */ 9 9 … … 32 32 if ( ! $settings['text'] ) { 33 33 $settings['text'] = __( 'Share this post on social media.', 'shareopenly' ); 34 add_option( 'shareopenly_text', $settings['text'] ); 34 35 } 35 36 … … 39 40 if ( ! $settings['priority'] ) { 40 41 $settings['priority'] = 10; 42 add_option( 'shareopenly_priority', $settings['priority'] ); 41 43 } 42 44 … … 68 70 break; 69 71 } 72 } 73 74 // If the post types have changed, make sure to upate them. 75 if ( $support_post_types !== $shareopenly_post_types ) { 76 add_option( 'shareopenly_type', $shareopenly_post_types ); 70 77 } 71 78 … … 110 117 * Type setting callback 111 118 * 112 * Output the settings fields for selecting onwhich post types to display sharing link.119 * Output the settings fields for selecting which post types to display sharing link. 113 120 */ 114 121 function shareopenly_type_callback() { … … 121 128 <?php foreach ( $post_types as $post_type ) : ?> 122 129 <li> 123 <input type="checkbox" id="shareopenly_type_<?php echo esc_ attr( $post_type->name ); ?>" name="shareopenly_type[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php echo checked( in_array( $post_type->name, $support_post_types, true ) ); ?> />124 <label for="shareopenly_type_<?php echo esc_ attr( $post_type->name ); ?>"><?php echo esc_html( $post_type->label ); ?></label>130 <input type="checkbox" id="shareopenly_type_<?php echo esc_html( $post_type->name ); ?>" name="shareopenly_type[]" value="<?php echo esc_html( $post_type->name ); ?>" <?php echo checked( in_array( $post_type->name, $support_post_types, true ) ); ?> /> 131 <label for="shareopenly_type_<?php echo esc_html( $post_type->name ); ?>"><?php echo esc_html( $post_type->label ); ?></label> 125 132 </li> 126 133 <?php endforeach; ?> … … 140 147 $text = $options['text']; 141 148 142 echo '<input name="shareopenly_text" size="40" type="text" value="' . esc_ attr( $text ) . '" />';149 echo '<input name="shareopenly_text" size="40" type="text" value="' . esc_html( $text ) . '" /><label for="shareopenly_text">' . esc_html( 'The sharing text that will be displayed' ) . '</label>'; 143 150 } 144 151 … … 153 160 $type = $options['priority']; 154 161 155 echo '<input name="shareopenly_priority" size="4" maxlength="4" type="text" value="' . esc_attr( $type ) . '" />';162 echo '<input name="shareopenly_priority" min="1" max="9999" type="number" value="' . esc_html( $type ) . '" /><label for="shareopenly_text">' . esc_html( 'The priority of the sharing message on the page' ) . '</label>'; 156 163 } -
shareopenly/trunk/inc/shared.php
r3084932 r3348890 69 69 70 70 /** 71 * WordPress ForkCheck71 * WordPress Requirements Check 72 72 * 73 * Deactivate the plugin if an unsupported fork of WordPress is detected.73 * Deactivate the plugin if certain requirements are not met. 74 74 * 75 * @version 1. 075 * @version 1.2 76 76 */ 77 function shareopenly_fork_check() { 77 function shareopenly_requirements_check() { 78 79 $reason = ''; 80 81 // Grab the plugin details. 82 83 $plugins = get_plugins(); 84 $name = $plugins[ SHAREOPENLY_PLUGIN_BASE ]['Name']; 78 85 79 86 // Check for a fork. 80 87 81 if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) ) {88 if ( function_exists( 'calmpress_version' ) || function_exists( 'classicpress_version' ) || defined( 'COSMIC_VERSION' ) ) { 82 89 83 // Grab the plugin details. 90 /* translators: 1: The plugin name. */ 91 $reason .= '<li>' . sprintf( __( 'A fork of WordPress was detected. %1$s has not been tested on this fork and, as a consequence, the author will not provide any support.', 'shareopenly' ), $name ) . '</li>'; 84 92 85 $plugins = get_plugins(); 86 $name = $plugins[ SHAREOPENLY_PLUGIN_BASE ]['Name']; 93 } 94 95 // If a requirement is not met, output the message and stop the plugin. 96 97 if ( '' !== $reason ) { 87 98 88 99 // Deactivate this plugin. … … 93 104 94 105 /* translators: 1: The plugin name. */ 95 $message = '<p><b>' . sprintf( __( '%1$s has been deactivated', 'shareopenly' ), $name ) . '</b></p><p>' . __( 'Reason:', 'shareopenly' ) . '</p>'; 96 /* translators: 1: The plugin name. */ 97 $message .= '<ul><li>' . __( 'A fork of WordPress was detected.', 'shareopenly' ) . '</li></ul><p>' . sprintf( __( 'The author of %1$s will not provide any support until the above are resolved.', 'shareopenly' ), $name ) . '</p>'; 106 $message = '<p><b>' . sprintf( __( '%1$s has been deactivated', 'shareopenly' ), $name ) . '</b></p><p>' . __( 'Reason:', 'shareopenly' ) . '</p><ul>' . $reason . '</ul>'; 98 107 99 108 $allowed = array( … … 108 117 } 109 118 110 add_action( 'admin_init', 'shareopenly_ fork_check' );119 add_action( 'admin_init', 'shareopenly_requirements_check' ); -
shareopenly/trunk/readme.txt
r3271372 r3348890 2 2 Contributors: dartiss, jeherve, mediaformat 3 3 Donate link: https://artiss.blog/donate 4 Tags: share, sharing, social media, mastodon, threads4 Tags: share, openly, social media, mastodon, threads 5 5 Requires at least: 4.6 6 6 Tested up to: 6.8 7 7 Requires PHP: 8.0 8 Stable tag: 1. 18 Stable tag: 1.2 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 11 11 README revision: 1.0 12 12 13 The official plugin for [ShareOpenly](https://shareopenly.org/) - adding modern, open social media sharing links to your website. 13 The official plugin for [ShareOpenly](https://shareopenly.org/) - adding modern, open social media sharing links to your website. Share openly. 14 14 15 15 == Description == 16 16 17 You know all those “share to Facebook” / “share to Twitter”links you see all over peoples’ websites? They’re all out of date.17 You know all those "share to Facebook" / "share to Twitter" links you see all over peoples’ websites? They’re all out of date. 18 18 19 Social media has evolved over the last year, yet nobody has “share to” links for Mastodon, Bluesky, Threads, etc. There have been a few attempts to create “share to Mastodon”buttons, but they haven’t taken the larger breadth of the new social media landscape into account.19 Social media has evolved over the last year, yet nobody has "share to" links for Mastodon, Bluesky, Threads, etc. There have been a few attempts to create "share to Mastodon" buttons, but they haven’t taken the larger breadth of the new social media landscape into account. 20 20 21 21 This is where ShareOpenly comes in. 22 22 23 Activate this plugin and, at the bottom of every post and/or page on your site, you’ll see a “share to social media”button. If you click it, you’ll be taken to a page that shows a number of modern, social media sites (see the first screenshot). You can select one of the pre-set sites in the list, and you’ll be taken to share a post there. But if you, for example, have a Mastodon instance, or a Known site, or an IndieWeb site at a different domain, you can enter that domain in the box, and ShareOpenly will try and find a way to let you share the page with that site.23 Activate this plugin and, at the bottom of every post and/or page on your site, you’ll see a "share to social media" button. If you click it, you’ll be taken to a page that shows a number of modern, social media sites (see the first screenshot). You can select one of the pre-set sites in the list, and you’ll be taken to share a post there. But if you, for example, have a Mastodon instance, or a Known site, or an IndieWeb site at a different domain, you can enter that domain in the box, and ShareOpenly will try and find a way to let you share the page with that site. 24 24 25 * Tested up to PHP 8.2 26 * Fully complies with WordPress coding standards 27 * Compliant with the stronger [WordPress VIP](https://wpvip.com/) coding standards, as well as compatibility with their platform 28 * Community plugin - visit the [Github page](https://github.com/dartiss/share-openly "Github") to get involved with the latest code development, request enhancements and report issues 25 * Tested up to PHP 8.4 26 * Follows WordPress coding standards 27 * Designed to be compatible with [WP VIP](https://wpvip.com/) coding standards, as well as compatibility with their platform 28 * Community plugin - visit the [GitHub page](https://github.com/dartiss/share-openly "GitHub") to get involved with the latest code development, request enhancements and report issues 29 30 == Support & Contributing == 31 32 If you would like to contribute to the code, report issues, request features or help with translation, then please use one of the following methods to do so... 33 34 * For support queries please [use the plugin forum on WordPress.org](https://wordpress.org/support/plugin/shareopenly/) 35 * To contribute to the code, suggest enhancements or report bugs you can [do so on my GitHub repo](https://github.com/dartiss/shareopenly) 36 * For translations, please [use GlotPress](https://translate.wordpress.org/projects/wp-plugins/shareopenly/) 37 38 If you wish to disclose a security issue then I would ask that you do so responsibly. For example, you could [submit it via Wordfence](https://www.wordfence.com/threat-intel/vulnerabilities/submit/), which this plugin is registered with. 39 40 == Privacy == 41 42 This plugin does not store personal data. Clicking a share link navigates the user to a third-party (or user-specified) site to complete the share. 43 44 Since v1.2, the share icon is loaded locally; no external assets or scripts are loaded by the plugin. 29 45 30 46 == Installation == … … 34 50 1. Upload the entire unzipped plugin folder to your `wp-content/plugins/` directory, either from WP Admin (Plugins -> Add New), your favorite FTP client or any other file manager 35 51 2. Activate the plugin through the 'Plugins' menu in WP Admin (Plugins -> Installed Plugins) 52 53 == Plugin Settings == 54 55 By default, nothing needs to be done for the new sharing options to appear. However, a number of settings are available, allowing for you to modify the results. 56 57 In Settings -> Discussion -> ShareOpenly, you can configure: 58 1. Location – where sharing links appear (Posts, Pages, or both) 59 2. Share text – the text shown next to the icon 60 3. Priority – the filter priority used for output ordering (default: 10) 61 62 After changing any of the settings, make sure to press the "Save Changes" button at the bottom of the screen. 36 63 37 64 == Screenshots == … … 46 73 ShareOpenly will do a few things first: 47 74 48 1. If it’s on a “well-known”domain — eg, facebook.com — it’ll send you to the share page there.75 1. If it’s on a "well-known" domain — eg, facebook.com — it’ll send you to the share page there. 49 76 2. It checks to see if it can figure out if the site is on a known platform (currently Mastodon, Known, hosted WordPress, micro.blog, and a few others). If so — hooray! — it knows the share URL, and off you go. 50 3. It looks for a `<link rel= “share-url”>` header tag on the page. The href attribute should be set to the share URL for the site, with template variables {text} and (optionally) {url} present where the share text and URL should go. (If {url} is not present, the URL to share will be appended at the end of the text.) If it’s there — yay! — we forward there, replacing {text} and {url} as appropriate.77 3. It looks for a `<link rel="share-url">` header tag on the page. The href attribute should be set to the share URL for the site, with template variables {text} and (optionally) {url} present where the share text and URL should go. (If {url} is not present, the URL to share will be appended at the end of the text.) If it’s there — yay! — we forward there, replacing {text} and {url} as appropriate. 51 78 52 79 Once you’ve shared to a site, the next time you visit ShareOpenly, it will be in the quick links. … … 66 93 No. It was developed for WordPress and so forks remain unsupported. I have no intention of developing and testing this on any other version. 67 94 95 = How do you uninstall the plugin and what does it do? = 96 97 When you uninstall the plugin via the Plugins menu in WP Admin, all saved settings will be deleted along with the plugin files, leaving no residual data behind. 98 99 = Is this plugin accessible? = 100 101 By default, the link that is displayed has an accessible name (although this can be changed by the user), the icon is decorative and focus is visible. I would love to hear from you if you experience any problems, however (please see the previous section on how to contribute). 102 68 103 == Changelog == 69 104 70 105 I use semantic versioning, with the first release being 1.0 106 107 = 1.2 = 108 * Enhancement: Added additional information to the README 109 * Enhancement: Improved accessibility, performance and security across the plugin 110 * Enhancement: Moved the SVG icon from an external link to locally 111 * Enhancement: Now making sure I'm defining the priority setting as a number and not a text field 112 * Enhancement: Updated the WordPress requirements script (v1.1 -> v1.2) 113 * Bug: Removed the smart quotes that were in the README. Thanks to [Terence Eden](https://shkspr.mobi/blog/) for identifying and reporting it 71 114 72 115 = 1.1 = … … 83 126 == Upgrade Notice == 84 127 85 = 1. 1=86 * Now with custom post types!128 = 1.2 = 129 * Assorted code quality improvements. Now more secure, accessible and performant! -
shareopenly/trunk/shareopenly.php
r3137745 r3348890 10 10 * Plugin URI: https://wordpress.org/plugins/shareopenly/ 11 11 * Description: The official plugin for ShareOpenly, adding modern, open social media sharing links to your website. 12 * Version: 1. 112 * Version: 1.2 13 13 * Requires at least: 4.6 14 14 * Requires PHP: 8.0
Note: See TracChangeset
for help on using the changeset viewer.