Skip to content

Commit

Permalink
4.26
Browse files Browse the repository at this point in the history
  • Loading branch information
odudename committed Oct 26, 2024
1 parent 629f985 commit d46e7a7
Show file tree
Hide file tree
Showing 15 changed files with 262 additions and 229 deletions.
6 changes: 3 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Donate link: https://odude.com/
Tags: gallery, photo gallery, image gallery, video gallery, Frontend, visitor
Requires at least: 5.0.0
Requires PHP: 5.5
Tested up to: 6.0
Stable tag: 4.25
Tested up to: 6.6.2
Stable tag: 4.26
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -189,7 +189,7 @@ At Flexi Settings all configuration are ready, but do check all automatically cr

== Changelog ==

= 4.25 =
= 4.26 =
* No features added. Only made it compatible to work with latest version of wordpress

= 4.24 =
Expand Down
5 changes: 2 additions & 3 deletions admin/partials/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
<?php echo __('Let visitors to post images,video,audio,youtube from frontend with full controls.', 'flexi'); ?><br>
<?php echo "<a href='" . esc_url(flexi_get_button_url('', false, 'submission_form', 'flexi_form_settings')) . "' target='_blank' class='button button-primary'>" . __('Post files', 'flexi') . "</a>" ?>
<?php echo " <a href='" . esc_url(flexi_get_button_url('', false, 'primary_page', 'flexi_image_layout_settings')) . "' target='_blank' class='button button-primary'>" . __('View Gallery', 'flexi') . "</a>" ?>
<a href="https://odude.com/docs/flexi-gallery/" target="_blank"
<a href="https://odude.com/flexi/docs/flexi-gallery/" target="_blank"
class='button'><?php echo __('Documentation', 'flexi'); ?></a>
<a href="https://odude.com/flexi/primary-gallery/" target="_blank"
class='button'><?php echo __('Live Demo', 'flexi'); ?></a>
<a href="https://odude.com/demo/" target="_blank" class='button'><?php echo __('Live Demo', 'flexi'); ?></a>

</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions flexi.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* that starts the plugin.
*
* @link https://odude.com/
* @since 4.25
* @since 4.26
* @package Flexi
*
* @wordpress-plugin
* Plugin Name: Flexi - Guest Submit
* Plugin URI: https://odude.com/
* Description: User submitted images/video into gallery
* Version: 4.25
* Version: 4.26
* Author: ODude
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Expand All @@ -37,7 +37,7 @@

// The current version of the plugin
if (!defined('FLEXI_VERSION')) {
define('FLEXI_VERSION', '4.25');
define('FLEXI_VERSION', '4.26');
}
define('FLEXI_FOLDER', dirname(plugin_basename(__FILE__)));
define('FLEXI_PLUGIN_URL', content_url('/plugins/' . FLEXI_FOLDER));
Expand Down
146 changes: 79 additions & 67 deletions includes/addon/class-flexi-buddypress.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* BuddyPress plugin support
*
Expand All @@ -8,49 +9,54 @@
* @package Flexi
* @subpackage Flexi/includes/addon
*/
class Flexi_Addon_BuddyPress {
private $help = ' <a style="text-decoration: none;" href="https://odude.com/docs/flexi-gallery/tutorial/buddypress-user-gallery/" target="_blank"><span class="dashicons dashicons-editor-help"></span></a>';

public function __construct() {

add_filter( 'flexi_settings_sections', array( $this, 'add_section' ) );
add_filter( 'flexi_settings_fields', array( $this, 'add_fields' ) );
add_action( 'bp_setup_nav', array( $this, 'add_flexi_buddypress_tab' ) );
add_action( 'flexi_submit_complete', array( $this, 'add_into_activity' ), 10, 1 );
add_filter( 'flexi_settings_fields', array( $this, 'add_extension' ) );
class Flexi_Addon_BuddyPress
{
private $help = ' <a style="text-decoration: none;" href="https://odude.com/flexi/docs/flexi-gallery/tutorial/buddypress-user-gallery/" target="_blank"><span class="dashicons dashicons-editor-help"></span></a>';

public function __construct()
{

add_filter('flexi_settings_sections', array($this, 'add_section'));
add_filter('flexi_settings_fields', array($this, 'add_fields'));
add_action('bp_setup_nav', array($this, 'add_flexi_buddypress_tab'));
add_action('flexi_submit_complete', array($this, 'add_into_activity'), 10, 1);
add_filter('flexi_settings_fields', array($this, 'add_extension'));
}

// add_filter flexi_settings_tabs
public function add_tabs( $new ) {
public function add_tabs($new)
{
$tabs = array();
$new = array_merge( $tabs, $new );
$new = array_merge($tabs, $new);
return $new;
}

// Add Section title
public function add_section( $new ) {
$enable_addon = flexi_get_option( 'enable_buddypress', 'flexi_extension', 0 );
if ( '1' == $enable_addon ) {
public function add_section($new)
{
$enable_addon = flexi_get_option('enable_buddypress', 'flexi_extension', 0);
if ('1' == $enable_addon) {
$sections = array(
array(
'id' => 'flexi_buddypress_settings',
'title' => __( 'BuddyPress', 'flexi' ),
'description' => __( 'If you have installed BuddyPress plugin, user can see own submitted images at their profile page. https://wordpress.org/plugins/buddypress/', 'flexi' ) . ' ' . $this->help,
'title' => __('BuddyPress', 'flexi'),
'description' => __('If you have installed BuddyPress plugin, user can see own submitted images at their profile page. https://wordpress.org/plugins/buddypress/', 'flexi') . ' ' . $this->help,
'tab' => 'gallery',
),
);
$new = array_merge( $new, $sections );
$new = array_merge($new, $sections);
}
return $new;
}

// Add enable/disable option at extension tab
public function add_extension( $new ) {
public function add_extension($new)
{

$enable_addon = flexi_get_option( 'enable_buddypress', 'flexi_extension', 0 );
if ( '1' == $enable_addon ) {
$enable_addon = flexi_get_option('enable_buddypress', 'flexi_extension', 0);
if ('1' == $enable_addon) {

$description = ' <a style="text-decoration: none;" href="' . admin_url( 'admin.php?page=flexi_settings&tab=gallery&section=flexi_buddypress_settings' ) . '"><span class="dashicons dashicons-admin-tools"></span></a>';
$description = ' <a style="text-decoration: none;" href="' . admin_url('admin.php?page=flexi_settings&tab=gallery&section=flexi_buddypress_settings') . '"><span class="dashicons dashicons-admin-tools"></span></a>';
} else {
$description = '';
}
Expand All @@ -59,109 +65,115 @@ public function add_extension( $new ) {
'flexi_extension' => array(
array(
'name' => 'enable_buddypress',
'label' => __( 'Enable BuddyPress', 'flexi' ),
'description' => __( 'Displays tab on user profile page of BuddyPress members page.', 'flexi' ) . ' ' . $this->help . ' ' . $description,
'label' => __('Enable BuddyPress', 'flexi'),
'description' => __('Displays tab on user profile page of BuddyPress members page.', 'flexi') . ' ' . $this->help . ' ' . $description,
'type' => 'checkbox',
'sanitize_callback' => 'intval',

),
),
);

$new = array_merge_recursive( $new, $fields );
$new = array_merge_recursive($new, $fields);
return $new;
}

// Add section fields
public function add_fields( $new ) {
$enable_addon = flexi_get_option( 'enable_buddypress', 'flexi_extension', 0 );
if ( '1' == $enable_addon ) {
public function add_fields($new)
{
$enable_addon = flexi_get_option('enable_buddypress', 'flexi_extension', 0);
if ('1' == $enable_addon) {
$fields = array(
'flexi_buddypress_settings' => array(

array(
'name' => 'buddypress_tab_name',
'label' => __( 'Tab name', 'flexi' ),
'description' => __( 'Name of the tab displays on profile page', 'flexi' ),
'label' => __('Tab name', 'flexi'),
'description' => __('Name of the tab displays on profile page', 'flexi'),
'type' => 'text',
'size' => 'medium',
'sanitize_callback' => 'sanitize_text_field',
),
array(
'name' => 'enable_buddypress_activity',
'label' => __( 'Enable BuddyPress Activity', 'flexi' ),
'description' => __( 'Displays activity when any flexi post is posted.', 'flexi' ),
'label' => __('Enable BuddyPress Activity', 'flexi'),
'description' => __('Displays activity when any flexi post is posted.', 'flexi'),
'type' => 'checkbox',
'sanitize_callback' => 'intval',

),

),
);
$new = array_merge( $new, $fields );
$new = array_merge($new, $fields);
}
return $new;
}
public function add_flexi_buddypress_tab( $tabs ) {
$enable_addon = flexi_get_option( 'enable_buddypress', 'flexi_extension', 0 );
if ( '1' == $enable_addon && function_exists( 'bp_get_displayed_user_username' ) ) {
public function add_flexi_buddypress_tab($tabs)
{
$enable_addon = flexi_get_option('enable_buddypress', 'flexi_extension', 0);
if ('1' == $enable_addon && function_exists('bp_get_displayed_user_username')) {
global $bp;

$yourtab = flexi_get_option( 'buddypress_tab_name', 'flexi_buddypress_settings', 'Gallery' );
$yourtab = flexi_get_option('buddypress_tab_name', 'flexi_buddypress_settings', 'Gallery');

bp_core_new_nav_item(
array(
'name' => $yourtab,
'slug' => 'flexi',
'screen_function' => array( $this, 'flexi_buddypress_yourtab_screen' ),
'position' => 40,
'parent_url' => $bp->displayed_user->domain,
'parent_slug' => $bp->profile->slug,
'default_subnav_slug' => 'flexi',
)
);
'name' => $yourtab,
'slug' => 'flexi',
'screen_function' => array($this, 'flexi_buddypress_yourtab_screen'),
'position' => 40,
'parent_url' => $bp->displayed_user->domain,
'parent_slug' => $bp->profile->slug,
'default_subnav_slug' => 'flexi',
)
);
}
}

public function flexi_buddypress_yourtab_screen() {
public function flexi_buddypress_yourtab_screen()
{

// Add title and content here - last is to call the members plugin.php template.

add_action( 'bp_template_title', array( $this, 'flexi_buddypress_yourtab_title' ) );
add_action( 'bp_template_content', array( $this, 'flexi_buddypress_yourtab_content' ) );
if ( function_exists( 'bp_get_displayed_user_username' ) ) {
bp_core_load_template( 'buddypress/members/single/plugins' );
add_action('bp_template_title', array($this, 'flexi_buddypress_yourtab_title'));
add_action('bp_template_content', array($this, 'flexi_buddypress_yourtab_content'));
if (function_exists('bp_get_displayed_user_username')) {
bp_core_load_template('buddypress/members/single/plugins');
}
}
public function flexi_buddypress_yourtab_title() {
public function flexi_buddypress_yourtab_title()
{

// echo flexi_get_option('buddypress_tab_name', 'flexi_buddypress_settings', 'Gallery');
}

public function flexi_buddypress_yourtab_content() {
public function flexi_buddypress_yourtab_content()
{

if ( function_exists( 'bp_get_displayed_user_username' ) ) {
if (function_exists('bp_get_displayed_user_username')) {
$user_info = bp_get_displayed_user_username();
echo do_shortcode( '[flexi-profile-toolbar]' );
echo do_shortcode( '[flexi-gallery user="' . $user_info . '" ] ' );
echo do_shortcode('[flexi-profile-toolbar]');
echo do_shortcode('[flexi-gallery user="' . $user_info . '" ] ');
}
}

// Add it into buddypress activity
public function add_into_activity( $post_id ) {
$enable_addon = flexi_get_option( 'enable_buddypress', 'flexi_extension', 0 );
$enable_activity = flexi_get_option( 'enable_buddypress_activity', 'flexi_buddypress_settings', 1 );
if ( '1' == $enable_addon && '1' == $enable_activity && function_exists( 'bp_core_get_userlink' ) ) {
if ( is_user_logged_in() ) {
$link = get_permalink( flexi_get_option( 'primary_page', 'flexi_image_layout_settings', 0 ) );
public function add_into_activity($post_id)
{
$enable_addon = flexi_get_option('enable_buddypress', 'flexi_extension', 0);
$enable_activity = flexi_get_option('enable_buddypress_activity', 'flexi_buddypress_settings', 1);
if ('1' == $enable_addon && '1' == $enable_activity && function_exists('bp_core_get_userlink')) {
if (is_user_logged_in()) {
$link = get_permalink(flexi_get_option('primary_page', 'flexi_image_layout_settings', 0));
$author = wp_get_current_user();
$link = add_query_arg( 'flexi_user', $author->user_login, $link );
$flexi_post = get_post( $post_id );
$content = '<div class="flexi-image-wrapper-thumb"><img src="' . esc_url( flexi_image_src( 'thumbnail', $flexi_post ) ) . '"></div>';
$link = add_query_arg('flexi_user', $author->user_login, $link);
$flexi_post = get_post($post_id);
$content = '<div class="flexi-image-wrapper-thumb"><img src="' . esc_url(flexi_image_src('thumbnail', $flexi_post)) . '"></div>';
$buddy_post = array(
'id' => false,
// Pass an existing activity ID to update an existing entry.
'action' => sprintf( __( '%1$s has posted: <a target="_blank" href = "%2$s">%3$s</a>', 'flexi' ), bp_core_get_userlink( bp_loggedin_user_id() ), esc_url( $link ), esc_attr( get_the_title( $post_id ) ) ),
'action' => sprintf(__('%1$s has posted: <a target="_blank" href = "%2$s">%3$s</a>', 'flexi'), bp_core_get_userlink(bp_loggedin_user_id()), esc_url($link), esc_attr(get_the_title($post_id))),
// The activity action - e.g. "Jon Doe posted an update"
'content' => $content,
'component' => 'flexi',
Expand All @@ -184,7 +196,7 @@ public function add_into_activity( $post_id ) {
// Is this activity item to be marked as spam?
);

return bp_activity_add( $buddy_post );
return bp_activity_add($buddy_post);
}
}
}
Expand Down
Loading

0 comments on commit d46e7a7

Please sign in to comment.