: URL to the PDF file must be on exactly the same domain as the current web page.', 'pdf-embedder' ), 'clickhereinfo' => esc_html__( 'Click here for more info', 'pdf-embedder' ), 'widthheightinvalid' => esc_html__( 'PDF page width or height are invalid', 'pdf-embedder' ), 'viewinfullscreen' => esc_html__( 'View in Full Screen', 'pdf-embedder' ), ], ]; // Translatable strings. wp_localize_script( 'pdfemb_embed_pdf', 'pdfemb_trans', $front ); } /** * Register block editor scripts. * * @since 4.8.0 */ public function enqueue_block_assets(): void { if ( ! is_admin() ) { return; } // As the block is extended by Premium, we need this "once" flag to load all assets only once. static $once = false; if ( $once ) { return; } $once = true; $options = pdf_embedder()->options()->get(); $processed = []; foreach ( $options as $key => $value ) { if ( is_array( $value ) ) { continue; } $processed[ str_replace( 'pdfemb_', '', $key ) ] = $value; } $data = 'const pdfembPluginOptions=' . wp_json_encode( $processed ) . ';'; wp_add_inline_script( 'pdfemb-pdf-embedder-viewer-editor-script', $data, 'before' ); } /** * Plugin logic that should be available in admin area only. * * @since 4.7.0 */ public function hook_admin_init(): void { $this->admin->init(); $this->admin->hooks(); /** * Plugin admin area is initialized. * You can extend it now. * * @since 4.7.0 */ do_action( 'pdfemb_admin_init' ); } /** * Check if the plugin is a paid version. * * @since 4.7.0 * * @return bool */ public function is_premium(): bool { return $this->premium !== null; } /** * Premium plugin instance. * * @since 4.7.0 * * @return Premium\Plugin */ public function premium() { return $this->is_premium() ? $this->premium : null; } /** * Get access to the plugin admin area. * * @since 4.7.0 */ public function admin(): Admin\Admin { return $this->admin; } /** * Get the Tasks code of the plugin. * * @since 4.7.0 */ public function tasks(): Tasks { return $this->tasks; } /** * Get/Load the Options code of the plugin. * * @since 4.7.0 */ public function options(): Options { return $this->options; } /** * Activation hook. * * @since 4.7.0 */ public static function activated(): void { $options = pdf_embedder()->options(); if ( ! $options->exist() ) { $options->save( $options->get(), 'settings' ); } // Activation time, added only once. add_option( 'wppdf_emb_activation', time(), '', 'no' ); } }