Esempio n. 1
0
File: func.php Progetto: big2men/qhm
 /**
  * Print Haik-skin variable
  *
  * @param string $name name of custom-skin config
  * @param boolean $return when true return value without print
  * @return void|mixed when $return is true then return value (escaped)
  */
 function hv($name, $return = false)
 {
     global $style_name;
     $skin_custom_vars = get_skin_custom_vars($style_name);
     $value = isset($skin_custom_vars[$name]) ? $skin_custom_vars[$name] : '';
     if ($return) {
         return $value;
     } else {
         echo h($value, ENT_NOQUOTES);
     }
 }
Esempio n. 2
0
/**
 *   Section Plugin
 *   -------------------------------------------
 *   /plugin/section.inc.php
 *
 *   Copyright (c) 2014 hokuken
 *   http://hokuken.com/
 *
 *   created  : 2013/12/09
 *   modified : 2014/07/18
 *
 *   Description
 *
 *   Usage :
 *
 *   ### Notice: Background-Video on any Browser
 *   When specify background-video of MP4 Search Webm(.webm) and Ogg Video(.ogv) in same dir.
 *   Video sources founded are output in video element.
 *   But, Firefox occurs warning and ignore video unless web server return valid Content-Type.
 *
 *     *Apache solution*
 *     AddType video/webm .webm
 *     AddType video/ogg  .ogv
 *
 */
function plugin_section_convert()
{
    global $script;
    static $cnt = 0;
    $qt = get_qt();
    $args = func_get_args();
    $body = array_pop($args);
    $body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
    $title = '';
    $h_align = 'center';
    //left|center|right
    $v_align = 'middle';
    //top|middle|bottom
    $height = $height_xs = '';
    //awesome!
    $type = 'cover';
    //cover|repeat
    $style = 'default';
    //primary|info|success|warning|danger
    $fullpage = FALSE;
    //full height section; fit window size
    $relative = FALSE;
    //position: relative
    $container = TRUE;
    //FALSE to enable 'fit' option
    $jumbotron = FALSE;
    //FALSE to remove .jumbotron
    $color = FALSE;
    //inherit
    $background_image = $background_image_xs = FALSE;
    $background_fix = FALSE;
    $filter = FALSE;
    $background_color = FALSE;
    //transparent
    $additional_class = $container_class = '';
    $additional_style = '';
    $background_video = FALSE;
    $background_filename = '';
    $attrs = array('id' => 'qhm_section_' . ++$cnt, 'class' => 'qhm-section');
    $styles = array('__xs__' => array(), '__raw__' => '');
    $is_eyecatch = FALSE;
    foreach ($args as $arg) {
        if (preg_match('/\\A(left|center|right)\\z/i', $arg, $mts)) {
            $h_align = strtolower($mts[1]);
        } else {
            if (preg_match('/\\A(top|middle|bottom)\\z/i', $arg, $mts)) {
                $v_align = strtolower($mts[1]);
            } else {
                if (preg_match('/\\A(cover|repeat)\\z/i', $arg, $mts)) {
                    $type = strtolower($mts[1]);
                } else {
                    if (preg_match('/\\Axsbg=(.+)\\z/', $arg, $mts)) {
                        $background_image_xs = $mts[1];
                    } else {
                        if (preg_match('/\\Axsheight=([\\d.]+)(.*)\\z/', $arg, $mts)) {
                            $height_xs = $mts[1] . ($mts[2] ? $mts[2] : 'px');
                        } else {
                            if (preg_match('/\\.(jpe?g|gif|png)\\z/i', $arg)) {
                                $background_image = trim($arg);
                            } else {
                                if (preg_match('/\\Aimage=(.+)\\z/', $arg, $mts)) {
                                    $background_image = trim($mts[1]);
                                } else {
                                    if (preg_match('/\\A([\\d.]+)(.*)\\z/', $arg, $mts)) {
                                        $height = $mts[1] . ($mts[2] ? $mts[2] : 'px');
                                    } else {
                                        if ($arg === 'page') {
                                            $fullpage = TRUE;
                                        } else {
                                            if (preg_match('/\\A(primary|info|success|warning|danger)\\z/i', $arg, $mts)) {
                                                $style = $mts[1];
                                            } else {
                                                if (preg_match('/\\Aclass=(.+)\\z/', $arg, $mts)) {
                                                    $additional_class .= ' ' . $mts[1];
                                                } else {
                                                    if (preg_match('/\\Astyle=(.+)\\z/', $arg, $mts)) {
                                                        $additional_style .= $mts[1];
                                                    } else {
                                                        if (preg_match('/\\Acolor=(.+)\\z/', $arg, $mts)) {
                                                            $color = $mts[1];
                                                        } else {
                                                            if (preg_match('/\\Abgcolor=(.+)\\z/', $arg, $mts)) {
                                                                $background_color = $mts[1];
                                                            } else {
                                                                if (preg_match('/\\Abgvideo=(.+)\\z/', $arg, $mts)) {
                                                                    $background_video = $mts[1];
                                                                } else {
                                                                    if (preg_match('/\\Atitle=(.+)\\z/', $arg, $mts)) {
                                                                        $title = $mts[1];
                                                                    } else {
                                                                        if ($arg === 'fit') {
                                                                            $container = FALSE;
                                                                            $styles['padding'] = 0;
                                                                            $styles['height'] = 'auto';
                                                                        } else {
                                                                            if ($arg === 'fix') {
                                                                                $background_fix = TRUE;
                                                                            } else {
                                                                                if ($arg === 'relative') {
                                                                                    $relative = TRUE;
                                                                                } else {
                                                                                    if ($arg === 'jumbotron') {
                                                                                        $jumbotron = TRUE;
                                                                                    } else {
                                                                                        if ($arg === 'nojumbotron') {
                                                                                            $jumbotron = FALSE;
                                                                                        } else {
                                                                                            if ($arg === 'eyecatch') {
                                                                                                $additional_class .= ' qhm-eyecatch';
                                                                                                $jumbotron = TRUE;
                                                                                                $is_eyecatch = TRUE;
                                                                                            } else {
                                                                                                if ($arg === 'blur') {
                                                                                                    $filter = 'blur';
                                                                                                } else {
                                                                                                    if (preg_match('/\\A(dark|light)(?:=(.+))?\\z/', $arg, $mts)) {
                                                                                                        $filter = $mts[1];
                                                                                                        $filter_value =& $mts[2];
                                                                                                    } else {
                                                                                                        if ($arg === '__default') {
                                                                                                            $additional_class .= ' qhm-eyecatch-default';
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // !set attributes
    if ($jumbotron) {
        $attrs['class'] = 'jumbotron ' . $attrs['class'];
    }
    //set base class
    $attrs['class'] .= ' qhm-section-' . $style;
    if ($relative) {
        $styles['position'] = 'relative';
    }
    if ($is_eyecatch) {
        if (isset($_SESSION['temp_design'])) {
            $conf = get_skin_custom_vars($_SESSION['temp_design']);
        } else {
            global $style_name;
            $conf = get_skin_custom_vars($style_name);
        }
        if (isset($conf['default_eyecatch']) && $conf['default_eyecatch']) {
            if ($background_color === FALSE && $background_image === FALSE && isset($conf['eyecatch_bgimage'])) {
                $background_image = $conf['eyecatch_bgimage'];
            }
            if ($background_image === FALSE && isset($conf['enable_eyecatch_bgimage']) && !$conf['enable_eyecatch_bgimage']) {
                $background_image = '';
            }
            if ($color === FALSE && isset($conf['eyecatch_color'])) {
                $color = $conf['eyecatch_color'];
            }
        }
    }
    if ($color) {
        $styles['color'] = $color;
    }
    if ($background_color) {
        $styles['background-color'] = $background_color;
    }
    if ($background_image) {
        if (is_url($background_image, TRUE, TRUE)) {
            $background_filename = $background_image;
        } else {
            $background_filename = dirname($script . 'dummy') . '/' . get_file_path($background_image);
        }
        //first image をセット
        $qt->set_first_image($background_filename);
        // フィルター
        if ($filter === 'blur') {
            $attrs['data-filter'] = $filter;
            $svg_html = '
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
  <filter id="blur">
    <feGaussianBlur stdDeviation="6" />
  </filter>
</svg>
';
            $qt->appendv_once('plugin_section_blur_svg', 'lastscript', $svg_html);
            $addjs = '
<script>
$(function(){
  var ua = {};
  ua.name = window.navigator.userAgent.toLowerCase();
  if (ua.name.indexOf("msie") >= 0 || ua.name.indexOf("trident") >= 0) {
    $(".qhm-section[data-filter=blur] > div").css({background: "none", position: "static"});
  }
});
</script>
';
            $qt->appendv_once('plugin_section_kill_blur_on_ie', 'beforescript', $addjs);
        }
        if ($background_video === FALSE) {
            $styles['background-image'] = 'url(' . h($background_filename) . ')';
        }
        if ($background_fix) {
            // iOS, Android では無効にする
            $addjs = '
<script>
$(function(){
  var ua = {};
  ua.name = window.navigator.userAgent.toLowerCase();
  if (ua.name.indexOf("ipad") >= 0 || ua.name.indexOf("ipod") >= 0 || ua.name.indexOf("iphone") >= 0 || ua.name.indexOf("android") >= 0) {
    $(".qhm-section[data-background-attachment=fixed]").css({backgroundAttachment: "inherit"}).removeAttr("data-background-attachment");
  }
});
</script>
';
            $qt->appendv_once('plugin_section_kill_fixed_on_ios+android', 'beforescript', $addjs);
            $styles['background-attachment'] = 'fixed';
            $attrs['data-background-attachment'] = 'fixed';
        }
        $attrs['data-background-image'] = $background_image;
        $attrs['data-background-type'] = $type;
    }
    $filter_wrapper_html = '';
    if ($filter === 'dark' || $filter === 'light') {
        $attrs['data-filter'] = $filter;
        $opacity = $filter_value ? $filter_value / 100.0 : '0.4';
        $bg_color = $filter === 'light' ? 255 : 0;
        $rgba = 'rgba(' . str_repeat($bg_color . ',', 3) . $opacity . ');';
        $filter_wrapper_html = '
<div class="dark-overlay-wrapper">
<div class="dark-overlay" style="background-color:' . $rgba . '"></div>
</div>
';
    }
    if ($background_image_xs) {
        if (is_url($background_image_xs, TRUE, TRUE)) {
            $background_filename = $background_image_xs;
        } else {
            $background_filename = dirname($script . 'dummy') . '/' . get_file_path($background_image_xs);
        }
        //first image をセット
        $qt->set_first_image($background_filename);
        $styles['__xs__']['background-image'] = 'url(' . h($background_filename) . ')';
    }
    if ($background_video) {
        //dark フィルター以外は使えない
        if (isset($attrs['data-filter']) && !in_array($attrs['data-filter'], array('dark', 'light'))) {
            unset($attrs['data-filter']);
        }
        $ext = pathinfo($background_video, PATHINFO_EXTENSION);
        if ($ext == 'mp4') {
            $background_videofile = array();
            if (is_url($background_video)) {
                $background_videofile["video/mp4"] = $background_video;
                $background_videofile["video/webm"] = preg_replace('/\\.mp4$/i', '.webm', $background_video);
                $background_videofile["video/ogg"] = preg_replace('/\\.mp4$/i', '.ogv', $background_video);
            } else {
                $background_videofile["video/mp4"] = $mp4_path = get_file_path($background_video);
                foreach (array("video/webm" => ".webm", "video/ogg" => ".ogv") as $mime => $ext) {
                    $tmpfile = preg_replace('/\\.mp4$/i', $ext, $mp4_path);
                    if (file_exists($tmpfile)) {
                        $background_videofile[$mime] = $tmpfile;
                    }
                }
            }
            if ($background_image) {
                $bg_image_style = 'background-image:url(' . h($background_filename) . ');';
            }
            $add_js = '
<script>
if (navigator.userAgent.toLowerCase().match(/iphone|ipod|ipad|android|windows phone/))
{
  $(window).on("load", function(){$(".qhm-section .background-video .qhm-section-video").hide()});
}
</script>
';
            $qt->appendv_once('plugin_section_prevent_video', 'beforescript', $add_js);
            $video_html = '
    <div class="background-video" style="' . $bg_image_style . '">
      <video class="qhm-section-video" preload="" loop="" autoplay="" muted="" poster="' . h($background_filename) . '">
';
            foreach ($background_videofile as $mime => $path) {
                $video_html .= '<source src="' . h($path) . '" type="' . $mime . '">';
            }
            $video_html .= '
      </video>
    </div>
';
            $attrs['data-video'] = 'video';
        }
    }
    if ($fullpage) {
        $styles['height'] = '600px';
        $styles['__xs__']['height'] = '100vh';
        $attrs['data-height'] = 'page';
        $addjs = '
<script>
$(function(){
  var $sections = $(".qhm-section[data-height=page]");
  if ($sections.length === 0) return;

  var resizeSection = function resizeSection() {
    var windowHeight = $(window).height();
    $sections.innerHeight(windowHeight);
  };
  resizeSection();
  $(window).on("resize", resizeSection);
});
</script>
';
        $qt->appendv_once('plugin_section_page_height', 'beforescript', $addjs);
    } else {
        if ($height != '') {
            $styles['height'] = $height;
        }
        if ($height_xs != '') {
            $styles['__xs__']['height'] = $height_xs;
        }
        $attrs['data-height'] = $height;
    }
    if ($title !== '') {
        $attrs['data-title'] = $title;
    }
    $attrs['data-horizontal-align'] = $h_align;
    $attrs['data-vertical-align'] = $v_align;
    $attrs['class'] .= ' ' . $additional_class;
    $styles['__raw__'] = $additional_style;
    $attr_string = '';
    foreach ($attrs as $name => $value) {
        $attr_string .= ' ' . $name . '="' . h($value) . '"';
    }
    if ($container) {
        $container_class = 'container-fluid';
    }
    // ! make html
    $body = convert_html($body);
    $html = <<<EOH
<section {$attr_string}>
  {$filter_wrapper_html}
  {$video_html}
    <div>
      <div class="{$container_class} qhm-section-content">
        {$body}
      </div>
    </div>
</section>
EOH;
    $addstyle = '
<link rel="stylesheet" href="' . PLUGIN_DIR . 'section/section.css" />
';
    $qt->appendv_once('plugin_section_style', 'beforescript', $addstyle);
    $style_tag = '<style class="qhm-plugin-section-style">';
    $style_tag .= '#' . $attrs['id'] . ' {';
    $style_tag .= plugin_section_make_style($styles);
    $style_tag .= '}';
    if (isset($styles['__xs__']) && $styles['__xs__']) {
        $style_tag .= '@media (max-width:767px){';
        $style_tag .= '#' . $attrs['id'] . ' {';
        $style_tag .= plugin_section_make_style($styles['__xs__']);
        $style_tag .= '}}';
    }
    $style_tag .= '</style>' . "\n";
    $qt->appendv('beforescript', $style_tag);
    return $html;
}
Esempio n. 3
0
File: html.php Progetto: big2men/qhm
function catbody($title, $page, $body)
{
    global $script, $script_ssl, $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr;
    global $attach_link, $related_link, $cantedit, $function_freeze;
    global $search_word_color, $_msg_word, $foot_explain, $note_hr, $head_tags;
    global $trackback, $trackback_javascript, $referer, $javascript;
    global $nofollow, $non_list;
    global $_LANG, $_LINK, $_IMAGE;
    global $pkwk_dtd;
    // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional...
    global $page_title;
    // Title of this site
    global $do_backup;
    // Do backup or not
    global $modifier;
    // Site administrator's  web page
    global $modifierlink;
    // Site administrator's name
    global $owneraddr;
    // Site owner address
    global $ownertel;
    // Site owner tel
    global $headcopy;
    // Site headcopy
    global $menuadmin;
    // Menu Administrate Page
    global $style_type, $style_name, $logo_image, $logo_header;
    global $keywords, $description, $accesstag, $ga_tracking_id, $killer_fg, $killer_bg, $noindex, $accesstag_moved;
    //for skin by hokuken
    global $qhm_adminmenu;
    // Site administration menu 20 JUN 2007
    global $custom_meta;
    // Insert meta tag for specific meta tag
    global $adcode;
    // AD code (exp. Google Adwords, Analytics ... )  25 JLY 2007 by hokuken.com
    global $nowindow;
    // Disable including external_link.js
    global $killer_page2;
    // for Killer page Design 2
    global $no_qhm_licence;
    // qhm licence
    global $include_skin_file_path;
    //orignal skin setting
    global $qhm_access_key;
    global $reg_exp_host;
    global $unload_confirm, $check_login;
    global $enable_wp_theme, $enable_wp_theme_name, $wp_add_css;
    //WordPress用のテーマ
    global $mobile_redirect, $googlemaps_apikey;
    global $other_plugins, $other_plugin_categories;
    global $default_script, $init_scripts;
    global $enable_smart_style, $smart_name;
    // smart phone
    global $is_update;
    global $enable_fitvids;
    // body部分以外は、元々の$script を使う(通常のリンク設定)を使う
    // 結果、$body内は、script_sslを使ったリンクになるが、ナビ、メニューなどは、元の$scriptを必ず使う
    $script = $init_scripts['normal'];
    $script_ssl = $init_scripts['ssl'];
    if (!file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) {
        die_message('SKIN_FILE is not found');
    }
    $_LINK = $_IMAGE = array();
    // Add JavaScript header when ...
    if ($trackback && $trackback_javascript) {
        $javascript = 1;
    }
    // Set something If you want
    if (!PKWK_ALLOW_JAVASCRIPT) {
        unset($javascript);
    }
    $_page = isset($vars['page']) ? $vars['page'] : '';
    $r_page = rawurlencode($_page);
    //QHM Template
    $qt = get_qt();
    if (!$qt->set_page) {
        $qt->set_page($_page);
    }
    //QHM Messages
    $qm = get_qm();
    // Set $_LINK for skin
    $_LINK['add'] = "{$script}?cmd=add&amp;page={$r_page}";
    $_LINK['backup'] = "{$script}?cmd=backup&amp;page={$r_page}";
    $_LINK['copy'] = "{$script}?plugin=template&amp;refer={$r_page}";
    $_LINK['diff'] = "{$script}?cmd=diff&amp;page={$r_page}";
    $_LINK['edit'] = "{$script}?cmd=edit&amp;page={$r_page}";
    $_LINK['filelist'] = "{$script}?cmd=filelist";
    $_LINK['freeze'] = "{$script}?cmd=freeze&amp;page={$r_page}";
    $_LINK['help'] = "{$script}?" . rawurlencode($help_page);
    $_LINK['list'] = "{$script}?cmd=list";
    $_LINK['new'] = "{$script}?plugin=newpage&amp;refer={$r_page}";
    $_LINK['rdf'] = "{$script}?cmd=rss&amp;ver=1.0";
    $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew);
    $_LINK['refer'] = "{$script}?plugin=referer&amp;page={$r_page}";
    $_LINK['reload'] = "{$script}?{$r_page}";
    $_LINK['rename'] = "{$script}?plugin=rename&amp;refer={$r_page}";
    $_LINK['delete'] = "{$script}?plugin=delete&amp;page={$r_page}";
    $_LINK['rss'] = "{$script}?cmd=rss";
    $_LINK['rss10'] = "{$script}?cmd=rss&amp;ver=1.0";
    // Same as 'rdf'
    $_LINK['rss20'] = "{$script}?cmd=rss&amp;ver=2.0";
    $_LINK['search'] = "{$script}?cmd=search";
    $_LINK['top'] = dirname($script . 'dummy.php') . '/';
    if ($trackback) {
        $tb_id = tb_get_id($_page);
        $_LINK['trackback'] = "{$script}?plugin=tb&amp;__mode=view&amp;tb_id={$tb_id}";
    }
    $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&amp;page={$r_page}";
    $_LINK['upload'] = "{$script}?plugin=attach&amp;pcmd=upload&amp;page={$r_page}";
    $_LINK['menuadmin'] = "{$script}?" . rawurlencode($menuadmin);
    //Hokuken.com original
    $_LINK['qhm_adminmenu'] = qhm_get_script_path() . "?cmd=qhmauth";
    $_LINK['qhm_logout'] = "{$script}?cmd=qhmlogout";
    $_LINK['qhm_setting'] = "{$script}?cmd=qhmsetting";
    $_LINK['edit_menu'] = "{$script}?cmd=edit&amp;page=MenuBar";
    $_LINK['edit_menu2'] = "{$script}?cmd=edit&amp;page=MenuBar2";
    $_LINK['edit_navi'] = "{$script}?cmd=edit&amp;page=SiteNavigator";
    $_LINK['edit_navi2'] = "{$script}?cmd=edit&amp;page=SiteNavigator2";
    $_LINK['edit_header'] = "{$script}?cmd=edit&amp;page=SiteHeader";
    $_LINK['yetlist'] = "{$script}?cmd=yetlist";
    // Compat: Skins for 1.4.4 and before
    $link_add =& $_LINK['add'];
    $link_new =& $_LINK['new'];
    // New!
    $link_edit =& $_LINK['edit'];
    $link_diff =& $_LINK['diff'];
    $link_top =& $_LINK['top'];
    $link_list =& $_LINK['list'];
    $link_filelist =& $_LINK['filelist'];
    $link_search =& $_LINK['search'];
    $link_whatsnew =& $_LINK['recent'];
    $link_backup =& $_LINK['backup'];
    $link_help =& $_LINK['help'];
    $link_trackback =& $_LINK['trackback'];
    // New!
    $link_rdf =& $_LINK['rdf'];
    // New!
    $link_rss =& $_LINK['rss'];
    $link_rss10 =& $_LINK['rss10'];
    // New!
    $link_rss20 =& $_LINK['rss20'];
    // New!
    $link_freeze =& $_LINK['freeze'];
    $link_unfreeze =& $_LINK['unfreeze'];
    $link_upload =& $_LINK['upload'];
    $link_template =& $_LINK['copy'];
    $link_refer =& $_LINK['refer'];
    // New!
    $link_rename =& $_LINK['rename'];
    $link_delete =& $_LINK['delete'];
    $link_menuadmin =& $_LINK['menuadmin'];
    //Hokuken.com original
    $link_copy =& $_LINK['copy'];
    $link_qhm_adminmenu =& $_LINK['qhm_adminmenu'];
    //Hokuken.com original
    $link_qhm_logout =& $_LINK['qhm_logout'];
    //Hokuken.com original
    $link_qhm_setting =& $_LINK['qhm_setting'];
    //Hokuken.com original
    $link_edit_menu =& $_LINK['edit_menu'];
    //Hokuken.com original
    $link_edit_menu2 =& $_LINK['edit_menu2'];
    $link_edit_navi =& $_LINK['edit_navi'];
    //Hokuken.com original
    $link_edit_navi2 =& $_LINK['edit_navi2'];
    //Hokuken.com original
    $link_edit_header =& $_LINK['edit_header'];
    //Hokuken.com original
    $link_yetlist =& $_LINK['yetlist'];
    //Hokuken.com original
    // Init flags
    $is_page = is_pagename($_page) && $_page != $whatsnew;
    $is_read = arg_check('read') && is_page($_page);
    $is_freeze = is_freeze($_page);
    // Last modification date (string) of the page
    $lastmodified = $is_read ? format_date(get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : '';
    // List of attached files to the page
    $attaches = $attach_link && $is_read && exist_plugin_action('attach') ? attach_filelist() : '';
    // List of related pages
    $related = $related_link && $is_read ? make_related($_page) : '';
    // List of footnotes
    ksort($foot_explain, SORT_NUMERIC);
    $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : '';
    // Tags will be inserted into <head></head>
    $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : '';
    // 1.3.x compat
    // Last modification date (UNIX timestamp) of the page
    $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0;
    // Search words
    if ($search_word_color && isset($vars['word'])) {
        $body = '<div class="small">' . $_msg_word . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body;
        // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5
        // with array_splice(), array_flip()
        $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY);
        $words = array_splice($words, 0, 10);
        // Max: 10 words
        $words = array_flip($words);
        $keys = array();
        foreach ($words as $word => $id) {
            $keys[$word] = strlen($word);
        }
        arsort($keys, SORT_NUMERIC);
        $keys = get_search_words(array_keys($keys), TRUE);
        $id = 0;
        foreach ($keys as $key => $pattern) {
            $s_key = htmlspecialchars($key);
            $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS';
            $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];');
            $body = preg_replace_callback($pattern, $decorate_Nth_word, $body);
            $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes);
            ++$id;
        }
    }
    //-----------------------------------------------------------------------
    //
    // customized by hokuken for QHM (2009/1/28)
    //
    //-----------------------------------------------------------------------
    //----------------- 携帯の場合の処理 --------------------------------------
    if (preg_match('/keitai.skin.php$/', SKIN_FILE)) {
        require LIB_DIR . 'qhm_init.php';
        require LIB_DIR . 'qhm_init_main.php';
        require SKIN_FILE;
        return;
    }
    //------------------- IF UA is mobile, end here -----------------------
    //---------- KILLERPAGE: でもKILLERPAGE2:に統合 いつか消したい --------------
    if ($killer_fg != '') {
        //load common setting and output header
        require LIB_DIR . 'qhm_init.php';
        $killer_page2['fg'] = $killer_fg;
        $killer_page2['bg'] = $killer_bg;
        $killer_page2['width'] = 700;
        $killer_page2['padding'] = 60;
        $killer_page2['bg_body'] = '#fff';
        $killer_page2['fg_body'] = '#000';
        require LIB_DIR . 'qhm_init_killer.php';
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
    }
    //--------------------------- いつか消したい end here ----------------
    ///////////////////////////////////////////////////////////////////
    //
    // Main
    //
    //common setting
    require LIB_DIR . 'qhm_init.php';
    $qt->enable_cache = $qt->getv('editable') ? false : $qt->enable_cache;
    $qt->set_encode($shiftjis || $eucjp ? true : false);
    if ($shiftjis) {
        $output_encode = 'Shift_JIS';
    } else {
        if ($eucjp) {
            $output_encode = 'EUC-JP';
        } else {
            $output_encode = CONTENT_CHARSET;
        }
    }
    define('WORDPRESS_CHARSET', $output_encode);
    //output common header (available change encode)
    $qt->setv('meta_content_type', qhm_output_dtd($pkwk_dtd, CONTENT_CHARSET, $output_encode));
    //------- KILLERPAGE2: セールスレター型デザイン -------------------
    if (isset($killer_page2['fg']) != '') {
        require LIB_DIR . 'qhm_init_killer.php';
        //JQuery Include
        $jquery_script = '';
        $jquery_cookie_script = '';
        if ($qt->getv('jquery_include')) {
            $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
            $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
        }
        $bootstrap_style = $bootstrap_script = '';
        if ($qt->getv('bootstrap_script')) {
            $bootstrap_style = $qt->getv('bootstrap_style');
            $bootstrap_script = $qt->getv('bootstrap_script');
        }
        $qt->setv('jquery_script', $bootstrap_style . $jquery_script . $bootstrap_script);
        $qt->setv('jquery_cookie_script', $jquery_cookie_script);
        $longtaketime = getmicrotime() - MUTIME;
        $taketime = sprintf('%01.03f', $longtaketime);
        $qt->setv('taketime', $taketime);
        $qt->read('skin/killerpage2/pukiwiki.skin.php');
        return;
    }
    //-------------------------------------------------------------
    // ---- include main design skin file ----
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $style_type = $_SESSION['temp_style_type'];
    }
    //pluginでデザインが指定されている場合
    if ($include_skin_file_path != '') {
        $style_name = $include_skin_file_path;
    }
    require LIB_DIR . 'qhm_init_main.php';
    // meta:GENERATOR
    $generator_tag = '<meta name="GENERATOR" content="Quick Homepage Maker; version=' . QHM_VERSION . '; haik=' . (is_bootstrap_skin() ? 'true' : 'false') . '" />' . "\n";
    $qt->prependv_once('generator_tag', 'beforescript', $generator_tag);
    //-------------------------------------------------
    // ogp タグを挿入
    //-------------------------------------------------
    if (exist_plugin('ogp')) {
        plugin_ogp_set_template($body);
    }
    //独自のテンプレートファイルをチェック
    $skin_file = SKIN_DIR . "{$style_name}/pukiwiki.skin.php";
    if ($qt->getv('layout_name')) {
        $layout_file = $qt->getv('layout_name') . '.skin.php';
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_file}";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    } else {
        $layout_prefix = 'content';
        if ($_page === $defaultpage) {
            $layout_prefix = 'default';
        } else {
            if (is_qblog()) {
                $layout_prefix = 'article';
            }
        }
        $layout_name = isset($style_config["{$layout_prefix}_layout"]) ? $style_config["{$layout_prefix}_layout"] : "";
        $layout_path = SKIN_DIR . "{$style_name}/{$layout_name}.skin.php";
        if (file_exists($layout_path)) {
            $skin_file = $layout_path;
        }
    }
    if (!file_exists($skin_file)) {
        $skin_file = SKIN_FILE;
        //デフォルトの位置
    }
    // Read design config for customize
    $style_config = read_skin_config($style_name);
    $skin_custom_vars = get_skin_custom_vars($style_name);
    $custom_css = make_custom_css($style_name);
    $qt->prependv('beforescript', $custom_css);
    if (isset($style_config['bootstrap']) && $style_config['bootstrap'] !== false) {
        $qt->setv('jquery_include', true);
    }
    // Default Eyecatch
    if (isset($skin_custom_vars['default_eyecatch']) && $skin_custom_vars['default_eyecatch'] && $qt->getv('main_visual') === '' && exist_plugin('eyecatch')) {
        $bg_image = $color = '';
        if (isset($skin_custom_vars['eyecatch_bgimage'])) {
            $bg_image = $skin_custom_vars['eyecatch_bgimage'];
            $bg_image = is_url($bg_image, TRUE, TRUE) || file_exists(get_file_path($bg_image)) ? $bg_image : '';
        }
        if (isset($skin_custom_vars['enable_eyecatch_bgimage']) && !$skin_custom_vars['enable_eyecatch_bgimage']) {
            $bg_image = '';
        }
        if (isset($skin_custom_vars['eyecatch_color'])) {
            $color = 'color=' . $skin_custom_vars['eyecatch_color'];
        }
        if (is_qblog()) {
            $title_copy = $qblog_title;
        } else {
            if (isset($skin_custom_vars['eyecatch_title_type']) && trim($skin_custom_vars['eyecatch_title_type']) == 'site') {
                $title_copy = $page_title;
            } else {
                if ($_page === $defaultpage) {
                    $title_copy = $page_title;
                } else {
                    $title_copy = get_page_title($_page);
                }
            }
        }
        $content = <<<EOD
! {$title_copy}
EOD;
        plugin_eyecatch_convert($bg_image, $color, '__default', $content);
    }
    if ($qt->getv('no_eyecatch')) {
        $qt->setv('main_visual', "<!-- no eyecatch -->");
    }
    // Determine emptiness of eyecatch
    $qt->setv('eyecatch_is_empty', $qt->getv('no_eyecatch') || $qt->getv('main_visual') === '');
    if (isset($skin_custom_vars['palette_color']) && trim($skin_custom_vars['palette_color'])) {
        $qt->setv('palette_color', trim($skin_custom_vars['palette_color']));
        $qt->setv('palette_color_class', 'haik-palette-' . trim($skin_custom_vars['palette_color']));
    }
    //JQuery Include
    $jquery_script = '';
    $jquery_cookie_script = '';
    if ($qt->getv('jquery_include')) {
        $jquery_script = '<script type="text/javascript" src="js/jquery.js"></script>';
        $jquery_cookie_script = '<script type="text/javascript" src="js/jquery.cookie.js"></script>';
    }
    if ($qt->getv('bootstrap_script')) {
        $bootstrap_script = $qt->getv('bootstrap_script');
    }
    $qt->setv('jquery_script', $jquery_script . $bootstrap_script);
    $qt->setv('jquery_cookie_script', $jquery_cookie_script);
    $longtaketime = getmicrotime() - MUTIME;
    $taketime = sprintf('%01.03f', $longtaketime);
    $qt->setv('taketime', $taketime);
    //UniversalAnalytics Tracking Code
    if ($code = $qt->getv('ga_universal_analytics')) {
        $qt->appendv('beforescript', $code);
    }
    //------------------------------------------------------------------
    // WordPressデザイン
    if ($enable_wp_theme && ($vars['cmd'] != 'qhmsetting' && $vars['plugin'] != 'qhmsetting')) {
        define('TEMPLATEPATH', 'skin/wordpress/' . $enable_wp_theme_name);
        include LIB_DIR . 'wp_adapter.php';
        wp_load_functions();
        $skin_file = get_wp_skin_file();
    }
    //-------------------------------------------------------------------
    //-------------------------------------------------------------------
    // 	プレビュー用のskinファイルを表示
    $tmpfilename = '';
    if (isset($_SESSION['temp_skin']) && strlen($_SESSION['temp_skin']) > 0) {
        $tmpfilename = $skin_file = tempnam(realpath(CACHEQHM_DIR), 'qhmdesign');
        file_put_contents($skin_file, $_SESSION['temp_skin']);
        $qt->setv('default_css', $bootstrap_css . $_SESSION['temp_css']);
        $qt->setv('style_path', $_SESSION['temp_style_path']);
    }
    //-------------------------------------------------------------------
    //skinファイルを読み込んで、表示
    $qt->read($skin_file, $_page);
    // 一時ファイルの削除
    if (file_exists($tmpfilename) && strpos(basename($tmpfilename), 'qhmdesign') === 0) {
        unlink($tmpfilename);
    }
}
Esempio n. 4
0
            unset($tools['toollink']['sub']['qdsgnlink']);
        }
    }
    if (strpos($style_name, 'haik_') !== 0) {
        if (isset($tools['haiklink'])) {
            unset($tools['haiklink']);
        }
    } else {
        $addjs = '
<script type="text/javascript" src="js/haik_theme_utility.js"></script>
<script type="text/javascript" src="' . PLUGIN_DIR . 'skin_customizer/color_picker.js"></script>
';
        $qt->appendv('beforescript', $addjs);
        // Determine custom skin
        $style_config = read_skin_config($style_name);
        $skin_custom_vars = get_skin_custom_vars($style_name);
        if (!isset($style_config['custom_options']['header']) || !$skin_custom_vars['header']) {
            unset($tools['sitelink']['sub']['headerlink']);
        }
    }
    if (!ss_admin_check()) {
        if (isset($tools['reflink'])) {
            unset($tools['reflink']);
        }
        if (isset($tools['pagelink'])) {
            unset($tools['pagelink']);
        }
        if (isset($tools['sitelink'])) {
            unset($tools['sitelink']);
        }
        if (isset($tools['toollink'])) {