コード例 #1
0
ファイル: info.php プロジェクト: JeffLuckett/quickref
function get_k2info($show = '')
{
    $output = '';
    switch ($show) {
        case 'version':
            $output = K2_CURRENT;
            break;
        case 'style_footer':
            if (K2_STYLES) {
                $styleinfo = get_option('k2styleinfo');
                if (!empty($styleinfo['footer'])) {
                    $output = stripslashes($styleinfo['footer']);
                }
            }
            break;
        case 'styles_url':
            if (K2_STYLES) {
                $output = K2Styles::get_styles_url();
            }
            break;
        case 'headers_url':
            $output = K2_HEADERS_URL . '/';
            break;
    }
    return $output;
}
コード例 #2
0
ファイル: styles.php プロジェクト: Acidburn0zzz/K2
 /**
  * Retrieve style data from parsed style file
  *
  * @param string $style_file style file path
  * @return array style data
  */
 function get_style_data($style_file = '')
 {
     // if no style selected, exit
     if ('' == $style_file) {
         return false;
     }
     $style_path = K2Styles::get_styles_dir() . "/{$style_file}";
     if (!is_readable($style_path)) {
         return false;
     }
     $style_data = implode('', file($style_path));
     $style_data = str_replace('\\r', '\\n', $style_data);
     if (preg_match("|Author\\s*:(.*)\$|mi", $style_data, $author)) {
         $author = trim($author[1]);
     } else {
         $author = '';
     }
     if (preg_match("|Author URI\\s*:(.*)\$|mi", $style_data, $site)) {
         $site = esc_url(trim($site[1]));
     } else {
         $site = '';
     }
     if (preg_match("|Style Name\\s*:(.*)\$|mi", $style_data, $stylename)) {
         $stylename = trim($stylename[1]);
     } else {
         $stylename = '';
     }
     if (preg_match("|Style URI\\s*:(.*)\$|mi", $style_data, $stylelink)) {
         $stylelink = esc_url(trim($stylelink[1]));
     } else {
         $stylelink = '';
     }
     if (preg_match("|Description\\s*:(.*)\$|mi", $style_data, $description)) {
         $description = trim($description[1]);
     } else {
         $description = '';
     }
     if (preg_match("|Footer\\s*:(.*)\$|mi", $style_data, $footer)) {
         $footer = trim($footer[1]);
     } else {
         $footer = '';
     }
     if (preg_match("|Version\\s*:(.*)\$|mi", $style_data, $version)) {
         $version = trim($version[1]);
     } else {
         $version = '';
     }
     if (preg_match("|Comments\\s*:(.*)\$|mi", $style_data, $comments)) {
         $comments = trim($comments[1]);
     } else {
         $comments = '';
     }
     if (preg_match("|Header Text Color\\s*:\\s*#*([\\dABCDEF]+)|i", $style_data, $header_text_color)) {
         $header_text_color = $header_text_color[1];
     } else {
         $header_text_color = '';
     }
     if (preg_match("|Header Width\\s*:\\s*(\\d+)|i", $style_data, $header_width)) {
         $header_width = (int) $header_width[1];
     } else {
         $header_width = 0;
     }
     if (preg_match("|Content Width\\s*:\\s*(\\d+)|i", $style_data, $content_width)) {
         $content_width = (int) $content_width[1];
     } else {
         $content_width = 0;
     }
     if (preg_match("|Header Height\\s*:\\s*(\\d+)|i", $style_data, $header_height)) {
         $header_height = (int) $header_height[1];
     } else {
         $header_height = 0;
     }
     $layout_widths = array();
     if (preg_match("|Layout Widths\\s*:\\s*(\\d+)\\s*(px)?,\\s*(\\d+)\\s*(px)?,\\s*(\\d+)|i", $style_data, $widths)) {
         $layout_widths[1] = (int) $widths[1];
         $layout_widths[2] = (int) $widths[3];
         $layout_widths[3] = (int) $widths[5];
     }
     if (preg_match("|Tags\\s*:(.*)\$|mi", $style_data, $tags)) {
         $tags = trim($tags[1]);
     } else {
         $tags = '';
     }
     return array('path' => $style_file, 'modified' => filemtime($style_path), 'author' => $author, 'description' => $description, 'site' => $site, 'stylename' => $stylename, 'stylelink' => $stylelink, 'footer' => $footer, 'version' => $version, 'comments' => $comments, 'header_text_color' => $header_text_color, 'content_width' => $content_width, 'header_width' => $header_width, 'header_height' => $header_height, 'layout_widths' => $layout_widths, 'tags' => $tags);
 }