class function update

This commit is contained in:
magepeopleteam 2021-11-02 07:28:50 +00:00
parent 8b167c45e5
commit 0595afc443
17 changed files with 1063 additions and 11657 deletions

View File

@ -100,7 +100,7 @@ class MAGE_Setting_API {
if ( isset($section['desc']) && !empty($section['desc']) ) {
$section['desc'] = '<div class="inside">' . $section['desc'] . '</div>';
$callback = function() use ( $section ) {
echo str_replace( '"', '\"', $section['desc'] );
echo str_replace( '"', '\"', esc_html($section['desc']) );
};
} else if ( isset( $section['callback'] ) ) {
$callback = $section['callback'];
@ -115,10 +115,10 @@ class MAGE_Setting_API {
foreach ( $this->settings_fields as $section => $field ) {
foreach ( $field as $option ) {
$name = $option['name'];
$type = isset( $option['type'] ) ? $option['type'] : 'text';
$label = isset( $option['label'] ) ? $option['label'] : '';
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
$name = $option['name'];
$type = isset( $option['type'] ) ? $option['type'] : 'text';
$label = isset( $option['label'] ) ? $option['label'] : '';
$callback = isset( $option['callback'] ) ? $option['callback'] : array( $this, 'callback_' . $type );
$args = array(
'id' => $name,
@ -178,7 +178,7 @@ class MAGE_Setting_API {
$html = sprintf( '<input type="%1$s" class="%2$s-text" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -207,7 +207,7 @@ class MAGE_Setting_API {
$html = sprintf( '<input type="%1$s" class="%2$s-number" id="%3$s[%4$s]" name="%3$s[%4$s]" value="%5$s"%6$s%7$s%8$s%9$s/>', $type, $size, $args['section'], $args['id'], $value, $placeholder, $min, $max, $step );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -226,7 +226,7 @@ class MAGE_Setting_API {
$html .= sprintf( '%1$s</label>', $args['desc'] );
$html .= '</fieldset>';
echo $html;
echo mep_esc_html($html);
}
/**
@ -249,7 +249,7 @@ class MAGE_Setting_API {
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html;
echo mep_esc_html($html);
}
/**
@ -271,7 +271,7 @@ class MAGE_Setting_API {
$html .= $this->get_field_description( $args );
$html .= '</fieldset>';
echo $html;
echo mep_esc_html($html);
}
/**
@ -292,7 +292,7 @@ class MAGE_Setting_API {
$html .= sprintf( '</select>' );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -309,7 +309,7 @@ class MAGE_Setting_API {
$html = sprintf( '<textarea rows="5" cols="55" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]"%4$s>%5$s</textarea>', $size, $args['section'], $args['id'], $placeholder, $value );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -319,7 +319,7 @@ class MAGE_Setting_API {
* @return string
*/
function callback_html( $args ) {
echo $this->get_field_description( $args );
echo mep_esc_html($this->get_field_description( $args ));
}
/**
@ -348,7 +348,7 @@ class MAGE_Setting_API {
echo '</div>';
echo $this->get_field_description( $args );
echo wp_kses_post($this->get_field_description( $args ));
}
/**
@ -367,7 +367,7 @@ class MAGE_Setting_API {
$html .= '<input type="button" class="button wpsa-browse" value="' . $label . '" />';
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -383,7 +383,7 @@ class MAGE_Setting_API {
$html = sprintf( '<input type="password" class="%1$s-text" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>', $size, $args['section'], $args['id'], $value );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -399,7 +399,8 @@ class MAGE_Setting_API {
$html = sprintf( '<input type="text" class="%1$s-text wp-color-picker-field" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s" data-default-color="%5$s" />', $size, $args['section'], $args['id'], $value, $args['std'] );
$html .= $this->get_field_description( $args );
echo $html;
echo mep_esc_html($html);
}
@ -417,7 +418,7 @@ class MAGE_Setting_API {
'echo' => 0
);
$html = wp_dropdown_pages( $dropdown_args );
echo $html;
echo mep_esc_html($html);
}
/**
@ -507,7 +508,7 @@ class MAGE_Setting_API {
}
$html .= '</h2>';
echo $html;
echo mep_esc_html($html);
}
/**
@ -519,7 +520,7 @@ class MAGE_Setting_API {
?>
<div class="metabox-holder">
<?php foreach ( $this->settings_sections as $form ) { ?>
<div id="<?php echo $form['id']; ?>" class="group" style="display: none;">
<div id="<?php echo esc_attr($form['id']); ?>" class="group" style="display: none;">
<form method="post" action="options.php">
<?php
do_action( 'wsa_form_top_' . $form['id'], $form );
@ -644,5 +645,4 @@ class MAGE_Setting_API {
}
}
endif;

View File

@ -417,7 +417,7 @@ class MP_Event_All_Info_In_One
<th style="min-width: 80px;" title="<?php esc_attr_e('Available Qty', 'mage-eventpress'); ?>"><?php esc_html_e('Available', 'mage-eventpress'); ?></th>
<th style="min-width: 80px;" title="<?php esc_attr_e('Default Qty', 'mage-eventpress'); ?>"><?php esc_html_e('Default', 'mage-eventpress'); ?></th>
<?php $rsvqty = '<th style="min-width: 80px;" title="' . esc_attr__("Reserve Qty", "mage-eventpress") . '">' . esc_html__("Reserve", "mage-eventpress") . '</th>';
echo apply_filters('mep_add_extra_column', wp_kses_post($rsvqty)); ?>
echo apply_filters('mep_add_extra_column', mep_esc_html($rsvqty)); ?>
<th style="min-width: 150px;" title="<?php esc_attr_e('Sale End Date', 'mage-eventpress'); ?>"><?php esc_html_e('Sale End Date', 'mage-eventpress'); ?></th>
<th style="min-width: 120px;" title="<?php esc_attr_e('Sale End Time', 'mage-eventpress'); ?>"><?php esc_html_e('Sale End Time', 'mage-eventpress'); ?></th>
<th style="min-width: 140px;" title="<?php esc_attr_e('Qty Box Type', 'mage-eventpress'); ?>"><?php esc_html_e('Qty Box', 'mage-eventpress'); ?></th>
@ -518,8 +518,8 @@ class MP_Event_All_Info_In_One
<?php do_action('mep_pricing_table_empty_after_price_col'); ?>
<td><input type="number" size="4" pattern="[0-9]*" step="1" class="mp_formControl" name="option_qty_t[]" placeholder="Ex: 15" value="" /></td>
<td><input type="number" size="2" pattern="[0-9]*" class="mp_formControl" name="option_default_qty_t[]" placeholder="Ex: 1" value="" /></td>
<?php $option_rsv_t = '<td><input type="number" class="mp_formControl" name="option_rsv_t[]" placeholder="Ex: 5" value=""/></td>' ?>
<?php echo apply_filters('mep_add_field_to_ticket_type', wp_kses_post($option_rsv_t)); ?>
<?php $option_rsv_t = '<td><input type="number" class="mp_formControl" name="option_rsv_t[]" placeholder="Ex: 5" value=""/></td>'; ?>
<?php echo apply_filters('mep_add_field_to_ticket_type', mep_esc_html($option_rsv_t)); ?>
<td>
<div class="sell_expire_date">
<input type="date" id="ticket_sale_start_date" value='' name="option_sale_end_date[]" />

View File

@ -6,12 +6,9 @@ if (!class_exists('EDD_SL_Plugin_Updater')) {
require_once(dirname(__DIR__) . '/lib/classes/EDD_SL_Plugin_Updater.php');
}
require_once(dirname(__DIR__) . '/lib/classes/class-wc-product-data.php');
require_once(dirname(__DIR__) . '/lib/classes/class-form-fields-generator.php');
require_once(dirname(__DIR__) . '/lib/classes/class-form-fields-wrapper.php');
require_once(dirname(__DIR__) . '/lib/classes/class-form-fields-generator.php');
require_once(dirname(__DIR__) . '/lib/classes/class-meta-box.php');
require_once(dirname(__DIR__) . '/lib/classes/class-taxonomy-edit.php');
require_once(dirname(__DIR__) . '/lib/classes/class-theme-page.php');
require_once(dirname(__DIR__) . '/lib/classes/class-menu-page.php');
require_once(dirname(__DIR__) . "/inc/class/mep_settings_api.php");
require_once(dirname(__DIR__) . "/inc/welcome.php");
require_once(dirname(__DIR__) . "/inc/status.php");

View File

@ -1417,6 +1417,214 @@ if (!function_exists('event_single_template_list')) {
}
}
if (!function_exists('mep_field_generator')) {
function mep_field_generator($type,$option){
$FormFieldsGenerator = new FormFieldsGenerator();
if ( $type === 'text' ) {
return $FormFieldsGenerator->field_text( $option );
} elseif ( $type === 'text_multi' ) {
return $FormFieldsGenerator->field_text_multi( $option );
} elseif ( $type === 'textarea' ) {
return $FormFieldsGenerator->field_textarea( $option );
} elseif ( $type === 'checkbox' ) {
return $FormFieldsGenerator->field_checkbox( $option );
} elseif ( $type === 'checkbox_multi' ) {
return $FormFieldsGenerator->field_checkbox_multi( $option );
} elseif ( $type === 'radio' ) {
return $FormFieldsGenerator->field_radio( $option );
} elseif ( $type === 'select' ) {
return $FormFieldsGenerator->field_select( $option );
} elseif ( $type === 'range' ) {
return $FormFieldsGenerator->field_range( $option );
} elseif ( $type === 'range_input' ) {
return $FormFieldsGenerator->field_range_input( $option );
} elseif ( $type === 'switch' ) {
return $FormFieldsGenerator->field_switch( $option );
} elseif ( $type === 'switch_multi' ) {
return $FormFieldsGenerator->field_switch_multi( $option );
} elseif ( $type === 'switch_img' ) {
return $FormFieldsGenerator->field_switch_img( $option );
} elseif ( $type === 'time_format' ) {
return $FormFieldsGenerator->field_time_format( $option );
} elseif ( $type === 'date_format' ) {
return $FormFieldsGenerator->field_date_format( $option );
} elseif ( $type === 'datepicker' ) {
return $FormFieldsGenerator->field_datepicker( $option );
} elseif ( $type === 'color_sets' ) {
return $FormFieldsGenerator->field_color_sets( $option );
} elseif ( $type === 'colorpicker' ) {
return $FormFieldsGenerator->field_colorpicker( $option );
} elseif ( $type === 'colorpicker_multi' ) {
return $FormFieldsGenerator->field_colorpicker_multi( $option );
} elseif ( $type === 'link_color' ) {
return $FormFieldsGenerator->field_link_color( $option );
} elseif ( $type === 'icon' ) {
return $FormFieldsGenerator->field_icon( $option );
} elseif ( $type === 'icon_multi' ) {
return $FormFieldsGenerator->field_icon_multi( $option );
} elseif ( $type === 'dimensions' ) {
return $FormFieldsGenerator->field_dimensions( $option );
} elseif ( $type === 'wp_editor' ) {
return $FormFieldsGenerator->field_wp_editor( $option );
} elseif ( $type === 'select2' ) {
return $FormFieldsGenerator->field_select2( $option );
} elseif ( $type === 'faq' ) {
return $FormFieldsGenerator->field_faq( $option );
} elseif ( $type === 'grid' ) {
return $FormFieldsGenerator->field_grid( $option );
} elseif ( $type === 'color_palette' ) {
return $FormFieldsGenerator->field_color_palette( $option );
} elseif ( $type === 'color_palette_multi' ) {
return $FormFieldsGenerator->field_color_palette_multi( $option );
} elseif ( $type === 'media' ) {
return $FormFieldsGenerator->field_media( $option );
} elseif ( $type === 'media_multi' ) {
return $FormFieldsGenerator->field_media_multi( $option );
} elseif ( $type === 'repeatable' ) {
return $FormFieldsGenerator->field_repeatable( $option );
} elseif ( $type === 'user' ) {
return $FormFieldsGenerator->field_user( $option );
} elseif ( $type === 'margin' ) {
return $FormFieldsGenerator->field_margin( $option );
} elseif ( $type === 'padding' ) {
return $FormFieldsGenerator->field_padding( $option );
} elseif ( $type === 'border' ) {
return $FormFieldsGenerator->field_border( $option );
} elseif ( $type === 'switcher' ) {
return $FormFieldsGenerator->field_switcher( $option );
} elseif ( $type === 'password' ) {
return $FormFieldsGenerator->field_password( $option );
} elseif ( $type === 'post_objects' ) {
return $FormFieldsGenerator->field_post_objects( $option );
} elseif ( $type === 'google_map' ) {
return $FormFieldsGenerator->field_google_map( $option );
}elseif ( $type === 'image_link' ) {
return $FormFieldsGenerator->field_image_link($option);
}else {
return '';
}
}
}
if (!function_exists('mep_esc_html')) {
function mep_esc_html($string){
$allow_attr = array(
'input' => array(
'type' => [],
'class' => [],
'id' => [],
'name' => [],
'value' => [],
'size' => [],
'placeholder' => [],
'min' => [],
'max' => [],
'checked' => [],
'required' => [],
'disabled' => [],
'readonly' => [],
'step' => [],
'data-default-color' => [],
),
'p' => [
'class' => []
],
'img' => [
'class' => [],
'id' => [],
'src' => [],
'alt' => [],
],
'fieldset' => [
'class' => []
],
'label' => [
'for' => [],
'class' => []
],
'select' => [
'class' => [],
'name' => [],
'id' => [],
],
'option' => [
'class' => [],
'value' => [],
'id' => [],
],
'textarea' => [
'class' => [],
'rows' => [],
'id' => [],
'cols' => [],
'name' => [],
],
'h2' => ['class'=> [],'id'=> [],],
'a' => ['class'=> [],'id'=> [],'href'=> [],],
'div' => ['class'=> [],'id'=> [],'data'=> [],],
'span' => [
'class' => [],
'id' => [],
'data' => [],
],
'i' => [
'class' => [],
'id' => [],
'data' => [],
],
'table' => [
'class' => [],
'id' => [],
'data' => [],
],
'tr' => [
'class' => [],
'id' => [],
'data' => [],
],
'td' => [
'class' => [],
'id' => [],
'data' => [],
],
'thead' => [
'class' => [],
'id' => [],
'data' => [],
],
'tbody' => [
'class' => [],
'id' => [],
'data' => [],
],
'th' => [
'class' => [],
'id' => [],
'data' => [],
],
'svg' => [
'class' => [],
'id' => [],
'width' => [],
'height' => [],
'viewBox' => [],
'xmlns' => [],
],
'g' => [
'fill' => [],
],
'path' => [
'd' => [],
],
'br' => array(),
'em' => array(),
'strong' => array(),
);
return wp_kses($string,$allow_attr);
}
}
if (!function_exists('mep_title_cutoff_words')) {
function mep_title_cutoff_words($text, $length) {

View File

@ -221,8 +221,8 @@ jQuery(document).ready(function($) {
score_text = 'Week';
}
html = '<span style="width:'+parseInt(score)+'%;background-color: '+score_style+'"></span>';
$(".field-password-wrapper-<?php echo $id; ?> .scorePassword").html(html)
$(".field-password-wrapper-<?php echo $id; ?> .scoreText").html(score_text)
$(".field-password-wrapper- .scorePassword").html(html)
$(".field-password-wrapper- .scoreText").html(score_text)
})

View File

@ -391,7 +391,7 @@ class Insights {
$notice .= 'We are using Appsero to collect your data. <a href="' . $policy_url . '">Learn more</a> about how Appsero collects and handle your data.</p>';
echo '<div class="updated"><p>';
echo $notice;
echo mep_esc_html($notice);
echo '</p><p class="submit">';
echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . $this->client->__trans( 'Allow' ) . '</a>';
echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . $this->client->__trans( 'No thanks' ) . '</a>';
@ -412,14 +412,14 @@ class Insights {
*/
public function handle_optin_optout() {
if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && $_GET[ $this->client->slug . '_tracker_optin' ] == 'true' ) {
if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && mage_array_strip($_GET[ $this->client->slug . '_tracker_optin' ]) == 'true' ) {
$this->optin();
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optin' ) );
exit;
}
if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && $_GET[ $this->client->slug . '_tracker_optout' ] == 'true' ) {
if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && mage_array_strip($_GET[ $this->client->slug . '_tracker_optout' ]) == 'true' ) {
$this->optout();
wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optout' ) );
@ -756,7 +756,7 @@ class Insights {
$custom_reasons = apply_filters( 'appsero_custom_deactivation_reasons', array() );
?>
<div class="wd-dr-modal" id="<?php echo $this->client->slug; ?>-wd-dr-modal">
<div class="wd-dr-modal" id="<?php echo esc_attr($this->client->slug); ?>-wd-dr-modal">
<div class="wd-dr-modal-wrap">
<div class="wd-dr-modal-header">
<h3><?php $this->client->_etrans( 'Goodbyes are always hard. If you have a moment, please let us know how we can improve.' ); ?></h3>
@ -768,7 +768,7 @@ class Insights {
<li data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
<label>
<input type="radio" name="selected-reason" value="<?php echo esc_attr($reason['id']); ?>">
<div class="wd-de-reason-icon"><?php echo esc_html($reason['icon']); ?></div>
<div class="wd-de-reason-icon"><?php echo mep_esc_html($reason['icon']); ?></div>
<div class="wd-de-reason-text"><?php echo esc_html($reason['text']); ?></div>
</label>
</li>
@ -780,7 +780,7 @@ class Insights {
<li data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>" data-customreason="true">
<label>
<input type="radio" name="selected-reason" value="<?php echo esc_attr($reason['id']); ?>">
<div class="wd-de-reason-icon"><?php echo esc_html($reason['icon']); ?></div>
<div class="wd-de-reason-icon"><?php echo mep_esc_html($reason['icon']); ?></div>
<div class="wd-de-reason-text"><?php echo esc_html($reason['text']); ?></div>
</label>
</li>
@ -810,11 +810,11 @@ class Insights {
<script type="text/javascript">
(function($) {
$(function() {
var modal = $( '#<?php echo $this->client->slug; ?>-wd-dr-modal' );
var modal = $( '#<?php echo esc_attr($this->client->slug); ?>-wd-dr-modal' );
var deactivateLink = '';
// Open modal
$( '#the-list' ).on('click', 'a.<?php echo $this->client->slug; ?>-deactivate-link', function(e) {
$( '#the-list' ).on('click', 'a.<?php echo esc_attr($this->client->slug); ?>-deactivate-link', function(e) {
e.preventDefault();
modal.addClass('modal-active');
@ -872,7 +872,7 @@ class Insights {
url: ajaxurl,
type: 'POST',
data: {
action: '<?php echo $this->client->slug; ?>_submit-uninstall-reason',
action: '<?php echo esc_attr($this->client->slug); ?>_submit-uninstall-reason',
reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
},

View File

@ -231,7 +231,7 @@ class License {
*/
public function menu_output() {
if ( isset( $_POST['submit'] ) ) {
$this->license_form_submit( $_POST );
$this->license_form_submit( mage_array_strip($_POST) );
}
$license = $this->get_license();
@ -262,13 +262,13 @@ class License {
<svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
</svg>
<input type="text" value="<?php echo $this->get_input_license_value( $action, $license ); ?>"
<input type="text" value="<?php echo esc_attr($this->get_input_license_value( $action, $license )); ?>"
placeholder="<?php echo esc_attr( $this->client->__trans( 'Enter your license key to activate' ) ); ?>" name="license_key"
<?php echo ( 'deactive' == $action ) ? 'readonly="readonly"' : ''; ?>
/>
</div>
<button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
<?php echo $action == 'active' ? $this->client->__trans( 'Activate License' ) : $this->client->__trans( 'Deactivate License' ); ?>
<?php echo esc_html($action == 'active' ? $this->client->__trans( 'Activate License' ) : $this->client->__trans( 'Deactivate License' )); ?>
</button>
</div>
</form>
@ -503,7 +503,7 @@ class License {
<?php if ( empty( $license['activation_limit'] ) ) { ?>
<p><?php $this->client->_etrans( 'Unlimited' ); ?></p>
<?php } else { ?>
<p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
<p class="<?php echo esc_attr($license['remaining'] ? '' : 'occupied'); ?>">
<?php printf( $this->client->__trans( '%1$d out of %2$d' ), $license['remaining'], $license['activation_limit'] ); ?>
</p>
<?php } ?>
@ -529,7 +529,7 @@ class License {
if ( ! empty( $this->error ) ) {
?>
<div class="notice notice-error is-dismissible appsero-license-section">
<p><?php echo $this->error; ?></p>
<p><?php echo esc_html($this->error); ?></p>
</div>
<?php
}
@ -537,7 +537,7 @@ class License {
if ( ! empty( $this->success ) ) {
?>
<div class="notice notice-success is-dismissible appsero-license-section">
<p><?php echo $this->success; ?></p>
<p><?php echo esc_html($this->success); ?></p>
</div>
<?php
}

View File

@ -486,7 +486,7 @@ class EDD_SL_Plugin_Updater {
global $edd_plugin_data;
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != mage_array_strip($_REQUEST['edd_sl_action']) ) {
return;
}
@ -502,7 +502,7 @@ class EDD_SL_Plugin_Updater {
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
}
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
$data = $edd_plugin_data[ mage_array_strip($_REQUEST['slug']) ];
$version_info = $this->get_cached_version_info();
if( false === $version_info ) {
@ -511,7 +511,7 @@ class EDD_SL_Plugin_Updater {
'edd_action' => 'get_version',
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
'slug' => $_REQUEST['slug'],
'slug' => mage_array_strip($_REQUEST['slug']),
'author' => $data['author'],
'url' => home_url(),
'beta' => ! empty( $data['beta'] )

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,610 +1,2 @@
<?php
/*
* @Author : PickPlugins
* Copyright : 2015 PickPlugins.com
*
* Version : 1.0.3
*/
if ( ! defined('ABSPATH')) exit; // if direct access
if( ! class_exists( 'AddMenuPage' ) ) {
class AddMenuPage {
public $data = array();
public function __construct( $args ){
$this->data = &$args;
if( $this->add_in_menu() ) {
add_action( 'admin_menu', array( $this, 'add_menu_in_admin_menu' ), 12 );
}
add_action( 'admin_init', array( $this, 'display_fields' ), 12 );
add_filter( 'whitelist_options', array( $this, 'whitelist_options' ), 99, 1 );
}
public function add_menu_in_admin_menu(){
if( "main" == $this->get_menu_type() ) {
add_menu_page( $this->get_menu_name(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ), $this->get_menu_icon() );
}
foreach ($this->get_pages() as $panelsIndex=>$panels):
add_submenu_page( $this->get_menu_slug(), $panels['page_nav'], $panels['page_nav'], $this->get_capability(),
$panelsIndex,
array( $this, 'display_function' ) );
endforeach;
}
public function section_callback( $section ) {
$section_id = $section['id'];
$data = isset( $section['callback'][0]->data ) ? $section['callback'][0]->data : array();
?>
<?php
//$description = $section['description'];
$description = $section['id'] ;
echo '<div id="'.esc_attr($section['id']).'"></div>';
}
public function display_fields() {
foreach ($this->get_pages() as $panelsIndex=>$panels):
foreach ($panels['page_settings'] as $sectionIndex=>$sections):
add_settings_section(
$sectionIndex,
isset( $sections['title'] ) ? $sections['title'] : "",
array( $this, 'section_callback'),
$panelsIndex
);
foreach( $sections['options'] as $option ) :
add_settings_field( $option['id'], $option['title'], array($this,'field_generator'), $panelsIndex, $sectionIndex, $option );
endforeach;
endforeach;
endforeach;
}
public function field_generator( $option ) {
$id = isset( $option['id'] ) ? $option['id'] : "";
$type = isset( $option['type'] ) ? $option['type'] : "";
$details = isset( $option['details'] ) ? $option['details'] : "";
if( empty( $id ) ) return;
$prent_option_name = $this->get_option_name();
$FormFieldsGenerator = new FormFieldsGenerator();
if(!empty($prent_option_name)):
$field_name = $prent_option_name.'['.$id.']';
$option['field_name'] = $field_name;
$prent_option_value = get_option( $prent_option_name );
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
else:
$option['field_name'] = $id;
$option['value'] = get_option( $id );
endif;
?>
<?php
if( isset($option['type']) && $option['type'] === 'text' ){
echo $FormFieldsGenerator->field_text($option);
}
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
echo $FormFieldsGenerator->field_text_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
echo $FormFieldsGenerator->field_textarea($option);
}
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
echo $FormFieldsGenerator->field_checkbox($option);
}
elseif( isset($option['type']) && $option['type'] === 'checkbox_multi' ){
echo $FormFieldsGenerator->field_checkbox_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'radio' ){
echo $FormFieldsGenerator->field_radio($option);
}
elseif( isset($option['type']) && $option['type'] === 'select' ){
echo $FormFieldsGenerator->field_select($option);
}
elseif( isset($option['type']) && $option['type'] === 'range' ){
echo $FormFieldsGenerator->field_range($option);
}
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
echo $FormFieldsGenerator->field_range_input($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch' ){
echo $FormFieldsGenerator->field_switch($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
echo $FormFieldsGenerator->field_switch_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
echo $FormFieldsGenerator->field_switch_img($option);
}
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
echo $FormFieldsGenerator->field_time_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
echo $FormFieldsGenerator->field_date_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
echo $FormFieldsGenerator->field_datepicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
echo $FormFieldsGenerator->field_colorpicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
echo $FormFieldsGenerator->field_colorpicker_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
echo $FormFieldsGenerator->field_link_color($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon' ){
echo $FormFieldsGenerator->field_icon($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
echo $FormFieldsGenerator->field_icon_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
echo $FormFieldsGenerator->field_dimensions($option);
}
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
echo $FormFieldsGenerator->field_wp_editor($option);
}
elseif( isset($option['type']) && $option['type'] === 'select2' ){
echo $FormFieldsGenerator->field_select2($option);
}
elseif( isset($option['type']) && $option['type'] === 'faq' ){
echo $FormFieldsGenerator->field_faq($option);
}
elseif( isset($option['type']) && $option['type'] === 'grid' ){
echo $FormFieldsGenerator->field_grid($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_sets' ){
echo $FormFieldsGenerator->field_color_sets($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
echo $FormFieldsGenerator->field_color_palette($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
echo $FormFieldsGenerator->field_color_palette_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'media' ){
echo $FormFieldsGenerator->field_media($option);
}
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
echo $FormFieldsGenerator->field_media_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
echo $FormFieldsGenerator->field_repeatable($option);
}
elseif( isset($option['type']) && $option['type'] === 'user' ){
echo $FormFieldsGenerator->field_user($option);
}
elseif( isset($option['type']) && $option['type'] === 'margin' ){
echo $FormFieldsGenerator->field_margin($option);
}
elseif( isset($option['type']) && $option['type'] === 'padding' ){
echo $FormFieldsGenerator->field_padding($option);
}
elseif( isset($option['type']) && $option['type'] === 'border' ){
echo $FormFieldsGenerator->field_border($option);
}
elseif( isset($option['type']) && $option['type'] === 'switcher' ){
echo $FormFieldsGenerator->field_switcher($option);
}
elseif( isset($option['type']) && $option['type'] === 'password' ){
echo $FormFieldsGenerator->field_password($option);
}
elseif( isset($option['type']) && $option['type'] === 'post_objects' ){
echo $FormFieldsGenerator->field_post_objects($option);
}
elseif( isset($option['type']) && $option['type'] === 'google_map' ){
echo $FormFieldsGenerator->field_google_map($option);
}
elseif( isset($option['type']) && $option['type'] === 'image_link' ){
echo $FormFieldsGenerator->field_image_link($option);
}
elseif( isset($option['type']) && $option['type'] === 'option_group_accordion' ){
echo $FormFieldsGenerator->field_option_group_accordion($option);
}
elseif( isset($option['type']) && $option['type'] === 'option_group_tabs' ){
echo $FormFieldsGenerator->field_option_group_tabs($option);
}
elseif( isset($option['type']) && $option['type'] === 'option_group' ){
echo $FormFieldsGenerator->field_option_group($option);
}
elseif( isset($option['type']) && $option['type'] === $type ){
do_action( "wp_theme_settings_field_$type", $option );
}
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
}
public function generate_field_text( $option ){
$prent_option_name = $this->get_option_name();
$id = isset( $option['id'] ) ? $option['id'] : "";
$placeholder = isset( $option['placeholder'] ) ? $option['placeholder'] : "";
$default = isset( $option['default'] ) ? $option['default'] : "";
if($prent_option_name):
$field_name = $prent_option_name.'['.$id.']';
$prent_option_value = get_option( $prent_option_name );
$value = $prent_option_value[$id];
else:
$field_name = $id;
$value = get_option( $id );
endif;
$value = !empty($value) ? $value : $default;
echo "<input type='text' name='$field_name' id='$id' placeholder='$placeholder' value='$value' />";
}
public function whitelist_options( $whitelist_options ){
$prent_option_name = $this->get_option_name();
if($prent_option_name):
$whitelist_options[$this->get_menu_slug()][] = $prent_option_name;
else:
foreach( $this->get_pages() as $page_id => $page ): foreach( $page['page_settings'] as $section ):
foreach( $section['options'] as $option ):
$whitelist_options[$this->get_menu_slug()][] = $option['id'];
endforeach; endforeach;
endforeach;
endif;
update_option('whitelist_options',$whitelist_options );
return $whitelist_options;
}
public function display_function(){
?>
<div class='wrap ppof-settings'>
<?php
parse_str( $_SERVER['QUERY_STRING'], $nav_menu_url_args );
global $pagenow;
settings_errors();
?>
<div class='navigation'>
<div class="nav-header">
<?php
do_action('nav_header_top');
?>
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
<?php
do_action('nav_header_bottom');
?>
</div>
<ul class="nav-items">
<?php
//$current_page = isset($_GET['page'])? $_GET['page'] : '';
$current_page = $this->get_current_page();
foreach( $this->get_pages() as $page_id => $page ):
$page_settings = !empty($page['page_settings']) ? $page['page_settings'] : array();
$page_settings_count = count($page_settings);
//var_dump($page_settings);
?>
<li class="nav-item-wrap <?php if(($page_settings_count > 1)) echo 'has-child'; ?> <?php if($current_page==$page_id) echo 'active'; ?>">
<a dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
$page_id; ?>' class='nav-item'><?php echo $page['page_nav']; ?>
<?php if(($page_settings_count > 1)) echo '<i class="child-nav-icon fas fa-angle-down"></i>'; ?>
</a>
<?php
if(($page_settings_count > 1)):
?>
<ul class="child-navs">
<?php
foreach ($page_settings as $section_id=>$nav_sections):
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
//var_dump($nav_sections_title);
?>
<li>
<a sectionId="<?php echo $section_id; ?>" dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
$page_id; ?>' class='nav-item <?php if($current_page==$page_id) echo 'active'; ?>'><?php echo $nav_sections_title; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
<?php
endif;
?>
</li>
<?php
endforeach;
?>
</ul>
<div class="nav-footer">
<?php
do_action('nav_footer_top');
?>
<?php
do_action('nav_footer_bottom');
?>
</div>
</div>
<div class="form-wrapper">
<script>jQuery(document).ready(function($){
})
</script>
<form class="" action='options.php' method='post'>
<div class="form-header">
<div class="pp-row">
<div class="pp-col pp-col-50">
<div class="pagename"> # <?php echo $this->get_menu_page_title(); ?></div>
</div>
<div class="pp-col pp-col-50 text-align-right">
<!-- <input type="search" class="search-options" placeholder="Search Option..." value="">-->
<!-- <input type="submit" value="Reset" class="button button-secondary reset-options">-->
<?php submit_button(null,'primary', null, false); ?>
</div>
</div>
</div>
<div class="form-section">
<?php
$current_page = $this->get_current_page();
foreach ($this->get_pages() as $panelsIndex=>$panels):
?>
<div id="<?php echo $panelsIndex; ?>" class="tab-content <?php if($current_page==$panelsIndex) echo 'active'; ?> tab-content-<?php echo
$panelsIndex;
?>">
<?php
do_settings_sections( $panelsIndex);
?>
</div>
<?php
endforeach;
settings_fields( $this->get_menu_slug() );
?>
</div>
<div class="form-footer">
<div class="pp-row">
<div class="pp-col pp-col-50">
<div class=""></div>
<span>Developed by : <a class="" href="http://mage-people.com">MagePeople Inc.</a> | Version: 1.0.0</span>
</div>
<div class="pp-col pp-col-50 text-align-right">
<?php submit_button(null,'primary', null, false); ?>
</div>
</div>
</div>
</form>
</div>
</div>
<?php
}
// Default Functions
public function get_current_page(){
$current_page = isset($_GET['page'])? mage_array_strip($_GET['page']) : '';
$pages = array();
foreach ($this->get_pages() as $panelsIndex=>$panels):
$pages[] = $panelsIndex;
endforeach;
// var_dump($pages);
foreach ($pages as $page):
if($current_page == $page){
$_current_page = $page;
break;
}
else{
$_current_page = $pages[0];
}
endforeach;
return $_current_page;
}
private function get_item_name(){
if( isset( $this->data['item_name'] ) ) return $this->data['item_name'];
else return "PickPlugins";
}
private function get_item_version(){
if( isset( $this->data['item_version'] ) ) return $this->data['item_version'];
else return "1.0.0";
}
private function get_menu_type(){
if( isset( $this->data['menu_type'] ) ) return $this->data['menu_type'];
else return "main";
}
private function get_pages(){
if( isset( $this->data['panels'] ) ) return $this->data['panels'];
else return array();
}
private function get_settings_name(){
if( isset( $this->data['settings_name'] ) ) return $this->data['settings_name'];
else return "my_custom_settings";
}
private function get_menu_icon(){
if( isset( $this->data['menu_icon'] ) ) return $this->data['menu_icon'];
else return "";
}
private function get_menu_slug(){
if( isset( $this->data['menu_slug'] ) ) return $this->data['menu_slug'];
else return "my-custom-settings";
}
private function get_capability(){
if( isset( $this->data['capability'] ) ) return $this->data['capability'];
else return "manage_options";
}
private function get_menu_page_title(){
if( isset( $this->data['menu_page_title'] ) ) return $this->data['menu_page_title'];
else return "My Custom Menu";
}
private function get_menu_name(){
if( isset( $this->data['menu_name'] ) ) return $this->data['menu_name'];
else return "Menu Name";
}
private function get_menu_title(){
if( isset( $this->data['menu_title'] ) ) return $this->data['menu_title'];
else return "Menu Title";
}
private function get_page_title(){
if( isset( $this->data['page_title'] ) ) return $this->data['page_title'];
else return "Page Title";
}
private function add_in_menu(){
if( isset( $this->data['add_in_menu'] ) && $this->data['add_in_menu'] ) return true;
else return false;
}
private function get_option_name(){
if( isset( $this->data['option_name'] )) return $this->data['option_name'];
else return false;
}
private function get_option_id(){
if( isset( $this->data['option_id'] ) && $this->data['option_id'] ) return $this->data['option_id'];
else return "";
}
}
}
if ( ! defined('ABSPATH')) exit; // if direct access

View File

@ -1,68 +1,70 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
if (!defined('ABSPATH')) {
exit;
} // if direct access
if ( ! class_exists( 'AddMetaBox' ) ) {
if (!class_exists('AddMetaBox')) {
class AddMetaBox {
class AddMetaBox
{
public $data = array();
public function __construct( $args ) {
public function __construct($args)
{
$this->data = &$args;
if ( isset( $this->data['seat_plan'] ) ) {
add_action( 'mp_event_all_in_tab_item_seat_plan', array( $this, 'meta_box_callback' ), 10, 1 );
}elseif ( isset( $this->data['every_day_setting'] ) ) {
add_action('mp_event_recurring_every_day_setting',array( $this, 'meta_box_callback' ), 10, 1);
} elseif ( $this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal' ) {
add_action( 'mp_event_all_in_tab_menu', array( $this, 'mp_event_all_in_tab_menu_list' ) );
add_action( 'mp_event_all_in_tab_item', array( $this, 'meta_box_callback' ), 10, 1 );
if (isset($this->data['seat_plan'])) {
add_action('mp_event_all_in_tab_item_seat_plan', array($this, 'meta_box_callback'), 10, 1);
} elseif (isset($this->data['every_day_setting'])) {
add_action('mp_event_recurring_every_day_setting', array($this, 'meta_box_callback'), 10, 1);
} elseif ($this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal') {
add_action('mp_event_all_in_tab_menu', array($this, 'mp_event_all_in_tab_menu_list'));
add_action('mp_event_all_in_tab_item', array($this, 'meta_box_callback'), 10, 1);
} else {
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 12 );
add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 12);
}
add_action( 'save_post', array( $this, 'save_post' ), 12 );
add_action('save_post', array($this, 'save_post'), 12);
}
public function add_meta_boxes() {
add_meta_box( $this->get_meta_box_id(), $this->get_meta_box_title(), array( $this, 'meta_box_callback' ),
$this->get_meta_box_screen(), $this->get_meta_box_context(), $this->get_meta_box_priority(), $this->get_callback_args() );
public function add_meta_boxes()
{
add_meta_box(
$this->get_meta_box_id(),
$this->get_meta_box_title(),
array($this, 'meta_box_callback'),
$this->get_meta_box_screen(),
$this->get_meta_box_context(),
$this->get_meta_box_priority(),
$this->get_callback_args()
);
}
public function save_post( $post_id ) {
public function save_post($post_id)
{
$get_option_name = $this->get_option_name();
$post_id = $this->get_post_id();
if ( ! empty( $get_option_name ) ):
$option_value = serialize( stripslashes_deep(mage_array_strip($_POST[ $get_option_name ])) );
if (!empty($get_option_name)) :
$option_value = serialize(stripslashes_deep(mage_array_strip($_POST[$get_option_name])));
update_post_meta($post_id, $get_option_name, $option_value);
else :
update_post_meta( $post_id, $get_option_name, $option_value );
foreach ($this->get_panels() as $panelsIndex => $panel) :
foreach ($panel['sections'] as $sectionIndex => $section) :
foreach ($section['options'] as $option) :
$option_value = isset($_POST[$option['id']]) ? stripslashes_deep(mage_array_strip($_POST[$option['id']])) : '';
else:
foreach ( $this->get_panels() as $panelsIndex => $panel ):
foreach ( $panel['sections'] as $sectionIndex => $section ):
foreach ( $section['options'] as $option ):
$option_value = isset( $_POST[ $option['id'] ] ) ? stripslashes_deep(mage_array_strip($_POST[ $option['id'] ])) : '';
if ( is_array( $option_value ) ) {
$option_value = serialize( $option_value );
if (is_array($option_value)) {
$option_value = serialize($option_value);
}
if(!empty($option['id'])){
update_post_meta( $post_id, $option['id'], $option_value );
if (!empty($option['id'])) {
update_post_meta($post_id, $option['id'], $option_value);
}
endforeach;
@ -71,449 +73,298 @@ if ( ! class_exists( 'AddMetaBox' ) ) {
endif;
}
public function mp_event_all_in_tab_menu_list() {
?>
<li data-target-tabs="#<?php echo $this->get_meta_box_id(); ?>">
<?php echo $this->get_meta_box_title(); ?>
</li>
public function mp_event_all_in_tab_menu_list()
{
?>
<li data-target-tabs="#<?php echo esc_attr($this->get_meta_box_id()); ?>">
<?php echo mep_esc_html($this->get_meta_box_title()); ?>
</li>
<?php
}
public function meta_box_callback( $post_id = null ) {
$get_nav_position = $this->get_nav_position();
//var_dump($get_nav_position);
if ( $this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal' && !isset( $this->data['seat_plan'] )) {
?>
<div class="mp_tab_item" data-tab-item="#<?php echo $this->get_meta_box_id(); ?>">
public function meta_box_callback($post_id = null)
{
$get_nav_position = $this->get_nav_position();
if ($this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal' && !isset($this->data['seat_plan'])) {
?>
<div class="mp_tab_item" data-tab-item="#<?php echo esc_html($this->get_meta_box_id()); ?>">
<?php
}
?>
<div class='wrap ppof-settings ppof-metabox'>
<div class='navigation <?php echo esc_attr($get_nav_position); ?>'>
<div class="nav-header">
<?php
do_action( 'nav_header_top' );
?>
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
<div class="themeVersion"><?php echo sprintf( __( 'Version: %s', 'wp-theme-settings' ), $this->get_item_version() ); ?></div>
<?php
do_action( 'nav_header_bottom' );
?>
</div>
<div class="nav-items">
<?php
do_action( 'nav_nav_items_top' );
?>
<?php
$current_page = 1;
foreach ( $this->get_panels() as $page_id => $page ):
$page_settings = ! empty( $page['sections'] ) ? $page['sections'] : array();
$page_settings_count = count( $page_settings );
//var_dump($page_settings);
?>
<li class="nav-item-wrap <?php if ( ( $page_settings_count > 1 ) ) {
echo 'has-child';
} ?> <?php if ( $current_page == $page_id ) {
echo 'active';
} ?>">
<a dataid="<?php echo esc_attr($page_id); ?>" href='#<?php echo esc_attr($page_id); ?>' class='nav-item'><?php echo esc_html($page['page_nav']); ?>
<?php if ( ( $page_settings_count > 1 ) ) {
echo '<i class="child-nav-icon fas fa-angle-down"></i>';
} ?>
</a>
<?php
if ( ( $page_settings_count > 1 ) ):
?>
<ul class="child-navs">
<?php
foreach ( $page_settings as $section_id => $nav_sections ):
$nav_sections_title = ! empty( $nav_sections['nav_title'] ) ? $nav_sections['nav_title'] : $nav_sections['title'];
//var_dump($nav_sections_title);
?>
<li>
<a sectionId="<?php echo esc_attr($section_id); ?>" dataid="<?php echo esc_attr($page_id); ?>" href='#<?php echo esc_attr($section_id); ?>' class='nav-item <?php if ( $current_page == $page_id ) {
echo 'active';
} ?>'><?php echo esc_html($nav_sections_title); ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
<?php
endif;
?>
</li>
<?php
$current_page ++;
endforeach;
?>
<?php
do_action( 'nav_nav_items_bottom' );
?>
</div>
<div class="nav-footer">
<?php
do_action( 'nav_footer_top' );
?>
<?php
do_action( 'nav_footer_bottom' );
?>
</div>
</div>
<?php
if ( $get_nav_position == 'right' ) {
$form_wrapper_position = 'left';
} elseif ( $get_nav_position == 'left' ) {
$form_wrapper_position = 'right';
} elseif ( $get_nav_position == 'top' ) {
$form_wrapper_position = 'full-width-top';
} else {
$form_wrapper_position = 'full-width';
}
?>
<div class="form-wrapper <?php echo esc_attr($form_wrapper_position); ?>">
<div class="form-section">
<?php
$current_page = 1;
foreach ( $this->get_panels() as $panelsIndex => $panel ):
<div class='wrap ppof-settings ppof-metabox'>
<div class='navigation <?php echo esc_attr($get_nav_position); ?>'>
<div class="nav-header">
<?php
do_action('nav_header_top');
?>
<div class="tab-content <?php if ( $current_page == 1 ) {
echo 'active';
} ?> tab-content-<?php
echo esc_attr($panelsIndex); ?>">
<?php
foreach ( $panel['sections'] as $sectionIndex => $section ):
<div class="themeName"><?php echo esc_html($this->get_item_name()); ?></div>
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
<?php
do_action('nav_header_bottom');
?>
</div>
<div class="nav-items">
<?php
do_action('nav_nav_items_top');
$current_page = 1;
foreach ($this->get_panels() as $page_id => $page) :
$page_settings = !empty($page['sections']) ? $page['sections'] : array();
$page_settings_count = count($page_settings);
?>
<li class="nav-item-wrap <?php if (($page_settings_count > 1)) { echo 'has-child'; } ?> <?php if ($current_page == $page_id) {
echo 'active';
} ?>">
<a dataid="<?php echo esc_attr($page_id); ?>" href='#<?php echo esc_attr($page_id); ?>' class='nav-item'><?php echo esc_html($page['page_nav']); ?>
<?php if (($page_settings_count > 1)) {
echo '<i class="child-nav-icon fas fa-angle-down"></i>';
} ?>
</a>
<?php
if (($page_settings_count > 1)) :
?>
<div class="section">
<h1 id="<?php echo esc_attr($sectionIndex); ?>" class="section-title"><?php echo esc_html($section['title']); ?></h1>
<p class="description"><?php echo esc_html($section['description']); ?></p>
<table class="form-table">
<tbody>
<ul class="child-navs">
<?php
foreach ( $section['options'] as $option ):
?>
<tr>
<th scope="row"><?php echo esc_html($option['title']); ?></th>
<td>
<?php
$option_value = get_post_meta( $this->get_post_id(), $option['id'], true );
if ( is_serialized( $option_value ) ) {
$option_value = unserialize( $option_value );
}
$option['value'] = $option_value;
$this->field_generator( $option )
?>
</td>
</tr>
foreach ($page_settings as $section_id => $nav_sections) :
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
?>
<li>
<a sectionId="<?php echo esc_attr($section_id); ?>" dataid="<?php echo esc_attr($page_id); ?>" href='#<?php echo esc_attr($section_id); ?>' class='nav-item <?php if ($current_page == $page_id) { echo 'active'; } ?>'><?php echo esc_html($nav_sections_title); ?>
</a>
</li>
<?php
endforeach;
?>
</tbody>
</table>
</div>
<?php
endforeach;
?>
</div>
</ul>
<?php
endif;
?>
</li>
<?php
$current_page++;
endforeach;
?>
<?php
do_action('nav_nav_items_bottom');
?>
</div>
<div class="nav-footer">
<?php
do_action('nav_footer_top');
do_action('nav_footer_bottom');
?>
</div>
$current_page ++;
endforeach;
</div>
<?php
if ($get_nav_position == 'right') {
$form_wrapper_position = 'left';
} elseif ($get_nav_position == 'left') {
$form_wrapper_position = 'right';
} elseif ($get_nav_position == 'top') {
$form_wrapper_position = 'full-width-top';
} else {
$form_wrapper_position = 'full-width';
}
?>
?>
<div class="form-wrapper <?php echo esc_attr($form_wrapper_position); ?>">
<div class="form-section">
<?php
$current_page = 1;
foreach ($this->get_panels() as $panelsIndex => $panel) :
?>
<div class="tab-content <?php if ($current_page == 1) { echo 'active'; } ?> tab-content-<?php echo esc_attr($panelsIndex); ?>">
<?php foreach ($panel['sections'] as $sectionIndex => $section) : ?>
<div class="section">
<h1 id="<?php echo esc_attr($sectionIndex); ?>" class="section-title"><?php echo esc_html($section['title']); ?></h1>
<p class="description"><?php echo esc_html($section['description']); ?></p>
<table class="form-table">
<tbody>
<?php foreach ($section['options'] as $option) : ?>
<tr>
<th scope="row"><?php echo esc_html($option['title']); ?></th>
<td>
<?php
$option_value = get_post_meta($this->get_post_id(), $option['id'], true);
if (is_serialized($option_value)) {
$option_value = unserialize($option_value);
}
$option['value'] = $option_value;
$this->field_generator($option)
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endforeach; ?>
</div>
<?php
$current_page++;
endforeach;
?>
</div>
</div>
</div>
<?php
if ( $this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal' && !isset( $this->data['seat_plan'] )) {
?>
</div>
</div>
</div>
</div>
<?php
}
}
public function field_generator( $option ) {
$id = isset( $option['id'] ) ? $option['id'] : "";
$type = isset( $option['type'] ) ? $option['type'] : "";
$details = isset( $option['details'] ) ? $option['details'] : "";
$post_id = $this->get_post_id();
if ( empty( $id ) ) {
return;
}
$prent_option_name = $this->get_option_name();
$FormFieldsGenerator = new FormFieldsGenerator();
if ( ! empty( $prent_option_name ) ):
$field_name = $prent_option_name . '[' . $id . ']';
$option['field_name'] = $field_name;
$prent_option_value = get_post_meta( $post_id, $prent_option_name, true );
$prent_option_value = is_serialized( $prent_option_value ) ? unserialize( $prent_option_value ) : array();
$option['value'] = isset( $prent_option_value[ $id ] ) ? $prent_option_value[ $id ] : '';
else:
$option['field_name'] = $id;
$option_value = get_post_meta( $post_id, $id, true );
$option['value'] = is_serialized( $option_value ) ? unserialize( $option_value ) : $option_value;
endif;
//var_dump($prent_option_value);
?>
<?php
if ( isset( $option['type'] ) && $option['type'] === 'text' ) {
echo $FormFieldsGenerator->field_text( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'text_multi' ) {
echo $FormFieldsGenerator->field_text_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'textarea' ) {
echo $FormFieldsGenerator->field_textarea( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'checkbox' ) {
echo $FormFieldsGenerator->field_checkbox( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'checkbox_multi' ) {
echo $FormFieldsGenerator->field_checkbox_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'radio' ) {
echo $FormFieldsGenerator->field_radio( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'select' ) {
echo $FormFieldsGenerator->field_select( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'range' ) {
echo $FormFieldsGenerator->field_range( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'range_input' ) {
echo $FormFieldsGenerator->field_range_input( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'switch' ) {
echo $FormFieldsGenerator->field_switch( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'switch_multi' ) {
echo $FormFieldsGenerator->field_switch_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'switch_img' ) {
echo $FormFieldsGenerator->field_switch_img( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'time_format' ) {
echo $FormFieldsGenerator->field_time_format( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'date_format' ) {
echo $FormFieldsGenerator->field_date_format( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'datepicker' ) {
echo $FormFieldsGenerator->field_datepicker( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'color_sets' ) {
echo $FormFieldsGenerator->field_color_sets( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'colorpicker' ) {
echo $FormFieldsGenerator->field_colorpicker( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'colorpicker_multi' ) {
echo $FormFieldsGenerator->field_colorpicker_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'link_color' ) {
echo $FormFieldsGenerator->field_link_color( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'icon' ) {
echo $FormFieldsGenerator->field_icon( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'icon_multi' ) {
echo $FormFieldsGenerator->field_icon_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'dimensions' ) {
echo $FormFieldsGenerator->field_dimensions( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'wp_editor' ) {
echo $FormFieldsGenerator->field_wp_editor( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'select2' ) {
echo $FormFieldsGenerator->field_select2( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'faq' ) {
echo $FormFieldsGenerator->field_faq( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'grid' ) {
echo $FormFieldsGenerator->field_grid( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'color_palette' ) {
echo $FormFieldsGenerator->field_color_palette( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'color_palette_multi' ) {
echo $FormFieldsGenerator->field_color_palette_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'media' ) {
echo $FormFieldsGenerator->field_media( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'media_multi' ) {
echo $FormFieldsGenerator->field_media_multi( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'repeatable' ) {
echo $FormFieldsGenerator->field_repeatable( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'user' ) {
echo $FormFieldsGenerator->field_user( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'margin' ) {
echo $FormFieldsGenerator->field_margin( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'padding' ) {
echo $FormFieldsGenerator->field_padding( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'border' ) {
echo $FormFieldsGenerator->field_border( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'switcher' ) {
echo $FormFieldsGenerator->field_switcher( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'password' ) {
echo $FormFieldsGenerator->field_password( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'post_objects' ) {
echo $FormFieldsGenerator->field_post_objects( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === 'google_map' ) {
echo $FormFieldsGenerator->field_google_map( $option );
} elseif ( isset( $option['type'] ) && $option['type'] === $type ) {
do_action( "wp_theme_settings_field_$type", $option );
}
if ( ! empty( $details ) ) {
echo "<p class='description'>$details</p>";
if ($this->get_meta_box_screen()[0] == 'mep_events' && $this->get_meta_box_context() == 'normal' && !isset($this->data['seat_plan'])) {
?>
</div>
<?php
}
}
}
public function field_generator($option)
{
$id = isset($option['id']) ? $option['id'] : "";
$type = isset($option['type']) ? $option['type'] : "";
$details = isset($option['details']) ? $option['details'] : "";
private function get_meta_box_id() {
if ( isset( $this->data['meta_box_id'] ) ) {
return $this->data['meta_box_id'];
} else {
return "";
$post_id = $this->get_post_id();
if (empty($id)) {
return;
}
$prent_option_name = $this->get_option_name();
$FormFieldsGenerator = new FormFieldsGenerator();
if (!empty($prent_option_name)) :
$field_name = $prent_option_name . '[' . $id . ']';
$option['field_name'] = $field_name;
$prent_option_value = get_post_meta($post_id, $prent_option_name, true);
$prent_option_value = is_serialized($prent_option_value) ? unserialize($prent_option_value) : array();
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
else :
$option['field_name'] = $id;
$option_value = get_post_meta($post_id, $id, true);
$option['value'] = is_serialized($option_value) ? unserialize($option_value) : $option_value;
endif;
if (sizeof($option) > 0 && isset($option['type'])) {
echo mep_field_generator($option['type'], $option);
do_action("wp_theme_settings_field_$type", $option);
}
if (!empty($details)) {
echo "<p class='description'>" . mep_esc_html($details) . "</p>";
}
}
private function get_meta_box_id()
{
if (isset($this->data['meta_box_id'])) {
return $this->data['meta_box_id'];
} else {
return "";
}
}
private function get_meta_box_title()
{
if (isset($this->data['meta_box_title'])) {
return $this->data['meta_box_title'];
} else {
return "";
}
}
private function get_meta_box_screen()
{
if (isset($this->data['screen'])) {
return $this->data['screen'];
} else {
return array('post');
}
}
private function get_meta_box_context()
{
if (isset($this->data['context'])) {
return $this->data['context'];
} else {
return 'normal';
}
}
private function get_meta_box_priority()
{
if (isset($this->data['priority'])) {
return $this->data['priority'];
} else {
return "high";
}
}
private function get_callback_args()
{
if (isset($this->data['callback_args'])) {
return $this->data['callback_args'];
} else {
return array();
}
}
private function get_panels()
{
if (isset($this->data['panels'])) {
return $this->data['panels'];
} else {
return array();
}
}
private function get_item_name()
{
if (isset($this->data['item_name'])) {
return $this->data['item_name'];
} else {
return "PickPlugins";
}
}
private function get_item_version()
{
if (isset($this->data['item_version'])) {
return $this->data['item_version'];
} else {
return "1.0.0";
}
}
private function get_option_name()
{
if (isset($this->data['option_name'])) {
return $this->data['option_name'];
} else {
return false;
}
}
private function get_nav_position()
{
if (isset($this->data['nav_position'])) {
return $this->data['nav_position'];
} else {
return 'left';
}
}
private function get_post_id()
{
$post_id = get_the_ID();
return $post_id;
}
}
private function get_meta_box_title() {
if ( isset( $this->data['meta_box_title'] ) ) {
return $this->data['meta_box_title'];
} else {
return "";
}
}
private function get_meta_box_screen() {
if ( isset( $this->data['screen'] ) ) {
return $this->data['screen'];
} else {
return array( 'post' );
}
}
private function get_meta_box_context() {
if ( isset( $this->data['context'] ) ) {
return $this->data['context'];
} else {
return 'normal';
}
}
private function get_meta_box_priority() {
if ( isset( $this->data['priority'] ) ) {
return $this->data['priority'];
} else {
return "high";
}
}
private function get_callback_args() {
if ( isset( $this->data['callback_args'] ) ) {
return $this->data['callback_args'];
} else {
return array();
}
}
private function get_panels() {
if ( isset( $this->data['panels'] ) ) {
return $this->data['panels'];
} else {
return array();
}
}
private function get_item_name() {
if ( isset( $this->data['item_name'] ) ) {
return $this->data['item_name'];
} else {
return "PickPlugins";
}
}
private function get_item_version() {
if ( isset( $this->data['item_version'] ) ) {
return $this->data['item_version'];
} else {
return "1.0.0";
}
}
private function get_option_name() {
if ( isset( $this->data['option_name'] ) ) {
return $this->data['option_name'];
} else {
return false;
}
}
private function get_nav_position() {
if ( isset( $this->data['nav_position'] ) ) {
return $this->data['nav_position'];
} else {
return 'left';
}
}
private function get_post_id() {
$post_id = get_the_ID();
return $post_id;
}
}
}
}

View File

@ -1,284 +1,98 @@
<?php
if ( ! defined('ABSPATH')) exit; // if direct access
if (!defined('ABSPATH')) exit; // if direct access
if( ! class_exists( 'TaxonomyEdit' ) ) {
if (!class_exists('TaxonomyEdit')) {
class TaxonomyEdit {
class TaxonomyEdit
{
public $data = array();
public function __construct( $args ){
public function __construct($args)
{
$this->data = &$args;
add_action($this->get_taxonomy() . '_add_form_fields', array($this, 'add_form_fields'), 12);
add_action($this->get_taxonomy() . '_edit_form_fields', array($this, 'edit_form_fields'), 12);
add_action('edited_' . $this->get_taxonomy(), array($this, 'save_update_taxonomy'), 12);
add_action('create_' . $this->get_taxonomy(), array($this, 'save_update_taxonomy'), 12);
}
add_action( $this->get_taxonomy().'_add_form_fields', array( $this, 'add_form_fields' ), 12 );
add_action( $this->get_taxonomy().'_edit_form_fields', array( $this, 'edit_form_fields' ), 12 );
add_action( 'edited_'.$this->get_taxonomy(), array( $this, 'save_update_taxonomy' ), 12 );
add_action( 'create_'.$this->get_taxonomy(), array( $this, 'save_update_taxonomy' ), 12 );
public function save_update_taxonomy($term_id)
{
foreach ($this->get_panels() as $optionIndex => $option) :
$option_value = isset($_POST[$option['id']]) ? mage_array_strip($_POST[$option['id']]) : '';
if (is_array($option_value)) {
$option_value = serialize($option_value);
}
update_term_meta($term_id, $option['id'], $option_value);
endforeach;
}
public function save_update_taxonomy($term_id){
foreach ($this->get_panels() as $optionIndex=>$option):
$option_value = isset($_POST[$option['id']]) ? mage_array_strip($_POST[$option['id']]) : '';
if(is_array($option_value)){
$option_value = serialize($option_value);
}
update_term_meta($term_id, $option['id'], $option_value);
endforeach;
}
public function edit_form_fields($term){
public function edit_form_fields($term)
{
$term_id = $term->term_id;
?>
<?php
foreach ($this->get_panels() as $optionIndex=>$option):
//var_dump($option);
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="<?php echo esc_attr($option['id']); ?>"><?php echo esc_html($option['title']); ?></label></th>
<td>
<?php
$this->field_generator($option, $term_id)
?>
</td>
</tr>
foreach ($this->get_panels() as $optionIndex => $option) : ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="<?php echo esc_attr($option['id']); ?>"><?php echo esc_html($option['title']); ?></label></th>
<td>
<?php
endforeach;
}
public function add_form_fields($term){
$term_id = '';
?>
<?php
foreach ($this->get_panels() as $optionIndex=>$option):
$this->field_generator($option, $term_id)
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="<?php echo esc_attr($option['id']); ?>"><?php echo esc_html($option['title']); ?></label></th>
<td>
<?php
$this->field_generator($option, $term_id)
?>
</td>
</tr>
<?php
</td>
</tr>
<?php
endforeach;
}
public function field_generator( $option, $term_id ) {
$id = isset( $option['id'] ) ? $option['id'] : "";
$type = isset( $option['type'] ) ? $option['type'] : "";
$details = isset( $option['details'] ) ? $option['details'] : "";
if( empty( $id ) ) return;
$FormFieldsGenerator = new FormFieldsGenerator();
$option['field_name'] = $id;
$option_value = get_term_meta($term_id, $id, true );
$option['value'] = is_serialized($option_value) ? unserialize($option_value): $option_value;
if( isset($option['type']) && $option['type'] === 'text' ){
echo $FormFieldsGenerator->field_text($option);
}
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
echo $FormFieldsGenerator->field_text_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
echo $FormFieldsGenerator->field_textarea($option);
}
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
echo $FormFieldsGenerator->field_checkbox($option);
}
elseif( isset($option['type']) && $option['type'] === 'radio' ){
echo $FormFieldsGenerator->field_radio($option);
}
elseif( isset($option['type']) && $option['type'] === 'select' ){
echo $FormFieldsGenerator->field_select($option);
}
elseif( isset($option['type']) && $option['type'] === 'range' ){
echo $FormFieldsGenerator->field_range($option);
}
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
echo $FormFieldsGenerator->field_range_input($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch' ){
echo $FormFieldsGenerator->field_switch($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
echo $FormFieldsGenerator->field_switch_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
echo $FormFieldsGenerator->field_switch_img($option);
}
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
echo $FormFieldsGenerator->field_time_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
echo $FormFieldsGenerator->field_date_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
echo $FormFieldsGenerator->field_datepicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
echo $FormFieldsGenerator->field_colorpicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
echo $FormFieldsGenerator->field_colorpicker_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
echo $FormFieldsGenerator->field_link_color($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon' ){
echo $FormFieldsGenerator->field_icon($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
echo $FormFieldsGenerator->field_icon_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
echo $FormFieldsGenerator->field_dimensions($option);
}
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
echo $FormFieldsGenerator->field_wp_editor($option);
}
elseif( isset($option['type']) && $option['type'] === 'select2' ){
echo $FormFieldsGenerator->field_select2($option);
}
elseif( isset($option['type']) && $option['type'] === 'faq' ){
echo $FormFieldsGenerator->field_faq($option);
}
elseif( isset($option['type']) && $option['type'] === 'grid' ){
echo $FormFieldsGenerator->field_grid($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
echo $FormFieldsGenerator->field_color_palette($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
echo $FormFieldsGenerator->field_color_palette_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'media' ){
echo $FormFieldsGenerator->field_media($option);
}
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
echo $FormFieldsGenerator->field_media_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
echo $FormFieldsGenerator->field_repeatable($option);
}
elseif( isset($option['type']) && $option['type'] === 'user' ){
echo $FormFieldsGenerator->field_user($option);
}
elseif( isset($option['type']) && $option['type'] === $type ){
do_action( "wp_theme_settings_field_$type", $option );
}
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
public function add_form_fields($term)
{
$term_id = '';
?>
<?php foreach ($this->get_panels() as $optionIndex => $option) : ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="<?php echo esc_attr($option['id']); ?>"><?php echo esc_html($option['title']); ?></label></th>
<td>
<?php $this->field_generator($option, $term_id); ?>
</td>
</tr>
<?php
endforeach;
}
public function field_generator($option, $term_id)
{
$id = isset($option['id']) ? $option['id'] : "";
$type = isset($option['type']) ? $option['type'] : "";
$details = isset($option['details']) ? $option['details'] : "";
private function get_taxonomy(){
if( isset( $this->data['taxonomy'] ) ) return $this->data['taxonomy'];
if (empty($id)) return;
$option['field_name'] = $id;
$option_value = get_term_meta($term_id, $id, true);
$option['value'] = is_serialized($option_value) ? unserialize($option_value) : $option_value;
if (sizeof($option) > 0 && isset($option['type'])) {
echo mep_field_generator($option['type'], $option);
do_action("wp_theme_settings_field_$type", $option);
}
if (!empty($details)) echo "<p class='description'>$details</p>";
}
private function get_taxonomy()
{
if (isset($this->data['taxonomy'])) return $this->data['taxonomy'];
else return "category";
}
private function get_panels(){
if( isset( $this->data['options'] ) ) return $this->data['options'];
private function get_panels()
{
if (isset($this->data['options'])) return $this->data['options'];
else return array();
}
private function get_tax_id(){
//$post_id = get_the_ID();
//return $post_id;
}
}
}
}

View File

@ -1,560 +1,2 @@
<?php
/*
* @Author : PickPlugins
* Copyright : 2015 PickPlugins.com
*
* Version : 1.0.3
*/
if ( ! defined('ABSPATH')) exit; // if direct access
if( ! class_exists( 'AddThemePage' ) ) {
class AddThemePage {
public $data = array();
public function __construct( $args ){
$this->data = &$args;
if( $this->add_in_menu() ) {
add_action( 'admin_menu', array( $this, 'add_menu_in_admin_menu' ), 12 );
}
add_action( 'admin_init', array( $this, 'display_fields' ), 12 );
add_filter( 'whitelist_options', array( $this, 'whitelist_options' ), 99, 1 );
}
public function add_menu_in_admin_menu(){
if( "main" == $this->get_menu_type() ) {
add_theme_page( $this->get_menu_name(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ), $this->get_menu_icon() );
}
if( "sub" == $this->get_menu_type() ) {
add_submenu_page($this->data['cpt_menu'], $this->get_menu_title(), $this->get_menu_title(), $this->get_capability(), $this->get_menu_slug(), array( $this, 'display_function' ));
}
}
public function section_callback( $section ) {
$section_id = $section['id'];
//var_dump($section_id);
$data = isset( $section['callback'][0]->data ) ? $section['callback'][0]->data : array();
//$description = $section['description'];
$description = $section['id'] ;
echo '<div id="'.esc_attr($section['id']).'"></div>';
}
public function display_fields() {
foreach ($this->get_pages() as $panelsIndex=>$panels):
//var_dump($panelsIndex);
foreach ($panels['page_settings'] as $sectionIndex=>$sections):
add_settings_section(
$sectionIndex,
isset( $sections['title'] ) ? $sections['title'] : "",
array( $this, 'section_callback'),
$panelsIndex
);
foreach( $sections['options'] as $option ) :
add_settings_field( $option['id'], $option['title'], array($this,'field_generator'), $panelsIndex, $sectionIndex, $option );
endforeach;
endforeach;
endforeach;
}
public function field_generator( $option ) {
$id = isset( $option['id'] ) ? $option['id'] : "";
$type = isset( $option['type'] ) ? $option['type'] : "";
$details = isset( $option['details'] ) ? $option['details'] : "";
if( empty( $id ) ) return;
$FormFieldsGenerator = array();
$prent_option_name = $this->get_option_name();
$FormFieldsGenerator = new FormFieldsGenerator();
if(!empty($prent_option_name)):
$field_name = $prent_option_name.'['.$id.']';
$option['field_name'] = $field_name;
$prent_option_value = get_option( $prent_option_name );
$option['value'] = isset($prent_option_value[$id]) ? $prent_option_value[$id] : '';
else:
$option['field_name'] = $id;
$option['value'] = get_option( $id );
endif;
?>
<?php
if( isset($option['type']) && $option['type'] === 'text' ){
echo $FormFieldsGenerator->field_text($option);
}
elseif( isset($option['type']) && $option['type'] === 'text_multi' ){
echo $FormFieldsGenerator->field_text_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'textarea' ){
echo $FormFieldsGenerator->field_textarea($option);
}
elseif( isset($option['type']) && $option['type'] === 'checkbox' ){
echo $FormFieldsGenerator->field_checkbox($option);
}
elseif( isset($option['type']) && $option['type'] === 'checkbox_multi' ){
echo $FormFieldsGenerator->field_checkbox_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'radio' ){
echo $FormFieldsGenerator->field_radio($option);
}
elseif( isset($option['type']) && $option['type'] === 'select' ){
echo $FormFieldsGenerator->field_select($option);
}
elseif( isset($option['type']) && $option['type'] === 'range' ){
echo $FormFieldsGenerator->field_range($option);
}
elseif( isset($option['type']) && $option['type'] === 'range_input' ){
echo $FormFieldsGenerator->field_range_input($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch' ){
echo $FormFieldsGenerator->field_switch($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_multi' ){
echo $FormFieldsGenerator->field_switch_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'switch_img' ){
echo $FormFieldsGenerator->field_switch_img($option);
}
elseif( isset($option['type']) && $option['type'] === 'time_format' ){
echo $FormFieldsGenerator->field_time_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'date_format' ){
echo $FormFieldsGenerator->field_date_format($option);
}
elseif( isset($option['type']) && $option['type'] === 'datepicker' ){
echo $FormFieldsGenerator->field_datepicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_sets' ){
echo $FormFieldsGenerator->field_color_sets($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker' ){
echo $FormFieldsGenerator->field_colorpicker($option);
}
elseif( isset($option['type']) && $option['type'] === 'colorpicker_multi' ){
echo $FormFieldsGenerator->field_colorpicker_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'link_color' ){
echo $FormFieldsGenerator->field_link_color($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon' ){
echo $FormFieldsGenerator->field_icon($option);
}
elseif( isset($option['type']) && $option['type'] === 'icon_multi' ){
echo $FormFieldsGenerator->field_icon_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'dimensions' ){
echo $FormFieldsGenerator->field_dimensions($option);
}
elseif( isset($option['type']) && $option['type'] === 'wp_editor' ){
echo $FormFieldsGenerator->field_wp_editor($option);
}
elseif( isset($option['type']) && $option['type'] === 'select2' ){
echo $FormFieldsGenerator->field_select2($option);
}
elseif( isset($option['type']) && $option['type'] === 'faq' ){
echo $FormFieldsGenerator->field_faq($option);
}
elseif( isset($option['type']) && $option['type'] === 'grid' ){
echo $FormFieldsGenerator->field_grid($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette' ){
echo $FormFieldsGenerator->field_color_palette($option);
}
elseif( isset($option['type']) && $option['type'] === 'color_palette_multi' ){
echo $FormFieldsGenerator->field_color_palette_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'media' ){
echo $FormFieldsGenerator->field_media($option);
}
elseif( isset($option['type']) && $option['type'] === 'media_multi' ){
echo $FormFieldsGenerator->field_media_multi($option);
}
elseif( isset($option['type']) && $option['type'] === 'repeatable' ){
echo $FormFieldsGenerator->field_repeatable($option);
}
elseif( isset($option['type']) && $option['type'] === 'user' ){
echo $FormFieldsGenerator->field_user($option);
}
elseif( isset($option['type']) && $option['type'] === 'margin' ){
echo $FormFieldsGenerator->field_margin($option);
}
elseif( isset($option['type']) && $option['type'] === 'padding' ){
echo $FormFieldsGenerator->field_padding($option);
}
elseif( isset($option['type']) && $option['type'] === 'border' ){
echo $FormFieldsGenerator->field_border($option);
}
elseif( isset($option['type']) && $option['type'] === 'switcher' ){
echo $FormFieldsGenerator->field_switcher($option);
}
elseif( isset($option['type']) && $option['type'] === 'password' ){
echo $FormFieldsGenerator->field_password($option);
}
elseif( isset($option['type']) && $option['type'] === 'post_objects' ){
echo $FormFieldsGenerator->field_post_objects($option);
}
elseif( isset($option['type']) && $option['type'] === 'google_map' ){
echo $FormFieldsGenerator->field_google_map($option);
}
elseif( isset($option['type']) && $option['type'] === $type ){
do_action( "wp_theme_settings_field_$type", $option );
}
if( !empty( $details ) ) echo "<p class='description'>$details</p>";
}
public function whitelist_options( $whitelist_options ){
$prent_option_name = $this->get_option_name();
if($prent_option_name):
$whitelist_options[$this->get_menu_slug()][] = $prent_option_name;
else:
foreach( $this->get_pages() as $page_id => $page ): foreach( $page['page_settings'] as $section ):
foreach( $section['options'] as $option ):
$whitelist_options[$this->get_menu_slug()][] = $option['id'];
endforeach; endforeach;
endforeach;
endif;
update_option('whitelist_options',$whitelist_options );
return $whitelist_options;
}
public function display_function(){
?>
<div class='wrap ppof-settings'>
<?php
parse_str( $_SERVER['QUERY_STRING'], $nav_menu_url_args );
global $pagenow;
settings_errors();
?>
<div class='navigation'>
<div class="nav-header">
<?php
do_action('nav_header_top');
?>
<div class="themeName"><?php echo $this->get_item_name(); ?></div>
<div class="themeVersion"><?php echo sprintf(__('Version: %s', 'wp-theme-settings'), $this->get_item_version()); ?></div>
<?php
do_action('nav_header_bottom');
?>
</div>
<ul class="nav-items">
<?php
//$current_page = isset($_GET['page'])? $_GET['page'] : '';
$current_page = $this->get_current_page();
foreach( $this->get_pages() as $page_id => $page ):
$page_settings = !empty($page['page_settings']) ? $page['page_settings'] : array();
$page_settings_count = count($page_settings);
//var_dump($page_settings);
?>
<li class="nav-item-wrap <?php if(($page_settings_count > 1)) echo 'has-child'; ?> <?php if($current_page==$page_id) echo 'active'; ?>">
<a dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
$page_id; ?>' class='nav-item'><?php echo $page['page_nav']; ?>
<?php if(($page_settings_count > 1)) echo '<i class="child-nav-icon fas fa-angle-down"></i>'; ?>
</a>
<?php
if(($page_settings_count > 1)):
?>
<ul class="child-navs">
<?php
foreach ($page_settings as $section_id=>$nav_sections):
$nav_sections_title = !empty($nav_sections['nav_title']) ? $nav_sections['nav_title'] : $nav_sections['title'];
//var_dump($nav_sections_title);
?>
<li>
<a sectionId="<?php echo $section_id; ?>" dataid="<?php echo $page_id; ?>" href='#<?php //echo $pagenow.'?'.$nav_menu_url; ?><?php echo
$page_id; ?>' class='nav-item <?php if($current_page==$page_id) echo 'active'; ?>'><?php echo $nav_sections_title; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
<?php
endif;
?>
</li>
<?php
endforeach;
?>
</ul>
<div class="nav-footer">
<?php
do_action('nav_footer_top');
?>
<?php
do_action('nav_footer_bottom');
?>
</div>
</div>
<div class="form-wrapper">
<form class="" action='options.php' method='post'>
<div class="form-header">
<div class="pp-row">
<div class="pp-col pp-col-50">
<div class="pagename"> # <?php echo $this->get_menu_page_title(); ?></div>
</div>
<div class="pp-col pp-col-50 text-align-right">
<?php submit_button(null,'primary', null, false); ?>
</div>
</div>
</div>
<div class="form-section">
<?php
$current_page = $this->get_current_page();
foreach ($this->get_pages() as $panelsIndex=>$panels):
?>
<div class="tab-content <?php if($current_page==$panelsIndex) echo 'active'; ?> tab-content-<?php echo
$panelsIndex;
?>">
<?php
do_settings_sections( $panelsIndex);
?>
</div>
<?php
endforeach;
settings_fields( $this->get_menu_slug() );
?>
</div>
<div class="form-footer">
<div class="pp-row">
<div class="pp-col pp-col-50">
<div class=""></div>
<span>Developed by : <a class="" href="http://mage-people.com">MagePeople Inc.</a> | Version: 1.0.0</span>
</div>
<div class="pp-col pp-col-50 text-align-right">
<?php submit_button(null,'primary', null, false); ?>
</div>
</div>
</div>
</form>
</div>
</div>
<?php
}
// Default Functions
public function get_current_page(){
$current_page = isset($_GET['page'])? mage_array_strip($_GET['page']) : '';
$pages = array();
foreach ($this->get_pages() as $panelsIndex=>$panels):
$pages[] = $panelsIndex;
endforeach;
// var_dump($pages);
foreach ($pages as $page):
if($current_page == $page){
$_current_page = $page;
break;
}
else{
$_current_page = $pages[0];
}
endforeach;
return $_current_page;
}
private function get_item_name(){
if( isset( $this->data['item_name'] ) ) return $this->data['item_name'];
else return "PickPlugins";
}
private function get_item_version(){
if( isset( $this->data['item_version'] ) ) return $this->data['item_version'];
else return "1.0.0";
}
private function get_menu_type(){
if( isset( $this->data['menu_type'] ) ) return $this->data['menu_type'];
else return "main";
}
private function get_pages(){
if( isset( $this->data['panels'] ) ) return $this->data['panels'];
else return array();
}
private function get_settings_name(){
if( isset( $this->data['settings_name'] ) ) return $this->data['settings_name'];
else return "my_custom_settings";
}
private function get_menu_icon(){
if( isset( $this->data['menu_icon'] ) ) return $this->data['menu_icon'];
else return "";
}
private function get_menu_slug(){
if( isset( $this->data['menu_slug'] ) ) return $this->data['menu_slug'];
else return "my-custom-settings";
}
private function get_capability(){
if( isset( $this->data['capability'] ) ) return $this->data['capability'];
else return "manage_options";
}
private function get_menu_page_title(){
if( isset( $this->data['menu_page_title'] ) ) return $this->data['menu_page_title'];
else return "My Custom Menu";
}
private function get_menu_name(){
if( isset( $this->data['menu_name'] ) ) return $this->data['menu_name'];
else return "Menu Name";
}
private function get_menu_title(){
if( isset( $this->data['menu_title'] ) ) return $this->data['menu_title'];
else return "Menu Title";
}
private function get_page_title(){
if( isset( $this->data['page_title'] ) ) return $this->data['page_title'];
else return "Page Title";
}
private function add_in_menu(){
if( isset( $this->data['add_in_menu'] ) && $this->data['add_in_menu'] ) return true;
else return false;
}
private function get_option_name(){
if( isset( $this->data['option_name'] )) return $this->data['option_name'];
else return false;
}
private function get_option_id(){
if( isset( $this->data['option_id'] ) && $this->data['option_id'] ) return $this->data['option_id'];
else return "";
}
}
}

View File

@ -1,4 +1,4 @@
<h3>
<i class="fa fa-calendar"></i>
<?php echo mep_get_option('mep_event_schedule_text', 'label_setting_sec', esc_html__('Event Schedule Details', 'mage-eventpress')); ?>
<h3>
<i class="fa fa-calendar"></i>
<?php echo mep_get_option('mep_event_schedule_text', 'label_setting_sec', esc_html__('Event Schedule Details', 'mage-eventpress')); ?>
</h3>

View File

@ -1,6 +1,6 @@
<p>
<?php echo mep_get_option('mep_by_text', 'label_setting_sec') ? mep_get_option('mep_by_text', 'label_setting_sec') : esc_html__('By:','mage-eventpress'); ?>
<a href="<?php echo get_term_link( $author_terms[0]->term_id, 'mep_org' ); ?>">
<?php echo esc_html($author_terms[0]->name); ?>
</a>
<p>
<?php echo mep_get_option('mep_by_text', 'label_setting_sec') ? mep_get_option('mep_by_text', 'label_setting_sec') : esc_html__('By:','mage-eventpress'); ?>
<a href="<?php echo get_term_link( $author_terms[0]->term_id, 'mep_org' ); ?>">
<?php echo esc_html($author_terms[0]->name); ?>
</a>
</p>

View File

@ -1,12 +1,12 @@
<h5>
<strong>
<?php echo mep_get_option('mep_total_seat_text', 'label_setting_sec') ? mep_get_option('mep_total_seat_text', 'label_setting_sec') : esc_html__('Total Seats:', 'mage-eventpress'); ?>
</strong>
<?php
echo esc_html($total_seat);
if ($mep_available_seat == 'on') {
?>
(<strong><?php echo esc_html(max($total_left, 0)); ?></strong>
<?php echo mep_get_option('mep_left_text', 'label_setting_sec') ? mep_get_option('mep_left_text', 'label_setting_sec') : esc_html__('Left:', 'mage-eventpress'); ?>)
<?php } ?>
<h5>
<strong>
<?php echo mep_get_option('mep_total_seat_text', 'label_setting_sec') ? mep_get_option('mep_total_seat_text', 'label_setting_sec') : esc_html__('Total Seats:', 'mage-eventpress'); ?>
</strong>
<?php
echo esc_html($total_seat);
if ($mep_available_seat == 'on') {
?>
(<strong><?php echo esc_html(max($total_left, 0)); ?></strong>
<?php echo mep_get_option('mep_left_text', 'label_setting_sec') ? mep_get_option('mep_left_text', 'label_setting_sec') : esc_html__('Left:', 'mage-eventpress'); ?>)
<?php } ?>
</h5>