Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?lc
  2. global gControllerHandlers, gData
  3.  
  4. put "index" into gControllerHandlers
  5. start using stack (gAPPPATH & "stacks/lib_Fedwiki.livecode")
  6.  
  7. on index
  8. -- put "Hello" into testArray ["World"]
  9. -- put json_FromArray (testArray) into someJSON
  10. -- put $_SERVER ["DOCUMENT_ROOT"] into documentRoot
  11.  
  12. put fedwiki_GetDroppedUrl ($_POST_RAW) into imageURL
  13. set the itemdelimiter to "."
  14. if item -1 of imageURL is not among the items of "jpg.jpeg.png.gif" then
  15. put fedwiki_ConstructErrorJSON ("Not an image.", "Pity") into someJSON
  16. else
  17. -- fedwiki_ConstructNewImagePageArray pageTitle, someImage, imageType, pImageCaption, pSourceArray
  18. put "Dropped Image" into pageTitle
  19. put "This is a simple image dropped on to a wiki." into someText
  20. put fedwiki_ConstructNewPageArray (pageTitle, someText) into pageArray
  21.  
  22. put "This is an image" into imageCaption
  23. put html_ExtractTLD (imageURL, true) into tldBit
  24. put "-" && tldBit into linkInfo
  25.  
  26. put imageURL into descriptionURL
  27. put fedwiki_ConstructImageHtml (imageURL, imageCaption, descriptionURL, linkInfo) into imageHTML
  28. fedwiki_AddHtmlToPageArray pageArray, imageHTML
  29.  
  30. put json_FromArray (pageArray) into someJSON
  31. end if
  32. fedwiki_ReturnJSON someJSON
  33. end index
  34.  
  35. function html_ExtractTLD someURL, pLastTwo
  36. set the itemdelimiter to slash
  37. put item 3 of someURL into someTLD
  38. if pLastTwo is not true then return someTLD
  39.  
  40. set the itemdelimiter to "."
  41. put item -2 to -1 of someTLD into tldBit
  42. return tldBit
  43. end html_ExtractTLD
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement