PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/lgorence/quickpress
PHP | 51 lines | 16 code | 7 blank | 28 comment | 0 complexity | 9e8cb6d6c514fbe988e2b9a9efa9764b MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /*
  3. Plugin Name: List with flags (CSS)
  4. Plugin URI: http://transposh.org/
  5. Description: Widget with flags links (using css sprites) followed by language name
  6. Author: Team Transposh
  7. Version: 1.0.1
  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_css 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_css", "$url/widgets/flags/tpw_flags_css.css", array(), TRANSPOSH_PLUGIN_VER);
  28. }
  29. /**
  30. * Creates the list of flags (using css sprites) - 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. echo "<div class=\"" . NO_TRANSLATE_CLASS . " transposh_flags\" >";
  36. foreach ($args as $langrecord) {
  37. echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' .
  38. transposh_utils::display_flag('', $langrecord['flag'], $langrecord['langorig'], true) . '</a>';
  39. echo "<a href=\"{$langrecord['url']}\"" . ($langrecord['active'] ? ' class="tr_active"' : '' ) . '>' . "{$langrecord['langorig']}</a><br/>";
  40. }
  41. echo "</div>";
  42. }
  43. }
  44. ?>