| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.0.12 Free | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2026 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2023 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FireBox\Core\Admin\Includes; |
| @@ -22,8 +22,14 @@ | ||
| 22 | 22 | { |
| 23 | 23 | parent::__construct($this->getLibrarySettings()); |
| 24 | 24 | |
| 25 | 25 | add_action('current_screen', [$this, 'validate']); |
| 26 | + | |
| 27 | + // set default post title | |
| 28 | + add_filter('default_title', [$this, 'presetPostTitle'], 100, 2); | |
| 29 | + | |
| 30 | + // set default post content | |
| 31 | + add_filter('default_content', [$this, 'presetPostContent'], 200, 2); | |
| 26 | 32 | } |
| 27 | 33 | |
| 28 | 34 | /** |
| 29 | 35 | * Returns the library settings. |
| @@ -33,11 +39,11 @@ | ||
| 33 | 39 | private function getLibrarySettings() |
| 34 | 40 | { |
| 35 | 41 | return [ |
| 36 | 42 | 'id' => 'fbSelectTemplate', |
| 37 | - 'title' => firebox()->_('FB_CAMPAIGN_LIBRARY'), | |
| 43 | + 'title' => firebox()->_('FB_POPUP_LIBRARY'), | |
| 38 | 44 | 'create_new_template_link' => admin_url('post-new.php?post_type=firebox'), |
| 39 | - 'main_category_label' => firebox()->_('FB_CAMPAIGN_TYPE'), | |
| 45 | + 'main_category_label' => firebox()->_('FB_POPUP_TYPES'), | |
| 40 | 46 | 'plugin_license_settings_url' => admin_url('admin.php?page=firebox-settings#license_key'), |
| 41 | 47 | 'plugin_dir' => FBOX_PLUGIN_DIR, |
| 42 | 48 | 'plugin' => 'firebox', |
| 43 | 49 | 'plugin_version' => FBOX_VERSION, |
| @@ -47,10 +53,10 @@ | ||
| 47 | 53 | 'license_key' => false, |
| 48 | 54 | 'license_key_status' => false, |
| 49 | 55 | |
| 50 | 56 | |
| 51 | - 'blank_template_label' => fpframework()->_('FPF_BLANK_TEMPLATE'), | |
| 52 | - 'template_use_url' => 'post.php?action=edit&post=' | |
| 57 | + 'blank_template_label' => firebox()->_('FB_BLANK_POPUP'), | |
| 58 | + 'template_use_url' => 'post-new.php?post_type=firebox&fpf_use_template=true&template=' | |
| 53 | 59 | ]; |
| 54 | 60 | } |
| 55 | 61 | |
| 56 | 62 | /** |
| @@ -77,12 +83,8 @@ | ||
| 77 | 83 | $current_screen = get_current_screen(); |
| 78 | 84 | |
| 79 | 85 | $allowed_pages = [ |
| 80 | 86 | 'toplevel_page_firebox', |
| 81 | - 'firebox_page_firebox-analytics', | |
| 82 | - 'firebox_page_firebox-campaigns', | |
| 83 | - 'firebox_page_firebox-submissions', | |
| 84 | - 'firebox_page_firebox-settings', | |
| 85 | 87 | 'edit-firebox' |
| 86 | 88 | ]; |
| 87 | 89 | |
| 88 | 90 | if (!in_array($current_screen->id, $allowed_pages)) |
| @@ -90,6 +92,41 @@ | ||
| 90 | 92 | return false; |
| 91 | 93 | } |
| 92 | 94 | |
| 93 | 95 | $this->init(); |
| 96 | + } | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * Set the default post title if we have selected a template via the Library | |
| 100 | + * | |
| 101 | + * @param string $post_title | |
| 102 | + * @param object $post | |
| 103 | + * | |
| 104 | + * @return string | |
| 105 | + */ | |
| 106 | + public function presetPostTitle($post_title, $post) | |
| 107 | + { | |
| 108 | + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL()) | |
| 109 | + { | |
| 110 | + return; | |
| 111 | + } | |
| 112 | + | |
| 113 | + return $template['template']['post_title']; | |
| 114 | + } | |
| 115 | + | |
| 116 | + /** | |
| 117 | + * Sets the default post content if we have selected a template via the Library | |
| 118 | + * | |
| 119 | + * @param string | |
| 120 | + * | |
| 121 | + * @return string | |
| 122 | + */ | |
| 123 | + public function presetPostContent($content) | |
| 124 | + { | |
| 125 | + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL()) | |
| 126 | + { | |
| 127 | + return; | |
| 128 | + } | |
| 129 | + | |
| 130 | + return $template['template']['post_content']; | |
| 94 | 131 | } |
| 95 | 132 | } |