'
34 | );
35 | $("#bpfb_cancel_action").hide();
36 | };
37 |
38 | var removeTempDocuments = function (rti_callback) {
39 | var $docs = $('input.bpfb_documents_to_add');
40 | if (!$docs.length) return rti_callback();
41 | $.post(ajaxurl, {"action":"bpfb_remove_temp_documents", "data": $docs.serialize().replace(/%5B%5D/g, '[]')}, function (data) {
42 | rti_callback();
43 | });
44 | };
45 |
46 | var processForSave = function () {
47 | var $docs = $('input.bpfb_documents_to_add');
48 | var docArr = [];
49 | $docs.each(function () {
50 | docArr[docArr.length] = $(this).val();
51 | });
52 | return {
53 | "bpfb_documents": docArr//$imgs.serialize().replace(/%5B%5D/g, '[]')
54 | };
55 | };
56 |
57 | var init = function () {
58 | $container.empty();
59 | $('.bpfb_preview_container').empty();
60 | $('.bpfb_action_container').empty();
61 | $('#aw-whats-new-submit').hide();
62 | createMarkup();
63 | };
64 |
65 | var destroy = function () {
66 | removeTempDocuments(function() {
67 | $container.empty();
68 | $('.bpfb_preview_container').empty();
69 | $('.bpfb_action_container').empty();
70 | $('#aw-whats-new-submit').show();
71 | });
72 | };
73 |
74 | removeTempDocuments(init);
75 |
76 | return {"destroy": destroy, "get": processForSave};
77 | };
78 |
79 | $(".bpfb_toolbar_container").append(
80 | ' ' +
81 | '' + l10nBpfbDocs.add_documents + ''
82 | );
83 |
84 | $('#bpfb_addDocuments').click(function () {
85 | if (_bpfbActiveHandler) _bpfbActiveHandler.destroy();
86 | var group_id = $('#whats-new-post-in').length ? $('#whats-new-post-in').val() : 0;
87 | if (parseInt(group_id)) {
88 | _bpfbActiveHandler = new BpfbDocumentHandler();
89 | $("#bpfb_cancel_action").show();
90 | } else {
91 | alert(l10nBpfbDocs.no_group_selected);
92 | }
93 | return false;
94 | });
95 |
96 | });
97 | })(jQuery);
--------------------------------------------------------------------------------
/dev-readme.txt:
--------------------------------------------------------------------------------
1 | === BuddyPress Activity Plus ===
2 | Contributors: WPMUDEV
3 | Tags: BuddyPress, Activity, Activity Stream, BuddyPress Activity, Wall, Embed, Media, Youtube, Photos, Facebook, Social Network, Social Networking, Embed Video, Embed Link, Upload Photo, Upload Photos, Share Media, Sharing Media, Social Network Wall, Social Media
4 | Requires at least: 3.1
5 | Tested up to: 4.7
6 | Stable tag: 1.6.5
7 |
8 | BuddyPress Activity Plus allows for embedding of oEmbed videos and media in your activities.
9 |
10 | == Description ==
11 |
12 | BuddyPress Embed Activity gives your social network all the features and ease of Facebook when it comes to uploading and sharing media!
13 |
14 | [youtube https://www.youtube.com/watch?v=57qUenN1DOM]
15 |
16 | The plugin adds 3 new buttons to your BuddyPress activity stream. Enabling you to attach photos, videos, and even share web links with everyone on your network!
17 |
18 | Here's the quick overview of this plugin's features:
19 | * Upload a photo (or multiple) directly from your computer to the activity stream
20 | * Embed a video from popular sites such as youtube and vimeo by copying the link
21 | * Embed a link to any site - the site title and description will automatically be pulled in
22 | * Embedding a link also allows you to choose a thumbnail image from a list of images on the site's homepage
23 | * Works perfectly with any theme based on the BuddyPress Default theme
24 |
25 | == Installation ==
26 | = To Install: =
27 |
28 | 1. Download the plugin file
29 | 2. Unzip the file into a folder on your hard drive
30 | 3. Upload the `/bpfb/` folder to the `/wp-content/plugins/` folder on your site
31 | 4. Single-site BuddyPres go to Plugins menu and activate there.
32 | 5. For Multisite visit Network Admin -> Plugins and Network Activate it there.
33 |
34 | == Frequently Asked Questions ==
35 |
36 | = Do I need to be a paid WPMU DEV member? =
37 | No. This plugin is offered as is at no charge.
38 |
39 | = How do I get support? =
40 | We provide comprehensive and guaranteed support on the WPMU DEV forums and live chat only.
41 |
42 | == Screenshots ==
43 |
44 | 1. Embed Activity Window
45 | 2. Photos and websites are easily embedded
46 | 3. Image galleries right in the activity stream
47 | 4. Video in your activity stream
48 |
49 | == Changelog ==
50 |
51 | = 1.6.5 =
52 | - Fix: override default WP user agent in GET requests
53 | - Fix: better HTTP error handling
54 | - Fix: compat with BP Reshare
55 | - Fix: custom moderation to avoid issues with thumbnails
56 |
57 | = 1.6.4 =
58 | - Fix for preview URL escaping issue.
59 | - Expose dependencies manipulation filters.
60 |
61 | = 1.6.3 =
62 | - Fix for link contents render after editing.
63 | - Fix for certain characters cutting shortcode too short.
64 |
65 | = 1.6.2 =
66 | - Fix for group document uploads.
67 | - Fix for potential CSRF issue and attribute escaping.
68 | - Some cleanup.
69 |
70 | = 1.6.1 =
71 | - Added ability to auto-clean up unused images.
72 | - Some code tweaks and fixes.
73 |
74 | = 1.6 =
75 | - Added themes and the settings page.
76 | - Added EXIF orientation support.
77 | - Better OpenGraph support for link sharing.
78 |
79 | = 1.5 =
80 | - Trimming images for auto-innjected breaks.
81 | - Link type hrefs target assigned for external and all keywords.
82 | - Refactoring the deprecated resizing mehtod.
83 | - Fixing BuddyPress theme compat layer updates.
84 |
85 | = 1.4.1 =
86 | - Fix for shortcodes appearing in activity RSS feeds.
87 | - Wrapping initialization in mobile browser detection stub.
88 | - File name sanitization (thanks, buzug).
89 |
90 | = 1.4 =
91 | - Fixed conflict with duplicated uploader dependencies.
92 | - Prepared the uploader for l10n.
93 | - Added image limit define.
94 | - Added protocol replacement.
95 |
96 | = 1.3.1 =
97 | - Added URL scheme prefixing for links that miss it.
98 | - Added switch for disabling Thickbox.
99 | - Added waiting indicator for link and video processing.
100 | - Enter in video/link input triggers preview.
101 |
102 |
103 | = 1.3 =
104 | - Included missing file resource.
105 | - Re-styled the interface so the icons can be easily changed.
106 | - Added support for theme to force its own styles.
107 | - Added OpenGraph image support to link image detection.
108 | - Added option for overriding the default thumbnail image.
109 |
110 | = 1.2.1 =
111 | BuddyPress v1.5 compatibility update.
112 |
113 | = 1.2 =
114 | * Clearer display of cancel button vs. old 'X' icon
115 | * Progress indicator for file uploads
116 | * Integration with Group Documents plugin.
117 |
118 | = 1.1 =
119 | * Added remote image support.
120 | * Upload images cancels out remote image embedding, and vice versa.
121 | * Remote url input width fix.
122 | * Added support for user-defined oEmbed width.
123 | * Added "no thumbnail" option for link sharing.
124 |
125 | = 1.0 =
126 | Initial Release
127 |
--------------------------------------------------------------------------------
/languages/bpfb-default.po:
--------------------------------------------------------------------------------
1 | # Copyright (C) 2017
2 | # This file is distributed under the same license as the package.
3 | msgid ""
4 | msgstr ""
5 | "Project-Id-Version: Activity Plus\n"
6 | "Report-Msgid-Bugs-To: \n"
7 | "POT-Creation-Date: 2017-09-13 04:34:37+00:00\n"
8 | "MIME-Version: 1.0\n"
9 | "Content-Type: text/plain; charset=utf-8\n"
10 | "Content-Transfer-Encoding: 8bit\n"
11 | "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12 | "Last-Translator: FULL NAME \n"
13 | "Language-Team: LANGUAGE \n"
14 | "X-Generator: grunt-wp-i18n1.0.0\n"
15 |
16 | #: bpfb.php:50
17 | msgid ""
18 | "There was an issue determining where BuddyPress Activity Plus plugin is "
19 | "installed. Please reinstall."
20 | msgstr ""
21 |
22 | #: lib/bpfb_group_documents.php:48
23 | msgid "Add documents"
24 | msgstr ""
25 |
26 | #: lib/bpfb_group_documents.php:49
27 | msgid "Please select a group to upload to"
28 | msgstr ""
29 |
30 | #: lib/bpfb_group_documents.php:201
31 | msgid "%s uploaded new file(s): %s to %s"
32 | msgstr ""
33 |
34 | #: lib/class_bpfb_admin_pages.php:32
35 | msgid "BuddyPress Activity Plus"
36 | msgstr ""
37 |
38 | #: lib/class_bpfb_admin_pages.php:33
39 | msgid "Activity Plus"
40 | msgstr ""
41 |
42 | #: lib/class_bpfb_admin_pages.php:92
43 | msgid "Appearance"
44 | msgstr ""
45 |
46 | #: lib/class_bpfb_admin_pages.php:96
47 | msgid ""
48 | "Your BuddyPress theme incorporates Activity Plus style overrides. "
49 | "Respecting the selection you make in the "Appearance" section is "
50 | "entirely up to your theme."
51 | msgstr ""
52 |
53 | #: lib/class_bpfb_admin_pages.php:101
54 | msgid "Theme"
55 | msgstr ""
56 |
57 | #: lib/class_bpfb_admin_pages.php:105
58 | msgid "Default (legacy)"
59 | msgstr ""
60 |
61 | #: lib/class_bpfb_admin_pages.php:110
62 | msgid "New"
63 | msgstr ""
64 |
65 | #: lib/class_bpfb_admin_pages.php:115
66 | msgid "Round"
67 | msgstr ""
68 |
69 | #: lib/class_bpfb_admin_pages.php:119
70 | msgid "Alignment"
71 | msgstr ""
72 |
73 | #: lib/class_bpfb_admin_pages.php:122
74 | msgid "Left"
75 | msgstr ""
76 |
77 | #: lib/class_bpfb_admin_pages.php:126
78 | msgid "Right"
79 | msgstr ""
80 |
81 | #: lib/class_bpfb_admin_pages.php:133
82 | msgid "Functional"
83 | msgstr ""
84 |
85 | #: lib/class_bpfb_admin_pages.php:136
86 | msgid "oEmbed"
87 | msgstr ""
88 |
89 | #: lib/class_bpfb_admin_pages.php:139
90 | msgid ""
91 | "Your oEmbed dimensions will be dictated by the "
92 | "BPFB_OEMBED_WIDTH define value (%s). Remove this define to "
93 | "enable this option."
94 | msgstr ""
95 |
96 | #: lib/class_bpfb_admin_pages.php:143 lib/class_bpfb_admin_pages.php:155
97 | msgid "Width"
98 | msgstr ""
99 |
100 | #: lib/class_bpfb_admin_pages.php:148
101 | msgid "Image thumbnails"
102 | msgstr ""
103 |
104 | #: lib/class_bpfb_admin_pages.php:151
105 | msgid ""
106 | "Your thumbnail dimensions will be dictated by the "
107 | "BPFB_THUMBNAIL_IMAGE_SIZE define value (%s). Remove this "
108 | "define to enable these options."
109 | msgstr ""
110 |
111 | #: lib/class_bpfb_admin_pages.php:159
112 | msgid "Height"
113 | msgstr ""
114 |
115 | #: lib/class_bpfb_admin_pages.php:164
116 | msgid "Misc"
117 | msgstr ""
118 |
119 | #: lib/class_bpfb_admin_pages.php:167
120 | msgid "Clean up images?"
121 | msgstr ""
122 |
123 | #: lib/class_bpfb_admin_pages.php:174
124 | msgid "Save"
125 | msgstr ""
126 |
127 | #: lib/class_bpfb_binder.php:174
128 | msgid "Add images"
129 | msgstr ""
130 |
131 | #: lib/class_bpfb_binder.php:175
132 | msgid "Submit images post"
133 | msgstr ""
134 |
135 | #: lib/class_bpfb_binder.php:176
136 | msgid "Add image URL"
137 | msgstr ""
138 |
139 | #: lib/class_bpfb_binder.php:177
140 | msgid "Add another image URL"
141 | msgstr ""
142 |
143 | #: lib/class_bpfb_binder.php:178
144 | msgid "Add videos"
145 | msgstr ""
146 |
147 | #: lib/class_bpfb_binder.php:179
148 | msgid "Submit video post"
149 | msgstr ""
150 |
151 | #: lib/class_bpfb_binder.php:180
152 | msgid "Add links"
153 | msgstr ""
154 |
155 | #: lib/class_bpfb_binder.php:181
156 | msgid "Submit link post"
157 | msgstr ""
158 |
159 | #: lib/class_bpfb_binder.php:182
160 | msgid "Add"
161 | msgstr ""
162 |
163 | #: lib/class_bpfb_binder.php:183
164 | msgid "Cancel"
165 | msgstr ""
166 |
167 | #: lib/class_bpfb_binder.php:184
168 | msgid "Preview"
169 | msgstr ""
170 |
171 | #: lib/class_bpfb_binder.php:185
172 | msgid "Drop files here to upload"
173 | msgstr ""
174 |
175 | #: lib/class_bpfb_binder.php:186
176 | msgid "Upload a file"
177 | msgstr ""
178 |
179 | #: lib/class_bpfb_binder.php:187
180 | msgid "Choose thumbnail"
181 | msgstr ""
182 |
183 | #: lib/class_bpfb_binder.php:188
184 | msgid "No thumbnail"
185 | msgstr ""
186 |
187 | #: lib/class_bpfb_binder.php:189
188 | msgid "Paste video URL here"
189 | msgstr ""
190 |
191 | #: lib/class_bpfb_binder.php:190
192 | msgid "Paste link here"
193 | msgstr ""
194 |
195 | #: lib/class_bpfb_binder.php:191
196 | msgid "You tried to add too many images, only %d will be posted."
197 | msgstr ""
198 |
199 | #: lib/class_bpfb_binder.php:217 lib/class_bpfb_binder.php:234
200 | msgid "There has been an error processing your request"
201 | msgstr ""
202 |
203 | #: lib/class_bpfb_binder.php:218 lib/class_bpfb_binder.php:235
204 | msgid "Processing..."
205 | msgstr ""
--------------------------------------------------------------------------------
/lib/external/file_uploader.php:
--------------------------------------------------------------------------------
1 | getSize()){
18 | return false;
19 | }
20 |
21 | $target = fopen($path, "w");
22 | fseek($temp, 0, SEEK_SET);
23 | stream_copy_to_stream($temp, $target);
24 | fclose($target);
25 |
26 | return true;
27 | }
28 | function getName() {
29 | return $_GET['qqfile'];
30 | }
31 | function getSize() {
32 | if (isset($_SERVER["CONTENT_LENGTH"])){
33 | return (int)$_SERVER["CONTENT_LENGTH"];
34 | } else {
35 | //throw new Exception('Getting content length is not supported.');
36 | return false;
37 | }
38 | }
39 | }
40 |
41 | /**
42 | * Handle file uploads via regular form post (uses the $_FILES array)
43 | */
44 | class qqUploadedFileForm {
45 | /**
46 | * Save the file to the specified path
47 | * @return boolean TRUE on success
48 | */
49 | function save($path) {
50 | if(!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path)){
51 | return false;
52 | }
53 | return true;
54 | }
55 | function getName() {
56 | return $_FILES['qqfile']['name'];
57 | }
58 | function getSize() {
59 | return $_FILES['qqfile']['size'];
60 | }
61 | }
62 |
63 | class qqFileUploader {
64 | var $allowedExtensions = array();
65 | var $sizeLimit = 10485760;
66 | var $file;
67 |
68 | function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
69 | $allowedExtensions = array_map("strtolower", $allowedExtensions);
70 |
71 | $this->allowedExtensions = $allowedExtensions;
72 | $this->sizeLimit = $sizeLimit;
73 |
74 | //$this->checkServerSettings();
75 |
76 | if (isset($_GET['qqfile'])) {
77 | $this->file = new qqUploadedFileXhr();
78 | } elseif (isset($_FILES['qqfile'])) {
79 | $this->file = new qqUploadedFileForm();
80 | } else {
81 | $this->file = false;
82 | }
83 | }
84 |
85 | function checkServerSettings(){
86 | $postSize = $this->toBytes(ini_get('post_max_size'));
87 | $uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
88 |
89 | if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
90 | $size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
91 | die("{'error':'increase post_max_size and upload_max_filesize to $size'}");
92 | }
93 | }
94 |
95 | function toBytes($str){
96 | $val = trim($str);
97 | $last = strtolower($str[strlen($str)-1]);
98 | switch($last) {
99 | case 'g': $val *= 1024;
100 | case 'm': $val *= 1024;
101 | case 'k': $val *= 1024;
102 | }
103 | return $val;
104 | }
105 |
106 | /**
107 | * Returns array('success'=>true, 'file'=>$filename) or array('error'=>'error message')
108 | */
109 | function handleUpload($uploadDirectory, $replaceOldFile = FALSE){
110 | if (!is_writable($uploadDirectory)){
111 | return array('error' => "Server error. Upload directory isn't writable.");
112 | }
113 |
114 | if (!$this->file){
115 | return array('error' => 'No files were uploaded.');
116 | }
117 |
118 | $size = $this->file->getSize();
119 |
120 | if ($size == 0) {
121 | return array('error' => 'File is empty');
122 | }
123 |
124 | if ($size > $this->sizeLimit) {
125 | return array('error' => 'File is too large');
126 | }
127 |
128 | $pathinfo = pathinfo($this->file->getName());
129 | $filename = strtolower($pathinfo['filename']);
130 | //$filename = md5(uniqid());
131 | $ext = strtolower($pathinfo['extension']);
132 |
133 | if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
134 | $these = implode(', ', $this->allowedExtensions);
135 | return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
136 | }
137 |
138 | if(!$replaceOldFile){
139 | /// don't overwrite previous files that were uploaded
140 | while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
141 | $filename .= rand(10, 99);
142 | }
143 | }
144 | $filename = sanitize_file_name($filename);
145 |
146 | if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){
147 | return array('success'=>true, 'file'=> $filename . '.' . $ext);
148 | } else {
149 | return array('error'=> 'Could not save uploaded file.' .
150 | 'The upload was cancelled, or server error encountered');
151 | }
152 |
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/lib/class_bpfb_codec.php:
--------------------------------------------------------------------------------
1 | false,
19 | 'title' => false,
20 | 'image' => false,
21 | ), $atts));
22 | if (!$url) return '';
23 |
24 | $template = locate_template(array('link_tag_template.php'));
25 | if (empty($template)) $template = BPFB_PLUGIN_BASE_DIR . '/lib/forms/link_tag_template.php';
26 |
27 | ob_start();
28 | @include $template;
29 | $out = ob_get_clean();
30 | return $out;
31 | }
32 |
33 | /**
34 | * Creates the proper shortcode tag based on the submitted data.
35 | */
36 | function create_link_tag ($url, $title, $body='', $image='') {
37 | if (!$url) return '';
38 | $title = $this->_escape_shortcode($title);
39 | $body = !empty($body) ? $this->_escape_shortcode($body) : $title;
40 | $title = esc_attr($title);
41 | $image = esc_url($image);
42 | $url = esc_url($url);
43 | return "[bpfb_link url='{$url}' title='{$title}' image='{$image}']{$body}[/bpfb_link]";
44 | }
45 |
46 | /**
47 | * Escape shortcode-breaking characters.
48 | *
49 | * @param string $string String to process
50 | *
51 | * @return string
52 | */
53 | private function _escape_shortcode ($string='') {
54 | if (empty($string)) return $string;
55 |
56 | $string = preg_replace('/' . preg_quote('[', '/') . '/', '[', $string);
57 | $string = preg_replace('/' . preg_quote(']', '/') . '/', ']', $string);
58 |
59 | return $string;
60 | }
61 |
62 | /**
63 | * Processes video-type shortcode and create proper markup.
64 | * Relies on `wp_oembed_get()` for markup rendering.
65 | */
66 | function process_video_tag ($atts, $content) {
67 | return wp_oembed_get($content, array('width' => Bpfb_Data::get('oembed_width', 450)));
68 | }
69 |
70 | /**
71 | * Creates the proper shortcode tag based on the submitted data.
72 | */
73 | function create_video_tag ($url) {
74 | if (!$url) return '';
75 | $url = preg_match('/^https?:\/\//i', $url) ? $url : BPFB_PROTOCOL . $url;
76 | $url = esc_url($url);
77 | return "[bpfb_video]{$url}[/bpfb_video]";
78 | }
79 |
80 | /**
81 | * Processes images-type shortcode and create proper markup.
82 | * Relies on ./forms/images_tag_template.php for markup rendering.
83 | */
84 | function process_images_tag ($atts, $content) {
85 | $images = self::extract_images($content);
86 | //return var_export($images,1);
87 | $activity_id = bp_get_activity_id();
88 | global $blog_id;
89 | $activity_blog_id = $blog_id;
90 | $use_thickbox = defined('BPFB_USE_THICKBOX') ? esc_attr(BPFB_USE_THICKBOX) : 'thickbox';
91 | if ($activity_id) {
92 | $activity_blog_id = bp_activity_get_meta($activity_id, 'bpfb_blog_id');
93 | }
94 |
95 | $template = locate_template(array('images_tag_template.php'));
96 | if (empty($template)) $template = BPFB_PLUGIN_BASE_DIR . '/lib/forms/images_tag_template.php';
97 |
98 | ob_start();
99 | @include $template;
100 | $out = ob_get_clean();
101 | return $out;
102 | }
103 |
104 | /**
105 | * Creates the proper shortcode tag based on the submitted data.
106 | */
107 | function create_images_tag ($imgs) {
108 | if (!$imgs) return '';
109 | if (!is_array($imgs)) $imgs = array($imgs);
110 | return "[bpfb_images]\n" . join("\n", $imgs) . "\n[/bpfb_images]";
111 | }
112 |
113 | /**
114 | * Wrap shortcode execution in a quick check.
115 | *
116 | * @param string $content Content to check for shortcode and process accordingly
117 | *
118 | * @return string
119 | */
120 | public function do_shortcode ($content='') {
121 | if (false === strpos($content, '[bpfb_')) return $content;
122 |
123 | remove_filter('bp_get_activity_content_body', 'stripslashes_deep', 5); // Drop this because we'll be doing this right now
124 | $content = stripslashes_deep($content); // ... and process immediately, before allowing shortcode processing
125 |
126 | return do_shortcode($content);
127 | }
128 |
129 | /**
130 | * Registers shotcode processing procedures.
131 | */
132 | public static function register () {
133 | $me = new BpfbCodec;
134 | add_shortcode('bpfb_link', array($me, 'process_link_tag'));
135 | add_shortcode('bpfb_video', array($me, 'process_video_tag'));
136 | add_shortcode('bpfb_images', array($me, 'process_images_tag'));
137 |
138 | // A fix for Ray's "oEmbed for BuddyPress" and similar plugins
139 | add_filter('bp_get_activity_content_body', array($me, 'do_shortcode'), 1);
140 | // RSS feed processing
141 | add_filter('bp_get_activity_feed_item_description', 'do_shortcode');
142 | }
143 |
144 | /**
145 | * Checks whether we have an images list shortcode in content.
146 | * @param string $content String to check
147 | * @return boolean
148 | */
149 | public static function has_images ($content) {
150 | return has_shortcode($content, 'bpfb_images');
151 | }
152 |
153 | /**
154 | * Extracts images from shortcode content.
155 | * @param string $shortcode_content Shortcode contents
156 | * @return array
157 | */
158 | public static function extract_images ($shortcode_content) {
159 | return explode("\n", trim(strip_tags($shortcode_content)));
160 | }
161 | }
--------------------------------------------------------------------------------
/css/external/font/bpfb.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/bpfb.php:
--------------------------------------------------------------------------------
1 | 232,
116 | 'name' => 'BuddyPress Activity Plus',
117 | 'screens' => array(
118 | 'settings_page_bpfb-settings',
119 | ),
120 | );
121 | require_once BPFB_PLUGIN_BASE_DIR . '/lib/external/dash/wpmudev-dash-notification.php';
122 | }
123 | require_once BPFB_PLUGIN_BASE_DIR . '/lib/class_bpfb_admin_pages.php';
124 | Bpfb_Admin::serve();
125 | }
126 |
127 | do_action('bpfb_init');
128 | BpfbBinder::serve();
129 | }
130 | // Only fire off if BP is actually loaded.
131 | add_action('bp_loaded', 'bpfb_plugin_init');
132 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BuddyPress Activity+
2 |
3 | **INACTIVE NOTICE: This plugin is unsupported by WPMUDEV, we've published it here for those technical types who might want to fork and maintain it for their needs.**
4 |
5 | ## Translations
6 |
7 | Translation files can be found at https://github.com/wpmudev/translations
8 |
9 | ## Fast powerful image, video and link sharing for BuddyPress.
10 |
11 |
12 |
13 | 
14 |
15 | Integrate easy access to video, image and link sharing.
16 |
17 | ### Easy Sharing
18 |
19 | Add a set of buttons that make it easy to share content from across the web. Simplify video embed, photo sharing and content linking. Preview embedded content before posting, add your own commentary and auto-pull titles, descriptions and thumbnails. There's no configuration needed – just activate the plugin and allow your users to start sharing.
20 |
21 | 
22 |
23 | Use a built-in style or create your own.
24 |
25 | ### Styles That Fit
26 |
27 | Choose one of the included button style that best fits your theme. Button designs include Legacy, Modern and rounded. Or follow the simple customization guide and craft buttons that perfectly fit your design aesthetic.
28 |
29 | 
30 |
31 | Autofill title and description and choose a thumbnail.
32 |
33 | ### Complete Control
34 |
35 | Configuration tools are super easy to use from toggle theme and alignment selection to oEmbed and thumbnail size setup. All the BuddyPress Activity + settings can be accessed from one simple settings page.
36 |
37 | ## Usage
38 |
39 | ### To Get Started:
40 |
41 | Start by reading [Installing Plugins](https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/) section in our [comprehensive WordPress and WordPress Multisite Manual](https://premium.wpmudev.org/wpmu-manual/) if you are new to WordPress.
42 |
43 | ### To Install:
44 |
45 | 1. Download the plugin file
46 |
47 | 2. Unzip the file into a folder on your hard drive
48 |
49 | 3. Upload the **_/_buddypress-activity-plus****_/_** folder and all its contents to the **/wp-content/plugins/** folder on your site
50 |
51 | 4. Login to your admin panel for WordPress or Multisite and activate the plugin:
52 |
53 | * On regular WordPress installs - visit **Plugins** and **Activate** the plugin.
54 | * For WordPress Multisite installs - visit **Network Admin -> Plugins** and **Network Activate** the plugin.
55 |
56 | 5\. Once installed and activated, you will see a new menu item in your admin at Settings > Activity Plus.
57 |
58 | ### Configuring Settings
59 |
60 | Basic settings can be configured at Settings > Activity Plus.
61 |
62 | 
63 |
64 | 1. Theme
65 | 2\. Alignment
66 | 3. oEmbed Width
67 | 4. Image thumbnail dimensions
68 |
69 | 1\. Select a _Theme_ to be used for the icons.
70 |
71 | 2\. Choose the _Alignment_, either Left or Right. This alignment setting will be used for the posted media.
72 |
73 | 3\. Specify the _oEmbed Width_, which will be the width of any media files such as videos. The height of the media will adjust to accommodate the width.
74 |
75 | 4\. Specify the _Image thumbnail dimensions_, both Width and Height, to be used for thumbnail images for the posted media. Now let's take a look at further customization options.
76 |
77 | ### Usage and Customization
78 |
79 | You can also use custom icons in your theme, simply use add_theme_support("bpfb_toolbar_icons"); in your functions.php, copy over the rules from css/bpfb_toolbar.css and edit to suit your needs. Alternatively, if you're OK with 32x32 icon sizes, you can just override the icons in your stylesheet using background property and !important. These are the IDs: #bpfb_addPhotos, #bpfb_addVideos, #bpfb_addLinks, #bpfb_addDocuments You can also set your preferred thumbnail size separately from your default thumbnail size settings, if you wish to do so. You can do that by adding this line to your wp-config.php: `define('BPFB_THUMBNAIL_IMAGE_SIZE', '200x200');` Where "200x200" are width and height (in that order), in pixels. Finally, be sure to verify your default sizes for embedded media. It's in Settings -> Media -> Embeds -> Maximum embed size There are a few additional constants that you can override in your _wp-config.php_ file to further customize how the plugin functions. Add the following to wp-config.php to override oEmbed width: `define('BPFB_OEMBED_WIDTH', 450, true);` Add the following to wp-config.php to increase/decrease the number of allowed images per activity item: `define('BPFB_IMAGE_LIMIT', 5, true);` Add the following to wp-config.php to open links in a new window: `define('BPFB_LINKS_TARGET', true);`
80 |
81 | ### User Experience
82 |
83 | Here are a few screenshots of what this plugin could look like on your site for your users (depending on your theme of course).
84 |
85 | 
86 |
87 | Adding an image to an activity update.
88 |
89 |
90 |
91 | 
92 |
93 | Image added to update.
94 |
95 |
96 |
97 | 
98 |
99 | Adding a video to an activity update.
100 |
101 |
102 |
103 | 
104 |
105 | Video added to update.
106 |
107 |
108 |
109 | 
110 |
111 | Adding a link to an activity update.
112 |
113 |
114 |
115 | 
116 |
117 | Link added to update.
118 |
119 | ### Known Issues
120 |
121 | When using the plugin in combination with BuddyPress Media, a conflict can arise due to the activity stream upload, since both the plugins are trying to upload media through the activity stream. If you want to use the BuddyPress Activity Plus functionality, uncheck "Enable Activity Uploading" on the BuddyPress Media Settings Page.
122 |
--------------------------------------------------------------------------------
/lib/class_bpfb_admin_pages.php:
--------------------------------------------------------------------------------
1 | _capability = bp_core_do_network_admin()
10 | ? 'manage_network_options'
11 | : 'manage_options'
12 | ;
13 | }
14 |
15 | public static function serve () {
16 | $me = new self;
17 | $me->_add_hooks();
18 | }
19 |
20 | private function _add_hooks () {
21 | add_action(bp_core_admin_hook(), array($this, 'add_menu_page'));
22 | add_action('admin_enqueue_scripts', array($this, 'enqueue_dependencies'));
23 | }
24 |
25 | public function add_menu_page () {
26 | $hook = bp_core_do_network_admin()
27 | ? 'settings.php'
28 | : 'options-general.php'
29 | ;
30 | $this->_page_hook = add_submenu_page(
31 | $hook,
32 | __('BuddyPress Activity Plus', 'bpfb'),
33 | __('Activity Plus', 'bpfb'),
34 | $this->_capability,
35 | 'bpfb-settings',
36 | array($this, 'settings_page')
37 | );
38 |
39 | $this->_save_settings();
40 | }
41 |
42 | public function enqueue_dependencies ($hook) {
43 | if ($hook !== $this->_page_hook) return false;
44 | wp_enqueue_style('bpfb-admin', BPFB_PLUGIN_URL . '/css/admin.css');
45 | }
46 |
47 | private function _save_settings () {
48 | if (empty($_POST['bpfb'])) return false;
49 | if (!current_user_can($this->_capability)) return false;
50 | if (!check_ajax_referer($this->_page_hook)) return false;
51 |
52 | $raw = stripslashes_deep($_POST['bpfb']);
53 | list($thumb_w,$thumb_h) = Bpfb_Data::get_thumbnail_size(true);
54 | $raw['thumbnail_size_height'] = !empty($raw['thumbnail_size_height']) && (int)$raw['thumbnail_size_height']
55 | ? (int)$raw['thumbnail_size_height']
56 | : $thumb_h
57 | ;
58 | $raw['thumbnail_size_width'] = !empty($raw['thumbnail_size_width']) && (int)$raw['thumbnail_size_width']
59 | ? (int)$raw['thumbnail_size_width']
60 | : $thumb_w
61 | ;
62 | $raw['oembed_width'] = !empty($raw['oembed_width']) && (int)$raw['oembed_width']
63 | ? (int)$raw['oembed_width']
64 | : Bpfb_Data::get('oembed_width')
65 | ;
66 | $raw['theme'] = !empty($raw['theme'])
67 | ? sanitize_html_class($raw['theme'])
68 | : ''
69 | ;
70 | $raw['cleanup_images'] = !empty($raw['cleanup_images'])
71 | ? (int)$raw['cleanup_images']
72 | : false
73 | ;
74 |
75 | update_option('bpfb', $raw);
76 | wp_safe_redirect(add_query_arg(array('updated' => true)));
77 | }
78 |
79 | public function settings_page () {
80 | $theme = Bpfb_Data::get('theme');
81 | list($thumb_w,$thumb_h) = Bpfb_Data::get_thumbnail_size();
82 | $oembed_width = Bpfb_Data::get('oembed_width', 450);
83 | $alignment = Bpfb_Data::get('alignment', 'left');
84 | $cleanup_images = Bpfb_Data::get('cleanup_images', false);
85 | ?>
86 |
87 |
88 |
89 |
177 |
178 | _add_hooks();
15 | }
16 |
17 | private function _add_hooks () {
18 | add_action('bpfb_add_ajax_hooks', array($this, 'add_ajax_hooks_handler'));
19 | add_action('bpfb_add_cssjs_hooks', array($this, 'add_cssjs_hooks_handler'));
20 | add_action('bpfb_code_before_save', array($this, 'code_before_save_handler'));
21 | add_action('bpfb_init', array($this, 'create_core_defines'));
22 | }
23 |
24 | /**
25 | * Registers required AJAX handlers.
26 | */
27 | public function add_ajax_hooks_handler () {
28 | add_action('wp_ajax_bpfb_preview_document', array($this, 'ajax_preview_document'));
29 | add_action('wp_ajax_bpfb_remove_temp_documents', array($this, 'ajax_remove_temp_documents'));
30 | }
31 |
32 | public function add_js_globals () {
33 | printf(
34 | '',
35 | '"' . join('", "', array_map('trim', explode(',', BPFB_DOCUMENTS_ALLOWED_EXTENSIONS))) . '"'
36 | );
37 | }
38 |
39 | /**
40 | * Injects required interface scripts.
41 | */
42 | public function add_cssjs_hooks_handler () {
43 | if (!defined('BP_GROUP_DOCUMENTS_IS_INSTALLED') || !BP_GROUP_DOCUMENTS_IS_INSTALLED) return false;
44 |
45 | add_action('wp_print_scripts', array($this, 'add_js_globals'));
46 | wp_enqueue_script('bpfb_group_documents', BPFB_PLUGIN_URL . '/js/bpfb_group_documents.js', array('bpfb_interface_script'));
47 | wp_localize_script('bpfb_group_documents', 'l10nBpfbDocs', array(
48 | 'add_documents' => __('Add documents', 'bpfb'),
49 | 'no_group_selected' => __('Please select a group to upload to', 'bpfb'),
50 | ));
51 | }
52 |
53 | /**
54 | * Handles document upload preview
55 | */
56 | public function ajax_preview_document () {
57 | $dir = BPFB_PLUGIN_BASE_DIR . '/img/';
58 | if (!class_exists('qqFileUploader')) require_once(BPFB_PLUGIN_BASE_DIR . '/lib/external/file_uploader.php');
59 | $uploader = new qqFileUploader(array_map('trim', explode(',', BPFB_DOCUMENTS_ALLOWED_EXTENSIONS)));
60 | $result = $uploader->handleUpload(BPFB_TEMP_IMAGE_DIR);
61 |
62 | if ($result['file']) {
63 | $doc_obj = new BP_Group_Documents();
64 | $doc_obj->file = $result['file'];
65 | $result['icon'] = $doc_obj->get_icon();
66 | }
67 | echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
68 | exit();
69 | }
70 |
71 | /**
72 | * Checks upload permissions.
73 | * Adapted from Group Documents plugin.
74 | */
75 | public function allowed ($group=false) {
76 | if (!$group) return false;
77 |
78 | $user = wp_get_current_user();
79 | $moderator_of = BP_Groups_Member::get_is_admin_of($user->ID) + BP_Groups_Member::get_is_mod_of($user->ID);
80 | $moderator_of = (is_array($moderator_of) && isset($moderator_of['groups'])) ? $moderator_of['groups'] : false;
81 |
82 | $is_mod = false;
83 | foreach ($moderator_of as $gm) {
84 | if ($gm->id == $group->id) {
85 | $is_mod = true; break;
86 | }
87 | }
88 |
89 | switch (get_option( 'bp_group_documents_upload_permission')) {
90 | case 'mods_decide':
91 | switch (groups_get_groupmeta( $group->id, 'group_documents_upload_permission')) {
92 | case 'mods_only':
93 | if ($is_mod) return true;
94 | break;
95 | case 'members':
96 | default:
97 | if (groups_is_user_member($user->ID, $group->id)) return true;
98 | break;
99 | }
100 | break;
101 | case 'mods_only':
102 | if ($is_mod) return true;
103 | break;
104 | case 'members':
105 | default:
106 | if (groups_is_user_member($user->ID, $group->id)) return true;
107 | break;
108 | }
109 | return false;
110 | }
111 |
112 | /**
113 | * Handles save request.
114 | */
115 | public function code_before_save_handler ($code) {
116 | $data = !empty($_POST['data']) ? stripslashes_deep($_POST['data']) : array();
117 | if (!empty($data['bpfb_documents'])) {
118 | $docs = $this->move($data['bpfb_documents']);
119 | $code = $this->create_documents_tag($docs);
120 | }
121 | return $code;
122 | }
123 |
124 | /**
125 | * Clears up the temporary documents storage.
126 | */
127 | public function ajax_remove_temp_documents () {
128 | header('Content-type: application/json');
129 | parse_str($_POST['data'], $data);
130 | $data = is_array($data) ? $data : array('bpfb_documents'=>array());
131 | foreach ($data['bpfb_documents'] as $file) {
132 | $path = BpfbBinder::resolve_temp_path($file);
133 | if (!empty($path)) @unlink($path);
134 | }
135 | echo json_encode(array('status'=>'ok'));
136 | exit();
137 | }
138 |
139 | /**
140 | * Moves the documents to a place recognized by Group Documents plugin
141 | * and saves them.
142 | */
143 | public function move ($docs) {
144 | if (!$docs) return false;
145 | if (!is_array($docs)) $docs = array($docs);
146 |
147 | if (!(int)@$_POST['group_id']) return false;
148 |
149 | $group = new BP_Groups_Group((int)@$_POST['group_id']);
150 | if (!$this->allowed($group)) return false;
151 |
152 | global $bp;
153 | $ret = array();
154 |
155 | // Construct the needed data
156 | $user = wp_get_current_user();
157 | $data = array (
158 | 'user_id' => $user->ID,
159 | 'group_id' => (int)@$_POST['group_id'],
160 | 'created_ts' => time(),
161 | 'modified_ts' => time(),
162 | 'file' => '',
163 | 'name' => '',
164 | 'description' => @$_POST['content'],
165 | );
166 |
167 | foreach ($docs as $doc) {
168 | $doc_obj = new BP_Group_Documents();
169 | foreach ($data as $key=>$val) {
170 | $doc_obj->$key = $val;
171 | }
172 | $doc_obj->name = $doc;
173 | $doc_obj->file = apply_filters('bp_group_documents_filename_in', $doc);
174 |
175 | $tmp_doc = realpath(BPFB_TEMP_IMAGE_DIR . $doc);
176 | $new_doc = $doc_obj->get_path(0,1);
177 |
178 | if (@rename($tmp_doc, $new_doc) && $doc_obj->save(false)) {
179 | $ret[] = $doc_obj;
180 | }
181 | }
182 |
183 | return $ret;
184 | }
185 |
186 | /**
187 | * Creates the activity info message.
188 | * No shortcode, just renders the appropriate HTML.
189 | */
190 | public function create_documents_tag ($docs) {
191 | if (!$docs || !is_array($docs)) return false;
192 |
193 | global $bp;
194 | $uploaded = array();
195 | $group = false;
196 | foreach ($docs as $doc) {
197 | if (!$group) $group = new BP_Groups_Group($doc->group_id);
198 | $uploaded[] = '' . esc_attr($doc->name) . '';
199 | }
200 | return sprintf(
201 | __('%s uploaded new file(s): %s to %s', 'bpfb'),
202 | bp_core_get_userlink($bp->loggedin_user->id),
203 | join(', ', $uploaded),
204 | '' . bp_get_group_name($group) . ''
205 | );
206 | }
207 |
208 | public function create_core_defines () {
209 | if (!defined('BPFB_DOCUMENTS_ALLOWED_EXTENSIONS')) {
210 | $exts = get_option('bp_group_documents_valid_file_formats');
211 | if ($exts) {
212 | define('BPFB_DOCUMENTS_ALLOWED_EXTENSIONS', $exts);
213 | } else {
214 | /**
215 | * This define is a list of allowed file extensions.
216 | * It can be overriden in wp-config.php
217 | */
218 | define(
219 | 'BPFB_DOCUMENTS_ALLOWED_EXTENSIONS',
220 | 'adp, as, avi, bash, bz, bz2, c, cf, cpp, cs, css, deb, doc, docx, eps, exe, fh, fl, gif, gz, htm, html, iso, java, jpeg, jpg, json, m4a, mov, mdb, mp3, mpeg, msp, ods, odt, ogg, perl, pdf, php, png, ppt, pps, pptx, ps, rb, rtf, sh, sql, swf, tar, txt, wav, xls, xlsx, xml, zip'
221 | );
222 | }
223 | }
224 | }
225 |
226 | }
227 | Bpfb_Documents::serve();
--------------------------------------------------------------------------------
/css/bpfb_toolbar.css:
--------------------------------------------------------------------------------
1 | .bpfb_toolbar_container, .bpfb_controls_container {
2 | clear: left;
3 | padding-top: 5px;
4 | }
5 | .bpfb-alignment-right .bpfb_toolbar_container, .bpfb-alignment-right .bpfb_controls_container {
6 | clear: right;
7 | }
8 |
9 | .bpfb_toolbarItem {
10 | border: none;
11 | text-decoration: none;
12 | display: block;
13 | float: left;
14 | height: 32px;
15 | width: 32px;
16 | margin-right: 1ex;
17 | overflow: hidden;
18 | }
19 | .bpfb-alignment-right .bpfb_toolbarItem {
20 | float: right;
21 | }
22 |
23 | .bpfb_toolbarItem span {
24 | display: block;
25 | position: absolute;
26 | left: -12000000000px;
27 | display: none;
28 | }
29 |
30 | #bpfb_addPhotos {
31 | background: url(../img/system/camera.png) left top no-repeat;
32 | }
33 | #bpfb_addVideos {
34 | background: url(../img/system/film.png) left top no-repeat;
35 | }
36 | #bpfb_addLinks {
37 | background: url(../img/system/link.png) left top no-repeat;
38 | }
39 | #bpfb_addDocuments {
40 | background: url(../img/system/document.png) left top no-repeat;
41 | }
42 |
43 |
44 | /* --- */
45 |
46 |
47 | /* ----- New interface ----- */
48 | .bpfb_actions_container.bpfb-theme-new .bpfb_toolbarItem,
49 | .bpfb_actions_container.bpfb-theme-new .bpfb_toolbarItem:visited,
50 | .bpfb_actions_container.bpfb-theme-new .bpfb_toolbarItem:hover
51 | {
52 | color: #5FB3C9;
53 | }
54 | .bpfb_actions_container.bpfb-theme-new .bpfb_toolbarItem:active,
55 | .bpfb_actions_container.bpfb-theme-new .bpfb_toolbarItem.bpfb_active {
56 | color: #F33;
57 | }
58 | .bpfb_actions_container.bpfb-theme-new #bpfb_addPhotos,
59 | .bpfb_actions_container.bpfb-theme-new #bpfb_addVideos,
60 | .bpfb_actions_container.bpfb-theme-new #bpfb_addLinks,
61 | .bpfb_actions_container.bpfb-theme-new #bpfb_addDocuments {
62 | background: none;
63 | font-family:'bpfb';
64 | font-size: 24px;
65 | line-height: 32px;
66 | font-weight:normal;
67 | margin-right: .5em;
68 | text-align: center;
69 | }
70 | .bpfb_actions_container.bpfb-theme-new #bpfb_addPhotos:before {content:'I';}
71 | .bpfb_actions_container.bpfb-theme-new #bpfb_addVideos:before {content:'V';}
72 | .bpfb_actions_container.bpfb-theme-new #bpfb_addLinks:before {content:'a';}
73 | .bpfb_actions_container.bpfb-theme-new #bpfb_addDocuments:before {content:'D';}
74 |
75 | /* primary button color scheme */
76 | .bpfb_actions_container.bpfb-theme-round .button-primary.bpfb_primary_button,
77 | .bpfb_actions_container.bpfb-theme-round .qq-upload-button
78 | {
79 | color: #FFFFFF;
80 | background: #5FB3C9 !important;
81 | }
82 |
83 | /* ----- Waiting animation / requires CSS3 transforms ----- */
84 | .bpfb_actions_container.bpfb-theme-new .bpfb_waiting {
85 | background: none;
86 | font-family:'bpfb';
87 | font-size: 24px;
88 | font-weight:normal;
89 | text-align: center;
90 | }
91 | .bpfb_actions_container.bpfb-theme-new .bpfb_waiting:after {
92 | display: block;
93 | content: "\2e";
94 | height: 24px;
95 | width: 24px;
96 | line-height: 24px;
97 | margin: 0 auto;
98 | -webkit-animation:bpfb_spin 1s infinite steps(8);
99 | -moz-animation:bpfb_spin 1s infinite steps(8);
100 | animation:bpfb_spin 1s infinite steps(8);
101 | }
102 | @-moz-keyframes bpfb_spin { 0% {-moz-transform: rotate(0);} 100% { -moz-transform: rotate(360deg); } }
103 | @-webkit-keyframes bpfb_spin { 0% {-webkit-transform: rotate(0);} 100% { -webkit-transform: rotate(360deg); } }
104 | @keyframes bpfb_spin { 0% {transform: rotate(0);} 100% { transform: rotate(360deg); } }
105 |
106 |
107 | .bpfb_actions_container.bpfb-theme-new div.bpfb_thumbnail_chooser img {
108 | display: none;
109 | }
110 | .bpfb_actions_container.bpfb-theme-new span.bpfb_thumbnail_chooser_label {
111 | padding: 0;
112 | }
113 |
114 | .bpfb_actions_container.bpfb-theme-new .bpfb_thumbnail_chooser {
115 | font-size: 12px;
116 | line-height: 16px;
117 | }
118 | .bpfb_actions_container.bpfb-theme-new .bpfb_thumbnail_chooser .bpfb_left:before {
119 | display: inline-block;
120 | font-size: 16px;
121 | height: 16px;
122 | width: 24px;
123 | font-family:'bpfb';
124 | content: "L";
125 | cursor: pointer;
126 | }
127 | .bpfb_actions_container.bpfb-theme-new .bpfb_thumbnail_chooser .bpfb_right:after {
128 | display: inline-block;
129 | font-size: 16px;
130 | height: 16px;
131 | width: 24px;
132 | padding-left: 1em;
133 | font-family:'bpfb';
134 | content: "R";
135 | cursor: pointer;
136 | }
137 |
138 |
139 | /* ----- Round interface ----- */
140 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem {
141 | line-height: 32px;
142 | border-radius: 32px;
143 | }
144 | .bpfb_actions_container.bpfb-theme-round #bpfb_addPhotos,
145 | .bpfb_actions_container.bpfb-theme-round #bpfb_addVideos,
146 | .bpfb_actions_container.bpfb-theme-round #bpfb_addLinks,
147 | .bpfb_actions_container.bpfb-theme-round #bpfb_addDocuments {
148 | font-family:'bpfb';
149 | font-size: 14px;
150 | font-weight: normal;
151 | margin-right: .5em;
152 | text-align: center;
153 | border: 1px solid #444;
154 | }
155 | .bpfb_actions_container.bpfb-theme-round #bpfb_addPhotos:before {content:'I';}
156 | .bpfb_actions_container.bpfb-theme-round #bpfb_addVideos:before {content:'V';}
157 | .bpfb_actions_container.bpfb-theme-round #bpfb_addLinks:before {content:'a';}
158 | .bpfb_actions_container.bpfb-theme-round #bpfb_addDocuments:before {content:'D';}
159 |
160 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem,
161 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem:visited,
162 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem:hover
163 | {
164 | color: #eee;
165 | background: #555 !important;
166 | }
167 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem:active,
168 | .bpfb_actions_container.bpfb-theme-round .bpfb_toolbarItem.bpfb_active {
169 | color: #333;
170 | background: #eee !important;
171 | border: none !important;
172 | font-size: 24px !important;
173 | }
174 | /* primary button color scheme */
175 | .bpfb_actions_container.bpfb-theme-round .button-primary.bpfb_primary_button,
176 | .bpfb_actions_container.bpfb-theme-round .qq-upload-button
177 | {
178 | color: #eee;
179 | background: #555 !important;
180 | }
181 |
182 |
183 | /* ----- Waiting animation / requires CSS3 transforms ----- */
184 | .bpfb_actions_container.bpfb-theme-round .bpfb_waiting {
185 | background: none;
186 | font-family:'bpfb';
187 | font-size: 24px;
188 | font-weight:normal;
189 | text-align: center;
190 | }
191 | .bpfb_actions_container.bpfb-theme-round .bpfb_waiting:after {
192 | display: block;
193 | content: "\2e";
194 | height: 24px;
195 | width: 24px;
196 | line-height: 24px;
197 | margin: 0 auto;
198 | -webkit-animation:bpfb_spin 1s infinite steps(8);
199 | -moz-animation:bpfb_spin 1s infinite steps(8);
200 | animation:bpfb_spin 1s infinite steps(8);
201 | }
202 | @-moz-keyframes bpfb_spin { 0% {-moz-transform: rotate(0);} 100% { -moz-transform: rotate(360deg); } }
203 | @-webkit-keyframes bpfb_spin { 0% {-webkit-transform: rotate(0);} 100% { -webkit-transform: rotate(360deg); } }
204 | @keyframes bpfb_spin { 0% {transform: rotate(0);} 100% { transform: rotate(360deg); } }
205 |
206 |
207 | .bpfb_actions_container.bpfb-theme-round div.bpfb_thumbnail_chooser img {
208 | display: none;
209 | }
210 | .bpfb_actions_container.bpfb-theme-round span.bpfb_thumbnail_chooser_label {
211 | padding: 0;
212 | }
213 |
214 | .bpfb_actions_container.bpfb-theme-round .bpfb_thumbnail_chooser {
215 | font-size: 12px;
216 | line-height: 16px;
217 | }
218 | .bpfb_actions_container.bpfb-theme-round .bpfb_thumbnail_chooser .bpfb_left:before {
219 | display: inline-block;
220 | font-size: 16px;
221 | height: 16px;
222 | width: 24px;
223 | font-family:'bpfb';
224 | content: "L";
225 | cursor: pointer;
226 | }
227 | .bpfb_actions_container.bpfb-theme-round .bpfb_thumbnail_chooser .bpfb_right:after {
228 | display: inline-block;
229 | font-size: 16px;
230 | height: 16px;
231 | width: 24px;
232 | padding-left: 1em;
233 | font-family:'bpfb';
234 | content: "R";
235 | cursor: pointer;
236 | }
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 | 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
6 |
7 | Everyone is permitted to copy and distribute verbatim copies
8 | of this license document, but changing it is not allowed.
9 |
10 | Preamble
11 |
12 | The licenses for most software are designed to take away your
13 | freedom to share and change it. By contrast, the GNU General Public
14 | License is intended to guarantee your freedom to share and change free
15 | software--to make sure the software is free for all its users. This
16 | General Public License applies to most of the Free Software
17 | Foundation's software and to any other program whose authors commit to
18 | using it. (Some other Free Software Foundation software is covered by
19 | the GNU Library General Public License instead.) You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | this service if you wish), that you receive source code or can get it
26 | if you want it, that you can change the software or use pieces of it
27 | in new free programs; and that you know you can do these things.
28 |
29 | To protect your rights, we need to make restrictions that forbid
30 | anyone to deny you these rights or to ask you to surrender the rights.
31 | These restrictions translate to certain responsibilities for you if you
32 | distribute copies of the software, or if you modify it.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must give the recipients all the rights that
36 | you have. You must make sure that they, too, receive or can get the
37 | source code. And you must show them these terms so they know their
38 | rights.
39 |
40 | We protect your rights with two steps: (1) copyright the software, and
41 | (2) offer you this license which gives you legal permission to copy,
42 | distribute and/or modify the software.
43 |
44 | Also, for each author's protection and ours, we want to make certain
45 | that everyone understands that there is no warranty for this free
46 | software. If the software is modified by someone else and passed on, we
47 | want its recipients to know that what they have is not the original, so
48 | that any problems introduced by others will not reflect on the original
49 | authors' reputations.
50 |
51 | Finally, any free program is threatened constantly by software
52 | patents. We wish to avoid the danger that redistributors of a free
53 | program will individually obtain patent licenses, in effect making the
54 | program proprietary. To prevent this, we have made it clear that any
55 | patent must be licensed for everyone's free use or not licensed at all.
56 |
57 | The precise terms and conditions for copying, distribution and
58 | modification follow.
59 |
60 | GNU GENERAL PUBLIC LICENSE
61 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
62 |
63 | 0. This License applies to any program or other work which contains
64 | a notice placed by the copyright holder saying it may be distributed
65 | under the terms of this General Public License. The "Program", below,
66 | refers to any such program or work, and a "work based on the Program"
67 | means either the Program or any derivative work under copyright law:
68 | that is to say, a work containing the Program or a portion of it,
69 | either verbatim or with modifications and/or translated into another
70 | language. (Hereinafter, translation is included without limitation in
71 | the term "modification".) Each licensee is addressed as "you".
72 |
73 | Activities other than copying, distribution and modification are not
74 | covered by this License; they are outside its scope. The act of
75 | running the Program is not restricted, and the output from the Program
76 | is covered only if its contents constitute a work based on the
77 | Program (independent of having been made by running the Program).
78 | Whether that is true depends on what the Program does.
79 |
80 | 1. You may copy and distribute verbatim copies of the Program's
81 | source code as you receive it, in any medium, provided that you
82 | conspicuously and appropriately publish on each copy an appropriate
83 | copyright notice and disclaimer of warranty; keep intact all the
84 | notices that refer to this License and to the absence of any warranty;
85 | and give any other recipients of the Program a copy of this License
86 | along with the Program.
87 |
88 | You may charge a fee for the physical act of transferring a copy, and
89 | you may at your option offer warranty protection in exchange for a fee.
90 |
91 | 2. You may modify your copy or copies of the Program or any portion
92 | of it, thus forming a work based on the Program, and copy and
93 | distribute such modifications or work under the terms of Section 1
94 | above, provided that you also meet all of these conditions:
95 |
96 | a) You must cause the modified files to carry prominent notices
97 | stating that you changed the files and the date of any change.
98 |
99 | b) You must cause any work that you distribute or publish, that in
100 | whole or in part contains or is derived from the Program or any
101 | part thereof, to be licensed as a whole at no charge to all third
102 | parties under the terms of this License.
103 |
104 | c) If the modified program normally reads commands interactively
105 | when run, you must cause it, when started running for such
106 | interactive use in the most ordinary way, to print or display an
107 | announcement including an appropriate copyright notice and a
108 | notice that there is no warranty (or else, saying that you provide
109 | a warranty) and that users may redistribute the program under
110 | these conditions, and telling the user how to view a copy of this
111 | License. (Exception: if the Program itself is interactive but
112 | does not normally print such an announcement, your work based on
113 | the Program is not required to print an announcement.)
114 |
115 | These requirements apply to the modified work as a whole. If
116 | identifiable sections of that work are not derived from the Program,
117 | and can be reasonably considered independent and separate works in
118 | themselves, then this License, and its terms, do not apply to those
119 | sections when you distribute them as separate works. But when you
120 | distribute the same sections as part of a whole which is a work based
121 | on the Program, the distribution of the whole must be on the terms of
122 | this License, whose permissions for other licensees extend to the
123 | entire whole, and thus to each and every part regardless of who wrote it.
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 |
--------------------------------------------------------------------------------
/js/bpfb_interface.js:
--------------------------------------------------------------------------------
1 | var _bpfbActiveHandler = false;
2 |
3 | (function($){
4 | $(function() {
5 |
6 | var $form;
7 | var $text;
8 | var $textContainer;
9 |
10 |
11 | /**
12 | * Video insertion/preview handler.
13 | */
14 | var BpfbVideoHandler = function () {
15 | $container = $(".bpfb_controls_container");
16 |
17 | var resize = function () {
18 | $('#bpfb_video_url').width($container.width());
19 | };
20 |
21 | var createMarkup = function () {
22 | var html = '' +
23 | '';
24 | $container.empty().append(html);
25 |
26 | $(window).off("resize.bpfb").on("resize.bpfb", resize);
27 | resize();
28 | $('#bpfb_video_url').focus(function () {
29 | $(this)
30 | .select()
31 | .addClass('changed')
32 | ;
33 | });
34 |
35 | $('#bpfb_video_url').keypress(function (e) {
36 | if (13 != e.which) return true;
37 | createVideoPreview();
38 | return false;
39 | });
40 | $('#bpfb_video_url').change(createVideoPreview);
41 | $('#bpfb_video_url_preview').click(createVideoPreview);
42 | };
43 |
44 | var createVideoPreview = function () {
45 | var url = $('#bpfb_video_url').val();
46 | if (!url) return false;
47 | $('.bpfb_preview_container').html('');
48 | $.post(ajaxurl, {"action":"bpfb_preview_video", "data":url}, function (data) {
49 | $('.bpfb_preview_container').empty().html(data);
50 | $('.bpfb_action_container').html(
51 | '