Advertisement
borlabs

WP Store Locator Install/Uninstall-Routine

Feb 7th, 2019
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.38 KB | None | 0 0
  1. /*********************
  2. *
  3. *
  4. *       INSTALLATION/UNINSTALLATION
  5. *
  6. *
  7. *********************/
  8. register_activation_hook(__FILE__, 'wpsl_InstallBorlabsCookie');
  9. register_deactivation_hook(__FILE__, 'wpsl_UninstallBorlabsCookie');
  10.  
  11. /* Adds new Blocked Content Type when the plugin is about to be activated */
  12. function wpsl_InstallBorlabsCookie()
  13. {
  14.     if (function_exists('BorlabsCookieHelper')) {
  15.  
  16.         // We use the previewHTML code of the blocked content type "Google Maps"
  17.         $bctGoogleMaps = BorlabsCookieHelper()->getBlockedContentTypeDataById('googlemaps');
  18.  
  19.         // Add new Blocked Content Type wpstorelocator - if the BCT exists nothing happens
  20.         BorlabsCookieHelper()->addBlockedContentType(
  21.             'wpstorelocator',
  22.             'WP Store Locator',
  23.             'Lorem ipsum dolor - You text here, use it as advertisement if you like.',
  24.             [],
  25.             $bctGoogleMaps['previewHTML'],
  26.             '',
  27.             '',
  28.             [
  29.                 'responsiveIframe'=>true,
  30.             ],
  31.             true,
  32.             true
  33.         );
  34.     }
  35. }
  36.  
  37. /* Deletes Blocked Content Type when the plugin is about to be disabled */
  38. function wpsl_UninstallBorlabsCookie()
  39. {
  40.     if (function_exists('BorlabsCookieHelper')) {
  41.         // Delete Blocked Content Type wpstorelocator
  42.         BorlabsCookieHelper()->deleteBlockedContentType('wpstorelocator');
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement