function getListFiles($folder, $ext = '') { if (themerex_substr($folder, 0, 1) != '/') { $folder = '/' . $folder; } $list = array(); $dir = get_template_directory() . $folder; $url = get_template_directory_uri() . $folder; if (is_dir($dir)) { $hdir = @opendir($dir); if ($hdir) { while (($file = readdir($hdir)) !== false) { $pi = pathinfo($dir . '/' . $file); if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || !empty($ext) && $pi['extension'] != $ext) { continue; } $key = themerex_substr($file, 0, themerex_strrpos($file, '.')); $list[$key] = $url . '/' . $file; } @closedir($hdir); } } return $list; }
function getThemesList($prepend_default = true) { $list = array(); if ($prepend_default) { $list['default'] = 'default'; } $dir = get_template_directory() . "/css/themes"; if (is_dir($dir)) { $hdir = @opendir($dir); if ($hdir) { while (($file = readdir($hdir)) !== false) { $pi = pathinfo($dir . '/' . $file); if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || $pi['extension'] != 'css') { continue; } $key = themerex_substr($file, 0, themerex_strrpos($file, '.')); $list[$key] = themerex_strtoproper(str_replace('_', ' ', $key)); } @closedir($hdir); } } return $list; }
</a> <?php } ?> </div> <div class="copy_socials socPage"> <ul> <?php $socials = get_theme_option('social_icons'); foreach ($socials as $s) { if (empty($s['url'])) { continue; } $sn = basename($s['icon']); $sn = themerex_substr($sn, 0, themerex_strrpos($sn, '.')); if (($pos = themerex_strrpos($sn, '_')) !== false) { $sn = themerex_substr($sn, 0, $pos); } $soc = themerex_get_socials_url(basename($s['icon'])); //$s['icon']; ?> <li><a class="social_icons social_<?php echo $sn; ?> " style="background-image: url(<?php echo $soc; ?> );" target="_blank" href="<?php echo $s['url']; ?> "><span style="background-image: url(<?php
function getListFiles($folder, $ext = '', $only_names = false) { if (themerex_substr($folder, 0, 1) != '/') { $folder = '/' . $folder; } $list = array(); if (is_dir(get_stylesheet_directory() . $folder)) { $dir = get_stylesheet_directory() . $folder; $url = get_stylesheet_directory_uri() . $folder; } else { $dir = get_template_directory() . $folder; $url = get_template_directory_uri() . $folder; } if (is_dir($dir)) { $hdir = @opendir($dir); if ($hdir) { while (($file = readdir($hdir)) !== false) { $pi = pathinfo($dir . '/' . $file); if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || !empty($ext) && $pi['extension'] != $ext) { continue; } $key = themerex_substr($file, 0, themerex_strrpos($file, '.')); if (themerex_substr($key, -4) == '.min') { $key = themerex_substr($file, 0, themerex_strrpos($key, '.')); } $list[$key] = $only_names ? themerex_strtoproper(str_replace('_', ' ', $key)) : $url . '/' . $file; } @closedir($hdir); } } return $list; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $text = isset($instance['text']) ? do_shortcode($instance['text']) : ''; $logo_image = isset($instance['logo_image']) ? $instance['logo_image'] : ''; $logo_text = isset($instance['logo_text']) ? $instance['logo_text'] : ''; $show_logo = isset($instance['show_logo']) ? (int) $instance['show_logo'] : 1; $show_icons = isset($instance['show_icons']) ? (int) $instance['show_icons'] : 1; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } ?> <div class="widget_inner"> <?php if ($show_logo) { if ($logo_image == '') { $logo_image = get_custom_option('logo_image'); } if ($logo_text == '') { $logo_text = get_custom_option('logo_text'); } if ($logo_image != '' || $logo_text != '') { ?> <div class="logo"><a href="<?php echo home_url(); ?> "><?php echo $logo_image ? '<img src="' . $logo_image . '" alt="">' : ''; echo $logo_text ? '<span class="logo_text">' . str_replace(array('[', ']'), array('<span class="theme_accent">', '</span>'), $logo_text) . '</span>' : ''; ?> </a></div> <?php } } if (!empty($text)) { ?> <div class="logo_descr"><?php echo nl2br(do_shortcode($text)); ?> </div> <?php } if ($show_icons) { $socials = get_theme_option('social_icons'); ?> <div class="logo_socials socPage"> <ul> <?php foreach ($socials as $s) { if (empty($s['url'])) { continue; } $sn = basename($s['icon']); $sn = themerex_substr($sn, 0, themerex_strrpos($sn, '.')); if (($pos = themerex_strrpos($sn, '_')) !== false) { $sn = themerex_substr($sn, 0, $pos); } $soc = themerex_get_socials_url(basename($s['icon'])); //$s['icon']; ?> <li><a class="social_icons social_<?php echo $sn; ?> " style="background-image: url(<?php echo $soc; ?> );" target="_blank" href="<?php echo $s['url']; ?> "><span style="background-image: url(<?php echo $soc; ?> );"></span></a></li> <?php } ?> </ul> </div> <?php } ?> </div> <?php /* After widget (defined by themes). */ echo $after_widget; }