Your IP : 216.73.216.162


Current Path : /home/x/b/o/xbodynamge/namtation/wp-content/
Upload File :
Current File : /home/x/b/o/xbodynamge/namtation/wp-content/common-functions.php.tar

wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/inc/hestia/common-functions.php000060400000010254151121220700036113 0ustar00home/xbodynamge/crosstraining<?php
/**
 * Functions that are running in both Hestia Lite and Pro
 *
 * @author Themeisle
 * @package themeisle-companion
 */

/**
 * Change default alignment for top bar.
 */
function themeisle_hestia_top_bar_default_alignment(){
	return 'left';
}

/**
 * Add default content to clients section;
 */
function themeisle_hestia_clients_default_content(){
	$plugin_path = plugins_url( 'inc/img/', __FILE__ );
	return json_encode(
		array(
			array( 'image_url' => $plugin_path . 'clients1.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients2.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients3.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients4.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients5.png', 'link' => '#'),
		)
	);
}

/**
 * Execute this function once to check all widgets and see if there are any duplicates.
 * If there are duplicates, remove that widget and generate a new one with same
 * data but a new id.
 *
 * @since 2.4.5
 */
function themeisle_hestia_fix_duplicate_widgets() {

	$load_default = get_option( 'hestia_fix_duplicate_widgets' );
	if ( $load_default !== false ) {
		return;
	}

	global $wp_registered_widgets;
	$current_sidebars = get_option( 'sidebars_widgets' );

	$duplicates = themeisle_hestia_get_duplicate_widgets();
	if(empty($duplicates)){
		return;
	}
	foreach ($duplicates as $widget){
		$old_widget_id = $widget['widget_id'];
		$old_widget_sidebar = $widget['sidebar'];
		$old_widget_index = array_search($old_widget_id,$current_sidebars[$old_widget_sidebar]);
		if( empty($old_widget_index)){
			return;
		}

		/* Remove the widget id and obtain the widget name */
		$old_widget_name = explode( '-', $old_widget_id );
		array_pop( $old_widget_name );
		$widget_name = implode('-', $old_widget_name);

		/* Get the id of new widget */
		$new_widget_name = themeisle_hestia_generate_unique_widget_name($widget_name);
		$new_widget_index  = trim( substr( $new_widget_name, strrpos( $new_widget_name, '-' ) + 1 ) );


		/* Get the options of old widget and update its id */
		$old_widget_options = $wp_registered_widgets[$old_widget_id];
		if(!empty($old_widget_options)) {
			if ( ! empty( $old_widget_options['params'] ) ) {
				unset( $old_widget_options['params'] );
			}
			if ( ! empty( $old_widget_options['callback'] ) ) {
				unset( $old_widget_options['callback'] );
			}
			if ( ! empty( $old_widget_options['id'] ) ) {
				unset( $old_widget_options['id'] );
			}
		} else {
			$old_widget_options = array();
		}

		$current_sidebars[$old_widget_sidebar][$old_widget_index] = $new_widget_name;
		$new_widget[ $new_widget_index ] = $old_widget_options;

		update_option( 'widget_'.$widget_name, $new_widget );
	}
	update_option( 'sidebars_widgets', $current_sidebars );

	update_option( 'hestia_fix_duplicate_widgets', true );
}

/**
 * Generate new unique widget name.
 *
 * @param string $widget_name Widget name.
 *
 * @since 2.4.5
 * @return string
 */
function themeisle_hestia_generate_unique_widget_name( $widget_name ) {
	$current_sidebars = get_option( 'sidebars_widgets' );
	$all_widget_array = array();
	foreach ( $current_sidebars as $sidebar => $widgets ) {
		if ( ! empty( $widgets ) && is_array( $widgets ) && $sidebar != 'wp_inactive_widgets' ) {
			foreach ( $widgets as $widget ) {
				$all_widget_array[] = $widget;
			}
		}
	}
	$widget_index = 1;
	while ( in_array( $widget_name . '-' . $widget_index, $all_widget_array ) ) {
		$widget_index ++;
	}
	$new_widget_name = $widget_name . '-' . $widget_index;
	return $new_widget_name;
}


/**
 * Get an array of duplicate widgets and their sidebars.
 *
 * @since 2.4.5
 */
function themeisle_hestia_get_duplicate_widgets() {

	$current_sidebars = get_option( 'sidebars_widgets' );
	$all_widget_array = array();
	$duplicate_widgets = array();
	foreach ( $current_sidebars as $sidebar => $widgets ) {
		if ( ! empty( $widgets ) && is_array( $widgets ) && $sidebar != 'wp_inactive_widgets' ) {
			foreach ( $widgets as $widget ) {
				if( in_array($widget,$all_widget_array)){
					$duplicate_widgets[] = array(
						'widget_id' => $widget,
						'sidebar' => $sidebar
					);
				} else{
					$all_widget_array[] = $widget;
				}
			}
		}
	}
	return $duplicate_widgets;
}wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/inc/common-functions.php000060400000007576151150722310034344 0ustar00home/xbodynamge/crosstraining<?php
/**
 * This file contains common functions that can be used in every Beaver module
 *
 * @package themeisle-companion
 */

// Get the module directory.
$module_directory = $this->get_dir();

// Require custom field.
require_once( $module_directory . '/custom-fields/number-field/number_field.php' );

/**
 * Function to return padding controls.
 *
 * @param array $settings Fields settings.
 *
 * @return array
 */
function themeisle_four_fields_control( $settings ) {
	$default = $settings['default'];
	$prefix = $settings['field_name_prefix'];
	$type = ! empty( $settings['type'] ) ? $settings['type'] : 'padding';
	return array(
		'title'  => $type === 'margin' ? esc_html__( 'Margins', 'themeisle-companion' ) : esc_html__( 'Padding', 'themeisle-companion' ),
		'fields' => array(
			$prefix . 'top' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Top', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['top'],
			),
			$prefix . 'bottom' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Bottom', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['bottom'],
			),
			$prefix . 'left' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Left', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['left'],
			),
			$prefix . 'right' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Right', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['right'],
			),
		),
	);
}

/**
 * Typography controls.
 *
 * @param array $settings Typography settings.
 *
 * @return array
 */
function themeisle_typography_settings( $settings ) {
	$title = ! empty( $settings['title'] ) ? $settings['title'] : esc_html__( 'Typography', 'themeisle-companion' );
	$prefix = $settings['prefix'];
	$font_default = ! empty( $settings['font_size_default'] ) ? $settings['font_size_default'] : '';
	return array(
		'title' => $title,
		'fields' => array(
			$prefix . 'font_size' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Font size', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $font_default,
			),
			$prefix . 'font_family' => array(
				'type'          => 'font',
				'label'         => esc_html__( 'Font family', 'themeisle-companion' ),
				'default'       => array(
					'family'        => 'Roboto',
					'weight'        => 300,
				),
			),
			$prefix . 'transform' => array(
				'type'    => 'select',
				'label'   => esc_html__( 'Transform', 'themeisle-companion' ),
				'default' => 'none',
				'options' => array(
					'none' => esc_html__( 'None', 'themeisle-companion' ),
					'capitalize' => esc_html__( 'Capitalize', 'themeisle-companion' ),
					'uppercase' => esc_html__( 'Uppercase', 'themeisle-companion' ),
					'lowercase' => esc_html__( 'Lowercase', 'themeisle-companion' ),
				),
			),
			$prefix . 'font_style' => array(
				'type'    => 'select',
				'label'   => esc_html__( 'Font style', 'themeisle-companion' ),
				'default' => 'normal',
				'options' => array(
					'normal' => esc_html__( 'Normal', 'themeisle-companion' ),
					'italic' => esc_html__( 'Italic', 'themeisle-companion' ),
					'oblique' => esc_html__( 'Oblique', 'themeisle-companion' ),
				),
			),
			$prefix . 'line_height' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Line height', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
			),
			$prefix . 'letter_spacing' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Letter spacing', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
			),
		),
	);
}
dev/wp-content/plugins/themeisle-companion/obfx_modules/beaver-widgets/inc/common-functions.php000064400000007576151156335470032256 0ustar00home/xbodynamge<?php
/**
 * This file contains common functions that can be used in every Beaver module
 *
 * @package themeisle-companion
 */

// Get the module directory.
$module_directory = $this->get_dir();

// Require custom field.
require_once( $module_directory . '/custom-fields/number-field/number_field.php' );

/**
 * Function to return padding controls.
 *
 * @param array $settings Fields settings.
 *
 * @return array
 */
function themeisle_four_fields_control( $settings ) {
	$default = $settings['default'];
	$prefix = $settings['field_name_prefix'];
	$type = ! empty( $settings['type'] ) ? $settings['type'] : 'padding';
	return array(
		'title'  => $type === 'margin' ? esc_html__( 'Margins', 'themeisle-companion' ) : esc_html__( 'Padding', 'themeisle-companion' ),
		'fields' => array(
			$prefix . 'top' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Top', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['top'],
			),
			$prefix . 'bottom' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Bottom', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['bottom'],
			),
			$prefix . 'left' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Left', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['left'],
			),
			$prefix . 'right' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Right', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $default['right'],
			),
		),
	);
}

/**
 * Typography controls.
 *
 * @param array $settings Typography settings.
 *
 * @return array
 */
function themeisle_typography_settings( $settings ) {
	$title = ! empty( $settings['title'] ) ? $settings['title'] : esc_html__( 'Typography', 'themeisle-companion' );
	$prefix = $settings['prefix'];
	$font_default = ! empty( $settings['font_size_default'] ) ? $settings['font_size_default'] : '';
	return array(
		'title' => $title,
		'fields' => array(
			$prefix . 'font_size' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Font size', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
				'default' => $font_default,
			),
			$prefix . 'font_family' => array(
				'type'          => 'font',
				'label'         => esc_html__( 'Font family', 'themeisle-companion' ),
				'default'       => array(
					'family'        => 'Roboto',
					'weight'        => 300,
				),
			),
			$prefix . 'transform' => array(
				'type'    => 'select',
				'label'   => esc_html__( 'Transform', 'themeisle-companion' ),
				'default' => 'none',
				'options' => array(
					'none' => esc_html__( 'None', 'themeisle-companion' ),
					'capitalize' => esc_html__( 'Capitalize', 'themeisle-companion' ),
					'uppercase' => esc_html__( 'Uppercase', 'themeisle-companion' ),
					'lowercase' => esc_html__( 'Lowercase', 'themeisle-companion' ),
				),
			),
			$prefix . 'font_style' => array(
				'type'    => 'select',
				'label'   => esc_html__( 'Font style', 'themeisle-companion' ),
				'default' => 'normal',
				'options' => array(
					'normal' => esc_html__( 'Normal', 'themeisle-companion' ),
					'italic' => esc_html__( 'Italic', 'themeisle-companion' ),
					'oblique' => esc_html__( 'Oblique', 'themeisle-companion' ),
				),
			),
			$prefix . 'line_height' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Line height', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
			),
			$prefix . 'letter_spacing' => array(
				'type'        => 'obfx_number',
				'label' => esc_html__( 'Letter spacing', 'themeisle-companion' ),
				'description' => esc_html__( 'px', 'themeisle-companion' ),
			),
		),
	);
}
wp-content/plugins/themeisle-companion/obfx_modules/companion-legacy/inc/hestia/common-functions.php000064400000010254151157566670034044 0ustar00home/xbodynamge/dev<?php
/**
 * Functions that are running in both Hestia Lite and Pro
 *
 * @author Themeisle
 * @package themeisle-companion
 */

/**
 * Change default alignment for top bar.
 */
function themeisle_hestia_top_bar_default_alignment(){
	return 'left';
}

/**
 * Add default content to clients section;
 */
function themeisle_hestia_clients_default_content(){
	$plugin_path = plugins_url( 'inc/img/', __FILE__ );
	return json_encode(
		array(
			array( 'image_url' => $plugin_path . 'clients1.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients2.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients3.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients4.png', 'link' => '#'),
			array( 'image_url' => $plugin_path . 'clients5.png', 'link' => '#'),
		)
	);
}

/**
 * Execute this function once to check all widgets and see if there are any duplicates.
 * If there are duplicates, remove that widget and generate a new one with same
 * data but a new id.
 *
 * @since 2.4.5
 */
function themeisle_hestia_fix_duplicate_widgets() {

	$load_default = get_option( 'hestia_fix_duplicate_widgets' );
	if ( $load_default !== false ) {
		return;
	}

	global $wp_registered_widgets;
	$current_sidebars = get_option( 'sidebars_widgets' );

	$duplicates = themeisle_hestia_get_duplicate_widgets();
	if(empty($duplicates)){
		return;
	}
	foreach ($duplicates as $widget){
		$old_widget_id = $widget['widget_id'];
		$old_widget_sidebar = $widget['sidebar'];
		$old_widget_index = array_search($old_widget_id,$current_sidebars[$old_widget_sidebar]);
		if( empty($old_widget_index)){
			return;
		}

		/* Remove the widget id and obtain the widget name */
		$old_widget_name = explode( '-', $old_widget_id );
		array_pop( $old_widget_name );
		$widget_name = implode('-', $old_widget_name);

		/* Get the id of new widget */
		$new_widget_name = themeisle_hestia_generate_unique_widget_name($widget_name);
		$new_widget_index  = trim( substr( $new_widget_name, strrpos( $new_widget_name, '-' ) + 1 ) );


		/* Get the options of old widget and update its id */
		$old_widget_options = $wp_registered_widgets[$old_widget_id];
		if(!empty($old_widget_options)) {
			if ( ! empty( $old_widget_options['params'] ) ) {
				unset( $old_widget_options['params'] );
			}
			if ( ! empty( $old_widget_options['callback'] ) ) {
				unset( $old_widget_options['callback'] );
			}
			if ( ! empty( $old_widget_options['id'] ) ) {
				unset( $old_widget_options['id'] );
			}
		} else {
			$old_widget_options = array();
		}

		$current_sidebars[$old_widget_sidebar][$old_widget_index] = $new_widget_name;
		$new_widget[ $new_widget_index ] = $old_widget_options;

		update_option( 'widget_'.$widget_name, $new_widget );
	}
	update_option( 'sidebars_widgets', $current_sidebars );

	update_option( 'hestia_fix_duplicate_widgets', true );
}

/**
 * Generate new unique widget name.
 *
 * @param string $widget_name Widget name.
 *
 * @since 2.4.5
 * @return string
 */
function themeisle_hestia_generate_unique_widget_name( $widget_name ) {
	$current_sidebars = get_option( 'sidebars_widgets' );
	$all_widget_array = array();
	foreach ( $current_sidebars as $sidebar => $widgets ) {
		if ( ! empty( $widgets ) && is_array( $widgets ) && $sidebar != 'wp_inactive_widgets' ) {
			foreach ( $widgets as $widget ) {
				$all_widget_array[] = $widget;
			}
		}
	}
	$widget_index = 1;
	while ( in_array( $widget_name . '-' . $widget_index, $all_widget_array ) ) {
		$widget_index ++;
	}
	$new_widget_name = $widget_name . '-' . $widget_index;
	return $new_widget_name;
}


/**
 * Get an array of duplicate widgets and their sidebars.
 *
 * @since 2.4.5
 */
function themeisle_hestia_get_duplicate_widgets() {

	$current_sidebars = get_option( 'sidebars_widgets' );
	$all_widget_array = array();
	$duplicate_widgets = array();
	foreach ( $current_sidebars as $sidebar => $widgets ) {
		if ( ! empty( $widgets ) && is_array( $widgets ) && $sidebar != 'wp_inactive_widgets' ) {
			foreach ( $widgets as $widget ) {
				if( in_array($widget,$all_widget_array)){
					$duplicate_widgets[] = array(
						'widget_id' => $widget,
						'sidebar' => $sidebar
					);
				} else{
					$all_widget_array[] = $widget;
				}
			}
		}
	}
	return $duplicate_widgets;
}