div#plugin_blinks { padding:0 10px 0 10px; margin:auto; display:-webkit-flex; display:-ms-flex; display:flex; flex-wrap:wrap; -webkit-flex-wrap:wrap; -ms-flex-wrap:wrap; width:100%; flex:2; -webkit-flex:2; -ms-flex:2; } div#plugin_blink { background-color:rgb(250, 250, 250); width:320px; height:250px; min-width:50px; border:solid rgb(150, 150, 150) 1px; border-radius:5px; margin:10px 10px 10px 10px; position:relative; z-index:1; flex-grow:1; -webkit-flex-grow:1; -ms-flex-grow:1; transition-duration:0.3s; } div#plugin_blink a#plugin_blink_link { opacity:0; position:absolute; top:0; left:0; width:100%; height:100%; text-indent:-999px; z-index:2; } div#plugin_blink:hover { opacity:0.5; transform:scale(1.05); } div#plugin_blink_body { margin:5px 5px 0 5px; } div#plugin_blink_body div#image { float:left; margin:0 15px 15px 0; } div#plugin_blink_body img { width:150px; height:150px; max-width:190px; max-height:190px; min-width:20px; min-height:20px; } div#plugin_blink_body p#short_plugin_blinkcontents { margin-top:-15px; line-height:1.6em; font-size:12px; color:rgb(50, 50, 50); } div#plugin_blink a#plugin_blink_inlink { position:relative; z-index:3; } div#plugin_blink a.thumbnail_attach { font-size:10px } "; } $brecent_lines = PLUGIN_BRECENT_DEFAULT_LINES; if (func_num_args()) { $args = func_get_args(); if (! is_numeric($args[0]) || isset($args[1])) { return PLUGIN_BRECENT_USAGE . '
'; } else { $brecent_lines = $args[0]; } } // Show only N times if ($exec_count > PLUGIN_BRECENT_EXEC_LIMIT) { return '#brecent(): You called me too much' . '
' . "\n"; } else { ++$exec_count; } if (! file_exists(PLUGIN_BRECENT_CACHE)) { put_lastmodified(); if (! file_exists(PLUGIN_BRECENT_CACHE)) { return '#brecent(): Cache file of RecentChanges not found' . '
'; } } // Get latest N changes $hidepages = explode(",", PLUGIN_BRECENT_HIDE_PAGES); $lines = file_head(PLUGIN_BRECENT_CACHE, $brecent_lines + count($hidepages)); if($lines == FALSE) return '#brecent(): File can not open' . '
' . "\n"; $date = $plugin_brecents = ''; $recent_count = 0; foreach ($lines as $line) { $hide_true = false; list($time, $page) = explode("\t", rtrim($line)); foreach($hidepages as $hidepage){ if($page == $hidepage){ $hide_true = true; break; } } if($hide_true == true){ continue; }else{ ++$recent_count; } $_date = get_date($date_format, $time); if ($date != $_date) { $date = $_date; } $s_page = htmlsc($page); if(!file_exists(THUMB_DIR . strtoupper(bin2hex($page)) . ".png")){ $noimage_attach = ' [サムネイル添付]'; if(file_exists(THUMB_DIR . "noimage.png")){ $_pageimage_path = THUMB_DIR . "noimage.png"; }else{ $_pageimage_path = IMAGE_DIR . "noimage.png"; } }else{ $_pageimage_path = THUMB_DIR . strtoupper(bin2hex($page)) . ".png"; $noimage_attach = ''; } $_source = get_source($page); $_source = plugin_brecent_drop($_source); $_partsource = mb_substr(implode($_source),0 ,140); $pageurl = get_page_uri($page); $plugin_brecents .= ''; if($recent_count == $brecent_lines){ break; } } return '"; } function plugin_brecent_drop($source){ $source = preg_replace('/^\#(.*?)$/u', '', $source); $source = preg_replace('/&(.*?)\{(.*?)\};/u', '$2', $source); $source = preg_replace('/&(.*?);/u', '', $source); $source = preg_replace('/^\|#(.*?)\|$/u', '', $source); $source = preg_replace('/^\*\*\*(.*?)$/u', '', $source); $source = preg_replace('/^\*\*(.*?)$/u', '', $source); $source = preg_replace('/^\*(.*?)$/u', '', $source); $source = preg_replace('/^---(.*?)$/u', '$1', $source); $source = preg_replace('/^--(.*?)$/u', '$1', $source); $source = preg_replace('/^-(.*?)$/u', '$1', $source); $source = preg_replace('/\[\[(.*?)>(.*?)\]\]/u', '$1', $source); $source = preg_replace('/\[\[(.*?)\]\]/u', '$1', $source); $source = preg_replace('/^\|(.*?)\|$/u', '', $source); $source = preg_replace('/^\|(.*?)\|h$/u', '', $source); $source = preg_replace('/^\|(.*?)\|c$/u', '', $source); $source = preg_replace('/^\|(.*?)\|f$/u', '', $source); $source = preg_replace('/\'\'\'(.*?)\'\'\'/u', '$1', $source); $source = preg_replace('/\'\'(.*?)\'\'/u', '$1', $source); $source = preg_replace('/%%%(.*?)%%%/u', '$1', $source); $source = preg_replace('/%%(.*?)%%/u', '$1', $source); $source = preg_replace('/\/\/(.*?)/u', '', $source); return $source; } function plugin_brecent_action(){ global $vars; if($vars['do'] == "attach"){ $msg = "「" . $vars['page'] . "」のサムネイル添付"; $body = <<「{$vars['page']}」のサムネイルの添付



管理者パスワード: 
EOD; }elseif($vars['do'] == "upload"){ if(!pkwk_login($vars["adminpass"])){ $body = <<ログインに失敗しました。



管理者パスワード: 
EOD; return array('body' => $body, 'msg' => "ログインに失敗しました。"); } if(!file_exists(THUMB_DIR)){ mkdir(THUMB_DIR); } if($vars['select_mode'] == "upload"){ if(is_uploaded_file($_FILES["uploadfile"]["tmp_name"])){ $pathinfo = pathinfo($_FILES["uploadfile"]["name"]); if(strtolower($pathinfo["extension"]) == "png"){ move_uploaded_file($_FILES["uploadfile"]["tmp_name"], THUMB_DIR . strtoupper(bin2hex($vars['page'])) . ".png"); }else{ $image = @imagecreatefromstring(file_get_contents($_FILES["uploadfile"]["tmp_name"])); imagepng($image, THUMB_DIR . strtoupper(bin2hex($vars['page'])) . ".png"); imagedestroy($image); } } }elseif($vars['select_mode'] == "screenshot"){ if(preg_match("/https?:\/{2}.*/u", $vars['page'])){ $pageurl = $vars['page']; }else{ $pageurl = get_script_uri() . "?" . $vars['page']; } $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, str_replace("%URL%", $pageurl, PLUGIN_BRECENT_PAGESPEEDONLINE_API)); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 300); $jsonsource = curl_exec($curl); curl_close($curl); $json_array = json_decode($jsonsource, true); $base64image = $json_array['lighthouseResult']['audits']['final-screenshot']['details']['data']; $base64image = preg_replace('/data:image\/(jpeg|png);base64,/', '', $base64image); $imagedata = base64_decode($base64image); $image = @imagecreatefromstring($imagedata); imagepng($image, THUMB_DIR . strtoupper(bin2hex($vars['page'])) . ".png"); imagedestroy($image); } } return array('body' => $body, 'msg' => $msg); }