if (isset($vars['plugin']) && $vars['plugin'] == 'qhmsetting' && isset($vars['phase']) && $vars['phase'] == 'design' && isset($vars['mode']) && $vars['mode'] == 'form' && isset($vars['design'])) { $_SESSION['temp_design'] = $vars['design']; $_SESSION['temp_enable_wp'] = $vars['enable_wp_theme'] == '1' ? 1 : 0; $_SESSION['wp_add_css'] = $vars['wp_add_css']; } if (isset($_SESSION['temp_design']) && $vars['cmd'] !== 'qhmsetting' && $vars['plugin'] !== 'qhmsetting') { $style_name = $enable_wp_theme_name = $_SESSION['temp_design']; if (isset($_SESSION['temp_enable_wp'])) { $enable_wp_theme = $_SESSION['temp_enable_wp']; } if (isset($_SESSION['wp_add_css'])) { $wp_add_css = $_SESSION['wp_add_css']; } } // Determine custom skin $style_config = read_skin_config($style_name); $is_bootstrap_skin = false; $bootstrap_css = ''; if ($style_config['bootstrap']) { $is_bootstrap_skin = true; } else { if ($qt->getv('is_bootstrap_skin')) { $is_bootstrap_skin = true; } } $qt->setv('is_bootstrap_skin', $is_bootstrap_skin); //Bootstrap Include $bootstrap_css = ''; $bootstrap_script = ''; if ($is_bootstrap_skin) { $bootstrap_css = '<link rel="stylesheet" href="skin/bootstrap/css/bootstrap.min.css" />';
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&page={$r_page}"; $_LINK['backup'] = "{$script}?cmd=backup&page={$r_page}"; $_LINK['copy'] = "{$script}?plugin=template&refer={$r_page}"; $_LINK['diff'] = "{$script}?cmd=diff&page={$r_page}"; $_LINK['edit'] = "{$script}?cmd=edit&page={$r_page}"; $_LINK['filelist'] = "{$script}?cmd=filelist"; $_LINK['freeze'] = "{$script}?cmd=freeze&page={$r_page}"; $_LINK['help'] = "{$script}?" . rawurlencode($help_page); $_LINK['list'] = "{$script}?cmd=list"; $_LINK['new'] = "{$script}?plugin=newpage&refer={$r_page}"; $_LINK['rdf'] = "{$script}?cmd=rss&ver=1.0"; $_LINK['recent'] = "{$script}?" . rawurlencode($whatsnew); $_LINK['refer'] = "{$script}?plugin=referer&page={$r_page}"; $_LINK['reload'] = "{$script}?{$r_page}"; $_LINK['rename'] = "{$script}?plugin=rename&refer={$r_page}"; $_LINK['delete'] = "{$script}?plugin=delete&page={$r_page}"; $_LINK['rss'] = "{$script}?cmd=rss"; $_LINK['rss10'] = "{$script}?cmd=rss&ver=1.0"; // Same as 'rdf' $_LINK['rss20'] = "{$script}?cmd=rss&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&__mode=view&tb_id={$tb_id}"; } $_LINK['unfreeze'] = "{$script}?cmd=unfreeze&page={$r_page}"; $_LINK['upload'] = "{$script}?plugin=attach&pcmd=upload&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&page=MenuBar"; $_LINK['edit_menu2'] = "{$script}?cmd=edit&page=MenuBar2"; $_LINK['edit_navi'] = "{$script}?cmd=edit&page=SiteNavigator"; $_LINK['edit_navi2'] = "{$script}?cmd=edit&page=SiteNavigator2"; $_LINK['edit_header'] = "{$script}?cmd=edit&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); } }
public static function load($style_name) { $skin_custom_vars = array(); $style_config = read_skin_config($style_name); foreach ($style_config['custom_options'] as $name => $value) { $skin_custom_vars[$name] = $value['value']; } $custom_skin_file = CACHE_DIR . 'custom_skin.' . $style_name . '.dat'; if (file_exists($custom_skin_file)) { $custom_skin_data = file_get_contents($custom_skin_file); $custom_skin_data = unserialize($custom_skin_data); if ($custom_skin_data) { foreach ($custom_skin_data as $key => $value) { if (isset($skin_custom_vars[$key])) { $skin_custom_vars[$key] = trim($value); } } } } return $skin_custom_vars; }
function plugin_skin_customizer_set_form() { global $script, $style_name; $skin_name = $_SESSION['temp_design']; $skin_config = read_skin_config($_SESSION['temp_design']); if (!$skin_config['bootstrap']) { return ''; } $custom_file = CACHE_DIR . 'custom_skin.' . $skin_name . '.dat'; if (file_exists($custom_file)) { $custom_data = file_get_contents($custom_file); $custom_data = unserialize($custom_data); if ($custom_data) { foreach ($custom_data as $key => $value) { if (isset($skin_config['custom_options'][$key])) { $skin_config['custom_options'][$key]['value'] = trim($value); } } } } $qt = get_qt(); $html = array(); $modal = array(); $tmpl = ' <div %s> <label class="control-label col-sm-4">%s</label> <div class="col-sm-8 text-left"> %s </div> </div> '; foreach ($skin_config['custom_options'] as $key => $conf) { $group_attr = 'class="form-group"'; if (isset($conf['follow'])) { $group_attr = 'class="form-group collapse" data-follow="' . h($conf['follow']) . '"'; } if (isset($conf['draft'])) { $draft = '<span class="text-muted">' . h($conf['draft']) . '</span>'; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $draft); continue; } switch ($conf['type']) { case 'divider': $html[] = '<div class="divider"></div>'; break; case 'spacer': $html[] = '<div class="spacer"></div>'; break; case 'text': $formhtml = '<input type="text" name="' . h($key) . '" value="' . h($conf['value']) . '" class="form-control input-sm">'; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'textarea': $formhtml = '<textarea name="' . h($key) . '" rows="2" class="form-control input-sm">' . h($conf['value']) . '</textarea>'; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'hidden': $formhtml = '<input type="hidden" name="' . h($key) . '" value="' . h($conf['value']) . '">'; $html[] = $formhtml; break; case 'color': $formhtml = ' <div class="row"> <div class="col-sm-5"> <input type="text" name="' . h($key) . '" value="' . h($conf['value']) . '" class="color-picker form-control input-sm" data-color="' . h($conf['value']) . '"> </div> </div> '; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'theme_color': $formhtml = ' <div id="themeColorPicker_palette" class="themeColorPicker-palette"> <input type="hidden" name="' . h($key) . '" value="' . h($conf['value']) . '" class="theme-color-picker"> </div> '; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'img': $param = array('cmd' => 'skin_customizer', 'phase' => 'file_upload', 'param_name' => h($key)); $formhtml = ' <span class="pull-right"><small>選択中の画像:</small><span class="qhm-btn-default qhm-btn-sm" data-image="' . h($conf['value']) . '" data-target="#qhm_skin_customizer_' . h($key) . '_file"> </span></span> <span class="qhm-btn-info qhm-btn-sm fileinput-button"> <i class="text-lg glyphicon glyphicon-paperclip"></i> <span>アップロード</span> <input type="file" name="' . h($key) . '_FILE" id="qhm_skin_customizer_' . h($key) . '_file" data-file-upload="image" data-form-data="' . h(json_encode($param)) . '" data-param-name="' . h($key) . '" data-sync="' . h($key) . '" data-parent="file"> <input type="hidden" name="' . h($key) . '" value="' . h($conf['value']) . '"> </span> '; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'font': $formhtml = ''; if (isset($conf['options'])) { $formhtml = '<select name="' . h($key) . '" class="form-control input-sm">'; foreach ($conf['options'] as $option) { $selected = $option == $conf['value'] ? " selected" : ''; $style = 'font-family: ' . h($option) . ';'; $formhtml .= '<option value="' . h($option) . '" style="' . $style . '"' . $selected . '>' . h($option) . '</option>'; } $formhtml .= '</select>'; } else { $formhtml = '<input type="text" name="' . h($key) . '" value="' . h($conf['value']) . '" class="form-control input-sm">'; } $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'select': if (isset($conf['options'])) { $formhtml = '<select name="' . h($key) . '" class="form-control input-sm">'; foreach ($conf['options'] as $op_key => $op_name) { $selected = $op_key == $conf['value'] ? " selected" : ''; $formhtml .= '<option value="' . h($op_key) . '"' . $selected . '>' . h($op_name) . '</option>'; } $formhtml .= '</select>'; $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); } break; case 'if': $formhtml = ''; if (isset($conf['paint'])) { $target = $conf['paint']; if (isset($skin_config['custom_options'][$target]['value'])) { $base = 'white'; $color = $skin_config['custom_options'][$target]['value']; $base_style = 'data-color="' . $base . '" data-font-color="' . h($color) . '"'; $color_style = 'data-color="' . h($color) . '" data-font-color="' . $base . '"'; $formhtml = ' <div class="btn-group qhm-skin-customizer-color" data-toggle="buttons" data-color-type="paint" data-paint-target="' . h($target) . '"> <label class="btn qhm-btn-default qhm-btn-sm' . ($conf['value'] ? ' active' : '') . '" ' . $base_style . '><input type="radio" name="' . h($key) . '" value="1"' . ($conf['value'] ? ' checked' : '') . '> A </label> <label class="btn qhm-btn-default qhm-btn-sm' . ($conf['value'] ? '' : ' active') . '" ' . $color_style . '><input type="radio" name="' . h($key) . '" value="0"' . ($conf['value'] ? '' : ' checked') . '> A </label> </div> '; } } else { $formhtml = ' <div class="btn-group" data-toggle="buttons" data-type="if"> <label class="btn qhm-btn-default qhm-btn-sm' . ($conf['value'] ? ' active' : '') . '"><input type="radio" name="' . h($key) . '" value="1"' . ($conf['value'] ? ' checked' : '') . '> ON</label> <label class="btn qhm-btn-default qhm-btn-sm' . ($conf['value'] ? '' : ' active') . '"><input type="radio" name="' . h($key) . '" value="0"' . ($conf['value'] ? '' : ' checked') . '> OFF</label> </div> '; } if ($formhtml != '') { $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); } break; case 'select_img': $host = PLUGIN_SKIN_CUSTOMIZER_CDN; $haik_bg_images = file_get_contents("{$host}/data/images.json"); $haik_bg_images = json_decode($haik_bg_images, true); foreach ($haik_bg_images as $i => $bg_image) { $haik_bg_images[$i] = $host . $bg_image; } $is_custom_image = is_url($conf['value'], TRUE, TRUE) || $conf['value'] == '' ? FALSE : TRUE; $bg_basename = basename($conf['value']); $param = array('cmd' => 'skin_customizer', 'phase' => 'file_upload', 'param_name' => h($key)); $formhtml = ' <span class="pull-right"><small>選択中の画像:</small><span class="qhm-btn-default qhm-btn-sm" data-image="' . h($conf['value']) . '" data-target="#qhm_skin_customizer_' . h($key) . '_select_img"> </span></span> <button id="qhm_skin_customizer_' . h($key) . '_select_img" type="button" class="qhm-btn-info qhm-btn-sm" data-toggle="modal" data-target="#qhm_skin_customizer_' . h($key) . '_modal"> <i class="text-lg glyphicon glyphicon-paperclip"></i> <span>画像の選択</span> <input type="hidden" name="' . h($key) . '" value="' . h($conf['value']) . '"> </button> '; $tmpl_file = PLUGIN_DIR . 'skin_customizer/select_img_modal.html'; ob_start(); include $tmpl_file; $modal[] = ob_get_clean(); $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; case 'select_texture': $host = PLUGIN_SKIN_CUSTOMIZER_CDN; $haik_bg_images = file_get_contents("{$host}/data/textures.json"); $haik_bg_images = json_decode($haik_bg_images, true); foreach ($haik_bg_images as $i => $bg_image) { $haik_bg_images[$i] = $host . $bg_image; } $is_custom_image = is_url($conf['value'], TRUE, TRUE) || $conf['value'] == '' ? FALSE : TRUE; $bg_basename = basename($conf['value']); $param = array('cmd' => 'skin_customizer', 'phase' => 'file_upload', 'param_name' => h($key)); $formhtml = ' <span class="pull-right"><small>選択中の画像:</small><span class="qhm-btn-default qhm-btn-sm" data-image="' . h($conf['value']) . '" data-target="#qhm_skin_customizer_' . h($key) . '_select_texture"> </span></span> <button id="qhm_skin_customizer_' . h($key) . '_select_texture" type="button" class="qhm-btn-info qhm-btn-sm" data-toggle="modal" data-target="#qhm_skin_customizer_' . h($key) . '_modal"> <i class="text-lg glyphicon glyphicon-paperclip"></i> <span>画像の選択</span> <input type="hidden" name="' . h($key) . '" value="' . h($conf['value']) . '"> </button> '; $tmpl_file = PLUGIN_DIR . 'skin_customizer/select_texture_modal.html'; ob_start(); include $tmpl_file; $modal[] = ob_get_clean(); $html[] = sprintf($tmpl, $group_attr, h($conf['title']), $formhtml); break; } } $custom_html = ' <a class="btn btn-link pull-left qhm-skin-customizer-menu-toggle" data-toggle="collapse" href=".qhm-skin-customizer-menu">カスタマイズ</a> <div class="qhm-skin-customizer-menu collapse"> <form action="' . h($script) . '" class="form-horizontal" method="post" enctype="multipart/form-data"> <input type="hidden" name="cmd" value="skin_customizer" /> <div class="qhm-skin-customizer-body container-fluid"> ' . join('', $html) . ' </div> <div class="qhm-skin-customizer-footer"> <div class="form-group"> <div class="col-sm-8 col-sm-offset-4 text-left"> <input type="submit" class="qhm-btn-primary btn-sm" name="save" value="保存" /> <input type="submit" class="btn btn-link btn-sm" name="reset" onclick="return confirm(\'設定したデータを初期化します。\\nアップロードした画像も削除します。\\n\\nよろしいですか?\');" value="リセット" /> </div> </div> </div> </form> </div> '; $modal_html = join('', $modal); $qt->appendv('lastscript', $modal_html); $open = 0; if (isset($_SESSION['temp_design_customizer'])) { $open = $_SESSION['temp_design_customizer']; unset($_SESSION['temp_design_customizer']); } $colors = file_get_contents(PLUGIN_DIR . 'skin_customizer/colors.json'); $data = array('script' => $script, 'open' => $open, 'file_upload_postdata' => array(array('name' => 'cmd', 'value' => 'skin_customizer'), array('name' => 'phase', 'value' => 'file_upload')), 'palette' => json_decode($colors, false)); $skin_dir = SKIN_DIR . $skin_name; if (file_exists($skin_dir . '/theme_colors.json')) { $theme_colors = file_get_contents($skin_dir . '/theme_colors.json'); $data['theme_colors'] = json_decode($theme_colors, false); } $data_json = json_encode($data); $js = ' <link rel="stylesheet" href="js/jquery.fileupload.css" /> <link rel="stylesheet" href="' . PLUGIN_DIR . 'skin_customizer/color_picker.css" /> <link rel="stylesheet" href="' . PLUGIN_DIR . 'skin_customizer/skin_customizer.css" /> <script type="text/javascript" src="js/jquery.ui.widget.js"></script> <script type="text/javascript" src="js/jquery.iframe-transport.js"></script> <script type="text/javascript" src="js/jquery.fileupload.js"></script> <script type="text/javascript"> var skin_customizer = ' . $data_json . '; </script> <script type="text/javascript" src="' . PLUGIN_DIR . 'skin_customizer/color_picker.js"></script> <script type="text/javascript" src="' . PLUGIN_DIR . 'skin_customizer/skin_customizer.js"></script> '; $qt->appendv('beforescript', $js); return $custom_html; }