/** * Add stylesheets to sliders set to display automatically * */ function FA_add_styles() { $sliders = FA_display(); if (!$sliders) { return; } foreach ($sliders as $slider_id) { $theme = FA_slider_options($slider_id, '_fa_lite_theme'); /** * This is for backwards compatibility. * Prior to V2.4, theme Classic was actually 2 different themes: Light and Dark. * If slideshow was set on either dark or lite theme, those themes should no longer exist. * If user saved them, we'll use them. If not, switch to classic. */ $load_classic = FA_should_load_classic($theme['active_theme']); if ($load_classic) { $theme = $load_classic; } // theme path and url $theme_path = FA_theme_path($theme['active_theme']); $theme_url = FA_theme_url($theme['active_theme']); // if theme folder doesn't exist, skip this slider if (!$theme_path) { continue; // bail out } // enqueue main stylesheet $stylesheet_handle = 'FA_style_' . $theme['active_theme']; $stylesheet_url = $theme_url . '/stylesheet.css'; wp_enqueue_style($stylesheet_handle, $stylesheet_url); // enqueue color stylesheet if (!empty($theme['active_theme_color'])) { $color_style_handle = $stylesheet_handle . '-' . $theme['active_theme_color']; $color_style_url = $theme_url . '/colors/' . $theme['active_theme_color']; wp_enqueue_style($color_style_handle, $color_style_url); } } }
/** * Displays the name of the theme the slideshow is currently using, including color scheme * @param array $item * * @since 2.4.5 */ function column_slider_theme($item) { $options = FA_slider_options($item['ID'], '_fa_lite_theme'); if (!$options) { return '-'; } $theme_name = false; $theme_color = false; if (array_key_exists('active_theme', $options)) { $theme_name = ucfirst(str_replace('_', ' ', $options['active_theme'])); } if (array_key_exists('active_theme_color', $options)) { $theme_color = ' - ' . ucfirst(str_replace(array('.css', '_'), array('', ' '), $options['active_theme_color'])); } if ($theme_name) { return $theme_name . $theme_color; } else { return '-'; } }
/** * For a given slider ID the function sets as globals the slider options. * To get an option, use FA_get_option * @param int $slider_id */ function FA_set_slider_options($slider_id) { global $FA_slider_options; $FA_slider_options = FA_slider_options($slider_id); }
if (isset($_POST['FA-save_wpnonce'])) { if (!wp_verify_nonce($_POST['FA-save_wpnonce'], 'FA_saveOptions')) { die(__('Sorry, it looks like your request is not valid. Please try again.', 'falite')); } // if it's a new slider, save it first if (!$slider_id) { global $user_ID; $post_data = array('post_type' => 'fa_slider', 'post_title' => $_POST['section_title'], 'post_author' => $user_ID, 'post_status' => 'publish', 'comment_status' => 'closed', 'ping_status' => 'closed'); $slider_id = wp_insert_post($post_data); $current_page .= "&action=edit&id=" . $slider_id; } else { $post_data = array('post_title' => $_POST['section_title'], 'ID' => $slider_id); wp_update_post($post_data); } // get the default options $defaults = FA_slider_options(); // save new options foreach ($defaults as $meta_key => $values) { if (!is_array($values) || empty($values)) { $key = str_replace('_fa_lite_', '', $meta_key); if (isset($_POST[$key])) { if (is_bool($values)) { $value = true; } else { $value = $_POST[$key]; } } else { $value = false; } update_post_meta($slider_id, $meta_key, $value); continue;
<?php /** * @package Featured articles Lite - Wordpress plugin * @author CodeFlavors ( codeflavors[at]codeflavors.com ) * @version 2.4 */ include FA_dir('includes/custom_wp_posts_table.php'); // get already selected pages $slider_id = isset($_GET['id']) ? (int) $_GET['id'] : false; $options = FA_slider_options($slider_id); wp_enqueue_style('FA_add_content', FA_path('styles/add_content_modal.css')); wp_enqueue_script('FA_content_add_script', FA_path('scripts/admin_content_add_modal.js'), array('jquery')); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?> > <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php echo get_option('blog_charset'); ?> " /> <title><?php