| 1 |
<?php |
| 2 |
namespace BPPIV\Base; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
class Admin { |
| 9 |
|
| 10 |
public function register() { |
| 11 |
add_action( 'admin_enqueue_scripts', [ $this, 'bppiv_popup_modal' ] ); |
| 12 |
add_filter( 'plugin_row_meta', [ $this, 'bppiv_plugin_row_meta' ], 10, 2 ); |
| 13 |
add_filter( 'plugin_action_links_' . plugin_basename( BPPIV__FILE__ ), [ $this, 'bppiv_plugin_action_links' ] ); |
| 14 |
add_action( 'init', [ $this, 'bppiv_load_metaboxes' ], 0 ); |
| 15 |
} |
| 16 |
|
| 17 |
public function bppiv_popup_modal() { |
| 18 |
wp_add_inline_script( 'jquery-core', <<<'JS' |
| 19 |
jQuery(document).ready(function($){ |
| 20 |
$('.pano-help-link').on('click', function(e){ |
| 21 |
e.preventDefault(); |
| 22 |
if ($('#pano-help-modal').length === 0) { |
| 23 |
$('body').append(` |
| 24 |
<div id='pano-help-modal' style=' |
| 25 |
position:fixed; top:0; left:0; width:100%; height:100%; |
| 26 |
background:rgba(0,0,0,0.5); z-index:9999; |
| 27 |
display:flex; justify-content:center; align-items:center;'> |
| 28 |
<div style=' |
| 29 |
background:#fff; padding:20px; max-width:500px; width:90%; |
| 30 |
border-radius:6px; box-shadow:0 5px 15px rgba(0,0,0,0.3);'> |
| 31 |
<h3>How to Find Google Street View Panorama ID</h3> |
| 32 |
<ol> |
| 33 |
<li>Open <b>Google Maps</b></li> |
| 34 |
<li>Search your location</li> |
| 35 |
<li>Drag the yellow Street View icon onto a road</li> |
| 36 |
<li>Copy the URL from your browser</li> |
| 37 |
<li>Find <b>panoid=</b> in the URL</li> |
| 38 |
<li>Copy the text after <b>panoid=</b></li> |
| 39 |
</ol> |
| 40 |
<p>Example: <code>https://www.google.com/maps/...panoid=JmSoPsBPhqWvaBmOqfFzgA</code></p> |
| 41 |
<p>Panorama ID: <code>JmSoPsBPhqWvaBmOqfFzgA</code></p> |
| 42 |
<button id='pano-help-close' style='margin-top:10px; cursor:pointer;'>Close</button> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
`); |
| 46 |
} |
| 47 |
$('#pano-help-modal').fadeIn(); |
| 48 |
$('#pano-help-close').on('click', function(){ $('#pano-help-modal').fadeOut(); }); |
| 49 |
$('#pano-help-modal').on('click', function(e){ if(e.target.id==='pano-help-modal'){ $(this).fadeOut(); } }); |
| 50 |
}); |
| 51 |
}); |
| 52 |
JS |
| 53 |
); |
| 54 |
} |
| 55 |
|
| 56 |
public function bppiv_plugin_row_meta( $plugin_meta, $plugin_file ) { |
| 57 |
if ( false !== strpos( $plugin_file, 'panorama/panorama.php' ) && time() < strtotime( '2025-12-05' ) ) { |
| 58 |
$url = 'https://bplugins.com/coupons/?from=plugins.php&plugin=panorama'; |
| 59 |
$plugin_meta[] = '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener noreferrer" style="font-weight:600;color:#146ef5;">' . esc_html__( '🎉 Black Friday Sale - Get up to 80% OFF Now!', 'panorama' ) . '</a>'; |
| 60 |
} |
| 61 |
return $plugin_meta; |
| 62 |
} |
| 63 |
|
| 64 |
public function bppiv_plugin_action_links( $links ) { |
| 65 |
$help_url = admin_url( 'edit.php?post_type=bppiv-image-viewer&page=bppiv-support' ); |
| 66 |
$help_link = '<a href="' . esc_url( $help_url ) . '" style="color:#FF7A00;font-weight:bold;">' |
| 67 |
. esc_html__( 'Help & Demos', 'panorama' ) . '</a>'; |
| 68 |
$links[] = $help_link; |
| 69 |
return $links; |
| 70 |
} |
| 71 |
|
| 72 |
public function bppiv_load_metaboxes() { |
| 73 |
require_once BPPIV_PATH . 'inc/metabox-options-free.php'; |
| 74 |
} |
| 75 |
} |
| 76 |
|