From 86e46024df7853751e2d2defe499e00fe6a4fb48 Mon Sep 17 00:00:00 2001 From: Jeongkyu Shin Date: Mon, 16 Feb 2015 15:25:50 +0900 Subject: [PATCH] refs #1749 : Context object now covers plugin-specific passing parameters. - updated - default plugins (continued.) --- interface/owner/plugin/adminHandler/index.php | 46 +- interface/owner/plugin/adminMenu/index.php | 46 +- plugins/PN_Visitor_Default/index.php | 5 +- plugins/StatGraph/index.php | 7 +- plugins/StatGraph/index.xml | 6 +- plugins/URLkeeper/index.php | 1 - plugins/refererkeyword/index.php | 700 +++++++++--------- plugins/refererkeyword/index.xml | 7 +- 8 files changed, 432 insertions(+), 386 deletions(-) diff --git a/interface/owner/plugin/adminHandler/index.php b/interface/owner/plugin/adminHandler/index.php index 6f06377fa..c3ad081b3 100644 --- a/interface/owner/plugin/adminHandler/index.php +++ b/interface/owner/plugin/adminHandler/index.php @@ -6,47 +6,69 @@ require ROOT . '/library/preprocessor.php'; requireStrictRoute(); $context = Model_Context::getInstance(); -if ((isset($_REQUEST['name'])) && (isset($adminHandlerMappings[$_REQUEST['name']]))) +if ((isset($_REQUEST['name'])) && (isset($adminHandlerMappings[$_REQUEST['name']]))) { $IV = array ( 'REQUEST' => array( 'name' => array('string') ) ); - + foreach($adminHandlerMappings[$_GET['name']]['params'] as $param) { $ivItem = array ( $param['type']); if (isset($param['default']) && !is_null($param['default']) ) $ivItem['default'] = $param['default']; if (isset($param['mandatory']) && !is_null($param['mandatory']) ) $ivItem['mandatory'] = $param['mandatory']; - + $IV['REQUEST'][$param['name']] = $ivItem; } - + if (Validator::validate($IV)) { $plugin = $adminHandlerMappings[$_REQUEST['name']]['plugin']; $handler = $adminHandlerMappings[$_REQUEST['name']]['handler']; - + $pluginAccessURL = $context->getProperty('uri.blog') . '/owner/plugin/adminMenu?name=' . $plugin; $pluginMenuURL = 'invalid link'; $pluginHandlerURL = $context->getProperty('uri.blog') . '/owner/plugin/adminHandler?name=' . $plugin; $pluginSelfURL = $context->getProperty('uri.blog') . '/owner/plugin/adminHandler?name=' . $plugin . '/' . $handler; - + $pluginAccessParam = '?name=' . $plugin; $pluginSelfParam = '?name=' . $plugin . '/' . $handler; - - $pluginURL = "{$context->getProperty('service.path')}/plugins/{$plugin}"; - $pluginPath = ROOT . "/plugins/{$plugin}"; - $pluginName = $plugin; + + $context->setProperty('plugin.uri.access',$pluginAccessURL); + $context->setProperty('plugin.uri.menu',$pluginMenuURL); + $context->setProperty('plugin.uri.handler',$pluginHandlerURL); + $context->setProperty('plugin.uri.self',$pluginSelfURL); + $context->setProperty('plugin.parameter.access',$pluginAccessParam); + $context->setProperty('plugin.parameter.self',$pluginSelfParam); + + $context->setProperty('plugin.uri',$context->getProperty('service.path')."/plugins/{$plugin}"); + $context->setProperty('plugin.path',ROOT . "/plugins/{$plugin}"); + $context->setProperty('plugin.name',$plugin); + + + $pluginURL = $context->getProperty('plugin.uri'); + $pluginPath = $context->getProperty('plugin.path'); + $pluginName = $context->getProperty('plugin.name'); include_once (ROOT . "/plugins/{$plugin}/index.php"); if (function_exists($handler)) { - if( !empty( $configMappings[$plugin]['config'] ) ) + if( !empty( $configMappings[$plugin]['config'] ) ) $configVal = getCurrentSetting($plugin); else $configVal =''; - + call_user_func($handler); } + $context->unsetProperty('plugin.uri'); + $context->unsetProperty('plugin.path'); + $context->unsetProperty('plugin.name'); + $context->unsetProperty('plugin.uri.access'); + $context->unsetProperty('plugin.uri.menu'); + $context->unsetProperty('plugin.uri.handler'); + $context->unsetProperty('plugin.uri.self'); + $context->unsetProperty('plugin.parameter.access'); + $context->unsetProperty('plugin.parameter.self'); + } } diff --git a/interface/owner/plugin/adminMenu/index.php b/interface/owner/plugin/adminMenu/index.php index 5f90d8b6a..f025d05c4 100644 --- a/interface/owner/plugin/adminMenu/index.php +++ b/interface/owner/plugin/adminMenu/index.php @@ -6,25 +6,26 @@ require ROOT . '/library/preprocessor.php'; require ROOT . '/interface/common/owner/header.php'; -if ((isset($_REQUEST['name'])) && (isset($adminMenuMappings[$_REQUEST['name']]))) +if ((isset($_REQUEST['name'])) && (isset($adminMenuMappings[$_REQUEST['name']]))) { - + $IV = array ( 'REQUEST' => array( 'name' => array('string') ) ); - + foreach($adminMenuMappings[$_REQUEST['name']]['params'] as $param) { $ivItem = array ( $param['type']); if (isset($param['default']) && !is_null($param['default']) ) $ivItem['default'] = $param['default']; if (isset($param['mandatory']) && !is_null($param['mandatory']) ) $ivItem['mandatory'] = $param['mandatory']; - + $IV['REQUEST'][$param['name']] = $ivItem; } - + if (Validator::validate($IV)) { - $_GET = $_POST = $_REQUEST; + $context = Model_Context::getInstance(); + $_GET = $_POST = $_REQUEST; $plugin = $adminMenuMappings[$_REQUEST['name']]['plugin']; $handler = $adminMenuMappings[$_REQUEST['name']]['handler']; @@ -35,10 +36,20 @@ $pluginAccessParam = '?name=' . $plugin; $pluginSelfParam = '?name=' . $plugin . '/' . $handler; - - $pluginURL = "{$context->getProperty('service.path')}/plugins/{$plugin}"; - $pluginPath = ROOT . "/plugins/{$plugin}"; - $pluginName = $plugin; + + $context->setProperty('plugin.uri.access',$pluginAccessURL); + $context->setProperty('plugin.uri.menu',$pluginMenuURL); + $context->setProperty('plugin.uri.handler',$pluginHandlerURL); + $context->setProperty('plugin.uri.self',$pluginSelfURL); + $context->setProperty('plugin.parameter.access',$pluginAccessParam); + $context->setProperty('plugin.parameter.self',$pluginSelfParam); + $context->setProperty('plugin.uri',$context->getProperty('service.path')."/plugins/{$plugin}"); + $context->setProperty('plugin.path',ROOT . "/plugins/{$plugin}"); + $context->setProperty('plugin.name',$plugin); + + $pluginURL = $context->getProperty('plugin.uri'); + $pluginPath = $context->getProperty('plugin.path'); + $pluginName = $context->getProperty('plugin.name'); // Loading locale resource $languageDomain = null; @@ -50,17 +61,26 @@ $locale->set($locale->defaultLanguage, $pluginName); $locale->domain = $pluginName; } - } + } include_once (ROOT . "/plugins/{$plugin}/index.php"); if (function_exists($handler)) { - if( !empty( $configMappings[$plugin]['config'] ) ) + if( !empty( $configMappings[$plugin]['config'] ) ) $configVal = getCurrentSetting($plugin); else $configVal =''; call_user_func($handler); } /// unload. - if(!is_null($languageDomain)) $locale->domain = $languageDomain; + if(!is_null($languageDomain)) $locale->domain = $languageDomain; + $context->unsetProperty('plugin.uri'); + $context->unsetProperty('plugin.path'); + $context->unsetProperty('plugin.name'); + $context->unsetProperty('plugin.uri.access'); + $context->unsetProperty('plugin.uri.menu'); + $context->unsetProperty('plugin.uri.handler'); + $context->unsetProperty('plugin.uri.self'); + $context->unsetProperty('plugin.parameter.access'); + $context->unsetProperty('plugin.parameter.self'); } } require ROOT . '/interface/common/owner/footer.php'; diff --git a/plugins/PN_Visitor_Default/index.php b/plugins/PN_Visitor_Default/index.php index c5237bc8e..b62fe4f3f 100644 --- a/plugins/PN_Visitor_Default/index.php +++ b/plugins/PN_Visitor_Default/index.php @@ -25,10 +25,8 @@ */ function PN_Visitor_Default() { - global $pluginMenuURL, $pluginAccessURL, $pluginHandlerURL; + global $pluginMenuURL, $pluginHandlerURL; $blogid = getBlogId(); - requireComponent( "Textcube.Model.Statistics"); - requireComponent('Textcube.Function.misc'); $stats = Statistics::getStatistics($blogid); $date = isset($_GET['date']) ? $_GET['date'] : date('Ym', strtotime("now")); ?> @@ -163,7 +161,6 @@ function execLoadFunction() { function PN_Visitor_Default_set() { $blogid = getBlogId(); - requireComponent( "Textcube.Model.Statistics"); $isAjaxRequest = isset($_REQUEST['ajaxcall']) ? true : false; if ($isAjaxRequest) { $result = Statistics::setTotalStatistics($blogid) ? 0 : -1; diff --git a/plugins/StatGraph/index.php b/plugins/StatGraph/index.php index 5ebf532fe..fdbaee57c 100644 --- a/plugins/StatGraph/index.php +++ b/plugins/StatGraph/index.php @@ -1,12 +1,11 @@ Statistics Graph'; +{ + $context = Model_Context::getInstance(); + $target = '
Statistics Graph
'; return $target; } ?> diff --git a/plugins/StatGraph/index.xml b/plugins/StatGraph/index.xml index 9004aad73..f738ab5d5 100644 --- a/plugins/StatGraph/index.xml +++ b/plugins/StatGraph/index.xml @@ -2,7 +2,7 @@ Graphic Statistics http://gendoh.com - 0.97 + 0.98 접속자 통계를 Graph로 표시합니다. [##_StatisticsGraph_##] 태그를 스킨에 삽입하거나 사이드바에서 추가하면 됩니다. @@ -10,7 +10,9 @@ - 1.8 + + 1.10.3 + diff --git a/plugins/URLkeeper/index.php b/plugins/URLkeeper/index.php index f2473e1f5..d5ec288bd 100644 --- a/plugins/URLkeeper/index.php +++ b/plugins/URLkeeper/index.php @@ -21,7 +21,6 @@ function URLkeeper($target) { - global $hostURL, $blogURL; global $configVal; requireComponent('Tattertools.Function.misc'); $data = Setting::fetchConfigVal( $configVal); diff --git a/plugins/refererkeyword/index.php b/plugins/refererkeyword/index.php index 1a7c59bf0..7e3baec2c 100644 --- a/plugins/refererkeyword/index.php +++ b/plugins/refererkeyword/index.php @@ -1,7 +1,7 @@ $val){ - $set=false; - foreach($result as $var2 => $val2){ - if($set==false){ - if($val>$val2 && $type=='desc' || $val<$val2 && $type=='asc'){ - $temp=array(); - foreach($result as $var3 => $val3){ - if($var3==$var2) $set=true; - if($set){ - $temp[$var3]=$val3; - unset($result[$var3]); - } - } - $result[$var]=$val; - foreach($temp as $var3 => $val3){ - $result[$var3]=$val3; - } - } - } - } - if(!$set){ - $result[$var]=$val; - } - } - return $result; +function array_sort($array, $type = 'asc') +{ + $result = array(); + foreach ($array as $var => $val) { + $set = false; + foreach ($result as $var2 => $val2) { + if ($set == false) { + if ($val > $val2 && $type == 'desc' || $val < $val2 && $type == 'asc') { + $temp = array(); + foreach ($result as $var3 => $val3) { + if ($var3 == $var2) $set = true; + if ($set) { + $temp[$var3] = $val3; + unset($result[$var3]); + } + } + $result[$var] = $val; + foreach ($temp as $var3 => $val3) { + $result[$var3] = $val3; + } + } + } + } + if (!$set) { + $result[$var] = $val; + } + } + return $result; } function unified_decode_processor($matches) { - $grab = array(); - if (preg_match('@^%([[:alnum:]][[:alnum:]])$@', $matches[0], $grab) > 0) { - if (hexdec($grab[1]) == 0) return ' '; // 0x00은 공백으로 처리 - return chr(hexdec($grab[1])); - } - if (preg_match('@^%u([[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]])$@', $matches[0], $grab) > 0) { - $value = hexdec($grab[1]); - - if ($value == 0) return ' '; // 0x00은 공백으로 처리 - if ($value < 0x0080) { // 7bit -> 1byte - return chr($value); - } - if ($value < 0x0800) { // 11bit -> 2byte ( 110xxxxx 10xxxxxx ) - return chr((($value & 0x07c0) >> 6) | 0xc0) . chr(($value & 0x3f) | 0x80); - } - // 16bit --> 3byte ( 1110xxxx 10xxxxxx 10xxxxxx ) - return chr((($value & 0xf000) >> 12) | 0xe0) - . chr((($value & 0x0fc0) >> 6) | 0x80) - . chr(($value & 0x3f) | 0x80); - } - return $matches[0]; // 번역이 안되는 놈들은 그대로 출력하자 + $grab = array(); + if (preg_match('@^%([[:alnum:]][[:alnum:]])$@', $matches[0], $grab) > 0) { + if (hexdec($grab[1]) == 0) return ' '; // 0x00은 공백으로 처리 + return chr(hexdec($grab[1])); + } + if (preg_match('@^%u([[:alnum:]][[:alnum:]][[:alnum:]][[:alnum:]])$@', $matches[0], $grab) > 0) { + $value = hexdec($grab[1]); + + if ($value == 0) return ' '; // 0x00은 공백으로 처리 + if ($value < 0x0080) { // 7bit -> 1byte + return chr($value); + } + if ($value < 0x0800) { // 11bit -> 2byte ( 110xxxxx 10xxxxxx ) + return chr((($value & 0x07c0) >> 6) | 0xc0) . chr(($value & 0x3f) | 0x80); + } + // 16bit --> 3byte ( 1110xxxx 10xxxxxx 10xxxxxx ) + return chr((($value & 0xf000) >> 12) | 0xe0) + . chr((($value & 0x0fc0) >> 6) | 0x80) + . chr(($value & 0x3f) | 0x80); + } + return $matches[0]; // 번역이 안되는 놈들은 그대로 출력하자 } function unified_decode($string) { - return preg_replace_callback( - '@(%u[[:alnum:]]{4}|%[[:alnum:]]{2})@', - 'unified_decode_processor', - str_replace('+', ' ', $string) // '+'를 먼저 처리한다. - ); + return preg_replace_callback( + '@(%u[[:alnum:]]{4}|%[[:alnum:]]{2})@', + 'unified_decode_processor', + str_replace('+', ' ', $string) // '+'를 먼저 처리한다. + ); } -function tostring($text){ -return iconv('UTF-16LE', 'UTF-8', chr(hexdec(substr($text[1], 2, 2))).chr(hexdec(substr($text[1], 0, 2)))); +function tostring($text) +{ + return iconv('UTF-16LE', 'UTF-8', chr(hexdec(substr($text[1], 2, 2))) . chr(hexdec(substr($text[1], 0, 2)))); } -function urlutfchr($text){ -return urldecode(preg_replace_callback('/%u([[:alnum:]]{4})/', 'tostring', $text)); +function urlutfchr($text) +{ + return urldecode(preg_replace_callback('/%u([[:alnum:]]{4})/', 'tostring', $text)); } -function bringSearchWord($originalURL,$originalHost){ - $matches = array(); - $decodedURL = ''; - $decodedKeyword = ''; +function bringSearchWord($originalURL, $originalHost) +{ + $matches = array(); + $decodedURL = ''; + $decodedKeyword = ''; // $originalURL = urlutfchr($originalURL); if(preg_match('/\W(q|query|k|keyword|search|stext|nlia|aqa|wd)(?:=|%3D)([^&]+)/i', $originalURL, $matches)){ $decodedKeyword = unified_decode($matches[2]); @@ -123,293 +128,294 @@ function bringSearchWord($originalURL,$originalHost){ function refererkeyword() { -global $pluginMenuURL, $pluginSelfParam, $configVal; - -$more = false; - - if (defined('TEXTCUBE_NAME')) { - requireComponent('Textcube.Model.Statistics'); - requireComponent('Textcube.Function.misc'); - } else { - requireComponent('Tattertools.Model.Statistics'); - requireComponent('Tattertools.Function.misc'); - } - - $data = Setting::fetchConfigVal( $configVal); - - - $showURL = 0; - $limitRank = 5; - $Filtering = array(); - - if( !is_null( $data ) ){ - $showURL = $data['showURL']; - $limitRank = $data['limitRank']; - $Filtering = preg_split("/[\s,]+/",$data['WordFiltering']); - } - -if (!empty($_POST['showURL'])) $showURL = $_POST['showURL']; - -if (!empty($_POST['showKeywordlistLight'])) $limitRank = $_POST['showKeywordlistLight']; - - - - -$refereres = Statistics::getRefererLogs(); -$keywordlist = array(); -$wordlist = array(); -$record = array(); -$refererURL = array(); -$totalpassedkeyword = 0; - -for ($i=0; $i -

- -
-
- - : - - : - - : - - : - 0) { -?> - - : - - : - -
-
-
- - -
-
- - - -
-
-
- - - -
- - - - - - - - - - - -
- 50) $cloudstyle[$i] = "cloud1"; - elseif (($wordlist[$wordwork]) > 25) $cloudstyle[$i] = "cloud2"; - elseif (($wordlist[$wordwork]) > 15) $cloudstyle[$i] = "cloud3"; - elseif (($wordlist[$wordwork]) > 6) $cloudstyle[$i] = "cloud4"; - else $cloudstyle[$i] = "cloud5"; - $i++; -} -if (count($wordkeys) <= 10) {$wordlist = $original_wordlist; $wordkeys = array_keys($wordlist);} - -//shuffle ($wordkeys); -$beforewordvalue = ''; -$wordrank = 0; - - -for ($i=0; $i".htmlspecialchars($wordkey)."  "; -} -?> -
-
- - - - -
- - - - - - - - - - +

+

+ +
+
+ + : + + : + + : + + : + 0) { + ?> + + : + + : + +
+
+
+ + +
+
+ + + +
+ +
+ + + +
+
+ + + + + + + + + + +
+ 50) $cloudstyle[$i] = "cloud1"; + elseif (($wordlist[$wordwork]) > 25) $cloudstyle[$i] = "cloud2"; + elseif (($wordlist[$wordwork]) > 15) $cloudstyle[$i] = "cloud3"; + elseif (($wordlist[$wordwork]) > 6) $cloudstyle[$i] = "cloud4"; + else $cloudstyle[$i] = "cloud5"; + $i++; + } + if (count($wordkeys) <= 10) { + $wordlist = $original_wordlist; + $wordkeys = array_keys($wordlist); + } + + //shuffle ($wordkeys); + $beforewordvalue = ''; + $wordrank = 0; + + + for ($i = 0; $i < sizeof($wordlist); $i++) { + $wordkey = $wordkeys[$i]; + $wordvalue = $wordlist[$wordkey]; + $wordkey = str_replace("\"", """, $wordkeys[$i]); + if ($wordvalue != $beforewordvalue) { + if ($wordrank == 15) break; + $wordrank++; + $beforewordvalue = $wordvalue; + } + + $wordclassName = ($i % 2) == 1 ? 'even-line' : 'odd-line'; + $wordclassName .= ($i == sizeof($wordlist) - 1) ? ' last-line' : ''; + + echo "" . htmlspecialchars($wordkey) . "  "; + } + ?> +
+
+ + + + +
+ + + + + + + + + + = 6 && $limitRank == 5) break; - if ($rankcount >= 11 && $limitRank == 10) break; - if ($rankcount >= 16 && $limitRank == 15) break; - } - - $RefererURLthiskeyword = $refererURL[$keywordkey]; - if ($eversamerankTotal[$rankcount] == 1) $viewSameRank = ''; - else $viewSameRank = " (".$samerank."/".$eversamerankTotal[$rankcount].")"; - -?> - - - - - - - - - - - - - -
-".Utils_Unicode::lessenAsEm(htmlspecialchars($decodeURL), 90).""; - $j++; - } - - }?> -
-
-
+ if ($keywordvalue != $beforekeywordvalue) { + $rankcount++; + $beforekeywordvalue = $keywordvalue; + $samerank = 1; + } else $samerank++; + + if ($limitRank != 3939) { + if ($rankcount >= 6 && $limitRank == 5) break; + if ($rankcount >= 11 && $limitRank == 10) break; + if ($rankcount >= 16 && $limitRank == 15) break; + } + + $RefererURLthiskeyword = $refererURL[$keywordkey]; + if ($eversamerankTotal[$rankcount] == 1) $viewSameRank = ''; + else $viewSameRank = " (" . $samerank . "/" . $eversamerankTotal[$rankcount] . ")"; + + ?> + + + + + + + + + + + " . UTF8::lessenAsEm(htmlspecialchars($decodeURL), 90) . ""; + $j++; + } + + } ?> + + + + + + +
diff --git a/plugins/refererkeyword/index.xml b/plugins/refererkeyword/index.xml index f178a2fc2..4c3e6d653 100644 --- a/plugins/refererkeyword/index.xml +++ b/plugins/refererkeyword/index.xml @@ -4,7 +4,7 @@ 리퍼러 검색어 통계 キーワード統計 http://forum.tattersite.com/ko/ - 1.2+ + 1.10.3 Keyword Statistics 리퍼러에서 검색 키워드를 추출하여 통계를 출력합니다. キーワード統計を表示します。 @@ -13,8 +13,9 @@ 태터앤프렌즈 (치리) - 1.1 - 1.5 + + 1.10.3 +