EmbedGoogleMapParser

The WordPress Core EmbedGoogleMapParser class.

Defined (1)

The class is defined in the following location(s).

/embed_google_map.php  
  1. class EmbedGoogleMapParser { 
  2.  
  3. public function parse($string, &$params) { 
  4. $arr = explode('|', $string); 
  5. $params->setAddress($arr[0]); 
  6.  
  7. foreach ( $arr as $phrase ) {  
  8. if ( strstr(strtolower($phrase), 'version:') )  
  9. {  
  10. $tpm1 = explode(':', $phrase); 
  11. $tmp1 = trim($tpm1[1], '"'); 
  12. if(strcmp(strtolower($tmp1), 'new') == 0) { 
  13. $params->setVersion("new"); 
  14. } else if(strcmp(strtolower($tmp1), 'classic') == 0) { 
  15. $params->setVersion("classic"); 
  16. } else if(strcmp(strtolower($tmp1), 'embed') == 0) { 
  17. $params->setVersion("embed"); 
  18. }  
  19.  
  20. if ( strstr(strtolower($phrase), 'zoom:') )  
  21. {  
  22. $tpm1 = explode(':', $phrase); 
  23. $params->setZoomLevel(trim($tpm1[1], '"')); 
  24.  
  25. if ( strstr(strtolower($phrase), 'height:') )  
  26. {  
  27. $tpm1 = explode(':', $phrase); 
  28. $params->setHeight(trim($tpm1[1], '"')); 
  29.  
  30. if ( strstr(strtolower($phrase), 'width:') ) 
  31. $tpm1 = explode(':', $phrase); 
  32. $params->setWidth(trim($tpm1[1], '"')); 
  33.  
  34. if ( strstr(strtolower($phrase), 'border:') )  
  35. {  
  36. $tpm1 = explode(':', $phrase); 
  37. $params->setBorder(trim($tpm1[1], '"')); 
  38. }  
  39.  
  40. if ( strstr(strtolower($phrase), 'border_style:') )  
  41. {  
  42. $tpm1 = explode(':', $phrase);  
  43. $border_style = trim($tpm1[1], '"'); 
  44. $border_style = ( preg_match('/^(none|hidden|dotted|dashed|solid|double)$/i', $border_style) ? $border_style : 'solid' ); 
  45. $params->setBorderStyle($border_style); 
  46. }  
  47.  
  48. if ( strstr(strtolower($phrase), 'border_color:') )  
  49. {  
  50. $tpm1 = explode(':', $phrase); 
  51. $params->setBorderColor(trim($tpm1[1], '"'));  
  52. }  
  53.  
  54. if ( strstr(strtolower($phrase), 'lang:') )  
  55. {  
  56. $tpm1 = explode(':', $phrase); 
  57. $params->setLanguage(trim($tpm1[1], '"')); 
  58. }  
  59.  
  60. if ( strstr(strtolower($phrase), 'link:') ) 
  61. $tpm1 = explode(':', $phrase); 
  62. $tmp1 = trim($tpm1[1], '"'); 
  63. if(strcmp(strtolower($tmp1), 'yes') == 0) { 
  64. $params->setAddLink(1); 
  65. } else { 
  66. $params->setAddLink(0); 
  67.  
  68. if ( strstr(strtolower($phrase), 'link_label:') )  
  69. {  
  70. $tpm1 = explode(':', $phrase); 
  71. $params->setLinkLabel(trim($tpm1[1], '"')); 
  72.  
  73. if ( strstr(strtolower($phrase), 'https:') ) 
  74. $tpm1 = explode(':', $phrase); 
  75. $tmp1 = trim($tpm1[1], '"'); 
  76. if(strcmp(strtolower($tmp1), 'yes') == 0) { 
  77. $params->setHttps(1); 
  78. } else { 
  79. $params->setHttps(0); 
  80. }  
  81.  
  82. if ( strstr(strtolower($phrase), 'type:') ) 
  83. $tpm1 = explode(':', $phrase); 
  84. $tmp1 = trim($tpm1[1], '"'); 
  85. if(strcmp(strtolower($tmp1), 'normal') == 0) { 
  86. $params->setMapType("m"); 
  87. } else if(strcmp(strtolower($tmp1), 'satellite') == 0) { 
  88. $params->setMapType("k"); 
  89. } else if(strcmp(strtolower($tmp1), 'hybrid') == 0) { 
  90. $params->setMapType("h"); 
  91. } else if(strcmp(strtolower($tmp1), 'terrain') == 0) { 
  92. $params->setMapType("p"); 
  93. }  
  94. }  
  95.  
  96. if ( strstr(strtolower($phrase), 'link_full:') ) 
  97. $tpm1 = explode(':', $phrase); 
  98. $tmp1 = trim($tpm1[1], '"'); 
  99. if(strcmp(strtolower($tmp1), 'yes') == 0) { 
  100. $params->setLinkFull(1); 
  101. } else { 
  102. $params->setLinkFull(0); 
  103.  
  104. if ( strstr(strtolower($phrase), 'show_info:') ) 
  105. $tpm1 = explode(':', $phrase); 
  106. $tmp1 = trim($tpm1[1], '"'); 
  107. if(strcmp(strtolower($tmp1), 'yes') == 0) { 
  108. $params->setShowInfo(1); 
  109. } else { 
  110. $params->setShowInfo(0); 
  111.  
  112. if ( strstr(strtolower($phrase), 'info_label:') )  
  113. {  
  114. $tpm1 = explode(':', $phrase); 
  115. $params->setInfoLabel(trim($tpm1[1], '"')); 
  116. }