diff --git a/app/assets/js/rtmedia-gallery-shortcode.js b/app/assets/js/rtmedia-gallery-shortcode.js new file mode 100644 index 000000000..f0b1b4506 --- /dev/null +++ b/app/assets/js/rtmedia-gallery-shortcode.js @@ -0,0 +1,13 @@ +/** + * This file is used to handle rtMedia Gallery shortcode + */ +jQuery(document).ready(function() { + // show notice: "rtMedia Gallery shortcode can be used only once." + wp.data.dispatch( 'core/notices' ).createNotice( + 'warning', + rtmedia_gallery_shortcode.notice_message, + { + isDismissible: true + } + ); +}); diff --git a/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php b/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php index b3e8233a5..3cbe133bb 100755 --- a/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php +++ b/app/main/controllers/shortcodes/RTMediaGalleryShortcode.php @@ -25,6 +25,8 @@ public function __construct() { add_shortcode( 'rtmedia_gallery', array( 'RTMediaGalleryShortcode', 'render' ) ); add_action( 'wp_ajax_rtmedia_get_template', array( &$this, 'ajax_rtmedia_get_template' ) ); add_action( 'wp_ajax_nopriv_rtmedia_get_template', array( &$this, 'ajax_rtmedia_get_template' ) ); + add_action( 'admin_notices', array( 'RTMediaGalleryShortcode', 'rtmedia_gallery_shortcode_admin_notice' ) ); + add_action( 'enqueue_block_editor_assets', array( 'RTMediaGalleryShortcode', 'rtmedia_gallery_shortcode_block_editor_assets' ) ); } /** @@ -158,10 +160,19 @@ public static function display_allowed() { * Render a shortcode according to the attributes passed with it * * @param bool|array $attr Shortcode attributes. + * @param null $content Shortcode content. + * @param string $shortcode_tag Shortcode tag. * * @return bool|string */ - public static function render( $attr ) { + public static function render( $attr, $content = null, $shortcode_tag = '' ) { + static $run_shortcode = false; + + if ( true === $run_shortcode ) { + return ''; + } + + $run_shortcode = true; if ( self::display_allowed() ) { @@ -359,4 +370,35 @@ public static function rtmedia_query_where_filter( $where, $table_name, $join ) return $where; } + + /** + * Display admin notice for rtMedia Gallery shortcode. + */ + public static function rtmedia_gallery_shortcode_admin_notice() { + ?> +
+

+ +

+
+ esc_html__( 'rtMedia Gallery shortcode can be used only once.', 'buddypress-media' ) ) ); + } } diff --git a/languages/buddypress-media.po b/languages/buddypress-media.po index 889e05cd4..ae0a26ec3 100644 --- a/languages/buddypress-media.po +++ b/languages/buddypress-media.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: rtMedia for WordPress, BuddyPress and bbPress 4.6.13\n" "Report-Msgid-Bugs-To: https://rtmedia.io/support/\n" -"POT-Creation-Date: 2023-02-14 09:20:22+00:00\n" +"POT-Creation-Date: 2023-07-24 13:19:13+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -69,8 +69,8 @@ msgstr "" #: app/admin/RTMediaAdmin.php:623 app/admin/RTMediaAdmin.php:1105 #: app/admin/RTMediaAdmin.php:1106 app/importers/RTMediaActivityUpgrade.php:189 -#: app/importers/RTMediaMigration.php:96 app/main/RTMedia.php:1210 -#: app/main/RTMedia.php:2189 +#: app/importers/RTMediaMigration.php:96 app/main/RTMedia.php:1208 +#: app/main/RTMedia.php:2182 msgid "rtMedia" msgstr "" @@ -321,7 +321,8 @@ msgid "Premium Add-ons" msgstr "" #: app/admin/RTMediaAdmin.php:1688 -#. translators: 1. Account page and link. +#. translators: 1$s: Account page and link. 2$s: License documentation page +#. link. msgid "" "Your license keys can be found on my-account page. For " "more details, please refer to License documentation " @@ -913,7 +914,7 @@ msgid "" "target=\"_blank\" >your account" msgstr "" -#: app/admin/templates/notices/addon-update.php:14 +#: app/admin/templates/notices/addon-update.php:15 #: app/admin/templates/notices/premium-addon.php:27 msgid "rtMedia: " msgstr "" @@ -927,7 +928,7 @@ msgid " - First official rtMedia premium theme." msgstr "" #: app/admin/templates/notices/premium-addon.php:21 -#. translators: 1. Product page link. +#. translators: %s: Product page link. msgid "Check 30+ premium rtMedia add-ons on our store." msgstr "" @@ -2092,7 +2093,7 @@ msgstr "" msgid "Users" msgstr "" -#: app/importers/BPMediaAlbumimporter.php:111 app/main/RTMedia.php:861 +#: app/importers/BPMediaAlbumimporter.php:111 app/main/RTMedia.php:860 msgid "Media" msgstr "" @@ -2209,8 +2210,8 @@ msgstr "" msgid " to upgrade rtMedia activities." msgstr "" -#: app/importers/RTMediaMediaSizeImporter.php:38 #: app/importers/RTMediaMediaSizeImporter.php:39 +#: app/importers/RTMediaMediaSizeImporter.php:40 msgid "Media Size Import" msgstr "" @@ -2302,9 +2303,9 @@ msgstr "" msgid "rtMedia: Import Media Size" msgstr "" -#: app/main/RTMedia.php:162 app/main/RTMedia.php:1535 app/main/RTMedia.php:1628 +#: app/main/RTMedia.php:163 app/main/RTMedia.php:1532 app/main/RTMedia.php:1625 #: app/main/controllers/activity/RTMediaBuddyPressActivity.php:760 -#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:113 +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:115 #: app/main/controllers/upload/processors/RTMediaUploadFile.php:246 msgid "Media Files" msgstr "" @@ -2329,153 +2330,153 @@ msgstr "" msgid "Music" msgstr "" -#: app/main/RTMedia.php:686 +#: app/main/RTMedia.php:685 msgid "Private - Visible only to the user" msgstr "" -#: app/main/RTMedia.php:687 +#: app/main/RTMedia.php:686 msgid "Friends - Visible to user's friends" msgstr "" -#: app/main/RTMedia.php:688 +#: app/main/RTMedia.php:687 msgid "Logged in Users - Visible to registered users" msgstr "" -#: app/main/RTMedia.php:689 +#: app/main/RTMedia.php:688 msgid "Public - Visible to the world" msgstr "" -#: app/main/RTMedia.php:869 app/main/controllers/template/RTMediaNav.php:303 +#: app/main/RTMedia.php:868 app/main/controllers/template/RTMediaNav.php:303 #: app/main/controllers/template/rtmedia-functions.php:139 msgid "All" msgstr "" -#: app/main/RTMedia.php:881 app/main/controllers/media/RTMediaAlbum.php:56 +#: app/main/RTMedia.php:880 app/main/controllers/media/RTMediaAlbum.php:56 #: app/main/controllers/template/rtmedia-actions.php:127 #: app/main/controllers/upload/RTMediaUploadView.php:84 #: app/main/controllers/upload/RTMediaUploadView.php:96 msgid "Album" msgstr "" -#: app/main/RTMedia.php:885 app/main/RTMedia.php:1430 +#: app/main/RTMedia.php:884 app/main/RTMedia.php:1428 #: app/main/controllers/media/RTMediaAlbum.php:55 #: app/main/controllers/media/RTMediaAlbum.php:67 #: app/main/controllers/template/RTMediaNav.php:326 msgid "Albums" msgstr "" -#: app/main/RTMedia.php:895 app/main/controllers/media/RTMediaLoginPopup.php:56 +#: app/main/RTMedia.php:894 app/main/controllers/media/RTMediaLoginPopup.php:56 #: app/main/controllers/template/rtmedia-actions.php:292 #: app/main/controllers/template/rtmedia-actions.php:299 #: app/main/controllers/template/rtmedia-actions.php:311 msgid "Upload" msgstr "" -#: app/main/RTMedia.php:900 +#: app/main/RTMedia.php:899 msgid "Wall Post" msgstr "" -#: app/main/RTMedia.php:1136 app/main/RTMedia.php:1145 +#: app/main/RTMedia.php:1134 app/main/RTMedia.php:1143 msgid "Wall Posts" msgstr "" -#: app/main/RTMedia.php:1211 +#: app/main/RTMedia.php:1209 msgid ": Can't Create Database table. Please check create table permission." msgstr "" -#: app/main/RTMedia.php:1301 app/main/RTMedia.php:1354 +#: app/main/RTMedia.php:1299 app/main/RTMedia.php:1352 msgid "Are you sure you want to delete this media?" msgstr "" -#: app/main/RTMedia.php:1302 +#: app/main/RTMedia.php:1300 msgid "Media file deleted successfully." msgstr "" -#: app/main/RTMedia.php:1348 +#: app/main/RTMedia.php:1346 msgid "Loading media" msgstr "" -#: app/main/RTMedia.php:1352 +#: app/main/RTMedia.php:1350 msgid "Please enter some content to post." msgstr "" -#: app/main/RTMedia.php:1353 +#: app/main/RTMedia.php:1351 msgid "Empty comment is not allowed." msgstr "" -#: app/main/RTMedia.php:1355 +#: app/main/RTMedia.php:1353 msgid "Are you sure you want to delete this comment?" msgstr "" -#: app/main/RTMedia.php:1356 +#: app/main/RTMedia.php:1354 msgid "Are you sure you want to delete this Album?" msgstr "" -#: app/main/RTMedia.php:1357 +#: app/main/RTMedia.php:1355 msgid "Drop files here" msgstr "" -#: app/main/RTMedia.php:1358 +#: app/main/RTMedia.php:1356 msgid "album created successfully." msgstr "" -#: app/main/RTMedia.php:1359 +#: app/main/RTMedia.php:1357 msgid "Something went wrong. Please try again." msgstr "" -#: app/main/RTMedia.php:1360 +#: app/main/RTMedia.php:1358 msgid "Enter an album name." msgstr "" -#: app/main/RTMedia.php:1361 +#: app/main/RTMedia.php:1359 msgid "Max file Size Limit: " msgstr "" -#: app/main/RTMedia.php:1362 +#: app/main/RTMedia.php:1360 msgid "Allowed File Formats" msgstr "" -#: app/main/RTMedia.php:1363 templates/media/album-single-edit.php:87 +#: app/main/RTMedia.php:1361 templates/media/album-single-edit.php:87 msgid "Select All Visible" msgstr "" -#: app/main/RTMedia.php:1364 +#: app/main/RTMedia.php:1362 msgid "Unselect All Visible" msgstr "" -#: app/main/RTMedia.php:1365 +#: app/main/RTMedia.php:1363 msgid "Please select some media." msgstr "" -#: app/main/RTMedia.php:1366 +#: app/main/RTMedia.php:1364 msgid "Are you sure you want to delete the selected media?" msgstr "" -#: app/main/RTMedia.php:1367 +#: app/main/RTMedia.php:1365 msgid "Are you sure you want to move the selected media?" msgstr "" -#: app/main/RTMedia.php:1368 +#: app/main/RTMedia.php:1366 msgid "Waiting" msgstr "" -#: app/main/RTMedia.php:1369 +#: app/main/RTMedia.php:1367 msgid "Uploaded" msgstr "" -#: app/main/RTMedia.php:1370 +#: app/main/RTMedia.php:1368 msgid "Uploading" msgstr "" -#: app/main/RTMedia.php:1371 +#: app/main/RTMedia.php:1369 msgid "Failed" msgstr "" -#: app/main/RTMedia.php:1372 +#: app/main/RTMedia.php:1370 msgid "Close" msgstr "" -#: app/main/RTMedia.php:1373 +#: app/main/RTMedia.php:1371 #: app/main/controllers/media/RTMediaGalleryItemAction.php:88 #: app/main/controllers/media/RTMediaGalleryItemAction.php:122 #: app/main/controllers/template/rtmedia-functions.php:1315 @@ -2483,7 +2484,7 @@ msgstr "" msgid "Edit" msgstr "" -#: app/main/RTMedia.php:1374 +#: app/main/RTMedia.php:1372 #: app/main/controllers/media/RTMediaGalleryItemAction.php:91 #: app/main/controllers/media/RTMediaGalleryItemAction.php:124 #: app/main/controllers/template/rtmedia-functions.php:2284 @@ -2492,83 +2493,83 @@ msgstr "" msgid "Delete" msgstr "" -#: app/main/RTMedia.php:1375 templates/media/media-single-edit.php:19 +#: app/main/RTMedia.php:1373 templates/media/media-single-edit.php:19 msgid "Edit Media" msgstr "" -#: app/main/RTMedia.php:1376 +#: app/main/RTMedia.php:1374 msgid "Remove from queue" msgstr "" -#: app/main/RTMedia.php:1377 +#: app/main/RTMedia.php:1375 msgid "Add more files" msgstr "" -#: app/main/RTMedia.php:1378 +#: app/main/RTMedia.php:1376 msgid "File not supported" msgstr "" -#: app/main/RTMedia.php:1379 +#: app/main/RTMedia.php:1377 msgid "more" msgstr "" -#: app/main/RTMedia.php:1380 +#: app/main/RTMedia.php:1378 msgid "less" msgstr "" -#: app/main/RTMedia.php:1381 +#: app/main/RTMedia.php:1379 msgid "Read more" msgstr "" -#: app/main/RTMedia.php:1382 +#: app/main/RTMedia.php:1380 msgid "Show less" msgstr "" -#: app/main/RTMedia.php:1384 +#: app/main/RTMedia.php:1382 msgid "This media is uploaded. Are you sure you want to delete this media?" msgstr "" -#: app/main/RTMedia.php:1404 +#: app/main/RTMedia.php:1402 msgid "Featured media set successfully." msgstr "" -#: app/main/RTMedia.php:1405 +#: app/main/RTMedia.php:1403 msgid "Featured media removed successfully." msgstr "" -#: app/main/RTMedia.php:1411 +#: app/main/RTMedia.php:1409 msgid "Title:" msgstr "" -#: app/main/RTMedia.php:1412 +#: app/main/RTMedia.php:1410 msgid "Description:" msgstr "" -#: app/main/RTMedia.php:1416 +#: app/main/RTMedia.php:1414 msgid "Oops !! There's no media found for the request !!" msgstr "" -#: app/main/RTMedia.php:1420 +#: app/main/RTMedia.php:1418 msgid "Edit File Name" msgstr "" -#: app/main/RTMedia.php:1431 +#: app/main/RTMedia.php:1429 msgid "Privacy updated successfully." msgstr "" -#: app/main/RTMedia.php:1432 +#: app/main/RTMedia.php:1430 msgid "Couldn't change privacy, please try again." msgstr "" -#: app/main/RTMedia.php:1471 +#: app/main/RTMedia.php:1468 msgid "There are some uploads in progress. Do you want to cancel them?" msgstr "" -#: app/main/RTMedia.php:1473 +#: app/main/RTMedia.php:1470 msgid "Media upload is disabled. Please Enable at least one media type to proceed." msgstr "" -#: app/main/RTMedia.php:1584 +#: app/main/RTMedia.php:1581 msgid "Adding media in Comments is not allowed" msgstr "" @@ -2997,10 +2998,15 @@ msgstr "" msgid "Your default privacy settings saved successfully." msgstr "" -#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:323 +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:336 msgid "You do not have sufficient privileges to view this gallery" msgstr "" +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:381 +#: app/main/controllers/shortcodes/RTMediaGalleryShortcode.php:402 +msgid "rtMedia Gallery shortcode can be used only once." +msgstr "" + #: app/main/controllers/template/RTMediaAJAX.php:48 msgid "You can not create album in this group." msgstr "" @@ -3098,7 +3104,7 @@ msgstr "" msgid "Search Media" msgstr "" -#: app/main/controllers/template/rtmedia-actions.php:1167 +#: app/main/controllers/template/rtmedia-actions.php:1166 msgid "Please swipe for more media." msgstr "" @@ -3482,6 +3488,10 @@ msgstr "" msgid "Default Privacy" msgstr "" +#: lib/deactivation-survey/deactivation-survey.php:58 +msgid "If you have a moment, please let us know why you are deactivating: " +msgstr "" + #: templates/main.php:70 templates/main.php:143 msgid "rtMedia menu" msgstr ""