Advertisement
Potion

timezones_field.php

Feb 10th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. <?php
  2. /*
  3. Custom Contact Forms Plugin
  4. By Taylor Lovett - http://www.taylorlovett.com
  5. Plugin URL: http://www.taylorlovett.com/wordpress-plugins
  6.  
  7. Fixed field 'timezones' added by Denis Collis - denis.collis@gmail.com
  8. */
  9. if (!class_exists('ccf_timezones_field')) {
  10. class ccf_timezones_field {
  11. var $field_code;
  12.  
  13. function ccf_timezones_field($class = NULL, $id = NULL, $initial_value = NULL, $field_instructions = NULL) {
  14. $this->field_code = '';
  15. $class_attr = ($class == NULL) ? '' : $class;
  16. $id_attr = ($id == NULL) ? '' : ' id="'.$id.'" ';
  17. if ($field_instructions == NULL) {
  18. $instructions_attr = '';
  19. $tooltip_class = '';
  20. } else {
  21. $instructions_attr = ' title="'.$field_instructions.'" ';
  22. $tooltip_class = 'ccf-tooltip-field';
  23. }
  24. $this->field_code .= '<select name="timezones" class="'.$tooltip_class.' ' . $class_attr . '" ' . $id_attr . $instructions_attr . '>' . "\n";
  25. $timezones = array(
  26. '(GMT-12:00) International Date Line West',
  27. '(GMT-11:00) Midway Island, Samoa',
  28. '(GMT-10:00) Hawaii',
  29. '(GMT-09:00) Alaska',
  30. '(GMT-08:00) Pacific Time (US & Canada)',
  31. '(GMT-08:00) Tijuana, Baja California',
  32. '(GMT-07:00) Arizona',
  33. '(GMT-07:00) Chihuahua, La Paz, Mazatlan',
  34. '(GMT-07:00) Mountain Time (US & Canada)',
  35. '(GMT-06:00) Central America',
  36. '(GMT-06:00) Central Time (US & Canada)',
  37. '(GMT-06:00) Guadalajara, Mexico City, Monterrey',
  38. '(GMT-06:00) Saskatchewan',
  39. '(GMT-05:00) Bogota, Lima, Quito, Rio Branco',
  40. '(GMT-05:00) Eastern Time (US & Canada)',
  41. '(GMT-05:00) Indiana (East)',
  42. '(GMT-04:00) Atlantic Time (Canada)',
  43. '(GMT-04:00) Caracas, La Paz',
  44. '(GMT-04:00) Manaus',
  45. '(GMT-04:00) Santiago',
  46. '(GMT-03:30) Newfoundland',
  47. '(GMT-03:00) Brasilia',
  48. '(GMT-03:00) Buenos Aires',
  49. '(GMT-03:00) Georgetown',
  50. '(GMT-03:00) Greenland',
  51. '(GMT-03:00) Montevideo',
  52. '(GMT-02:00) Mid-Atlantic',
  53. '(GMT-01:00) Cape Verde Is.',
  54. '(GMT-01:00) Azores',
  55. '(GMT+00:00) Casablanca, Monrovia, Reykjavik',
  56. '(GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London',
  57. '(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna',
  58. '(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague',
  59. '(GMT+01:00) Brussels, Copenhagen, Madrid, Paris',
  60. '(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb',
  61. '(GMT+01:00) West Central Africa',
  62. '(GMT+02:00) Amman',
  63. '(GMT+02:00) Athens, Bucharest, Istanbul',
  64. '(GMT+02:00) Beirut',
  65. '(GMT+02:00) Cairo',
  66. '(GMT+02:00) Johannesburg, Cape Town, Durban, Pretoria',
  67. '(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius',
  68. '(GMT+02:00) Jerusalem',
  69. '(GMT+02:00) Minsk',
  70. '(GMT+02:00) Windhoek',
  71. '(GMT+03:00) Kuwait, Riyadh, Baghdad',
  72. '(GMT+03:00) Moscow, St. Petersburg, Volgograd',
  73. '(GMT+03:00) Nairobi',
  74. '(GMT+03:00) Tbilisi',
  75. '(GMT+03:30) Tehran',
  76. '(GMT+04:00) Abu Dhabi, Muscat',
  77. '(GMT+04:00) Baku',
  78. '(GMT+04:00) Yerevan',
  79. '(GMT+04:30) Kabul',
  80. '(GMT+05:00) Yekaterinburg',
  81. '(GMT+05:00) Islamabad, Karachi, Tashkent',
  82. '(GMT+05:30) Sri Jayawardenapura',
  83. '(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi',
  84. '(GMT+05:45) Kathmandu',
  85. '(GMT+06:00) Almaty, Novosibirsk',
  86. '(GMT+06:00) Astana, Dhaka',
  87. '(GMT+06:30) Yangon (Rangoon)',
  88. '(GMT+07:00) Bangkok, Hanoi, Jakarta',
  89. '(GMT+07:00) Krasnoyarsk',
  90. '(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi',
  91. '(GMT+08:00) Kuala Lumpur, Singapore',
  92. '(GMT+08:00) Irkutsk, Ulaan Bataar',
  93. '(GMT+08:00) Perth',
  94. '(GMT+08:00) Taipei',
  95. '(GMT+09:00) Osaka, Sapporo, Tokyo',
  96. '(GMT+09:00) Seoul',
  97. '(GMT+09:00) Yakutsk',
  98. '(GMT+09:30) Adelaide, Darwin',
  99. '(GMT+10:00) Brisbane, Canberra, Melbourne, Sydney, Hobart',
  100. '(GMT+10:00) Guam, Port Moresby',
  101. '(GMT+10:00) Vladivostok',
  102. '(GMT+11:00) Magadan, Solomon Is., New Caledonia',
  103. '(GMT+12:00) Auckland, Wellington',
  104. '(GMT+12:00) Fiji, Kamchatka, Marshall Is.',
  105. '(GMT+13:00) Nuku\'alofa'
  106. );
  107. foreach ($timezones as $timezone) {
  108. if ($initial_value != NULL && $timezone == $initial_value)
  109. $this->field_code .= '<option selected="selected">' . $timezone . '</option>' . "\n";
  110. else
  111. $this->field_code .= '<option>' . $timezone . '</option>' . "\n";
  112. }
  113. $this->field_code .= '</select>';
  114. }
  115.  
  116. function getCode() {
  117. return $this->field_code;
  118. }
  119. }
  120. }
  121. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement