/** * Facebook LikeBox Plugin * ------------------------------------------- * ./plugin/fb_likebox.inc.php * * Copyright (c) 2015 hokuken * http://hokuken.com/ * * created : 2015-06-11 * modified : * * Put Facebook Page Plugin * * Usage : #fb_pagebox * */ function plugin_fb_pagebox_init() { if (!exist_plugin("fb_root")) { die('Fatal error: fb_root plugin not found'); } do_plugin_init("fb_root"); }
/** * Facebook Inframe Page Plugin * ------------------------------------------- * fb_page.inc.php * * Copyright (c) 2011 hokuken * http://hokuken.com/ * * created : 2011-07-26 * modified : * * 「いいね!」ボタンを押した人だけ見られるページにできる * * Usage : * */ function plugin_fb_page_init() { if (!exist_plugin("fb_root")) { die('Cannot find fb_root plugin'); } do_plugin_init("fb_root"); }
function plugin_monobook_navigation($wikinote, $tabs, $background) { global $vars, $plugin, $_monobook_navigation_messages; if (!exist_plugin('monobook_getlink')) { die('monobook_getlink plugin not found'); } do_plugin_init('monobook_navigation'); $main_tabs = ''; if ($wikinote->is_effect()) { $main_tabs = str_replace(array('<ul class="wikinote">', '</ul>', "\n"), '', $wikinote->show_tabs(array(array('cmd' => 'main', 'label' => $_monobook_navigation_messages['article']), array('cmd' => 'note', 'label' => $_monobook_navigation_messages['discuss'])))); } $sub_tabs = ''; $selected_flag = FALSE; foreach ($tabs as $tab) { if ($tab === 'edit' && is_freeze($vars['page']) && !in_array('source', $tabs)) { $tab = 'source'; } if ($tab === 'edit' && $plugin === 'paraedit') { $tab = 'paraedit'; } if ($tab === 'edit' && exist_plugin('revert') && plugin_revert_getlink()) { $tab = 'revert'; } list($link, $selected) = plugin_monobook_getlink($tab, $_monobook_navigation_messages, TRUE); if (!$link) { continue; } if ($selected) { $sub_tabs .= '<li class="selected">' . $link . '</li>'; $selected_flag = TRUE; } else { $sub_tabs .= '<li>' . $link . '</li>'; } } if (!$selected_flag) { $link = plugin_monobook_getlink('nowplugin', $_monobook_navigation_messages); if (!$main_tabs) { if ($link) { $sub_tabs = '<li class="selected" id="separate">' . $link . '</li>' . $sub_tabs; } else { $sub_tabs = '<li class="selected"><a href="' . get_script_uri() . strrchr($_SERVER['REQUEST_URI'], '?') . '">' . $_monobook_navigation_messages['undefined'] . '</a></li>'; } } elseif ($main_tabs && !arg_check('read') && $link) { $sub_tabs = '<li class="selected">' . $link . '</li>' . $sub_tabs; } } return '<div id="navigator"><ul' . $background . '>' . $main_tabs . $sub_tabs . '</ul></div>' . "\n"; }
function catbody($title, $page, $body) { global $script; // MUST BE SKIN.FILE. Do not delete line. global $vars, $arg, $defaultpage, $whatsnew, $help_page, $hr; global $attach_link, $related_link, $function_freeze; global $search_word_color, $foot_explain, $note_hr, $head_tags, $foot_tags; global $trackback, $referer, $javascript; global $newtitle, $newbase, $language, $use_local_time; // Plus! skin extension global $nofollow; global $_LANG, $_LINK, $_IMAGE; global $pkwk_dtd; // XHTML 1.1, XHTML1.0, HTML 4.01 Transitional... global $page_title; // Title of this site global $do_backup; // Do backup or not global $modifier; // Site administrator's web page global $modifierlink; // Site administrator's name global $skin_file, $menubar, $sidebar; global $_string; if (!defined('SKIN_FILE') || !file_exists(SKIN_FILE) || !is_readable(SKIN_FILE)) { if (!file_exists($skin_file) || !is_readable($skin_file)) { die_message(SKIN_FILE . '(skin file) is not found.'); } else { define('SKIN_FILE', $skin_file); } } $_LINK = $_IMAGE = array(); // Add JavaScript header when ... if (!PKWK_ALLOW_JAVASCRIPT) { unset($javascript); } $_page = isset($vars['page']) ? $vars['page'] : ''; $r_page = rawurlencode($_page); // Set $_LINK for skin $_LINK['add'] = get_cmd_uri('add', $_page); $_LINK['backup'] = get_cmd_uri('backup', $_page); $_LINK['brokenlink'] = get_cmd_uri('brokenlink', $_page); $_LINK['copy'] = get_cmd_uri('template', '', '', 'refer=' . $r_page); $_LINK['diff'] = get_cmd_uri('diff', $_page); $_LINK['edit'] = get_cmd_uri('edit', $_page); $_LINK['guiedit'] = get_cmd_uri('guiedit', $_page); $_LINK['filelist'] = get_cmd_uri('filelist'); $_LINK['freeze'] = get_cmd_uri('freeze', $_page); $_LINK['help'] = get_cmd_uri('help'); $_LINK['linklist'] = get_cmd_uri('linklist', $_page); $_LINK['list'] = get_cmd_uri('list'); $_LINK['log_login'] = get_cmd_uri('logview', '', '', 'kind=login'); $_LINK['log_browse'] = get_cmd_uri('logview', $_page, '', 'kind=browse'); $_LINK['log_update'] = get_cmd_uri('logview', $_page); $_LINK['log_down'] = get_cmd_uri('logview', $_page, '', 'kind=download'); $_LINK['log_check'] = get_cmd_uri('logview', $_page, '', 'kind=check'); $_LINK['menu'] = get_page_uri($menubar); $_LINK['new'] = get_cmd_uri('newpage', '', '', 'refer=' . $r_page); $_LINK['newsub'] = get_cmd_uri('newpage_subdir', '', '', 'directory=' . $r_page); $_LINK['print'] = get_cmd_uri('print', $_page); $_LINK['full'] = get_cmd_uri('print', $_page) . '&nohead&nofoot'; $_LINK['read'] = get_page_uri($_page); $_LINK['recent'] = get_page_uri($whatsnew); $_LINK['refer'] = get_cmd_uri('referer', $_page); $_LINK['reload'] = get_page_absuri($_page); // 本当は、get_script_uri でいいけど、絶対パスでないと、スキンに影響が出る $_LINK['reload_rel'] = get_page_uri($_page); $_LINK['rename'] = get_cmd_uri('rename', '', '', 'refer=' . $r_page); $_LINK['skeylist'] = get_cmd_uri('skeylist', $_page); $_LINK['search'] = get_cmd_uri('search'); $_LINK['side'] = get_page_uri($sidebar); $_LINK['source'] = get_cmd_uri('source', $_page); $_LINK['template'] = get_cmd_uri('template', '', '', 'refer=' . $r_page); $_LINK['top'] = get_page_uri($defaultpage); if ($trackback) { $tb_id = tb_get_id($_page); $_LINK['trackback'] = get_cmd_uri('tb', '', '', '__mode=view&tb_id=' . $tb_id); } $_LINK['unfreeze'] = get_cmd_uri('unfreeze', $_page); $_LINK['upload'] = get_cmd_uri('attach', $_page, '', 'pcmd=upload'); // link rel="alternate" にも利用するため absuri にしておく $_LINK['rdf'] = get_cmd_absuri('rss', '', 'ver=1.0'); $_LINK['rss'] = get_cmd_absuri('rss'); $_LINK['rss10'] = get_cmd_absuri('rss', '', 'ver=1.0'); // Same as 'rdf' $_LINK['rss20'] = get_cmd_absuri('rss', '', 'ver=2.0'); $_LINK['mixirss'] = get_cmd_absuri('mixirss'); // Same as 'rdf' for mixi // Compat: Skins for 1.4.4 and before $link_add =& $_LINK['add']; $link_backup =& $_LINK['backup']; $link_brokenlink =& $_LINK['brokenlink']; $link_template =& $_LINK['copy']; $link_diff =& $_LINK['diff']; $link_edit =& $_LINK['edit']; $link_guiedit =& $_LINK['guiedit']; $link_filelist =& $_LINK['filelist']; $link_freeze =& $_LINK['freeze']; $link_help =& $_LINK['help']; $link_linklist =& $_LINK['linklist']; $link_list =& $_LINK['list']; $link_log_login =& $_LINK['log_login']; $link_log_browse =& $_LINK['log_browse']; $link_log_update =& $_LINK['log_update']; $link_log_down =& $_LINK['log_down']; $link_log_check =& $_LINK['log_check']; $link_menu =& $_LINK['menu']; $link_new =& $_LINK['new']; $link_newsub =& $_LINK['newsub']; $link_print =& $_LINK['print']; $link_full =& $_LINK['full']; $link_read =& $_LINK['read']; $link_whatsnew =& $_LINK['recent']; $link_refer =& $_LINK['refer']; $link_reload =& $_LINK['reload']; $link_reload_rel =& $_LINK['reload_rel']; $link_rename =& $_LINK['rename']; $link_skeylist =& $_LINK['skeylist']; $link_search =& $_LINK['search']; $link_side =& $_LINK['side']; $link_source =& $_LINK['source']; $link_top =& $_LINK['top']; if ($trackback) { $link_trackback =& $_LINK['trackback']; } $link_unfreeze =& $_LINK['unfreeze']; $link_upload =& $_LINK['upload']; // $link_rdf =& $_LINK['rdf']; $link_rss =& $_LINK['rss']; $link_rss10 =& $_LINK['rss10']; $link_rss20 =& $_LINK['rss20']; $link_mixirss =& $_LINK['mixirss']; // Init flags $is_page = is_pagename($_page) && !arg_check('backup') && !is_cantedit($_page); $is_read = arg_check('read') && is_page($_page); $is_freeze = is_freeze($_page); // Last modification date (string) of the page $lastmodified = $is_read ? get_date('D, d M Y H:i:s T', get_filetime($_page)) . ' ' . get_pg_passage($_page, FALSE) : ''; // List of attached files to the page $attaches = ''; if ($attach_link && $is_read && exist_plugin_action('attach')) { if (do_plugin_init('attach') !== FALSE) { $attaches = attach_filelist(); } } // List of related pages $related = $related_link && $is_read ? make_related($_page) : ''; // List of footnotes ksort($foot_explain, SORT_NUMERIC); $notes = !empty($foot_explain) ? $note_hr . join("\n", $foot_explain) : ''; // Tags will be inserted into <head></head> $head_tag = !empty($head_tags) ? join("\n", $head_tags) . "\n" : ''; $foot_tag = !empty($foot_tags) ? join("\n", $foot_tags) . "\n" : ''; // 1.3.x compat // Last modification date (UNIX timestamp) of the page $fmt = $is_read ? get_filetime($_page) : 0; // Search words if ($search_word_color && isset($vars['word'])) { $body = '<div class="small">' . $_string['word'] . htmlspecialchars($vars['word']) . '</div>' . $hr . "\n" . $body; // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 $words = preg_split('/\\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY); $words = array_splice($words, 0, 10); // Max: 10 words $words = array_flip($words); $keys = array(); foreach ($words as $word => $id) { $keys[$word] = strlen($word); } arsort($keys, SORT_NUMERIC); $keys = get_search_words(array_keys($keys), TRUE); $id = 0; foreach ($keys as $key => $pattern) { $s_key = htmlspecialchars($key); $pattern = '/' . '<textarea[^>]*>.*?<\\/textarea>' . '|' . '<[^>]*>' . '|' . '&[^;]+;' . '|' . '(' . $pattern . ')' . '/sS'; $decorate_Nth_word = create_function('$matches', 'return (isset($matches[1])) ? ' . '\'<strong class="word' . $id . '">\' . $matches[1] . \'</strong>\' : ' . '$matches[0];'); $body = preg_replace_callback($pattern, $decorate_Nth_word, $body); $notes = preg_replace_callback($pattern, $decorate_Nth_word, $notes); ++$id; } } // Compat: 'HTML convert time' without time about MenuBar and skin $taketime = elapsedtime(); require SKIN_FILE; }
function do_plugin_inline($name, $args, &$body) { global $digest; if (do_plugin_init($name) === FALSE) { return '[Plugin init failed: ' . $name . ']'; } if ($args !== '') { $aryargs = csv_explode(',', $args); } else { $aryargs = array(); } // NOTE: A reference of $body is always the last argument $aryargs[] =& $body; // func_num_args() != 0 $_digest = $digest; $retvar = call_user_func_array('plugin_' . $name . '_inline', $aryargs); $digest = $_digest; // Revert if ($retvar === FALSE) { // Do nothing return htmlsc('&' . $name . ($args ? '(' . $args . ')' : '') . ';'); } else { return $retvar; } }
function make_tooltips($term, $glossary_page = '') { global $script, $ajax; static $tooltip_initialized = FALSE; if (!exist_plugin('tooltip')) { return FALSE; } if (!$tooltip_initialized) { if (do_plugin_init('tooltip') === FALSE) { return FALSE; } $tooltip_initialized = TRUE; } $glossary = plugin_tooltip_get_glossary($term, $glossary_page, FALSE); if ($glossary === FALSE) { $glossary = plugin_tooltip_get_page_title($term); if ($glossary === FALSE) { $glossary = ''; } } $s_term = str_replace("'", "\\'", htmlspecialchars($term)); $s_glossary = htmlspecialchars($glossary); $page = strip_bracket($term); if (is_page($page)) { $passage = get_pg_passage($page, FALSE); return '<a href="' . get_page_uri($page) . '" class="linktip" title="' . $s_glossary . $passage . '">' . $term . '</a>'; } elseif ($ajax) { return '<span class="tooltip"' . ' onmouseover="' . "javascript:this.style.backgroundColor='#ffe4e1';showGlossaryPopup('" . $script . "?plugin=tooltip&q=" . $s_term . "',event,0.2);" . '"' . ' onmouseout="' . "javascript:this.style.backgroundColor='transparent';" . '">' . $term . '</span>'; } else { return '<span class="tooltip" title="' . $s_glossary . '"' . ' onmouseover="javascript:this.style.backgroundColor=\'#ffe4e1\';"' . ' onmouseout="javascript:this.style.backgroundColor=\'transparent\';">' . $term . '</span>'; } }
function do_plugin_inline($name,$args,$body) { global $digest; // digestを退避 $_digest = $digest; $aryargs = ($args !== '') ? explode(',',$args) : array(); $aryargs[] =& $body; do_plugin_init($name); $retvar = call_user_func_array('plugin_'.$name.'_inline',$aryargs); // digestを復元 $digest = $_digest; if($retvar === FALSE) { return htmlspecialchars("&${name}" . ($args ? "($args)" : '') . ';'); } return $retvar; }
function submitham_action() { global $vars, $post, $get; $error = NULL; if (PLUGIN_AKISMET_USE_RECAPTCHA) { // was there a reCAPTCHA response? if (isset($post["recaptcha_response_field"])) { $resp = recaptcha_check_answer(PLUGIN_AKISMET_RECAPTCHA_PRIVATE_KEY, $_SERVER["REMOTE_ADDR"], $post["recaptcha_challenge_field"], $post["recaptcha_response_field"]); $error = $resp->error; $captcha_valid = $resp->is_valid; // If no response from reCAPTCHA, Assume as valid. } else { $captcha_valid = TRUE; if (PLUGIN_AKISMET_RECAPTCHA_LOG) { PluginAkismet::spamlog_write($vars, array('body' => 'reCaptcha invalid'), LOG_DIR . 'captchalog.txt'); } } } $comment = $vars['comment']; $vars = $vars['vars']; if ($captcha_valid) { if (PLUGIN_AKISMET_RECAPTCHA_LOG) { PluginAkismet::spamlog_write($vars, array('body' => 'break'), LOG_DIR . 'captchalog.txt'); } // Memorize the user is human because he could pass captcha $use_authlevel = PLUGIN_AKISMET_THROUGH_IF_ENROLLEE ? ROLE_AUTH : (PLUGIN_AKISMET_THROUGH_IF_ADMIN ? ROLE_ADM_CONTENTS : 0); is_human(TRUE, PLUGIN_AKISMET_USE_SESSION, $use_authlevel); // set to session // submitHam if (PLUGIN_AKISMET_USE_AKISMET) { $akismet = new Akismet(get_script_uri(), PLUGIN_AKISMET_API_KEY, $comment); $akismet->submitHam(); } // autopost if (PLUGIN_AKISMET_AUTOPOST_AFTER_SUBMITHAM) { // throw to originally called plugin // refer lib/pukiwiki.php $cmd = isset($vars['cmd']) ? $vars['cmd'] : (isset($vars['plugin']) ? $vars['plugin'] : 'read'); if (exist_plugin_action($cmd)) { $post = $vars; $get = array(); do_plugin_init($cmd); return do_plugin_action($cmd); } else { $msg = 'plugin=' . htmlspecialchars($cmd) . ' is not implemented.'; return array('msg' => $msg, 'body' => $msg); } } else { $body = '<p>スパム取り消し報告を行いました。以下がスパムと判断された投稿内容です。再度投稿してください。</p>' . "\n"; $body .= '<div class="ie5"><table class="style_table" cellspacing="1" border="0"><tbody>' . "\n"; foreach ($vars as $key => $val) { $body .= '<tr>' . "\n"; $body .= ' <td class="style_td">' . htmlspecialchars($key) . '<td>' . "\n"; $body .= ' <td class="style_td">' . htmlspecialchars($val) . '<td>' . "\n"; $body .= '</tr>' . "\n"; } $body .= '</tbody></table></div>' . "\n"; return array('msg' => 'キャプチャ認証', 'body' => $body); } } else { $form = PluginAkismet::get_captcha_form($vars, $comment, $error); return array('msg' => 'キャプチャ認証', 'body' => $form); } }