예제 #1
0
 function init()
 {
     if (is_admin()) {
         add_action('admin_menu', array('K2Options', 'add_menu'));
         // Check for K2 uninstallation. Do here to avoid header output.
         if ($_GET['page'] == 'k2-options' and isset($_POST['uninstall'])) {
             K2::uninstall();
         }
         // Need to check if this changes...
         $sidebar_manager = get_option('k2sidebarmanager');
         K2Options::update();
         K2Header::update();
         // Ewww...
         if ($sidebar_manager != get_option('k2sidebarmanager')) {
             header('Location: themes.php?page=k2-options&updated');
             exit;
         }
     }
 }
예제 #2
0
<?php

global $wpdb;
// Get the current K2 Style
$style_name = get_option('k2scheme');
$style_title = $style_name !== false ? $style_name : __('No Style', 'k2_domain');
// Check that the styles folder exists
$is_styles_dir = is_dir(K2_STYLES_PATH);
// Get the scheme files
$style_files = K2::get_styles();
// Get the sidebar
$column_number = get_option('k2columns');
$column_options = array(1 => __('Single Column', 'k2_domain'), __('Two Columns', 'k2_domain'), __('Three Columns', 'k2_domain'));
// Get the asides category
$asides_id = get_option('k2asidescategory');
// Get the categories we might use for asides
$asides_cats = get_categories('get=all');
// Get the current K2 header picture
$header_picture = get_option('k2header_picture');
$header_sizes = array(1 => __('560 x 200 px', 'k2_domain'), __('780 x 200 px', 'k2_domain'), __('950 x 200 px', 'k2_domain'));
// Check that we can write to the headers folder and that it exists
$is_headers_writable = is_writable(K2_HEADERS_PATH);
$is_headers_dir = is_dir(K2_HEADERS_PATH);
// Get the header pictures
$picture_files = K2Header::get_header_images();
?>


<?php 
if (isset($_POST['submit']) or isset($_GET['updated'])) {
    ?>
예제 #3
0
 function get_header_images()
 {
     global $wpdb;
     $images = K2::files_scan(K2_HEADERS_DIR, array('gif', 'jpeg', 'jpg', 'png'), 1);
     $attachment_ids = $wpdb->get_results("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = 'k2-header-image'", ARRAY_N);
     if (!empty($attachment_ids)) {
         foreach ($attachment_ids as $id_array) {
             $images[] = $id_array[0];
         }
     }
     return $images;
 }
예제 #4
0
파일: k2.php 프로젝트: Acidburn0zzz/K2
 function _copy_or_move_file($source, $dest, $overwrite = false, $move = false)
 {
     // check source and destination folder
     if (file_exists($source) and is_dir(dirname($dest))) {
         // destination is a folder, assume move to there
         if (is_dir($dest)) {
             if (DIRECTORY_SEPARATOR != substr($dest, -1)) {
                 $dest .= DIRECTORY_SEPARATOR;
             }
             $dest = $dest . basename($source);
         }
         // destination file exists
         if (is_file($dest)) {
             if ($overwrite) {
                 // Delete existing destination file
                 @unlink($dest);
             } else {
                 // Find a unique name
                 $dest = K2::get_unique_path($dest);
             }
         }
         if ($move) {
             if (rename($source, $dest)) {
                 return $dest;
             }
         } else {
             if (copy($source, $dest)) {
                 return $dest;
             }
         }
     }
     return false;
 }
예제 #5
0
파일: styles.php 프로젝트: Acidburn0zzz/K2
 /**
  * Adds styles to the list of editable files in the Theme Editor
  */
 function theme_editor_append_styles()
 {
     global $wp_themes, $pagenow;
     $styles_dir = K2Styles::get_styles_dir();
     if ('theme-editor.php' == $pagenow and strpos($styles_dir, WP_CONTENT_DIR) !== false) {
         get_themes();
         $current = get_current_theme();
         // Get a list of style css
         $styles = K2::files_scan($styles_dir, 'css', 3);
         // Loop through each style css and add to the list
         foreach ($styles as $style_css) {
             $wp_themes[$current]['Stylesheet Files'][] = "{$styles_dir}/{$style_css}";
         }
         $wp_themes[$current]['Stylesheet Files'][] = "/css/k2.css";
     }
 }
예제 #6
0
<?php

// Current version of K2
define('K2_CURRENT', '1.0');
// Is this MU or no?
define('K2_MU', isset($wpmu_version) or strpos($wp_version, 'wordpress-mu') !== false);
// Are we using K2 Styles?
define('K2_CHILD_THEME', get_stylesheet() != get_template());
// Features that can be disabled by Child Themes
@define('K2_STYLES', true);
@define('K2_HEADERS', true);
// WordPress compatibility
@define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
@define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
/* Blast you red baron! Initialize the k2 system! */
require_once TEMPLATEPATH . '/app/classes/k2.php';
K2::init();
예제 #7
0
 function process_custom_header_image($source, $id = false)
 {
     // Workaround for WP 2.1 bug
     if (empty($source)) {
         $uploads = wp_upload_dir();
         $source = str_replace($uploads['url'], $uploads['path'], get_theme_mod('header_image'));
         $id = true;
     }
     // Handle only the final step
     if (file_exists($source) and strpos(basename($source), 'midsize-') === false) {
         if ($id) {
             $dest = K2::copy_file($source, K2_HEADERS_PATH . basename($source));
         } else {
             $dest = K2::move_file($source, K2_HEADERS_PATH . basename($source));
         }
         if (false !== $dest) {
             update_option('k2header_picture', basename($dest));
             set_theme_mod('header_image', get_bloginfo('template_directory') . '/images/headers/' . basename($dest));
             return $dest;
         }
     }
     return $source;
 }
예제 #8
0
<?php

// Load localizatons
load_theme_textdomain('k2_domain');
// Register our scripts with script loader
K2::register_scripts();
// Load our scripts
wp_enqueue_script('k2functions');
if (get_option('k2rollingarchives') == 1) {
    wp_enqueue_script('k2rollingarchives');
}
if (get_option('k2livesearch') == 1) {
    wp_enqueue_script('k2livesearch');
}
if (get_option('k2livecommenting') == 1 and ((is_page() or is_single()) and !isset($_GET['jal_edit_comments']) and 'open' == $post->comment_status or 'comment' == $post->comment_type)) {
    wp_enqueue_script('k2comments');
}
?>
<!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 
language_attributes();
?>
>

<head profile="http://gmpg.org/xfn/11">
	<title><?php 
// Page or Single Post
if (is_page() or is_single()) {
    the_title();
    // Category Archive
} elseif (is_category()) {
예제 #9
0
파일: sbm.php 프로젝트: 64kbytes/stayinba
 function module_admin_scripts()
 {
     // Register our scripts
     K2::register_scripts();
     // Add our script to the queue
     wp_enqueue_script('k2sbm');
 }