Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Then Please go to Frontend Dashboard | Frontend Dashboard | Login (Tab) | Settin
6. [fed_user role=user_role] to generate the role based user page

### Changelog

**v1.1 [11-August-2017]**
* Added more filter and action hooks for developers
* Minor: Bug fixed


**v1.0 [04-August-2017]**
- Public release

Expand Down
2 changes: 1 addition & 1 deletion admin/assets/fed_admin_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jQuery(document).ready(function ($) {


}
e.preventDefault;
e.preventDefault();
});

$('.fed_add_edit_input_container .fed_button.active').trigger('click');
Expand Down
6 changes: 6 additions & 0 deletions admin/assets/fed_admin_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ Loader
border: 1px solid #e0e0e0;
cursor: pointer;
}
.bc_fed.fed_plugins .thumbnail > img, .bc_fed.fed_plugins .thumbnail a > img {
width: 100% !important;
}
.bc_fed.fed_plugins .thumbnail {
padding:0 !important;
}
.bc_fed .fed_buttons_container .fed_button.active {
background-color: #00B5AD;
color: white;
Expand Down
144 changes: 61 additions & 83 deletions admin/function-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,131 +124,108 @@ function fed_profile_enable_disable( $condition = '', $type = '' ) {
* @return string
*/
function fed_get_input_details( $attr ) {

$placeholder = isset( $attr['placeholder'] ) && $attr['placeholder'] != '' ? esc_attr( $attr['placeholder'] ) : '';
$class = isset( $attr['class_name'] ) && $attr['class_name'] != '' ? 'form-control ' . esc_attr( $attr['class_name'] ) : 'form-control';
$name = isset( $attr['input_meta'] ) && $attr['input_meta'] != '' ? esc_attr( $attr['input_meta'] ) : $attr['input_meta'];
$value = isset( $attr['user_value'] ) && $attr['user_value'] != '' ? $attr['user_value'] : '';
$required = isset( $attr['is_required'] ) && $attr['is_required'] == 'true' ? 'required="required"' : '';
// $required = isset( $attr['is_required'] ) && $attr['is_required'] == 'true' ? '' : '';
$id = isset( $attr['id_name'] ) && $attr['id_name'] != '' ? $attr['id_name'] : '';
$input = '';
$readonly = isset( $attr['readonly'] ) && $attr['readonly'] != '' ? esc_attr( $attr['readonly'] ) : '';

$attr['extended'] = isset( $attr['extended'] ) ? ( is_string( $attr['extended'] ) ? unserialize( $attr['extended'] ) : $attr['extended'] ) : array();

$altFormat = isset( $attr['extended']['date_format'] ) && $attr['extended']['date_format'] != '' ? esc_attr( $attr['extended']['date_format'] ) : 'm-d-Y';

$dateFormat = isset( $attr['extended']['date_format'] ) && $attr['extended']['date_format'] != '' ? esc_attr( $attr['extended']['date_format'] ) : 'm-d-Y';

$mode = isset( $attr['extended']['date_mode'] ) && $attr['extended']['date_mode'] != '' ? esc_attr( $attr['extended']['date_mode'] ) : 'single';

$enableTime = isset( $attr['extended']['enable_time'] ) && $attr['extended']['enable_time'] != '' ? esc_attr( $attr['extended']['enable_time'] ) : false;

$time_24hr = isset( $attr['extended']['time_24hr'] ) && $attr['extended']['time_24hr'] != '' ? esc_attr( $attr['extended']['time_24hr'] ) : false;

switch ( $attr['input_type'] ) {
$values = array();
$values['placeholder'] = isset( $attr['placeholder'] ) && $attr['placeholder'] != '' ? esc_attr( $attr['placeholder'] ) : '';
$values['input_type'] = isset( $attr['input_type'] ) && $attr['input_type'] != '' ? esc_attr( $attr['input_type'] ) : 'text';
$values['class'] = isset( $attr['class_name'] ) && $attr['class_name'] != '' ? 'form-control ' . esc_attr( $attr['class_name'] ) : 'form-control';
$values['name'] = isset( $attr['input_meta'] ) && $attr['input_meta'] != '' ? esc_attr( $attr['input_meta'] ) : 'BUG';
$values['value'] = isset( $attr['user_value'] ) && $attr['user_value'] != '' ? $attr['user_value'] : '';
$values['required'] = isset( $attr['is_required'] ) && $attr['is_required'] == 'true' ? 'required="required"' : '';
$values['id'] = isset( $attr['id_name'] ) && $attr['id_name'] != '' ? $attr['id_name'] : '';
$values['default_value'] = isset( $attr['default_value'] ) && $attr['default_value'] != '' ? $attr['default_value'] : 'yes';
$input = '';
$values['readonly'] = isset( $attr['readonly'] ) && $attr['readonly'] === true ? 'readonly=readonly' : '';
$values['disabled'] = isset( $attr['disabled'] ) && $attr['disabled'] === true ? 'disabled=disabled' : '';

$label = isset( $attr['label'] ) ? $attr['label'] : '';
$values['extended'] = isset( $attr['extended'] ) ? ( is_string( $attr['extended'] ) ? unserialize( $attr['extended'] ) : $attr['extended'] ) : array();

$values['extra'] = isset( $attr['extra'] ) ? $attr['extra'] : '';

switch ( $values['input_type'] ) {
case 'single_line':
$input .= '<input ' . $readonly . ' ' . $required . ' type="text" name=" ' . $name . '" value="' . esc_attr( $value ) . '" class="' . $class . '" placeholder="' . $placeholder . '" id="' . $id . '">';
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['readonly'] . ' ' . $values['required'] . ' type="text" name=" ' . $values['name'] . '" value="' . esc_attr( $values['value'] ) . '" class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id="' . $values['id'] . '">';
break;

case 'hidden':
$input .= '<input ' . $readonly . ' ' . $required . ' type="hidden" name=" ' . $name . '" value="' . esc_attr( $value ) . '" class="' . $class . '" placeholder="' . $placeholder . '" id="' . $id . '">';
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['readonly'] . ' ' . $values['required'] . ' type="hidden" name=" ' . $values['name'] . '" value="' . esc_attr( $values['value'] ) . '" class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id="' . $values['id'] . '">';
break;

case 'email':
$input .= '<input ' . $readonly . ' ' . $required . ' type="email" name=" ' . $name . '" value="' . esc_attr( $value ) . '" class="' . $class . '" placeholder="' . $placeholder . '" id="' . $id . '">';
break;
case 'password':
$input .= '<input ' . $required . ' type="password" name=" ' . $name . '" class="' . $class . '" placeholder="' . $placeholder . '" id="' . $id . '">';
break;
case 'date':
$input .= '<input type="text" ' . $required . ' data-date-format="F j, Y h:i K" data-alt-format="' . $dateFormat . '" data-alt-input="true" data-mode="' . $mode . '" placeholder="' . $altFormat . '" data-enable-time="' . $enableTime . '" data-time_24hr="' . $time_24hr . '" type="text" name=" ' . $name . '" class="flatpickr ' . $class . '" id="' . $id . '" value="' . $value . '" >';
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['readonly'] . ' ' . $values['required'] . ' type="email" name=" ' . $values['name'] . '" value="' . esc_attr( $values['value'] ) . '" class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id="' . $values['id'] . '">';
break;

case 'url':
$input .= '<input ' . $required . ' type="url" placeholder="' . $placeholder . '" name=" ' . $name . '" class="' . $class . '" id="' . $id . '" value="' . esc_attr( $value ) . '" >';
case 'password':
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' type="password" name=" ' . $values['name'] . '" class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id="' . $values['id'] . '">';
break;

case 'color':
if ( $value == '' ) {
$value = '#000000';
}
$input .= '<input ' . $required . ' type="text" name=" ' . $name . '" class="jscolor {hash:true} ' . $class . '" id="' . $id . '" value="' . esc_attr( $value ) . '" >';
break;

case 'file':
if ( $value != '' ) {
$value = (int) $value;
$img = wp_get_attachment_image( $value, array( 100, 100 ) );
if ( $img == '' ) {
$img = '<span class="fed_upload_icon fa fa-2x fa fa fa-upload"></span>';
}
} else {
$value = '';
$img = '<span class="fed_upload_icon fa fa-2x fa fa fa-upload"></span>';
}
$input .= '<div class="fed_upload_container text-center ' . $class . '" id="' . $id . '">
<div class="fed_upload_image_container">' . $img . '</div>
<input type="hidden" name=" ' . $name . '" class="fed_upload_input" value="' . $value . '" />
</div>';
case 'url':
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' type="url" placeholder="' . $values['placeholder'] . '" name=" ' . $values['name'] . '" class="' . $values['class'] . '" id="' . $values['id'] . '" value="' . esc_attr( $values['value'] ) . '" >';
break;

case 'multi_line':
$rows = isset( $attr['rows'] ) ? absint( $attr['rows'] ) : 4;

$input .= '<textarea name="' . $name . '" rows="' . $rows . '"
class="' . $class . '" placeholder="' . $placeholder . '" id="' . $id . '">' . esc_textarea( $value ) . '</textarea>';
$input .= '<textarea ' . $values['disabled'] . $values['extra'] . ' name="' . $values['name'] . '" rows="' . $rows . '"
class="' . $values['class'] . '" placeholder="' . $values['placeholder'] . '" id="' . $values['id'] . '">' . esc_textarea( $values['value'] ) . '</textarea>';
break;

case 'checkbox':
$label = isset( $attr['label'] ) ? $attr['label'] : '';
$class = $class == 'form-control' ? '' : $class;
$input .= '<label class="' . $class . '" for="' . $name . '">
<input ' . $required . ' name="' . $name . '" value="yes"
type="checkbox" id="' . $id . '" ' . checked( $value, 'yes', false ) . '>
' . $label . '</label>';
$values['class'] = $values['class'] == 'form-control' ? '' : $values['class'];
$input .= '<label class="' . $values['class'] . '">
<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' name="' . $values['name'] . '" value="'.$values['default_value'].'" type="checkbox" id="' . $values['id'] . '" ' . checked( $values['value'], $values['default_value'], false ) . '>' . $label . '</label>';

break;

case 'select':
//$options = is_array( $attr['input_value'] ) ? $attr['input_value'] : array();
$options = strlen( $attr['input_value'] ) > 0 ? fed_convert_comma_separated_key_value( $attr['input_value'] ) : array();
$input .= '<select name="' . $name . '" class="' . $class . '" id="' . $id . '">';
$options = fed_get_select_option_value( $attr['input_value'] );
$input .= '<select ' . $values['disabled'] . $values['extra'] . ' name="' . $values['name'] . '" class="' . $values['class'] . '" id="' . $values['id'] . '">';
foreach ( $options as $key => $label ) {
$input .= '<option
value="' . esc_attr( $key ) . '" ' . selected( $value, $key, false ) . '>' . $label . '</option>';
value="' . esc_attr( $key ) . '" ' . selected( $values['value'], $key, false ) . '>' . $label . '</option>';
}
$input .= '</select>';
break;

case 'number':
$min = isset( $attr['input_min'] ) ? $attr['input_min'] : 0;
$max = isset( $attr['input_max'] ) ? $attr['input_max'] : 0;
$max = isset( $attr['input_max'] ) ? $attr['input_max'] : 999999;
$step = isset( $attr['input_step'] ) ? $attr['input_step'] : 'any';

$input .= '<input ' . $required . ' type="number" name="' . $name . '"
value="' . esc_attr( $value ) . '" class="' . $class . '"
placeholder="' . $placeholder . '"
$input .= '<input ' . $values['disabled'] . $values['extra'] . $values['required'] . ' type="number" name="' . $values['name'] . '"
value="' . esc_attr( $values['value'] ) . '" class="' . $values['class'] . '"
placeholder="' . $values['placeholder'] . '"
min="' . esc_attr( $min ) . '"
max="' . esc_attr( $max ) . '"
step="' . esc_attr( $step ) . '" id="' . $id . '">';
step="' . esc_attr( $step ) . '" id="' . $values['id'] . '">';
break;

case 'radio':
// $options = is_array( $attr['options'] ) ? $attr['options'] : array();
$class = $class == 'form-control' ? '' : $class;
$options = strlen( $attr['input_value'] ) > 0 ? fed_convert_comma_separated_key_value( $attr['input_value'] ) : array();
$values['class'] = $values['class'] == 'form-control' ? '' : $values['class'];
$options = strlen( $attr['input_value'] ) > 0 ? fed_convert_comma_separated_key_value( $attr['input_value'] ) : array();
foreach ( $options as $key => $label ) {
$input .= '<label class="' . $class . '" for="' . $key . '">
<input name="' . $name . '" value="' . $key . '"
type="radio"' . checked( $value, $key, false ) . $required . '>
$input .= '<label class="' . $values['class'] . '" for="' . $key . '">
<input ' . $values['disabled'] . $values['extra'] . ' name="' . $values['name'] . '" value="' . $key . '"
type="radio"' . checked( $values['value'], $key, false ) . $values['required'] . '>
' . $label . '
</label>';
}
break;

}

return apply_filters( 'fed_custom_input_fields', $input, $attr );
return apply_filters( 'fed_custom_input_fields', $input, $values, $attr );
}

function fed_get_select_option_value( $input_value ) {
if ( is_string( $input_value ) ) {
return strlen( $input_value ) > 0 ? fed_convert_comma_separated_key_value( $input_value ) : array();
}
if ( is_array( $input_value ) ) {
return count( $input_value ) > 0 ? $input_value : array();
}

}

/**
Expand Down Expand Up @@ -1290,6 +1267,7 @@ function fed_get_script_loading_pages() {
'fed_orders',
'fed_help',
'fed_status',
'fed_plugin_pages'
) );
}

Expand Down Expand Up @@ -1469,7 +1447,7 @@ function fed_currency_type() {
* @return array
*/
function fed_get_country_code() {
return apply_filters('fed_extend_country_code',array(
return apply_filters( 'fed_extend_country_code', array(
'empty' => 'Select Country',
'AF' => 'AFGHANISTAN',
'AX' => 'ÅLAND ISLANDS',
Expand Down Expand Up @@ -1714,7 +1692,7 @@ function fed_get_country_code() {
'YE' => 'YEMEN',
'ZM' => 'ZAMBIA',
'ZW' => 'ZIMBABWE',
));
) );
}

/**
Expand Down Expand Up @@ -2010,7 +1988,7 @@ function fed_show_help_message( array $message ) {
$content = isset( $message['content'] ) ? $message['content'] : '';

return '
<span class="' . $icon . '" data-toggle="popover" data-trigger="hover" title="' . $title . '" data-content="' . $content . '" data-original-title="'.$title.'"></span>
<span class="' . $icon . '" data-toggle="popover" data-trigger="hover" title="' . $title . '" data-content="' . $content . '" data-original-title="' . $title . '"></span>
';
}

Expand Down
38 changes: 20 additions & 18 deletions admin/layout/add_edit_profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ class="close"
}
$row = fed_process_user_profile( $rows, $action );
$selected = $row['input_type'];
}
else {
} else {
$row = fed_get_empty_value_for_user_profile( $action );
}
}
Expand Down Expand Up @@ -173,8 +172,10 @@ function fed_get_admin_up_role_based( $row, $action ) {
<div class="col-md-12">
<label><?php _e( 'Select user role to show this input field', 'fed' ) ?></label>
</div>
<?php foreach ( $all_roles as $key => $role ) {
$c_value = in_array( $key, $row['user_role'] ) ? 'Enable' : 'Disable';
<?php

foreach ( $all_roles as $key => $role ) {
$c_value = in_array( $key, $row['user_role'],false ) ? 'Enable' : 'Disable';
?>
<div class="col-md-2">
<?php echo fed_input_box( 'user_role', array(
Expand All @@ -192,7 +193,7 @@ function fed_get_admin_up_role_based( $row, $action ) {
<label><?php _e( 'Menu Location', 'fed' ) ?></label>
<?php echo fed_input_box( 'menu', array(
'default_value' => 'Enable',
'label' => __('Menu Location','fed'),
'label' => __( 'Menu Location', 'fed' ),
'value' => $row['menu'],
'options' => $options
), 'select' ); ?>
Expand All @@ -202,7 +203,7 @@ function fed_get_admin_up_role_based( $row, $action ) {
<div class="form-group col-md-4 fed_show_user_profile">
<?php echo fed_input_box( 'show_user_profile', array(
'default_value' => 'Disable',
'label' => __('Disable in User Profile?','fed'),
'label' => __( 'Disable in User Profile?', 'fed' ),
'value' => $row['show_user_profile'],
), 'checkbox' ); ?>
</div>
Expand All @@ -224,8 +225,8 @@ function fed_get_admin_up_display_permission( $row, $action, $type = '' ) {
?>
<div class="row fed_admin_up_display_permission">
<?php
if ( $action == 'profile' ) {
if ( $type == 'file' ) {
if ( $action === 'profile' ) {
if ( $type === 'file' ) {
$value = 'Disable';
$others = 'disabled';
$notification = '<i class="fa fa-info bg-info-font" data-toggle="popover" data-trigger="hover" title=" Status" data-content="Only registered user can upload the files."></i>';
Expand All @@ -236,11 +237,11 @@ function fed_get_admin_up_display_permission( $row, $action, $type = '' ) {
} ?>
<div class="form-group col-md-4">
<?php echo fed_input_box( 'show_register', array(
'default_value' => 'Enable',
'label' => __('Show this field on Register Form','fed').$notification,
'value' => $value,
'disabled' => $others
), 'checkbox' );
'default_value' => 'Enable',
'label' => __( 'Show this field on Register Form', 'fed' ) .' ' .$notification,
'value' => $value,
'disabled' => $others
), 'checkbox' );

?>

Expand Down Expand Up @@ -295,7 +296,7 @@ function fed_get_admin_up_label_input_order( $row ) {
<?php echo fed_input_box( 'label_name', array(
'class' => 'form-control ' . $change . ' ',
'value' => $row['label_name']
), 'text' ); ?>
), 'single_line' ); ?>
</div>

<div class="form-group col-md-6">
Expand Down Expand Up @@ -342,9 +343,10 @@ function fed_get_admin_up_input_meta( $row ) {
<?php
if ( fed_check_field_is_belongs_to_extra( $row['input_meta'] ) ) {
echo fed_input_box( 'input_meta', array(
'class' => 'fed_admin_input_meta form-control',
'value' => $row['input_meta'],
), 'readonly' );
'class' => 'fed_admin_input_meta form-control',
'value' => $row['input_meta'],
'readonly' => true,
), 'single_line' );

echo fed_input_box( 'fed_extra', array(
'value' => $row['input_meta'],
Expand All @@ -353,7 +355,7 @@ function fed_get_admin_up_input_meta( $row ) {
echo fed_input_box( 'input_meta', array(
'class' => 'fed_admin_input_meta form-control',
'value' => $row['input_meta']
), 'text' );
), 'single_line' );
}
?>
</div>
Expand Down
6 changes: 3 additions & 3 deletions admin/layout/input_fields/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
function fed_get_placeholder_field( array $row ) {
?>
<label for=""><?php _e( 'Placeholder Text', 'fed' ) ?></label>
<?php echo fed_input_box( 'placeholder', array( 'value' => $row['placeholder'] ), 'text' ); ?>
<?php echo fed_input_box( 'placeholder', array( 'value' => $row['placeholder'] ), 'single_line' ); ?>
<?php
}

function fed_get_class_field( array $row ) {
?>
<label for=""><?php _e( 'Class Name', 'fed' ) ?></label>
<?php echo fed_input_box( 'class_name', array( 'value' => $row['class_name'] ), 'text' ); ?>
<?php echo fed_input_box( 'class_name', array( 'value' => $row['class_name'] ), 'single_line' ); ?>
<?php
}

function fed_get_id_field( array $row ) {
?>
<label for=""><?php _e( 'ID Name', 'fed' ) ?></label>
<?php echo fed_input_box( 'id_name', array( 'value' => $row['id_name'] ), 'text' ); ?>
<?php echo fed_input_box( 'id_name', array( 'value' => $row['id_name'] ), 'single_line' ); ?>
<?php
}
2 changes: 1 addition & 1 deletion admin/layout/input_fields/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class="fed_admin_menu fed_ajax"
'placeholder' => __('Please enter the value by key,value','fed'),
'rows' => 10,
'value' => $row['input_value']
), 'textarea' ); ?>
), 'multi_line' ); ?>
</div>
<div class="col-md-7">
<div class="row fed_key_value_eg_container">
Expand Down
Loading