// Mozilla-compatible Javascript by Garvin Hicking (http://www.supergarv.de) // English translation and some Javascript-Debugging done by Paul Wistrand (http://paulwistrand.com) // Spanish translation by Francisco Ortiz if (IN_serendipity !== true) { die ("Don't hack!"); } // Probe for a language include with constants. Still include defines later on, if some constants were missing $probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php'; if (file_exists($probelang)) { include $probelang; } include dirname(__FILE__) . '/lang_en.inc.php'; class serendipity_plugin_wikipedia_finder extends serendipity_plugin { function introspect(&$propbag) { $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_TITLE); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_DESC); $propbag->add('configuration', array('title', 'site', 'color', 'target', 'jswindow', 'jswindow_height', 'jswindow_width')); $propbag->add('requirements', array( 'serendipity' => '0.7', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('legal', array( 'services' => array( 'wikipedia' => array( 'url' => 'https://www.wikipedia.com/', 'desc' => 'Looks up a selected term on the Wikipedia' ) ), 'frontend' => array( 'Users can select text on the blog and look up the term on Wikipedia. When clicking the submit button, the selected text is submitted to wikipedia from the client\'s browser. Wikipedia will then be able to submit Cookies and knows the visitor\s IP.', ), 'backend' => array( ), 'cookies' => array( ), 'stores_user_input' => false, 'stores_ip' => false, 'uses_ip' => true, 'transmits_user_input' => true )); $propbag->add('version', '1.5'); $propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES')); } function introspect_config_item($name, &$propbag) { switch($name) { case 'title': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_TITLE); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_TITLE_DESC); $propbag->add('default', PLUGIN_WIKIPEDIAFINDER_TITLE); break; case 'site': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_SITE); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_SITE_DESC); $propbag->add('default', PLUGIN_WIKIPEDIAFINDER_SITE); break; case 'color': $propbag->add('type', 'select'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_COLOR); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_COLOR_DESC); $propbag->add('select_values', array('black' => PLUGIN_WIKIPEDIAFINDER_PROP_COLOR_DARK, 'white' => PLUGIN_WIKIPEDIAFINDER_PROP_COLOR_LIGHT)); $propbag->add('default', 'black'); break; case 'target': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_TARGET); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_TARGET_DESC); $propbag->add('default', ""); break; case 'jswindow': $propbag->add('type', 'boolean'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW_DESC); $propbag->add('default', "false"); break; case 'jswindow_height': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW_HEIGHT); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW_HEIGHT_DESC); $propbag->add('default', "600"); break; case 'jswindow_width': $propbag->add('type', 'string'); $propbag->add('name', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW_WIDTH); $propbag->add('description', PLUGIN_WIKIPEDIAFINDER_PROP_JSWINDOW_WIDTH_DESC); $propbag->add('default', "600"); break; default: return false; } return true; } function generate_content(&$title) { global $serendipity; $title = $this->get_config('title', PLUGIN_WIKIPEDIAFINDER_TITLE); $site = $this->get_config('site', PLUGIN_WIKIPEDIAFINDER_SITE); $color = $this->get_config('color', 'black'); $target = $this->get_config('target', ''); $jswindow = $this->get_config('jswindow', 'false'); $jswindow_height = $this->get_config('jswindow_height', '600'); $jswindow_width = $this->get_config('jswindow_width', '600'); echo ''; $plugin_dir = basename(dirname(__FILE__)); echo "
set_config("target", "s9y_wikipediafinder"); } echo " target='$target'"; } echo ">"; echo "
".PLUGIN_WIKIPEDIAFINDER_DESC."
"; } } /* vim: set sts=4 ts=4 expandtab : */ ?>