Example #1
0
                                <tr valign="top">
                                    <th scope="row"><label for="date_format"><?php 
_e('Date Format', 'upme');
?>
</label></th>
                                    <td>
                                    <?php 
$property = array('name' => 'date_format', 'id' => 'date_format');
$version_message = '';
if (!function_exists('date_create_from_format') && '-1' == upme_php_version_status) {
    $data = array('mm/dd/yy' => date('m/d/Y'));
    $version_message = __('Your server is running PHP ' . phpversion() . ', which does nto support custom date formats. Update to PHP 5.3+ for custom date formats', 'upme');
} else {
    $data = array('mm/dd/yy' => date('m/d/Y'), 'yy/mm/dd' => date('Y/m/d'), 'dd/mm/yy' => date('d/m/Y'), 'yy-mm-dd' => date('Y-m-d'), 'dd-mm-yy' => date('d-m-Y'), 'mm-dd-yy' => date('m-d-Y'), 'MM d, yy' => date('F j, Y'), 'd M, y' => date('j M, y'), 'd MM, y' => date('j F, y'), 'DD, d MM, yy' => date('l, j F, Y'));
}
echo UPME_Html::drop_down($property, $data, $this->options['date_format']);
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('Select the date format to be used for date picker.', 'upme');
?>
"></i>
                                    <p class="description"><?php 
echo $version_message;
?>
</p>
                                    </td>
                                </tr>
                                
                                <?php 
$this->add_plugin_setting('select', 'hide_frontend_admin_bar', __('Admin Bar', 'upme'), array('enabled' => __('Enabled', 'upme'), 'hide_from_non_admin' => __('Hide from Non-Admin Users', 'upme'), 'hide_from_all' => __('Hide from All Users', 'upme')), __('Optionally hide the WordPress admin bar for logged in users on frontend pages.', 'upme'), __('Enabled will show the WordPress admin bar to all users. You amy select an option to hide the admin bar on frontend for non-admin users or all users.', 'upme'));
$this->add_plugin_setting('checkbox', 'lightbox_avatar_cropping', __('Lighbox Avatar Cropping', 'upme'), '1', __('If checked, users will be able to crop avatar images in a lightbox.', 'upme'), __('Unchecking this option will enable the default file upload instead of lightbox cropping.', 'upme'));
                     original-title="<?php 
_e('Select Export Type', 'upme');
?>
"></i>
            </td>
        </tr>

        <tr valign="top">
            <th scope="row"><label for="Settings Section"><?php 
_e('Settings Section', 'upme');
?>
</label></th>
            <td>
                <?php 
$settings_sections = array();
echo UPME_Html::drop_down(array('name' => 'site_export_settings_sections[]', 'id' => 'site_export_settings_sections', 'class' => 'chosen-admin_setting', 'multiple' => ''), $settings_sections, '');
?>
<i class="upme-icon-question-sign upme-tooltip2 option-help"
                     original-title="<?php 
_e('Select settings sections to be exported.', 'upme');
?>
"></i>
            </td>
        </tr>

        <tr valign="top">
            <th scope="row"><label>&nbsp;</label></th>
            <td>
                <?php 
echo UPME_Html::button('button', array('name' => 'upme-download-export-settings', 'id' => 'upme-download-export-settings', 'value' => __('Download', 'upme'), 'class' => 'button button-primary'));
?>
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('Select the email template name.', 'upme');
?>
"></i>
    </td>
</tr>
<tr valign="top" style='display:none'>
    <th scope="row"><label for="Email Status"><?php 
_e('Email Status', 'upme');
?>
</label></th>
    <td class='site_content_allowed_roles'>
        <?php 
$email_statuses = array('0' => __('Disabled - Don\'t send Email', 'upme'), '1' => __('Enabled - Send Email', 'upme'));
echo UPME_Html::drop_down(array('name' => 'email_status', 'id' => 'email_status', 'class' => 'chosen-admin_setting'), $email_statuses, '1');
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('Enable/Disable sending a specific email.', 'upme');
?>
"></i>
    </td>
</tr>
<tr valign="top" style='display:none'>
    <th scope="row"><label for="Email Subject"><?php 
_e('Email Subject', 'upme');
?>
</label></th>
    <td>
        <?php 
echo UPME_Html::text_box(array('name' => 'email_subject', 'id' => 'email_subject', 'class' => 'regular-text', 'value' => ''));
 function add_plugin_module_setting($type, $name, $id, $label, $pairs, $help, $inline_help = '', $custom_attrs = array())
 {
     $td_class = '';
     $field_holder_id = $id . '_holder';
     print "<tr valign=\"top\" id=\"{$field_holder_id}\">\n            <th scope=\"row\"><label for=\"{$id}\">{$label}</label></th>\n            <td " . $td_class . " >";
     $input_html = '';
     // Added hack for edit profile URL.
     $value = '';
     $value = $this->get_value($id);
     $class = isset($custom_attrs['class']) ? $custom_attrs['class'] : '';
     switch ($type) {
         case 'textarea':
             echo UPME_Html::text_area(array('name' => $name, 'id' => $id, 'class' => 'large-text code text-area ' . $class, 'value' => $value, 'rows' => '3'));
             break;
         case 'input':
             echo UPME_Html::text_box(array('name' => $name, 'id' => $id, 'value' => $value, 'class' => 'regular-text ' . $class));
             break;
         case 'select':
             if (isset($custom_attrs['multiple'])) {
                 echo UPME_Html::drop_down(array('name' => $name, 'id' => $id, 'class' => $class, 'multiple' => '', 'data-placeholder' => __('Please Select', 'upme')), $pairs, $this->options[$id]);
             } else {
                 echo UPME_Html::drop_down(array('name' => $name, 'id' => $id, 'class' => $class), $pairs, $this->options[$id]);
             }
             break;
         case 'checkbox':
             echo UPME_Html::check_box(array('name' => $name, 'id' => $id, 'class' => $class, 'value' => '1'), $value);
             break;
         case 'color':
             $default_color = $this->defaults[$id];
             echo UPME_Html::text_box(array('name' => $name, 'id' => $id, 'value' => $value, 'class' => 'my-color-field ' . $class, 'data-default-color' => $default_color));
             break;
     }
     if ($inline_help != '') {
         print '<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" title="' . $inline_help . '"></i>';
     }
     if ($help) {
         print "<p class=\"description\">{$help}</p>";
     }
     if (isset($custom_attrs['extra']) && is_array($custom_attrs['extra'])) {
         echo "<div class=\"helper-wrap\">";
         foreach ($custom_attrs['extra'] as $a) {
             echo $a;
         }
         echo "</div>";
     }
     print "</td></tr>";
 }
$site_allowed_roles = $upme_roles->upme_available_user_roles_restriction_rules();
$checked_value = '';
foreach ($site_allowed_roles as $role_key => $role) {
    echo UPME_Html::check_box(array('name' => 'site_content_allowed_roles[]', 'id' => 'site_content_allowed_roles', 'value' => $role_key), $checked_value) . $role . '<br/>';
}
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('Select which user roles will be allowed to access this content.', 'upme');
?>
"></i>
    </td>
</tr>

<tr valign="top">
    <th scope="row"><label for="Redirect URL"><?php 
_e('Redirect URL', 'upme');
?>
</label></th>
    <td>
        <?php 
$site_redirect_allowed_pages = $upme_admin->get_all_pages();
echo UPME_Html::drop_down(array('name' => 'site_content_redirect_url', 'id' => 'site_content_redirect_url', 'class' => 'chosen-admin_setting'), $site_redirect_allowed_pages, '0');
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('Specify the redirection URL for users with unauthorized access based on this rule.', 'upme');
?>
"></i>
    </td>
</tr>

Example #6
0
 function search($args = array())
 {
     global $predefined, $upme_options;
     // Add scripts for chosen library
     wp_register_script('upme_chosen_js', upme_url . 'admin/js/chosen/chosen.jquery.js');
     wp_enqueue_script('upme_chosen_js');
     wp_register_style('upme_chosen_css', upme_url . 'admin/js/chosen/chosen.css');
     wp_enqueue_style('upme_chosen_css');
     $current_option = $upme_options->upme_settings;
     // Determine search form is loaded
     $this->upme_search = true;
     /* Default Arguments */
     $defaults = array('fields' => null, 'filters' => null, 'exclude_fields' => null, 'operator' => 'AND', 'use_in_sidebar' => null, 'users_are_called' => $current_option['users_are_called'], 'combined_search_text' => $current_option['combined_search_text'], 'button_text' => $current_option['search_button_text'], 'reset_button_text' => $current_option['reset_button_text'], 'show_combined_search' => true, 'name' => wp_generate_password(12, false));
     $this->search_args = wp_parse_args($args, $defaults);
     $this->search_operator = $this->search_args['operator'];
     $this->search_form_name = $this->search_args['name'];
     if (strtolower($this->search_args['operator']) != 'and' && strtolower($this->search_args['operator']) != 'or') {
         $this->search_args['operator'] = 'AND';
     }
     // Prepare array of all fields to load
     $this->build_search_field_array();
     // Remove combned search option based on shortcode attributes
     if ('false' == strtolower($this->search_args['show_combined_search']) || 'no' == strtolower($this->search_args['show_combined_search'])) {
         $this->show_combined_search_field = false;
     }
     $sidebar_class = null;
     if ($this->search_args['use_in_sidebar']) {
         $sidebar_class = ' upme-sidebar';
     }
     $display = null;
     $display .= '<div class="upme-wrap upme-wrap-form upme-search-wrap' . $sidebar_class . '">';
     $display .= '<div class="upme-inner upme-clearfix">';
     $display .= '<div class="upme-head">' . sprintf(__('Search %s', 'upme'), $this->search_args['users_are_called']) . '</div>';
     /* Set form submission to member list page when used search in sidebar */
     $action = '';
     if ($this->search_args['use_in_sidebar']) {
         $member_list_page_id = isset($current_option['member_list_page_id']) ? $current_option['member_list_page_id'] : '';
         if ('' != $member_list_page_id) {
             $action = get_permalink($member_list_page_id);
         }
     }
     $display .= '<form action="' . $action . '" method="post" id="upme_search_form" class="upme-search-form upme-clearfix">';
     // Check For default fields Start
     if ($this->show_combined_search_field === true) {
         $display .= '<p class="upme-p upme-search-p">';
         $display .= UPME_Html::text_box(array('class' => 'upme-search-input upme-combined-search', 'value' => isset($_POST['upme_combined_search']) ? $_POST['upme_combined_search'] : '', 'name' => 'upme_combined_search', 'placeholder' => $this->search_args['combined_search_text']));
         if (count($this->combined_search_field) > 0) {
             $display .= '<input type="hidden" name="upme_combined_search_fields" value="' . implode(',', $this->combined_search_field) . '" />';
         } else {
             $display .= '<input type="hidden" name="upme_combined_search_fields" value="' . implode(',', $this->all_text_search_field) . '" />';
         }
         $display .= '</p>';
     }
     // Check For default fields End
     // Custom Search Fields Creation Starts
     if ($this->show_nontext_search_fields === true) {
         $counter = 0;
         $display .= '<p class="upme-p upme-search-p">';
         foreach ($this->nontext_search_fields as $key => $value) {
             $method_name = '';
             $method_name = $this->method_mapping[$value['field']];
             if ($method_name != '') {
                 if ($counter > 0 && $counter % 2 == 0) {
                     $display .= '</p>';
                     $display .= '<p class="upme-p upme-search-p">';
                 }
                 $counter++;
                 $class = 'upme-search-input upme-search-input-left upme-search-meta-' . $value['meta'];
                 if ($counter > 0 && $counter % 2 == 0) {
                     $class = 'upme-search-input upme-search-input-right upme-search-meta-' . $value['meta'];
                 }
                 if ($method_name == 'drop_down') {
                     $loop = array();
                     if (isset($value['predefined_loop']) && $value['predefined_loop'] != '' && $value['predefined_loop'] != '0') {
                         $defined_loop = $predefined->get_array($value['predefined_loop']);
                         foreach ($defined_loop as $option) {
                             if ($option == '' || $option == null) {
                                 $loop[$option] = $value['name'];
                             } else {
                                 $loop[$option] = $option;
                             }
                         }
                     } else {
                         if (isset($value['choices']) && $value['choices'] != '') {
                             $loop_default = explode(PHP_EOL, $value['choices']);
                             $loop[''] = $value['name'];
                             foreach ($loop_default as $option) {
                                 $loop[$option] = $option;
                             }
                         }
                     }
                     if (isset($_POST['upme_search'][$value['meta']])) {
                         $_POST['upme_search'][$value['meta']] = stripslashes_deep($_POST['upme_search'][$value['meta']]);
                     }
                     $default = isset($_POST['upme_search'][$value['meta']]) ? $_POST['upme_search'][$value['meta']] : '0';
                     $name = 'upme_search[' . $value['meta'] . ']';
                     if ($value['field'] == 'checkbox') {
                         $default = isset($_POST['upme_search'][$value['meta']]) ? $_POST['upme_search'][$value['meta']] : array();
                         $name = 'upme_search[' . $value['meta'] . '][]';
                     }
                     if (count($loop) > 0) {
                         $display .= UPME_Html::drop_down(array('class' => $class, 'name' => $name, 'placeholder' => $value['name']), $loop, $default);
                     }
                 } else {
                     if ($method_name == 'text_box') {
                         if (isset($_POST['upme_search'][$value['meta']])) {
                             $_POST['upme_search'][$value['meta']] = stripslashes_deep($_POST['upme_search'][$value['meta']]);
                         }
                         $default = isset($_POST['upme_search'][$value['meta']]) ? $_POST['upme_search'][$value['meta']] : '';
                         $name = 'upme_search[' . $value['meta'] . ']';
                         $display .= UPME_Html::text_box(array('class' => $class, 'name' => $name, 'placeholder' => $value['name'], 'value' => $default));
                     }
                 }
             }
         }
         $display .= '</p>';
         if (isset($this->checkbox_search_fields) && count($this->checkbox_search_fields) > 0) {
             foreach ($this->checkbox_search_fields as $key => $value) {
                 $display .= '<p class="upme-p upme-search-p upme-multiselect-p">';
                 $method_name = '';
                 $method_name = $this->method_mapping[$value['field']];
                 if ($method_name != '') {
                     $class = 'upme-search-input chosen-search-filter upme-search-multiselect upme-search-meta-' . $value['meta'];
                     $loop = array();
                     if (isset($value['predefined_loop']) && $value['predefined_loop'] != '' && $value['predefined_loop'] != '0') {
                         $defined_loop = $predefined->get_array($value['predefined_loop']);
                         foreach ($defined_loop as $option) {
                             $loop[$option] = $option;
                         }
                     } else {
                         if (isset($value['choices']) && $value['choices'] != '') {
                             $loop_default = explode(PHP_EOL, $value['choices']);
                             $default_filter_val_status = apply_filters('upme_search_filter_field_label_option', TRUE);
                             if ($default_filter_val_status) {
                                 $loop[''] = $value['name'];
                             }
                             foreach ($loop_default as $option) {
                                 $loop[$option] = $option;
                             }
                         }
                     }
                     if (isset($_POST['upme_search'][$value['meta']])) {
                         $_POST['upme_search'][$value['meta']] = stripslashes_deep($_POST['upme_search'][$value['meta']]);
                     }
                     $default = isset($_POST['upme_search'][$value['meta']]) ? $_POST['upme_search'][$value['meta']] : '0';
                     $name = 'upme_search[' . $value['meta'] . ']';
                     if ($value['field'] == 'checkbox') {
                         $default = isset($_POST['upme_search'][$value['meta']]) ? $_POST['upme_search'][$value['meta']] : array();
                         $name = 'upme_search[' . $value['meta'] . '][]';
                     }
                     if (count($loop) > 0) {
                         $display .= UPME_Html::drop_down(array('class' => $class, 'name' => $name, 'placeholder' => $value['name'], 'data-placeholder ' => $value['name']), $loop, $default);
                     }
                 }
                 $display .= '</p>';
             }
         }
     }
     $search_custom_inputs_params = array();
     $display .= apply_filters('upme_search_custom_inputs', '', $search_custom_inputs_params);
     $display .= '<input type="hidden" name="userspage" id="userspage" value="" />';
     $display .= '<input type="hidden" name="upme-search-fired" id="upme-search-fired" value="1" />';
     // Custom Search Fields Creation Ends
     // Submit Button
     $display .= '<p class="upme-search-submit-p">';
     $display .= UPME_Html::button('submit', array('class' => 'upme-button-alt upme-search-submit', 'name' => 'upme-search', 'value' => $this->search_args['button_text']));
     $display .= '&nbsp;';
     $display .= apply_filters('upme_search_custom_actions', '');
     $display .= '&nbsp;';
     $display .= UPME_Html::button('button', array('class' => 'upme-button-alt upme-search-reset', 'name' => 'upme-search-reset', 'value' => $this->search_args['reset_button_text'], 'id' => 'upme-reset-search'));
     $display .= '</p>';
     $display .= '</form>';
     $display .= '</div>';
     $display .= '</div>';
     /* Extra Clearfix for Avada Theme */
     $display .= '<div class="upme-clearfix"></div>';
     return $display;
 }
"><?php 
_e('Export Users', 'upme');
?>
</label></th>
            <td>
                <?php 
$export_types = array('all_users' => __('All Users', 'upme'));
$users_query = new WP_User_Query(array('orderby' => 'registered', 'order' => 'desc'));
$result_users = $users_query->get_results();
foreach ($result_users as $user) {
    $name = trim(get_user_meta($user->ID, 'first_name', true) . ' ' . get_user_meta($user->ID, 'last_name', true));
    $name = $name == '' ? $user->display_name : $name;
    $id = $user->ID;
    $export_types[$id] = $name;
}
echo UPME_Html::drop_down(array('name' => 'site_export_users_type', 'id' => 'site_export_users_type', 'class' => 'chosen-admin_setting'), $export_types, '');
?>
<i class="upme-icon-question-sign upme-tooltip2 option-help"
                     original-title="<?php 
_e('Select Export Type', 'upme');
?>
"></i>
            </td>
        </tr>

        

        <tr valign="top">
            <th scope="row"><label>&nbsp;</label></th>
            <td>
                <?php 
                     original-title="<?php 
_e('Select Export Type', 'upme');
?>
"></i>
            </td>
        </tr>

        <tr valign="top">
            <th scope="row"><label for="Fields"><?php 
_e('Fields', 'upme');
?>
</label></th>
            <td>
                <?php 
$profile_fields = $upme_admin->upme_get_custom_field();
echo UPME_Html::drop_down(array('name' => 'site_export_fields[]', 'id' => 'site_export_fields', 'class' => 'chosen-admin_setting', 'multiple' => ''), $profile_fields, '');
?>
<i class="upme-icon-question-sign upme-tooltip2 option-help"
                     original-title="<?php 
_e('Select pages to be exported.', 'upme');
?>
"></i>
            </td>
        </tr>

        <tr valign="top">
            <th scope="row"><label>&nbsp;</label></th>
            <td>
                <?php 
echo UPME_Html::button('button', array('name' => 'upme-download-export-fields', 'id' => 'upme-download-export-fields', 'value' => __('Download', 'upme'), 'class' => 'button button-primary'));
?>
_e('These pages will be acessible to any user regardless of the restriction rule settings.', 'upme');
?>
"></i>
    </td>
</tr>

<tr valign="top">
    <th scope="row"><label for="Allowed Posts"><?php 
_e('Allowed Posts', 'upme');
?>
</label></th>
    <td>
        <?php 
global $upme_admin;
$site_content_allowed_posts = $upme_admin->get_all_posts();
echo UPME_Html::drop_down(array('name' => 'site_content_allowed_posts[]', 'id' => 'site_content_allowed_posts', 'class' => 'chosen-admin_setting', 'multiple' => '', 'data-placeholder' => 'Please Select'), $site_content_allowed_posts, $site_content_allowed_posts_val);
?>
<i class="upme-icon upme-icon-question-circle upme-tooltip2 option-help" original-title="<?php 
_e('These posts will be acessible to any user regardless of the restriction rule settings.', 'upme');
?>
"></i>
    </td>
</tr>

<tr valign="top">
    <th scope="row"><label for="Allowed URL's"><?php 
_e('Allowed URLs', 'upme');
?>
</label></th>
    <td>
        <?php