/var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/includes/admin
NameSizeModeActions
add-ons/-0755rm
donors/-0755rm
emails/-0755rm
forms/-0755rm
payments/-0755rm
reports/-0755rm
settings/-0755rm
shortcodes/-0755rm
tools/-0755rm
upgrades/-0755rm
views/-0755rm
abstract-admin-settings-page.php66870644editdlrm
admin-actions.php431690644editdlrm
admin-filters.php77350644editdlrm
admin-footer.php11770644editdlrm
admin-pages.php104680644editdlrm
class-addon-activation-banner.php217550644editdlrm
class-admin-settings.php403660644editdlrm
class-api-keys-table.php86430644editdlrm
class-blank-slate.php84280644editdlrm
class-give-admin.php50700644editdlrm
class-give-html-elements.php211190644editdlrm
class-i18n-module.php87110644editdlrm
dashboard-widgets.php12710644editdlrm
give-metabox-functions.php607010644editdlrm
import-functions.php360780644editdlrm
misc-functions.php65760644editdlrm
plugins.php177210644editdlrm
setting-page-functions.php16910644editdlrm
Edit: /var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/includes/admin/class-admin-settings.php (40366B)

' . esc_attr__( 'Action failed. Please refresh the page and retry.', 'give' ) . '

'; die(); } /** * Trigger Action. * * Note: action dynamically fire on basis of setting page slug and current tab. * For example: if you register a setting page with give-settings menu slug and general current tab name * then action will be give-settings_save_general * * @since 1.8 */ do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); /** * Trigger Action. * * Note: action dynamically fire on basis of setting page slug. * For example: if you register a setting page with give-settings menu slug * then action will be give-settings_saved * * @since 1.8 */ do_action( self::$setting_filter_prefix . '_saved' ); } /** * Add a message. * * @since 1.8 * * @param string $code Message code (Note: This should be unique). * @param string $message Message text. * * @return void */ public static function add_message( $code, $message ) { self::$messages[ $code ] = $message; } /** * Add an error. * * @since 1.8 * * @param string $code Message code (Note: This should be unique). * @param string $message Message text. * * @return void */ public static function add_error( $code, $message ) { self::$errors[ $code ] = $message; } /** * Output messages + errors. * * @since 1.8 * @return void */ public static function show_messages() { $notice_html = ''; $classes = 'give-notice settings-error notice is-dismissible'; self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); if ( 0 < count( self::$errors ) ) { foreach ( self::$errors as $code => $message ) { $notice_html .= sprintf( '', $code, $classes, $message ); } } if ( 0 < count( self::$messages ) ) { foreach ( self::$messages as $code => $message ) { $notice_html .= sprintf( '', $code, $classes, $message ); } } echo $notice_html; } /** * Settings page. * * Handles the display of the main give settings page in admin. * * @since 1.8 * @return bool */ public static function output() { // Get current setting page. self::$setting_filter_prefix = give_get_current_setting_page(); // Bailout: Exit if setting page is not defined. if ( empty( self::$setting_filter_prefix ) ) { return false; } /** * Trigger Action. * * Note: action dynamically fire on basis of setting page slug * For example: if you register a setting page with give-settings menu slug * then action will be give-settings_start * * @since 1.8 */ do_action( self::$setting_filter_prefix . '_start' ); $current_tab = give_get_current_setting_tab(); $current_section = give_get_current_setting_section(); // Include settings pages. $all_setting = self::get_settings_pages(); /* @var object $current_setting_obj */ $current_setting_obj = new StdClass(); foreach ( $all_setting as $setting ) { if ( is_object($setting) && method_exists( $setting, 'get_id' ) && $current_tab === $setting->get_id() ) { $current_setting_obj = $setting; break; } } // Save settings if data has been posted. if ( isset( $_POST['_give-save-settings'] ) ) { self::save(); } /** * Filter the tabs for current setting page. * * Note: filter dynamically fire on basis of setting page slug. * For example: if you register a setting page with give-settings menu slug and general current tab name * then action will be give-settings_tabs_array * * @since 1.8 */ $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', [] ); include 'views/html-admin-settings.php'; return true; } /** * Get a setting from the settings API. * * @since 1.8 * * @param string $option_name Option Name. * @param string $field_id Field ID. * @param mixed $default Default. * * @return string|bool */ public static function get_option( $option_name = '', $field_id = '', $default = false ) { // Bailout. if ( empty( $option_name ) && empty( $field_id ) ) { return false; } if ( ! empty( $field_id ) && ! empty( $option_name ) ) { // Get field value if any. $option_value = get_option( $option_name ); $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) ? $option_value[ $field_id ] : $default; } else { // If option name is empty but not field name then this means, setting is direct store to option table under there field name. $option_name = ! $option_name ? $field_id : $option_name; // Get option value if any. $option_value = get_option( $option_name, $default ); } /** * Filter the option value * * @since 2.2.3 * * @param mixed $option_value * @param string $option_name * @param string $field_id * @param mixed $default */ return apply_filters( 'give_admin_field_get_value', $option_value, $option_name, $field_id, $default ); } /** * Output admin fields. * * Loops though the give options array and outputs each field. * * @todo Refactor this function * * @since 1.8 * @access public * * @param array $sections Opens array to output. * @param string $option_name Opens array to output. * * @return void */ public static function output_fields( $sections, $option_name = '' ) { $current_page = give_get_current_setting_page(); $current_tab = give_get_current_setting_tab(); $current_section = give_get_current_setting_section(); $groups = give_get_settings_groups(); if ( $groups ) { $defaultGroup = current( array_keys( $groups ) ); ?>
$fields ) { $current_group = ! empty( $_GET['group'] ) ? give_clean( $_GET['group'] ) : $defaultGroup; $hide_class = $group !== $current_group ? 'give-hidden' : ''; printf( '
', esc_attr( $group ), esc_html( $hide_class ) ); /** * Filter sub group settings. * * @since 2.8.0 */ $subGroups = apply_filters( "give_get_groups_{$current_section}_{$group}", [] ); if ( $subGroups ) { $subGroupIds = array_keys( $subGroups ); $defaultSubGroup = current( $subGroupIds ); $lastSubGroupId = end( $subGroupIds ); echo '
    '; foreach ( $subGroups as $id => $label ) { $separator = $lastSubGroupId === $id ? '' : ' | '; $currentSubGroup = ! empty( $_GET['sub-group'] ) ? give_clean( $_GET['sub-group'] ) : $defaultSubGroup; $class = $id === $currentSubGroup ? 'current' : ''; printf( '
  • %3$s%4$s
  • ', $id, esc_url( admin_url( "edit.php?post_type=give_forms&page={$current_page}&tab={$current_tab}§ion={$current_section}&group={$group}&sub-group={$id}" ) ), $label, $separator, $class ); } echo '
'; foreach ( $fields as $id => $subgroup ) { $current_group = ! empty( $_GET['sub-group'] ) ? give_clean( $_GET['sub-group'] ) : $defaultSubGroup; $hide_class = $id !== $current_group ? 'give-hidden' : ''; printf( '
', esc_attr( $id ), esc_html( $hide_class ) ); foreach ( $subgroup as $setting ) { if ( ! isset( $setting['type'] ) ) { continue; } self::prepare_settings_field( $setting, $option_name ); } echo '
'; } } else { foreach ( $fields as $value ) { if ( ! isset( $value['type'] ) ) { continue; } self::prepare_settings_field( $value, $option_name ); } } echo '
'; } ?>
'', 'class' => '', 'css' => '', 'default' => '', 'desc' => '', 'table_html' => true, 'repeat' => false, 'repeat_btn_title' => __( 'Add Field', 'give' ), ]; // Set title. $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; // Set default setting. $value = wp_parse_args( $value, $defaults ); // Colorpicker field. $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); // Custom attribute handling. $custom_attributes = []; if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { foreach ( $value['attributes'] as $attribute => $attribute_value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; } } // Description handling. $description = self::get_field_description( $value ); // Switch based on type. switch ( $value['type'] ) { // Section Titles. case 'title': if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) { ?>


' . "\n\n"; } if ( ! empty( $value['id'] ) ) { /** * Trigger Action. * * Note: action dynamically fire on basis of field id. * * @since 1.8 */ do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); } break; // Section Ends. case 'sectionend': if ( ! empty( $value['id'] ) ) { /** * Trigger Action. * * Note: action dynamically fire on basis of field id. * * @since 1.8 */ do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); } if ( $value['table_html'] ) { echo ''; } if ( ! empty( $value['id'] ) ) { /** * Trigger Action. * * Note: action dynamically fire on basis of field id. * * @since 1.8 */ do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); } break; // Standard text inputs and subtypes like 'number'. case 'colorpicker': case 'hidden': $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; case 'text': case 'email': case 'number': case 'password': $type = $value['type']; $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); // Set default value for repeater field if not any value set yet. if ( $value['repeat'] && is_string( $option_value ) ) { $option_value = [ $value['default'] ]; } ?> > $field_value ) : ?>

/> -

/> 10, 'cols' => 60, ]; $textarea_attributes = isset( $value['attributes'] ) ? $value['attributes'] : []; ?> > > >
> /> >
>
> > > /> > > ' . wp_kses_post( $value ) . ''; } return $description; } /** * Helper function to get the formated title. * Plugins can call this when implementing their own custom settings types. * * @since 1.8 * * @param array $value The form field value array * * @return array The description and tip as a 2 element array */ public static function get_field_title( $value ) { $title = esc_html( $value['title'] ); // If html tag detected then allow them to print. if ( strip_tags( $title ) ) { $title = $value['title']; } return $title; } /** * Save admin fields. * * Loops though the give options array and outputs each field. * * @since 1.8 * * @param array $options Options array to output * @param string $option_name Option name to save output. If empty then option will be store in there own option name i.e option id. * * @return bool */ public static function save_fields( $options, $option_name = '' ) { // Fetch form posted super global data. $post_data = give_clean( $_POST ); // Bailout, if posted data doesn't exists. if ( empty( $post_data ) ) { return false; } $new_options = []; $options_keys = array_keys( $options ); $is_vertical_tabs = is_array( $options_keys ) && count( $options_keys ) && ! is_numeric( $options_keys[0] ); if ( $is_vertical_tabs ) { // Loop through each vertical tabs related field options to destructure into single array. foreach ( $options as $option ) { // Get option from a sub group (if any). if ( ! is_numeric( array_keys( $option )[0] ) ) { foreach ( $option as $subGroup ) { $new_options = array_merge( $new_options, $subGroup ); } continue; } $new_options = array_merge( $new_options, $option ); } // Assign new field options. $options = $new_options; } // Options to update will be stored here and saved later. $update_options = []; // Loop options and get values to save. foreach ( $options as $option ) { if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { continue; } // Get posted value. if ( strstr( $option['id'], '[' ) ) { parse_str( $option['id'], $option_name_array ); $field_option_name = current( array_keys( $option_name_array ) ); $setting_name = key( $option_name_array[ $field_option_name ] ); $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; } else { $field_option_name = $option['id']; $setting_name = ''; $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; } // Format the value based on option type. switch ( $option['type'] ) { case 'checkbox': $value = is_null( $raw_value ) ? '' : 'on'; break; case 'wysiwyg': case 'textarea': $value = wp_kses_post( trim( $raw_value ) ); break; case 'multiselect': case 'chosen': $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); break; default: $value = give_clean( $raw_value ); break; } /** * Sanitize the value of an option. * * @since 1.8 */ $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); /** * Sanitize the value of an option by option name. * * @since 1.8 */ $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); if ( is_null( $value ) ) { continue; } // Check if option is an array and handle that differently to single values. if ( $field_option_name && $setting_name ) { if ( ! isset( $update_options[ $field_option_name ] ) ) { $update_options[ $field_option_name ] = get_option( $field_option_name, [] ); } if ( ! is_array( $update_options[ $field_option_name ] ) ) { $update_options[ $field_option_name ] = []; } $update_options[ $field_option_name ][ $setting_name ] = $value; } else { $update_options[ $field_option_name ] = $value; } } // Save all options in our array or there own option name i.e. option id. if ( empty( $option_name ) ) { foreach ( $update_options as $name => $value ) { update_option( $name, $value, false ); /** * Trigger action. * * Note: This is dynamically fire on basis of option name. * * @since 1.8 */ do_action( "give_save_option_{$name}", $value, $name ); } } else { $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : []; $update_options = array_merge( $old_options, $update_options ); update_option( $option_name, $update_options, false ); /** * Trigger action. * * Note: This is dynamically fire on basis of setting name. * * @since 1.8 */ do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options ); } return true; } /** * Check if admin saving setting or not. * * @since 1.8.17 * * @return bool */ public static function is_saving_settings() { return self::verify_nonce(); } /** * Verify setting page * * @since 2.0 * @access public * * @param string $tab * @param string $section * * @return bool */ public static function is_setting_page( $tab = '', $section = '' ) { $is_setting_page = false; // Are we accessing admin? if ( ! is_admin() ) { return $is_setting_page; } // Are we accessing any give page? if ( ! isset( $_GET['post_type'], $_GET['page'] ) || 'give_forms' !== give_clean( $_GET['post_type'] ) ) { return $is_setting_page; } // Check fo setting tab. if ( ! empty( $tab ) ) { $is_setting_page = ( $tab === give_get_current_setting_tab() ); } // Check fo setting section. if ( ! empty( $section ) ) { $is_setting_page = ( $section === give_get_current_setting_section() ); } return $is_setting_page; } } endif;