Нема описа

functions-deprecated.php 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <?php
  2. /*******************************************************************************
  3. * Copyright (c) 2019, Code Atlantic LLC
  4. ******************************************************************************/
  5. // Exit if accessed directly
  6. if ( ! defined( 'ABSPATH' ) ) {
  7. exit;
  8. }
  9. #region Deprecated 1.7.0
  10. /**
  11. * @deprecated 1.7.0 Use pum_load_popup
  12. *
  13. * @param $id
  14. */
  15. function popmake_enqueue_popup( $id ) {
  16. pum_load_popup( $id );
  17. }
  18. /**
  19. * Get an option
  20. *
  21. * Looks to see if the specified setting exists, returns default if not
  22. *
  23. * @since 1.0
  24. * @deprecated 1.7.0
  25. *
  26. * @param string $key
  27. * @param bool $default
  28. *
  29. * @return mixed
  30. */
  31. function popmake_get_option( $key = '', $default = false ) {
  32. return pum_get_option( $key, $default );
  33. }
  34. /**
  35. * Get Settings
  36. *
  37. * Retrieves all plugin settings
  38. *
  39. * @since 1.0.0
  40. * @deprecated 1.7.0
  41. *
  42. * @return array $settings
  43. */
  44. function popmake_get_settings() {
  45. return pum_get_options();
  46. }
  47. /**
  48. * Support Page
  49. *
  50. * Renders the support page contents.
  51. *
  52. * @since 1.5.0
  53. * @deprecated 1.7.0
  54. */
  55. function pum_settings_page() {
  56. PUM_Admin_Settings::page();
  57. }
  58. /**
  59. * @deprecated 1.7.0
  60. *
  61. * @param string $string
  62. *
  63. * @return string
  64. */
  65. function popmake_get_label_singular( $string = '' ) {
  66. return '';
  67. }
  68. /**
  69. * @deprecated 1.7.0
  70. *
  71. * @param string $string
  72. *
  73. * @return string
  74. */
  75. function popmake_get_label_plural( $string = '' ) {
  76. return '';
  77. }
  78. /**
  79. * Retrieve the array of plugin settings
  80. *
  81. * @since 1.0
  82. * @deprecated 1.7.0
  83. *
  84. * @return array
  85. */
  86. function popmake_get_registered_settings() {
  87. /**
  88. * 'Whitelisted' POPMAKE settings, filters are provided for each settings
  89. * section to allow extensions and other plugins to add their own settings
  90. */
  91. $popmake_settings = array(
  92. /** General Settings */
  93. 'general' => apply_filters( 'popmake_settings_general', array() ),
  94. 'assets' => apply_filters( 'popmake_settings_assets', array() ),
  95. /** Extension Settings */
  96. 'extensions' => apply_filters( 'popmake_settings_extensions', array() ),
  97. 'licenses' => apply_filters( 'popmake_settings_licenses', array() ),
  98. 'misc' => apply_filters( 'popmake_settings_misc', array() ),
  99. );
  100. return apply_filters( 'popmake_registered_settings', $popmake_settings );
  101. }
  102. /**
  103. * Determines whether the current admin page is an POPMAKE admin page.
  104. *
  105. * @deprecated 1.7.0 Use pum_is_admin_page instead.
  106. *
  107. * @since 1.0
  108. *
  109. * @return bool True if POPMAKE admin page.
  110. */
  111. function popmake_is_admin_page() {
  112. return pum_is_admin_page();
  113. }
  114. /**
  115. * Determines whether the current admin page is an admin popup page.
  116. *
  117. * @deprecated 1.7.0
  118. *
  119. * @since 1.0
  120. *
  121. * @return bool
  122. */
  123. function popmake_is_admin_popup_page() {
  124. return pum_is_popup_editor();
  125. }
  126. /**
  127. * Determines whether the current admin page is an admin theme page.
  128. *
  129. * @deprecated 1.7.0 @see pum_is_popup_theme_editor
  130. *
  131. * @since 1.0
  132. *
  133. * @return bool
  134. */
  135. function popmake_is_admin_popup_theme_page() {
  136. return pum_is_popup_theme_editor();
  137. }
  138. /**
  139. * @deprecated 1.7.0
  140. */
  141. function popmake_output_pum_styles() {
  142. return '';
  143. }
  144. /**
  145. * Retrieve a list of all published pages
  146. *
  147. * On large sites this can be expensive, so only load if on the settings page or $force is set to true
  148. *
  149. * @since 1.0
  150. * @deprecated 1.7.0
  151. *
  152. * @param bool $force Force the pages to be loaded even if not on settings
  153. *
  154. * @return array $pages_options An array of the pages
  155. */
  156. function popmake_get_pages( $force = false ) {
  157. $pages_options = array( 0 => '' ); // Blank option
  158. if ( ( ! isset( $_GET['page'] ) || 'pum-settings' != $_GET['page'] ) && ! $force ) {
  159. return $pages_options;
  160. }
  161. $pages = get_pages();
  162. if ( $pages ) {
  163. foreach ( $pages as $page ) {
  164. $pages_options[ $page->ID ] = $page->post_title;
  165. }
  166. }
  167. return $pages_options;
  168. }
  169. /**
  170. * Returns the cookie fields used for cookie options.
  171. *
  172. * @deprecated 1.7.0 Use PUM_Cookies::instance()->cookie_fields() instead.
  173. *
  174. * @return array
  175. */
  176. function pum_get_cookie_fields() {
  177. return PUM_Cookies::instance()->cookie_fields();
  178. }
  179. /**
  180. * Returns an array of args for registering coo0kies.
  181. *
  182. * @deprecated 1.7.0 Use PUM_Cookies::instance()->cookie_fields() instead.
  183. *
  184. * @return array
  185. */
  186. function pum_get_cookies() {
  187. return PUM_Cookies::instance()->get_cookies();
  188. }
  189. /**
  190. * Returns the cookie fields used for trigger options.
  191. *
  192. * @deprecated v1.7.0 Use PUM_Triggers::instance()->cookie_fields() instead.
  193. *
  194. * @return array
  195. */
  196. function pum_trigger_cookie_fields() {
  197. return PUM_Triggers::instance()->cookie_fields();
  198. }
  199. /**
  200. * Returns the cookie field used for trigger options.
  201. *
  202. * @deprecated v1.7.0 Use PUM_Triggers::instance()->cookie_field() instead.
  203. *
  204. * @return array
  205. */
  206. function pum_trigger_cookie_field() {
  207. return PUM_Triggers::instance()->cookie_field();
  208. }
  209. /**
  210. * Returns an array of section labels for all triggers.
  211. *
  212. * @deprecated v1.7.0 Use PUM_Triggers::instance()->get_tabs() instead.
  213. *
  214. * @return array
  215. */
  216. function pum_get_trigger_section_labels() {
  217. return PUM_Triggers::instance()->get_tabs();
  218. }
  219. #endregion
  220. #region Deprecated 1.8.0
  221. /**
  222. * Install Default Theme
  223. *
  224. * Installs the default theme and updates the option.
  225. *
  226. * @since 1.0
  227. * @deprecated 1.8.0
  228. */
  229. function popmake_install_default_theme() {
  230. $defaults = PUM_Admin_Themes::defaults();
  231. $default_theme = @wp_insert_post( array(
  232. 'post_title' => __( 'Default Theme', 'popup-maker' ),
  233. 'post_status' => 'publish',
  234. 'post_author' => 1,
  235. 'post_type' => 'popup_theme',
  236. 'comment_status' => 'closed',
  237. 'meta_input' => array(
  238. '_pum_built_in' => 'default-theme',
  239. '_pum_default_theme' => true,
  240. 'popup_theme_settings' => $defaults,
  241. 'popup_theme_data_version' => 3,
  242. ),
  243. ) );
  244. update_option( 'popmake_default_theme', $default_theme );
  245. pum_reset_assets();
  246. }
  247. /**
  248. * Checks if the db_ver is v1.4 compatible.
  249. *
  250. * v1.4 compatibility is db_ver 6 or higher.
  251. *
  252. * @depecated 1.8.0
  253. *
  254. * @uses pum_get_db_ver()
  255. *
  256. * @return bool
  257. */
  258. function pum_is_v1_4_compatible() {
  259. return true;
  260. }
  261. /**
  262. * Deletes the theme css transient forcing it to refresh.
  263. *
  264. * @deprecated 1.8.0 Use pum_reset_assets()
  265. */
  266. function pum_force_theme_css_refresh() {
  267. pum_reset_assets();
  268. }
  269. /**
  270. * @deprecated 1.8.0
  271. *
  272. * @param $hex
  273. *
  274. * @return array|string
  275. */
  276. function popmake_hex2rgb( $hex ) {
  277. return PUM_Utils_CSS::hex2rgb( $hex, 'array' );
  278. }
  279. /**
  280. * @deprecated 1.8.0
  281. *
  282. * @param $hex
  283. * @param int $opacity
  284. *
  285. * @return string
  286. */
  287. function popmake_get_rgba_value( $hex, $opacity = 100 ) {
  288. return PUM_Utils_CSS::hex2rgba( $hex, $opacity );
  289. }
  290. /**
  291. * @deprecated 1.8.0
  292. *
  293. * @param int $thickness
  294. * @param string $style
  295. * @param string $color
  296. *
  297. * @return string
  298. */
  299. function popmake_get_border_style( $thickness = 1, $style = 'solid', $color = '#cccccc' ) {
  300. return PUM_Utils_CSS::border_style( $thickness, $style, $color );
  301. }
  302. /**
  303. * @deprecated 1.8.0
  304. *
  305. * @param int $horizontal
  306. * @param int $vertical
  307. * @param int $blur
  308. * @param int $spread
  309. * @param string $hex
  310. * @param int $opacity
  311. * @param string $inset
  312. *
  313. * @return string
  314. */
  315. function popmake_get_box_shadow_style( $horizontal = 0, $vertical = 0, $blur = 0, $spread = 0, $hex = '#000000', $opacity = 50, $inset = 'no' ) {
  316. return PUM_Utils_CSS::box_shadow_style( $horizontal, $vertical, $blur, $spread, $hex, $opacity, $inset );
  317. }
  318. /**
  319. * @deprecated 1.8.0
  320. *
  321. * @param int $horizontal
  322. * @param int $vertical
  323. * @param int $blur
  324. * @param string $hex
  325. * @param int $opacity
  326. *
  327. * @return string
  328. */
  329. function popmake_get_text_shadow_style( $horizontal = 0, $vertical = 0, $blur = 0, $hex = '#000000', $opacity = 50 ) {
  330. return PUM_Utils_CSS::text_shadow_style( $horizontal, $vertical, $blur, $hex, $opacity );
  331. }
  332. /**
  333. * @deprecated 1.8.0
  334. *
  335. * @param $id
  336. */
  337. function pum_load_popup( $id ) {
  338. PUM_Site_Popups::load_popup( $id );
  339. };
  340. /**
  341. * Retrieves a template part
  342. *
  343. * @deprecated 1.8.0 Use pum_get_template_part instead.
  344. *
  345. * @param string $slug
  346. * @param null|string $name
  347. * @param bool $load
  348. *
  349. * @return string
  350. */
  351. function popmake_get_template_part( $slug, $name = null, $load = true ) {
  352. if ( $load ) {
  353. return pum_get_template_part( $slug, $name );
  354. } else {
  355. return PUM_Utils_Template::locate_part( $slug, $name, false );
  356. }
  357. }
  358. /**
  359. * Theme Overlay Metabox
  360. *
  361. * Extensions (as well as the core plugin) can add items to the theme overlay
  362. * configuration metabox via the `popmake_popup_theme_overlay_meta_box_fields` action.
  363. *
  364. * @since 1.0
  365. * @deprecated 1.8.0
  366. */
  367. function popmake_render_popup_theme_overlay_meta_box() {
  368. if ( ! has_action( 'popmake_popup_theme_overlay_meta_box_fields' ) ) {
  369. return;
  370. }
  371. global $post;
  372. wp_nonce_field( basename( __FILE__ ), 'popmake_popup_theme_meta_box_nonce' ); ?>
  373. <input type="hidden" name="popup_theme_defaults_set" value="true"/>
  374. <div id="popmake_popup_theme_overlay_fields" class="popmake_meta_table_wrap">
  375. <table class="form-table">
  376. <tbody>
  377. <?php do_action( 'popmake_popup_theme_overlay_meta_box_fields', $post->ID ); ?>
  378. </tbody>
  379. </table>
  380. </div><?php
  381. }
  382. /**
  383. * Theme Container Metabox
  384. *
  385. * Extensions (as well as the core plugin) can add items to the theme container
  386. * configuration metabox via the `popmake_popup_theme_container_meta_box_fields` action.
  387. *
  388. * @since 1.0
  389. * @deprecated 1.8.0
  390. */
  391. function popmake_render_popup_theme_container_meta_box() {
  392. if ( ! has_action( 'popmake_popup_theme_container_meta_box_fields' ) ) {
  393. return;
  394. }
  395. global $post; ?>
  396. <div id="popmake_popup_theme_container_fields" class="popmake_meta_table_wrap">
  397. <table class="form-table">
  398. <tbody>
  399. <?php do_action( 'popmake_popup_theme_container_meta_box_fields', $post->ID ); ?>
  400. </tbody>
  401. </table>
  402. </div><?php
  403. }
  404. /**
  405. * Theme Close Metabox
  406. *
  407. * Extensions (as well as the core plugin) can add items to the popup close
  408. * configuration metabox via the `popmake_popup_theme_close_meta_box_fields` action.
  409. *
  410. * @since 1.0
  411. * @deprecated 1.8.0
  412. */
  413. function popmake_render_popup_theme_close_meta_box() {
  414. if ( ! has_action( 'popmake_popup_theme_close_meta_box_fields' ) ) {
  415. return;
  416. }
  417. global $post; ?>
  418. <div id="popmake_popup_theme_close_fields" class="popmake_meta_table_wrap">
  419. <table class="form-table">
  420. <tbody>
  421. <?php do_action( 'popmake_popup_theme_close_meta_box_fields', $post->ID ); ?>
  422. </tbody>
  423. </table>
  424. </div><?php
  425. }
  426. #endregion