diff --git a/.wordpress-org/screenshot-1.png b/.wordpress-org/screenshot-1.png index d860152..5adb9de 100644 Binary files a/.wordpress-org/screenshot-1.png and b/.wordpress-org/screenshot-1.png differ diff --git a/.wordpress-org/screenshot-10.png b/.wordpress-org/screenshot-10.png new file mode 100644 index 0000000..bfd9a32 Binary files /dev/null and b/.wordpress-org/screenshot-10.png differ diff --git a/.wordpress-org/screenshot-2.png b/.wordpress-org/screenshot-2.png index 0c7e83b..26d373e 100644 Binary files a/.wordpress-org/screenshot-2.png and b/.wordpress-org/screenshot-2.png differ diff --git a/.wordpress-org/screenshot-3.png b/.wordpress-org/screenshot-3.png index 7cd9a57..e52d17a 100644 Binary files a/.wordpress-org/screenshot-3.png and b/.wordpress-org/screenshot-3.png differ diff --git a/.wordpress-org/screenshot-4.png b/.wordpress-org/screenshot-4.png new file mode 100644 index 0000000..f5b2460 Binary files /dev/null and b/.wordpress-org/screenshot-4.png differ diff --git a/.wordpress-org/screenshot-5.png b/.wordpress-org/screenshot-5.png new file mode 100644 index 0000000..fe025f3 Binary files /dev/null and b/.wordpress-org/screenshot-5.png differ diff --git a/.wordpress-org/screenshot-6.png b/.wordpress-org/screenshot-6.png new file mode 100644 index 0000000..4bb3944 Binary files /dev/null and b/.wordpress-org/screenshot-6.png differ diff --git a/.wordpress-org/screenshot-7.png b/.wordpress-org/screenshot-7.png new file mode 100644 index 0000000..e30184d Binary files /dev/null and b/.wordpress-org/screenshot-7.png differ diff --git a/.wordpress-org/screenshot-8.png b/.wordpress-org/screenshot-8.png new file mode 100644 index 0000000..e17fb7d Binary files /dev/null and b/.wordpress-org/screenshot-8.png differ diff --git a/.wordpress-org/screenshot-9.png b/.wordpress-org/screenshot-9.png new file mode 100644 index 0000000..4bcfaf3 Binary files /dev/null and b/.wordpress-org/screenshot-9.png differ diff --git a/README.md b/README.md index eab6d8d..e624533 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,36 @@ Currently, embeddings of the following services are supported: - Albums - Tracks - Podcast Episodes +- Twitter + - Single Tweet + - User Timeline + - Follow-Button + - Mention-Button + - Hashtag-Button ## installation & usage 1. Make sure that your WordPress installation meets the minimum requirements of this plugin. 2. Upload the plugin to the /wp-content/plugins/ directory or install it directly from the admin pages. 3. Use the shortcodes: - - Spotify\*: + - Spotify: `[privacy-embed_spotify title="Title of embed" spotify_url="spotify:album:1DFixLWuPkv3KT3TnV35m3"]` - YouTube: `[privacy-embed_youtube title="Title of embed" youtube_link="https://www.youtube.com/watch?v=kV9sNmujCPk"]` + - Twitter: + `[privacy-embed_twitter title="Title of embed" twitter_type="timeline" twitter_link="https://twitter.com/WordPress"]` -\* You can get the Spotify URI by clicking \"Share\" on the Spotify page of any artist, album or track and then selecting \"Copy Spotify URI\". Getting the Spotify URL for a podcast episode requires a bit more steps: Click "Share" on the corresponding Spotify page and select "Copy episode link". From the copied link you now have to extract the part after ".../episode/" up to (excluding) the next question mark. Your Spotify URL is now composed of: `spotify:episode:extracted-part`. For podcasts (shows) you have to click "Share" on the corresponding Spotify page and select "Copy show link" nad extract the part after ".../show/" up to (excluding) the next question mark. Your Spotify URL is now composed of: `spotify:show:extracted-part`. +You can get the Spotify URI by clicking \"Share\" on the Spotify page of any artist, album or track and then selecting \"Copy Spotify URI\". + +Getting the Spotify URL for a podcast episode requires a bit more steps: Click "Share" on the corresponding Spotify page and select "Copy episode link". From the copied link you now have to extract the part after ".../episode/" up to (excluding) the next question mark. Your Spotify URL is now composed of: `spotify:episode:extracted-part`. + +For podcasts (shows) you have to click "Share" on the corresponding Spotify page and select "Copy show link" nad extract the part after ".../show/" up to (excluding) the next question mark. Your Spotify URL is now composed of: `spotify:show:extracted-part`. + +The following examples can be values of the field `twitter_link`: + +- single tweet: `https://twitter.com/WordPress/status/1402457431742074881` +- timeline, follow-button, mention-button: `https://twitter.com/WordPress` +- hashtag-button: `https://twitter.com/hashtag/WordPress` ## license diff --git a/functions/privacy_embed__twitter_hashtag_link_to_twitter_hashtag.php b/functions/privacy_embed__twitter_hashtag_link_to_twitter_hashtag.php new file mode 100644 index 0000000..2fdc2e8 --- /dev/null +++ b/functions/privacy_embed__twitter_hashtag_link_to_twitter_hashtag.php @@ -0,0 +1,25 @@ + array( + 'title' => __('Twitter', 'privacy-embed'), + 'fields' => array( + 'twitter_embed_notice' => array( + 'title' => __('Embed Notice Message', 'privacy-embed'), + 'id' => 'twitter_embed_notice', + 'type' => 'textarea', + 'value' => __('There is external content hidden here that would have to be loaded by Twitter. We have no influence on this external content and its provision. This means that we cannot say whether and to what extent your personal data is processed by Twitter (or, for example, whether so-called tracking takes place). You could find more information in Twitter\'s privacy policy. If you still want to load the content, this decision only applies until the page is reloaded.', 'privacy-embed') + ), + 'twitter_embed_load' => array( + 'title' => __('Embed Load Text', 'privacy-embed'), + 'id' => 'twitter_embed_load', + 'type' => 'text', + 'value' => __('Load content from Twitter anyway.', 'privacy-embed') + ), + 'twitter_follow_button' => array( + 'title' => __('Follow Button Text (preview only)', 'privacy-embed'), + 'id' => 'twitter_follow_button', + 'type' => 'text', + 'value' => __('Follow @', 'privacy-embed') + ), + 'twitter_mention_button' => array( + 'title' => __('Mention Button Text (preview only)', 'privacy-embed'), + 'id' => 'twitter_mention_button', + 'type' => 'text', + 'value' => __('Tweet to @', 'privacy-embed') + ), + 'twitter_hashtag_button' => array( + 'title' => __('Hashtag Button Text (preview only)', 'privacy-embed'), + 'id' => 'twitter_hashtag_button', + 'type' => 'text', + 'value' => __('Tweet #', 'privacy-embed') + ), + ), + ), ), ), ); diff --git a/shortcodes/spotify.php b/shortcodes/spotify.php index 494314c..5d46888 100644 --- a/shortcodes/spotify.php +++ b/shortcodes/spotify.php @@ -70,7 +70,7 @@ public function render_shortcode($attributes, $content, $tag) $output .= 'Spotify Thumbnail'; // add privacy-notice - $output .= '

+ $output .= '

' . $embed_notice . '

' . $embed_load . '

'; diff --git a/shortcodes/twitter.php b/shortcodes/twitter.php new file mode 100644 index 0000000..5e8c0ff --- /dev/null +++ b/shortcodes/twitter.php @@ -0,0 +1,132 @@ + '', + 'twitter_link' => '', + 'twitter_type' => '' + ), $attributes)); + + // get title + $title = esc_html($attributes['title']); + + // get twitter specific attributes + $twitter_link = esc_html($attributes['twitter_link']); + $twitter_type = esc_html($attributes['twitter_type']); + + // validate type + if ($twitter_type == '') { + $error_message = __('error: no type for this twitter embed specified', 'privacy-embed'); + return '

' . $error_message . '

'; + } + + // get preview image (thumbnail) + $thumbnail_src = plugins_url('public/images/twitter_thumbnail.jpg', dirname(__FILE__)); + + // get texts from settings + $options = get_option('privacy-embed_settings-page', array()); + + $embed_notice = esc_html($options['twitter_embed_notice']); + $embed_notice_default = __('There is external content hidden here that would have to be loaded by Twitter. We have no influence on this external content and its provision. This means that we cannot say whether and to what extent your personal data is processed by Twitter (or, for example, whether so-called tracking takes place). You could find more information in Twitter\'s privacy policy. If you still want to load the content, this decision only applies until the page is reloaded.', 'privacy-embed'); + $embed_notice = ($embed_notice == "" ? $embed_notice_default : $embed_notice); + + $embed_load = esc_html($options['twitter_embed_load']); + $embed_load_default = __('Load content from Twitter anyway.', 'privacy-embed'); + $embed_load = ($embed_load == "" ? $embed_load_default : $embed_load); + + $twitter_follow_button = esc_html($options['twitter_follow_button']); + $twitter_follow_button_default = __('Follow @', 'privacy-embed'); + $twitter_follow_button = ($twitter_follow_button == "" ? $twitter_follow_button_default : $twitter_follow_button); + + $twitter_mention_button = esc_html($options['twitter_mention_button']); + $twitter_mention_button_default = __('Tweet to @', 'privacy-embed'); + $twitter_mention_button = ($twitter_mention_button == "" ? $twitter_mention_button_default : $twitter_mention_button); + + $twitter_hashtag_button = esc_html($options['twitter_hashtag_button']); + $twitter_hashtag_button_default = __('Tweet #', 'privacy-embed'); + $twitter_hashtag_button = ($twitter_hashtag_button == "" ? $twitter_hashtag_button_default : $twitter_hashtag_button); + + // generate twitter_html depending on twitter_type + $twitter_html = ''; + $show_embed = true; + switch ($twitter_type) { + case 'tweet': + $twitter_html = '
'; + break; + case 'timeline': + $twitter_username = privacy_embed__twitter_profile_link_to_twitter_username($twitter_link); + $twitter_html = ''; + break; + case 'follow-button': + $show_embed = false; + $twitter_username = privacy_embed__twitter_profile_link_to_twitter_username($twitter_link); + $twitter_html = '' . $twitter_follow_button . $twitter_username . ''; + break; + case 'mention-button': + $show_embed = false; + $twitter_username = privacy_embed__twitter_profile_link_to_twitter_username($twitter_link); + $twitter_html = '' . $twitter_mention_button . $twitter_username . ''; + break; + case 'hashtag-button': + $show_embed = false; + $twitter_hashtag = privacy_embed__twitter_hashtag_link_to_twitter_hashtag($twitter_link); + $twitter_html = '' . $twitter_hashtag_button . $twitter_hashtag . ''; + break; + default: + return ''; + } + + // generate and return output (html) + $output = ''; + + // add title (if not empty) + if ($title != '') $output .= '

' . $title . '

'; + + // add twitter html + $output .= $twitter_html; + + if ($show_embed) { + // create overall div + $output .= '
'; + + // add thumbnail + $output .= ''; + + // add privacy-notice + $output .= ''; + + // close overall div + $output .= '
'; + } + + // return everything + return $output; + } + } + + new PrivacyEmbedTwitterShortcode(); +} diff --git a/wpbakery/twitter.php b/wpbakery/twitter.php new file mode 100644 index 0000000..d5d4dea --- /dev/null +++ b/wpbakery/twitter.php @@ -0,0 +1,61 @@ + __('Twitter (Privacy Embed)', 'privacy-embed'), + 'base' => 'privacy-embed_twitter', + 'category' => __('Privacy Modules', 'privacy-embed'), + 'params' => array( + array( + 'type' => 'textfield', + 'class' => '', + 'heading' => __('Title', 'privacy-embed'), + 'param_name' => 'title', + 'description' => __('The title above the embed', 'privacy-embed'), + 'holder' => 'div' + ), + array( + 'type' => 'textfield', + 'class' => '', + 'heading' => __('Twitter Link', 'privacy-embed'), + 'param_name' => 'twitter_link', + 'description' => __('A link to a user, a hastag or a single tweet', 'privacy-embed'), + 'holder' => 'div' + ), + array( + 'type' => 'dropdown', + 'class' => '', + 'heading' => __('Twitter Type', 'privacy-embed'), + 'param_name' => 'twitter_type', + 'value' => array( + __('choose value', 'privacy-embed') => 'n/a', + __('single tweet', 'privacy-embed') => 'tweet', + __('timeline of an user', 'privacy-embed') => 'timeline', + __('follow button', 'privacy-embed') => 'follow-button', + __('mention button', 'privacy-embed') => 'mention-button', + __('hashtag button', 'privacy-embed') => 'hashtag-button', + ), + 'description' => __('The type of the embed', 'privacy-embed'), + 'holder' => 'div', + ) + ) + )); + } + } + + new VcPrivacyEmbedTwitter(); +}