| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/FileManager/wp-content/plugins/quick-embed-pdf/includes/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class QEPW_Admin {
public static function init() {
add_action( 'admin_menu', [ self::class, 'add_admin_menu' ] );
add_action( 'admin_init', [ self::class, 'register_settings' ] );
}
public static function add_admin_menu() {
add_options_page(
'Quick Embed PDF Settings',
'Quick Embed PDF',
'manage_options',
'qepw',
[ self::class, 'settings_page' ]
);
}
public static function register_settings() {
register_setting(
'qepw_settings',
'qepw_width',
[
'type' => 'integer',
'sanitize_callback' => 'absint',
'default' => 800,
]
);
register_setting(
'qepw_settings',
'qepw_download_button',
[
'type' => 'boolean',
'sanitize_callback' => 'rest_sanitize_boolean',
'default' => true,
]
);
}
public static function render_usage_instructions() {
?>
<div>
<h3>1. Embedding in Classic Editor</h3>
<p>To embed a PDF file in a post or page using the plugin, use the following shortcode. Example:</p>
<code>[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]</code>
<p>Replace <code>YOUR_PDF_FILE_URL</code> with the actual URL of your PDF file.</p>
<h3>2. Embedding in Gutenberg Editor</h3>
<p>In the Gutenberg editor, use the "Quick Embed PDF" block. It is available in the "Embed" category in the block menu. After adding the block, select a PDF from your media library or upload a new one.</p>
<h3>3. Manually Embedding the Shortcode</h3>
<p>If you want to manually embed a PDF file at any place in the content, use the following shortcode:</p>
<code>[qepw_pdf_viewer file="YOUR_PDF_FILE_URL"]</code>
<p>Replace <code>YOUR_PDF_FILE_URL</code> with the link to your PDF file.</p>
</div>
<?php
}
public static function settings_page() {
?>
<div class="wrap">
<h1>Quick Embed PDF Settings</h1>
<form method="post" action="options.php">
<?php
settings_fields( 'qepw_settings' );
?>
<table class="form-table">
<tr>
<th scope="row">Block Width (px)</th>
<td>
<input type="text"
name="qepw_width"
value="<?php echo esc_attr( get_option( 'qepw_width', 800 ) ); ?>"
pattern="[0-9]*"
required />
</td>
</tr>
<tr>
<th scope="row">Show Download Button</th>
<td>
<input type="checkbox"
name="qepw_download_button"
value="1"
<?php checked( get_option( 'qepw_download_button', true ), true ); ?> />
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
<h2>Plugin Usage</h2>
<div>
<?php self::render_usage_instructions(); ?>
</div>
</div>
<?php
}
}