diff --git a/bpge.php b/bpge.php index e693238..d917065 100644 --- a/bpge.php +++ b/bpge.php @@ -4,7 +4,7 @@ Plugin URI: http://ovirium.com/portfolio/bp-groups-extras/ Description: Adding extra fields and pages, menu sorting and other missing functionality to groups Version: 3.6.8 -Text Domain: bpge +Text Domain: buddypress-groups-extras Domain Path: /langs/ Author: slaFFik Author URI: https://ovirium.com/ @@ -22,6 +22,7 @@ define( 'BPGE_FIELDS_SET', 'bpge_fields_set' ); define( 'BPGE_GFIELDS', 'bpge_gfields' ); define( 'BPGE_GPAGES', 'gpages' ); +define( 'BPGE_I18N', 'buddypress-groups-extras' ); if ( ! defined( 'DS' ) ) { define( 'DS', DIRECTORY_SEPARATOR ); @@ -90,10 +91,10 @@ function bpge_clear( $type = 'all' ) { */ function bpge_load_textdomain() { $locale = apply_filters( 'buddypress_locale', get_locale() ); - $mofile = dirname( __File__ ) . "/langs/bpge-$locale.mo"; + $mofile = dirname( __File__ ) . '/langs/' . BPGE_I18N . "-$locale.mo"; if ( file_exists( $mofile ) ) { - load_textdomain( 'bpge', $mofile ); + load_textdomain( BPGE_I18N, $mofile ); } } @@ -108,8 +109,8 @@ function bpge_admin_init() { $admin = new BPGE_ADMIN(); add_submenu_page( is_multisite() ? 'settings.php' : 'options-general.php', - __( 'BP Groups Extras', 'bpge' ), - ' ' . __( 'BP Groups Extras', 'bpge' ), + __( 'BP Groups Extras', BPGE_I18N ), + ' ' . __( 'BP Groups Extras', BPGE_I18N ), 'manage_options', BPGE_ADMIN_SLUG, array( $admin, 'admin_page' ) ); diff --git a/core/admin.php b/core/admin.php index 3160de8..82ec028 100644 --- a/core/admin.php +++ b/core/admin.php @@ -44,10 +44,10 @@ public function __construct() { public function manage_columns() { return array( 'cb' => '', - 'title' => __( 'Title', 'bpge' ), - 'group_link' => __( 'Group Links', 'bpge' ), - 'page_link' => __( 'Page Links', 'bpge' ), - 'date' => __( 'Date', 'bpge' ) + 'title' => __( 'Title', BPGE_I18N ), + 'group_link' => __( 'Group Links', BPGE_I18N ), + 'page_link' => __( 'Page Links', BPGE_I18N ), + 'date' => __( 'Date', BPGE_I18N ) ); } @@ -80,9 +80,9 @@ public function manage_columns_content( $column, $post_id ) { break; } - echo '' . __( 'Visit', 'bpge' ) . ''; + echo '' . __( 'Visit', BPGE_I18N ) . ''; echo ' | '; - echo '' . __( 'Edit', 'bpge' ) . ''; + echo '' . __( 'Edit', BPGE_I18N ) . ''; break; @@ -91,9 +91,9 @@ public function manage_columns_content( $column, $post_id ) { break; } - echo '' . __( 'Visit', 'bpge' ) . ''; + echo '' . __( 'Visit', BPGE_I18N ) . ''; echo ' | '; - echo '' . __( 'Edit', 'bpge' ) . ''; + echo '' . __( 'Edit', BPGE_I18N ) . ''; break; } } @@ -183,11 +183,11 @@ public function load_assets() { public function load_pointers() { $page = is_multisite() ? 'network/settings.php' : 'options-general.php'; - $vote_content = '

' . __( 'Vote for Features', 'bpge' ) . '

'; - $vote_content .= '

' . __( 'Based on voting results I will implement features in new versions (either in core or as modules to extend the initial functionality).', 'bpge' ) . '

'; + $vote_content = '

' . __( 'Vote for Features', BPGE_I18N ) . '

'; + $vote_content .= '

' . __( 'Based on voting results I will implement features in new versions (either in core or as modules to extend the initial functionality).', BPGE_I18N ) . '

'; $tuts_content = '

' . __( 'Tutorials Included' ) . '

'; - $tuts_content .= '

' . sprintf( __( 'You can get the basic help of how to use this plugin right from the plugin admin area - several very detailed tutorials are bundled into the plugin.', 'bpge' ), admin_url( '/' . $page . '?page=' . BPGE_ADMIN_SLUG . '&tab=tuts' ) ) . '

'; + $tuts_content .= '

' . sprintf( __( 'You can get the basic help of how to use this plugin right from the plugin admin area - several very detailed tutorials are bundled into the plugin.', BPGE_I18N ), admin_url( '/' . $page . '?page=' . BPGE_ADMIN_SLUG . '&tab=tuts' ) ) . '

'; // get all pointer that we dismissed $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); @@ -326,28 +326,28 @@ public function header() { $current_tab = $this->get_cur_tab(); echo '

'; - _e( 'BuddyPress Groups Extras', 'bpge' ); + _e( 'BuddyPress Groups Extras', BPGE_I18N ); echo 'v' . BPGE_VERSION . ' '; do_action( 'bpge_admin_header_title_pro' ); echo '→ '; - _e( 'Extend Your Groups', 'bpge' ); + _e( 'Extend Your Groups', BPGE_I18N ); do_action( 'bpge_admin_header_title' ); echo '

'; ?> '; - echo '

' . __( 'All changes were saved. Go and check results!', 'bpge' ) . '

'; + echo '

' . __( 'All changes were saved. Go and check results!', BPGE_I18N ) . '

'; } if ( ! isset( $this->bpge['reviewed'] ) || $this->bpge['reviewed'] == 'no' ) { echo '
'; echo '

' . sprintf( - __( 'If you like the plugin please review it on its WordPress Repository page. Thanks in advance!', 'bpge' ), + __( 'If you like the plugin please review it on its WordPress Repository page. Thanks in advance!', BPGE_I18N ), 'http://wordpress.org/support/view/plugin-reviews/buddypress-groups-extras' ) . - '' . __( 'Dismiss', 'bpge' ) . '' . + '' . __( 'Dismiss', BPGE_I18N ) . '' . '

'; } @@ -360,9 +360,9 @@ public function header() { do_action( 'bpge_admin_tabs_links' ); if ( defined( 'BPGE_PRO' ) ) { - echo '' . __( 'Support', 'bpge' ) . ''; + echo '' . __( 'Support', BPGE_I18N ) . ''; } else { - echo '' . __( 'Support', 'bpge' ) . ''; + echo '' . __( 'Support', BPGE_I18N ) . ''; } echo ''; } diff --git a/core/admin_tabs/general.php b/core/admin_tabs/general.php index 50192f2..3340294 100644 --- a/core/admin_tabs/general.php +++ b/core/admin_tabs/general.php @@ -13,7 +13,7 @@ class BPGE_ADMIN_GENERAL extends BPGE_ADMIN_TAB { public $title = null; public function __construct() { - $this->title = __( 'General Options', 'bpge' ); + $this->title = __( 'General Options', BPGE_I18N ); parent::__construct(); } @@ -25,27 +25,27 @@ public function register_sections() { do_action( 'bpge_admin_general_section_before', $this ); add_settings_field( 're_pages', - __( 'Rich Editor for Pages', 'bpge' ), + __( 'Rich Editor for Pages', BPGE_I18N ), array( $this, 'display_re_pages' ), $this->slug, $this->slug . '_settings' ); add_settings_field( 're_fields', - __( 'Rich Editor for Fields', 'bpge' ), + __( 'Rich Editor for Fields', BPGE_I18N ), array( $this, 'display_re_fields' ), $this->slug, $this->slug . '_settings' ); add_settings_field( 'access', - __( 'User Access', 'bpge' ), + __( 'User Access', BPGE_I18N ), array( $this, 'display_access' ), $this->slug, $this->slug . '_settings' ); add_settings_field( 'import', - __( 'Data Import', 'bpge' ), + __( 'Data Import', BPGE_I18N ), array( $this, 'display_import' ), $this->slug, $this->slug . '_settings' ); add_settings_field( 'uninstall', - __( 'Uninstall Options', 'bpge' ), + __( 'Uninstall Options', BPGE_I18N ), array( $this, 'display_uninstall' ), $this->slug, $this->slug . '_settings' ); @@ -57,7 +57,7 @@ public function register_sections() { * Display the tab description */ public function display() { - echo '

' . __( 'Here are some general settings.', 'bpge' ) . '

'; + echo '

' . __( 'Here are some general settings.', BPGE_I18N ) . '

'; } /** @@ -66,10 +66,10 @@ public function display() { public function display_access() { ?>

- +

-

+

bpge['access_extras'] ) || empty( $this->bpge['access_extras'] ) ) { $this->bpge['access_extras'] = 'g_s_admin'; @@ -79,12 +79,12 @@ public function display_access() {
  • @@ -96,19 +96,19 @@ public function display_access() { */ public function display_import() { ?>

    - +

    -

    Important: Do not import data twice - as this will create lots of duplicated fields.', 'bpge' ); ?>

    +

    Important: Do not import data twice - as this will create lots of duplicated fields.', BPGE_I18N ); ?>

    -   -

    -

    +

    */ public function display_re_pages() { echo '

    '; - _e( 'Would you like to enable Rich Editor for easy use of html tags for groups custom pages?', 'bpge' ); + _e( 'Would you like to enable Rich Editor for easy use of html tags for groups custom pages?', BPGE_I18N ); echo '

    '; echo ''; } @@ -131,7 +131,7 @@ public function display_re_pages() { */ public function display_re_fields() { echo '

    '; - _e( 'Would you like to enable Rich Editor for easy use of html tags for groups custom textarea fields?', 'bpge' ); + _e( 'Would you like to enable Rich Editor for easy use of html tags for groups custom textarea fields?', BPGE_I18N ); echo '

    '; if ( ! isset( $this->bpge['re_fields'] ) || empty( $this->bpge['re_fields'] ) ) { @@ -139,8 +139,8 @@ public function display_re_fields() { } echo ''; } @@ -149,7 +149,7 @@ public function display_re_fields() { */ public function display_uninstall() { echo '

    '; - _e( 'On BPGE deactivation you can delete or preserve all its settings and created content (like groups pages and fields). What do you want to do?', 'bpge' ); + _e( 'On BPGE deactivation you can delete or preserve all its settings and created content (like groups pages and fields). What do you want to do?', BPGE_I18N ); echo '

    '; if ( ! isset( $this->bpge['uninstall'] ) ) { @@ -157,8 +157,8 @@ public function display_uninstall() { } echo '

    '; - echo '
    '; - echo ''; + echo '
    '; + echo ''; echo '

    '; } diff --git a/core/admin_tabs/groups.php b/core/admin_tabs/groups.php index 02edeb5..9fc21db 100644 --- a/core/admin_tabs/groups.php +++ b/core/admin_tabs/groups.php @@ -13,7 +13,7 @@ class BPGE_ADMIN_GROUPS extends BPGE_ADMIN_TAB { public $title = null; public function __construct() { - $this->title = __( 'Allowed Groups', 'bpge' ); + $this->title = __( 'Allowed Groups', BPGE_I18N ); parent::__construct(); } diff --git a/core/admin_tabs/poll.php b/core/admin_tabs/poll.php index d874522..9b9a345 100644 --- a/core/admin_tabs/poll.php +++ b/core/admin_tabs/poll.php @@ -13,14 +13,14 @@ class BPGE_ADMIN_POLL extends BPGE_ADMIN_TAB { public $title = null; public function __construct() { - $this->title = __( 'Poll', 'bpge' ); + $this->title = __( 'Poll', BPGE_I18N ); parent::__construct(); } public function display() { echo '

    '; - _e( 'Please answer the question below - this will help me to prioritize my development work.', 'bpge' ); + _e( 'Please answer the question below - this will help me to prioritize my development work.', BPGE_I18N ); echo '


    '; // hide Submit button diff --git a/core/admin_tabs/sets.php b/core/admin_tabs/sets.php index 8fbc374..24f95a3 100644 --- a/core/admin_tabs/sets.php +++ b/core/admin_tabs/sets.php @@ -13,14 +13,14 @@ class BPGE_ADMIN_SETS extends BPGE_ADMIN_TAB { public $title = null; public function __construct() { - $this->title = __( 'Default Sets of Fields', 'bpge' ); + $this->title = __( 'Default Sets of Fields', BPGE_I18N ); parent::__construct(); } public function display() { echo '

    '; - _e( 'Please create/edit here fields you want to be available as standard blocks of data.
    This will be helpful for group admins - no need for them to create lots of fields from scratch.', 'bpge' ); + _e( 'Please create/edit here fields you want to be available as standard blocks of data.
    This will be helpful for group admins - no need for them to create lots of fields from scratch.', BPGE_I18N ); echo '

    '; $set_args = array( @@ -52,7 +52,7 @@ public function display() { } } else { echo '
  • '; - echo '' . __( 'Currently there are no predefined fields. Groups admins should create all fields by themselves.', 'bpge' ) . ''; + echo '' . __( 'Currently there are no predefined fields. Groups admins should create all fields by themselves.', BPGE_I18N ) . ''; echo '
  • '; } echo ''; diff --git a/core/admin_tabs/tuts.php b/core/admin_tabs/tuts.php index be8a821..e825ae9 100644 --- a/core/admin_tabs/tuts.php +++ b/core/admin_tabs/tuts.php @@ -13,14 +13,14 @@ class BPGE_ADMIN_TUTS extends BPGE_ADMIN_TAB { public $title = null; public function __construct() { - $this->title = __( 'Tutorials', 'bpge' ); + $this->title = __( 'Tutorials', BPGE_I18N ); parent::__construct(); } public function display() { echo '

    '; - _e( 'Below you will see several tutorials and how to, that will help you to better understand the plugin and how to work with it.', 'bpge' ); + _e( 'Below you will see several tutorials and how to, that will help you to better understand the plugin and how to work with it.', BPGE_I18N ); echo '

    '; bpge_view( 'admin/tuts_data' ); diff --git a/core/cpt.php b/core/cpt.php index 0a2b6a7..8ca8d13 100644 --- a/core/cpt.php +++ b/core/cpt.php @@ -5,7 +5,7 @@ function bpge_register_fields() { $args = array( 'labels' => array( - 'name' => __( 'Groups Fields', 'bpge' ) + 'name' => __( 'Groups Fields', BPGE_I18N ) ), 'public' => false, 'show_in_menu' => false, @@ -28,7 +28,7 @@ function bpge_register_fields() { function bpge_register_set() { $args = array( 'labels' => array( - 'name' => __( 'Sets of Fields', 'bpge' ) + 'name' => __( 'Sets of Fields', BPGE_I18N ) ), 'public' => false, 'show_in_menu' => false, @@ -51,7 +51,7 @@ function bpge_register_set() { function bpge_register_set_fields() { $args = array( 'labels' => array( - 'name' => __( 'Groups Fields', 'bpge' ) + 'name' => __( 'Groups Fields', BPGE_I18N ) ), 'public' => false, 'show_in_menu' => false, @@ -74,8 +74,8 @@ function bpge_register_set_fields() { function bpge_register_groups_pages() { $args = array( 'labels' => array( - 'name' => __( 'Groups Pages', 'bpge' ), - 'singular_name' => __( 'Groups Page', 'bpge' ) + 'name' => __( 'Groups Pages', BPGE_I18N ), + 'singular_name' => __( 'Groups Page', BPGE_I18N ) ), 'public' => false, 'exclude_from_search' => true, diff --git a/core/cssjs.php b/core/cssjs.php index a90273c..f4cd1d1 100644 --- a/core/cssjs.php +++ b/core/cssjs.php @@ -19,18 +19,18 @@ function bpge_load_js() { */ function bpge_get_localized_data() { return apply_filters( 'bpge_load_js_localized', array( - 'enter_options' => __( 'Please enter options for this Field', 'bpge' ), - 'option_text' => __( 'Option', 'bpge' ), - 'remove_it' => __( 'Remove It', 'bpge' ), - 'apply_set' => __( 'Do you want to apply this set of fields to all groups on your site?', 'bpge' ), - 'applied' => __( 'Applied', 'bpge' ), - 'close' => __( 'Close', 'bpge' ), - 'yes' => __( 'Yes', 'bpge' ), - 'no' => __( 'No', 'bpge' ), - 'success' => __( 'Success', 'bpge' ), - 'success_apply_set' => __( 'This set of fields was successfully applied to all groups on this site.', 'bpge' ), - 'error' => __( 'Error', 'bpge' ), - 'error_apply_set' => __( 'Unfortunately, there was an error while applying this set of fields. Please try again a bit later or recreate the set from scratch. Be aware, that re-applying this set will double fields for those groups that were successful.', 'bpge' ), + 'enter_options' => __( 'Please enter options for this Field', BPGE_I18N ), + 'option_text' => __( 'Option', BPGE_I18N ), + 'remove_it' => __( 'Remove It', BPGE_I18N ), + 'apply_set' => __( 'Do you want to apply this set of fields to all groups on your site?', BPGE_I18N ), + 'applied' => __( 'Applied', BPGE_I18N ), + 'close' => __( 'Close', BPGE_I18N ), + 'yes' => __( 'Yes', BPGE_I18N ), + 'no' => __( 'No', BPGE_I18N ), + 'success' => __( 'Success', BPGE_I18N ), + 'success_apply_set' => __( 'This set of fields was successfully applied to all groups on this site.', BPGE_I18N ), + 'error' => __( 'Error', BPGE_I18N ), + 'error_apply_set' => __( 'Unfortunately, there was an error while applying this set of fields. Please try again a bit later or recreate the set from scratch. Be aware, that re-applying this set will double fields for those groups that were successful.', BPGE_I18N ), ) ); } diff --git a/core/helpers.php b/core/helpers.php index 19e168f..ee68e1e 100644 --- a/core/helpers.php +++ b/core/helpers.php @@ -44,34 +44,34 @@ function bpge_names( $name = 'name' ) { switch ( $name ) { case 'title_general': - $text = __( 'Group Extras → General Settings', 'bpge' ); + $text = __( 'Group Extras → General Settings', BPGE_I18N ); break; case 'title_fields': - $text = __( 'Group Extras → Fields Management', 'bpge' ); + $text = __( 'Group Extras → Fields Management', BPGE_I18N ); break; case 'title_pages': - $text = __( 'Group Extras → Pages Management', 'bpge' ); + $text = __( 'Group Extras → Pages Management', BPGE_I18N ); break; case 'title_fields_add': - $text = __( 'Group Extras → Add Field', 'bpge' ); + $text = __( 'Group Extras → Add Field', BPGE_I18N ); break; case 'title_fields_edit': - $text = __( 'Group Extras → Edit Field', 'bpge' ); + $text = __( 'Group Extras → Edit Field', BPGE_I18N ); break; case 'title_pages_add': - $text = __( 'Group Extras → Add Page', 'bpge' ); + $text = __( 'Group Extras → Add Page', BPGE_I18N ); break; case 'title_pages_edit': - $text = __( 'Group Extras → Edit Page', 'bpge' ); + $text = __( 'Group Extras → Edit Page', BPGE_I18N ); break; case 'name': - $text = __( 'Description', 'bpge' ); + $text = __( 'Description', BPGE_I18N ); break; case 'nav': - $text = __( 'Extras', 'bpge' ); + $text = __( 'Extras', BPGE_I18N ); break; case 'gpages': - $text = __( 'Pages', 'bpge' ); + $text = __( 'Pages', BPGE_I18N ); break; } diff --git a/core/loader.php b/core/loader.php index 1ef33ff..b7a3bdf 100644 --- a/core/loader.php +++ b/core/loader.php @@ -275,7 +275,7 @@ public function edit_group_fields() { $req_text = $req_class = false; if ( $field->pinged == 'req' ) { - $req_text = __( '(required)', 'bpge' ); + $req_text = __( '(required)', BPGE_I18N ); $req_class = 'required'; } @@ -322,7 +322,7 @@ public function edit_group_fields() { } echo ''; if ( $req_text ) { - echo '' . __( 'Clear', 'bpge' ) . ''; + echo '' . __( 'Clear', BPGE_I18N ) . ''; } break; case 'datebox': @@ -380,7 +380,7 @@ public function edit_group_fields_save() { if ( ! empty( $error ) ) { bp_core_add_message( sprintf( - __( 'Required fields should not be empty. Please fill in: %s', 'bpge' ), + __( 'Required fields should not be empty. Please fill in: %s', BPGE_I18N ), '' . implode( ', ', $error ) . '' ), 'error' ); @@ -1027,25 +1027,25 @@ public function import_set_fields() { public function notices( $type ) { switch ( $type ) { case 'settings_updated'; - bp_core_add_message( __( 'Group Extras settings were succefully updated.', 'bpge' ) ); + bp_core_add_message( __( 'Group Extras settings were succefully updated.', BPGE_I18N ) ); break; case 'added_field'; - bp_core_add_message( __( 'New field was successfully added.', 'bpge' ) ); + bp_core_add_message( __( 'New field was successfully added.', BPGE_I18N ) ); break; case 'edited_field'; - bp_core_add_message( __( 'The field was successfully updated.', 'bpge' ) ); + bp_core_add_message( __( 'The field was successfully updated.', BPGE_I18N ) ); break; case 'added_page'; - bp_core_add_message( __( 'New page was successfully added.', 'bpge' ) ); + bp_core_add_message( __( 'New page was successfully added.', BPGE_I18N ) ); break; case 'edited_page'; - bp_core_add_message( __( 'The page was successfully updated.', 'bpge' ) ); + bp_core_add_message( __( 'The page was successfully updated.', BPGE_I18N ) ); break; case 'no_fields': - echo '

    ' . __( 'Please create at least 1 extra field to show it in a list.', 'bpge' ) . '

    '; + echo '

    ' . __( 'Please create at least 1 extra field to show it in a list.', BPGE_I18N ) . '

    '; break; case 'no_pages': - echo '

    ' . __( 'Please create at least 1 extra page to show it in a list.', 'bpge' ) . '

    '; + echo '

    ' . __( 'Please create at least 1 extra page to show it in a list.', BPGE_I18N ) . '

    '; break; } do_action( 'bpge_notices', $type ); diff --git a/core/templates.php b/core/templates.php index 360de5c..2f63c2b 100644 --- a/core/templates.php +++ b/core/templates.php @@ -2,40 +2,43 @@ /** * Get the template file and output its content - * @param string $view template file name - * @param mixed $params variables that should be passed to the view + * + * @param string $view template file name + * @param mixed $params variables that should be passed to the view + * * @return string HTML of a page or view */ -function bpge_view($view, $params = false){ - global $bp, $bpge; - - do_action('bpge_view_pre', $view, $params); - - $params = apply_filters('bpge_view_params', $params); - - if(!empty($params)) - extract($params); - - $theme_parent_file = get_template_directory() . DS . BPGE . DS . $view .'.php'; - $theme_child_file = get_stylesheet_directory() . DS . BPGE . DS . $view .'.php'; - - // admin area templates should not be overridable via theme files - // check that file exists in theme folder - if(!is_admin() && file_exists($theme_child_file)){ - // from child theme - include $theme_child_file; - }elseif(!is_admin() && file_exists($theme_parent_file)){ - // from parent theme if no in child - include $theme_parent_file; - }else{ - // from plugin folder - $plugin_file = BPGE_PATH . 'views'. DS . $view . '.php'; - if(file_exists($plugin_file)){ - include $plugin_file; - } - } - - do_action('bpge_view_post', $view, $params); +function bpge_view( $view, $params = false ) { + global $bp, $bpge; + + do_action( 'bpge_view_pre', $view, $params ); + + $params = apply_filters( 'bpge_view_params', $params ); + + if ( ! empty( $params ) ) { + extract( $params ); + } + + $theme_parent_file = get_template_directory() . DS . BPGE . DS . $view . '.php'; + $theme_child_file = get_stylesheet_directory() . DS . BPGE . DS . $view . '.php'; + + // admin area templates should not be overridable via theme files + // check that file exists in theme folder + if ( ! is_admin() && file_exists( $theme_child_file ) ) { + // from child theme + include $theme_child_file; + } elseif ( ! is_admin() && file_exists( $theme_parent_file ) ) { + // from parent theme if no in child + include $theme_parent_file; + } else { + // from plugin folder + $plugin_file = BPGE_PATH . 'views' . DS . $view . '.php'; + if ( file_exists( $plugin_file ) ) { + include $plugin_file; + } + } + + do_action( 'bpge_view_post', $view, $params ); } /*************************** @@ -44,60 +47,67 @@ function bpge_view($view, $params = false){ /** * Convert text into links where possible + * + * @param string $field_value + * + * @return array|string */ -function bpge_filter_link_group_data( $field_value) { - global $bpge; +function bpge_filter_link_group_data( $field_value ) { + global $bpge; - $field_value = stripslashes($field_value); + $field_value = stripslashes( $field_value ); - if(!isset($bpge['field_2_link']) || $bpge['field_2_link'] == 'no'){ - return $field_value; - } + if ( ! isset( $bpge['field_2_link'] ) || $bpge['field_2_link'] == 'no' ) { + return $field_value; + } - if ( !strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) ) - return $field_value; + if ( ! strpos( $field_value, ',' ) && ( count( explode( ' ', $field_value ) ) > 5 ) ) { + return $field_value; + } - $values = explode( ',', $field_value ); + $values = explode( ',', $field_value ); - if ( !empty( $values ) ) { - foreach ( (array) $values as $value ) { - $value = trim( $value ); + if ( ! empty( $values ) ) { + foreach ( (array) $values as $value ) { + $value = trim( $value ); - // If the value is a URL, skip it and just make it clickable. - if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) { - $new_values[] = make_clickable( $value ); + // If the value is a URL, skip it and just make it clickable. + if ( preg_match( '@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@', $value ) ) { + $new_values[] = make_clickable( $value ); - // Is not clickable - } else { + // Is not clickable + } else { - // More than 5 spaces - if ( count( explode( ' ', $value ) ) > 5 ) { - $new_values[] = $value; + // More than 5 spaces + if ( count( explode( ' ', $value ) ) > 5 ) { + $new_values[] = $value; - // Less than 5 spaces - } else { - $search_url = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_groups_directory_permalink() ); - $new_values[] = '' . $value . ''; - } - } - } + // Less than 5 spaces + } else { + $search_url = add_query_arg( array( 's' => urlencode( $value ) ), bp_get_groups_directory_permalink() ); + $new_values[] = '' . $value . ''; + } + } + } - $values = implode( ', ', $new_values ); - } + $values = implode( ', ', $new_values ); + } - return $values; + return $values; } /** * Edit page link + * + * @param int $page_id */ -function bpge_the_gpage_edit_link($page_id){ - global $bp, $bpge; - if (bpge_user_can('group_extras_admin')){ - echo '