| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FireBox |
| 4 | - * @version 3.1.13 Free | |
| 4 | + * @version 2.1.23 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 © 2024 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); | |
| 26 | 32 | } |
| 27 | 33 | |
| 28 | 34 | /** |
| 29 | 35 | * Returns the library settings. |
| @@ -48,9 +54,9 @@ | ||
| 48 | 54 | 'license_key_status' => false, |
| 49 | 55 | |
| 50 | 56 | |
| 51 | 57 | 'blank_template_label' => fpframework()->_('FPF_BLANK_TEMPLATE'), |
| 52 | - 'template_use_url' => 'post.php?action=edit&post=' | |
| 58 | + 'template_use_url' => 'post-new.php?post_type=firebox&fpf_use_template=true&template=' | |
| 53 | 59 | ]; |
| 54 | 60 | } |
| 55 | 61 | |
| 56 | 62 | /** |
| @@ -90,6 +96,41 @@ | ||
| 90 | 96 | return false; |
| 91 | 97 | } |
| 92 | 98 | |
| 93 | 99 | $this->init(); |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * Set the default post title if we have selected a template via the Library | |
| 104 | + * | |
| 105 | + * @param string $post_title | |
| 106 | + * @param object $post | |
| 107 | + * | |
| 108 | + * @return string | |
| 109 | + */ | |
| 110 | + public function presetPostTitle($post_title, $post) | |
| 111 | + { | |
| 112 | + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL()) | |
| 113 | + { | |
| 114 | + return $post_title; | |
| 115 | + } | |
| 116 | + | |
| 117 | + return $template['template']['post_title']; | |
| 118 | + } | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * Sets the default post content if we have selected a template via the Library | |
| 122 | + * | |
| 123 | + * @param string | |
| 124 | + * | |
| 125 | + * @return string | |
| 126 | + */ | |
| 127 | + public function presetPostContent($content) | |
| 128 | + { | |
| 129 | + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL()) | |
| 130 | + { | |
| 131 | + return $content; | |
| 132 | + } | |
| 133 | + | |
| 134 | + return $template['template']['post_content']; | |
| 94 | 135 | } |
| 95 | 136 | } |