Skip to content

Commit 34bddaa

Browse files
authored
refactor: remove deprecated constants and clean up markup (#34)
Eliminated unused constants `PML_DB_VERSION`, `PLUGINDIR`, and `MUPLUGINDIR` as they were no longer required. Simplified and reformatted HTML output in `class-token-meta-box.php` for better readability and maintainability.
2 parents 5c2cd6e + 5025111 commit 34bddaa

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

includes/class-token-meta-box.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function render_meta_box_content( WP_Post $post ): void
126126
$is_protected = (bool) get_post_meta( $attachment_id, '_' . PML_PREFIX . '_is_protected', true );
127127
$prefix = PML_PREFIX;
128128

129-
echo "<div id='{$prefix}-token-manager-app' class='pml-token-manager-app' data-attachment-id='{$attachment_id}'>";
129+
echo "<div id='$prefix-token-manager-app' class='pml-token-manager-app' data-attachment-id='$attachment_id'>";
130130

131131
if ( !$is_protected )
132132
{
@@ -142,20 +142,18 @@ public function render_meta_box_content( WP_Post $post ): void
142142
$exist_title = esc_html__( 'Existing Tokens', 'access-lens-protected-media-links' );
143143
$loading_text = esc_html__( 'Loading tokens...', 'access-lens-protected-media-links' );
144144

145-
echo <<<EOT
146-
<h3>$gen_title</h3>
147-
<div class='$prefix-generate-token-form-wrapper'>
145+
echo "<h3>$gen_title</h3>
146+
<div class='$prefix-generate-token-form-wrapper'>
148147
<div id='$prefix-generate-token-form-fields'></div>
149148
<button type='button' id='$prefix-generate-token-button' class='button button-primary'>$create_btn</button>
150149
<span class='spinner' id='$prefix-generate-token-spinner'></span>
151150
<div id='$prefix-generate-token-feedback'></div>
152-
</div>
153-
<hr>
154-
<h3>$exist_title</h3>
155-
<div id='$prefix-tokens-list-wrapper'><p class='pml-loading-text'>$loading_text</p></div>
156-
<div id='$prefix-token-actions-feedback' style='margin-top: 10px;'></div>
157-
EOT;
158-
echo "</div>";
151+
</div>
152+
<hr>
153+
<h3>$exist_title</h3>
154+
<div id='$prefix-tokens-list-wrapper'><p class='pml-loading-text'>$loading_text</p></div>
155+
<div id='$prefix-token-actions-feedback' style='margin-top: 10px;'></div>";
156+
echo "</div>"; // closes div#{PML_PREFIX}-token-manager-app
159157
}
160158

161159
public function ajax_fetch_attachment_tokens(): void

includes/pml-headless-helpers.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,6 @@ function pml_headless_define_constants( wpdb $wpdb )
283283
define( 'WPMU_PLUGIN_URL', rtrim( WP_CONTENT_URL, '/' ) . '/mu-plugins' );
284284
}
285285
}
286-
287-
// Define deprecated relative path constants.
288-
// These are string literals, by convention relative to ABSPATH.
289-
if ( !defined( 'PLUGINDIR' ) )
290-
{
291-
define( 'PLUGINDIR', 'wp-content/plugins' );
292-
}
293-
if ( !defined( 'MUPLUGINDIR' ) )
294-
{
295-
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' );
296-
}
297286
}
298287

299288
if ( !function_exists( '__' ) )

pml-constants.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
const PML_PLUGIN_SLUG = 'protected-media-links';
66
const PML_PREFIX = 'pml';
77
const PML_VERSION = '1.1.0';
8-
const PML_DB_VERSION = '1.0.0';
98
const PML_MIN_WP_VERSION = '5.9';
109
const PML_MIN_PHP_VERSION = '7.4';
1110
const PML_PLUGIN_FILE = __DIR__ . '/protected-media-links.php';

0 commit comments

Comments
 (0)