function plugin_qblog_recent_convert() { global $vars, $script, $qblog_page_re, $qblog_close; //閉鎖中は何も表示しない if ($qblog_close && !ss_admin_check()) { return ''; } //---- キャッシュのための処理を登録 ----- $qt = get_qt(); if ($qt->create_cache) { $args = func_get_args(); return $qt->get_dynamic_plugin_mark(__FUNCTION__, $args); } //------------------------------------ $display_num = PLUGIN_QBLOG_RECENT_DEFAULT_NUM; if (func_num_args()) { $args = func_get_args(); $display_num = $args[0]; } $recent_file = CACHEQBLOG_DIR . 'qblog_recent.dat'; if (file_exists($recent_file)) { $recent_list = explode("\n", file_get_contents($recent_file)); } else { $recent_list = array(); } //件数を抜く $size = array_shift($recent_list); $list = ''; $list .= '<ul class="qblog_recent">'; foreach ($recent_list as $i => $line) { if ($i >= $display_num) { break; } if (rtrim($line) != '') { $pagename = rtrim($line); $title = get_page_title($pagename); if ($pagename == $title) { if (preg_match($qblog_page_re, $pagename, $mts)) { $blog_date = "{$mts[1]}年{$mts[2]}月{$mts[3]}日"; $title = " No.{$mts[4]}"; } } //! 表示方法 要検討 $list .= '<li><a href="' . $script . '?' . rawurldecode($pagename) . '">' . $blog_date . $title . '</a></li>'; } } $list .= '</ul>'; if (!is_bootstrap_skin()) { $include_bs = ' <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> <script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>'; $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs); } //qblog.css を読み込む $head = ' <link rel="stylesheet" href="plugin/qblog/qblog.css" />'; $qt->appendv_once('qblog_beforescript', 'beforescript', $head); return $list; }
function plugin_gmapfun_convert() { static $s_gmapfun_cnt = 0; global $script, $googlemaps_apikey; global $vars; $qt = get_qt(); $qt->setv('jquery_include', true); $args = func_get_args(); $last = func_num_args() - 1; $datalist = ''; if (strpos($args[$last], ',') !== FALSE) { $datalist = array_pop($args); } list($type, $w, $h, $zoom, $addr, $lat, $lng) = array_pad($args, 7, ''); $type = $type == '' ? 'default' : $type; $addr = trim($addr) == '' ? '' : trim($addr); $lat = $lat == '' ? '35.658613' : $lat; $lng = $lng == '' ? '139.745525' : $lng; $zoom = $zoom == '' ? '15' : $zoom; $w = preg_match('/^[0-9]+$/', $w) ? $w . 'px' : $w; $h = preg_match('/^[0-9]+$/', $h) ? $h . 'px' : $h; switch ($type) { case 'top': $gmap_width = $w == '' ? '' : $w; $gmap_height = $h == '' ? '300px' : $h; $gmap_disp = PLUGIN_GMAPFUN_TYPE1; break; case 'side': $gmap_height = $h == '' ? '450px' : $h; if (is_bootstrap_skin()) { $gmap_width = '100%'; $gmap_disp = PLUGIN_GMAPFUN_TYPE2_BOOTSTRAP; } else { $gmap_width = $w == '' ? '220px' : $w; $gmap_disp = PLUGIN_GMAPFUN_TYPE2; } break; default: $gmap_width = $w == '' ? '' : $w; $gmap_height = $h == '' ? '500px' : $h; $gmap_disp = PLUGIN_GMAPFUN_DEFAULT; } if ($addr != '') { $geoobj = plugin_gmapfun_getGeocoding($addr); if ($geoobj) { $lng = $geoobj['lng']; $lat = $geoobj['lat']; } } if (isset($datalist)) { $flist = plugin_gmapfun_makelist($datalist); } $addscript = ''; if ($s_gmapfun_cnt == 0) { list($icon_width, $icon_height) = getimagesize(PLUGIN_GMAPFUN_ICON_PATH . 'pin.png'); list($icon_sh_width, $icon_sh_height) = getimagesize(PLUGIN_GMAPFUN_ICON_PATH . 'pin_shadow.png'); $addscript = ' <script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script> <script src="js/infobox.js" type="text/javascript"></script> <script type="text/javascript"> <!-- $(function(){ // マップ処理 function gmap_initialize(){ var ibopts = { content: "", disableAutoPan: false, maxWidth: "200px", pixelOffset: new google.maps.Size(-100, 10), zIndex: null, boxStyle: { backgroundColor: "#333", opacity: 0.85, color:"#fff", borderRadius: "10px", MozBorderRadius: "10px", WebkitBorderRadius: "10px", position:"relative", width: "200px" }, closeBoxMargin: "5px 5px 2px 2px", closeBoxURL: "//www.google.com/intl/en_us/mapfiles/close.gif", infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: "floatPane", enableEventPropagation: false, }; var ib = new InfoBox(ibopts); // マップデータを読み込み表示 var firstData = []; if ($(".mapmk").length) { firstData = $(".mapmk:first").attr("longdesc").split(","); } else { firstData.push(""); firstData.push(' . $lat . '); firstData.push(' . $lng . '); } var latlng = new google.maps.LatLng(parseFloat(firstData[1]),parseFloat(firstData[2])); var gmap_opts = { backgroundColor:"#fff", noCler: true, zoom:' . $zoom . ', center:latlng, mapTypeId:google.maps.MapTypeId.ROADMAP }; var gmap = new google.maps.Map(document.getElementById("gmap"), gmap_opts); if ($(".mapmk").length) { gmap.setCenter(latlng); } var flgSize = new google.maps.Size(' . $icon_width . ', ' . $icon_height . '); var flgOrigin = new google.maps.Point(0, 0); var flgAnchor = new google.maps.Point(0, ' . $icon_height . '); var flgImage = "' . PLUGIN_GMAPFUN_ICON_PATH . 'pin.png"; var flgIcon = new google.maps.MarkerImage(flgImage, flgSize, flgOrigin, flgAnchor); var flgShadowSize = new google.maps.Size(' . $icon_sh_width . ', ' . $icon_sh_height . '); var flgShadowOrigin = new google.maps.Point(0, 0); var flgShadowAnchor = new google.maps.Point(0, ' . $icon_sh_height . '); var flgShadowImage = "' . PLUGIN_GMAPFUN_ICON_PATH . 'pin_shadow.png"; var flgShadowIcon = new google.maps.MarkerImage(flgShadowImage, flgShadowSize, flgShadowOrigin, flgShadowAnchor); var markeropts = { position:"", map: gmap, icon: flgIcon, shadow: flgShadowIcon }; $("div.mapmk").each(function(){ var pobj = $(this); var shopdata = ($(this).attr("longdesc")).split(","); var makertitle = $(this).attr("title"); var pos = new google.maps.LatLng(parseFloat(shopdata[1]), parseFloat(shopdata[2])); markeropts.position = pos; var marker = new google.maps.Marker(markeropts); google.maps.event.addListener(marker, "click", function(){ focus_listitem(pobj); show_infobox(gmap, pos, ib, shopdata[0], makertitle); }); marker.setMap(gmap); if (shopdata[0].length > 0){ $(this).css({color:"#336699"}); } }).hover(function(e){$(this).addClass("titlehover");}, function(e){$(this).removeClass("titlehover"); }).click(function(){ focus_listitem($(this)); var shopdata = ($(this).attr("longdesc")).split(","); var pos = new google.maps.LatLng(parseFloat(shopdata[1]),parseFloat(shopdata[2])); show_infobox(gmap, pos, ib, shopdata[0], $(this).attr("title")); show_marker_info($(this), shopdata[0]); gmap.setCenter(pos); return false; }).mouseover(function(){ var shopdata = ($(this).attr("longdesc")).split(","); var pos = new google.maps.LatLng(parseFloat(shopdata[1]),parseFloat(shopdata[2])); show_infobox(gmap, pos, ib, shopdata[0], $(this).attr("title")); focus_listitem($(this)); if ($(this).hasClass("gmap_mklist_fm")) { show_marker_info($(this), shopdata[0]); } gmap.setCenter(pos); }); if ($(".mapmk:first").length) { show_infobox(gmap, latlng, ib, firstData[0], $(".mapmk:first").attr("title")); } show_marker_info($(".mapmk:first"), firstData[0]); } function focus_listitem(obj) { if (obj.hasClass("gmap_mklist_fm")) { $("div.gmap_mklist_fm").css("background-image", "url(' . PLUGIN_GMAPFUN_ICON_PATH . 'listframebg.png)"); obj.css("background-image", "url(' . PLUGIN_GMAPFUN_ICON_PATH . 'listframebg_h.png)"); } } function show_infobox(gmap, pos, ib, url, str) { ib.close(); if (str.length > 0) { ib.setPosition(pos); ib.setContent(\'<p style="padding:0 1em;">\'+str+\'</p><div class="marker_info_balloon"></div>\'); ib.open(gmap); } } function show_marker_info(obj, url) { var fVisible = true; if (url.length == 0) { if ($("#marker_info").children("div.body").length) { $("#marker_info").children("div.body").children("div").html("").closest("#marker_info").fadeOut("fast"); } else { $("#marker_info").children("div").html(""); } $("#marker_info").find("input:hidden[name=pagename]").remove(); } else { if ($("#marker_info").hasClass("marker_info_insert")) { if (obj.parent().find("#marker_info:visible").length) { $("#marker_info").fadeOut("fast"); } else{ $("#marker_info").fadeIn(); obj.after($("#marker_info")); $("#marker_info").children("div.body").children("div").load(url,function(e){ $(window).unbind("load"); $(e).filter("script").each(function(){ document.getElementsByTagName("head")[0].appendChild(this); }); $(window).load(); }); } } else { $("#marker_info").children("div").load(url); } var tmpurl = url.split("?"); var page = tmpurl[1].match(/.*page=(.*)/)[1]; $("#marker_info input:hidden[name=pagename]").remove(); $("#marker_info").append("<input type=\\"hidden\\" name=\\"pagename\\" value=\\""+page+"\\" />"); } } google.maps.event.addDomListener(window,"load",gmap_initialize); if ($("div.gmap_box_right").length){ var padding = parseInt($("div.gmap_box_right").css("padding-left").split("px")[0]) + parseInt($("div.gmap_box_right").css("padding-right").split("px")[0]); var w = $("#body").width() - ($("div.gmap_box_right").width() + padding); $("div.gmap_info_left").width(w); } }); // --> </script> <style type="text/css"> div.gmap_box,div.gmap_box_right{ background:transparent; padding-left:15px; } div.gmap_box_right{ background:transparent url(' . PLUGIN_GMAPFUN_ICON_PATH . 'vline.png) no-repeat 0 0; float:right; } div#gmap{ width:' . $gmap_width . '; height:' . $gmap_height . '; background:transparent url(image/loading.gif) 50% 50% no-repeat; } div.gmap_info, div.gmap_info_left{ width:100%; margin:0; overflow:hidden; } div.gmap_info_left{ width:290px; float:left; } #marker_info{ position:relative; } div.marker_list, div.marker_list_left{ background:transparent url(' . PLUGIN_GMAPFUN_ICON_PATH . 'hline.png) repeat-x 0 100%; padding-top:10px; padding-bottom:10px; } div.marker_list_left{ background:transparent url(' . PLUGIN_GMAPFUN_ICON_PATH . 'hline.png) repeat-x 0 0; } div.marker_info_left{ height:290px; overflow:auto; margin-bottom:10px; } div.marker_info_insert{ margin-bottom:10px; } div.marker_info_balloon { background:transparent url(' . PLUGIN_GMAPFUN_ICON_PATH . 'sankaku.png) no-repeat; width:10px; height:10px; top:-10px; left:' . (95 + $icon_width / 2) . 'px; position:absolute; } div.gmap_mklist_dump { cursor:pointer; } div.mapmk{ color:#333; margin:10px 0 0 0; font-weight:bold; background:url(' . PLUGIN_GMAPFUN_ICON_PATH . 'pin.png) no-repeat 0 0; padding-left:' . ($icon_width + 5) . 'px; line-height:' . $icon_height . 'px; cursor:pointer; } div.gmap_mklist_fm { width:94px; height:114px; float:left; background:transparent url(' . PLUGIN_GMAPFUN_ICON_PATH . 'listframebg.png) no-repeat; position:relative; cursor:pointer; padding-left:0; } div.gmap_mklist_fm img{ top:7px; left:7px; position:absolute; cursor:pointer; } div.pola_title{ bottom:5px; left:7px; position:absolute; width:80px; height:1.5em; line-height:1.5em; font-size:10px; overflow:hidden; } div.bubble { margin:0 0 0 30px; border-left: 7px solid #6699CC; border-top: 7px solid transparent; -border-top-color: white; opacity:0.9; } div.bubble div.body { margin: 0 0 0 -30px; border-radius: 10px; border: 3px solid #6699CC; background: white; } div.bubble div.body div { margin:5px; overflow:auto; height:200px; } div.titlehover{ color:#0066CC; } [data-style="bootstrap"] .gmapfun-marker-info { background: transparent url(image/gmap/vline.png) no-repeat 100% 0; } @media (max-width: 768px) { [data-style="bootstrap"] #gmap { height: 250px; } [data-style="bootstrap"] #marker_info { padding: 15px 0; height: 150px; } [data-style="bootstrap"] .gmapfun-marker-info { background: none; } } </style> '; } $s_gmapfun_cnt++; $list_str = ''; foreach ($flist as $f) { if ($f != '') { if (trim($f['address']) != '') { $geoobj = plugin_gmapfun_getGeocoding(trim($f['address'])); if ($geoobj) { $f['lng'] = $geoobj['lng']; $f['lat'] = $geoobj['lat']; } } $f['lat'] = $f['lat'] == '' ? '35.658613' : $f['lat']; $f['lng'] = $f['lng'] == '' ? '139.745525' : $f['lng']; if ($type == 'default') { $list_str .= '<div class="gmap_mklist_dump">'; $list_str .= '<div class="mapmk" longdesc="' . $f['link'] . ',' . $f['lat'] . ',' . $f['lng'] . '" title="' . $f['title'] . '">' . $f['title'] . '</div> </div>'; } else { $list_str .= '<div class="gmap_mklist_fm mapmk" longdesc="' . $f['link'] . ',' . $f['lat'] . ',' . $f['lng'] . '" title="' . $f['title'] . '">'; if ($f['img'] != '') { $size = ""; $position = ""; list($width, $height) = getimagesize($f['img']); $sz = PLUGIN_GMAPFUN_MARK_IMAGE_SIZE; if ($width > $height) { $size = ' width="' . PLUGIN_GMAPFUN_MARK_IMAGE_SIZE . '"'; if (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE > $width) { $size = ' width="' . $width . '"'; } $position = 'top:' . (7 + (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE - $height * (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE / $width)) / 2) . 'px;'; } else { $size = ' height="' . PLUGIN_GMAPFUN_MARK_IMAGE_SIZE . '"'; if (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE > $height) { $size = ' height="' . $height . '"'; } $position = 'left:' . (7 + (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE - $width * (PLUGIN_GMAPFUN_MARK_IMAGE_SIZE / $height)) / 2) . 'px;'; } $list_str .= '<img src="' . $f['img'] . '" class="mapmk" ' . $size . ' style="' . $position . '" />'; } $list_str .= '<div class="pola_title">' . $f['title'] . '</div></div>'; } } } $list_str .= '<div style="clear:both;"></div>'; $body = str_replace('<%markerlist%>', $list_str, $gmap_disp); if (check_editable($vars['page'], false, false)) { $addscript .= ' <style type="text/css"> .gmap_edit_page { border-radius:7px; -ms-filter: "alpha( opacity=60 )";/* IE8 */ filter: alpha( opacity=60 );/* IE6-7 */ opacity: 0.6; background-color: #333; position: absolute; bottom:5px; left:0px; width:90%; padding:10px; text-align:center; color:#fff; cursor:pointer; } </style> <script type="text/javascript"> <!-- $(function(){ $("div#marker_info").click(function(){ var url = page_exists($(this)); if (url) { location.href = url; } return false; }) .hover( function(){ var url = page_exists($(this)); if (url) { $(this).append("<div class=\\"gmap_edit_page\\">クリックするとこのページの編集ができます</div>"); } }, function(){ $(this).children("div.gmap_edit_page").remove(); } ); function page_exists(obj) { var pageobj = obj.find("input:hidden[name=pagename]"); if (pageobj.length) { var tmpurl = location.href.split("?"); return tmpurl[0]+"?cmd=edit&page="+pageobj.val(); } return false; } }); // --> </script> '; } $qt->appendv_once('plugin_gmapfun' + $s_gmapfun_cnt, 'beforescript', $addscript); return $body; }
function plugin_article_convert() { global $script, $vars, $digest; static $numbers = array(); $qm = get_qm(); $s_msg = $s_subject = $s_name = ""; if (PKWK_READONLY) { return ''; } // Show nothing if (!isset($numbers[$vars['page']])) { $numbers[$vars['page']] = 0; } $article_no = $numbers[$vars['page']]++; $authcode = '' . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9); $auth_label = '認証コード'; $auth_error_style = ''; $auth_error_class = ''; $auth_error_alert = ''; if (isset($vars['article_error'])) { $auth_error_alert = '<div class="alert alert-danger">認証コードを入力してください</div>'; $auth_error_style = 'color:red'; $auth_error_class = 'has-error'; $auth_label = '認証コードを入力してください'; $s_name = htmlspecialchars($vars['name']); $s_msg = htmlspecialchars($vars['msg']); $s_subject = htmlspecialchars($vars['subject']); } $s_page = htmlspecialchars($vars['page']); $s_digest = htmlspecialchars($digest); $name_cols = PLUGIN_ARTICLE_NAME_COLS; $subject_cols = PLUGIN_ARTICLE_SUBJECT_COLS; $article_rows = PLUGIN_ARTICLE_ROWS; $article_cols = PLUGIN_ARTICLE_COLS; $article_form = ''; if (is_bootstrap_skin()) { $article_form = <<<EOD <div class="form-horizontal"> {$auth_error_alert} <div class="form-group"> <div class="col-sm-6"> <div class="form-inline"> <div class="col-sm-12"> <div class="form-group"> <label class="control-label" for="_p_article_name_{$article_no}">お名前:</label> <input type="text" name="name" class="form-control input-sm" id="_p_article_name_{$article_no}" size="" value="{$s_name}" /> </div> </div> </div> </div> <div class="col-sm-6"> <div class="form-inline"> <div class="col-sm-12"> <div class="form-group"> <label id="article_auth_msg_no_{$article_no}" class="control-label">認証コード({$authcode}):</label> <input type="text" name="authcode" class="form-control input-sm" value="" size="4" /> </div> </div> </div> </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="text" name="subject" class="form-control" id="_p_article_subject_{$article_no}" size="{$subject_cols}" value="{$s_subject}" placeholder="タイトル" /> </div> </div> <div class="form-group"> <div class="col-sm-12"> <textarea name="msg" rows="{$article_rows}" cols="{$article_cols}" class="form-control">{$s_msg}</textarea> </div> </div> <div class="form-group"> <div class="col-md-12"> <input type="submit" name="article" class="btn btn-default" value="記事の投稿" /> </div> </div> </div> EOD; } else { $article_form = <<<EOD <span id="article_auth_msg_no_{$article_no}" style="font-size:11px;{$auth_error_style}"> {$auth_label}({$authcode}<input type="text" name="authcode" value="" size="4" /> </span> <label for="_p_article_name_{$article_no}">お名前</label> <input type="text" name="name" id="_p_article_name_{$article_no}" size="{$name_cols}" value="{$s_name}" /><br /> <label for="_p_article_subject_{$article_no}">題名:</label> <input type="text" name="subject" id="_p_article_subject_{$article_no}" size="{$subject_cols}" value="{$s_subject}" /><br /> <textarea name="msg" rows="{$article_rows}" cols="{$article_cols}">{$s_msg} </textarea><br /> <input type="submit" name="article" value="記事の投稿" /> EOD; } $string = <<<EOD <form action="{$script}" method="post"> <div> <input type="hidden" name="article_no" value="{$article_no}" /> <input type="hidden" name="plugin" value="article" /> <input type="hidden" name="digest" value="{$s_digest}" /> <input type="hidden" name="authcode_master" value="{$authcode}" /> <input type="hidden" name="refer" value="{$s_page}" /> {$article_form} </div> </form> EOD; return $string; }
function plugin_show_body($args) { global $script, $vars; global $WikiName, $BracketName; // compat $qm = get_qm(); $qt = get_qt(); $qt->setv('jquery_include', true); // 戻り値 $params = array('left' => FALSE, 'center' => FALSE, 'right' => FALSE, 'aroundl' => FALSE, 'aroundc' => FALSE, 'aroundr' => FALSE, 'wrap' => FALSE, 'nowrap' => FALSE, 'around' => FALSE, 'noicon' => FALSE, 'nolink' => TRUE, 'greybox' => FALSE, 'lightbox2' => FALSE, 'colorbox' => FALSE, 'normal' => FALSE, 'linkurl' => FALSE, 'label' => FALSE, 'crop' => TRUE, 'nocrop' => FALSE, 'noimg' => FALSE, 'zoom' => FALSE, 'change' => FALSE, '_size' => FALSE, '_w' => 0, '_h' => 0, '_%' => 0, '_ratio' => FALSE, '_args' => array(), '_done' => FALSE, '_error' => '', '_block' => FALSE); $is_bootstrap_skin = is_bootstrap_skin(); $bs_image_deco = array('circle' => FALSE, 'rounded' => FALSE, 'round' => FALSE, 'thumbnail' => FALSE, 'pola' => FALSE, 'polaroid ' => FALSE); if ($is_bootstrap_skin) { foreach ($bs_image_deco as $key => $val) { $params[$key] = $val; } } // 添付ファイルのあるページ: defaultは現在のページ名 $page = isset($vars['page']) ? $vars['page'] : ''; // 添付ファイルのファイル名 $name = ''; // 添付ファイルまでのパスおよび(実際の)ファイル名 $file = ''; // 第一引数: "画像ファイル名"、あるいは"画像ファイルパス"、あるいは"画像ファイルURL"を指定 $name = array_shift($args); $is_url = is_url($name, false, true); //画像ファイルかどうか if (!preg_match(PLUGIN_SHOW_IMAGE, $name)) { $params['_error'] = $qm->replace('plg_show.err_noimg', h($name)); } if (!$is_url) { $file = $name; if (!is_file($file)) { $file = SWFU_IMAGE_DIR . $file; if (!is_file($file)) { $params['_error'] = $qm->replace('plg_show.err_notfound', h($name)); return $params; } } } // 残りの引数の処理 if (!empty($args)) { foreach ($args as $arg) { plugin_show_check_arg($arg, $params); } } if (is_page($params['linkurl'])) { $params['linkurl'] = $script . '?' . rawurlencode($params['linkurl']); } /* $nameをもとに以下の変数を設定 $url,$url2 : URL $title :タイトル $info : 画像ファイルのときgetimagesize()の'size' 画像ファイル以外のファイルの情報 添付ファイルのとき : ファイルの最終更新日とサイズ URLのとき : URLそのもの */ $title = $url = $url2 = $info = $style = ''; $width = $height = 0; $matches = array(); if ($is_url) { // URL if (PKWK_DISABLE_INLINE_IMAGE_FROM_URI) { $url = h($name); $params['_body'] = '<a href="' . $url . '">' . $url . '</a>'; return $params; } $url = $url2 = h($name); $title = h(preg_match('/\\/(.+?)$/', $name, $matches) ? $matches[1] : $url); if (PLUGIN_SHOW_URL_GET_IMAGE_SIZE && (bool) ini_get('allow_url_fopen')) { $size = @getimagesize($name); if (is_array($size)) { $width = $size[0]; $height = $size[1]; $info = $size[3]; } } } else { // 添付ファイル $title = h($name); /* // Count downloads with attach plugin $url = $script . '?plugin=attach' . '&refer=' . rawurlencode($page) . '&openfile=' . rawurlencode($name); // Show its filename at the last */ $file = substr($file, 0, 2) == './' ? substr($file, 2) : $file; $url = $url2 = $file; $width = $height = 0; $size = @getimagesize($file); if (is_array($size)) { $width = $size[0]; $height = $size[1]; } } //first Image をセット $qt->set_first_image($is_url ? $url : dirname($script) . '/' . $url); // 拡張パラメータをチェック if (!empty($params['_args'])) { $_title = array(); foreach ($params['_args'] as $arg) { if (preg_match('/^([0-9]+)x([0-9]+)$/', $arg, $matches)) { $params['_size'] = TRUE; $params['_w'] = $matches[1]; $params['_h'] = $matches[2]; } else { if (preg_match('/^([0-9.]+)%$/', $arg, $matches) && $matches[1] > 0) { $params['_%'] = $matches[1]; } else { $_title[] = $arg; } } } if (!empty($_title)) { $title = h(join(',', $_title)); $title = make_line_rules($title); } } // 画像サイズ調整 // 指定されたサイズを使用する if ($params['_size']) { if ($width == 0 && $height == 0) { $width = $params['_w']; $height = $params['_h']; } else { if ($params['zoom']) { $_w = $params['_w'] ? $width / $params['_w'] : 0; $_h = $params['_h'] ? $height / $params['_h'] : 0; $zoom = max($_w, $_h); if ($zoom) { $width = (int) ($width / $zoom); $height = (int) ($height / $zoom); } } else { $width = $params['_w'] ? $params['_w'] : $width; $height = $params['_h'] ? $params['_h'] : $height; } } // 指定したサイズに合わせて切り取るかどうか if ($params['nocrop']) { $params['crop'] = FALSE; } if ($params['crop']) { $params['class'] .= ' qhm-show-crop'; plugin_show_set_crop_style(); } } if ($params['_%']) { $width = (int) ($width * $params['_%'] / 100); $height = (int) ($height * $params['_%'] / 100); } if ($params['_size'] or $params['_%']) { if ($width && $height) { $info = "width=\"{$width}\" height=\"{$height}\" "; // 表示領域が画像の幅よりも小さい場合 // 縦横日が崩れるので修正する JavaScript を出力する $params['class'] .= ' qhm-plugin-show-keep-ratio'; $params['class'] .= $params['_size'] ? ' qhm-plugin-show-size-given' : ''; plugin_show_set_keep_ratio(); } } if ($is_bootstrap_skin) { $params['class'] .= $params['_block'] ? ' img-responsive' : ''; } else { $style = 'style="max-width:100%;" '; } // アラインメント判定 $params['_align'] = PLUGIN_SHOW_DEFAULT_ALIGN; foreach (array('right', 'left', 'center', 'aroundr', 'aroundc', 'aroundl') as $align) { //aroundx if (strpos($align, 'around') === 0 && $params[$align]) { $params['around'] = TRUE; $align = substr($align, -1, 1); switch ($align) { case 'r': $align = 'right'; break; case 'c': $align = 'center'; break; default: $align = 'left'; } $params['_align'] = $align; break; } else { if ($params[$align]) { $params['_align'] = $align; break; } } } $mouseover = ''; if ($params['change']) { $a_path = explode('.', $url); $a_path[count($a_path) - 2] .= '_onmouse'; $mo_url = join('.', $a_path); $mouseover = " onmouseover=\"this.src='{$mo_url}'\" onmouseout=\"this.src='{$url}'\" "; $mouseover .= 'onload="qhm_preload(\'' . $mo_url . '\');"'; //preload $addscript = ' <script type="text/javascript"> var qhm_preloaded = {}; function qhm_preload(src) { if (typeof document.images != "undefined" && typeof qhm_preloaded[src] == "undefined") { var img = new Image(); img.src = src; qhm_preloaded[src] = 1; } } </script> '; $qt->appendv_once('plugin_show_preload', 'beforescript', $addscript); } $aclass = $arel = ''; $url2 = $params['linkurl'] ? $params['linkurl'] : $url2; //異なるURLが2つある場合、nolink をFALSEに if ($url2 != $url) { $params['nolink'] = FALSE; } //表示設定 if ($params['greybox']) { $addscript = ' <script type="text/javascript"> var GB_ROOT_DIR = "./plugin/greybox/"; </script> <script type="text/javascript" src="./plugin/greybox/AJS.js"></script> <script type="text/javascript" src="./plugin/greybox/AJS_fx.js"></script> <script type="text/javascript" src="./plugin/greybox/gb_scripts.js"></script> <link href="./plugin/greybox/gb_styles.css" rel="stylesheet" type="text/css" /> '; $qt->appendv_once('plugin_greybox', 'beforescript', $addscript); //文字列の場合:グループ if ($params['greybox'] !== TRUE) { $gb_type = $url == $url2 ? 'imageset' : 'pageset'; $gb_grp = $params['greybox']; $arel = ' rel="gb_' . $gb_type . '[' . $gb_grp . ']"'; } else { $gb_type = $url == $url2 ? 'image' : 'page_fs'; $arel = ' rel="gb_' . $gb_type . '[]"'; } $params['nolink'] = FALSE; } else { if ($params['lightbox2']) { require_once PLUGIN_DIR . '/lightbox2.inc.php'; $addscript = ' <script type="text/javascript" src="js/jquery.dimensions.min.js"></script> <script type="text/javascript" src="js/jquery.dropshadow.js"></script> <script type="text/javascript" src="' . LIGHTBOX2_LIB . '/js/jquery.lightbox.js"></script> <link href="' . LIGHTBOX2_LIB . '/css/lightbox.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(document).ready(function(){ $(".lightbox").lightbox(); }); </script> '; $qt->appendv_once('plugin_lightbox2', 'beforescript', $addscript); $aclass = ' class="lightbox"'; if ($params['lightbox2'] !== TRUE) { $arel = ' rel="' . $params['lightbox2'] . '"'; } //$url2 が画像ファイルでない場合、無効にする|エラーを出す if (!preg_match(PLUGIN_SHOW_IMAGE, $url2)) { $url2 = $url; // $params['_error'] = 'lightbox2 cannot show except images'; } $params['nolink'] = FALSE; } else { if ($params['colorbox']) { $addscript = ' <script type="text/javascript" src="./plugin/colorbox/jquery.colorbox-min.js"></script> <link href="./plugin/colorbox/colorbox.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $(function(){ var options = { opacity:0.5, current: "{current}/{total}", maxWidth: "100%", maxHeight: "90%" }; var slideshowOptions = $.extend({}, options, { opacity: 0.8, slideshow: true }); $("a.colorbox").colorbox(options); $("a.colorbox_slideshow").colorbox(slideshowOptions); }); </script> '; $qt->appendv_once('plugin_show_colorbox', 'beforescript', $addscript); //文字列の場合:グループ //グループ名がslideshow で始まる場合、スライドショー if (substr($params['colorbox'], 0, 9) === 'slideshow') { $aclass = ' class="colorbox_slideshow"'; $gb_grp = $params['colorbox']; $arel = ' rel="cb_' . $gb_grp . '"'; } else { if ($params['colorbox'] !== TRUE) { $gb_type = $url == $url2 ? 'imageset' : 'pageset'; $gb_grp = $params['colorbox']; $arel = ' rel="cb_' . $gb_grp . '"'; $aclass = ' class="colorbox"'; } else { $aclass = ' class="colorbox"'; // } } $params['nolink'] = FALSE; } else { if ($params['normal']) { $params['nolink'] = FALSE; } } } } if ($is_bootstrap_skin) { $img_thumbnail = false; $img_rounded = false; $img_circle = false; foreach (array_keys($bs_image_deco) as $deco) { if (isset($params[$deco]) && $params[$deco] !== FALSE) { switch ($deco) { case 'pola': case 'polaroid': case 'thumbnail': if (!$img_thumbnail) { $params['class'] .= ' img-thumbnail'; $img_thumbnail = true; } break; case 'round': case 'rounded': if (!$img_rounded) { $params['class'] .= ' img-rounded'; $img_rounded = true; } break; case 'circle': if (!$img_circle) { $params['class'] .= ' img-circle'; $img_circle = true; } break; } } } } //指定されたクラスを追加する $imgclass = ' class="' . h($params['class']) . '"'; if ($params['label'] !== FALSE && $params['label'] != '') { //画像を指定した場合、画像を表示する if (preg_match('/\\.(jpe?g|gif|png)$/', $params['label'])) { $url = plugin_show_get_filepath($params['label']); $size = plugin_show_get_imagesize($params['label']); //高さと幅を指定している場合はそちらを利用する if ($params['_w'] === 0 && $params['_h'] === 0 && $size !== FALSE) { $info = ''; if (is_array($size)) { $width = $size[0]; $height = $size[1]; if ($params['_%'] !== 0) { $width = floor($width * $params['_%'] / 100); $height = floor($height * $params['_%'] / 100); } $info = "width=\"{$width}\" height=\"{$height}\""; } $params['_body'] = "<img src=\"{$url}\" alt=\"{$title}\" title=\"{$title}\" {$info} {$mouseover} {$style}{$imgclass}{$ratio_attr}>"; } $params['_body'] = "<img src=\"{$url}\" alt=\"{$title}\" title=\"{$title}\" {$info} {$mouseover} {$style}{$imgclass}{$ratio_attr}>"; } else { $params['_body'] = h($params['label']); } } else { $params['_body'] = "<img src=\"{$url}\" alt=\"{$title}\" title=\"{$title}\" {$info} {$mouseover} {$style}{$imgclass}{$ratio_attr}>"; } if (!$params['nolink'] && $url2) { $params['_body'] = "<a href=\"{$url2}\" title=\"{$title}\"{$aclass}{$arel}>{$params['_body']}</a>"; } return $params; }
function plugin_qblog_list_convert() { global $vars, $qblog_date_format, $show_passage; global $qblog_page_prefix, $qblog_defaultpage, $qblog_page_format, $qblog_close; global $style_name; //閉鎖中は何も表示しない if ($qblog_close && !ss_admin_check()) { return ''; } static $exec_count = 1; $qm = get_qm(); $qt = get_qt(); $qt->setv('jquery_include', TRUE); $list_type = PLUGIN_QBLOG_LIST_TYPE; $recent_posts = PLUGIN_QBLOG_LIST_DEFAULT_POSTS; if (func_num_args()) { $args = func_get_args(); if (count($args) > 2) { return '#qblog_list([line or table], [number])'; } foreach ($args as $arg) { if (is_numeric($arg)) { $recent_posts = (int) $arg; } if ($arg == 'line') { $list_type = $arg; } } } //表示モード //recent, archives, category $mode = isset($vars['mode']) ? $vars['mode'] : 'recent'; //表示ページ:ページネーション //表示ページは必ず 1以上の整数 $page_num = isset($vars['p']) ? (int) $vars['p'] : 1; $page_num = $page_num <= 0 ? 1 : $page_num; // !前処理 if (!is_bootstrap_skin()) { $include_bs = ' <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> <script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>'; $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs); } //qblog.css を読み込む $head = ' <link rel="stylesheet" href="plugin/qblog/qblog.css" />'; $qt->appendv_once('qblog_beforescript', 'beforescript', $head); //---- キャッシュのための処理を登録 ----- $qt->enable_cache = FALSE; //------------------------------------ if (!file_exists(PLUGIN_QBLOG_LIST_CACHE)) { return $qm->m['plg_recent']['err_file_notfound'] . '<br />'; } $script = get_script_uri(); $date = $items = ''; //h2.title 前に挿入するHTML $pre_title_html = ''; // !新規記事追加リンクを表示 // デフォルトブログページが編集できるユーザー $editable = FALSE; if (check_editable($qblog_defaultpage, FALSE, FALSE) === TRUE) { $editable = TRUE; $search_replace = array('YYYY' => date('Y'), 'MM' => date('m'), 'DD' => date('d')); $newpage = str_replace(array_keys($search_replace), array_values($search_replace), $qblog_page_format); $number_holder_pos = strpos($newpage, '#'); if ($number_holder_pos !== FALSE) { $filename_prefix = encode(substr($newpage, 0, $number_holder_pos)); $files = glob(DATA_DIR . $filename_prefix . '*'); $pattern = '/^(' . str_replace('#', '(\\d+)', preg_quote($newpage)) . ')$/'; $max = 1; foreach ($files as $file) { $pagename = decode(basename($file, '.txt')); if (preg_match($pattern, $pagename, $mts)) { $max = max($mts[2], $max); } } $newpage = str_replace('#', $max + 1, $newpage); } $addpostlink = $script . '?cmd=qblog&mode=addpost'; $pre_title_html .= '<a href="' . h($addpostlink) . '" class="badge badge-info" style="color:#fff"><i class="icon-white icon-edit" style="vertical-align:text-bottom;"></i> 記事の追加</a> '; } // !モードによって、読み込むキャッシュを替える $pages = array(); $start = ($page_num - 1) * $recent_posts; $addquery = ''; switch ($mode) { case 'archives': $date = $vars['date']; $addquery = '&mode=archives&date=' . rawurlencode($date); if (preg_match('/^(\\d{4})(\\d{2})$/', $date, $mts)) { $year = $mts[1]; $month = $mts[2]; } else { $year = date('Y'); $month = date('m'); } $date = $year . $month; $files = glob(DATA_DIR . encode($qblog_page_prefix . $date) . '*'); foreach ($files as $file) { $pages[] = decode(basename($file, '.txt')); } $count_pages = count($pages); natsort($pages); $pages = array_reverse($pages); $pages = array_slice($pages, $start, $recent_posts); $subtitle = "{$year}年{$month}月"; $pre_title_html .= '<span class="badge">' . h($subtitle) . '</span> '; break; case 'category': $cat = isset($vars['catname']) ? $vars['catname'] : $qblog_default_cat; $addquery = '&mode=category&catname=' . rawurlencode($cat); $pages = explode("\n", trim(file_get_contents(CACHEQBLOG_DIR . encode($cat) . '.qbc.dat'))); $count_pages = count($pages); $pages = array_slice($pages, $start, $recent_posts); $pre_title_html .= '<span class="badge">カテゴリ:' . h($cat) . '</span> '; break; default: //recent mode // Get latest N changes $count_pages = (int) array_pop(file_head(PLUGIN_QBLOG_LIST_CACHE, 1)); $lines = file_slice(PLUGIN_QBLOG_LIST_CACHE, $start + 1, $recent_posts); foreach ($lines as $line) { $pages[] = rtrim($line); } } //! 記事毎のデータをまとめる $posts = array(); foreach ($pages as $i => $page) { //キャッシュファイルを読み込む $data = get_qblog_post_data($page); if ($data === FALSE) { continue; } $r_page = rawurlencode($page); if (is_file(SWFU_IMAGE_DIR . $data['image'])) { $data['image'] = SWFU_IMAGE_DIR . $data['image']; } if (trim($data['image']) === '') { $data['image'] = PLUGIN_DIR . 'qblog/qblog_thumbnail.png'; } if (trim($data['image']) === '') { $data['image'] = PLUGIN_DIR . 'qblog/qblog_thumbnail.png'; } $posts[$i] = array('page' => $page, 'title' => $data['title'], 'abstract' => $data['abstract'], 'image' => $data['image'], 'category' => $data['category'], 'url' => $script . '?' . $r_page . $addquery, 'date' => get_qblog_date($qblog_date_format, $page)); } // !ページネーションリンクを足す $paginates = array(); if ($count_pages > $recent_posts) { if ($page_num > 1) { $paginates[PLUGIN_QBLOG_LIST_PAGINATE_LAST_NAV] = $script . '?' . $qblog_defaultpage . '&p=1' . $addquery; } $paginate_length = ceil($count_pages / $recent_posts); if (PLUGIN_QBLOG_LIST_PAGINATE_NUM < $paginate_length) { } $range = (int) floor(PLUGIN_QBLOG_LIST_PAGINATE_NUM / 2); $start = (int) max(1, $page_num - $range); $end = (int) min($paginate_length + 1, $start + PLUGIN_QBLOG_LIST_PAGINATE_NUM); // 最初<<< 1 | 2 | 3 | 4 | 5 >>>最後 // 最初<<< 5 | 6 | 7 | 8 | 9 >>>最後 for ($i = $start; $i < $end; $i++) { $paginates[$i] = $script . '?' . $qblog_defaultpage . '&p=' . $i . $addquery; if ($page_num == $i) { $paginates[$i] = ''; } } if ($page_num < $paginate_length) { $paginates[PLUGIN_QBLOG_LIST_PAGINATE_FIRST_NAV] = $script . '?' . $qblog_defaultpage . '&p=' . $paginate_length . $addquery; } } $template_name = 'qblog_list_template.html'; if (file_exists(SKIN_DIR . $style_name . '/' . $template_name)) { $template_path = SKIN_DIR . $style_name . '/' . $template_name; } else { $template_path = PLUGIN_DIR . 'qblog/list_template.html'; } //! テンプレートを読み込む ob_start(); include $template_path; $items .= ob_get_clean(); //! h2.title にbadge を挿入 if ($list_type === 'table') { $qt->prependv('this_right_title', $pre_title_html); } return '<div id="qblog">' . $items . '</div>'; }
$site_header = "\n<!-- SITEHEADER CONTENTS START -->\n" . $site_header . "\n<!-- SITEHEADER CONTENTS END -->\n"; $qt->setv('SiteHeaderInsertMark', true); } $qt->setv('site_header', $site_header); unset($vars['page_alt']); } } //w3c tag $w3c_tagstr = <<<EOD <a href="http://validator.w3.org/check?uri=referer"><img src="image/valid-xhtml10.png" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /> EOD; $qt->setv('w3c_tag', $w3c_tagstr); // iPhone, iPod, android デザイン if ($enable_smart_style && is_smart_phone() && !is_bootstrap_skin()) { if (exist_plugin('use_smart')) { $qt->appendv('site_navigator2', do_plugin_convert('use_smart')); } if (plugin_use_smart_is_enable()) { $smart_css = ' <meta name="viewport" content="width=device-width,initial-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <link rel="stylesheet" href="' . SMART_DIR . $smart_name . '/smart.css" media="screen" text/css="text/css"> '; $smart_lastscript .= ' <script type="text/javascript" charset="utf-8"> if (typeof window.onload === "undefined") { window.onload = function(){ setTimeout(function(){window.scrollTo(0,1);},100); }; } else {
function plugin_qform_format($data_set, $style) { $astar = '<span class="' . (is_bootstrap_skin() ? 'text-danger' : 'qform-danger') . '">*</span>'; if ($style == 'default') { $str = '<table class="style_table" colspan="0" style="width:90%">'; foreach ($data_set as $d) { $astr = isset($d['valid']) && $d['valid'] ? $astar : ''; $str .= '<tr><th class="style_th">' . $d['label'] . $astr . '</th><td class="style_td">' . $d['content'] . '<br /><span style="font-size:small">' . $d['exp'] . '</span></td></tr>'; } $str .= '</table>'; } else { if ($style === 'horizontal') { $template_path = dirname(__FILE__) . '/qform/horizontal.html'; ob_start(); include $template_path; $str .= ob_get_clean(); } else { $template_path = dirname(__FILE__) . '/qform/vertical.html'; ob_start(); include $template_path; $str .= ob_get_clean(); } } return $str; }
/** * QBlog display post-head plugin * ------------------------------------------- * ./plugin/qblog_head.inc.php * * Copyright (c) 2012 hokuken * http://hokuken.com/ * * created : 12/07/30 * modified : * * Description * * Usage : * */ function plugin_qblog_head_convert() { global $vars, $script, $defaultpage; global $qblog_date_format, $qblog_page_re, $qblog_defaultpage, $qblog_close, $qblog_default_cat; if (!is_qblog()) { return ''; } $closed_msg = ''; if ($qblog_close) { if (ss_admin_check()) { $closed_msg = ' <div class="alert" style="margin-top: 15px ;margin-bottom: 15px ;"> <button class="close" data-dismiss="alert">×</button> <p> ブログは閉鎖されています。<br /> 管理者以外のアクセスはトップページへ転送されます。 </p> <p> ※ブログメニュー上のリストも管理者以外には表示されません。 </p> </div> '; } else { redirect($defaultpage); } } $qt = get_qt(); //RSSフィードを出力 if (exist_plugin('rss')) { $rssurl = $script . '?cmd=rss&qblog_rss=1'; $qt->setv_once('rss_link', $rssurl); } if (!is_bootstrap_skin()) { $include_bs = ' <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> <script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>'; $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs); } //qblog.css を読み込む $head = ' <link rel="stylesheet" href="plugin/qblog/qblog.css' . '" />'; $qt->appendv_once('qblog_beforescript', 'beforescript', $head); $page = $vars['page']; // ブログトップは<head>内の調整のみ if ($page === $qblog_defaultpage) { return $closed_msg; } //日付を取得 $date = get_qblog_date($qblog_date_format, $page); $data = get_qblog_post_data($page); if ($vars['cmd'] == 'edit') { //新規ページ if (!$data) { $data['title'] = $page; $data['category'] = $qblog_default_cat; } $data['title'] = isset($vars['title']) && $vars['title'] ? $vars['title'] : $data['title']; $data['category'] = isset($vars['category']) && $vars['category'] ? $vars['category'] : $data['category']; if (isset($vars['qblog_date'])) { $date = $vars['qblog_date']; list($y, $m, $d) = array_pad(explode('-', $vars['qblog_date']), 3, ''); if (checkdate($m, $d, $y)) { $time = mktime(0, 0, 0, $m, $d, $y); $date = date($qblog_date_format, $time); } } } $category_url = $script . '?' . $qblog_defaultpage . '&mode=category&catname=' . rawurlencode($data['category']); $addpostlink_html = ''; if (ss_admin_check()) { $editpostlink = $script . '?cmd=edit&page=' . $page; $addpostlink = $script . '?cmd=qblog&mode=addpost'; $addpostlink_html = ' <a href="' . h($editpostlink) . '" class="badge badge-important" style="color:#fff"><i class="icon-white icon-edit" style="vertical-align:text-bottom"></i> この記事を編集</a> <a href="' . h($addpostlink) . '" class="badge badge-info" style="color:#fff"><i class="icon-white icon-plus" style="vertical-align:text-bottom"></i> 記事の追加</a> '; } $head = ' <style type="text/css"> #content h2.title{display:none;} </style> ' . $closed_msg . ' <div class="title"> <span class="qblog_post_date">' . h($date) . '</span> ' . $addpostlink_html . ' <a href="' . h($category_url) . '" class="qblog_category badge">カテゴリ:' . h($data['category']) . '</a> </div> <h2>' . h($data['title']) . '</h2> '; if (trim($data['image']) !== '') { if (is_file(SWFU_IMAGE_DIR . $data['image'])) { $data['image'] = SWFU_IMAGE_DIR . $data['image']; } $head .= <<<EOH EOH; } return $head; }
function plugin_edit_action() { global $vars, $load_template_func, $style_name, $layout_pages; global $qblog_defaultpage; $qm = get_qm(); $qt = get_qt(); if (PKWK_READONLY) { die_message($qm->m['fmt_err_pkwk_readonly']); } $page = isset($vars['page']) ? $vars['page'] : ''; $prefix = ''; //メニューやナビの編集はスタイルを変える if (array_key_exists($page, $layout_pages) && !isset($vars['preview'])) { $prefix = '<h2 class="title">' . h($layout_pages[$page]) . 'の編集</h2>'; if (is_bootstrap_skin()) { if (exist_plugin("noeyecatch")) { do_plugin_convert("noeyecatch"); } } else { $style_name = '../'; $addscript = <<<EOD <script type="text/javascript"> \$(function(){ if (window != parent) { \t\t\$("input:submit").click(function(e){ \t\t\twindow.onbeforeunload = null; \t\t\tvar name = \$(this).attr("name"); \t\t\t\$(this).before('<input type="hidden" name="'+name+'" value="'+\$(this).val()+'">').prop("disabled", true); \t\t\tvar \$form = \$(this).closest("form"); \t\t\tvar \$parent = \$(window.parent.document).find("body"); \t \t\t\tvar params = \$form.serialize().split('&'); \t\t\tvar \$fm = \$('<form></form>'); \t\t\tfor (var i = 0; i < params.length; i++) \t\t\t{ \t\t\t\tvar param = params[i].split('='); \t\t\t\t\$fm.append(\$('<input type="hidden" name="'+param[0]+'" value="" />').val(decodeURIComponent(param[1].replace(/\\+/g, ' ')))); \t\t\t} \t\t\t\$fm.attr('action', \$form.attr('action')); \t\t\t\$fm.attr('method', \$form.attr('method')); \t\t\t\$parent.append(\$fm).find("form:last").submit(); \t\t\treturn false; \t\t}); \t} }); </script> EOD; $qt->appendv('beforescript', $addscript); } } check_editable($page, true, true); if (isset($vars['preview']) || $load_template_func && isset($vars['template'])) { return plugin_edit_preview(); } else { if (isset($vars['write'])) { return plugin_edit_write(); } else { if (isset($vars['cancel'])) { return plugin_edit_cancel(); } } } $postdata = @join('', get_source($page)); if ($postdata == '') { $postdata = auto_template($page); } return array('msg' => $qm->m['fmt_title_edit'], 'body' => $prefix . edit_form($page, $postdata)); }
function edit_form($page, $postdata, $digest = FALSE, $b_template = TRUE) { global $script, $vars, $rows, $cols, $hr, $function_freeze; global $_btn_preview, $_btn_repreview, $_btn_update, $_btn_cancel, $_msg_help; global $whatsnew, $_btn_template, $_btn_load, $load_template_func; global $notimeupdate; global $qhm_access_key; global $qblog_defaultpage, $style_name, $date_format, $qblog_default_cat; $qt = get_qt(); //accesskey setting $accesskey = array(); foreach (array('r', 'p', 's', 'c') as $v) { $accesskey[$v] = $qhm_access_key ? 'accesskey="' . $v . '"' : ''; } // Newly generate $digest or not if ($digest === FALSE) { $digest = md5(join('', get_source($page))); } $refer = $template = $headertitle = ''; // Add plugin $addtag = $add_top = ''; if (isset($vars['add'])) { global $_btn_addtop; $addtag = '<input type="hidden" name="add" value="true" />'; $add_top = isset($vars['add_top']) ? ' checked="checked"' : ''; $add_top = '<input type="checkbox" name="add_top" ' . 'id="_edit_form_add_top" value="true"' . $add_top . ' />' . "\n" . ' <label for="_edit_form_add_top" class="checkbox">' . '<span class="small">' . $_btn_addtop . '</span>' . '</label>'; } if ($load_template_func && $b_template) { $pages = array(); foreach (get_existpages() as $_page) { if ($_page == $whatsnew || check_non_list($_page)) { continue; } $s_page = htmlspecialchars($_page); $pages[$_page] = ' <option value="' . $s_page . '">' . $s_page . '</option>'; } ksort($pages); $s_pages = join("\n", $pages); $template = <<<EOD <select name="template_page"> <option value="">-- {$_btn_template} --</option> {$s_pages} </select> <input type="submit" name="template" value="{$_btn_load}" {$accesskey['r']} /> <br /> EOD; } //新規作成の場合、ページ名を大見出しとして挿入する if (isset($vars['refer']) && $vars['refer'] != '') { $headertitle = "\n\n" . '* ' . strip_bracket($page) . "\n\n"; } $r_page = rawurlencode($page); $s_page = htmlspecialchars($page); $s_digest = htmlspecialchars($digest); $s_postdata = htmlspecialchars($refer . $headertitle . $postdata); $s_original = isset($vars['original']) ? htmlspecialchars($vars['original']) : $s_postdata; $b_preview = isset($vars['preview']); // TRUE when preview $btn_preview = $b_preview ? $_btn_repreview : $_btn_preview; // Checkbox 'do not change timestamp' $add_notimestamp = ''; if ($notimeupdate != 0) { global $_btn_notchangetimestamp; $checked_time = isset($vars['notimestamp']) ? ' checked="checked"' : ''; // Only for administrator if ($notimeupdate == 2) { $add_notimestamp = ' ' . '<input type="password" name="pass" size="12" />' . "\n"; } $add_notimestamp = '<label for="_edit_form_notimestamp" class="checkbox"><input type="checkbox" name="notimestamp" ' . 'id="_edit_form_notimestamp" value="true"' . $checked_time . ' tabindex="9" />' . "\n" . ' ' . '<span class="small">' . $_btn_notchangetimestamp . '</span></label>' . "\n" . $add_notimestamp . ' '; } $buttons_align = 'left'; $blog_cancel_button = 'right'; if (is_bootstrap_skin()) { $buttons_align = 'right'; $blog_cancel_button = 'left'; } else { //Bootstrap の読み込み $include_bs = ' <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> <script type="text/javascript" src="skin/bootstrap/js/bootstrap.min.js"></script>'; $qt->appendv_once('include_bootstrap_pub', 'beforescript', $include_bs); } // !ブログ用編集フォーム if ($page !== $qblog_defaultpage && is_qblog()) { //メタデータを取得 $data = get_qblog_post_data($page); $data['title'] = isset($vars['title']) ? $vars['title'] : $data['title']; $data['category'] = isset($vars['category']) ? $vars['category'] : $data['category']; $data['image'] = isset($vars['image']) ? $vars['image'] : $data['image']; $date = get_qblog_date($date_format, $page); if (isset($vars['qblog_date']) && $date !== trim($vars['qblog_date'])) { $dates = array_pad(explode('-', $vars['qblog_date'], 3), 3, 0); $valid = checkdate($dates[1], $dates[2], $dates[0]); $date = $valid ? trim($vars['qblog_date']) : $date; } $category = isset($data['category']) && strlen(trim($data['category'])) > 0 ? $data['category'] : ''; $qblog_categories = array_keys(get_qblog_categories()); $qblog_cat_json = json_encode($qblog_categories); $h_qblog_cat_json = h(json_encode($qblog_categories)); $qblog_cat_list = '<ul id="qblog_categories_selector" class="qblog_categories collapse">'; foreach ($qblog_categories as $cat) { $qblog_cat_list .= '<li>' . h($cat) . '</li>'; } $qblog_cat_list .= '</ul>'; $h2title = '新規投稿'; if (is_page($page)) { $h2title = $data['title'] . 'の編集'; } $s_h2title = h($h2title); $s_blog_title = h($data['title']); $body = <<<EOD <link rel="stylesheet" href="js/datepicker/css/datepicker.css" /> <link rel="stylesheet" href="plugin/qblog/qblog.css" /> <script src="js/datepicker/js/bootstrap-datepicker.js"></script> <script tyle="text/javascript"> \$(function(){ \t\$('#qblog_datepicker').datepicker({ \t\tlanguage: "japanese" //\t\tformat: "yyyy/mm/dd" \t}); \tif (\$("input[name=category]").val().length == 0) { \t\t\$('#qblog_cat_trigger').click(); \t} \tif (\$('h2.title').length == 0) { \t\t\$("#edit_form_main").before('<h2 class="title">{$s_h2title}</h2>'); \t} \t\$('h2.title').text('{$s_h2title}'); \t\$('a.show-thumbnail').click(function(){ \t\tif (\$(this).next().is(':visible')) { \t\t\t\$(this).next().hide(); \t\t} \t\telse { \t\t\t\$(this).next().show(); \t\t} \t\treturn false; \t}); }); </script> <div class="qblog_edit_form"> <form action="{$script}" method="post" class="form-horizontal" id="edit_form_main"> {$template} {$addtag} <input type="hidden" name="cmd" value="edit" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="digest" value="{$s_digest}" /> <fieldset> <div class="form-group"> <label class="control-label col-sm-2">日付</label> <div class="controls col-sm-10"><input type="text" name="qblog_date" id="qblog_datepicker" tabindex="1" class="datepicker form-control" size="16" value="{$date}" data-date="{$date}" data-date-format="yyyy-mm-dd" class="form-control" /></div> </div> <div class="form-group"> <label class="control-label col-sm-2">タイトル</label> <div class="controls col-sm-10"><input type="text" name="title" value="{$s_blog_title}" tabindex="2" class="form-control" /></div> \t</div> <div class="form-group"> <label class="control-label col-sm-2">カテゴリ</label> <div class="controls col-sm-10"> <div class="input-group"> <input type="text" name="category" value="{$category}" placeholder="{$qblog_default_cat}" tabindex="3" class="form-control" data-provide="typeahead" data-source="{$h_qblog_cat_json}" autocomplete="off" /> <span class="input-group-btn"> <button type="button" id="qblog_cat_trigger" class="btn btn-default qhm-btn-default" data-toggle="collapse" data-target="#qblog_categories_selector" style="color:#333"> カテゴリ <span class="caret"></span> </button> </span> </div> {$qblog_cat_list} </div> </div> <div class="form-group"> <label class="control-label col-sm-2">記事の内容</label> <div class="controls col-sm-10"> <textarea name="msg" id="msg" tabindex="4" rows="20" class="form-control">{$s_postdata}</textarea> \t\t</div> \t</div> <div class="form-group"> <div class="controls col-sm-10 col-sm-offset-2"> \t \t\t<a class="show-thumbnail" href="#">サムネイルを指定する >></a> \t\t\t<div class="set-thumbnail"> \t\t\t\t<small>自動で本文の画像が使われます。<br />特別に指定したい場合、画像を画像名またはURLで指定してください。</small> <p style="color:#333;">画像名またはURL:<input type="text" name="image" value="{$data['image']}" tabindex="5" class="form-control" /></p> \t\t\t\t<p><small><span class="swfu"><a href="swfu/index_child.php">>>QHMのファイル管理(SWFU)を使って画像をアップする</a></span></small></p> \t\t\t</div> <!-- \t\t\t<span class="swfu"><a href="swfu/index_child.php"><i class="icon-picture"></i>SWFU</a><span> \t\t\t<p class="help-block">SWFUの画像を使う場合、画像詳細画面の<b>URL</b>をコピペしてください。</p> --> \t\t</div> \t</div> <div class="form-group"> <div class="col-sm-10 col-sm-offset-2"> <div style="float:{$buttons_align};"> <input type="submit" name="preview" value="{$btn_preview}" tabindex="6" class="qhm-btn-default"/> <input type="submit" name="write" value="{$_btn_update}" tabindex="7" class="qhm-btn-primary"/> \t\t{$add_notimestamp} {$add_top} \t\t<textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea> </div> <div style="float:{$buttons_align};"> <input type="submit" name="cancel" value="{$_btn_cancel}" tabindex="8" class="btn-link"/> </div> </div> \t</div> </fieldset> </form> </div> EOD; } else { $body = <<<EOD <div class="edit_form"> <form action="{$script}" method="post" style="margin-bottom:0px;" id="edit_form_main"> {$template} {$addtag} <input type="hidden" name="cmd" value="edit" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="hidden" name="digest" value="{$s_digest}" /> <div class="form-group"> <textarea name="msg" id="msg" rows="{$rows}" cols="{$cols}" tabindex="2" class="form-control">{$s_postdata}</textarea> </div> <div style="float:{$buttons_align};"> <input type="submit" name="preview" value="{$btn_preview}" tabindex="4" class="qhm-btn-default"/> <input type="submit" name="write" value="{$_btn_update}" tabindex="5" class="qhm-btn-primary"/> {$add_top} {$add_notimestamp} </div> <textarea name="original" rows="1" cols="1" style="display:none">{$s_original}</textarea> </form> <form action="{$script}" method="post" style="margin-top:0px;margin-left:5px;float:{$buttons_align};" id="edit_form_cancel"> <input type="hidden" name="cmd" value="edit" /> <input type="hidden" name="page" value="{$s_page}" /> <input type="submit" name="cancel" value="{$_btn_cancel}" tabindex="6" class="btn-link"/> </form> <div style="clear:both;"></div> </div> EOD; } $addscript = <<<EOD <script data-qhm-plugin="edit"> \$(function(){ if (\$("h2.title").length == 0) { \$(".edit_form").before('<h2 class="title">{$s_page} の編集</h2>'); } \$("h2.title").css({fontSize: "14px", marginBottom: '15px'}); \$("#editboxlink").on("click", function(){ if (\$(".qblog_edit_form").length) { QHM.scroll(".qblog_edit_form", 300); } else { QHM.scroll("h2.title", 300); } \$("#msg").focus(); return false; }); if (\$("#preview_body").length) { } else { \$(".qhm-eyecatch").hide(); setTimeout(function(){ \$("html, body").animate({scrollTop: \$("h2.title").offset().top}, 300); \$("#msg").focus(); }, 25); } }); </script> EOD; $qt->appendv_once("plugin_edit_form_script", 'lastscript', $addscript); // List of attached files to the page by hokuken.com $attaches = exist_plugin_action('attach') ? attach_filelist(true) : ''; if ($attaches !== '') { $body .= <<<EOD <script type="text/javascript" src="js/yahoo.js"></script> <script type="text/javascript" src="js/event.js"></script> <script type="text/javascript" src="js/dom.js"></script> <style type="text/css"> .yui-tt { \tposition: absolute; \tpadding: 5px; \tbackground-color:#eee; \tborder:1px solid #aaa; } </style> <script type="text/javascript" src="js/container.js"></script> <script type="text/javascript"> function init() { var el = document.getElementById('attachlist'); if(el != null){ \t var list = el.getElementsByTagName('a'); \t for( var i=0; i<list.length; i++ ) { \t if( list[i].getAttribute("rel") == "attachhref" ){ \t\t\t\t\tvar el = 'tooltip'+i; \t\t\t\t\tvar url = list[i].href; \t\t\t\t\tvar title = '<img src="'+list[i].href+'">'; \t\t\t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML; \t\t\t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } ); \t\t\t\t} \t } } var el = document.getElementById('swfulist'); if(el != null){ \tvar list = el.getElementsByTagName('a'); \t for( var i=0; i<list.length; i++ ) { \t if( list[i].getAttribute("rel") == "attachhref" ){ \t\t\t\t\tvar el = 'tooltip'+i; \t\t\t\t\tvar url = list[i].getAttribute("url"); \t\t\t\t\tvar title = '<img src="'+url+'">'; \t\t\t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML; \t\t\t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } ); \t\t\t\t} \t } \t\t} } YAHOO.util.Event.addListener(window, "load", init); </script> EOD; $body .= '<br /><div id="attachlist" style="border: 2px dashed #666;padding:5px 10px;background-color:#eee">' . $attaches . '</div>'; } $qm = get_qm(); $helpstr = $qm->m['html']['view_help_message']; //list up swfu files if (has_swfu()) { require_once SWFU_TEXTSQL_PATH; $db = new CTextDB(SWFU_IMAGEDB_PATH); $imgtitle = $qm->m['html']['img_title']; $imgtitle2 = $qm->m['html']['img_title2']; $attcstr = $qm->m['html']['attach_message']; //! swfuの画像データを取得して表示をする $rs = $db->select('$page_name=="' . $page . '"', 'created desc'); if (count($rs) > 0) { $body .= '<div id="swfulist" style="border:1px #aaa dashed;margin-top:10px;padding:10px;font-size:12px">'; $body .= '<b><a href="./swfu/index_child.php?page=FrontPage&KeepThis=true&TB_iframe=true&height=450&width=650" class="thickbox">' . $attcstr . '(SWFU)</a> : </b>'; foreach ($rs as $k => $v) { $path = SWFU_IMAGE_DIR . $v['name']; $prop = SWFU_DIR . 'view.php?id=' . $v['id'] . '&page=FrontPage&KeepThis=true&TB_iframe=true&height=450&width=650'; $body .= '<span style="padding:2px;margin-right:5px">'; $atitle1 = $qm->replace("html.insert_title", $v['name']); $atitle2 = $qm->replace("html.ar_insert_title", $v['name']); if (preg_match('/\\.(png|jpeg|jpg|gif)$/i', $v['name'])) { $title = h($v['name']); $body .= '<a href="' . $prop . '" url="' . $path . '" rel="attachhref" class="thickbox" title="' . $title . '"><img src="image/file.png" width="20" height="20" alt="file" style="border-width:0" />' . $v['name'] . '</a>'; $body .= <<<EOD <a href="#" title="{$atitle1}" onclick="javascript:jQuery.clickpad.cpInsert('&show({$v['name']},,{$v['description']});'); return false;"><img src="image/ins-img.png" alt="{$imgtitle}"/></a><a href="#" title="{$atitle2}" onclick="javascript:jQuery.clickpad.cpInsert('\\n#show({$v['name']},aroundl,{$v['description']})\\n'); return false;"><img src="image/ins-img2.png" alt="{$imgtitle2}" /></a> EOD; } else { $body .= '<a href="' . $path . '"><img src="image/file.png" width="20" height="20" alt="file" style="border-width:0" />' . $v['name'] . '</a>'; $body .= <<<EOD <a href="#" title="{$v['name']}" onclick="javascript:insert('&dlbutton({$path});'); return false;"><img src="image/ins-btn.png" alt="{$imgtitle}"/></a> EOD; } $body .= '</span>'; } $body .= '</div>'; } } return $body; }
function form() { global $rows, $cols, $notimeupdate, $hr; $qm = get_qm(); $qt = get_qt(); $script = get_script_uri(); $r_page = rawurlencode($this->page); $btn_preview = strpos(get_class($this), 'Preview') ? $qm->m['fmt_btn_repreview'] : $qm->m['fmt_btn_preview']; $buttons_align = 'right'; if (!is_bootstrap_skin()) { $buttons_align = 'left'; $beforescript = <<<EOD <script src="skin/bootstrap/js/bootstrap.min.js"></script> <link rel="stylesheet" href="skin/bootstrap/css/bootstrap-custom.min.css" /> EOD; $qt->appendv_once('plugin_secedit_edit', 'beforescript', $beforescript); } $level = $this->level ? '<input type="hidden" name="level" value="true" />' : ''; $add_notimestamp = ''; if ($notimeupdate) { $checked = $this->notimestamp ? ' checked="checked"' : ''; $pass_form = $notimeupdate == 2 ? ' <input type="password" name="pass" size="12" />' : ''; $add_notimestamp = <<<EOD \t<label for="_edit_form_notimestamp" class="checkbox"> \t\t<input type="checkbox" name="notimestamp" id="_edit_form_notimestamp" value="true"{$checked} /> \t\t<span class="small">{$qm->m['fmt_btn_notchangetimestamp']}</span> \t</label> {$pass_form} EOD; } $helpstr = $qm->m['html']['view_help_message']; $body = <<<EOD <div class="edit_form"> <form action="{$script}" method="post" style="margin-bottom:0px;"> <input type="hidden" name="cmd" value="secedit" /> <input type="hidden" name="page" value="{$this->s_page}" /> <input type="hidden" name="id" value="{$this->id}" /> {$level} <input type="hidden" name="digest" value="{$this->s_digest}" /> <div class="form-group"> <textarea name="msg" id="msg" rows="{$rows}" cols="{$cols}" tabindex="2" class="form-control">{$this->s_postdata}</textarea> </div> <div style="float:{$buttons_align};"> <input type="submit" name="preview" value="{$btn_preview}" class="qhm-btn-default" /> <input type="submit" name="write" value="{$qm->m['fmt_btn_update']}" class="qhm-btn-primary" /> {$add_notimestamp} <textarea name="original" rows="1" cols="1" style="display:none">{$this->s_original}</textarea> </div> <div style="margin-top:0px;margin-left:5px;float:{$buttons_align};"> <input type="submit" name="cancel" value="{$qm->m['fmt_btn_cancel']}" class="btn-link" /> </div> <div style="clear:both;"></div> </form> </div> {$help} EOD; $addscript = <<<EOD <script data-qhm-plugin="secedit"> \$(function(){ if (\$("#preview_body").length) { } else { \$(".qhm-eyecatch").hide(); setTimeout(function(){ \$("html, body").animate({scrollTop: \$("#msg").offset().top-10}, 300); \$("#msg").focus(); }, 25); } }); </script> EOD; $qt->appendv_once("plugin_secedit_script", "lastscript", $addscript); // List of attached files to the page by hokuken.com $attaches = exist_plugin_action('attach') ? attach_filelist() : ''; if ($attaches !== '') { $body .= <<<EOD <script type="text/javascript" src="js/yahoo.js"></script> <script type="text/javascript" src="js/event.js"></script> <script type="text/javascript" src="js/dom.js"></script> <style type="text/css"><!-- .yui-tt { position: absolute; padding: 5px; background-color:#edf; border:1px solid #aaf; } --></style> <script type="text/javascript" src="js/container.js"></script> <script type="text/javascript"> function init() { \tvar list = document.getElementById('attachlist').getElementsByTagName('a'); \tfor( var i=0; i<list.length; i++ ) { \t\tif( list[i].getAttribute("rel") == "attachhref" ){ \t\t\tvar el = 'tooltip'+i; \t\t\tvar url = list[i].href; \t\t\tvar title = '<img src="'+list[i].href+'">'; \t\t\tif ( list[i].title ) title += '<br>'+list[i].innerHTML; \t\t\tvar tp = new YAHOO.widget.Tooltip( el, { context:list[i], text: title, autodismissdelay: 7500 } ); \t\t} \t} } YAHOO.util.Event.addListener(window, "load", init); </script> EOD; $body .= '<br /><div id="attachlist" style="border: 2px dashed #666;padding:5px 10px;background-color:#eee">' . $attaches . '</div>'; } return $body; }
function plugin_comment2_convert() { global $vars, $digest; static $numbers = array(); static $comment2_cols = PLUGIN_COMMENT2_SIZE_MSG; $qm = get_qm(); $plugin_comment2_auth = true; $s_msg = $s_name = ""; if (PKWK_READONLY) { return ''; } // Show nothing if (!isset($numbers[$vars['page']])) { $numbers[$vars['page']] = 0; } $comment2_no = $numbers[$vars['page']]++; $options = func_num_args() ? func_get_args() : array(); $nodate = in_array('nodate', $options) ? '1' : '0'; $noupdate = in_array('noupdate', $options) ? '1' : '0'; $above = in_array('above', $options) ? '1' : (in_array('below', $options) ? '0' : PLUGIN_COMMENT2_DIRECTION_DEFAULT); $authcode = '' . rand(0, 9) . rand(0, 9) . rand(0, 9) . rand(0, 9); $auth_label = '認証コード'; $auth_error_alert = ''; $auth_error_style = ''; $auth_error_class = ''; if (in_array('textarea', $options)) { $area = isset($options[1]) && is_numeric($options[1]) ? $options[1] : 6; } else { $area = 0; } $nametags = ''; $commenttags = ''; $input_area = ''; if (isset($vars['comment2_error'])) { $auth_error_alert = '<div class="alert alert-danger">' . $qm->m['plg_comment2']['err_auth_code'] . '</div>'; $auth_error_style = 'color:red;'; $auth_error_class = 'has_error'; $auth_label = $qm->m['plg_comment2']['err_auth_code']; if (isset($vars['name'])) { $s_name = htmlspecialchars($vars['name']); } $s_msg = htmlspecialchars(str_replace('&br;', "\n", $vars['msg'])); } if (is_bootstrap_skin()) { $auth_form = ' <label class="control-label">認証コード(' . $authcode . ')</label> <input type="text" name="authcode" value="" class="form-control input-sm" size="4" /> '; $name_form = ''; $commenttags = '<label for="_p_comment2_comment2_' . $comment2_no . '">コメント: </label>'; if (!in_array('noname', $options)) { $name_form = ' <label class="control-label" for="_p_comment2_name_' . $comment2_no . '">お名前: </label> <input type="text" name="name" class="form-control input-sm" id="_p_comment2_name_' . $comment2_no . '" size="24" value="' . $s_name . '" /> '; } $comment_submit = ' <div class="row"> <div class="col-xs-12 col-sm-6 pull-right"> <div class="form-inline"> <div class="col-sm-12"> <div class="form-group"> <small> ' . $auth_form . ' </small> </div> </div> </div> </div> <div class="col-xs-12 col-sm-6"> <div class="form-group"> <div class="col-sm-12"> <input type="submit" name="comment2" class="btn btn-default btn-sm" value="' . $qm->m['plg_comment']['btn_comment'] . '" style="margin-bottom:0;white-space:normal;"> </div> </div> </div> </div> '; $input_area = ''; if ($area) { $input_area = '<textarea name="msg" id="_p_comment2_comment2_' . $comment2_no . '" class="form-control" rows="' . $area . '">' . $s_msg . '</textarea>'; $comment_form = ' <div class="form-horizontal"> <div class="form-group"> <div class="col-sm-12"> ' . $name_form . ' </div> </div> <div class="form-group"> <div class="col-sm-12"> ' . $input_area . ' </div> </div> <div class="form-group"> <div class="col-sm-12"> ' . $comment_submit . ' </div> </div> </div> '; } else { if (in_array('noname', $options)) { $input_area = $commenttags . '<input type="text" name="msg" class="form-control input-sm" id="_p_comment2_comment2_' . $comment2_no . '" size="' . $comment2_cols . '" value="' . $s_msg . '" />'; $comment_form = ' <div class="form-horizontal"> <div class="form-group"> <div class="col-sm-12"> ' . $input_area . ' </div> </div> <div class="form-group"> <div class="col-sm-12"> ' . $comment_submit . ' </div> </div> </div> '; } else { $input_area = $commenttags . '<input type="text" name="msg" class="form-control input-sm" id="_p_comment2_comment2_' . $comment2_no . '" size="' . $comment2_cols . '" value="' . $s_msg . '" />'; $comment_form = ' <div class="form-horizontal"> <div class="form-group"> <label class="control-label col-md-2" for="_p_comment2_name_' . $comment2_no . '">お名前: </label> <div class="col-md-10"> <div class="row"> <div class="col-md-6"> <input type="text" name="name" class="form-control" id="_p_comment2_name_' . $comment2_no . '" size="24" value="' . $s_name . '" /> </div> </div> </div> </div> <div class="form-group"> <label class="control-label col-md-2" for="_p_comment2_comment2_' . $comment2_no . '">コメント: </label> <div class="col-md-10"> <input type="text" name="msg" class="form-control" id="_p_comment2_comment2_' . $comment2_no . '" size="' . $comment2_cols . '" value="' . $s_msg . '" /> </div> </div> <div class="form-group"> <div class="col-md-10 col-md-offset-2"> <div class="row"> <div class="col-md-6 col-sm-7 col-sm-push-6"> <div class="form-inline"> <div class="col-sm-12"> <div class="form-group"> <small> ' . $auth_form . ' </small> </div> </div> </div> </div> <div class="col-md-6 col-sm-5 col-sm-pull-6"> <div class="form-group"> <div class="col-sm-12"> <input type="submit" name="comment2" class="btn btn-default btn-sm" value="' . $qm->m['plg_comment']['btn_comment'] . '" style="margin-bottom:0;white-space:normal;"> </div> </div> </div> </div> </div> </div> </div> '; } } } else { $authcode_msg = ' <span id="coment2_auth_msg_no_' . $comment2_no . '" style="font-size:11px;' . $auth_error_style . '"> ' . $auth_label . '(' . $authcode . ') <input type="text" name="authcode" value="" size="4" /> </span> '; if (in_array('noname', $options)) { $commenttags = '<label for="_p_comment2_comment2_' . $comment2_no . '">コメント: </label>'; } else { $nametags = ' <label for="_p_comment2_name_' . $comment2_no . '">お名前: </label> <input type="text" name="name" id="_p_comment2_name_' . $comment2_no . '" size="' . PLUGIN_COMMENT2_SIZE_NAME . '" value="' . $s_name . '" /> '; } if ($area) { $input_area = '<br /><textarea name="msg" id="_p_comment2_comment2_' . $comment2_no . '" style="width:90%;" rows="' . $area . '">' . $s_msg . '</textarea>'; } else { $input_area = $commenttags . '<input type="text" name="msg" id="_p_comment2_comment2_' . $comment2_no . '" size="' . $comment2_cols . '" value="' . $s_msg . '" />'; } $input_button = '<input type="submit" name="comment2" value="' . $qm->m['plg_comment']['btn_comment'] . '" />'; $comment_form = $nametags . $authcode_msg . $input_area . $input_button; } $script = get_script_uri(); $s_page = htmlspecialchars($vars['page']); $string = <<<EOD <br /> <form action="{$script}" method="post"> <div> <input type="hidden" name="plugin" value="comment2" /> <input type="hidden" name="refer" value="{$s_page}" /> <input type="hidden" name="comment2_no" value="{$comment2_no}" /> <input type="hidden" name="nodate" value="{$nodate}" /> <input type="hidden" name="above" value="{$above}" /> <input type="hidden" name="digest" value="{$digest}" /> <input type="hidden" name="noupdate" value="{$noupdate}" /> <input type="hidden" name="authcode_master" value="{$authcode}" /> {$auth_error_alert} {$comment_form} </div> </form> EOD; return $string; }
/** * Plugin: Equal Navi * ------------------------------------------- * ./plugin/equal_navi.inc.php * * Copyright (c) 2011 hokuken * http://hokuken.com/ * * created : 2011-12-12 * modified : 2011-12-14 * * ナビのアイテム幅をすべて同じに(平均化)します。 * オプションが2つあり、 * grow: 長いアイテムは平均化から除外する * equal: 複数段ある場合、全段内の最小平均幅に合わせる * * Usage : * #equal_navi(grow|equal) * */ function plugin_equal_navi_convert() { global $script, $vars; if (is_bootstrap_skin()) { return ''; } $qt = get_qt(); $qt->setv('jquery_include', TRUE); $args = func_get_args(); $option = array_shift($args); $auto_grow = $equal_width = FALSE; switch ($option) { case 'grow': $auto_grow = TRUE; break; case 'equal': $equal_width = TRUE; break; } $beforescript = ' <script type="text/javascript"> $(function(){ if ($(window).width() < 768) { return; } var navi_width = $("#navigator").width(), min_li_width = navi_width, auto_grow = ' . ($auto_grow ? 'true' : 'false') . ', equal_width = ' . ($equal_width ? 'true' : 'false') . ', $uls = $("#navigator ul.list1"), max_ul_children_length = 0, $all_lis = $("> li", $uls); $uls.each(function(i){ var $lis = $("> li", this), $ul = $(this), ul_width = $ul.width(), width; ul_width -= intval($ul.css("border-left-width")) + intval($ul.css("border-right-width")); if (max_ul_children_length < $lis.length) { max_ul_children_length = $lis.length; } $lis.each(function(){ var $li = $(this), li_margin = intval($li.css("margin-left")) + intval($li.css("margin-right")), li_padding = intval($li.css("padding-left")) + intval($li.css("padding-right")), li_extra_width = li_margin + li_padding; ul_width -= li_extra_width; $li.data("equal_navi", {extra_width: li_extra_width}); }); width = ul_width / $lis.length; /* auto grow */ if (auto_grow) { var repeat = true; while (repeat) { repeat = false; $lis.each(function(){ var $li = $(this), new_width; if ($li.width() > width) { repeat = true; new_width = $li.width() + 0.5; $li.width(new_width); ul_width -= new_width; $lis = $lis.not(this); } }); width = ul_width / $lis.length; } } if (min_li_width > width) { min_li_width = width; } $lis.width(width); $("> li:last", this).width(ul_width - ($lis.length-1) * width); }); /* set all lists to same width */ if (equal_width && $uls.length > 1) { var cnt = 0, actual_width; $all_lis.width(min_li_width); $all_lis.each(function(){ var $li = $(this), $ul = $li.closest("ul.list1"); if ($li.is(":first-child")) { actual_width = 0; cnt = 0; } if ($li.is(":last-child") && cnt == max_ul_children_length - 1) { $li.width($li.closest("ul.list1").width() - actual_width - $li.data("equal_navi").extra_width); } else { actual_width += min_li_width + $li.data("equal_navi").extra_width; $li.width(min_li_width); } cnt++; }); } function intval(data) { return isNaN(parseInt(data)) ? 0 : parseInt(data); } }); </script> '; $qt->appendv_once('plugin_equal_navi', 'beforescript', $beforescript); return ''; }
<ol class="help-block"> <li>短縮URLをコピーする。</li> <li><a href="http://www.facebook.com/" class="btn qhm-btn-primary qhm-btn-sm" target="_blank">ここをクリックして、Facebook を開いて投稿</a></li> </ol> </div> </div> </div> </div> </div> </div> '; // other plugin $op_html = ''; if (!is_bootstrap_skin()) { $op_cat = array(); $op_html = '<div class="other_plugin">'; $op_html .= '<div class="other_plugin_box_title expand"><span>' . $qm->m['qhm_init']['ot_label'] . '</span> <span class="mark">ー</span></div>'; $op_html .= '<div class="other_plugin_box">'; $op_html_box = ""; foreach ($other_plugins as $opkey => $op) { $insert_cmd = $op['insert']; $insert_cmd = str_replace("\n", "##LF##", $insert_cmd); $op_html_box = '<li class="' . $op['help'] . '"><span class="opname">' . $op['name'] . '</span><span class="insert_cmd">' . $insert_cmd . '</span></li>'; $op_cat[$op['category']][] = $op_html_box; } $op_html .= '<ul class="other_plugin_menu">'; foreach ($other_plugin_categories as $catkey => $catname) { $op_html_menu = '<li>' . $catname; $op_html_menu .= '<ul class="other_plugin_sub">';
/** * Set Google Search Plugin * ------------------------------------------- * plugin/gsearch.inc.php * * Copyright (c) 2015 hokuken * http://hokuken.com/ * * created : * modified : 2015-06-17 Bootstrap スキンの分岐を追加 * * Google 検索、サイト内検索フォームを設置する * * Usage : * #gsearch([検索対象サイトURL]) * */ function plugin_gsearch_convert() { global $script; $qm = get_qm(); $other_site = false; $search_www = false; $args = func_get_args(); if (count($args) > 0) { $url = array_pop($args); if ($url === 'www') { $search_www = true; } else { $url_info = parse_url($script); $other_url_info = parse_url($url); if ($url_info['host'] !== $other_url_info['host'] || $url_info['path'] !== $other_url_info['path']) { $other_site = true; } } } else { $url = dirname($script); } if (is_bootstrap_skin()) { $label = $search_www ? 'Google 検索' : 'Google サイト内検索'; return '<!-- SiteSearch Google --> <div class="qhm-plugin-gsearch"> <form method="get" action="http://www.google.co.jp/search"> <input type="hidden" name="ie" value="UTF-8"> <input type="hidden" name="oe" value="UTF-8"> <input type="hidden" name="hl" value="ja"> <input type="hidden" name="sitesearch" value="' . ($search_www ? '' : h($url)) . '"> <div class="form-group"> <div class="input-group"> <input type="text" name="q" size="31" maxlength="255" placeholder="' . h($label) . '" class="form-control input-sm"> <span class="input-group-btn"> <input type="submit" value="検索" class="btn btn-default btn-sm"> </span> </div> ' . ($other_site ? '<span class="help-block">' . h($url) . ' 内を検索します</span>' : '') . ' </div> </form> </div> <!-- /SiteSearch Google -->'; } return '<!-- SiteSearch Google --> <div class="qhm-plugin-gsearch" style="text-align:center"> <form method="get" action="http://www.google.co.jp/search"> <table bgcolor="#FFFFFF"><tr valign="top"><td> <a href="http://www.google.co.jp/"> <img src="http://www.google.com/logos/Logo_40wht.gif" border="0" alt="Google" align="absmiddle" /></a> </td> <td> <input type="text" name="q" size="31" maxlength="255" value="" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="hidden" name="oe" value="UTF-8" /> <input type="hidden" name="hl" value="ja" /> <input type="submit" name="btnG" value="' . $qm->m['plg_gsearch']['btn_gsearch'] . '" /> <span style="font-size:smaller"> <input type="hidden" name="domains" value="' . h($url) . '" /><br /> <label><input type="radio" name="sitesearch" value="" ' . ($search_www ? 'checked' : '') . ' /> ' . $qm->m['plg_gsearch']['label_wsearch'] . '</label> <label><input type="radio" name="sitesearch" value="' . h($url) . '" ' . ($search_www ? '' : 'checked') . ' /> ' . $qm->replace('plg_gsearch.label_ssearch', h($url)) . '</label> </span> </td></tr></table> </form> </div> <!-- /SiteSearch Google -->'; }