render_preview_metabox($post) { $btn_url = admin_url('admin-ajax.php'); $attr = ['data-action' => 'dce_preview_pdf_html_template', 'data-url' => $btn_url, 'id' => 'dce-preview-pdf', 'type' => 'button', 'class' => 'dce-pdf-preview-button']; echo ''; echo ''; } // This function will only present the font options to the user. public function render_fonts_metabox($post) { echo '

' . __('The following fonts can be used with the font-family CSS property. ', 'dynamic-content-for-elementor') . '

'; echo '

' . __('Core Fonts', 'dynamic-content-for-elementor') . '

'; echo '

'; echo __('The available core fonts are: ', 'dynamic-content-for-elementor'); echo 'ctimes, chelvetica, ccourier'; echo '

'; echo '

' . __('RTL languages: please notice that you cannot use the core fonts in a page that contains also an RTL language, like Arabic or Hebrew. Upload them as Custom Fonts if you need them.', 'dynamic-content-for-elementor') . '

'; echo '

' . __('Custom Fonts', 'dynamic-content-for-elementor') . '

'; $text = __('Custom Fonts can be added in the Elementor Custom Fonts menu page. Only the TTF type is supported. Weight can only be normal or bold, style can only be normal or italic. The following are the ones that were detected:', 'dynamic-content-for-elementor'); $text = \sprintf($text, admin_url('edit.php?post_type=elementor_font')); echo '

' . $text . '

'; $font_data = $this->get_fonts()['fonts']; echo ''; } public function render_images_metabox($post) { $media_url = get_admin_url() . '/upload.php'; echo '

' . __('To insert an image, first go to the ', 'dynamic-content-for-elementor'); echo "" . __('WordPress Media Library', 'dynamic-content-for-elementor') . ''; echo __(', select an image and find its ID. Then you can use the image like this:', 'dynamic-content-for-elementor') . '

'; echo '<img src="{{ Image( <ID> ).file_loc }}">'; echo '

' . __('Notice how we used .file_loc , which is a file system path, instead of a URL. Avoid image URLs as they will be slow to fetch.', 'dynamic-content-for-elementor') . '

'; echo '

' . __('To insert a signature you can use:', 'dynamic-content-for-elementor') . '

'; echo '<img src="{{ form_raw.signature_field_id }}">'; } // Render a select2 input where $id is its id, and $post_id is the // preselected post id. public function render_select2($id, $post_id, $label) { // do not forget about WP Nonces for security purposes $attr = ['name' => $id, 'id' => $id, 'style' => 'width:99%;max-width:25em;']; if ($post_id) { $title = wp_kses_post(get_the_title($post_id)); $title = \mb_strlen($title) > 50 ? \mb_substr($title, 0, 49) . '...' : $title; } echo '


'; echo '

'; } public function render_preview_data_metabox($post) { wp_enqueue_script('dce-pdf-html-template', DCE_URL . 'assets/js/pdf-html-templates.js', [], DCE_VERSION, \true); $data = get_post_meta($post->ID, self::TEMPLATE_META_KEY, \true); $post_id = $data[self::FIELD_PREVIEW_POST] ?? \false; $label = __('Select a Post to get things like Post Title, ACF fields etc. for the preview (can leave empty if these are not used)', 'dynamic-content-for-elementor'); $this->render_select2(self::FIELD_PREVIEW_POST, $post_id, $label); $attr = ['name' => self::FIELD_PREVIEW_FORM_DATA, 'id' => self::FIELD_PREVIEW_FORM_DATA, 'style' => 'width: 100%; height: 10em;']; $form_data = $data[self::FIELD_PREVIEW_FORM_DATA] ?? self::DEFAULT_PREVIEW_DATA; echo '

'; echo '

'; } public function render_dimensions_metabox($post) { $data = get_post_meta($post->ID, self::TEMPLATE_META_KEY, \true); $format_attr = ['name' => self::FIELD_FORMAT, 'id' => self::FIELD_FORMAT]; $orientation_attr = ['name' => self::FIELD_ORIENTATION, 'type' => 'radio']; $selected_format = $data[self::FIELD_FORMAT] ?? 'A4'; $selected_orientation = $data[self::FIELD_ORIENTATION] ?? 'P'; $formats = ['A4', 'A5', 'A6', 'Letter', 'Legal', 'Executive', 'Folio']; echo ''; echo '

'; echo ''; $checked = $selected_orientation === 'P' ? ' checked ' : ''; echo 'get_attribute_string($orientation_attr) . $checked . '>'; echo ''; $checked = $selected_orientation === 'L' ? ' checked ' : ''; echo 'get_attribute_string($orientation_attr) . $checked . '>'; echo '

'; } private function get_code_editor_settings() { // TODO: Handle `enqueue_code_editor_scripts` to work with `lint => 'true'`. return ['type' => 'text/html', 'codemirror' => ['indentUnit' => 2, 'tabSize' => 2, 'mode' => ['name' => 'twig', 'base' => 'text/html']]]; } private function enqueue_code_editor_scripts($field_code_id) { wp_enqueue_script('htmlhint'); wp_enqueue_script('csslint'); wp_add_inline_script( // fix as described here: https://make.wordpress.org/core/2017/10/22/code-editing-improvements-in-wordpress-4-9/ 'wp-codemirror', 'window.CodeMirror = wp.CodeMirror;' ); wp_enqueue_script('codemirror-twig', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.29.0/mode/twig/twig.min.js', ['wp-codemirror'], DCE_VERSION, \false); /** * Some of the plugins may load 'code-editor' for their needs and change the default behavior, so it should * re-initialize the code editor with 'custom code' settings. */ if (wp_script_is('code-editor')) { wp_add_inline_script('code-editor', \sprintf('wp.codeEditor.initialize( jQuery( "#%s"), %s );', $field_code_id, wp_json_encode(wp_get_code_editor_settings($this->get_code_editor_settings())))); } else { wp_enqueue_code_editor($this->get_code_editor_settings()); wp_add_inline_script('code-editor', \sprintf('wp.codeEditor.initialize( jQuery( "#%s") );', $field_code_id)); } } public function add_meta_boxes() { add_meta_box('elementor-pdf-html-code-metabox', __('HTML', 'dynamic-content-for-elementor'), [$this, 'render_code_metabox'], self::CPT, 'normal', 'default'); add_meta_box('elementor-pdf-html-preview-metabox', __('Preview', 'dynamic-content-for-elementor'), [$this, 'render_preview_metabox'], self::CPT, 'side', 'default'); add_meta_box('elementor-pdf-html-dimensions-metabox', __('Dimensions', 'dynamic-content-for-elementor'), [$this, 'render_dimensions_metabox'], self::CPT, 'normal', 'default'); add_meta_box('elementor-pdf-html-fonts-metabox', __('Fonts', 'dynamic-content-for-elementor'), [$this, 'render_fonts_metabox'], self::CPT, 'normal', 'default'); add_meta_box('elementor-pdf-html-preview-data-metabox', __('Preview Data', 'dynamic-content-for-elementor'), [$this, 'render_preview_data_metabox'], self::CPT, 'normal', 'default'); add_meta_box('elementor-pdf-html-image-metabox', __('Inserting Images', 'dynamic-content-for-elementor'), [$this, 'render_images_metabox'], self::CPT, 'side', 'default'); } }
Fatal error: Uncaught Error: Class 'DynamicContentForElementor\PdfHtmlTemplates' not found in /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php:151 Stack trace: #0 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php(128): DynamicContentForElementor\Plugin->init_managers() #1 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php(95): DynamicContentForElementor\Plugin->init() #2 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php(122): DynamicContentForElementor\Plugin->__construct() #3 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php(259): DynamicContentForElementor\Plugin::instance() #4 /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/dynamic-content-for-elementor.php(200): require_once('/home/sportuga/...') #5 /home/sportuga/public_html/wp-includes/class-wp-hook.php(324): dce_load('') #6 /home/s in /home/sportuga/public_html/wp-content/plugins/dynamic-content-for-elementor/core/plugin.php on line 151