PageRenderTime 45ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/ad-codez-widget/includes/classes/utils-arrays.inc.php

https://bitbucket.org/Wallynm/iptb
PHP | 46 lines | 30 code | 0 blank | 16 comment | 4 complexity | 22addd3ff42388029b0052d5f4a0d4f6 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-1.0, GPL-2.0, GPL-3.0
  1. <?php
  2. /*
  3. Copyright: Š 2009 WebSharks, Inc. ( coded in the USA )
  4. <mailto:support@websharks-inc.com> <http://www.websharks-inc.com/>
  5. Released under the terms of the GNU General Public License.
  6. You should have received a copy of the GNU General Public License,
  7. along with this software. In the main directory, see: /licensing/
  8. If not, see: <http://www.gnu.org/licenses/>.
  9. */
  10. if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"]))
  11. exit ("Do not access this file directly.");
  12. /**/
  13. if (!class_exists ("c_ws_widget__ad_codes_utils_arrays"))
  14. {
  15. class c_ws_widget__ad_codes_utils_arrays
  16. {
  17. /*
  18. Function that extends array_unique to support multi-dimensional arrays.
  19. */
  20. public static function array_unique ($array = FALSE)
  21. {
  22. if (!is_array ($array))
  23. {
  24. return array ($array);
  25. }
  26. else /* Serialized array_unique. */
  27. {
  28. foreach ($array as &$value)
  29. {
  30. $value = serialize ($value);
  31. }
  32. /**/
  33. $array = array_unique ($array);
  34. /**/
  35. foreach ($array as &$value)
  36. {
  37. $value = unserialize ($value);
  38. }
  39. /**/
  40. return $array;
  41. }
  42. }
  43. }
  44. }
  45. ?>