PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/transposh-translation-filter-for-wordpress/widgets/flagslist/tpw_list_with_flags.php

https://bitbucket.org/lgorence/quickpress
PHP | 55 lines | 18 code | 8 blank | 29 comment | 0 complexity | 03f37a9b43eb0483e04f6cf840989f80 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /*
  3. Plugin Name: List with flags
  4. Plugin URI: http://transposh.org/
  5. Description: Widget with flags links followed by language name
  6. Author: Team Transposh
  7. Version: 1.0
  8. Author URI: http://transposh.org/
  9. License: GPL (http://www.gnu.org/licenses/gpl.txt)
  10. */
  11. /*
  12. * Transposh v0.8.3
  13. * http://transposh.org/
  14. *
  15. * Copyright 2012, Team Transposh
  16. * Licensed under the GPL Version 2 or higher.
  17. * http://transposh.org/license
  18. *
  19. * Date: Mon, 28 May 2012 14:38:35 +0300
  20. */
  21. class tpw_list_with_flags extends transposh_base_widget {
  22. /**
  23. * Instructs usage of a different .css file
  24. * @global transposh_plugin $my_transposh_plugin
  25. */
  26. static function tp_widget_css($file, $dir, $url) {
  27. wp_enqueue_style("flags/tpw_flags", "$url/widgets/flags/tpw_flags.css", array(), TRANSPOSH_PLUGIN_VER);
  28. }
  29. /**
  30. * Creates the list of flags - followed by a language name link
  31. * @global transposh_plugin $my_transposh_plugin
  32. * @param array $args - http://trac.transposh.org/wiki/WidgetWritingGuide#functiontp_widgets_doargs
  33. */
  34. static function tp_widget_do($args) {
  35. global $my_transposh_plugin;
  36. // we calculate the plugin path part, so we can link the images there
  37. $plugpath = parse_url($my_transposh_plugin->transposh_plugin_url, PHP_URL_PATH);
  38. echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
  39. foreach ($args as $langrecord) {
  40. echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
  41. transposh_utils::display_flag("$plugpath/img/flags", $langrecord['flag'], $langrecord['langorig'], false) . "</a>";
  42. echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' . "{$langrecord['langorig']}</a><br/>";
  43. }
  44. echo "</div>";
  45. }
  46. }
  47. ?>