PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
← All changes | includes/features/bbpc_attachments/code/front.php +28 -28 1.2.92.2.0 View file →
@@ -51,9 +51,9 @@
51 51
52 52 add_filter( 'bbp_get_reply_content', [ $this, 'embed_attachments' ], 100, 2 );
53 53 add_filter( 'bbp_get_topic_content', [ $this, 'embed_attachments' ], 100, 2 );
54 54
55 - if ( bbpc_bba_o( 'is_attachment_icon' ) == 1 ) {
55 + if ( forumax_bba_o( 'is_attachment_icon' ) == 1 ) {
56 56 add_action( 'bbp_theme_before_topic_title', [ $this, 'show_attachments_icon' ] );
57 57 }
58 58
59 59 $this->register_scripts_and_styles();
@@ -71,11 +71,10 @@
71 71 return 'generic';
72 72 }
73 73
74 74 public function register_scripts_and_styles() {
75 - //TODO: Fix the constant for version
76 - wp_register_style( 'bbpc-attachments', BBPCATTACHMENT_URL . 'css/front.min.css', [], BBPC_VERSION );
77 - wp_register_script( 'bbpc-attachments', BBPCATTACHMENT_URL . 'js/front.min.js', [ 'jquery' ], BBPC_VERSION, true );
75 + wp_register_style( 'bbpc-attachments', BBPCATTACHMENT_URL . 'css/front.css', [], FORUMAX_VERSION );
76 + wp_register_script( 'bbpc-attachments', BBPCATTACHMENT_URL . 'js/front.js', [ 'jquery' ], FORUMAX_VERSION, true );
78 77 }
79 78
80 79 public function include_scripts_and_styles() {
81 80 wp_enqueue_style( 'bbpc-attachments' );
@@ -85,15 +84,15 @@
85 84 'bbpc-attachments',
86 85 'bbpcAttachmentsInit',
87 86 [
88 87 'max_files' => apply_filters( 'bbpc_bbpressattchment_allow_upload', BBPCATTCore::instance()->get_max_files(), bbp_get_forum_id() ),
89 - 'are_you_sure' => __( 'This operation is not reversible. Are you sure?', 'bbp-core' ),
88 + 'are_you_sure' => __( 'This operation is not reversible. Are you sure?', 'forumax' ),
90 89 ]
91 90 );
92 91 }
93 92
94 93 public function wp_enqueue_scripts() {
95 - if ( bbpc_is_bbpress() ) {
94 + if ( forumax_is_bbpress() ) {
96 95 $this->include_scripts_and_styles();
97 96 }
98 97 }
99 98
@@ -244,30 +243,30 @@
244 243 $topic_id = bbp_get_topic_id();
245 244 $count = bbpc_topic_attachments_count( $topic_id, true );
246 245
247 246 if ( $count > 0 ) {
248 - echo '<span class="bbp-attachments-count" title="' . $count . ' ' . _n( 'attachment', 'attachments', $count, 'bbp-core' ) . '"></span>';
247 + echo '<span class="bbp-attachments-count" title="' . esc_attr( $count . ' ' . _n( 'attachment', 'attachments', $count, 'forumax' ) ) . '"></span>';
249 248 }
249 +
250 250 }
251 251
252 252 public function embed_attachments( $content, $id ) {
253 253 global $user_ID;
254 254
255 - $attachments = bbpc_get_post_attachments( $id );
255 + $attachments = forumax_get_post_attachments( $id );
256 256
257 257 $post = get_post( $id );
258 258 $author_id = $post->post_author;
259 259
260 - $opt = get_option( 'bbp_core_settings' );
261 -
262 260 if ( ! empty( $attachments ) ) {
263 261 $content .= '<div class="bbp-attachments">';
264 - $content .= '<h6>' . __( 'Attachments', 'bbp-core' ) . ':</h6>';
262 + $content .= '<h6>' . __( 'Attachments', 'forumax' ) . ':</h6>';
265 263
266 264 $_download = ' download';
267 265
268 266 if ( ! is_user_logged_in() && BBPCATTCore::instance()->is_hidden_from_visitors() ) {
269 - $content .= sprintf( __( "You must be <a href='%s'>logged in</a> to view attached files.", 'bbp-core' ), wp_login_url( get_permalink() ) );
267 + /* translators: %s: Login URL */
268 + $content .= sprintf( __( "You must be <a href='%s'>logged in</a> to view attached files.", 'forumax' ), wp_login_url( get_permalink() ) );
270 269 } else {
271 270 $listing = '<ol';
272 271 $thumbnails = '<ol';
273 272
@@ -285,11 +284,11 @@
285 284 $url = add_query_arg( 'att_id', $attachment->ID, $url );
286 285 $url = add_query_arg( 'bbp_id', $id, $url );
287 286
288 287 $allow = 'no';
289 - if ( bbpc_is_user_admin() ) {
288 + if ( forumax_is_user_admin() ) {
290 289 $allow = 'delete';
291 - } elseif ( bbpc_is_user_moderator() ) {
290 + } elseif ( forumax_is_user_moderator() ) {
292 291 $allow = 'delete';
293 292 } elseif ( $author_id == $user_ID ) {
294 293 $allow = false;
295 294 }
@@ -294,13 +293,13 @@
294 293 $allow = false;
295 294 }
296 295
297 296 if ( $allow == 'delete' || $allow == 'both' ) {
298 - $actions[] = '<a class="d4p-bba-action-delete" href="' . esc_url( add_query_arg( 'd4pbbaction', 'delete', $url ) ) . '">' . __( 'delete', 'bbp-core' ) . '</a>';
297 + $actions[] = '<a class="d4p-bba-action-delete" href="' . esc_url( add_query_arg( 'd4pbbaction', 'delete', $url ) ) . '">' . __( 'delete', 'forumax' ) . '</a>';
299 298 }
300 299
301 300 if ( $allow == 'detach' || $allow == 'both' ) {
302 - $actions[] = '<a class="d4p-bba-action-detach" href="' . esc_url( add_query_arg( 'd4pbbaction', 'detach', $url ) ) . '">' . __( 'detach', 'bbp-core' ) . '</a>';
301 + $actions[] = '<a class="d4p-bba-action-detach" href="' . esc_url( add_query_arg( 'd4pbbaction', 'detach', $url ) ) . '">' . __( 'detach', 'forumax' ) . '</a>';
303 302 }
304 303
305 304 if ( count( $actions ) > 0 ) {
306 305 $actions = ' <span class="d4p-bba-actions">[' . join( ' | ', $actions ) . ']</span>';
@@ -317,15 +316,15 @@
317 316 $a_title = $filename;
318 317 $caption = false;
319 318
320 319 $is_lighbox = '';
321 - if ( bbpc_is_premium() ) {
322 - $is_lighbox = $opt['image_link_type'] == 'lightbox' ? ' bbpc-lightbox' : '';
323 - $_download = $opt['image_link_type'] == 'lightbox' ? '' : $_download;
320 + if ( forumax_is_premium() ) {
321 + $is_lighbox = forumax_get_opt( 'image_link_type' ) == 'lightbox' ? ' bbpc-lightbox' : '';
322 + $_download = forumax_get_opt( 'image_link_type' ) == 'lightbox' ? '' : $_download;
324 323 }
325 324
326 325 $img = false;
327 - if ( ( $opt['attachment_image_x'] ?? false ) && ( $opt['attachment_image_y'] ?? false ) ) {
326 + if ( forumax_get_opt( 'attachment_image_x', false ) && forumax_get_opt( 'attachment_image_y', false ) ) {
328 327 $html = wp_get_attachment_image( $attachment->ID, 'bbpc-attachment-thumb' );
329 328
330 329 if ( $html != '' ) {
331 330 $img = true;
@@ -331,9 +330,9 @@
331 330 $img = true;
332 331
333 332 $class_li = 'bbp-atthumb';
334 333
335 - $caption = bbpc_bba_o( 'image_thumbnail_caption' ) == 1;
334 + $caption = forumax_bba_o( 'image_thumbnail_caption' ) == 1;
336 335 }
337 336 }
338 337
339 338 $item = '<li id="bbpcore-attach_' . $attachment->ID . '" class="bbpcore-attach bbpcore-attachment-' . $ext . ' ' . $class_li . '">';
@@ -345,9 +344,9 @@
345 344
346 345 if ( $img ) {
347 346
348 347 if ( $caption ) {
349 - $item .= '<div style="width: ' . bbpc_bba_o( 'attachment_image_x' ) . 'px" class="wp-caption">';
348 + $item .= '<div style="width: ' . forumax_bba_o( 'attachment_image_x' ) . 'px" class="wp-caption">';
350 349 }
351 350
352 351 $item .= '<a class="' . $class_a . $is_lighbox . '" href="' . $file_url . '" title="' . $a_title .'" '. $_download .'>' . $html . '</a>';
353 352
@@ -386,14 +385,14 @@
386 385
387 386 $content .= '</div>';
388 387 }
389 388
390 - if ( bbpc_is_user_admin() || bbpc_is_user_moderator() ) {
389 + if ( forumax_is_user_admin() || forumax_is_user_moderator() ) {
391 390 $errors = get_post_meta( $id, '_bbp_attachment_upload_error' );
392 391
393 392 if ( ! empty( $errors ) ) {
394 393 $content .= '<div class="bbp-attachments-errors">';
395 - $content .= '<h6>' . __( 'Upload Errors', 'bbp-core' ) . ':</h6>';
394 + $content .= '<h6>' . __( 'Upload Errors', 'forumax' ) . ':</h6>';
396 395 $content .= '<ol';
397 396
398 397 $class_li = 'bbp-file-error';
399 398
@@ -403,9 +402,9 @@
403 402 $content .= '>';
404 403
405 404 foreach ( $errors as $error ) {
406 405 $content .= '<li class="' . $class_li . '"><span role="presentation" class="' . $class_li . '"></span> ';
407 - $content .= '<div class="d4p-bbp-att-wrapper"><strong>' . esc_html( $error['file'] ) . '</strong>: ' . __( $error['message'], 'bbp-core' ) . '</div></li>';
406 + $content .= '<div class="d4p-bbp-att-wrapper"><strong>' . esc_html( $error['file'] ) . '</strong>: ' . esc_html( $error['message'] ) . '</div></li>';
408 407 }
409 408
410 409 $content .= '</ol></div>';
411 410 }
@@ -414,19 +413,20 @@
414 413 return $content;
415 414 }
416 415
417 416 public function embed_form() {
418 - $can_upload = apply_filters( 'bbpc_bbpressattchment_allow_upload', BBPCATTCore::instance()->is_user_allowed(), bbpc_get_forum_id() );
417 + $can_upload = apply_filters( 'bbpc_bbpressattchment_allow_upload', BBPCATTCore::instance()->is_user_allowed(), forumax_get_forum_id() );
419 418 if ( ! $can_upload ) {
420 419 return;
421 420 }
422 421
423 - $is_enabled = apply_filters( 'bbpc_bbpressattchment_forum_enabled', BBPCATTCore::instance()->enabled_for_forum(), bbpc_get_forum_id() );
422 + $is_enabled = apply_filters( 'bbpc_bbpressattchment_forum_enabled', BBPCATTCore::instance()->enabled_for_forum(), forumax_get_forum_id() );
424 423 if ( ! $is_enabled ) {
425 424 return;
426 425 }
427 426
428 - $file_size = apply_filters( 'bbpc_bbpressattchment_max_file_size', BBPCATTCore::instance()->get_file_size(), bbpc_get_forum_id() );
427 + $file_size = apply_filters( 'bbpc_bbpressattchment_max_file_size', BBPCATTCore::instance()->get_file_size(), forumax_get_forum_id() );
429 428
430 429 include BBPCATTACHMENTS_PATH . 'forms/uploader.php';
431 430 }
432 431 }
432 +