| Server IP : 69.72.244.102 / Your IP : 216.73.216.164 Web Server : LiteSpeed System : Linux s3434.fra1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : konzalta ( 1271) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/konzalta/public_html/wp-content/plugins/wappointment/app/System/ |
Upload File : |
<?php
namespace Wappointment\System;
use Wappointment\WP\Helpers as WPHelpers;
// @codingStandardsIgnoreFile
class InitPreinstall
{
private $plugin_file = '';
public function __construct()
{
$this->plugin_file = WAPPOINTMENT_SLUG . \DIRECTORY_SEPARATOR . 'index.php';
register_activation_hook($this->plugin_file, [$this, 'activated']);
add_action('admin_init', [$this, 'checkJustActivated']);
add_filter('plugin_row_meta', [$this, 'customPluginRowMeta'], 10, 2);
add_filter('plugin_action_links_' . plugin_basename(WAPPOINTMENT_FILE), [$this, 'customPluginLinks']);
new \Wappointment\Routes\Init();
}
public function activated()
{
add_option('wappo_plug_activated', 'wappointment');
}
public function checkJustActivated()
{
if (get_option('wappo_plug_activated') == 'wappointment') {
wp_enqueue_style(WAPPOINTMENT_SLUG . '-wap', plugins_url(WAPPOINTMENT_SLUG . '/dist/css/wappointment.css'));
add_action('wp_print_scripts', [$this, 'scrollDownToUs']);
delete_option('wappo_plug_activated');
}
}
public function scrollDownToUs()
{
$return = '<script type="text/javascript">' . "\n";
$return .= 'window.addEventListener("DOMContentLoaded", (event) => {
let row_wappo = document.querySelectorAll(\'[data-slug="wappointment"]\')[0]
row_wappo.classList.add("just-activated")
row_wappo.scrollIntoView({block: "center", behavior: "smooth"})
});';
$return .= '</script>' . "\n";
echo $return;
}
public function customPluginRowMeta($links, $file)
{
if (\strpos($file, $this->plugin_file) !== \false) {
$buttonInit = '<a href="' . WPHelpers::adminUrl('wappointment_calendar') . '" class="button button-primary button-large" >' . __('Setup', 'wappointment') . '</a>';
$htmlWrap = '<div class="notice inline notice-info">
<p>' . __('Thanks for activating me! Now set me up in only few seconds', 'wappointment') . ' ' . $buttonInit . '
</p></div>';
$links = ['initial_setup' => $htmlWrap];
}
return $links;
}
public function customPluginLinks($links)
{
$links[] = '<a href="' . esc_url(WPHelpers::adminUrl('wappointment_calendar')) . '" >' . __('Start Setup', 'wappointment') . '</a>';
return $links;
}
}