Overview

Packages

  • admin
  • classes
    • media
  • CodeIgniter
    • Libraries
  • core
  • functions
  • JSMin
  • None
  • OpenID
  • PHP
  • PHPMailer
  • plugins
    • admin
    • development
    • feed
    • mail
    • media
    • misc
    • seo
    • spam
    • uploader
    • users
    • zenpage
    • zenphoto
      • news
  • Services
    • JSON

Classes

  • _zp_captcha
  • _zp_HTML_cache
  • admin_approval
  • Album
  • AlbumBase
  • AlbumZip
  • AMFReader
  • AMFStream
  • AnyFile
  • AnyFile_Options
  • Auth_OpenID
  • Auth_OpenID_AlreadySigned
  • Auth_OpenID_AssociateRequest
  • Auth_OpenID_Association
  • Auth_OpenID_AuthRequest
  • Auth_OpenID_AX
  • Auth_OpenID_AX_AttrInfo
  • Auth_OpenID_AX_Error
  • Auth_OpenID_AX_FetchRequest
  • Auth_OpenID_AX_FetchResponse
  • Auth_OpenID_AX_KeyValueMessage
  • Auth_OpenID_AX_Message
  • Auth_OpenID_AX_StoreRequest
  • Auth_OpenID_AX_StoreResponse
  • Auth_OpenID_BcMathWrapper
  • Auth_OpenID_CancelResponse
  • Auth_OpenID_CheckAuthRequest
  • Auth_OpenID_CheckIDRequest
  • Auth_OpenID_Consumer
  • Auth_OpenID_ConsumerResponse
  • Auth_OpenID_CryptUtil
  • Auth_OpenID_DatabaseConnection
  • Auth_OpenID_Decoder
  • Auth_OpenID_DiffieHellman
  • Auth_OpenID_DiffieHellmanSHA1ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA1ServerSession
  • Auth_OpenID_DiffieHellmanSHA256ConsumerSession
  • Auth_OpenID_DiffieHellmanSHA256ServerSession
  • Auth_OpenID_DumbStore
  • Auth_OpenID_Encoder
  • Auth_OpenID_EncodingError
  • Auth_OpenID_Extension
  • Auth_OpenID_FailureResponse
  • Auth_OpenID_FileStore
  • Auth_OpenID_GenericConsumer
  • Auth_OpenID_GmpMathWrapper
  • Auth_OpenID_KVForm
  • Auth_OpenID_MalformedReturnURL
  • Auth_OpenID_MalformedTrustRoot
  • Auth_OpenID_Mapping
  • Auth_OpenID_MathLibrary
  • Auth_OpenID_MDB2Store
  • Auth_OpenID_MemcachedStore
  • Auth_OpenID_Message
  • Auth_OpenID_MySQLStore
  • Auth_OpenID_NamespaceMap
  • Auth_OpenID_NoReturnToError
  • Auth_OpenID_OpenIDStore
  • Auth_OpenID_PAPE_Request
  • Auth_OpenID_PAPE_Response
  • Auth_OpenID_Parse
  • Auth_OpenID_PlainTextConsumerSession
  • Auth_OpenID_PlainTextServerSession
  • Auth_OpenID_PostgreSQLStore
  • Auth_OpenID_Request
  • Auth_OpenID_Server
  • Auth_OpenID_ServerError
  • Auth_OpenID_ServerErrorContainer
  • Auth_OpenID_ServerRequest
  • Auth_OpenID_ServerResponse
  • Auth_OpenID_ServiceEndpoint
  • Auth_OpenID_ServiceEndpointLoader
  • Auth_OpenID_SessionNegotiator
  • Auth_OpenID_SetupNeededResponse
  • Auth_OpenID_Signatory
  • Auth_OpenID_SigningEncoder
  • Auth_OpenID_SQLiteStore
  • Auth_OpenID_SQLStore
  • Auth_OpenID_SRegBase
  • Auth_OpenID_SRegRequest
  • Auth_OpenID_SRegResponse
  • Auth_OpenID_SuccessResponse
  • Auth_OpenID_TrustRoot
  • Auth_OpenID_TypeURIMismatch
  • Auth_OpenID_UntrustedReturnURL
  • Auth_OpenID_WebResponse
  • Auth_Yadis_Discovery
  • Auth_Yadis_DiscoveryResult
  • Auth_Yadis_dom
  • Auth_Yadis_domxml
  • Auth_Yadis_HTTPFetcher
  • Auth_Yadis_HTTPResponse
  • Auth_Yadis_Manager
  • Auth_Yadis_ManagerLoader
  • Auth_Yadis_ParanoidHTTPFetcher
  • Auth_Yadis_ParseHTML
  • Auth_Yadis_PHPSession
  • Auth_Yadis_PlainHTTPFetcher
  • Auth_Yadis_ProxyResolver
  • Auth_Yadis_Service
  • Auth_Yadis_SessionLoader
  • Auth_Yadis_XMLParser
  • Auth_Yadis_XRDS
  • Auth_Yadis_Yadis
  • auto_backup
  • AVCSequenceParameterSetReader
  • bxslider
  • cacheManager
  • cacheManagerFeed
  • CI_jsmin
  • CI_load
  • cloneZenphoto
  • codeIgniter_kludge
  • colorbox
  • Comment
  • comment_form
  • contactformOptions
  • crop_image
  • cycle
  • defaultCodeblocks
  • deprecated_functions
  • DownloadList
  • dynamic_locale
  • dynamicAlbum
  • elFinder_options
  • email_new_user
  • exampleMacros
  • external_auth
  • ExternalFeed
  • externalFeed_options
  • favorites
  • favoritesOptions
  • federated_logon
  • feed
  • fieldExtender
  • flag_thumbnail
  • Gallery
  • galleryArticles
  • getID3
  • getid3_aac
  • getid3_apetag
  • getid3_flv
  • getid3_handler
  • getid3_id3v1
  • getid3_id3v2
  • getid3_lib
  • getid3_lyrics3
  • getid3_mp3
  • getid3_mpeg
  • getid3_quicktime
  • getid3_swf
  • GoogleMap
  • Googlemaps
  • googleVerifyOptions
  • hitcounter
  • HTML
  • htmlmetatags
  • http_auth
  • Image
  • image_effects
  • internal_deprecations
  • ipBlocker
  • jcarousel
  • jPlayer
  • jplayer_options
  • jquery_rating
  • JSMin
  • lib_GD_Options
  • lib_Imagick_Options
  • lib_NoGraphics
  • MediaObject
  • menu_manager
  • MergedRSS
  • MergedRSSOptions
  • mobile
  • Mobile_Detect
  • mobileTheme
  • multipleLayoutOptions
  • null_seo
  • OAuthConsumer
  • OAuthDataStore
  • OAuthRequest
  • OAuthServer
  • OAuthSignatureMethod
  • OAuthSignatureMethod_HMAC_SHA1
  • OAuthSignatureMethod_PLAINTEXT
  • OAuthSignatureMethod_RSA_SHA1
  • OAuthToken
  • OAuthUtil
  • pagedThumbsNav
  • pagedthumbsOptions
  • PclZip
  • PersistentObject
  • PHPMailer
  • PlainText
  • POP3
  • print_album_menu
  • pseudoPlayer
  • publishContent
  • quota_manager
  • reCaptcha
  • ReCaptchaResponse
  • register_user
  • rewriteRules
  • rewriteTokens
  • RSS
  • RSS_internal_deprecations
  • rss_options
  • search_statistics
  • SearchEngine
  • security_logger
  • seo_locale
  • Services_JSON
  • Services_JSON_Error
  • setupexternalFeed
  • setupRSS
  • show_not_loggedin
  • sitemap
  • slideshow
  • SMTP
  • static_html_cache
  • tagsuggest
  • TextObject
  • TextObject_internal_deprecations
  • TextObject_Options
  • ThemeObject
  • themeSwitcher
  • tinymce4Options
  • tinyURL
  • Transientimage
  • tweet
  • TwitterOAuth
  • UploadHandler
  • user_expiry
  • user_groups
  • user_logout_options
  • userAddressFields
  • utf8
  • Video
  • Video_internal_deprecations
  • VideoObject_Options
  • viewer_size_image_options
  • WEBdocs
  • WEBdocs_Options
  • xmpMetadata
  • Zenpage
  • Zenpage_internal_deprecations
  • ZenpageCategory
  • zenpagecms
  • ZenpageItems
  • ZenpageNews
  • ZenpagePage
  • ZenpageRoot
  • Zenphoto_Administrator
  • Zenphoto_Authority
  • zenphoto_org_news
  • zenphoto_seo
  • zenphotoDonate
  • ZipStream
  • zp_PHPMailer
  • zpCaptcha
  • zpFunctions
  • zpLegacySpam
  • zpMutex
  • zpSimpleSpam
  • zpTrivialSpam

Exceptions

  • BadFunctionCallException
  • BadMethodCallException
  • Exception
  • getid3_exception
  • JSMin_UnterminatedCommentException
  • JSMin_UnterminatedRegExpException
  • JSMin_UnterminatedStringException
  • LogicException
  • OAuthExcept
  • phpmailerException

Functions

  • __autoload
  • _escape_xref
  • _recaptcha_aes_encrypt
  • _recaptcha_aes_pad
  • _recaptcha_http_post
  • _recaptcha_mailhide_email_parts
  • _recaptcha_mailhide_urlbase64
  • _recaptcha_qsencode
  • accessAllAlbums
  • add_context
  • addalbumsToDatabase
  • addCategoriesToDatabase
  • addGeoCoord
  • addItem
  • addPagesToDatabase
  • addPluginScript
  • addPluginType
  • addSubalbumMenus
  • admin_album_list
  • admin_securityChecks
  • admin_showupdate
  • adminPageNav
  • adminToolbox
  • albumNumber
  • applyMacros
  • Auth_OpenID_arrangeByType
  • Auth_OpenID_AX_checkAlias
  • Auth_OpenID_AX_toTypeURIs
  • Auth_OpenID_bestMatchingService
  • Auth_OpenID_checkFieldName
  • Auth_OpenID_checkSessionType
  • Auth_OpenID_checkTimestamp
  • Auth_OpenID_detectMathLibrary
  • Auth_OpenID_discover
  • Auth_OpenID_discoverURI
  • Auth_OpenID_discoverWithoutYadis
  • Auth_OpenID_discoverWithYadis
  • Auth_OpenID_discoverXRI
  • Auth_OpenID_extractReturnURL
  • Auth_OpenID_findOPLocalIdentifier
  • Auth_OpenID_getAllAssociationTypes
  • Auth_OpenID_getAllowedReturnURLs
  • Auth_OpenID_getAuthorityPattern
  • Auth_OpenID_getAvailableSessionTypes
  • Auth_OpenID_getDefaultAssociationOrder
  • Auth_OpenID_getDefaultGen
  • Auth_OpenID_getDefaultMod
  • Auth_OpenID_getDefaultNegotiator
  • Auth_OpenID_getEncodedPattern
  • Auth_OpenID_getEncryptedNegotiator
  • Auth_OpenID_getEscapeRE
  • Auth_OpenID_getMathLib
  • Auth_OpenID_getOnlyEncryptedOrder
  • Auth_OpenID_getOpenIDConsumerTypeURIs
  • Auth_OpenID_getOpenIDTypeName
  • Auth_OpenID_getOpenIDTypeURIs
  • Auth_OpenID_getOPOrUserServices
  • Auth_OpenID_getSecretSize
  • Auth_OpenID_getSessionTypes
  • Auth_OpenID_getSupportedAssociationTypes
  • Auth_OpenID_getUnreserved
  • Auth_OpenID_getURIPattern
  • Auth_OpenID_getURLIllegalCharRE
  • Auth_OpenID_HMACSHA1
  • Auth_OpenID_HMACSHA256
  • Auth_OpenID_include_init
  • Auth_OpenID_isError
  • Auth_OpenID_isOpenID1
  • Auth_OpenID_legacy_discover
  • Auth_OpenID_makeOpenIDEndpoints
  • Auth_OpenID_math_extensions
  • Auth_OpenID_mkNonce
  • Auth_OpenID_noMathSupport
  • Auth_OpenID_pct_encoded_replace
  • Auth_OpenID_pct_encoded_replace_unreserved
  • Auth_OpenID_registerNamespaceAlias
  • Auth_OpenID_remove_dot_segments
  • Auth_OpenID_removeNamespaceAlias
  • Auth_OpenID_returnToMatches
  • Auth_OpenID_setNoMathSupport
  • Auth_OpenID_SHA1
  • Auth_OpenID_SHA256
  • Auth_OpenID_splitNonce
  • Auth_OpenID_supportsSReg
  • Auth_OpenID_urinorm
  • Auth_OpenID_verifyReturnTo
  • Auth_Yadis_array_scramble
  • Auth_Yadis_escapeForIRI
  • Auth_Yadis_getCanonicalID
  • Auth_Yadis_getDefaultProxy
  • Auth_Yadis_getEscapeRE
  • Auth_Yadis_getIPrivateChars
  • Auth_Yadis_getNSMap
  • Auth_Yadis_getServiceEndpoints
  • Auth_Yadis_getSupportedExtensions
  • Auth_Yadis_getUCSChars
  • Auth_Yadis_getXMLParser
  • Auth_Yadis_getXRDExpiration
  • Auth_Yadis_getXrefRE
  • Auth_Yadis_getXRIAuthorities
  • Auth_Yadis_identifierScheme
  • Auth_Yadis_iriToURI
  • Auth_Yadis_pct_escape_unicode
  • Auth_Yadis_providerIsAuthoritative
  • Auth_Yadis_rootAuthority
  • Auth_Yadis_setDefaultParser
  • Auth_Yadis_startswith
  • Auth_Yadis_toIRINormal
  • Auth_Yadis_toURINormal
  • Auth_Yadis_XRI
  • Auth_Yadis_XRIAppendArgs
  • authorSelector
  • build_query
  • build_url
  • bulkActionRedirect
  • bulkTags
  • byteConvert
  • cacheImage
  • checkAccess
  • checkAlbumimagesort
  • checkAlbumParentid
  • checkAlbumPassword
  • checkChosenItemStatus
  • checkChosenMenuset
  • checked
  • checkFolder
  • checkForEmptyTitle
  • checkForGuest
  • checkForPage
  • checkForPassword
  • checkForUpdate
  • checkHitcounterDisplay
  • checkIfChecked
  • checkIfLockedNews
  • checkIfLockedPage
  • checkIfNew
  • checkInstall
  • checkLayoutUseForImages
  • checkNewsAccess
  • checkNewsCategoryPassword
  • checkObjectsThumb
  • checkPagePassword
  • checkPageValidity
  • checkParentLayouts
  • checkPublishDates
  • checkRequiredField
  • checkSelectedAlbum
  • checkSignature
  • cleanAlbum
  • cleanHTML
  • clearSitemapCache
  • clonedFrom
  • codeblocktabsJS
  • comment_form_addComment
  • comment_form_handle_comment
  • comment_form_PaginationJS
  • comment_form_postcomment
  • comment_form_print10Most
  • comment_form_visualEditor
  • commentFormUseCaptcha
  • commentReply
  • commentsAllowed
  • consolidatedEditMessages
  • copyLayoutSelection
  • copyThemeDirectory
  • countArticles
  • countCombiNews
  • createMenuIfNotExists
  • createRelatedItemsResultArray
  • cron_starter
  • currentRelativeURL
  • customOptions
  • dateDiff
  • datepickerJS
  • dateTimeConvert
  • db_affected_rows
  • db_close
  • db_collation
  • db_connect
  • db_count
  • db_create
  • db_create_table
  • db_error
  • db_fetch_assoc
  • db_fetch_row
  • db_free_result
  • db_getSQLmode
  • db_insert_id
  • db_LIKE_escape
  • db_list_fields
  • db_name
  • db_num_rows
  • db_permissions
  • db_quote
  • db_setSQLmode
  • db_show
  • db_software
  • db_table_update
  • db_truncate_table
  • debug404
  • debugLog
  • debugLogBacktrace
  • debugLogVar
  • defaultCodeblocks_codebox
  • deleteArticle
  • deleteCategory
  • deleteItem
  • deleteLayoutSelection
  • deletePage
  • deleteThemeDirectory
  • detect_fetcher
  • detect_math
  • detect_query_corruption
  • detect_random
  • detect_stores
  • detect_xml
  • dircopy
  • displayError
  • doIncludes
  • elFinder_admin_tabs
  • elFinder_tinymce
  • enableExtension
  • escape
  • executeRSS
  • exitZP
  • exposeZenPhotoInformations
  • extensionEnabled
  • fetchComments
  • filesystemToInternal
  • filter_extractReturnURL
  • filter_MatchesAnyOpenIDConsumerType
  • filter_MatchesAnyOpenIDType
  • filterImageQuery
  • fix_path_redirect
  • formatList
  • fullText
  • galleryAlbumsPerPage
  • genAlbumList
  • generateCaptcha
  • generateLanguageList
  • generateListFromArray
  • generateListFromFiles
  • generateRadiobuttonsFromArray
  • generateSitemapCacheFile
  • generateSitemapIndexCacheFile
  • generateUnorderedListFromArray
  • get_AnyFile_suffixes
  • get_context
  • get_filterScript
  • get_instance
  • get_language_string
  • getAdminThumb
  • getAlbumArray
  • getAlbumBreadcrumb
  • getAlbumBreadcrumbAdmin
  • getAlbumCustomData
  • getAlbumData
  • getAlbumDate
  • getAlbumDesc
  • getAlbumFolder
  • getAlbumGeodata
  • getAlbumId
  • getAlbumInherited
  • getAlbumLinkURL
  • getAlbumLocation
  • getAlbumPage
  • getAlbumPlace
  • getAlbumStatistic
  • getAlbumThumb
  • getAlbumTitle
  • getAlbumURL
  • getAllAccessibleAlbums
  • getAllAlbums
  • getAllArticleDates
  • getAllCategories
  • getAllDates
  • getAllowedTags
  • getAllSubAlbumIDs
  • getAllSubalbums
  • getAllTagsCount
  • getAllTagsFromAlbum
  • getAllTagsFromAlbum_multi_unique
  • getAllTagsFromZenpage
  • getAllTagsUnique
  • getAllTranslations
  • getAnnotatedAlbumTitle
  • getAnnotatedImageTitle
  • getArticles
  • getAuthor
  • getBare
  • getBareAlbumDesc
  • getBareAlbumTitle
  • getBareGalleryDesc
  • getBareGalleryTitle
  • getBareImageDesc
  • getBareImageTitle
  • getBareNewsAlbumTitle
  • getBareNewsTitle
  • getBarePageTitle
  • getCategory
  • getCategoryID
  • getCategoryLink
  • getCategoryParentID
  • getCategorySortOrder
  • getCategoryTitle
  • getCheckboxState
  • getCodeblock
  • getCombiNews
  • getCommentAddress
  • getCommentAuthorEmail
  • getCommentAuthorLink
  • getCommentAuthorName
  • getCommentAuthorSite
  • getCommentBody
  • getCommentCount
  • getCommentDate
  • getCommentDateTime
  • getCommentErrors
  • getCommentsAllowed
  • getCommentStored
  • getCommentTime
  • getConsumer
  • getContentShorten
  • getCurrentMenuItem
  • getCurrentNewsArchive
  • getCurrentNewsCategory
  • getCurrentNewsCategoryID
  • getCurrentNewsCategoryParentID
  • getCurrentNewsPage
  • getCurrentPage
  • getCurrentTheme
  • getCustomAlbumThumb
  • getCustomAlbumThumbMaxSpace
  • getCustomImageURL
  • getCustomPageURL
  • getCustomSizedImageMaxSpace
  • getCustomSizedImageThumbMaxSpace
  • getDefaultHeight
  • getDefaultSizedImage
  • getDefaultWidth
  • getDownloadLink
  • getdownloadList
  • getDownloadURL
  • getE
  • getEnabledPlugins
  • getExpiryDatePost
  • getFavoritesURL
  • getField
  • getFirstImageURL
  • getFullHeight
  • getFullImageURL
  • getFullNewsImage
  • getFullWidth
  • getGalleryDesc
  • getGalleryIndexURL
  • getGalleryTitle
  • getGeoCoord
  • getHeadTitle
  • getHitcounter
  • getImageArgs
  • getImageCacheFilename
  • getImageCachePostfix
  • getImageCity
  • getImageCountry
  • getImageCustomData
  • getImageData
  • getImageDate
  • getImageDesc
  • getImageEXIFData
  • getImageGeodata
  • getImageID
  • getImageLinkURL
  • getImageLocation
  • getImageMetaData
  • getImageParameters
  • getImageProcessorURI
  • getImageProcessorURIFromCacheName
  • getImageRotation
  • getImageSortOrder
  • getImageState
  • getImageStatistic
  • getImageThumb
  • getImageTitle
  • getImageURI
  • getImageURL
  • getItem
  • getItemByID
  • getItemTitleAndURL
  • getjPlayerSkinCSS
  • getjPlayerSkins
  • getLanguageArray
  • getLanguageFlag
  • getLastImageURL
  • getLatestComments
  • getLatestNews
  • getLatestZenpageComments
  • getLayout
  • getLayoutSelector
  • getLink
  • getLinkHTML
  • getLogTabs
  • getMacros
  • getMainSiteName
  • getMainSiteURL
  • getManagedAlbumList
  • getMaxSpaceContainer
  • getMenuFromLink
  • getMenuItemChilds
  • getMenuItems
  • getMenumanagerPredicessor
  • getMenumanagerSuccessor
  • getMenuSetSelector
  • getMenuVisibility
  • getMimeString
  • getNestedAlbumList
  • getNewsAdminOption
  • getNewsAdminOptionPath
  • getNewsAlbumName
  • getNewsAlbumTitle
  • getNewsAlbumURL
  • getNewsArchivePath
  • getNewsArchiveURL
  • getNewsAuthor
  • getNewsCategories
  • getNewsCategoryCustomData
  • getNewsCategoryDesc
  • getNewsCategoryPath
  • getNewsCategoryURL
  • getNewsContent
  • getNewsContentShorten
  • getNewsCustomData
  • getNewsDate
  • getNewsExtraContent
  • getNewsID
  • getNewsImageTags
  • getNewsIndexURL
  • getNewsLink
  • getNewsPagesStatistic
  • getNewsPathNav
  • getNewsReadMore
  • getNewsTitle
  • getNewsTitleLink
  • getNewsTitlePath
  • getNewsType
  • getNewsURL
  • getNewsVideoContent
  • getNextAlbum
  • getNextAlbumURL
  • getNextImageThumb
  • getNextImageURL
  • getNextNewsPageURL
  • getNextNewsURL
  • getNextPageURL
  • getNextPrevNews
  • getNotViewableAlbums
  • getNotViewableImages
  • getNumAlbums
  • getNumAllSubalbums
  • getNumImages
  • getNumNews
  • getNumPages
  • getNumSubalbums
  • getOpenIDURL
  • getOption
  • getOptionFromDB
  • getOptionList
  • getPageAuthor
  • getPageContent
  • getPageCustomData
  • getPageDate
  • getPageExtraContent
  • getPageID
  • getPageLastChangeDate
  • getPageLinkPath
  • getPageLinkURL
  • getPageNavList
  • getPageNumURL
  • getPageParentID
  • getPageRedirect
  • getPages
  • getPageSelector
  • getPageSortorder
  • getPageTitle
  • getPageTitleLink
  • getPageURL
  • getParentAlbums
  • getParentAlbumsAdmin
  • getParentBreadcrumb
  • getParentItems
  • getParentMenuItems
  • getParentNewsCategories
  • getParentPages
  • getPasswordProtectImage
  • getPHPFiles
  • getPlugin
  • getPluginFiles
  • getPluginTabs
  • getPrevAlbum
  • getPrevAlbumURL
  • getPrevImageThumb
  • getPrevImageURL
  • getPrevNewsPageURL
  • getPrevNewsURL
  • getPrevPageURL
  • getProtectedImageURL
  • getRandomImages
  • getRandomImagesAlbum
  • getRating
  • getRelatedItems
  • getRequestURI
  • getReturnTo
  • getRSSHeaderLink
  • getRSSLink
  • getScheme
  • getSearchDate
  • getSearchURL
  • getSearchWords
  • getSelectedLayout
  • getSerializedArray
  • getSetClause
  • getSiteHomeURL
  • getSitemapAlbumList
  • getSitemapAlbums
  • getSitemapGoogleImageVideoExtras
  • getSitemapGoogleLoopIndex
  • getSitemapImages
  • getSitemapIndexLinks
  • getSitemapZenpageNewsArticles
  • getSitemapZenpageNewsCategories
  • getSitemapZenpageNewsIndex
  • getSitemapZenpagePages
  • getSizeCustomImage
  • getSizeDefaultImage
  • getSizeDefaultThumb
  • getSizedImageURL
  • getSizeFullImage
  • getStore
  • getSubCategories
  • getSubtabs
  • getSuffix
  • getTagCountByAccess
  • getTagOrder
  • getTags
  • gettext_pl
  • gettext_th
  • getTheme
  • getThemeFiles
  • getThemeOption
  • getTimezones
  • getTinyMCE4ConfigFiles
  • getTitle
  • getTotalArticles
  • getTotalImagesIn
  • getTotalNewsPages
  • getTotalPages
  • getTrustRoot
  • getUnprotectedImageURL
  • getUrAlbum
  • getURL
  • getUserIP
  • getUserLocale
  • getVersion
  • getViewerImageSize
  • getWatermarkParam
  • getWatermarkPath
  • getWatermarks
  • getWhereClause
  • getXSRFToken
  • getZenpageHitcounter
  • getZenpageRSSHeaderLink
  • getZenpageRSSLink
  • getZenpageStatistic
  • googleVerifyHead
  • handleSearchParms
  • hasDynamicAlbumSuffix
  • hasNextImage
  • hasNextPage
  • hasPrevImage
  • hasPrevPage
  • hitcounter
  • html_decode
  • html_encode
  • html_encodeTagged
  • httpsRedirect
  • httpUploadHandler
  • httpUploadHandler_admin_tabs
  • i18nSetLocale
  • imageBlurGD
  • imageDebug
  • imageError
  • imageNumber
  • imgSrcURI
  • in_context
  • inNewsCategory
  • inProtectedNewsCategory
  • installSignature
  • instrument
  • inSubNewsCategoryOf
  • internalToFilesystem
  • inventMenuItem
  • iptc_make_tag
  • is_AdminEditPage
  • is_connected
  • is_GalleryNewsType
  • is_News
  • is_NewsArchive
  • is_NewsArticle
  • is_NewsCategory
  • is_NewsPage
  • is_NewsType
  • is_Pages
  • is_valid_email_zp
  • is_valid_image
  • is_valid_other_type
  • is_zip
  • isAlbumClass
  • isAlbumPage
  • isArchive
  • isHandledAlbum
  • isImageClass
  • isImagePage
  • isImagePhoto
  • isImageVideo
  • isLandscape
  • isMyAlbum
  • isMyNews
  • isMyPage
  • isolate
  • isProtectedAlbum
  • isProtectedNewsCategory
  • isProtectedPage
  • isSubNewsCategoryOf
  • isValidURL
  • jQueryUpload_head
  • jQueryUpload_headers
  • jQueryUploadHandler
  • jQueryUploadHandler_admin_tabs
  • js_encode
  • json_decode
  • json_encode
  • kses
  • kses_array_lc
  • kses_attr
  • kses_bad_protocol
  • kses_bad_protocol_once
  • kses_bad_protocol_once2
  • kses_check_attr_val
  • kses_decode_entities
  • kses_hair
  • kses_hook
  • kses_html_error
  • kses_js_entities
  • kses_no_null
  • kses_normalize_entities
  • kses_normalize_entities2
  • kses_split
  • kses_split2
  • kses_stripslashes
  • kses_version
  • ksesProcess
  • layoutSelector
  • layoutSelector_album
  • listDBUses
  • listDirectoryFiles
  • listUses
  • load_zenpage_news
  • load_zenpage_pages
  • loadLocalOptions
  • log_message
  • lookupSortKey
  • macro_admin_tabs
  • macroList_show
  • makeAlbumCurrent
  • makeImageCurrent
  • makeSpecialImageName
  • markRelease_button
  • mb_strlen
  • mb_strpos
  • mb_strrpos
  • mb_strtolower
  • mb_strtoupper
  • mb_substr
  • mb_substr_count
  • menu_admin_toolbox_global
  • menu_tabs
  • minDiff
  • mkdir_recursive
  • my_truncate_string
  • myts_date
  • newAlbum
  • newImage
  • next_album
  • next_comment
  • next_image
  • next_news
  • next_page
  • ngettext_pl
  • ngettext_th
  • normalizeColumns
  • omsAdditions
  • openedForComments
  • parse_query
  • parse_size
  • parseAllowedTags
  • parseHttpAcceptLanguage
  • passAlbums
  • passImages
  • pathurlencode
  • PclZipUtilCopyBlock
  • PclZipUtilOptionText
  • PclZipUtilPathInclusion
  • PclZipUtilPathReduction
  • PclZipUtilRename
  • PclZipUtilTranslateWinPath
  • PHPMailerAutoload
  • populateManagedObjectsList
  • postAlbumSort
  • postIndexDecode
  • postIndexEncode
  • prefix
  • prepareAlbumPage
  • prepareCustomPage
  • prepareImagePage
  • prepareIndexPage
  • print404status
  • print_language_string_list
  • printAddToFavorites
  • printAdminFooter
  • printAdminHeader
  • printAdminRightsTable
  • printAdminToolbox
  • printAlbumBreadcrumb
  • printAlbumButtons
  • printAlbumCustomData
  • printAlbumData
  • printAlbumDate
  • printAlbumDesc
  • printAlbumEditForm
  • printAlbumEditRow
  • printAlbumLegend
  • printAlbumLink
  • printAlbumLocation
  • printAlbumMap
  • printAlbumMenu
  • printAlbumMenuJump
  • printAlbumMenuList
  • printAlbumMenuListAlbum
  • printAlbumPlace
  • printAlbumRating
  • printAlbumsSelector
  • printAlbumStatistic
  • printAlbumStatisticItem
  • printAlbumThumbImage
  • printAlbumTitle
  • printAlbumURL
  • printAlbumZip
  • printAllDates
  • printAllNewsCategories
  • printAllTags
  • printAllTagsAs
  • printAllTagsFromAlbum
  • printAllTagsFromZenpage
  • printAnnotatedAlbumTitle
  • printAnnotatedImageTitle
  • printArticleCategories
  • printArticleDatesDropdown
  • printArticlesPerPageDropdown
  • printBareAlbumDesc
  • printBareAlbumTitle
  • printBareGalleryDesc
  • printBareGalleryTitle
  • printBareImageDesc
  • printBareImageTitle
  • printBareNewsTitle
  • printBarePageTitle
  • printBulkActions
  • printCaptcha
  • printCategoriesStatistic
  • printCategoryCheckboxListEntry
  • printCategoryDropdown
  • printCategoryListSortableTable
  • printCategorySelection
  • printCodeblock
  • printCodeblockEdit
  • printCommentAuthorLink
  • printCommentErrors
  • printCommentForm
  • printContactForm
  • printCurrentNewsArchive
  • printCurrentNewsCategory
  • printCustomAlbumThumbImage
  • printCustomAlbumThumbMaxSpace
  • printCustomMenu
  • printCustomPageSelector
  • printCustomPageURL
  • printCustomSizedImage
  • printCustomSizedImageMaxHeight
  • printCustomSizedImageMaxSpace
  • printCustomSizedImageThumbMaxSpace
  • printDefaultSizedImage
  • printDownloadAlbumZipURL
  • printDownloadLink
  • printDownloadLinkAlbumZip
  • printdownloadList
  • printDownloadURL
  • printEditable
  • printEditCommentLink
  • printEditDropdown
  • printExpired
  • printFavoritesLink
  • printFavoritesURL
  • printField
  • printGalleryDesc
  • printGalleryIndexURL
  • printGalleryTitle
  • printGoogleMap
  • printHeadTitle
  • printHomeLink
  • printImageCustomData
  • printImageData
  • printImageDate
  • printImageDesc
  • printImageDiv
  • printImageEXIFData
  • printImageID
  • printImageLink
  • printImageMap
  • printImageMetadata
  • printImageRating
  • printImageSortOrder
  • printImageStatistic
  • printImageThumb
  • printImageTitle
  • printImageURL
  • printItemEditLink
  • printItemsList
  • printItemsListTable
  • printItemStatusDropdown
  • printjCarouselThumbNav
  • printjPlayerPlaylist
  • printLanguageSelector
  • printLatestAlbums
  • printLatestComments
  • printLatestImages
  • printLatestImagesByDate
  • printLatestImagesByMtime
  • printLatestNews
  • printLatestUpdatedAlbums
  • printLatestZenpageComments
  • printLink
  • printLinkHTML
  • printLogoAndLinks
  • printManagedObjects
  • printMenuemanagerPageList
  • printMenuemanagerPageListWithNav
  • printMenumanagerBreadcrumb
  • printMenumanagerNextLink
  • printMenumanagerPrevLink
  • printMostPopularItems
  • printMostRatedAlbums
  • printMostRatedImages
  • printMostRatedItems
  • printNestedAlbumsList
  • printNestedItemsList
  • printNestedMenu
  • printNews
  • printNewsArchive
  • printNewsAuthor
  • printNewsCategories
  • printNewsCategoryCustomData
  • printNewsCategoryDesc
  • printNewsCategoryURL
  • printNewsContent
  • printNewsCustomData
  • printNewsDate
  • printNewsExtraContent
  • printNewsImageTags
  • printNewsIndexURL
  • printNewsLink
  • printNewsPageList
  • printNewsPageListWithNav
  • printNewsReadMoreLink
  • printNewsStatistic
  • printNewsTitle
  • printNewsTitleLink
  • printNewsURL
  • printNextNewsLink
  • printNextNewsPageLink
  • printNextPageLink
  • printNextPageURL
  • printPageArticleTags
  • printPageAuthor
  • printPageContent
  • printPageCustomData
  • printPageDate
  • printPagedThumbsNav
  • printPageExtraContent
  • printPageID
  • printPageLastChangeDate
  • printPageLinkURL
  • printPageList
  • printPageListWithNav
  • printPageMenu
  • printPageNav
  • printPageSelector
  • printPagesListTable
  • printPagesStatistic
  • printPageTitle
  • printPageTitleLink
  • printPageURL
  • printParentBreadcrumb
  • printParentPagesBreadcrumb
  • printPasswordForm
  • printPopularAlbums
  • printPopularImages
  • printPreloadScript
  • printPrevNewsLink
  • printPrevNewsPageLink
  • printPrevPageLink
  • printPrevPageURL
  • printPublished
  • printPublishIconLink
  • printRandomImages
  • printRating
  • printRegisterURL
  • printRegistrationForm
  • printRelatedItems
  • printRSSHeaderLink
  • printRSSLink
  • printSearchBreadcrumb
  • printSearchForm
  • printSiteHomeURL
  • printSizedImageLink
  • printSizedImageURL
  • printSlideShow
  • printSlideShowJS
  • printSlideShowLink
  • printSortableHead
  • printSortOrderDropdown
  • printSubPagesExcerpts
  • printSubtabs
  • printTabs
  • printTags
  • printThumbNav
  • printTopRatedAlbums
  • printTopRatedImages
  • printTopRatedItems
  • printUnpublishedDropdown
  • printUserLogin_out
  • printUserSizeImage
  • printUserSizeSelector
  • printVersion
  • printZenJavascripts
  • printZenpageIconLegend
  • printZenpageItemsBreadcrumb
  • printZenpageNewsCategorySelector
  • printZenpagePagesSelector
  • printZenpageRSSHeaderLink
  • printZenpageRSSLink
  • printZenpageStatistic
  • printZenphotoLink
  • process_language_string_save
  • processAlbumBulkActions
  • processAlbumEdit
  • processCodeblockSave
  • processCommentBulkActions
  • processCredentials
  • processCustomOptionSave
  • processEditSelection
  • processExpired
  • processImageBulkActions
  • processImageEdit
  • processManagedObjects
  • processMenuBulkActions
  • processOrder
  • processRights
  • processTags
  • processZenpageBulkActions
  • propSizes
  • publishItem
  • purgeOption
  • query
  • query_full_array
  • query_single_row
  • rc4
  • read_exif_data_protected
  • readTags
  • recaptcha_check_answer
  • recaptcha_get_html
  • recaptcha_get_signup_url
  • recaptcha_mailhide_html
  • recaptcha_mailhide_url
  • reconfigureAction
  • reconfigureCS
  • reconfigurePage
  • recordMissing
  • rem_context
  • removeParentAlbumNames
  • resetCurrentAlbum
  • restore_context
  • reveal
  • rewrite_get_album_image
  • rewrite_path
  • rewrite_path_zenpage
  • RSS_Channel
  • RSS_Retrieve
  • RSS_Tags
  • rulesList
  • run
  • safe_fnmatch
  • safe_glob
  • sanitize
  • sanitize_numeric
  • sanitize_path
  • sanitize_script
  • sanitize_string
  • sanitizeRedirect
  • save_context
  • saveLayoutSelection
  • saveZenphotoLayoutSelection
  • search_quote
  • secureServer
  • seo_cleanup_button
  • seoFriendly
  • seoFriendlyJS
  • set_context
  • setAlbumCustomData
  • setAlbumSubtabs
  • setImageCustomData
  • setMainDomain
  • setOption
  • setOptionDefault
  • setPluginDomain
  • setThemeColumns
  • setThemeDomain
  • setThemeOption
  • setThemeOptionDefault
  • setupAllowedMaps
  • setupCurrentLocale
  • setupDomain
  • setupTheme
  • shortenContent
  • showOrNotShowField
  • shuffle_assoc
  • signatureChange
  • site_upgrade_button
  • site_upgrade_status
  • sitemap_echonl
  • sitemap_getChangefreq
  • sitemap_getDateformat
  • sitemap_getDBLimit
  • sitemap_getISO8601Date
  • skipScheduledPublishing
  • sortByKey
  • sortByMultilingual
  • sortMultiArray
  • standardScripts
  • standardThemeOptions
  • stickyNews
  • storeConfig
  • storeTags
  • stripSuffix
  • submenuOf
  • switchLog
  • tagSelector
  • tagSuggestJS
  • tagSuggestJS_admin
  • tagSuggestJS_frontend
  • themeIsEditable
  • themeSetup
  • timezoneDiff
  • tinymce4ConfigJS
  • truncate_string
  • unpublishedZenphotoItemCheck
  • unpublishSubalbums
  • unQuote
  • unzip
  • updateArticle
  • updateCacheName
  • updateCategory
  • updateConfigItem
  • updateItemSortorder
  • updateItemsSortorder
  • updateMenuItem
  • updatePage
  • upload_extra
  • upload_form
  • upload_head
  • user_mailing_list_button
  • validateLocale
  • wordpress_import_button
  • wp_prefix
  • wp_query_full_array
  • wpimport_TryAgainError
  • XSRFdefender
  • XSRFToken
  • zenJavascript
  • zenpageAlbumImage
  • zenpageBulkActionMessage
  • zenpageHitcounter
  • zenpageJSCSS
  • zenpageOpenedForComments
  • zenpagePublish
  • zenphoto_PHPMailer
  • zenphoto_sendmail
  • zenPhotoTheme
  • zp_apply_filter
  • zp_clearCookie
  • zp_colorAllocate
  • zp_cookieEncode
  • zp_copyCanvas
  • zp_createImage
  • zp_drawRectangle
  • zp_error
  • zp_filter_slot
  • zp_filter_unique_id
  • zp_getCookie
  • zp_getFonts
  • zp_graphicsLibInfo
  • zp_handle_password
  • zp_handle_password_single
  • zp_has_filter
  • zp_image_types
  • zp_imageCanRotate
  • zp_imageColorTransparent
  • zp_imageDims
  • zp_imageFill
  • zp_imageFontHeight
  • zp_imageFontWidth
  • zp_imageFromString
  • zp_imageGet
  • zp_imageGray
  • zp_imageHeight
  • zp_imageIPTC
  • zp_imageKill
  • zp_imageLoadFont
  • zp_imageMerge
  • zp_imageOutput
  • zp_imageResizeAlpha
  • zp_imageUnsharpMask
  • zp_imageWidth
  • zp_load_album
  • zp_load_gallery
  • zp_load_image
  • zp_load_page
  • zp_load_request
  • zp_load_search
  • zp_loggedin
  • zp_mail
  • zp_register_filter
  • zp_remove_filter
  • zp_resampleImage
  • zp_rotateImage
  • zp_session_start
  • zp_setCookie
  • zp_writeString
  • zpErrorHandler
  • zpFormattedDate
  • zpRewriteURL
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
   1: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
   2: 
   3: /**
   4:  * CodeIgniter Google Maps API V3 Class
   5:  *
   6:  * Displays a Google Map
   7:  *
   8:  * @package     CodeIgniter
   9:  * @subpackage  Libraries
  10:  * @category    Libraries
  11:  * @author      BIOSTALL (Steve Marks)
  12:  * @link        http://biostall.com/codeigniter-google-maps-v3-api-library
  13:  * @docs        http://biostall.com/wp-content/uploads/2010/07/Google_Maps_V3_API_Documentation.pdf
  14:  */
  15: 
  16: class Googlemaps {
  17: 
  18:     var $adsense                    = FALSE;                    // Whether Google Adsense For Content should be enabled
  19:     var $adsenseChannelNumber       = '';                       // The Adsense channel number for tracking the performance of this AdUnit
  20:     var $adsenseFormat              = 'HALF_BANNER';            // The format of the AdUnit
  21:     var $adsensePosition            = 'TOP_CENTER';             // The position of the AdUnit
  22:     var $adsensePublisherID         = '';                       // Your Google AdSense publisher ID
  23:     var $apiKey                     = '';                       // If you've got an API key you can use it by passing this parameter. Setup an API key here: https://code.google.com/apis/console
  24:     var $backgroundColor            = '';                       // A hex color value shown as the map background when tiles have not yet loaded as the user pans
  25:     var $bicyclingOverlay           = FALSE;                    // If set to TRUE will overlay bicycling information (ie. bike paths and suggested routes) onto the map by default
  26:     var $center                     = "37.4419, -122.1419";     // Sets the default center location (lat/long co-ordinate or address) of the map. If defaulting to the users location set to "auto"
  27:     var $cluster                    = FALSE;                    // Whether to cluster markers
  28:     var $clusterGridSize            = 60;                       // The grid size of a cluster in pixels
  29:     var $clusterMaxZoom             = '';                       // The maximum zoom level that a marker can be part of a cluster
  30:     var $clusterZoomOnClick         = TRUE;                     // Whether the default behaviour of clicking on a cluster is to zoom into it
  31:     var $clusterAverageCenter       = FALSE;                    // Whether the center of each cluster should be the average of all markers in the cluster
  32:     var $clusterMinimumClusterSize  = 2;                        // The minimum number of markers to be in a cluster before the markers are hidden and a count is shown
  33:     var $disableDefaultUI           = FALSE;                    // If set to TRUE will hide the default controls (ie. zoom, scale etc)
  34:     var $disableDoubleClickZoom     = FALSE;                    // If set to TRUE will disable zooming when a double click occurs
  35:     var $disableMapTypeControl      = FALSE;                    // If set to TRUE will hide the MapType control (ie. Map, Satellite, Hybrid, Terrain)
  36:     var $disableNavigationControl   = FALSE;                    // If set to TRUE will hide the Navigation control (ie. zoom in/out, pan)
  37:     var $disableScaleControl        = FALSE;                    // If set to TRUE will hide the Scale control
  38:     var $disableStreetViewControl   = FALSE;                    // If set to TRUE will hide the Street View control
  39:     var $draggable                  = TRUE;                     // If set to FALSE will prevent the map from being dragged around
  40:     var $draggableCursor            = '';                       // The name or url of the cursor to display on a draggable object
  41:     var $draggingCursor             = '';                       // The name or url of the cursor to display when an object is being dragged
  42:     var $geocodeCaching             = FALSE;                    // If set to TRUE will cache any geocode requests made when an address is used instead of a lat/long. Requires DB table to be created (see documentation)
  43:     var $https                      = FALSE;                    // If set to TRUE will load the Google Maps JavaScript API over HTTPS, allowing you to utilize the API within your HTTPS secure application
  44:     var $navigationControlPosition  = '';                       // The position of the Navigation control, eg. 'BOTTOM_RIGHT'
  45:     var $keyboardShortcuts          = TRUE;                     // If set to FALSE will disable to map being controlled via the keyboard
  46:     var $jsfile                     = '';                       // Set this to the path of an external JS file if you wish the JavaScript to be placed in a file rather than output directly into the <head></head> section. The library will try to create the file if it does not exist already. Please ensure the destination file is writeable
  47:     var $kmlLayerURL                = '';                       // A URL to publicly available KML or GeoRSS data for displaying geographic information
  48:     var $kmlLayerPreserveViewport   = FALSE;                    // Specifies whether the map should be adjusted to the bounds of the KmlLayer's contents. By default the map is zoomed and positioned to show the entirety of the layer's contents
  49:     var $language                   = '';                       // The map will by default load in the language of the browser. This can be overriden however here. For a full list of codes see https://spreadsheets.google.com/pub?key=p9pdwsai2hDMsLkXsoM05KQ&gid=1
  50:     var $loadAsynchronously         = FALSE;                    // Load the map and API asynchronously once the page has loaded
  51:     var $map_div_id                 = "map_canvas";             // The ID of the <div></div> that is output which contains the map
  52:     var $map_height                 = "450px";                  // The height of the map container. Any units (ie 'px') can be used. If no units are provided 'px' will be presumed
  53:     var $map_name                   = "map";                    // The JS reference to the map. Currently not used but to be used in the future when multiple maps are supported
  54:     var $map_type                   = "ROADMAP";                // The default MapType. Values accepted are 'HYBRID', 'ROADMAP', 'SATELLITE' or 'TERRAIN'
  55:     var $map_types_available        = array();                  // The other MapTypes available for selection on the map
  56:     var $map_width                  = "100%";                   // The width of the map container. Any units (ie 'px') can be used. If no units are provided 'px' will be presumed
  57:     var $mapTypeControlPosition     = '';                       // The position of the MapType control, eg. 'BOTTOM_RIGHT'
  58:     var $mapTypeControlStyle        = '';                       // The style of the MapType control. blank, 'DROPDOWN_MENU' or 'HORIZONTAL_BAR' values accepted.
  59:     var $minzoom                    = '';                       // The minimum zoom level which will be displayed on the map
  60:     var $maxzoom                    = '';                       // The maximum zoom level which will be displayed on the map
  61:     var $minifyJS                   = FALSE;                    // If TRUE will run the JavaScript through Jsmin.php (this file and PHP5+ required) to minify the code
  62:     var $noClear                    = FALSE;                    // If TRUE do not clear the contents of the map div
  63:     var $onboundschanged            = '';                       // The JavaScript action to perform when the viewport bounds have changed
  64:     var $oncenterchanged            = '';                       // The JavaScript action to perform when themap center property changes
  65:     var $onclick                    = '';                       // The JavaScript action to perform when the map is clicked
  66:     var $ondblclick                 = '';                       // The JavaScript action to perform when the map is double-clicked
  67:     var $ondrag                     = '';                       // The JavaScript action to perform while the map is dragged
  68:     var $ondragend                  = '';                       // The JavaScript action to perform when the user stops dragging the map
  69:     var $ondragstart                = '';                       // The JavaScript action to perform when the user starts dragging the map
  70:     var $onidle                     = '';                       // The JavaScript action to perform when the map becomes idle after panning or zooming
  71:     var $onload                     = '';                       // The JavaScript action to perform when the map first loads. This library hi-jacks the window.load event so add any bespoke code using this option
  72:     var $onmousemove                = '';                       // The JavaScript action to perform when the user's mouse moves over the map container
  73:     var $onmouseout                 = '';                       // The JavaScript action to perform when the user's mouse exits the map container
  74:     var $onmouseover                = '';                       // The JavaScript action to perform when the user's mouse enters the map container
  75:     var $onresize                   = '';                       // The JavaScript action to perform when the maps div changes size
  76:     var $onrightclick               = '';                       // The JavaScript action to perform when the map is right-clicked
  77:     var $ontilesloaded              = '';                       // The JavaScript action to perform when the visible tiles have finished loading
  78:     var $onzoomchanged              = '';                       // The JavaScript action to perform when the maps zoom property changes
  79:     var $panoramio                  = FALSE;                    // If TRUE will add photos from Panoramio as a layer to your maps as a series of large and small photo icons
  80:     var $panoramioTag               = '';                       // Restrict the set of Panoramio photos shown to those matching a certain textual tag
  81:     var $panoramioUser              = '';                       // Restrict the set of Panoramio photos shown to those matching a particular user
  82:     var $region                     = '';                       // Country code top-level domain (eg "uk") within which to search. Useful if supplying addresses rather than lat/longs
  83:     var $scaleControlPosition       = '';                       // The position of the Scale control, eg. 'BOTTOM_RIGHT'
  84:     var $scrollwheel                = TRUE;                     // If set to FALSE will disable zooming by scrolling of the mouse wheel
  85:     var $sensor                     = FALSE;                    // Set to TRUE if being used on a device that can detect a users location
  86:     var $streetViewAddressControl   = TRUE;                     // If set to FALSE will hide the Address control
  87:     var $streetViewAddressPosition  = '';                       // The position of the Address control, eg. 'BOTTOM'
  88:     var $streetViewControlPosition  = '';                       // The position of the Street View control when viewing normal aerial map, eg. 'BOTTOM_RIGHT'
  89:     var $streetViewCloseButton      = FALSE;                    // If set to TRUE will show the close button in the top right. The close button allows users to return to the aerial map
  90:     var $streetViewLinksControl     = TRUE;                     // If set to FALSE will hide the Links control
  91:     var $streetViewPanControl       = TRUE;                     // If set to FALSE will hide the Pan control
  92:     var $streetViewPanPosition      = '';                       // The position of the Scale control, eg. 'TOP_RIGHT'
  93:     var $streetViewPovHeading       = 0;                        // The Street View camera heading in degrees relative to true north. True north is 0, east is 90, south is 180, west is 270
  94:     var $streetViewPovPitch         = 0;                        // The Street View camera pitch in degrees, relative to the street view vehicle. Directly upwards is 90, Directly downwards is -90.
  95:     var $streetViewPovZoom          = 0;                        // The Street View zoom level. Fully zoomed-out is level 0, zooming in increases the zoom level.
  96:     var $streetViewZoomControl      = TRUE;                     // If set to FALSE will hide the Zoom control
  97:     var $streetViewZoomPosition     = '';                       // The position of the Scale control, eg. 'TOP_RIGHT'
  98:     var $streetViewZoomStyle        = '';                       // The size of the Street View zoom control. blank, 'SMALL' or 'LARGE' values accepted.
  99:     var $styles                     = array();                  // An array of styles used to colour aspects of the map and turn points of interest on and off
 100:     var $stylesAsMapTypes           = false;                    // If applying styles, whether to apply them to the default map or add them as additional map types
 101:     var $stylesAsMapTypesDefault    = '';                       // If $stylesAsMapTypes is true the default style. Should contain the 'Name' of the style
 102:     var $tilt                       = 0;                        // The angle of tilt. Currently only supports the values 0 and 45 in SATELLITE and HYBRID map types and at certain zoom levels
 103:     var $trafficOverlay             = FALSE;                    // If set to TRUE will overlay traffic information onto the map by default
 104:     var $version                    = "3";                      // Version of the API being used. Not currently used in the library
 105:     var $zoom                       = 13;                       // The default zoom level of the map. If set to "auto" will autozoom/center to fit in all visible markers. If "auto", also overrides the $center parameter
 106:     var $zoomControlPosition        = '';                       // The position of the Zoom control, eg. 'BOTTOM_RIGHT'
 107:     var $zoomControlStyle           = '';                       // The size of the zoom control. blank, 'SMALL' or 'LARGE' values accepted.
 108: 
 109:     var $markers                    = array();                  // An array used by the library to store the markers as they are produced
 110:     var $markersInfo                = array();                  // An array containing marker information (id, latitude, longitude etc) for use elsewhere
 111:     var $polylines                  = array();                  // An array used by the library to store the polylines as they are produced
 112:     var $polygons                   = array();                  // An array used by the library to store the polygons as they are produced
 113:     var $circles                    = array();                  // An array used by the library to store the circles as they are produced
 114:     var $rectangles                 = array();                  // An array used by the library to store the rectangles as they are produced
 115:     var $overlays                   = array();                  // An array used by the library to store the overlays as they are produced
 116: 
 117:     var $directions                 = FALSE;                    // Whether or not the map will be used to show directions
 118:     var $directionsStart            = "";                       // The starting location (lat/long co-ordinate or address) of the directions
 119:     var $directionsEnd              = "";                       // The destination point (lat/long co-ordinate or address) of the directions
 120:     var $directionsDivID            = "";                       // An element's ID on the page where textual directions will be output to. Leave blank if not required
 121:     var $directionsMode             = "DRIVING";                // DRIVING, WALKING or BICYCLING (US Only) - The vehicle/mode of transport to show directions for
 122:     var $directionsAvoidTolls       = FALSE;                    // Whether or not directions should avoid tolls
 123:     var $directionsAvoidHighways    = FALSE;                    // Whether or not directions should avoid highways
 124:     var $directionsDraggable        = FALSE;                    // Whether or not directions on the map are draggable
 125:     var $directionsChanged          = "";                       // JavaScript to perform when directions are dragged
 126:     var $directionsUnits            = "";                       // 'metric' for kilometers and meters or 'imperial for miles and feet. Leave blank and it will default to the region or country of where directions are being obtained
 127: 
 128:     var $drawing                    = FALSE;                    // Whether or not the drawing library tools will be loaded
 129:     var $drawingControl             = TRUE;                     // If set to FALSE will hide the Drawing Manager control
 130:     var $drawingControlPosition     = 'TOP_CENTER';             // The position of the Drawing Manager control, eg. 'TOP_RIGHT'
 131:     var $drawingDefaultMode         = 'marker';                 // The default mode for the Drawing Manager. Accepted values are marker, polygon, polyline, rectangle, circle, or null. null means that the user can interact with the map as normal when the map loads, and clicks do not draw anything.
 132:     var $drawingModes               = array();                  // An array of modes available for use. Accepted values are marker, polygon, polyline, rectangle, circle
 133:     var $drawingOnComplete          = array();                  // An array of JS to execute when shapes are completed, one array element per shape. For example: array('circle'=>'JS here', 'polygon'=>'JS here');
 134:     var $drawingOnEdit              = array();                  // An array of JS to execute when shapes are changed/resized, one array element per shape. For example: array('circle'=>'JS here', 'polygon'=>'JS here');
 135: 
 136:     var $places                     = FALSE;                    // Whether or not the map will be used to show places
 137:     var $placesLocation             = '';                       // A point (lat/long co-ordinate or address) on the map if the search for places is based around a central point
 138:     var $placesRadius               = 0;                        // The radius (in meters) if search is based around a central position
 139:     var $placesLocationSW           = '';                       // If preferring to search within bounds the South-West position (latitude/longitude coordinate OR address)
 140:     var $placesLocationNE           = '';                       // If preferring to search within bounds the North-East position (latitude/longitude coordinate OR address)
 141:     var $placesTypes                = array();                  // The types of places to search for. For a list of supported types see http://code.google.com/apis/maps/documentation/places/supported_types.html
 142:     var $placesName                 = '';                       // A term to be matched against when searching for places to display on the map
 143:     var $placesAutocompleteInputID  = '';                       // The ID attribute of the textfield that the autocomplete should effect
 144:     var $placesAutocompleteTypes    = array();                  // The types of places for the autocomplete to return. Options can be seen here https://developers.google.com/maps/documentation/javascript/places#places_autocomplete but include 'establishment' to only return business results, '(cities)', or '(regions)'
 145:     var $placesAutocompleteBoundSW  = '';                       // By specifying an area in which to search for Places, the results are biased towards, but not restricted to, Places contained within these bounds.
 146:     var $placesAutocompleteBoundNE  = '';                       // Both South-West (lat/long co-ordinate or address) and North-East (lat/long co-ordinate or address) values are required if wishing to set bounds
 147:     var $placesAutocompleteBoundsMap= FALSE;                    // An alternative to setting the SW and NE bounds is to use the bounds of the current viewport. If set to TRUE, the bounds will be set to the viewport of the visible map, even if dragged or zoomed
 148:     var $placesAutocompleteOnChange = '';                       // The JavaScript action to perform when a place is selected
 149: 
 150:     function __construct($config = array())
 151:     {
 152:         if (count($config) > 0)
 153:         {
 154:             $this->initialize($config);
 155:         }
 156: 
 157:         log_message('debug', "Google Maps Class Initialized");
 158:     }
 159: 
 160:     function initialize($config = array())
 161:     {
 162:         foreach ($config as $key => $val)
 163:         {
 164:             if (isset($this->$key))
 165:             {
 166:                 $this->$key = $val;
 167:             }
 168:         }
 169: 
 170:         if ($this->sensor) { $this->sensor = "true"; }else{ $this->sensor = "false"; }
 171: 
 172:     }
 173: 
 174:     function add_marker($params = array())
 175:     {
 176: 
 177:         $marker = array();
 178:         $this->markersInfo['marker_'.count($this->markers)] = array();
 179: 
 180:         $marker['position'] = '';                               // The position (lat/long co-ordinate or address) at which the marker will appear
 181:         $marker['infowindow_content'] = '';                     // If not blank, creates an infowindow (aka bubble) with the content provided. Can be plain text or HTML
 182:         $marker['id'] = '';                                     // The unique identifier of the marker suffix (ie. marker_yourID). If blank, this will default to marker_X where X is an incremental number
 183:         $marker['clickable'] = TRUE;                            // Defines if the marker is clickable
 184:         $marker['cursor'] = '';                                 // The name or url of the cursor to display on hover
 185:         $marker['draggable'] = FALSE;                           // Defines if the marker is draggable
 186:         $marker['flat'] = FALSE;                                // If set to TRUE will not display a shadow beneath the icon
 187:         $marker['icon'] = '';                                   // The name or url of the icon to use for the marker
 188:         $marker['animation'] = '';                              // blank, 'DROP' or 'BOUNCE'
 189:         $marker['onclick'] = '';                                // JavaScript performed when a marker is clicked
 190:         $marker['ondblclick'] = '';                             // JavaScript performed when a marker is double-clicked
 191:         $marker['ondrag'] = '';                                 // JavaScript repeatedly performed while the marker is being dragged
 192:         $marker['ondragstart'] = '';                            // JavaScript performed when a marker is started to be dragged
 193:         $marker['ondragend'] = '';                              // JavaScript performed when a draggable marker is dropped
 194:         $marker['onmousedown'] = '';                            // JavaScript performed when a mousedown event occurs on a marker
 195:         $marker['onmouseout'] = '';                             // JavaScript performed when the mouse leaves the area of the marker icon
 196:         $marker['onmouseover'] = '';                            // JavaScript performed when the mouse enters the area of the marker icon
 197:         $marker['onmouseup'] = '';                              // JavaScript performed when a mouseup event occurs on a marker
 198:         $marker['onpositionchanged'] = '';                      // JavaScript performed when the markers position changes
 199:         $marker['onrightclick'] = '';                           // JavaScript performed when a right-click occurs on a marker
 200:         $marker['raiseondrag'] = TRUE;                          // If FALSE, disables the raising and lowering of the icon when a marker is being dragged
 201:         $marker['shadow'] = '';                                 // The name or url of the icon's shadow
 202:         $marker['title'] = '';                                  // The tooltip text to show on hover
 203:         $marker['visible'] = TRUE;                              // Defines if the marker is visible by default
 204:         $marker['zIndex'] = '';                                 // The zIndex of the marker. If two markers overlap, the marker with the higher zIndex will appear on top
 205: 
 206:         $marker_output = '';
 207: 
 208:         foreach ($params as $key => $value) {
 209: 
 210:             if (isset($marker[$key])) {
 211: 
 212:                 $marker[$key] = $value;
 213: 
 214:             }
 215: 
 216:         }
 217: 
 218:         $marker_id = count($this->markers);
 219:         if (trim($marker['id']) != "")
 220:         {
 221:             $marker_id = $marker['id'];
 222:         }
 223: 
 224:         if ($marker['position']!="") {
 225:             if ($this->is_lat_long($marker['position'])) {
 226:                 $marker_output .= '
 227:             var myLatlng = new google.maps.LatLng('.$marker['position'].');
 228:             ';
 229:                 $explodePosition = explode(",", $marker['position']);
 230:                 $this->markersInfo['marker_'.$marker_id]['latitude'] = trim($explodePosition[0]);
 231:                 $this->markersInfo['marker_'.$marker_id]['longitude'] = trim($explodePosition[1]);
 232:             }else{
 233:                 $lat_long = $this->get_lat_long_from_address($marker['position']);
 234:                 $marker_output .= '
 235:             var myLatlng = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].');';
 236:                 $this->markersInfo['marker_'.$marker_id]['latitude'] = $lat_long[0];
 237:                 $this->markersInfo['marker_'.$marker_id]['longitude'] = $lat_long[1];
 238:             }
 239:         }
 240: 
 241:         $marker_output .= '
 242:             var markerOptions = {
 243:                 map: '.$this->map_name;
 244:         if ($marker['position']!="") {
 245:             $marker_output .= ',
 246:                 position: myLatlng';
 247:         }
 248:         if (!$marker['clickable']) {
 249:             $marker_output .= ',
 250:                 clickable: false';
 251:         }
 252:         if ($marker['cursor']!="") {
 253:             $marker_output .= ',
 254:                 cursor: "'.$marker['cursor'].'"';
 255:         }
 256:         if ($marker['draggable']) {
 257:             $marker_output .= ',
 258:                 draggable: true';
 259:         }
 260:         if ($marker['flat']) {
 261:             $marker_output .= ',
 262:                 flat: true';
 263:         }
 264:         if ($marker['icon']!="") {
 265:             $marker_output .= ',
 266:                 icon: "'.$marker['icon'].'"';
 267:         }
 268:         if (!$marker['raiseondrag']) {
 269:             $marker_output .= ',
 270:                 raiseOnDrag: false';
 271:         }
 272:         if ($marker['shadow']!="") {
 273:             $marker_output .= ',
 274:                 shadow: "'.$marker['shadow'].'"';
 275:         }
 276:         if ($marker['title']!="") {
 277:             $marker_output .= ',
 278:                 title: "'.$marker['title'].'"';
 279:             $this->markersInfo['marker_'.$marker_id]['title'] = $marker['title'];
 280:         }
 281:         if (!$marker['visible']) {
 282:             $marker_output .= ',
 283:                 visible: false';
 284:         }
 285:         if ($marker['zIndex']!="" && is_numeric($marker['zIndex'])) {
 286:             $marker_output .= ',
 287:                 zIndex: '.$marker['zIndex'];
 288:         }
 289:         if ($marker['animation']!="" && (strtoupper($marker['animation'])=="DROP" || strtoupper($marker['animation']=="BOUNCE"))) {
 290:             $marker_output .= ',
 291:                 animation:  google.maps.Animation.'.strtoupper($marker['animation']);
 292:         }
 293:         $marker_output .= '
 294:             };
 295:             marker_'.$marker_id.' = createMarker(markerOptions);
 296:             ';
 297: 
 298:         if ($marker['infowindow_content']!="") {
 299: 
 300:             // Escape any quotes in the event that HTML is being added to the infowindow
 301:             $marker['infowindow_content'] = str_replace('\"', '"', $marker['infowindow_content']);
 302:             $marker['infowindow_content'] = str_replace('"', '\"', $marker['infowindow_content']);
 303:             $marker_output .= '
 304:             marker_'.$marker_id.'.set("content", "'.$marker['infowindow_content'].'");
 305: 
 306:             google.maps.event.addListener(marker_'.$marker_id.', "click", function(event) {
 307:                 iw.setContent(this.get("content"));
 308:                 iw.open('.$this->map_name.', this);
 309:             ';
 310:             if ($marker['onclick']!="") { $marker_output .= $marker['onclick'].'
 311:             '; }
 312:             $marker_output .= '
 313:             });
 314:             ';
 315:             // hack zenphoto
 316:             $marker_output .= '
 317:             oms.addMarker(marker_'.$marker_id.');
 318:             ';
 319:             // end hack zenphoto
 320:         }else{
 321:             if ($marker['onclick']!="") {
 322:                 $marker_output .= '
 323:                 google.maps.event.addListener(marker_'.$marker_id.', "click", function(event) {
 324:                     '.$marker['onclick'].'
 325:                 });
 326:                 ';
 327:             }
 328:         }
 329: 
 330:         if ($marker['ondblclick']!="") {
 331:             $marker_output .= '
 332:             google.maps.event.addListener(marker_'.$marker_id.', "dblclick", function(event) {
 333:                 '.$marker['ondblclick'].'
 334:             });
 335:             ';
 336:         }
 337:         if ($marker['onmousedown']!="") {
 338:             $marker_output .= '
 339:             google.maps.event.addListener(marker_'.$marker_id.', "mousedown", function(event) {
 340:                 '.$marker['onmousedown'].'
 341:             });
 342:             ';
 343:         }
 344:         if ($marker['onmouseout']!="") {
 345:             $marker_output .= '
 346:             google.maps.event.addListener(marker_'.$marker_id.', "mouseout", function(event) {
 347:                 '.$marker['onmouseout'].'
 348:             });
 349:             ';
 350:         }
 351:         if ($marker['onmouseover']!="") {
 352:             $marker_output .= '
 353:             google.maps.event.addListener(marker_'.$marker_id.', "mouseover", function(event) {
 354:                 '.$marker['onmouseover'].'
 355:             });
 356:             ';
 357:         }
 358:         if ($marker['onmouseup']!="") {
 359:             $marker_output .= '
 360:             google.maps.event.addListener(marker_'.$marker_id.', "mouseup", function(event) {
 361:                 '.$marker['onmouseup'].'
 362:             });
 363:             ';
 364:         }
 365:         if ($marker['onpositionchanged']!="") {
 366:             $marker_output .= '
 367:             google.maps.event.addListener(marker_'.$marker_id.', "position_changed", function(event) {
 368:                 '.$marker['onpositionchanged'].'
 369:             });
 370:             ';
 371:         }
 372:         if ($marker['onrightclick']!="") {
 373:             $marker_output .= '
 374:             google.maps.event.addListener(marker_'.$marker_id.', "rightclick", function(event) {
 375:                 '.$marker['onrightclick'].'
 376:             });
 377:             ';
 378:         }
 379: 
 380:         if ($marker['draggable']) {
 381:             if ($marker['ondrag']!="") {
 382:                 $marker_output .= '
 383:                 google.maps.event.addListener(marker_'.$marker_id.', "drag", function(event) {
 384:                     '.$marker['ondrag'].'
 385:                 });
 386:                 ';
 387:             }
 388:             if ($marker['ondragend']!="") {
 389:                 $marker_output .= '
 390:                 google.maps.event.addListener(marker_'.$marker_id.', "dragend", function(event) {
 391:                     '.$marker['ondragend'].'
 392:                 });
 393:                 ';
 394:             }
 395:             if ($marker['ondragstart']!="") {
 396:                 $marker_output .= '
 397:                 google.maps.event.addListener(marker_'.$marker_id.', "dragstart", function(event) {
 398:                     '.$marker['ondragstart'].'
 399:                 });
 400:                 ';
 401:             }
 402:         }
 403: 
 404:         array_push($this->markers, $marker_output);
 405: 
 406:     }
 407: 
 408:     function add_polyline($params = array())
 409:     {
 410: 
 411:         $polyline = array();
 412: 
 413:         $polyline['points'] = array();                          // An array of latitude/longitude coordinates OR addresses, or a mixture of both. If an address is supplied the Google geocoding service will be used to return a lat/long.
 414:         $polyline['clickable'] = TRUE;                          // Defines if the polyline is clickable
 415:         $polyline['strokeColor'] = '#FF0000';                   // The hex value of the polylines color
 416:         $polyline['strokeOpacity'] = '1.0';                     // The opacity of the polyline. 0 to 1.0
 417:         $polyline['strokeWeight'] = '2';                        // The thickness of the polyline
 418:         $polyline['onclick'] = '';                              // JavaScript performed when a polyline is clicked
 419:         $polyline['ondblclick'] = '';                           // JavaScript performed when a polyline is double-clicked
 420:         $polyline['onmousedown'] = '';                          // JavaScript performed when a mousedown event occurs on a polyline
 421:         $polyline['onmousemove'] = '';                          // JavaScript performed when the mouse moves in the area of the polyline
 422:         $polyline['onmouseout'] = '';                           // JavaScript performed when the mouse leaves the area of the polyline
 423:         $polyline['onmouseover'] = '';                          // JavaScript performed when the mouse enters the area of the polyline
 424:         $polyline['onmouseup'] = '';                            // JavaScript performed when a mouseup event occurs on a polyline
 425:         $polyline['onrightclick'] = '';                         // JavaScript performed when a right-click occurs on a polyline
 426:         $polyline['zIndex'] = '';                               // The zIndex of the polyline. If two polylines overlap, the polyline with the higher zIndex will appear on top
 427: 
 428:         $polyline_output = '';
 429: 
 430:         foreach ($params as $key => $value) {
 431: 
 432:             if (isset($polyline[$key])) {
 433: 
 434:                 $polyline[$key] = $value;
 435: 
 436:             }
 437: 
 438:         }
 439: 
 440:         if (count($polyline['points'])) {
 441: 
 442:             $polyline_output .= '
 443:                 var polyline_plan_'.count($this->polylines).' = [';
 444:             $i=0;
 445:             $lat_long_output = '';
 446:             foreach ($polyline['points'] as $point) {
 447:                 if ($i>0) { $polyline_output .= ','; }
 448:                 $lat_long_to_push = '';
 449:                 if ($this->is_lat_long($point)) {
 450:                     $lat_long_to_push = $point;
 451:                     $polyline_output .= '
 452:                     new google.maps.LatLng('.$point.')
 453:                     ';
 454:                 }else{
 455:                     $lat_long = $this->get_lat_long_from_address($point);
 456:                     $polyline_output .= '
 457:                     new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
 458:                     $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
 459:                 }
 460:                 $lat_long_output .= '
 461:                     lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
 462:                 ';
 463:                 $i++;
 464:             }
 465:             $polyline_output .= '];';
 466: 
 467:             $polyline_output .= $lat_long_output;
 468: 
 469:             $polyline_output .= '
 470:                 var polyline_'.count($this->polylines).' = new google.maps.Polyline({
 471:                         path: polyline_plan_'.count($this->polylines).',
 472:                         strokeColor: "'.$polyline['strokeColor'].'",
 473:                         strokeOpacity: '.$polyline['strokeOpacity'].',
 474:                         strokeWeight: '.$polyline['strokeWeight'];
 475:             if (!$polyline['clickable']) {
 476:                 $polyline_output .= ',
 477:                     clickable: false';
 478:             }
 479:             if ($polyline['zIndex']!="" && is_numeric($polyline['zIndex'])) {
 480:                 $polyline_output .= ',
 481:                     zIndex: '.$polyline['zIndex'];
 482:             }
 483:             $polyline_output .= '
 484:                 });
 485: 
 486:                 polyline_'.count($this->polylines).'.setMap('.$this->map_name.');
 487: 
 488:             ';
 489: 
 490:             if ($polyline['onclick']!="") {
 491:                 $polyline_output .= '
 492:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "click", function() {
 493:                     '.$polyline['onclick'].'
 494:                 });
 495:                 ';
 496:             }
 497:             if ($polyline['ondblclick']!="") {
 498:                 $polyline_output .= '
 499:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "dblclick", function() {
 500:                     '.$polyline['ondblclick'].'
 501:                 });
 502:                 ';
 503:             }
 504:             if ($polyline['onmousedown']!="") {
 505:                 $polyline_output .= '
 506:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "mousedown", function() {
 507:                     '.$polyline['onmousedown'].'
 508:                 });
 509:                 ';
 510:             }
 511:             if ($polyline['onmousemove']!="") {
 512:                 $polyline_output .= '
 513:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "mousemove", function() {
 514:                     '.$polyline['onmousemove'].'
 515:                 });
 516:                 ';
 517:             }
 518:             if ($polyline['onmouseout']!="") {
 519:                 $polyline_output .= '
 520:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "mouseout", function() {
 521:                     '.$polyline['onmouseout'].'
 522:                 });
 523:                 ';
 524:             }
 525:             if ($polyline['onmouseover']!="") {
 526:                 $polyline_output .= '
 527:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "mouseover", function() {
 528:                     '.$polyline['onmouseover'].'
 529:                 });
 530:                 ';
 531:             }
 532:             if ($polyline['onmouseup']!="") {
 533:                 $polyline_output .= '
 534:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "mouseup", function() {
 535:                     '.$polyline['onmouseup'].'
 536:                 });
 537:                 ';
 538:             }
 539:             if ($polyline['onrightclick']!="") {
 540:                 $polyline_output .= '
 541:                 google.maps.event.addListener(polyline_'.count($this->polylines).', "rightclick", function() {
 542:                     '.$polyline['onrightclick'].'
 543:                 });
 544:                 ';
 545:             }
 546: 
 547:             array_push($this->polylines, $polyline_output);
 548: 
 549:         }
 550: 
 551:     }
 552: 
 553:     function add_polygon($params = array())
 554:     {
 555: 
 556:         $polygon = array();
 557: 
 558:         $polygon['points'] = array();                           // The positions (latitude/longitude coordinates OR addresses) at which the polygon points will appear. NOTE: The first and last elements of the array must be the same
 559:         $polygon['clickable'] = TRUE;                           // Defines if the polygon is clickable
 560:         $polygon['strokeColor'] = '#FF0000';                    // The hex value of the polygons border color
 561:         $polygon['strokeOpacity'] = '0.8';                      // The opacity of the polygon border. 0 to 1.0
 562:         $polygon['strokeWeight'] = '2';                         // The thickness of the polygon border
 563:         $polygon['fillColor'] = '#FF0000';                      // The hex value of the polygons fill color
 564:         $polygon['fillOpacity'] = '0.3';                        // The opacity of the polygons fill
 565:         $polygon['onclick'] = '';                               // JavaScript performed when a polygon is clicked
 566:         $polygon['ondblclick'] = '';                            // JavaScript performed when a polygon is double-clicked
 567:         $polygon['onmousedown'] = '';                           // JavaScript performed when a mousedown event occurs on a polygon
 568:         $polygon['onmousemove'] = '';                           // JavaScript performed when the mouse moves in the area of the polygon
 569:         $polygon['onmouseout'] = '';                            // JavaScript performed when the mouse leaves the area of the polygon
 570:         $polygon['onmouseover'] = '';                           // JavaScript performed when the mouse enters the area of the polygon
 571:         $polygon['onmouseup'] = '';                             // JavaScript performed when a mouseup event occurs on a polygon
 572:         $polygon['onrightclick'] = '';                          // JavaScript performed when a right-click occurs on a polygon
 573:         $polygon['zIndex'] = '';                                // The zIndex of the polygon. If two polygons overlap, the polygon with the higher zIndex will appear on top
 574: 
 575:         $polygon_output = '';
 576: 
 577:         foreach ($params as $key => $value) {
 578: 
 579:             if (isset($polygon[$key])) {
 580: 
 581:                 $polygon[$key] = $value;
 582: 
 583:             }
 584: 
 585:         }
 586: 
 587:         if (count($polygon['points'])) {
 588: 
 589:             $polygon_output .= '
 590:                 var polygon_plan_'.count($this->polygons).' = [';
 591:             $i=0;
 592:             $lat_long_output = '';
 593:             foreach ($polygon['points'] as $point) {
 594:                 if ($i>0) { $polygon_output .= ','; }
 595:                 $lat_long_to_push = '';
 596:                 if ($this->is_lat_long($point)) {
 597:                     $lat_long_to_push = $point;
 598:                     $polygon_output .= '
 599:                     new google.maps.LatLng('.$point.')
 600:                     ';
 601:                 }else{
 602:                     $lat_long = $this->get_lat_long_from_address($point);
 603:                     $polygon_output .= '
 604:                     new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
 605:                     $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
 606:                 }
 607:                 $lat_long_output .= '
 608:                     lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
 609:                 ';
 610:                 $i++;
 611:             }
 612:             $polygon_output .= '];';
 613: 
 614:             $polygon_output .= $lat_long_output;
 615: 
 616:         }
 617: 
 618:         $polygon_output .= '
 619:             var polygon_'.count($this->polygons).' = new google.maps.Polygon({
 620:                     ';
 621:         if (count($polygon['points'])) {
 622:             $polygon_output .= 'path: polygon_plan_'.count($this->polygons).',
 623:                     ';
 624:         }
 625:         $polygon_output .= '
 626:                     strokeColor: "'.$polygon['strokeColor'].'",
 627:                     strokeOpacity: '.$polygon['strokeOpacity'].',
 628:                     strokeWeight: '.$polygon['strokeWeight'].',
 629:                 fillColor: "'.$polygon['fillColor'].'",
 630:                 fillOpacity: '.$polygon['fillOpacity'];
 631:         if (!$polygon['clickable']) {
 632:             $polygon_output .= ',
 633:                 clickable: false';
 634:         }
 635:         if ($polygon['zIndex']!="" && is_numeric($polygon['zIndex'])) {
 636:             $polygon_output .= ',
 637:                 zIndex: '.$polygon['zIndex'];
 638:         }
 639:         $polygon_output .= '
 640:             });
 641: 
 642:             polygon_'.count($this->polygons).'.setMap('.$this->map_name.');
 643: 
 644:         ';
 645: 
 646:         if ($polygon['onclick']!="") {
 647:             $polygon_output .= '
 648:             google.maps.event.addListener(polygon_'.count($this->polygons).', "click", function() {
 649:                 '.$polygon['onclick'].'
 650:             });
 651:             ';
 652:         }
 653:         if ($polygon['ondblclick']!="") {
 654:             $polygon_output .= '
 655:             google.maps.event.addListener(polygon_'.count($this->polygons).', "dblclick", function() {
 656:                 '.$polygon['ondblclick'].'
 657:             });
 658:             ';
 659:         }
 660:         if ($polygon['onmousedown']!="") {
 661:             $polygon_output .= '
 662:             google.maps.event.addListener(polygon_'.count($this->polygons).', "mousedown", function() {
 663:                 '.$polygon['onmousedown'].'
 664:             });
 665:             ';
 666:         }
 667:         if ($polygon['onmousemove']!="") {
 668:             $polygon_output .= '
 669:             google.maps.event.addListener(polygon_'.count($this->polygons).', "mousemove", function() {
 670:                 '.$polygon['onmousemove'].'
 671:             });
 672:             ';
 673:         }
 674:         if ($polygon['onmouseout']!="") {
 675:             $polygon_output .= '
 676:             google.maps.event.addListener(polygon_'.count($this->polygons).', "mouseout", function() {
 677:                 '.$polygon['onmouseout'].'
 678:             });
 679:             ';
 680:         }
 681:         if ($polygon['onmouseover']!="") {
 682:             $polygon_output .= '
 683:             google.maps.event.addListener(polygon_'.count($this->polygons).', "mouseover", function() {
 684:                 '.$polygon['onmouseover'].'
 685:             });
 686:             ';
 687:         }
 688:         if ($polygon['onmouseup']!="") {
 689:             $polygon_output .= '
 690:             google.maps.event.addListener(polygon_'.count($this->polygons).', "mouseup", function() {
 691:                 '.$polygon['onmouseup'].'
 692:             });
 693:             ';
 694:         }
 695:         if ($polygon['onrightclick']!="") {
 696:             $polygon_output .= '
 697:             google.maps.event.addListener(polygon_'.count($this->polygons).', "rightclick", function() {
 698:                 '.$polygon['onrightclick'].'
 699:             });
 700:             ';
 701:         }
 702: 
 703:         array_push($this->polygons, $polygon_output);
 704: 
 705:     }
 706: 
 707:     function add_circle($params = array())
 708:     {
 709: 
 710:         $circle = array();
 711: 
 712:         $circle['center'] = '';                                 // The center position (latitude/longitude coordinate OR addresse) at which the circle will appear
 713:         $circle['clickable'] = TRUE;                            // Defines if the circle is clickable
 714:         $circle['radius'] = 0;                                  // The circle radius (in metres)
 715:         $circle['strokeColor'] = '0.8';                         // The hex value of the circles border color
 716:         $circle['strokeOpacity'] = '0.8';                       // The opacity of the circle border
 717:         $circle['strokeWeight'] = '2';                          // The thickness of the circle border
 718:         $circle['fillColor'] = '#FF0000';                       // The hex value of the circles fill color
 719:         $circle['fillOpacity'] = '0.3';                         // The opacity of the circles fill
 720:         $circle['onclick'] = '';                                // JavaScript performed when a circle is clicked
 721:         $circle['ondblclick'] = '';                             // JavaScript performed when a circle is double-clicked
 722:         $circle['onmousedown'] = '';                            // JavaScript performed when a mousedown event occurs on a circle
 723:         $circle['onmousemove'] = '';                            // JavaScript performed when the mouse moves in the area of the circle
 724:         $circle['onmouseout'] = '';                             // JavaScript performed when the mouse leaves the area of the circle
 725:         $circle['onmouseover'] = '';                            // JavaScript performed when the mouse enters the area of the circle
 726:         $circle['onmouseup'] = '';                              // JavaScript performed when a mouseup event occurs on a circle
 727:         $circle['onrightclick'] = '';                           // JavaScript performed when a right-click occurs on a circle
 728:         $circle['zIndex'] = '';                                 // The zIndex of the circle. If two circles overlap, the circle with the higher zIndex will appear on top
 729: 
 730:         $circle_output = '';
 731: 
 732:         foreach ($params as $key => $value) {
 733: 
 734:             if (isset($circle[$key])) {
 735: 
 736:                 $circle[$key] = $value;
 737: 
 738:             }
 739: 
 740:         }
 741: 
 742:         if ($circle['radius']>0 && $circle['center']!="") {
 743: 
 744:             $lat_long_to_push = '';
 745:             if ($this->is_lat_long($circle['center'])) {
 746:                 $lat_long_to_push = $circle['center'];
 747:                 $circle_output = '
 748:                 var circleCenter = new google.maps.LatLng('.$circle['center'].')
 749:                 ';
 750:             }else{
 751:                 $lat_long = $this->get_lat_long_from_address($circle['center']);
 752:                 $circle_output = '
 753:                 var circleCenter = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
 754:                 $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
 755:             }
 756:             $circle_output .= '
 757:                 lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
 758:             ';
 759: 
 760:             $circle_output .= '
 761:                 var circleOptions = {
 762:                     strokeColor: "'.$circle['strokeColor'].'",
 763:                     strokeOpacity: '.$circle['strokeOpacity'].',
 764:                     strokeWeight: '.$circle['strokeWeight'].',
 765:                     fillColor: "'.$circle['fillColor'].'",
 766:                     fillOpacity: '.$circle['fillOpacity'].',
 767:                     map: '.$this->map_name.',
 768:                     center: circleCenter,
 769:                     radius: '.$circle['radius'];
 770:             if (!$circle['clickable']) {
 771:                 $circle_output .= ',
 772:                     clickable: false';
 773:             }
 774:             if ($circle['zIndex']!="" && is_numeric($circle['zIndex'])) {
 775:                 $circle_output .= ',
 776:                     zIndex: '.$circle['zIndex'];
 777:             }
 778:             $circle_output .= '
 779:                 };
 780:                 var circle_'.count($this->circles).' = new google.maps.Circle(circleOptions);
 781:             ';
 782: 
 783:             if ($circle['onclick']!="") {
 784:                 $circle_output .= '
 785:                 google.maps.event.addListener(circle_'.count($this->circles).', "click", function() {
 786:                     '.$circle['onclick'].'
 787:                 });
 788:                 ';
 789:             }
 790:             if ($circle['ondblclick']!="") {
 791:                 $circle_output .= '
 792:                 google.maps.event.addListener(circle_'.count($this->circles).', "dblclick", function() {
 793:                     '.$circle['ondblclick'].'
 794:                 });
 795:                 ';
 796:             }
 797:             if ($circle['onmousedown']!="") {
 798:                 $circle_output .= '
 799:                 google.maps.event.addListener(circle_'.count($this->circles).', "mousedown", function() {
 800:                     '.$circle['onmousedown'].'
 801:                 });
 802:                 ';
 803:             }
 804:             if ($circle['onmousemove']!="") {
 805:                 $circle_output .= '
 806:                 google.maps.event.addListener(circle_'.count($this->circles).', "mousemove", function() {
 807:                     '.$circle['onmousemove'].'
 808:                 });
 809:                 ';
 810:             }
 811:             if ($circle['onmouseout']!="") {
 812:                 $circle_output .= '
 813:                 google.maps.event.addListener(circle_'.count($this->circles).', "mouseout", function() {
 814:                     '.$circle['onmouseout'].'
 815:                 });
 816:                 ';
 817:             }
 818:             if ($circle['onmouseover']!="") {
 819:                 $circle_output .= '
 820:                 google.maps.event.addListener(circle_'.count($this->circles).', "mouseover", function() {
 821:                     '.$circle['onmouseover'].'
 822:                 });
 823:                 ';
 824:             }
 825:             if ($circle['onmouseup']!="") {
 826:                 $circle_output .= '
 827:                 google.maps.event.addListener(circle_'.count($this->circles).', "mouseup", function() {
 828:                     '.$circle['onmouseup'].'
 829:                 });
 830:                 ';
 831:             }
 832:             if ($circle['onrightclick']!="") {
 833:                 $circle_output .= '
 834:                 google.maps.event.addListener(circle_'.count($this->circles).', "rightclick", function() {
 835:                     '.$circle['onrightclick'].'
 836:                 });
 837:                 ';
 838:             }
 839: 
 840:             array_push($this->circles, $circle_output);
 841: 
 842:         }
 843: 
 844:     }
 845: 
 846:     function add_rectangle($params = array())
 847:     {
 848: 
 849:         $rectangle = array();
 850: 
 851:         $rectangle['positionSW'] = '';                          // The South-West position (latitude/longitude coordinate OR address) at which the rectangle will appear
 852:         $rectangle['positionNE'] = '';                          // The North-East position(latitude/longitude coordinate OR address) at which the rectangle will appear
 853:         $rectangle['clickable'] = TRUE;                         // Defines if the rectangle is clickable
 854:         $rectangle['strokeColor'] = '0.8';                      // The hex value of the rectangles border color
 855:         $rectangle['strokeOpacity'] = '0.8';                    // The opacity of the rectangle border
 856:         $rectangle['strokeWeight'] = '2';                       // The thickness of the rectangle border
 857:         $rectangle['fillColor'] = '#FF0000';                    // The hex value of the rectangles fill color
 858:         $rectangle['fillOpacity'] = '0.3';                      // The opacity of the rectangles fill
 859:         $rectangle['onclick'] = '';                             // JavaScript performed when a rectangle is clicked
 860:         $rectangle['ondblclick'] = '';                          // JavaScript performed when a rectangle is double-clicked
 861:         $rectangle['onmousedown'] = '';                         // JavaScript performed when a mousedown event occurs on a rectangle
 862:         $rectangle['onmousemove'] = '';                         // JavaScript performed when the mouse moves in the area of the rectangle
 863:         $rectangle['onmouseout'] = '';                          // JavaScript performed when the mouse leaves the area of the rectangle
 864:         $rectangle['onmouseover'] = '';                         // JavaScript performed when the mouse enters the area of the rectangle
 865:         $rectangle['onmouseup'] = '';                           // JavaScript performed when a mouseup event occurs on a rectangle
 866:         $rectangle['onrightclick'] = '';                        // JavaScript performed when a right-click occurs on a rectangle
 867:         $rectangle['zIndex'] = '';                              // The zIndex of the rectangle. If two rectangles overlap, the rectangle with the higher zIndex will appear on top
 868: 
 869:         $rectangle_output = '';
 870: 
 871:         foreach ($params as $key => $value) {
 872: 
 873:             if (isset($rectangle[$key])) {
 874: 
 875:                 $rectangle[$key] = $value;
 876: 
 877:             }
 878: 
 879:         }
 880: 
 881:         if ($rectangle['positionSW']!="" && $rectangle['positionNE']!="") {
 882: 
 883:             $lat_long_to_push = '';
 884:             if ($this->is_lat_long($rectangle['positionSW'])) {
 885:                 $lat_long_to_push = $rectangle['positionSW'];
 886:                 $rectangle_output .= '
 887:                 var positionSW = new google.maps.LatLng('.$rectangle['positionSW'].')
 888:                 ';
 889:             }else{
 890:                 $lat_long = $this->get_lat_long_from_address($rectangle['positionSW']);
 891:                 $rectangle_output .= '
 892:                 var positionSW = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
 893:                 $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
 894:             }
 895:             $rectangle_output .= '
 896:                 lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
 897:             ';
 898: 
 899:             $lat_long_to_push = '';
 900:             if ($this->is_lat_long($rectangle['positionNE'])) {
 901:                 $lat_long_to_push = $rectangle['positionNE'];
 902:                 $rectangle_output .= '
 903:                 var positionNE = new google.maps.LatLng('.$rectangle['positionNE'].')
 904:                 ';
 905:             }else{
 906:                 $lat_long = $this->get_lat_long_from_address($rectangle['positionNE']);
 907:                 $rectangle_output .= '
 908:                 var positionNE = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
 909:                 $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
 910:             }
 911:             $rectangle_output .= '
 912:                 lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
 913:             ';
 914: 
 915:             $rectangle_output .= '
 916:                 var rectangleOptions = {
 917:                     strokeColor: "'.$rectangle['strokeColor'].'",
 918:                     strokeOpacity: '.$rectangle['strokeOpacity'].',
 919:                     strokeWeight: '.$rectangle['strokeWeight'].',
 920:                     fillColor: "'.$rectangle['fillColor'].'",
 921:                     fillOpacity: '.$rectangle['fillOpacity'].',
 922:                     map: '.$this->map_name.',
 923:                     bounds: new google.maps.LatLngBounds(positionSW, positionNE)';
 924:             if (!$rectangle['clickable']) {
 925:                 $rectangle_output .= ',
 926:                     clickable: false';
 927:             }
 928:             if ($rectangle['zIndex']!="" && is_numeric($rectangle['zIndex'])) {
 929:                 $rectangle_output .= ',
 930:                     zIndex: '.$rectangle['zIndex'];
 931:             }
 932:             $rectangle_output .= '
 933:                 };';
 934: 
 935:             $rectangle_output .= '
 936:                 var rectangle_'.count($this->rectangles).' = new google.maps.Rectangle(rectangleOptions);
 937:             ';
 938: 
 939:             if ($rectangle['onclick']!="") {
 940:                 $rectangle_output .= '
 941:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "click", function() {
 942:                     '.$rectangle['onclick'].'
 943:                 });
 944:                 ';
 945:             }
 946:             if ($rectangle['ondblclick']!="") {
 947:                 $rectangle_output .= '
 948:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "dblclick", function() {
 949:                     '.$rectangle['ondblclick'].'
 950:                 });
 951:                 ';
 952:             }
 953:             if ($rectangle['onmousedown']!="") {
 954:                 $rectangle_output .= '
 955:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "mousedown", function() {
 956:                     '.$rectangle['onmousedown'].'
 957:                 });
 958:                 ';
 959:             }
 960:             if ($rectangle['onmousemove']!="") {
 961:                 $rectangle_output .= '
 962:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "mousemove", function() {
 963:                     '.$rectangle['onmousemove'].'
 964:                 });
 965:                 ';
 966:             }
 967:             if ($rectangle['onmouseout']!="") {
 968:                 $rectangle_output .= '
 969:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "mouseout", function() {
 970:                     '.$rectangle['onmouseout'].'
 971:                 });
 972:                 ';
 973:             }
 974:             if ($rectangle['onmouseover']!="") {
 975:                 $rectangle_output .= '
 976:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "mouseover", function() {
 977:                     '.$rectangle['onmouseover'].'
 978:                 });
 979:                 ';
 980:             }
 981:             if ($rectangle['onmouseup']!="") {
 982:                 $rectangle_output .= '
 983:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "mouseup", function() {
 984:                     '.$rectangle['onmouseup'].'
 985:                 });
 986:                 ';
 987:             }
 988:             if ($rectangle['onrightclick']!="") {
 989:                 $rectangle_output .= '
 990:                 google.maps.event.addListener(rectangle_'.count($this->rectangles).', "rightclick", function() {
 991:                     '.$rectangle['onrightclick'].'
 992:                 });
 993:                 ';
 994:             }
 995: 
 996:             array_push($this->rectangles, $rectangle_output);
 997: 
 998:         }
 999: 
1000:     }
1001: 
1002:     function add_ground_overlay($params = array())
1003:     {
1004: 
1005:         $overlay = array();
1006: 
1007:         $overlay['image'] = '';                                 // JavaScript performed when a ground overlay is clicked
1008:         $overlay['positionSW'] = '';                            // The South-West position (latitude/longitude coordinate OR addresse) at which the ground overlay will appear
1009:         $overlay['positionNE'] = '';                            // The North-East position (latitude/longitude coordinate OR addresse) at which the ground overlay will appear
1010:         $overlay['clickable'] = TRUE;                           // Defines if the ground overlay is clickable
1011:         $overlay['onclick'] = '';                               // JavaScript performed when a ground overlay is clicked
1012: 
1013:         $overlay_output = '';
1014: 
1015:         foreach ($params as $key => $value) {
1016: 
1017:             if (isset($overlay[$key])) {
1018: 
1019:                 $overlay[$key] = $value;
1020: 
1021:             }
1022: 
1023:         }
1024: 
1025:         if ($overlay['image']!="" && $overlay['positionSW']!="" && $overlay['positionNE']!="") {
1026: 
1027:             $lat_long_to_push = '';
1028:             if ($this->is_lat_long($overlay['positionSW'])) {
1029:                 $lat_long_to_push = $overlay['positionSW'];
1030:                 $overlay_output .= '
1031:                 var positionSW = new google.maps.LatLng('.$overlay['positionSW'].')
1032:                 ';
1033:             }else{
1034:                 $lat_long = $this->get_lat_long_from_address($overlay['positionSW']);
1035:                 $overlay_output .= '
1036:                 var positionSW = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
1037:                 $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
1038:             }
1039:             $overlay_output .= '
1040:                 lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
1041:             ';
1042: 
1043:             $lat_long_to_push = '';
1044:             if ($this->is_lat_long($overlay['positionNE'])) {
1045:                 $lat_long_to_push = $overlay['positionNE'];
1046:                 $overlay_output .= '
1047:                 var positionNE = new google.maps.LatLng('.$overlay['positionNE'].')
1048:                 ';
1049:             }else{
1050:                 $lat_long = $this->get_lat_long_from_address($overlay['positionNE']);
1051:                 $overlay_output .= '
1052:                 var positionNE = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')';
1053:                 $lat_long_to_push = $lat_long[0].', '.$lat_long[1];
1054:             }
1055:             $overlay_output .= '
1056:                 lat_longs.push(new google.maps.LatLng('.$lat_long_to_push.'));
1057:             ';
1058: 
1059:             $overlay_output .= '
1060:                 var overlay_'.count($this->overlays).' = new google.maps.GroundOverlay("'.$overlay['image'].'", new google.maps.LatLngBounds(positionSW, positionNE), { map: '.$this->map_name;
1061:             if (!$overlay['clickable']) { $overlay_output .= ', clickable: false'; }
1062:             $overlay_output .= '});
1063:             ';
1064: 
1065:             if ($overlay['onclick']!="") {
1066:                 $overlay_output .= '
1067:                 google.maps.event.addListener(overlay_'.count($this->overlays).', "click", function() {
1068:                     '.$overlay['onclick'].'
1069:                 });
1070:                 ';
1071:             }
1072: 
1073:             array_push($this->overlays, $overlay_output);
1074: 
1075:         }
1076: 
1077:     }
1078: 
1079:     function create_map()
1080:     {
1081: 
1082:         $this->output_js = '';
1083:         $this->output_js_contents = '';
1084:         $this->output_html = '';
1085: 
1086:         if ($this->apiKey!="")
1087:         {
1088:             if ($this->https) { $apiLocation = 'https'; }else{ $apiLocation = 'http'; }
1089:             $apiLocation .= '://maps.googleapis.com/maps/api/js?key='.$this->apiKey.'&';
1090:         }
1091:         else
1092:         {
1093:         if ($this->https) { $apiLocation = 'https://maps-api-ssl'; }else{ $apiLocation = 'http://maps'; }
1094:             $apiLocation .= '.google.com/maps/api/js?';
1095:         }
1096:         $apiLocation .= 'sensor='.$this->sensor;
1097:         if ($this->region!="" && strlen($this->region)==2) { $apiLocation .= '&region='.strtoupper($this->region); }
1098:         if ($this->language!="") { $apiLocation .= '&language='.$this->language; }
1099:         $libraries = array();
1100:         if ($this->adsense!="") { array_push($libraries, 'adsense'); }
1101:         if ($this->places!="") { array_push($libraries, 'places'); }
1102:         if ($this->panoramio) { array_push($libraries, 'panoramio'); }
1103:         if ($this->drawing) { array_push($libraries, 'drawing'); }
1104:         if (count($libraries)) { $apiLocation .= '&libraries='.implode(",", $libraries); }
1105:         $this->output_js .= '
1106:         <script type="text/javascript" src="'.$apiLocation.'"></script>';
1107:         if ($this->center=="auto" || $this->directionsStart=="auto") { $this->output_js .= '
1108:         <script type="text/javascript" src="http://code.google.com/apis/gears/gears_init.js"></script>
1109:         '; } // Script not hosted on Google anymore !
1110:         if ($this->cluster) { $this->output_js .= '
1111:         <script type="text/javascript" src="' . WEBPATH . '/' . USER_PLUGIN_FOLDER . '/GoogleMap-plugins/markerclusterer.js"></script>
1112:         '; } // Script not hosted on Google anymore !
1113:         if ($this->jsfile=="") {
1114:             $this->output_js .= '
1115:             <script type="text/javascript">
1116:             //<![CDATA[
1117:             ';
1118:         }
1119: 
1120:         $this->output_js_contents .= '
1121:             var '.$this->map_name.'; // Global declaration of the map
1122: 
1123:             // hack zenphoto
1124:             //var iw = new google.maps.InfoWindow(); // Global declaration of the infowindow
1125:             var iw = new google.maps.InfoWindow({maxWidth:250}); // Global declaration of the infowindow
1126:             var lat_longs = new Array();
1127:             var markers = new Array();
1128:             ';
1129:         if ($this->cluster) {
1130:             $this->output_js_contents .= 'var markerCluster;
1131:             ';
1132:         }
1133:         if ($this->directions) {
1134:             $rendererOptions = '';
1135:             if ($this->directionsDraggable) {
1136:                 $this->output_js_contents .= '
1137:             var rendererOptions = { draggable: true };
1138:             ';
1139:                 $rendererOptions = 'rendererOptions';
1140:             }
1141:             $this->output_js_contents .= 'var directionsDisplay = new google.maps.DirectionsRenderer('.$rendererOptions.');
1142:             var directionsService = new google.maps.DirectionsService();
1143:             ';
1144:         }
1145:         if ($this->places) {
1146:             $this->output_js_contents .= 'var placesService;
1147:             ';
1148:             if ($this->placesAutocompleteInputID != "")
1149:             {
1150:                 $this->output_js_contents .= 'var placesAutocomplete;
1151:             ';
1152:             }
1153:         }
1154:         if ($this->adsense) {
1155:             $this->output_js_contents .= 'var adUnit;
1156:             ';
1157:         }
1158:         if ($this->drawing) {
1159:             $this->output_js_contents .= 'var drawingManager;
1160:             ';
1161:         }
1162: 
1163:         $this->output_js_contents .= 'function initialize() {
1164: 
1165:                  ';
1166: 
1167:         $styleOutput = '';
1168:         if (count($this->styles)) {
1169:             $styles = 0;
1170:             foreach ($this->styles as $style) {
1171:                 $this->output_js_contents .= 'var styles_'.$styles.' = '.json_encode($style['definition']).';
1172:                 ';
1173: 
1174:                 if ($this->stylesAsMapTypes) {
1175:                     $this->output_js_contents .= 'var styles_'.$styles.' = new google.maps.StyledMapType(styles_'.$styles.', {name:"'.$style['name'].'"});
1176:                 ';
1177:                 }else{
1178:                     $styleOutput .= $this->map_name.'.setOptions({styles: styles_'.$styles.'});
1179:                 ';
1180:                     break;
1181:                 }
1182: 
1183:                 $styles++;
1184:             }
1185:         }
1186: 
1187:         if ($this->center!="auto") {
1188:             if ($this->is_lat_long($this->center)) { // if centering the map on a lat/long
1189:                 $this->output_js_contents .= 'var myLatlng = new google.maps.LatLng('.$this->center.');';
1190:             }else{  // if centering the map on an address
1191:                 $lat_long = $this->get_lat_long_from_address($this->center);
1192:                 $this->output_js_contents .= 'var myLatlng = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].');';
1193:             }
1194:         }
1195: 
1196:         $this->output_js_contents .= '
1197:                 var myOptions = {
1198:                         ';
1199:         if ($this->zoom=="auto") { $this->output_js_contents .= 'zoom: 13,'; }else{ $this->output_js_contents .= 'zoom: '.$this->zoom.','; }
1200:         if ($this->center!="auto") { $this->output_js_contents .= '
1201:                     center: myLatlng,'; }
1202:         if (strtolower($this->map_type)=="street") { $map_type = "ROADMAP"; }else{ $map_type = $this->map_type; }
1203:         $this->output_js_contents .= '
1204:                         mapTypeId: google.maps.MapTypeId.'.$map_type;
1205:         if ($this->backgroundColor) {
1206:             $this->output_js_contents .= ',
1207:                     backgroundColor: \''.$this->backgroundColor.'\'';
1208:         }
1209:         if ($this->disableDefaultUI) {
1210:             $this->output_js_contents .= ',
1211:                     disableDefaultUI: true';
1212:         }
1213:         if ($this->disableMapTypeControl) {
1214:             $this->output_js_contents .= ',
1215:                     mapTypeControl: false';
1216:         }
1217:         if ($this->disableNavigationControl) {
1218:             $this->output_js_contents .= ',
1219:                     navigationControl: false';
1220:         }
1221:         if ($this->disableScaleControl) {
1222:             $this->output_js_contents .= ',
1223:                     scaleControl: false';
1224:         }
1225:         if ($this->disableStreetViewControl) {
1226:             $this->output_js_contents .= ',
1227:                     streetViewControl: false';
1228:         }
1229:         if ($this->disableDoubleClickZoom) {
1230:             $this->output_js_contents .= ',
1231:                     disableDoubleClickZoom: true';
1232:         }
1233:         if (!$this->draggable) {
1234:             $this->output_js_contents .= ',
1235:                     draggable: false';
1236:         }
1237:         if ($this->draggableCursor!="") {
1238:             $this->output_js_contents .= ',
1239:                     draggableCursor: "'.$this->draggableCursor.'"';
1240:         }
1241:         if ($this->draggingCursor!="") {
1242:             $this->output_js_contents .= ',
1243:                     draggingCursor: "'.$this->draggingCursor.'"';
1244:         }
1245:         if (!$this->keyboardShortcuts) {
1246:             $this->output_js_contents .= ',
1247:                     keyboardShortcuts: false';
1248:         }
1249:         $mapTypeControlOptions = array();
1250:         $map_types = array();
1251:         if ($this->mapTypeControlPosition!="") {
1252:             array_push($mapTypeControlOptions, 'position: google.maps.ControlPosition.'.strtoupper($this->mapTypeControlPosition));
1253:         }
1254:         if ($this->mapTypeControlStyle!="" && (strtoupper($this->mapTypeControlStyle)=="DROPDOWN_MENU" || strtoupper($this->mapTypeControlStyle)=="HORIZONTAL_BAR")) {
1255:             array_push($mapTypeControlOptions, 'style: google.maps.MapTypeControlStyle.'.strtoupper($this->mapTypeControlStyle));
1256:         }
1257:         if (count($this->map_types_available)) {
1258:             foreach ($this->map_types_available as $map_type) { array_push($map_types, 'google.maps.MapTypeId.'.strtoupper($map_type)); }
1259:         }
1260:         if (count($this->styles) && $this->stylesAsMapTypes) {
1261:             $styles = 0;
1262:             foreach ($this->styles as $style) {
1263:                 array_push($map_types, '"style'.$styles.'"');
1264:                 $styleOutput .= '
1265:                         '.$this->map_name.'.mapTypes.set("style'.$styles.'", styles_'.$styles.');
1266:                 ';
1267:                 if ($this->stylesAsMapTypesDefault==$style['name']) {
1268:                 $styleOutput .= '
1269:                         '.$this->map_name.'.setMapTypeId("style'.$styles.'");
1270:                 ';
1271:                 }
1272:                 $styles++;
1273:             }
1274:         }
1275:         if (count($map_types)) {
1276:             array_push($mapTypeControlOptions, 'mapTypeIds: ['.implode(", ", $map_types).']');
1277:         }
1278:         if (count($mapTypeControlOptions)) {
1279:             $this->output_js_contents .= ',
1280:                     mapTypeControlOptions: {'.implode(",", $mapTypeControlOptions).'}';
1281:         }
1282:         if ($this->minzoom!="") {
1283:             $this->output_js_contents .= ',
1284:                     minZoom: '.$this->minzoom;
1285:         }
1286:         if ($this->maxzoom!="") {
1287:             $this->output_js_contents .= ',
1288:                     maxZoom: '.$this->maxzoom;
1289:         }
1290:         if ($this->noClear) {
1291:             $this->output_js_contents .= ',
1292:                     noClear: true';
1293:         }
1294:         if ($this->navigationControlPosition!="") {
1295:             $this->output_js_contents .= ',
1296:                     navigationControlOptions: {position: google.maps.ControlPosition.'.strtoupper($this->navigationControlPosition).'}';
1297:         }
1298:         if ($this->scaleControlPosition!="") {
1299:             $this->output_js_contents .= ',
1300:                     scaleControlOptions: {position: google.maps.ControlPosition.'.strtoupper($this->scaleControlPosition).'}';
1301:         }
1302:         if (!$this->scrollwheel) {
1303:             $this->output_js_contents .= ',
1304:                     scrollwheel: false';
1305:         }
1306:         if ($this->streetViewControlPosition!="") {
1307:             $this->output_js_contents .= ',
1308:                     streetViewControlOptions: {position: google.maps.ControlPosition.'.strtoupper($this->streetViewControlPosition).'}';
1309:         }
1310:         if ($this->tilt==45) {
1311:             $this->output_js_contents .= ',
1312:                     tilt: '.$this->tilt;
1313:         }
1314:         $zoomControlOptions = array();
1315:         if ($this->zoomControlPosition!="") { array_push($zoomControlOptions, 'position: google.maps.ControlPosition.'.strtoupper($this->zoomControlPosition)); }
1316:         if ($this->zoomControlStyle!="" && (strtoupper($this->zoomControlStyle)=="SMALL" || strtoupper($this->zoomControlStyle)=="LARGE")) { array_push($zoomControlOptions, 'style: google.maps.ZoomControlStyle.'.strtoupper($this->zoomControlStyle)); }
1317:         if (count($zoomControlOptions)) {
1318:             $this->output_js_contents .= ',
1319:                     zoomControlOptions: {'.implode(",", $zoomControlOptions).'}';
1320:         }
1321:         $this->output_js_contents .= '}
1322:                 '.$this->map_name.' = new google.maps.Map(document.getElementById("'.$this->map_div_id.'"), myOptions);
1323:                 ';
1324: 
1325:         if ($styleOutput!="") {
1326:             $this->output_js_contents .= $styleOutput.'
1327:                 ';
1328:         }
1329: 
1330:         // hack zenphoto
1331:         $this->output_js_contents .= '
1332:                 var oms = new OverlappingMarkerSpiderfier(map, {keepSpiderfied: true});
1333: 
1334:                 oms.addListener("click", function(marker){
1335:                     iw.setContent(marker.get("content"));
1336:                     iw.open(map, marker);
1337:                 });
1338:                 oms.addListener("spiderfy", function(markers){
1339:                     iw.close();
1340:                 });
1341: 
1342:                 ';
1343:         // end hack zenphoto
1344: 
1345:         if ($this->trafficOverlay) {
1346:             $this->output_js_contents .= 'var trafficLayer = new google.maps.TrafficLayer();
1347:                 trafficLayer.setMap('.$this->map_name.');
1348:                 ';
1349:         }
1350:         if ($this->bicyclingOverlay) {
1351:             $this->output_js_contents .= 'var bikeLayer = new google.maps.BicyclingLayer();
1352:                 bikeLayer.setMap('.$this->map_name.');
1353:                 ';
1354:         }
1355: 
1356:         if ($this->kmlLayerURL!="") {
1357:             $this->output_js_contents .= '
1358:                 var kmlLayerOptions = {
1359:                     map: '.$this->map_name;
1360:             if ($this->kmlLayerPreserveViewport) {
1361:                 $this->output_js_contents .= ',
1362:                     preserveViewport: true';
1363:             }
1364:             $this->output_js_contents .= '
1365:                 }
1366:                 var kmlLayer = new google.maps.KmlLayer("'.$this->kmlLayerURL.'", kmlLayerOptions);
1367:                 ';
1368:         }
1369: 
1370:         if ($this->panoramio) {
1371:             $this->output_js_contents .= 'var panoramioLayer = new google.maps.panoramio.PanoramioLayer();
1372:                 ';
1373:             if ($this->panoramioTag!="") { $this->output_js_contents .= 'panoramioLayer.setTag("'.$this->panoramioTag.'");
1374:                 '; }
1375:             if ($this->panoramioUser!="") { $this->output_js_contents .= 'panoramioLayer.setUserId("'.$this->panoramioUser.'");
1376:                 '; }
1377:             $this->output_js_contents .= '
1378:                 panoramioLayer.setMap('.$this->map_name.');
1379:                 ';
1380:         }
1381: 
1382:         if (strtolower($this->map_type)=="street") { // if defaulting the map to Street View
1383:             $this->output_js_contents .= '
1384:                     var streetViewOptions = {
1385:                         position: myLatlng';
1386:             if (!$this->streetViewAddressControl) {
1387:                 $this->output_js_contents .= ',
1388:                     addressControl: false';
1389:             }
1390:             if ($this->streetViewAddressPosition!="") {
1391:                 $this->output_js_contents .= ',
1392:                     addressControlOptions: { position: google.maps.ControlPosition.'.$this->streetViewAddressPosition.' }';
1393:             }
1394:             if ($this->streetViewCloseButton) {
1395:                 $this->output_js_contents .= ',
1396:                     enableCloseButton: true';
1397:             }
1398:             if (!$this->streetViewLinksControl) {
1399:                 $this->output_js_contents .= ',
1400:                     linksControl: false';
1401:             }
1402:             if (!$this->streetViewPanControl) {
1403:                 $this->output_js_contents .= ',
1404:                     panControl: false';
1405:             }
1406:             if ($this->streetViewPanPosition!="") {
1407:                 $this->output_js_contents .= ',
1408:                     panControlOptions: { position: google.maps.ControlPosition.'.$this->streetViewPanPosition.' }';
1409:             }
1410:             if ($this->streetViewPovHeading!=0 || $this->streetViewPovPitch!=0 || $this->streetViewPovZoom!=0) {
1411:                 $this->output_js_contents .= ',
1412:                     pov: {
1413:                         heading: '.$this->streetViewPovHeading.',
1414:                         pitch: '.$this->streetViewPovPitch.',
1415:                         zoom: '.$this->streetViewPovZoom.'
1416:                     }';
1417:             }
1418:             if (!$this->streetViewZoomControl) {
1419:                 $this->output_js_contents .= ',
1420:                     zoomControl: false';
1421:             }
1422:             if ($this->streetViewZoomPosition!="" || $this->streetViewZoomStyle!="") {
1423:                 $this->output_js_contents .= ',
1424:                     zoomControlOptions: {';
1425:                 if ($this->streetViewZoomPosition!="") {
1426:                     $this->output_js_contents .= '
1427:                         position: google.maps.ControlPosition.'.$this->streetViewZoomPosition.',';
1428:                 }
1429:                 if ($this->streetViewZoomStyle!="") {
1430:                     $this->output_js_contents .= '
1431:                         style: google.maps.ZoomControlStyle.'.$this->streetViewZoomStyle.',';
1432:                 }
1433:                 $this->output_js_contents = trim($this->output_js_contents, ",");
1434:                 $this->output_js_contents .= '}';
1435:             }
1436:             $this->output_js_contents .= '
1437:                 };
1438:                 var streetView = new google.maps.StreetViewPanorama(document.getElementById("'.$this->map_div_id.'"), streetViewOptions);
1439:                 streetView.setVisible(true);
1440:                         ';
1441:         }
1442: 
1443:         if ($this->center=="auto") { // if wanting to center on the users location
1444:             $this->output_js_contents .= '
1445:                 // Try W3C Geolocation (Preferred)
1446:                 if(navigator.geolocation) {
1447:                     navigator.geolocation.getCurrentPosition(function(position) {
1448:                         '.$this->map_name.'.setCenter(new google.maps.LatLng(position.coords.latitude,position.coords.longitude));
1449:                     }, function() { alert("Unable to get your current position. Please try again. Geolocation service failed."); });
1450:                 // Try Google Gears Geolocation
1451:                 } else if (google.gears) {
1452:                     var geo = google.gears.factory.create(\'beta.geolocation\');
1453:                     geo.getCurrentPosition(function(position) {
1454:                         '.$this->map_name.'.setCenter(new google.maps.LatLng(position.latitude,position.longitude));
1455:                     }, function() { alert("Unable to get your current position. Please try again. Geolocation service failed."); });
1456:                 // Browser doesn\'t support Geolocation
1457:                 }else{
1458:                     alert(\'Your browser does not support geolocation.\');
1459:                 }
1460:             ';
1461:         }
1462: 
1463:         if ($this->directions) {
1464:             $this->output_js_contents .= 'directionsDisplay.setMap('.$this->map_name.');
1465:             ';
1466:             if ($this->directionsDivID!="") {
1467:                 $this->output_js_contents .= 'directionsDisplay.setPanel(document.getElementById("'.$this->directionsDivID.'"));
1468:             ';
1469:             }
1470:             if ($this->directionsDraggable && $this->directionsChanged!="") {
1471:                 $this->output_js_contents .= 'google.maps.event.addListener(directionsDisplay, "directions_changed", function() {
1472:                     '.$this->directionsChanged.'
1473:                 });
1474:             ';
1475:             }
1476:         }
1477: 
1478:         if ($this->drawing) {
1479: 
1480:             if ($this->drawingControlPosition=='') { $this->drawingControlPosition = 'TOP_CENTER'; }
1481: 
1482:             $this->output_js_contents .= 'drawingManager = new google.maps.drawing.DrawingManager({
1483:                 drawingMode: google.maps.drawing.OverlayType.'.strtoupper($this->drawingDefaultMode).',
1484:                     drawingControl: '.(!$this->drawingControl ? 'false' : 'true').',
1485:                     drawingControlOptions: {
1486:                         position: google.maps.ControlPosition.'.strtoupper($this->drawingControlPosition);
1487:                 $shapeOptions = '';
1488:             if (count($this->drawingModes)) {
1489:                 $this->output_js_contents .= ',
1490:                     drawingModes: [';
1491:                 $i=0;
1492:                 foreach ($this->drawingModes as $drawingMode) {
1493:                     if ($i>0) { $this->output_js_contents .= ','; }
1494:                     $this->output_js_contents .= 'google.maps.drawing.OverlayType.'.strtoupper($drawingMode);
1495:                     if (strtoupper($drawingMode)!="MARKER") {
1496:                         $shapeOptions .= ',
1497:                         '.strtolower($drawingMode).'Options: {
1498:                             editable: true
1499:                         }';
1500:                     }
1501:                     $i++;
1502:                 }
1503:                 $this->output_js_contents .= ']';
1504:                 }
1505:             $this->output_js_contents .= '
1506:                 }'.$shapeOptions.'
1507:             });
1508:             drawingManager.setMap('.$this->map_name.');
1509:             ';
1510: 
1511:             $this->output_js_contents .= '
1512:             google.maps.event.addListener(drawingManager, "overlaycomplete", function(event) {
1513:                 var newShape = event.overlay;
1514:                 newShape.type = event.type;
1515:                 ';
1516:             if (count($this->drawingOnComplete)) {
1517:                 foreach ($this->drawingOnComplete as $shape=>$js) {
1518:                     $this->output_js_contents .= 'if (event.type==google.maps.drawing.OverlayType.'.strtoupper($shape).') {
1519:                         '.$js.'
1520:                     }
1521:                     ';
1522:                 }
1523:             }
1524: 
1525:             if (count($this->drawingOnEdit)) {
1526: 
1527:                 if (isset($this->drawingOnEdit['polygon'])) {
1528:                     $this->output_js_contents .= '
1529:                 if (newShape.type==google.maps.drawing.OverlayType.POLYGON) {
1530:                     var newShapePaths = newShape.getPaths();
1531:                     for (var i=0; i<newShapePaths.length; i++) {
1532:                         google.maps.event.addListener(newShapePaths.getAt(i), "set_at", function(event) {
1533:                             '.$this->drawingOnEdit['polygon'].'
1534:                         });
1535:                         google.maps.event.addListener(newShapePaths.getAt(i), "insert_at", function(event) {
1536:                             '.$this->drawingOnEdit['polygon'].'
1537:                         });
1538:                         google.maps.event.addListener(newShapePaths.getAt(i), "remove_at", function(event) {
1539:                             '.$this->drawingOnEdit['polygon'].'
1540:                         });
1541:                     }
1542:                 }';
1543:                 }
1544:                 if (isset($this->drawingOnEdit['polyline'])) {
1545:                     $this->output_js_contents .= '
1546:                 if (newShape.type==google.maps.drawing.OverlayType.POLYLINE) {
1547:                     var newShapePaths = newShape.getPaths();
1548:                     for (var i=0; i<newShapePaths.length; i++) {
1549:                         google.maps.event.addListener(newShapePaths.getAt(i), "set_at", function(event) {
1550:                             '.$this->drawingOnEdit['polyline'].'
1551:                         });
1552:                         google.maps.event.addListener(newShapePaths.getAt(i), "insert_at", function(event) {
1553:                             '.$this->drawingOnEdit['polyline'].'
1554:                         });
1555:                         google.maps.event.addListener(newShapePaths.getAt(i), "remove_at", function(event) {
1556:                             '.$this->drawingOnEdit['polyline'].'
1557:                         });
1558:                     }
1559:                 }';
1560:                 }
1561:                 if (isset($this->drawingOnEdit['rectangle'])) {
1562:                     $this->output_js_contents .= '
1563:                 if (newShape.type==google.maps.drawing.OverlayType.RECTANGLE) {
1564:                     google.maps.event.addListener(newShape, "bounds_changed", function(event) {
1565:                         '.$this->drawingOnEdit['rectangle'].'
1566:                     });
1567:                 }';
1568:                 }
1569:                 if (isset($this->drawingOnEdit['circle'])) {
1570:                     $this->output_js_contents .= '
1571:                 if (newShape.type==google.maps.drawing.OverlayType.CIRCLE) {
1572:                     google.maps.event.addListener(newShape, "radius_changed", function(event) {
1573:                         '.$this->drawingOnEdit['circle'].'
1574:                     });
1575:                     google.maps.event.addListener(newShape, "center_changed", function(event) {
1576:                         '.$this->drawingOnEdit['circle'].'
1577:                     });
1578:                 }';
1579:                 }
1580:             }
1581: 
1582:             $this->output_js_contents .= '
1583:             });';
1584: 
1585:         }
1586: 
1587:         if ($this->places) {
1588: 
1589:             $placesLocationSet = false;
1590: 
1591:             if ($this->placesLocationSW!="" && $this->placesLocationNE!="") { // if search based on bounds
1592: 
1593:                 $placesLocationSet = true;
1594: 
1595:                 if ($this->is_lat_long($this->placesLocationSW)) {
1596:                     $this->output_js_contents .= 'var placesLocationSW = new google.maps.LatLng('.$this->placesLocationSW.');
1597:             ';
1598:                 }else{  // if centering the map on an address
1599:                     $lat_long = $this->get_lat_long_from_address($this->placesLocationSW);
1600:                     $this->output_js_contents .= 'var placesLocationSW = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].');
1601:             ';
1602:                 }
1603: 
1604:                 if ($this->is_lat_long($this->placesLocationNE)) {
1605:                     $this->output_js_contents .= 'var placesLocationNE = new google.maps.LatLng('.$this->placesLocationNE.');
1606:             ';
1607:                 }else{  // if centering the map on an address
1608:                     $lat_long = $this->get_lat_long_from_address($this->placesLocationNE);
1609:                     $this->output_js_contents .= 'var placesLocationNE = new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].');
1610:             ';
1611:                 }
1612: 
1613:             }
1614: 
1615:             if (($placesLocationSet || $this->placesLocation!="") || count($this->placesTypes) || $this->placesName!="")
1616:             {
1617:                 $this->output_js_contents .= 'var placesRequest = {
1618:                     ';
1619:                 if ($placesLocationSet) {
1620:                     $this->output_js_contents .= 'bounds: new google.maps.LatLngBounds(placesLocationSW, placesLocationNE)
1621:                         ';
1622:                 }else{
1623:                     if ($this->placesLocation!="") { // if search based on a center point
1624:                         if ($this->is_lat_long($this->placesLocation)) { // if centering the map on a lat/long
1625:                             $this->output_js_contents .= 'location: new google.maps.LatLng('.$this->placesLocation.')
1626:                         ';
1627:                         }else{  // if centering the map on an address
1628:                             $lat_long = $this->get_lat_long_from_address($this->placesLocation);
1629:                             $this->output_js_contents .= 'location: new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')
1630:                         ';
1631:                         }
1632:                         $this->output_js_contents .= ',radius: '.$this->placesRadius.'
1633:                         ';
1634:                     }
1635:                 }
1636: 
1637:                 if (count($this->placesTypes)) {
1638:                     $this->output_js_contents .= ',types: [\''.implode("','", $this->placesTypes).'\']
1639:                         ';
1640:                 }
1641:                 if ($this->placesName!="") {
1642:                     $this->output_js_contents .= ',name : \''.$this->placesName.'\'
1643:                         ';
1644:                 }
1645:                 $this->output_js_contents .= '};
1646: 
1647:                 placesService = new google.maps.places.PlacesService('.$this->map_name.');
1648:                 placesService.search(placesRequest, placesCallback);
1649:                 ';
1650:             }
1651: 
1652:             if ($this->placesAutocompleteInputID != "")
1653:             {
1654:                 $this->output_js_contents .= 'var autocompleteOptions = {
1655:                     ';
1656:                 $autocompleteOptions = '';
1657:                 if ($this->placesAutocompleteBoundSW != "" && $this->placesAutocompleteBoundNE != "")
1658:                 {
1659:                     if ($this->is_lat_long($this->placesAutocompleteBoundSW)) {
1660:                         $autocompleteOptionsSW = 'new google.maps.LatLng('.$this->placesAutocompleteBoundSW.')
1661:                     ';
1662:                     }else{  // if centering the map on an address
1663:                         $lat_long = $this->get_lat_long_from_address($this->placesAutocompleteBoundSW);
1664:                         $autocompleteOptionsSW = 'new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')
1665:                     ';
1666:                     }
1667: 
1668:                     if ($this->is_lat_long($this->placesAutocompleteBoundNE)) {
1669:                         $autocompleteOptionsNE = 'new google.maps.LatLng('.$this->placesAutocompleteBoundNE.')
1670:                     ';
1671:                     }else{  // if centering the map on an address
1672:                         $lat_long = $this->get_lat_long_from_address($this->placesAutocompleteBoundNE);
1673:                         $autocompleteOptionsNE = 'new google.maps.LatLng('.$lat_long[0].', '.$lat_long[1].')
1674:                     ';
1675:                     }
1676:                     $autocompleteOptions .= 'bounds: new google.maps.LatLngBounds('.$autocompleteOptionsSW.', '.$autocompleteOptionsNE.')';
1677:                 }
1678:                 if (count($this->placesAutocompleteTypes))
1679:                 {
1680:                     if ($autocompleteOptions != "")
1681:                     {
1682:                          $autocompleteOptions .= ',
1683:                          ';
1684:                     }
1685:                     $autocompleteOptions .= 'types: [\''.implode("','", $this->placesAutocompleteTypes).'\']';
1686:                 }
1687:                 $this->output_js_contents .= $autocompleteOptions;
1688:                 $this->output_js_contents .= '}';
1689: 
1690:                 $this->output_js_contents .= '
1691:                 var autocompleteInput = document.getElementById(\''.$this->placesAutocompleteInputID.'\');
1692: 
1693:                 placesAutocomplete = new google.maps.places.Autocomplete(autocompleteInput, autocompleteOptions);
1694:                 ';
1695: 
1696:                 if ($this->placesAutocompleteBoundsMap)
1697:                 {
1698:                     $this->output_js_contents .= 'placesAutocomplete.bindTo(\'bounds\', map);
1699:                     ';
1700:                 }
1701: 
1702:                 if ($this->placesAutocompleteOnChange != "")
1703:                 {
1704:                     $this->output_js_contents .= 'google.maps.event.addListener(placesAutocomplete, \'place_changed\', function() {
1705:                         '.$this->placesAutocompleteOnChange.'
1706:                     });
1707:                     ';
1708:                 }
1709:             }
1710: 
1711:         }
1712: 
1713:         if ($this->onboundschanged!="") {
1714:             $this->output_js_contents .= 'google.maps.event.addListener(map, "bounds_changed", function(event) {
1715:                     '.$this->onboundschanged.'
1716:                 });
1717:             ';
1718:         }
1719:         if ($this->oncenterchanged!="") {
1720:             $this->output_js_contents .= 'google.maps.event.addListener(map, "center_changed", function(event) {
1721:                     '.$this->oncenterchanged.'
1722:                 });
1723:             ';
1724:         }
1725:         if ($this->onclick!="") {
1726:             $this->output_js_contents .= 'google.maps.event.addListener(map, "click", function(event) {
1727:                     '.$this->onclick.'
1728:                 });
1729:             ';
1730:         }
1731:         if ($this->ondblclick!="") {
1732:             $this->output_js_contents .= 'google.maps.event.addListener(map, "dblclick", function(event) {
1733:                     '.$this->ondblclick.'
1734:                 });
1735:             ';
1736:         }
1737:         if ($this->ondrag!="") {
1738:             $this->output_js_contents .= 'google.maps.event.addListener(map, "drag", function(event) {
1739:                     '.$this->ondrag.'
1740:                 });
1741:             ';
1742:         }
1743:         if ($this->ondragend!="") {
1744:             $this->output_js_contents .= 'google.maps.event.addListener(map, "dragend", function(event) {
1745:                     '.$this->ondragend.'
1746:                 });
1747:             ';
1748:         }
1749:         if ($this->ondragstart!="") {
1750:             $this->output_js_contents .= 'google.maps.event.addListener(map, "dragstart", function(event) {
1751:                     '.$this->ondragstart.'
1752:                 });
1753:             ';
1754:         }
1755:         if ($this->onidle!="") {
1756:             $this->output_js_contents .= 'google.maps.event.addListener(map, "idle", function(event) {
1757:                     '.$this->onidle.'
1758:                 });
1759:             ';
1760:         }
1761:         if ($this->onmousemove!="") {
1762:             $this->output_js_contents .= 'google.maps.event.addListener(map, "mousemove", function(event) {
1763:                     '.$this->onmousemove.'
1764:                 });
1765:             ';
1766:         }
1767:         if ($this->onmouseout!="") {
1768:             $this->output_js_contents .= 'google.maps.event.addListener(map, "mouseout", function(event) {
1769:                     '.$this->onmouseout.'
1770:                 });
1771:             ';
1772:         }
1773:         if ($this->onmouseover!="") {
1774:             $this->output_js_contents .= 'google.maps.event.addListener(map, "mouseover", function(event) {
1775:                     '.$this->onmouseover.'
1776:                 });
1777:             ';
1778:         }
1779:         if ($this->onresize!="") {
1780:             $this->output_js_contents .= 'google.maps.event.addListener(map, "resize", function(event) {
1781:                     '.$this->onresize.'
1782:                 });
1783:             ';
1784:         }
1785:         if ($this->onrightclick!="") {
1786:             $this->output_js_contents .= 'google.maps.event.addListener(map, "rightclick", function(event) {
1787:                     '.$this->onrightclick.'
1788:                 });
1789:             ';
1790:         }
1791:         if ($this->ontilesloaded!="") {
1792:             $this->output_js_contents .= 'google.maps.event.addListener(map, "tilesloaded", function(event) {
1793:                     '.$this->ontilesloaded.'
1794:                 });
1795:             ';
1796:         }
1797:         if ($this->onzoomchanged!="") {
1798:             $this->output_js_contents .= 'google.maps.event.addListener(map, "zoom_changed", function(event) {
1799:                     '.$this->onzoomchanged.'
1800:                 });
1801:             ';
1802:         }
1803: 
1804:         // add markers
1805:         if (count($this->markers)) {
1806:             foreach ($this->markers as $marker) {
1807:                 $this->output_js_contents .= $marker;
1808:             }
1809:         }
1810:         //
1811: 
1812:         if ($this->cluster) {
1813:             $this->output_js_contents .= '
1814:             var clusterOptions = {
1815:                 gridSize: '.$this->clusterGridSize;
1816:             if ($this->clusterMaxZoom!="") { $this->output_js_contents .= ',
1817:                 maxZoom: '.$this->clusterMaxZoom; }
1818:             if (!$this->clusterZoomOnClick) { $this->output_js_contents .= ',
1819:                 zoomOnClick: false'; }
1820:             if ($this->clusterAverageCenter) { $this->output_js_contents .= ',
1821:                 averageCenter: true'; }
1822:             // zenphoto hack
1823:             // Google abandoned their CDN
1824:             $this->output_js_contents .= ',
1825:                 imagePath: "' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/GoogleMap/markerClustererPlus/images/m"';
1826:             // end zenphotohack
1827:             $this->output_js_contents .= ',
1828:                 minimumClusterSize: '.$this->clusterMinimumClusterSize.'
1829:             };
1830:             markerCluster = new MarkerClusterer('.$this->map_name.', markers, clusterOptions);
1831:             ';
1832:         }
1833: 
1834:         // add polylines
1835:         if (count($this->polylines)) {
1836:             foreach ($this->polylines as $polyline) {
1837:                 $this->output_js_contents .= $polyline;
1838:             }
1839:         }
1840:         //
1841: 
1842:         // add polygons
1843:         if (count($this->polygons)) {
1844:             foreach ($this->polygons as $polygon) {
1845:                 $this->output_js_contents .= $polygon;
1846:             }
1847:         }
1848:         //
1849: 
1850:         // add circles
1851:         if (count($this->circles)) {
1852:             foreach ($this->circles as $circle) {
1853:                 $this->output_js_contents .= $circle;
1854:             }
1855:         }
1856:         //
1857: 
1858:         // add rectangles
1859:         if (count($this->rectangles)) {
1860:             foreach ($this->rectangles as $rectangle) {
1861:                 $this->output_js_contents .= $rectangle;
1862:             }
1863:         }
1864:         //
1865: 
1866:         // add ground overlays
1867:         if (count($this->overlays)) {
1868:             foreach ($this->overlays as $overlay) {
1869:                 $this->output_js_contents .= $overlay;
1870:             }
1871:         }
1872:         //
1873: 
1874:         if ($this->zoom=="auto") {
1875: 
1876:             $this->output_js_contents .= '
1877:             fitMapToBounds();
1878:             ';
1879: 
1880:         }
1881: 
1882:         if ($this->adsense) {
1883:             $this->output_js_contents .= '
1884:             var adUnitDiv = document.createElement("div");
1885: 
1886:                 // Note: replace the publisher ID noted here with your own
1887:                 // publisher ID.
1888:                 var adUnitOptions = {
1889:                     format: google.maps.adsense.AdFormat.'.$this->adsenseFormat.',
1890:                     position: google.maps.ControlPosition.'.$this->adsensePosition.',
1891:                     publisherId: "'.$this->adsensePublisherID.'",
1892:                     ';
1893:                 if ($this->adsenseChannelNumber!="") { $this->output_js_contents .= 'channelNumber: "'.$this->adsenseChannelNumber.'",
1894:                     '; }
1895:                 $this->output_js_contents .= 'map: map,
1896:                     visible: true
1897:                 };
1898:                 adUnit = new google.maps.adsense.AdUnit(adUnitDiv, adUnitOptions);
1899:                 ';
1900:         }
1901: 
1902:         if ($this->directions && $this->directionsStart!="" && $this->directionsEnd!="") {
1903:             if ($this->directionsStart=="auto") {
1904:                 $this->output_js_contents .= '
1905:                 // Try W3C Geolocation (Preferred)
1906:                 if(navigator.geolocation) {
1907:                     navigator.geolocation.getCurrentPosition(function(position) {
1908:                         start = position.coords.latitude+","+position.coords.longitude;
1909:                         calcRoute(start, \''.$this->directionsEnd.'\');
1910:                     }, function() { alert("Unable to get your current position. Please try again. Geolocation service failed."); });
1911:                 // Try Google Gears Geolocation
1912:                 } else if (google.gears) {
1913:                     var geo = google.gears.factory.create(\'beta.geolocation\');
1914:                     geo.getCurrentPosition(function(position) {
1915:                         start = position.latitude+","+position.longitude;
1916:                         calcRoute(start, \''.$this->directionsEnd.'\');
1917:                     }, function() { alert("Unable to get your current position. Please try again. Geolocation service failed."); });
1918:                 // Browser doesn\'t support Geolocation
1919:                 }else{
1920:                     alert(\'Your browser does not support geolocation.\');
1921:                 }
1922:                 ';
1923:             }else{
1924:                 $this->output_js_contents .= '
1925:                 calcRoute(\''.$this->directionsStart.'\', \''.$this->directionsEnd.'\');
1926:                 ';
1927:             }
1928:         }
1929: 
1930:         if ($this->onload!="") {
1931:             $this->output_js_contents .= '
1932:                 '.$this->onload;
1933:         }
1934: 
1935:         $this->output_js_contents .= '
1936: 
1937:             }
1938: 
1939:         ';
1940: 
1941:         // add markers
1942:         $this->output_js_contents .= '
1943:         function createMarker(markerOptions) {
1944:             var marker = new google.maps.Marker(markerOptions);
1945:             markers.push(marker);
1946:             lat_longs.push(marker.getPosition());
1947:             return marker;
1948:         }
1949:         ';
1950:         //
1951: 
1952:         if ($this->directions) {
1953: 
1954:             $this->output_js_contents .= 'function calcRoute(start, end) {
1955: 
1956:             var request = {
1957:                         origin:start,
1958:                         destination:end,
1959:                         travelMode: google.maps.TravelMode.'.$this->directionsMode.'
1960:                         ';
1961:             if ($this->region!="" && strlen($this->region)==2) {
1962:                 $this->output_js_contents .= ',region: '.strtoupper($this->region).'
1963:                     ';
1964:             }
1965:             if (trim($this->directionsUnits)!="" && (strtolower(trim($this->directionsUnits)) == "metric" || strtolower(trim($this->directionsUnits)) == "imperial")) {
1966:                 $this->output_js_contents .= ',unitSystem: google.maps.UnitSystem.'.strtoupper(trim($this->directionsUnits)).'
1967:                     ';
1968:             }
1969:             if ($this->directionsAvoidTolls) {
1970:                 $this->output_js_contents .= ',avoidTolls: true
1971:                     ';
1972:             }
1973:             if ($this->directionsAvoidHighways) {
1974:                 $this->output_js_contents .= ',avoidHighways: true
1975:                     ';
1976:             }
1977: 
1978:             $this->output_js_contents .= '
1979:             };
1980:                     directionsService.route(request, function(response, status) {
1981:                         if (status == google.maps.DirectionsStatus.OK) {
1982:                                 directionsDisplay.setDirections(response);
1983:                         }else{
1984:                             switch (status) {
1985:                                 case "NOT_FOUND": { alert("Either the start location or destination were not recognised"); break }
1986:                                 case "ZERO_RESULTS": { alert("No route could be found between the start location and destination"); break }
1987:                                 case "MAX_WAYPOINTS_EXCEEDED": { alert("Maximum waypoints exceeded. Maximum of 8 allowed"); break }
1988:                                 case "INVALID_REQUEST": { alert("Invalid request made for obtaining directions"); break }
1989:                                 case "OVER_QUERY_LIMIT": { alert("This webpage has sent too many requests recently. Please try again later"); break }
1990:                                 case "REQUEST_DENIED": { alert("This webpage is not allowed to request directions"); break }
1991:                                 case "UNKNOWN_ERROR": { alert("Unknown error with the server. Please try again later"); break }
1992:                             }
1993:                         }
1994:                     });
1995:             }
1996:             ';
1997: 
1998:         }
1999: 
2000:         if ($this->places) {
2001:             $this->output_js_contents .= 'function placesCallback(results, status) {
2002:                 if (status == google.maps.places.PlacesServiceStatus.OK) {
2003:                     for (var i = 0; i < results.length; i++) {
2004: 
2005:                         var place = results[i];
2006: 
2007:                         var placeLoc = place.geometry.location;
2008:                         var placePosition = new google.maps.LatLng(placeLoc.lat(), placeLoc.lng());
2009:                         var markerOptions = {
2010:                             map: '.$this->map_name.',
2011:                                     position: placePosition
2012:                                 };
2013:                                 var marker = createMarker(markerOptions);
2014:                                 marker.set("content", place.name);
2015:                                 google.maps.event.addListener(marker, "click", function() {
2016:                                     iw.setContent(this.get("content"));
2017:                                     iw.open('.$this->map_name.', this);
2018:                                 });
2019: 
2020:                                 lat_longs.push(placePosition);
2021: 
2022:                     }
2023:                     ';
2024:             if ($this->zoom=="auto") { $this->output_js_contents .= 'fitMapToBounds();'; }
2025:             $this->output_js_contents .= '
2026:                 }
2027:             }
2028:             ';
2029:         }
2030: 
2031:         if ($this->zoom=="auto") {
2032:             $this->output_js_contents .= '
2033:             function fitMapToBounds() {
2034:                 var bounds = new google.maps.LatLngBounds();
2035:                 if (lat_longs.length>0) {
2036:                     for (var i=0; i<lat_longs.length; i++) {
2037:                         bounds.extend(lat_longs[i]);
2038:                     }
2039:                     '.$this->map_name.'.fitBounds(bounds);
2040:                 }
2041:             }
2042:             ';
2043:         }
2044: 
2045:         if ($this->loadAsynchronously) {
2046:             $this->output_js_contents .= '
2047:             function loadScript() {
2048:                 var script = document.createElement("script");
2049:                     script.type = "text/javascript";
2050:                     script.src = "'.$apiLocation.'&callback=initialize";
2051:                     document.body.appendChild(script);
2052:             }
2053:             window.onload = loadScript;
2054:             ';
2055:         }else{
2056:             $this->output_js_contents .= '
2057:                 window.onload = initialize;
2058: 
2059:                 // hack zenphoto - recenter map after resize
2060:                 google.maps.event.addDomListener(window, "resize", function() {
2061:                     var center = map.getCenter();
2062:                     google.maps.event.trigger(map, "resize");
2063:                     map.setCenter(center);
2064:                 });
2065: 
2066:             ';
2067:         }
2068: 
2069:         // Minify the Javascript if the $minifyJS config value is true. Requires Jsmin.php and PHP 5+
2070:         if ($this->minifyJS) {
2071:             $CI = get_instance();
2072:             $CI->load->library('jsmin');
2073:             $this->output_js_contents = $CI->jsmin->min($this->output_js_contents);
2074:         }
2075:         if ($this->jsfile=="") {
2076:             $this->output_js .= $this->output_js_contents;
2077:         }else{ // if needs writing to external js file
2078:             if (!$handle = fopen($this->jsfile, "w")) {
2079:                 $this->output_js .= $this->output_js_contents;
2080:             }else{
2081:                 if (!fwrite($handle, $this->output_js_contents)) {
2082:                     $this->output_js .= $this->output_js_contents;
2083:                 }else{
2084:                     $this->output_js .= '
2085:                     <script src="'.$this->jsfile.'" type="text/javascript"></script>';
2086:                 }
2087:             }
2088:         }
2089: 
2090:         if ($this->jsfile=="") {
2091:             $this->output_js .= '
2092:             //]]>
2093:             </script>';
2094:         }
2095: 
2096: 
2097: 
2098:         // set height and width
2099:         if (is_numeric($this->map_width)) { // if no width type set
2100:             $this->map_width = $this->map_width.'px';
2101:         }
2102:         if (is_numeric($this->map_height)) { // if no height type set
2103:             $this->map_height = $this->map_height.'px';
2104:         }
2105:         //
2106: 
2107:         $this->output_html .= '<div id="'.$this->map_div_id.'"></div>';
2108: 
2109:         return array('js'=>$this->output_js, 'html'=>$this->output_html, 'markers'=>$this->markersInfo);
2110: 
2111:     }
2112: 
2113:     function is_lat_long($input)
2114:     {
2115: 
2116:         $input = str_replace(", ", ",", trim($input));
2117:         $input = explode(",", $input);
2118:         if (count($input)==2) {
2119: 
2120:             if (is_numeric($input[0]) && is_numeric($input[1])) { // is a lat long
2121:                 return true;
2122:             }else{ // not a lat long - incorrect values
2123:                 return false;
2124:             }
2125: 
2126:         }else{ // not a lat long - too many parts
2127:             return false;
2128:         }
2129: 
2130:     }
2131: 
2132:     function get_lat_long_from_address($address, $attempts = 0)
2133:     {
2134: 
2135:         $lat = 0;
2136:         $lng = 0;
2137: 
2138:         $error = '';
2139: 
2140:         if ($this->geocodeCaching) { // if caching of geocode requests is activated
2141: 
2142:             $CI = get_instance();
2143:             $CI->load->database();
2144:             $CI->db->select("latitude,longitude");
2145:             $CI->db->from("geocoding");
2146:             $CI->db->where("address", trim(strtolower($address)));
2147:             $query = $CI->db->get();
2148: 
2149:             if ($query->num_rows()>0) {
2150:                 $row = $query->row();
2151:                 return array($row->latitude, $row->longitude);
2152:             }
2153: 
2154:         }
2155:         if ($this->https) { $data_location = 'https://'; }else{ $data_location = 'http://'; }
2156:         $data_location .= "maps.google.com/maps/api/geocode/json?address=".urlencode(utf8_encode($address))."&sensor=".$this->sensor;
2157:         if ($this->region!="" && strlen($this->region)==2) { $data_location .= "&region=".$this->region; }
2158:         $data = file_get_contents($data_location);
2159: 
2160:         $data = json_decode($data);
2161: 
2162:         if ($data->status=="OK")
2163:         {
2164:             $lat = $data->results[0]->geometry->location->lat;
2165:             $lng = $data->results[0]->geometry->location->lng;
2166: 
2167:             if ($this->geocodeCaching) { // if we to need to cache this result
2168:                 $data = array(
2169:                     "address"=>trim(strtolower($address)),
2170:                     "latitude"=>$lat,
2171:                     "longitude"=>$lng
2172:                 );
2173:                 $CI->db->insert("geocoding", $data);
2174:             }
2175:         }
2176:         else
2177:         {
2178:             if ($data->status == "OVER_QUERY_LIMIT")
2179:             {
2180:                 $error = $data->status;
2181:                 if ($attempts < 2)
2182:                 {
2183:                     sleep(1);
2184:                     ++$attempts;
2185:                     list($lat, $lng, $error) = $this->get_lat_long_from_address($address, $attempts);
2186:                 }
2187:             }
2188:         }
2189: 
2190:         return array($lat, $lng, $error);
2191: 
2192:     }
2193: 
2194: }
2195: 
2196: ?>
Zenphoto doc API documentation generated by ApiGen