diff --git a/core/um-shortcodes.php b/core/um-shortcodes.php
index 1984449c..9a26263d 100644
--- a/core/um-shortcodes.php
+++ b/core/um-shortcodes.php
@@ -10,99 +10,103 @@ class UM_Shortcodes {
add_shortcode('ultimatemember', array(&$this, 'ultimatemember'), 1);
- add_shortcode('um_loggedin', array(&$this, 'um_loggedin') );
- add_shortcode('um_loggedout', array(&$this, 'um_loggedout') );
+ add_shortcode('um_loggedin', array(&$this, 'um_loggedin'));
+ add_shortcode('um_loggedout', array(&$this, 'um_loggedout'));
- add_filter( 'body_class', array(&$this, 'body_class'), 0 );
+ add_filter('body_class', array(&$this, 'body_class'), 0);
- $this->emoji[':)'] = 'https://s.w.org/images/core/emoji/72x72/1f604.png';
- $this->emoji[':smiley:'] = 'https://s.w.org/images/core/emoji/72x72/1f603.png';
- $this->emoji[':D'] = 'https://s.w.org/images/core/emoji/72x72/1f600.png';
- $this->emoji[':$'] = 'https://s.w.org/images/core/emoji/72x72/1f60a.png';
- $this->emoji[':relaxed:'] = 'https://s.w.org/images/core/emoji/72x72/263a.png';
- $this->emoji[';)'] = 'https://s.w.org/images/core/emoji/72x72/1f609.png';
- $this->emoji[':heart_eyes:'] = 'https://s.w.org/images/core/emoji/72x72/1f60d.png';
- $this->emoji[':kissing_heart:'] = 'https://s.w.org/images/core/emoji/72x72/1f618.png';
- $this->emoji[':kissing_closed_eyes:'] = 'https://s.w.org/images/core/emoji/72x72/1f61a.png';
- $this->emoji[':kissing:'] = 'https://s.w.org/images/core/emoji/72x72/1f617.png';
- $this->emoji[':kissing_smiling_eyes:'] = 'https://s.w.org/images/core/emoji/72x72/1f619.png';
- $this->emoji[';P'] = 'https://s.w.org/images/core/emoji/72x72/1f61c.png';
- $this->emoji[':P'] = 'https://s.w.org/images/core/emoji/72x72/1f61b.png';
- $this->emoji[':stuck_out_tongue_closed_eyes:'] = 'https://s.w.org/images/core/emoji/72x72/1f61d.png';
- $this->emoji[':flushed:'] = 'https://s.w.org/images/core/emoji/72x72/1f633.png';
- $this->emoji[':grin:'] = 'https://s.w.org/images/core/emoji/72x72/1f601.png';
- $this->emoji[':pensive:'] = 'https://s.w.org/images/core/emoji/72x72/1f614.png';
- $this->emoji[':relieved:'] = 'https://s.w.org/images/core/emoji/72x72/1f60c.png';
- $this->emoji[':unamused'] = 'https://s.w.org/images/core/emoji/72x72/1f612.png';
- $this->emoji[':('] = 'https://s.w.org/images/core/emoji/72x72/1f61e.png';
- $this->emoji[':persevere:'] = 'https://s.w.org/images/core/emoji/72x72/1f623.png';
- $this->emoji[":'("] = 'https://s.w.org/images/core/emoji/72x72/1f622.png';
- $this->emoji[':joy:'] = 'https://s.w.org/images/core/emoji/72x72/1f602.png';
- $this->emoji[':sob:'] = 'https://s.w.org/images/core/emoji/72x72/1f62d.png';
- $this->emoji[':sleepy:'] = 'https://s.w.org/images/core/emoji/72x72/1f62a.png';
- $this->emoji[':disappointed_relieved:'] = 'https://s.w.org/images/core/emoji/72x72/1f625.png';
- $this->emoji[':cold_sweat:'] = 'https://s.w.org/images/core/emoji/72x72/1f630.png';
- $this->emoji[':sweat_smile:'] = 'https://s.w.org/images/core/emoji/72x72/1f605.png';
- $this->emoji[':sweat:'] = 'https://s.w.org/images/core/emoji/72x72/1f613.png';
- $this->emoji[':weary:'] = 'https://s.w.org/images/core/emoji/72x72/1f629.png';
- $this->emoji[':tired_face:'] = 'https://s.w.org/images/core/emoji/72x72/1f62b.png';
- $this->emoji[':fearful:'] = 'https://s.w.org/images/core/emoji/72x72/1f628.png';
- $this->emoji[':scream:'] = 'https://s.w.org/images/core/emoji/72x72/1f631.png';
- $this->emoji[':angry:'] = 'https://s.w.org/images/core/emoji/72x72/1f620.png';
- $this->emoji[':rage:'] = 'https://s.w.org/images/core/emoji/72x72/1f621.png';
- $this->emoji[':triumph'] = 'https://s.w.org/images/core/emoji/72x72/1f624.png';
- $this->emoji[':confounded:'] = 'https://s.w.org/images/core/emoji/72x72/1f616.png';
- $this->emoji[':laughing:'] = 'https://s.w.org/images/core/emoji/72x72/1f606.png';
- $this->emoji[':yum:'] = 'https://s.w.org/images/core/emoji/72x72/1f60b.png';
- $this->emoji[':mask:'] = 'https://s.w.org/images/core/emoji/72x72/1f637.png';
- $this->emoji[':cool:'] = 'https://s.w.org/images/core/emoji/72x72/1f60e.png';
- $this->emoji[':sleeping:'] = 'https://s.w.org/images/core/emoji/72x72/1f634.png';
- $this->emoji[':dizzy_face:'] = 'https://s.w.org/images/core/emoji/72x72/1f635.png';
- $this->emoji[':astonished:'] = 'https://s.w.org/images/core/emoji/72x72/1f632.png';
- $this->emoji[':worried:'] = 'https://s.w.org/images/core/emoji/72x72/1f61f.png';
- $this->emoji[':frowning:'] = 'https://s.w.org/images/core/emoji/72x72/1f626.png';
- $this->emoji[':anguished:'] = 'https://s.w.org/images/core/emoji/72x72/1f627.png';
- $this->emoji[':smiling_imp:'] = 'https://s.w.org/images/core/emoji/72x72/1f608.png';
- $this->emoji[':imp:'] = 'https://s.w.org/images/core/emoji/72x72/1f47f.png';
- $this->emoji[':open_mouth:'] = 'https://s.w.org/images/core/emoji/72x72/1f62e.png';
- $this->emoji[':grimacing:'] = 'https://s.w.org/images/core/emoji/72x72/1f62c.png';
- $this->emoji[':neutral_face:'] = 'https://s.w.org/images/core/emoji/72x72/1f610.png';
- $this->emoji[':confused:'] = 'https://s.w.org/images/core/emoji/72x72/1f615.png';
- $this->emoji[':hushed:'] = 'https://s.w.org/images/core/emoji/72x72/1f62f.png';
- $this->emoji[':no_mouth:'] = 'https://s.w.org/images/core/emoji/72x72/1f636.png';
- $this->emoji[':innocent:'] = 'https://s.w.org/images/core/emoji/72x72/1f607.png';
- $this->emoji[':smirk:'] = 'https://s.w.org/images/core/emoji/72x72/1f60f.png';
- $this->emoji[':expressionless:'] = 'https://s.w.org/images/core/emoji/72x72/1f611.png';
+ $base_uri = apply_filters('um_emoji_base_uri', 'https://s.w.org/images/core/emoji/');
+
+ $this->emoji[':)'] = $base_uri . '72x72/1f604.png';
+ $this->emoji[':smiley:'] = $base_uri . '72x72/1f603.png';
+ $this->emoji[':D'] = $base_uri . '72x72/1f600.png';
+ $this->emoji[':$'] = $base_uri . '72x72/1f60a.png';
+ $this->emoji[':relaxed:'] = $base_uri . '72x72/263a.png';
+ $this->emoji[';)'] = $base_uri . '72x72/1f609.png';
+ $this->emoji[':heart_eyes:'] = $base_uri . '72x72/1f60d.png';
+ $this->emoji[':kissing_heart:'] = $base_uri . '72x72/1f618.png';
+ $this->emoji[':kissing_closed_eyes:'] = $base_uri . '72x72/1f61a.png';
+ $this->emoji[':kissing:'] = $base_uri . '72x72/1f617.png';
+ $this->emoji[':kissing_smiling_eyes:'] = $base_uri . '72x72/1f619.png';
+ $this->emoji[';P'] = $base_uri . '72x72/1f61c.png';
+ $this->emoji[':P'] = $base_uri . '72x72/1f61b.png';
+ $this->emoji[':stuck_out_tongue_closed_eyes:'] = $base_uri . '72x72/1f61d.png';
+ $this->emoji[':flushed:'] = $base_uri . '72x72/1f633.png';
+ $this->emoji[':grin:'] = $base_uri . '72x72/1f601.png';
+ $this->emoji[':pensive:'] = $base_uri . '72x72/1f614.png';
+ $this->emoji[':relieved:'] = $base_uri . '72x72/1f60c.png';
+ $this->emoji[':unamused'] = $base_uri . '72x72/1f612.png';
+ $this->emoji[':('] = $base_uri . '72x72/1f61e.png';
+ $this->emoji[':persevere:'] = $base_uri . '72x72/1f623.png';
+ $this->emoji[":'("] = $base_uri . '72x72/1f622.png';
+ $this->emoji[':joy:'] = $base_uri . '72x72/1f602.png';
+ $this->emoji[':sob:'] = $base_uri . '72x72/1f62d.png';
+ $this->emoji[':sleepy:'] = $base_uri . '72x72/1f62a.png';
+ $this->emoji[':disappointed_relieved:'] = $base_uri . '72x72/1f625.png';
+ $this->emoji[':cold_sweat:'] = $base_uri . '72x72/1f630.png';
+ $this->emoji[':sweat_smile:'] = $base_uri . '72x72/1f605.png';
+ $this->emoji[':sweat:'] = $base_uri . '72x72/1f613.png';
+ $this->emoji[':weary:'] = $base_uri . '72x72/1f629.png';
+ $this->emoji[':tired_face:'] = $base_uri . '72x72/1f62b.png';
+ $this->emoji[':fearful:'] = $base_uri . '72x72/1f628.png';
+ $this->emoji[':scream:'] = $base_uri . '72x72/1f631.png';
+ $this->emoji[':angry:'] = $base_uri . '72x72/1f620.png';
+ $this->emoji[':rage:'] = $base_uri . '72x72/1f621.png';
+ $this->emoji[':triumph'] = $base_uri . '72x72/1f624.png';
+ $this->emoji[':confounded:'] = $base_uri . '72x72/1f616.png';
+ $this->emoji[':laughing:'] = $base_uri . '72x72/1f606.png';
+ $this->emoji[':yum:'] = $base_uri . '72x72/1f60b.png';
+ $this->emoji[':mask:'] = $base_uri . '72x72/1f637.png';
+ $this->emoji[':cool:'] = $base_uri . '72x72/1f60e.png';
+ $this->emoji[':sleeping:'] = $base_uri . '72x72/1f634.png';
+ $this->emoji[':dizzy_face:'] = $base_uri . '72x72/1f635.png';
+ $this->emoji[':astonished:'] = $base_uri . '72x72/1f632.png';
+ $this->emoji[':worried:'] = $base_uri . '72x72/1f61f.png';
+ $this->emoji[':frowning:'] = $base_uri . '72x72/1f626.png';
+ $this->emoji[':anguished:'] = $base_uri . '72x72/1f627.png';
+ $this->emoji[':smiling_imp:'] = $base_uri . '72x72/1f608.png';
+ $this->emoji[':imp:'] = $base_uri . '72x72/1f47f.png';
+ $this->emoji[':open_mouth:'] = $base_uri . '72x72/1f62e.png';
+ $this->emoji[':grimacing:'] = $base_uri . '72x72/1f62c.png';
+ $this->emoji[':neutral_face:'] = $base_uri . '72x72/1f610.png';
+ $this->emoji[':confused:'] = $base_uri . '72x72/1f615.png';
+ $this->emoji[':hushed:'] = $base_uri . '72x72/1f62f.png';
+ $this->emoji[':no_mouth:'] = $base_uri . '72x72/1f636.png';
+ $this->emoji[':innocent:'] = $base_uri . '72x72/1f607.png';
+ $this->emoji[':smirk:'] = $base_uri . '72x72/1f60f.png';
+ $this->emoji[':expressionless:'] = $base_uri . '72x72/1f611.png';
}
/***
- *** @emoji support
- ***/
- function emotize( $content ) {
- $content = stripslashes( $content );
- foreach( $this->emoji as $code => $val ) {
- $regex = str_replace( array( '(', ')' ), array( "\\" . '(', "\\" . ')'), $code );
- $content = preg_replace( '/(' . $regex . ')(\s|$)/', '
$2', $content );
+ *** @emoji support
+ */
+ function emotize($content) {
+ $content = stripslashes($content);
+ foreach ($this->emoji as $code => $val) {
+ $regex = str_replace(array('(', ')'), array("\\" . '(', "\\" . ')'), $code);
+ $content = preg_replace('/(' . $regex . ')(\s|$)/', '
$2', $content);
}
return $content;
}
/***
- *** @extend body classes
- ***/
- function body_class( $classes ) {
+ *** @extend body classes
+ */
+ function body_class($classes) {
global $ultimatemember;
$array = $ultimatemember->permalinks->core;
- if ( !$array ) return $classes;
+ if (!$array) {
+ return $classes;
+ }
- foreach( $array as $slug => $info ) {
- if ( um_is_core_page( $slug ) ) {
+ foreach ($array as $slug => $info) {
+ if (um_is_core_page($slug)) {
$classes[] = 'um-page-' . $slug;
- if ( is_user_logged_in() ) {
+ if (is_user_logged_in()) {
$classes[] = 'um-page-loggedin';
} else {
$classes[] = 'um-page-loggedout';
@@ -115,62 +119,65 @@ class UM_Shortcodes {
}
/***
- *** @Retrieve core login form
- ***/
+ *** @Retrieve core login form
+ */
function core_login_form() {
- $forms = get_posts( array( 'post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login' ) );
+ $forms = get_posts(array('post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login'));
return $forms[0]->ID;
}
/***
- *** @load a compatible template
- ***/
- function load_template( $tpl ) {
+ *** @load a compatible template
+ */
+ function load_template($tpl) {
global $ultimatemember;
- $loop = ( $this->loop ) ? $this->loop : '';
+ $loop = ($this->loop) ? $this->loop : '';
- if ( isset( $this->set_args ) && is_array( $this->set_args ) ) {
+ if (isset($this->set_args) && is_array($this->set_args)) {
$args = $this->set_args;
- extract( $args );
+ extract($args);
}
$file = um_path . 'templates/' . $tpl . '.php';
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $tpl . '.php';
- if ( file_exists( $theme_file ) )
+ if (file_exists($theme_file)) {
$file = $theme_file;
+ }
- if ( file_exists( $file ) )
+ if (file_exists($file)) {
include $file;
+ }
+
}
/***
- *** @Add class based on shortcode
- ***/
- function get_class( $mode, $args = array() ){
+ *** @Add class based on shortcode
+ */
+ function get_class($mode, $args = array()) {
global $ultimatemember;
- $classes = 'um-'.$mode;
+ $classes = 'um-' . $mode;
- if ( is_admin() ) {
+ if (is_admin()) {
$classes .= ' um-in-admin';
}
- if ( isset( $ultimatemember->form->errors ) && $ultimatemember->form->errors ) {
+ if (isset($ultimatemember->form->errors) && $ultimatemember->form->errors) {
$classes .= ' um-err';
}
- if ( $ultimatemember->fields->editing == true ) {
+ if ($ultimatemember->fields->editing == true) {
$classes .= ' um-editing';
}
- if ( $ultimatemember->fields->viewing == true ) {
+ if ($ultimatemember->fields->viewing == true) {
$classes .= ' um-viewing';
}
- if ( isset( $args['template'] ) && $args['template'] != $args['mode'] ) {
+ if (isset($args['template']) && $args['template'] != $args['mode']) {
$classes .= ' um-' . $args['template'];
}
@@ -179,30 +186,30 @@ class UM_Shortcodes {
}
/***
- *** @Logged-in only content
- ***/
- function um_loggedin( $args = array(), $content = "" ) {
+ *** @Logged-in only content
+ */
+ function um_loggedin($args = array(), $content = "") {
global $ultimatemember;
ob_start();
$defaults = array(
- 'lock_text' => __('This content has been restricted to logged in users only. Please login to view this content.','ultimatemember' ),
- 'show_lock' => 'yes'
+ 'lock_text' => __('This content has been restricted to logged in users only. Please login to view this content.', 'ultimatemember'),
+ 'show_lock' => 'yes',
);
- $args = wp_parse_args( $args, $defaults );
+ $args = wp_parse_args($args, $defaults);
- $args['lock_text'] = $this->convert_locker_tags( $args['lock_text'] );
+ $args['lock_text'] = $this->convert_locker_tags($args['lock_text']);
- if ( !is_user_logged_in() ) {
- if ( $args['show_lock'] == 'no' ) {
+ if (!is_user_logged_in()) {
+ if ($args['show_lock'] == 'no') {
echo '';
} else {
$ultimatemember->shortcodes->set_args = $args;
- $ultimatemember->shortcodes->load_template( 'login-to-view' );
+ $ultimatemember->shortcodes->load_template('login-to-view');
}
} else {
- echo do_shortcode( $this->convert_locker_tags( wpautop( $content ) ) );
+ echo do_shortcode($this->convert_locker_tags(wpautop($content)));
}
$output = ob_get_contents();
@@ -211,17 +218,17 @@ class UM_Shortcodes {
}
/***
- *** @Logged-out only content
- ***/
- function um_loggedout( $args = array(), $content = "" ) {
+ *** @Logged-out only content
+ */
+ function um_loggedout($args = array(), $content = "") {
global $ultimatemember;
ob_start();
// Hide for logged in users
- if ( is_user_logged_in() ) {
+ if (is_user_logged_in()) {
echo '';
} else {
- echo do_shortcode( wpautop( $content ) );
+ echo do_shortcode(wpautop($content));
}
$output = ob_get_contents();
@@ -230,54 +237,72 @@ class UM_Shortcodes {
}
/***
- *** @Shortcode
- ***/
- function ultimatemember( $args = array() ) {
- return $this->load( $args );
+ *** @Shortcode
+ */
+ function ultimatemember($args = array()) {
+ return $this->load($args);
}
/***
- *** @Load a module with global function
- ***/
- function load( $args ) {
+ *** @Load a module with global function
+ */
+ function load($args) {
global $ultimatemember;
ob_start();
$defaults = array();
- $args = wp_parse_args( $args, $defaults );
+ $args = wp_parse_args($args, $defaults);
// when to not continue
$this->form_id = (isset($args['form_id'])) ? $args['form_id'] : null;
- if (!$this->form_id) return;
- $this->form_status = get_post_status( $this->form_id );
- if ( $this->form_status != 'publish' ) return;
+ if (!$this->form_id) {
+ return;
+ }
+
+ $this->form_status = get_post_status($this->form_id);
+ if ($this->form_status != 'publish') {
+ return;
+ }
// get data into one global array
- $post_data = $ultimatemember->query->post_data( $this->form_id );
+ $post_data = $ultimatemember->query->post_data($this->form_id);
- $args = apply_filters('um_pre_args_setup', $post_data );
+ $args = apply_filters('um_pre_args_setup', $post_data);
- if ( !isset( $args['template'] ) ) $args['template'] = '';
- if ( isset( $post_data['template'] ) && $post_data['template'] != $args['template']) $args['template'] = $post_data['template'];
- if ( !$this->template_exists( $args['template'] ) ) $args['template'] = $post_data['mode'];
- if ( !isset( $post_data['template'] ) ) $post_data['template'] = $post_data['mode'];
- $args = array_merge( $post_data, $args );
+ if (!isset($args['template'])) {
+ $args['template'] = '';
+ }
- if ( isset( $args['use_globals'] ) && $args['use_globals'] == 1 ) {
- $args = array_merge( $args, $this->get_css_args( $args ) );
+ if (isset($post_data['template']) && $post_data['template'] != $args['template']) {
+ $args['template'] = $post_data['template'];
+ }
+
+ if (!$this->template_exists($args['template'])) {
+ $args['template'] = $post_data['mode'];
+ }
+
+ if (!isset($post_data['template'])) {
+ $post_data['template'] = $post_data['mode'];
+ }
+
+ $args = array_merge($post_data, $args);
+
+ if (isset($args['use_globals']) && $args['use_globals'] == 1) {
+ $args = array_merge($args, $this->get_css_args($args));
} else {
- $args = array_merge( $this->get_css_args( $args ), $args );
+ $args = array_merge($this->get_css_args($args), $args);
}
// filter for arguments
- $args = apply_filters('um_shortcode_args_filter', $args );
+ $args = apply_filters('um_shortcode_args_filter', $args);
- extract( $args, EXTR_SKIP );
+ extract($args, EXTR_SKIP);
// for profiles only
- if ( $mode == 'profile' && um_profile_id() && isset( $args['role'] ) && $args['role'] &&
- $args['role'] != $ultimatemember->query->get_role_by_userid( um_profile_id() ) )
+ if ($mode == 'profile' && um_profile_id() && isset($args['role']) && $args['role'] &&
+ $args['role'] != $ultimatemember->query->get_role_by_userid(um_profile_id())) {
return;
+ }
// start loading the template here
do_action("um_pre_{$mode}_shortcode", $args);
@@ -286,11 +311,11 @@ class UM_Shortcodes {
do_action("um_before_{$mode}_form_is_loaded", $args);
- $this->template_load( $template, $args );
+ $this->template_load($template, $args);
- $this->dynamic_css( $args );
+ $this->dynamic_css($args);
- if ( um_get_requested_user() || $mode == 'logout' ) {
+ if (um_get_requested_user() || $mode == 'logout') {
um_reset_user();
}
@@ -302,107 +327,110 @@ class UM_Shortcodes {
}
/***
- *** @Get dynamic css args
- ***/
- function get_css_args( $args ) {
- $arr = um_styling_defaults( $args['mode'] );
- $arr = array_merge( $arr, array( 'form_id' => $args['form_id'], 'mode' => $args['mode'] ) );
+ *** @Get dynamic css args
+ */
+ function get_css_args($args) {
+ $arr = um_styling_defaults($args['mode']);
+ $arr = array_merge($arr, array('form_id' => $args['form_id'], 'mode' => $args['mode']));
return $arr;
}
/***
- *** @Load dynamic css
- ***/
- function dynamic_css( $args=array() ) {
+ *** @Load dynamic css
+ */
+ function dynamic_css($args = array()) {
global $ultimatemember;
extract($args);
$global = um_path . 'assets/dynamic_css/dynamic_global.php';
- if ( isset( $mode ) ) {
- $file = um_path . 'assets/dynamic_css/dynamic_'.$mode.'.php';
+ if (isset($mode)) {
+ $file = um_path . 'assets/dynamic_css/dynamic_' . $mode . '.php';
}
include $global;
- if ( isset( $file ) && file_exists( $file ) )
+ if (isset($file) && file_exists($file)) {
include $file;
-
- if ( isset( $args['custom_css'] ) ) {
- $css = $args['custom_css'];
- ?>shortcodes->set_args = $args;
}
- $ultimatemember->shortcodes->load_template( $template );
+ $ultimatemember->shortcodes->load_template($template);
}
/***
- *** @Checks if a template file exists
- ***/
- function template_exists( $template ) {
+ *** @Checks if a template file exists
+ */
+ function template_exists($template) {
- $file = um_path . 'templates/'. $template . '.php';
+ $file = um_path . 'templates/' . $template . '.php';
$theme_file = get_stylesheet_directory() . '/ultimate-member/templates/' . $template . '.php';
- if ( file_exists( $theme_file ) || file_exists( $file ) )
+ if (file_exists($theme_file) || file_exists($file)) {
return true;
+ }
+
return false;
}
/***
- *** @Get File Name without path and extension
- ***/
- function get_template_name($file){
+ *** @Get File Name without path and extension
+ */
+ function get_template_name($file) {
$file = basename($file);
$file = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file);
return $file;
}
/***
- *** @Get Templates
- ***/
- function get_templates( $excluded = null ) {
+ *** @Get Templates
+ */
+ function get_templates($excluded = null) {
if ($excluded) {
- $array[$excluded] = __('Default Template','ultimatemember');
+ $array[$excluded] = __('Default Template', 'ultimatemember');
}
- $paths[] = glob( um_path . 'templates/' . '*.php');
+ $paths[] = glob(um_path . 'templates/' . '*.php');
- if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/' ) ) {
- $paths[] = glob( get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php' );
+ if (file_exists(get_stylesheet_directory() . '/ultimate-member/templates/')) {
+ $paths[] = glob(get_stylesheet_directory() . '/ultimate-member/templates/' . '*.php');
}
- foreach($paths as $k => $files){
+ foreach ($paths as $k => $files) {
- foreach( $files as $file ) {
+ foreach ($files as $file) {
$clean_filename = $this->get_template_name($file);
if (0 === strpos($clean_filename, $excluded)) {
- $source = file_get_contents( $file );
- $tokens = token_get_all( $source );
+ $source = file_get_contents($file);
+ $tokens = token_get_all($source);
$comment = array(
- T_COMMENT, // All comments since PHP5
- T_DOC_COMMENT // PHPDoc comments
+ T_COMMENT, // All comments since PHP5
+ T_DOC_COMMENT, // PHPDoc comments
);
- foreach( $tokens as $token ) {
- if( in_array($token[0], $comment) && strstr( $token[1], '/* Template:' ) && $clean_filename != $excluded ) {
+ foreach ($tokens as $token) {
+ if (in_array($token[0], $comment) && strstr($token[1], '/* Template:') && $clean_filename != $excluded) {
$txt = $token[1];
- $txt = str_replace('/* Template: ','',$txt);
- $txt = str_replace(' */','',$txt);
- $array[ $clean_filename ] = $txt;
+ $txt = str_replace('/* Template: ', '', $txt);
+ $txt = str_replace(' */', '', $txt);
+ $array[$clean_filename] = $txt;
}
}
@@ -417,25 +445,25 @@ class UM_Shortcodes {
}
/***
- *** @Get Shortcode for given form ID
- ***/
- function get_shortcode($post_id){
- $shortcode = '[ultimatemember form_id='.$post_id.']';
+ *** @Get Shortcode for given form ID
+ */
+ function get_shortcode($post_id) {
+ $shortcode = '[ultimatemember form_id=' . $post_id . ']';
return $shortcode;
}
/***
- *** @convert access lock tags
- ***/
- function convert_locker_tags( $str ) {
- $str = um_convert_tags( $str );
+ *** @convert access lock tags
+ */
+ function convert_locker_tags($str) {
+ $str = um_convert_tags($str);
return $str;
}
/***
- *** @convert user tags in a string
- ***/
- function convert_user_tags( $str ) {
+ *** @convert user tags in a string
+ */
+ function convert_user_tags($str) {
$value = '';
@@ -450,27 +478,27 @@ class UM_Shortcodes {
$pattern_array = apply_filters('um_allowed_user_tags_patterns', $pattern_array);
$matches = false;
- foreach ( $pattern_array as $pattern ) {
+ foreach ($pattern_array as $pattern) {
if (preg_match($pattern, $str)) {
- $usermeta = str_replace('{','',$pattern);
- $usermeta = str_replace('}','',$usermeta);
+ $usermeta = str_replace('{', '', $pattern);
+ $usermeta = str_replace('}', '', $usermeta);
- if ( $usermeta == 'user_avatar_small' ) {
- $value = get_avatar( um_user('ID'), 40 );
- } elseif ( um_user( $usermeta ) ){
- $value = um_user( $usermeta );
+ if ($usermeta == 'user_avatar_small') {
+ $value = get_avatar(um_user('ID'), 40);
+ } elseif (um_user($usermeta)) {
+ $value = um_user($usermeta);
}
- if ( $usermeta == 'username' ) {
+ if ($usermeta == 'username') {
$value = um_user('user_login');
}
- $value = apply_filters("um_profile_tag_hook__{$usermeta}", $value, um_user('ID') );
+ $value = apply_filters("um_profile_tag_hook__{$usermeta}", $value, um_user('ID'));
- if ( $value ) {
- $str = preg_replace('/'.$pattern.'/', $value , $str );
+ if ($value) {
+ $str = preg_replace('/' . $pattern . '/', $value, $str);
}
}
diff --git a/um-init.php b/um-init.php
index 4e008160..152ac699 100644
--- a/um-init.php
+++ b/um-init.php
@@ -3,32 +3,32 @@
class UM_API {
public $is_filtering;
-
+
public $addons = null;
-
+
function __construct() {
-
+
$this->is_filtering = 0;
require_once um_path . 'core/um-short-functions.php';
-
- if (is_admin()){
+
+ if (is_admin()) {
require_once um_path . 'admin/um-admin-init.php';
}
- add_action('init', array(&$this, 'init'), 0);
+ add_action('init', array(&$this, 'init'), 0);
- add_action('init', array(&$this, 'load_addons') );
+ add_action('init', array(&$this, 'load_addons'));
$this->honeypot = 'request';
-
+
$this->available_languages = array(
'en_US' => 'English (US)',
'es_ES' => 'Español',
'es_MX' => 'Español (México)',
'fr_FR' => 'Français',
'it_IT' => 'Italiano',
- 'de_DE' => 'Deutsch',
+ 'de_DE' => 'Deutsch',
'nl_NL' => 'Nederlands',
'pt_BR' => 'Português do Brasil',
'fi_FI' => 'Suomi',
@@ -37,44 +37,44 @@ class UM_API {
'sv_SE' => 'Svenska',
'pl_PL' => 'Polski',
'cs_CZ' => 'Czech',
- 'el' => 'Greek',
+ 'el' => 'Greek',
'id_ID' => 'Indonesian',
- 'zh_CN' => 'Simplified Chinese',
+ 'zh_CN' => '简体中文',
'ru_RU' => 'Русский',
'tr_TR' => 'Türkçe',
'fa_IR' => 'Farsi',
'he_IL' => 'Hebrew',
- 'ar' => 'العربية'
+ 'ar' => 'العربية',
);
-
+
$this->addons['bp_avatar_transfer'] = array(
- __( 'BuddyPress Avatar Transfer','ultimatemember' ),
- __('This add-on enables you to migrate your custom user photos from BuddyPress to use with Ultimate Member.','ultimatemember')
+ __('BuddyPress Avatar Transfer', 'ultimatemember'),
+ __('This add-on enables you to migrate your custom user photos from BuddyPress to use with Ultimate Member.', 'ultimatemember'),
);
-
+
}
-
+
/***
- *** @Load add-ons
- ***/
+ *** @Load add-ons
+ */
function load_addons() {
global $ultimatemember;
- if ( isset( $ultimatemember->addons ) && is_array( $ultimatemember->addons ) ) {
- foreach( $ultimatemember->addons as $addon => $name ) {
- if ( um_get_option('addon_' . $addon ) == 1 ) {
- include_once um_path . 'addons/'.$addon.'.php';
+ if (isset($ultimatemember->addons) && is_array($ultimatemember->addons)) {
+ foreach ($ultimatemember->addons as $addon => $name) {
+ if (um_get_option('addon_' . $addon) == 1) {
+ include_once um_path . 'addons/' . $addon . '.php';
}
}
}
}
-
+
/***
- *** @Init
- ***/
- function init(){
+ *** @Init
+ */
+ function init() {
ob_start();
-
+
require_once um_path . 'core/um-api.php';
require_once um_path . 'core/um-rewrite.php';
require_once um_path . 'core/um-setup.php';
@@ -108,11 +108,11 @@ class UM_API {
require_once um_path . 'core/um-modal.php';
require_once um_path . 'core/um-cron.php';
require_once um_path . 'core/um-tracking.php';
-
- if ( !class_exists( 'Mobile_Detect' ) ) {
+
+ if (!class_exists('Mobile_Detect')) {
require_once um_path . 'core/lib/mobiledetect/Mobile_Detect.php';
}
-
+
require_once um_path . 'core/um-actions-form.php';
require_once um_path . 'core/um-actions-access.php';
require_once um_path . 'core/um-actions-wpadmin.php';
@@ -143,7 +143,7 @@ class UM_API {
require_once um_path . 'core/um-filters-misc.php';
require_once um_path . 'core/um-filters-addons.php';
require_once um_path . 'core/um-filters-commenting.php';
-
+
/* initialize UM */
$this->api = new UM_REST_API();
$this->rewrite = new UM_Rewrite();
@@ -177,20 +177,21 @@ class UM_API {
$this->modal = new UM_Modal();
$this->cron = new UM_Cron();
$this->tracking = new UM_Tracking();
-
+
$this->mobile = new Mobile_Detect;
$this->options = get_option('um_options');
-
+
$domain = 'ultimatemember';
- $locale = ( get_locale() != '' ) ? get_locale() : 'en_US';
- load_textdomain($domain, WP_LANG_DIR . '/plugins/' .$domain.'-'.$locale.'.mo');
-
- if ( !get_option('show_avatars') )
- update_option('show_avatars', 1 );
+ $locale = (get_locale() != '') ? get_locale() : 'en_US';
+ load_textdomain($domain, WP_LANG_DIR . '/plugins/' . $domain . '-' . $locale . '.mo');
+
+ if (!get_option('show_avatars')) {
+ update_option('show_avatars', 1);
+ }
}
-
+
}
$ultimatemember = new UM_API();
\ No newline at end of file