Dotclear

source: plugins/dcWikipedia/popup.php @ 1107

Revision 1107, 1.8 KB checked in by Tomtom33, 14 years ago (diff)

dcWikipedia 0.1.1 :

  • Fixed typo
  • Minifed *.js and *.css
  • Property svn:executable set to *
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of dcWikipedia, a plugin for Dotclear.
4#
5# Copyright (c) 2009 Tomtom
6# http://blog.zenstyle.fr/
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13$value = isset($_GET['value']) ? rawurldecode($_GET['value']) : '';
14$lang = isset($_GET['lang']) ? rawurldecode($_GET['lang']) : '';
15
16$parser = dcWikipediaReader::quickParse('http://'.$lang.'.wikipedia.org/w/api.php?action=opensearch&format=xml&search='.rawurlencode($value),DC_TPL_CACHE);
17
18?>
19
20<html>
21<head>
22     <title><?php echo __('dcWikipedia'); ?></title>
23     <?php echo dcPage::jsLoad(DC_ADMIN_URL.'?pf=dcWikipedia/js/popup.min.js'); ?>
24     <style type="text/css">@import '<?php echo DC_ADMIN_URL; ?>?pf=dcWikipedia/style.min.css';</style>
25</head>
26
27<body>
28<h2><?php echo __('Add a Wikipedia link'); ?></h2>
29
30<?php
31
32if (count($parser->getItems()) == 0) {
33     echo '<p>'.sprintf(__('No suggestion found for : %s'),'<q>'.$value.'</q>').'</p>';
34}
35else {
36     echo '<form id="dcwikipedia-insert-form" action="#" method="get">';
37     foreach($parser->getItems() as $v => $k) {
38          echo 
39          '<div class="dcwikipedia_item">'.
40          '<p class="wikipedia_value">'.
41          form::radio(array('dcwikipedia_uri'),$k['uri']).
42          $k['value'].'&nbsp;<a href="'.$k['uri'].
43          '" class="wikipedia_uri">('.__('Read more...').')</a></p>'.
44          '<p class="wikipedia_desc">'.$k['desc'].'</p>'.
45          '</div>'."\n";
46     }
47     echo
48     '<input type="hidden" name="dcwikipedia_value" value="'.$value.'" />'.
49     '</form>'.
50     '<p><a class="button" href="#" id="dcwikipedia-insert-cancel">'.__('cancel').'</a> - '.
51     '<strong><a class="button" href="#" id="dcwikipedia-insert-ok">'.__('insert').'</a></strong></p>'."\n";
52}
53
54?>
55
56</body>
57</html>
Note: See TracBrowser for help on using the repository browser.

Sites map