53 )); |
53 )); |
54 |
54 |
55 $paths->add_page(Array( |
55 $paths->add_page(Array( |
56 \'name\'=>\'GNU General Public License\', |
56 \'name\'=>\'GNU General Public License\', |
57 \'urlname\'=>\'GNU_General_Public_License\', |
57 \'urlname\'=>\'GNU_General_Public_License\', |
|
58 \'namespace\'=>\'Special\', |
|
59 \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
|
60 )); |
|
61 |
|
62 $paths->add_page(Array( |
|
63 \'name\'=>\'Tag cloud\', |
|
64 \'urlname\'=>\'TagCloud\', |
58 \'namespace\'=>\'Special\', |
65 \'namespace\'=>\'Special\', |
59 \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
66 \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\', |
60 )); |
67 )); |
61 '); |
68 '); |
62 |
69 |
364 echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>.</p>'; |
371 echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>.</p>'; |
365 } |
372 } |
366 $template->footer(); |
373 $template->footer(); |
367 } |
374 } |
368 |
375 |
|
376 function page_Special_TagCloud() |
|
377 { |
|
378 global $db, $session, $paths, $template, $plugins; // Common objects |
|
379 |
|
380 $template->header(); |
|
381 |
|
382 if ( $tag = $paths->getParam(0) ) |
|
383 { |
|
384 $tag = sanitize_tag($tag); |
|
385 $q = $db->sql_query('SELECT page_id, namespace FROM '.table_prefix.'tags WHERE tag_name=\'' . $db->escape($tag) . '\';'); |
|
386 if ( !$q ) |
|
387 $db->_die(); |
|
388 if ( $row = $db->fetchrow() ) |
|
389 { |
|
390 echo '<div class="tblholder"> |
|
391 <table border="0" cellspacing="1" cellpadding="4">'; |
|
392 echo '<tr><th colspan="2">Pages tagged "' . htmlspecialchars($tag) . '"</th></tr>'; |
|
393 echo '<tr>'; |
|
394 $i = 0; |
|
395 $td_class = 'row1'; |
|
396 do |
|
397 { |
|
398 if ( $i % 2 == 0 && $i > 1 ) |
|
399 { |
|
400 $td_class = ( $td_class == 'row2' ) ? 'row1' : 'row2'; |
|
401 echo '</tr><tr>'; |
|
402 } |
|
403 $i++; |
|
404 $title = get_page_title_ns($row['page_id'], $row['namespace']); |
|
405 if ( $row['namespace'] != 'Article' && isset($paths->nslist[$row['namespace']]) ) |
|
406 $title = $paths->nslist[$row['namespace']] . $title; |
|
407 $url = makeUrlNS($row['namespace'], $row['page_id']); |
|
408 $class = ( isPage( $paths->nslist[$row['namespace']] . $row['page_id'] ) ) ? '' : ' class="wikilink-nonexistent"'; |
|
409 $link = '<a href="' . htmlspecialchars($url) . '"' . $class . '>' . htmlspecialchars($title) . '</a>'; |
|
410 echo "<td class=\"$td_class\" style=\"width: 50%;\">$link</td>"; |
|
411 // " workaround for jEdit highlighting bug |
|
412 } |
|
413 while ( $row = $db->fetchrow() ); |
|
414 while ( $i % 2 > 0 ) |
|
415 { |
|
416 $i++; |
|
417 echo "<td class=\"$td_class\" style=\"width: 50%;\"></td>"; |
|
418 } |
|
419 // " workaround for jEdit highlighting bug |
|
420 echo '<tr> |
|
421 <th colspan="2" class="subhead"><a href="' . makeUrlNS('Special', 'TagCloud') . '" style="color: white;">« Return to tag cloud</a></th> |
|
422 </tr>'; |
|
423 echo '</table>'; |
|
424 echo '</div>'; |
|
425 } |
|
426 } |
|
427 else |
|
428 { |
|
429 $cloud = new TagCloud(); |
|
430 |
|
431 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
432 if ( !$q ) |
|
433 $db->_die(); |
|
434 if ( $db->numrows() < 1 ) |
|
435 { |
|
436 echo '<p>No pages are tagged yet.</p>'; |
|
437 } |
|
438 else |
|
439 { |
|
440 echo '<h3>Summary of page tagging</h3>'; |
|
441 while ( $row = $db->fetchrow() ) |
|
442 { |
|
443 $cloud->add_word($row['tag_name']); |
|
444 } |
|
445 echo $cloud->make_html('normal'); |
|
446 echo '<p>Hover your mouse over a tag to see how many pages have the tag. Click on a tag to see a list of the pages that have it.</p>'; |
|
447 } |
|
448 } |
|
449 |
|
450 $template->footer(); |
|
451 } |
|
452 |
|
453 // tag cloud sidebar block |
|
454 function sidebar_add_tag_cloud() |
|
455 { |
|
456 global $db, $session, $paths, $template, $plugins; // Common objects |
|
457 $cloud = new TagCloud(); |
|
458 |
|
459 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
|
460 if ( !$q ) |
|
461 $db->_die(); |
|
462 if ( $db->numrows() < 1 ) |
|
463 { |
|
464 $sb_html = 'No pages are tagged yet.'; |
|
465 } |
|
466 else |
|
467 { |
|
468 while ( $row = $db->fetchrow() ) |
|
469 { |
|
470 $cloud->add_word($row['tag_name']); |
|
471 } |
|
472 $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">Larger version</a>'; |
|
473 } |
|
474 $template->sidebar_widget('Tag cloud', "<div style='padding: 5px;'>$sb_html</div>"); |
|
475 } |
|
476 |
|
477 $plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();'); |
|
478 |
369 ?> |
479 ?> |