PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
vxcash
/
admin
<?php /** * The admin-specific functionality of the plugin. * * @link https://www.vxcash.net * @since 1.0.0 * * @package Vxcash * @subpackage Vxcash/admin */ /** * The admin-specific functionality of the plugin. * * Defines the plugin name, version, and two examples hooks for how to * enqueue the admin-specific stylesheet and JavaScript. * * @package Vxcash * @subpackage Vxcash/admin * @author Support <support@vxcash.net> */ class Vxcash_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * @var wpdb */ private $wpdb; /** * Initialize the class and set its properties. * * @since 1.0.0 * * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. * @param wpdb $wpdb */ public function __construct($plugin_name, $version, wpdb $wpdb) { $this->plugin_name = $plugin_name; $this->version = $version; $this->wpdb = $wpdb; } /** * Register the stylesheets for the admin area. * * @since 1.0.0 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Vxcash_Loader as all of the hooks are defined * in that particular class. * * The Vxcash_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/vxcash-admin.css', array(), $this->version, 'all'); } /** * Register the JavaScript for the admin area. * * @since 1.0.0 */ public function enqueue_scripts() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Vxcash_Loader as all of the hooks are defined * in that particular class. * * The Vxcash_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ wp_enqueue_script('vxcash-admin', plugin_dir_url(__FILE__) . 'js/vxcash-admin.js', array('jquery'), $this->version, false); } /** * Adds the plugin to the admin menu as a top point */ public function add_main_menu_entry() { add_menu_page('VX-CASH Admin', 'VX-CASH Admin', 'manage_options', $this->plugin_name, array($this, 'display_plugin_setup_page')); } /** * Adds the settings link to the plugin view * * @param $links * * @return array */ public function add_action_links($links) { $settings_link = array( '<a href="' . admin_url('admin.php?page=' . $this->plugin_name) . '">' . __('Settings', $this->plugin_name) . '</a>', ); return array_merge($settings_link, $links); } /** * Show the actual warning on the livecams edit page, if necessary */ public function showWarningForHost() { print '<div class="notice notice-warning is-dismissible"> <p><b>Bitte beachten:</b> Um die Aktualität des VISIT-X Darsteller Bestands zu garantieren prüft das VX-CASH Theme automatisch täglich den Datenbestand.<br>In diesem Zuge wurde dieses Profil auf "Entwurf" gestellt da diese(r) VISIT-X Darsteller(in) derzeit nicht mehr aktiv ist oder das Profil gelöscht wurde.<br><br>Dieses Profil bitte derzeit nicht verwenden - eine Aktivierung und Verwendung ist nicht gestattet!</p> </div>'; } public function showWarningForVideo() { print '<div class="notice notice-warning is-dismissible"> <p><b>Bitte beachten:</b> Um die Aktualität des VISIT-X Video Bestands zu garantieren prüft das VX-CASH Theme automatisch täglich den Datenbestand.<br>In diesem Zuge wurde dieses Video auf "Entwurf" gestellt da es derzeit nicht mehr verfügbar ist oder gelöscht wurde.<br><br>Dieses Video bitte derzeit nicht verwenden - eine Aktivierung und Verwendung ist nicht gestattet!</p> </div>'; } /** * @param $currentScreen */ public function showWarningForTurnedOfLivecams(WP_Screen $currentScreen) { if ($currentScreen->base === 'post' && $currentScreen->post_type === Vxcash_Posttypes_Enum::VX_HOSTS) { if (isset($_GET['post'])) { $postId = (int) $_GET['post']; } else if (isset($_POST['post'])) { $postId = (int) $_POST['post']; } else { return; } $tableName = $this->wpdb->prefix . Vxcash_Tablename_Enum::LIVECAMS; $num = $this->wpdb->get_var($this->wpdb->prepare("SELECT COUNT(*) FROM $tableName WHERE page = %d AND last_action = %d", $postId, Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_CRON)); if ($num > 0) { add_action( 'admin_notices', array($this, 'showWarningForHost') ); } } } public function showWarningForTurnedOffVideos(WP_Screen $currentScreen) { if ($currentScreen->base === 'post' && $currentScreen->post_type === Vxcash_Posttypes_Enum::VX_VIDEOS) { if (isset($_GET['post'])) { $postId = (int) $_GET['post']; } else if (isset($_POST['post'])) { $postId = (int) $_POST['post']; } else { return; } $tableName = $this->wpdb->prefix . Vxcash_Tablename_Enum::VX_VIDEOS; $num = $this->wpdb->get_var($this->wpdb->prepare("SELECT COUNT(*) FROM $tableName WHERE page = %d AND last_action = %d", $postId, Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_CRON)); if ($num > 0) { add_action( 'admin_notices', array($this, 'showWarningForVideo') ); } } } /** * Loads the partial for the main plugin page */ public function display_plugin_setup_page() { $changed = get_option('vxcash_livecams_state_changes', array()); $cronChanges = ''; if (count($changed) > 0) { $cronChanges = '<div style="border-left: 4px solid darkorange; background-color: white; padding: 10px; margin: 10px 0"> <p><b>Bitte beachten:</b> Um die Aktualität des VISIT-X Darsteller Bestands zu garantieren prüft das VX-CASH Theme automatisch täglich den Datenbestand.<br>In diesem Zuge wurden folgende Profile aktuell auf "Entwurf" gestellt da diese VISIT-X Darsteller derzeit nicht mehr aktiv sind oder ihr Profil gelöscht wurde.</p><p>Diese Profile bitte derzeit nicht verwenden - eine Aktiviereung und Verwendung ist nicht gestattet!</p> <ul style="clear: both;">'; $imploded = implode(',', $changed); $tableName = $this->wpdb->prefix . Vxcash_Tablename_Enum::LIVECAMS; /** @var array $turnedOffHosts */ $turnedOffHosts = $this->wpdb->get_results($this->wpdb->prepare("SELECT * FROM $tableName WHERE id IN ($imploded) AND last_action = %d", Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_CRON), ARRAY_A); foreach ($turnedOffHosts as $item) { $cronChanges .= sprintf('<li style="display: inline-block; width: 20%%;"><a href="%s" target="_blank">%s</a></li>', get_edit_post_link($item['page']), $item['name']); } $cronChanges .= '</ul></div>'; update_option('vxcash_livecams_state_changes', array(), false); } $changed2 = get_option('vxcash_vxvideos_state_changes', array()); if (count($changed2) > 0) { $cronChanges .= '<div style="border-left: 4px solid darkorange; background-color: white; padding: 10px; margin: 10px 0"> <p><b>Bitte beachten:</b> Um die Aktualität des VISIT-X Video Bestands zu garantieren prüft das VX-CASH Theme automatisch täglich den Datenbestand.<br>In diesem Zuge wurden folgende Videos aktuell auf "Entwurf" gestellt da diese derzeit nicht mehr verfügbar sind oder gelöscht wurden.</p><p>Diese Videos bitte derzeit nicht verwenden - eine Aktiviereung und Verwendung ist nicht gestattet!</p> <ul style="clear: both;">'; $imploded = implode(',', $changed2); $tableName = $this->wpdb->prefix . Vxcash_Tablename_Enum::VX_VIDEOS; /** @var array $turnedOffHosts */ $turnedOffHosts = $this->wpdb->get_results($this->wpdb->prepare("SELECT * FROM $tableName WHERE id IN ($imploded) AND last_action = %d", Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_CRON), ARRAY_A); foreach ($turnedOffHosts as $item) { $cronChanges .= sprintf('<li style="display: inline-block; width: 20%%;"><a href="%s" target="_blank">%s</a></li>', get_edit_post_link($item['page']), $item['name']); } $cronChanges .= '</ul></div>'; update_option('vxcash_vxvideos_state_changes', array(), false); } include_once __DIR__ . '/partials/vxcash-admin-display.php'; } /** * Register validation of options */ public function options_update() { register_setting($this->plugin_name, $this->plugin_name, array($this, 'validate')); } /** * Validate input * * @param array $input * * @return array */ public function validate($input) { $result = array(); $result['wmid'] = isset($input['wmid']) ? (int) $input['wmid'] : ''; $result['campaignId'] = isset($input['campaignId']) ? $input['campaignId'] : ''; $result['vxCampaignId'] = isset($input['vxCampaignId']) ? $input['vxCampaignId'] : ''; $result['vxDirectLink'] = isset($input['vxDirectLink']) ? $input['vxDirectLink'] : ''; $result['pmCampaignId'] = ''; $result['pmDomain'] = isset($input['pmDomain']) ? $input['pmDomain'] : 'www.pornme.de'; $result['basCampaignId'] = isset($input['basCampaignId']) ? $input['basCampaignId'] : ''; $result['resellerCampaignId'] = isset($input['resellerCampaignId']) ? $input['resellerCampaignId'] : ''; $result['vxApiKey'] = isset($input['vxApiKey']) ? $input['vxApiKey'] : ''; $result['pornmeApiKey'] = ''; $result['basApiKey'] = isset($input['basApiKey']) ? $input['basApiKey'] : ''; $result['pornmeMaxNum'] = 0; $result['vxMaxNum'] = isset($input['vxMaxNum']) ? (int) $input['vxMaxNum'] : 0; $result['vxVideoMaxNum'] = isset($input['vxVideoMaxNum']) ? (int) $input['vxVideoMaxNum'] : 0; $result['vxLinking'] = isset($input['vxLinking']) ? $input['vxLinking'] : 'direkt'; $result['dePhone'] = isset($input['dePhone']) ? $input['dePhone'] : 0; $result['auPhone'] = isset($input['auPhone']) ? $input['auPhone'] : 0; $result['chPhone'] = isset($input['chPhone']) ? $input['chPhone'] : 0; $result['deMobile'] = isset($input['deMobile']) ? $input['deMobile'] : 0; $result['smartlink'] = isset($input['smartlink']) ? $input['smartlink'] : 'soft'; $result['popunder'] = isset($input['popunder']) ? $input['popunder'] : '0'; $result['exitintent'] = isset($input['exitintent']) ? $input['exitintent'] : '0'; $result['webpush'] = isset($input['webpush']) ? $input['webpush'] : '0'; $result['closebutton'] = isset($input['closebutton']) ? $input['closebutton'] : '0'; $result['exitintenttitle'] = isset($input['exitintenttitle']) ? $input['exitintenttitle'] : 'STOP!'; $result['exitintenttext'] = isset($input['exitintenttext']) ? $input['exitintenttext'] : 'Wir haben noch andere interessante Seiten für dich!'; $result['exitintentlinktext'] = isset($input['exitintentlinktext']) ? $input['exitintentlinktext'] : 'Jetzt ansehen!'; return $result; } /** * @param int $ID */ public function on_livecam_publishing($ID) { $tableName = $this->wpdb->get_blog_prefix() . Vxcash_Tablename_Enum::LIVECAMS; $numRows = $this->wpdb->query($this->wpdb->prepare("UPDATE $tableName SET last_action = %d WHERE page = %d and last_action != %d AND last_action != %d", Vxcash_Vxhost_State_Enum::SET_TO_PUBLISHED_BY_OWNER, $ID, Vxcash_Vxhost_State_Enum::SET_TO_PUBLISHED_BY_CRON, Vxcash_Vxhost_State_Enum::IMPORTED_AND_PUBLISHED)); if ($numRows > 0) { $hostId = get_post_meta($ID, 'hostId', true); $config = Vxcash_Config::getInstance(); $url = sprintf(Vxcash_Vx_Dataprovider::URL_CALLBACK, $hostId, $config->getWmid(), $config->getVisitxApiKey(), 'publish', 'admin', get_site_url(), $this->version); wp_remote_get($url); } } /** * @param int $ID * @param WP_Post $post */ public function on_livecam_drafting($ID, $post) { $tableName = $this->wpdb->get_blog_prefix() . Vxcash_Tablename_Enum::LIVECAMS; if ($post->post_status === 'draft') { $this->wpdb->query($this->wpdb->prepare("UPDATE $tableName SET last_action = %d WHERE page = %d and last_action != %d AND last_action != %d", Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_OWNER, $ID, Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_CRON, Vxcash_Vxhost_State_Enum::IMPORTED_AND_DRAFT)); } else { $this->wpdb->query($this->wpdb->prepare("UPDATE $tableName SET last_action = %d WHERE page = %d", Vxcash_Vxhost_State_Enum::SET_TO_DRAFT_BY_OWNER, $ID)); } } private function url_is_image($url) { if (!filter_var($url, FILTER_VALIDATE_URL)) { return false; } $ext = ['jpeg', 'jpg', 'gif', 'png']; $info = (array) pathinfo(parse_url($url, PHP_URL_PATH)); return isset($info['extension']) && in_array(strtolower($info['extension']), $ext, true); } public function add_thumbnail_url_field($html) { global $post; $value = get_post_meta($post->ID, 'vxcash_preview_image', true) ?: ''; $nonce = wp_create_nonce('thumbnail_ext_url_' . $post->ID . get_current_blog_id()); $html .= '<input type="hidden" name="thumbnail_ext_url_nonce" value="' . esc_attr($nonce) . '">'; $html .= '<div><p>' . __('oder', 'vxcash') . '</p>'; $html .= '<p>' . __('Gib die URL eines externen Bildes ein', 'vxcash') . '</p>'; $html .= '<p><input type="url" name="vxcash_preview_image" value="' . $value . '"></p>'; if (!empty($value) && $this->url_is_image($value)) { $html .= '<p><img style="max-width:150px;height:auto;" src="' . esc_url($value) . '" alt=""></p>'; $html .= '<p>' . __('Feld leer lassen um das Bild zu entfernen.', 'vxcash') . '</p>'; } $html .= '</div>'; return $html; } public function thumbnail_url_field_save($pid, $post) { $cap = $post->post_type === 'page' ? 'edit_page' : 'edit_post'; if (!current_user_can($cap, $pid) || !post_type_supports($post->post_type, 'thumbnail') || defined('DOING_AUTOSAVE')) { return; } $action = 'thumbnail_ext_url_' . $pid . get_current_blog_id(); $nonce = filter_input(INPUT_POST, 'thumbnail_ext_url_nonce', FILTER_SANITIZE_STRING); $url = filter_input(INPUT_POST, 'vxcash_preview_image', FILTER_VALIDATE_URL); if (empty($nonce) || !wp_verify_nonce($nonce, $action) || (!empty($url) && !$this->url_is_image($url))) { return; } if (!empty($url)) { update_post_meta($pid, 'vxcash_preview_image', esc_url($url)); if (!get_post_meta($pid, '_thumbnail_id', true)) { update_post_meta($pid, '_thumbnail_id', 'by_url'); } } elseif (get_post_meta($pid, 'vxcash_preview_image', true)) { delete_post_meta($pid, 'vxcash_preview_image'); if (get_post_meta($pid, '_thumbnail_id', true) === 'by_url') { delete_post_meta($pid, '_thumbnail_id'); } } } }
[-] index.php
[edit]
[+]
js
[-] class-vxcash-debug-admin.php
[edit]
[-] class-vxcash-visitx-video-admin.php
[edit]
[-] class-vxcash-auto-import-dataprovider.php
[edit]
[-] class-vxcash-config.php
[edit]
[+]
partials
[-] class-vxcash-admin.php
[edit]
[-] class-vxcash-host-category-handler.php
[edit]
[-] class-vxcash-notifier.php
[edit]
[+]
..
[+]
css
[-] class-vxcash-visitx-host-admin.php
[edit]
[-] class-vxcash-visitx-graphql-client.php
[edit]
[-] class-vxcash-pornme-video-admin.php
[edit]
[-] class-vxcash-vx-dataprovider.php
[edit]