コード例 #1
0
ファイル: um-short-functions.php プロジェクト: blogfor/king
function um_convert_tags($content, $args = array())
{
    $search = array('{display_name}', '{first_name}', '{last_name}', '{gender}', '{username}', '{email}', '{password}', '{login_url}', '{site_name}', '{site_url}', '{account_activation_link}', '{password_reset_link}', '{admin_email}', '{user_profile_link}', '{user_account_link}', '{submitted_registration}', '{user_avatar_url}');
    $search = apply_filters('um_template_tags_patterns_hook', $search);
    $replace = array(um_user('display_name'), um_user('first_name'), um_user('last_name'), um_user('gender'), um_user('user_login'), um_user('user_email'), um_user('_um_cool_but_hard_to_guess_plain_pw'), um_get_core_page('login'), um_get_option('site_name'), get_bloginfo('url'), um_user('account_activation_link'), um_user('password_reset_link'), um_admin_email(), um_user_profile_url(), um_get_core_page('account'), um_user_submitted_registration(), um_get_user_avatar_url());
    $replace = apply_filters('um_template_tags_replaces_hook', $replace);
    $content = str_replace($search, $replace, $content);
    if (isset($args['tags']) && isset($args['tags_replace'])) {
        $content = str_replace($args['tags'], $args['tags_replace'], $content);
    }
    return $content;
}
コード例 #2
0
function um_convert_tags($content, $args = array())
{
    $search = array('{display_name}', '{first_name}', '{last_name}', '{gender}', '{username}', '{email}', '{password}', '{login_url}', '{login_referrer}', '{site_name}', '{site_url}', '{account_activation_link}', '{password_reset_link}', '{admin_email}', '{user_profile_link}', '{user_account_link}', '{submitted_registration}', '{user_avatar_url}');
    $search = apply_filters('um_template_tags_patterns_hook', $search);
    $replace = array(um_user('display_name'), um_user('first_name'), um_user('last_name'), um_user('gender'), um_user('user_login'), um_user('user_email'), um_user('_um_cool_but_hard_to_guess_plain_pw'), um_get_core_page('login'), um_dynamic_login_page_redirect(), um_get_option('site_name'), get_bloginfo('url'), um_user('account_activation_link'), um_user('password_reset_link'), um_admin_email(), um_user_profile_url(), um_get_core_page('account'), um_user_submitted_registration(), um_get_user_avatar_url());
    $replace = apply_filters('um_template_tags_replaces_hook', $replace);
    $content = str_replace($search, $replace, $content);
    if (isset($args['tags']) && isset($args['tags_replace'])) {
        $content = str_replace($args['tags'], $args['tags_replace'], $content);
    }
    $regex = '~\\{([^}]*)\\}~';
    preg_match_all($regex, $content, $matches);
    // Support for all usermeta keys
    if (isset($matches[1]) && is_array($matches[1]) && !empty($matches[1])) {
        foreach ($matches[1] as $match) {
            $strip_key = str_replace('usermeta:', '', $match);
            $content = str_replace('{' . $match . '}', um_user($strip_key), $content);
        }
    }
    return $content;
}
コード例 #3
0
function ultimatemember_dynamic_modal_content()
{
    global $ultimatemember;
    $metabox = new UM_Admin_Metabox();
    if (!is_user_logged_in() || !current_user_can('manage_options')) {
        die(__('Please login as administrator', 'ultimatemember'));
    }
    extract($_POST);
    switch ($act_id) {
        default:
            ob_start();
            do_action('um_admin_ajax_modal_content__hook', $act_id);
            do_action("um_admin_ajax_modal_content__hook_{$act_id}");
            $output = ob_get_contents();
            ob_end_clean();
            break;
        case 'um_admin_fonticon_selector':
            ob_start();
            ?>
				
					<div class="um-admin-metabox">
						<p class="_icon_search"><input type="text" name="_icon_search" id="_icon_search" value="" placeholder="<?php 
            _e('Search Icons...', 'ultimatemember');
            ?>
" /></p>
					</div>
				
					<div class="um-admin-icons">
						<?php 
            foreach ($ultimatemember->icons->all as $icon) {
                ?>
						<span data-code="<?php 
                echo $icon;
                ?>
" title="<?php 
                echo $icon;
                ?>
" class="um-admin-tipsy-n"><i class="<?php 
                echo $icon;
                ?>
"></i></span>
						<?php 
            }
            ?>
					</div><div class="um-admin-clear"></div>
			
					<?php 
            $output = ob_get_contents();
            ob_end_clean();
            break;
        case 'um_admin_show_fields':
            ob_start();
            ?>
					
					<h4><?php 
            _e('Setup New Field', 'ultimatemember');
            ?>
</h4>
					<div class="um-admin-btns">
						
						<?php 
            if ($ultimatemember->builtin->core_fields) {
                foreach ($ultimatemember->builtin->core_fields as $field_type => $array) {
                    if (isset($array['in_fields']) && $array['in_fields'] == false) {
                    } else {
                        ?>
						
						<a href="#" class="button" data-modal="UM_add_field" data-modal-size="normal" data-dynamic-content="um_admin_new_field_popup" data-arg1="<?php 
                        echo $field_type;
                        ?>
" data-arg2="<?php 
                        echo $arg2;
                        ?>
"><?php 
                        echo $array['name'];
                        ?>
</a>
						
						<?php 
                    }
                }
            }
            ?>
						
					</div>
					
					<h4><?php 
            _e('Predefined Fields', 'ultimatemember');
            ?>
</h4>
					<div class="um-admin-btns">
						
						<?php 
            if ($ultimatemember->builtin->predefined_fields) {
                foreach ($ultimatemember->builtin->predefined_fields as $field_key => $array) {
                    if (!isset($array['account_only']) && !isset($array['private_use'])) {
                        ?>
						
						<a href="#" class="button" data-silent_action="um_admin_add_field_from_predefined" data-arg1="<?php 
                        echo $field_key;
                        ?>
" data-arg2="<?php 
                        echo $arg2;
                        ?>
"><?php 
                        echo $array['title'];
                        ?>
</a>

						<?php 
                    }
                }
            } else {
                echo '<p>' . __('None', 'ultimatemember') . '</p>';
            }
            ?>
						
					</div>
					
					<h4><?php 
            _e('Custom Fields', 'ultimatemember');
            ?>
</h4>
					<div class="um-admin-btns">
						
						<?php 
            if ($ultimatemember->builtin->custom_fields) {
                foreach ($ultimatemember->builtin->custom_fields as $field_key => $array) {
                    ?>
						
						<a href="#" class="button with-icon" data-silent_action="um_admin_add_field_from_list" data-arg1="<?php 
                    echo $field_key;
                    ?>
" data-arg2="<?php 
                    echo $arg2;
                    ?>
"><?php 
                    echo $array['title'];
                    ?>
<span class="remove"></span></a>
						
						<?php 
                }
            } else {
                echo '<p>' . __('You did not create any custom fields', 'ultimatemember') . '</p>';
            }
            ?>
						
					</div>
					
				<?php 
            $output = ob_get_contents();
            ob_end_clean();
            break;
        case 'um_admin_edit_field_popup':
            ob_start();
            $args = $ultimatemember->builtin->get_core_field_attrs($arg1);
            $form_fields = $ultimatemember->query->get_attr('custom_fields', $arg2);
            $metabox->set_field_type = $arg1;
            $metabox->in_edit = true;
            $metabox->edit_array = $form_fields[$arg3];
            if (!isset($metabox->edit_array['metakey'])) {
                $metabox->edit_array['metakey'] = $metabox->edit_array['id'];
            }
            if (!isset($metabox->edit_array['position'])) {
                $metabox->edit_array['position'] = $metabox->edit_array['id'];
            }
            extract($args);
            if (!isset($col1)) {
                echo '<p>' . __('This field type is not setup correcty.', 'ultimatemember') . '</p>';
            } else {
                ?>
				
				<?php 
                if (isset($metabox->edit_array['in_group'])) {
                    ?>
				<input type="hidden" name="_in_row" id="_in_row" value="<?php 
                    echo $metabox->edit_array['in_row'];
                    ?>
" />
				<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php 
                    echo $metabox->edit_array['in_sub_row'];
                    ?>
" />
				<input type="hidden" name="_in_column" id="_in_column" value="<?php 
                    echo $metabox->edit_array['in_column'];
                    ?>
" />
				<input type="hidden" name="_in_group" id="_in_group" value="<?php 
                    echo $metabox->edit_array['in_group'];
                    ?>
" />
				<?php 
                }
                ?>
				
				<input type="hidden" name="_type" id="_type" value="<?php 
                echo $arg1;
                ?>
" />
				
				<input type="hidden" name="post_id" id="post_id" value="<?php 
                echo $arg2;
                ?>
" />
				
				<input type="hidden" name="action" id="action" value="ultimatemember_admin_update_field" />
				
				<input type="hidden" name="edit_mode" id="edit_mode" value="true" />
				
				<input type="hidden" name="_metakey" id="_metakey" value="<?php 
                echo $metabox->edit_array['metakey'];
                ?>
" />

				<input type="hidden" name="_position" id="_position" value="<?php 
                echo $metabox->edit_array['position'];
                ?>
" />
				
				<?php 
                if (isset($args['mce_content'])) {
                    ?>
<div class="dynamic-mce-content"><?php 
                    echo $metabox->edit_array['content'];
                    ?>
</div><?php 
                }
                ?>

				<?php 
                do_action('um_admin_field_modal_header');
                ?>

				<div class="um-admin-half">
				
					<?php 
                if (isset($col1)) {
                    foreach ($col1 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
					
				</div>
				
				<div class="um-admin-half um-admin-right">
				
					<?php 
                if (isset($col2)) {
                    foreach ($col2 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
					
				</div><div class="um-admin-clear"></div>
				
				<?php 
                if (isset($col3)) {
                    foreach ($col3 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
				
				<div class="um-admin-clear"></div>
				
				<?php 
                if (isset($col_full)) {
                    foreach ($col_full as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
				
				<?php 
                do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, isset($metabox->edit_array) ? $metabox->edit_array : '');
                ?>
	
				<?php 
            }
            $output = ob_get_contents();
            ob_end_clean();
            break;
        case 'um_admin_new_field_popup':
            ob_start();
            $args = $ultimatemember->builtin->get_core_field_attrs($arg1);
            $metabox->set_field_type = $arg1;
            extract($args);
            if (!isset($col1)) {
                echo '<p>' . __('This field type is not setup correcty.', 'ultimatemember') . '</p>';
            } else {
                ?>
				
				<?php 
                if ($in_column) {
                    ?>
				<input type="hidden" name="_in_row" id="_in_row" value="_um_row_<?php 
                    echo $in_row + 1;
                    ?>
" />
				<input type="hidden" name="_in_sub_row" id="_in_sub_row" value="<?php 
                    echo $in_sub_row;
                    ?>
" />
				<input type="hidden" name="_in_column" id="_in_column" value="<?php 
                    echo $in_column;
                    ?>
" />
				<input type="hidden" name="_in_group" id="_in_group" value="<?php 
                    echo $in_group;
                    ?>
" />
				<?php 
                }
                ?>
				
				<input type="hidden" name="_type" id="_type" value="<?php 
                echo $arg1;
                ?>
" />
				
				<input type="hidden" name="post_id" id="post_id" value="<?php 
                echo $arg2;
                ?>
" />
				
				<input type="hidden" name="action" id="action" value="ultimatemember_admin_update_field" />

				<?php 
                do_action('um_admin_field_modal_header');
                ?>

				<div class="um-admin-half">
				
					<?php 
                if (isset($col1)) {
                    foreach ($col1 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
					
				</div>
				
				<div class="um-admin-half um-admin-right">
				
					<?php 
                if (isset($col2)) {
                    foreach ($col2 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
					
				</div><div class="um-admin-clear"></div>
				
				<?php 
                if (isset($col3)) {
                    foreach ($col3 as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
				
				<div class="um-admin-clear"></div>
				
				<?php 
                if (isset($col_full)) {
                    foreach ($col_full as $opt) {
                        $metabox->field_input($opt);
                    }
                }
                ?>
				
				<?php 
                do_action('um_admin_field_modal_footer', $arg2, $args, $metabox->in_edit, isset($metabox->edit_array) ? $metabox->edit_array : '');
                ?>
	
				<?php 
            }
            $output = ob_get_contents();
            ob_end_clean();
            break;
        case 'um_admin_preview_form':
            $mode = $ultimatemember->query->get_attr('mode', $arg1);
            if ($mode == 'profile') {
                $ultimatemember->fields->editing = true;
            }
            $output = do_shortcode('[ultimatemember form_id=' . $arg1 . ']');
            break;
        case 'um_admin_review_registration':
            um_fetch_user($arg1);
            $ultimatemember->user->preview = true;
            $submitted = um_user('submitted');
            $output = um_user_submitted_registration(true);
            break;
    }
    if (is_array($output)) {
        print_r($output);
    } else {
        echo $output;
    }
    die;
}