PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
vxcash
/
public
<?php /** * The public-facing functionality of the plugin. * * @link https://www.vxcash.net * @since 1.0.0 * * @package Vxcash * @subpackage Vxcash/public */ /** * The public-facing 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/public * @author Support <support@vxcash.net> */ class Vxcash_Public { /** * 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 Vxcash_Vx_Dataprovider */ private $dataprovider; /** * @var Vxcash_Bas_Dataprovider */ private $basDataprovider; /** * Initialize the class and set its properties. * * @param string $plugin_name The name of the plugin. * @param string $version The version of this plugin. * @param Vxcash_Vx_Dataprovider $dataprovider * * @since 1.0.0 */ public function __construct($plugin_name, $version, Vxcash_Vx_Dataprovider $dataprovider, Vxcash_Bas_Dataprovider $basDataprovider) { $this->plugin_name = $plugin_name; $this->version = $version; $this->dataprovider = $dataprovider; $this->basDataprovider = $basDataprovider; } /** * Register the stylesheets for the public-facing side of the site. * * @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-public.css', array(), $this->version); } /** * Register the JavaScript for the public-facing side of the site. * * @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($this->plugin_name, plugin_dir_url(__FILE__) . 'js/vxcash-public.js', array('jquery'), $this->version, false); wp_enqueue_script($this->plugin_name . 'bas_app', plugin_dir_url(__FILE__) . '../dist/app.js', array(), $this->version); /** @var Vxcash_Config $config */ $config = Vxcash_Config::getInstance(); $nonce = wp_create_nonce('ajax_nonce'); $basNumbers = $this->basDataprovider->getNumbers(); $basNumberArray = array(); foreach ($basNumbers as $numberInfo) { $basNumberArray[$numberInfo['lang']] = json_decode($numberInfo['content'], true); } wp_localize_script($this->plugin_name, 'vxcash_obj', array( 'ajax_url' => admin_url('admin-ajax.php'), 'wmid' => $config->getWmid(), 'campaignid' => $config->getCampaignId() . '.wp', 'vxCampaignid' => $config->getVxCampaignId() . '.wp', 'vxDirectLink' => $config->getVxDirectLink(), 'pmCampaignid' => $config->getPmCampaignId() . '.wp', 'pmDomain' => $config->getPornmeDomain(), 'basCampaignid' => $config->getBasCampaignId() . '.wp', 'linking' => $config->getLinkType(), 'key' => $config->getVisitxApiKey(), 'nonce' => $nonce, 'numbers' => $basNumberArray, 'countrySelection' => array( 'dePhone' => $config->getDePhone(), 'deMobile' => $config->getDeMobile(), 'auPhone' => $config->getAuPhone(), 'chPhone' => $config->getChPhone() ) )); } /** * Action to link a hostname to a profile page, if it exists * * @param $hostName * * @return string */ public function linkHostName($hostName) { global $wpdb; $tableName = $wpdb->prefix . Vxcash_Tablename_Enum::LIVECAMS; $result = $wpdb->get_var($wpdb->prepare("SELECT page FROM $tableName WHERE name = %s", $hostName)); if ($result === null) { return $hostName; } $status = get_post_status($result); if ($status !== 'publish') { return $hostName; } $permalink = get_permalink($result); return '<a href="' . $permalink . '">' . $hostName . '</a>'; } /** * Create a monthly schedule since wordpress only know hourly, daily and twicedaily by default * * @param $schedules * * @return mixed */ public function check_livecams_monthly_recurrence( $schedules ) { $schedules['monthly'] = array( 'display' => __( 'monthly', 'textdomain' ), 'interval' => 2592000, ); return $schedules; } /** * Schedule the check livecams event */ public function check_livecams_monthly_hook_setup() { $nextScheduled = wp_next_scheduled('check_livecams_availability'); if ($nextScheduled !== false) { $diff = $nextScheduled - time(); // We move from monthly to daily as requested by MK if ($diff > (60 * 60 * 24)) { wp_unschedule_event($nextScheduled, 'check_livecams_availability'); $nextScheduled = false; } } if ( !$nextScheduled) { wp_schedule_event(time() + mt_rand(1,60*60), 'daily', 'check_livecams_availability'); } } /** * Checks and update livecams, gives warning for webmaster */ public function check_livecams() { $deleted = $this->dataprovider->getDeletedHostAndAlbumIds(); $this->dataprovider->unpublishRemovedHosts($deleted['hostIds']); $this->dataprovider->unpublishRemovedAlbums($deleted['albumIds']); $draftedHostIds = $this->dataprovider->getAutoDraftedHostIds(); $reinstated = $this->dataprovider->checkForReinstatedHosts($draftedHostIds); $this->dataprovider->reinstateActiveHosts($reinstated); $draftedVideoIds = $this->dataprovider->getAutoDraftedVideoIds(); $reinstated2 = $this->dataprovider->checkForReinstatedVideos($draftedVideoIds); $this->dataprovider->reinstateActiveVideos($reinstated2); } public function show_external_thumbnail($html) { $url = get_post_meta(get_the_ID(), 'vxcash_preview_image', true); if (empty($url)) { return $html; } $alt = get_post_field( 'post_title', get_the_ID()) . ' thumbnail' ; $attr = array( 'alt' => $alt ); $attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, NULL ); $attr = array_map( 'esc_attr', $attr ); $html = sprintf( '<img src="%s"', esc_url($url) ); foreach ( $attr as $name => $value ) { $html .= " $name=" . '"' . $value . '"'; } $html .= ' />'; return $html; } public function ajaxTurnOffHost() { $slug = $_REQUEST['livecamslug']; $token = $_REQUEST['token']; // Check back with VXCash if token is valid $response = wp_remote_get('http://www.vxcash.net/VXCASHREST/v1/wp/token/' . $token); if ($response instanceof WP_Error) { echo 'Did not validate token'; exit; } if (trim($response['body']) !== '"ok"') { echo 'Did not validate token. Reply was ' . $response['body']; exit; } $page = get_page_by_path($slug, OBJECT, 'livecams'); if ($page === null) { echo 'Did not find page'; exit; } $hostId = get_post_meta($page->ID, 'hostId', true); $changedVideos = 0; // Turn off videos if ($hostId !== null) { global $post; $args = array( 'post_type' => 'pornos', 'posts_per_page' => -1, 'meta_key' => 'model_id', 'meta_value' => $hostId ); $queryCams = new WP_Query($args); while ($queryCams->have_posts()) { $queryCams->the_post(); wp_update_post(array('ID' => $post->ID, 'post_status' => 'draft')); $changedVideos++; } $args = array( 'post_type' => 'videos', 'posts_per_page' => -1, 'meta_key' => 'hostId', 'meta_value' => $hostId ); $queryCams = new WP_Query($args); while ($queryCams->have_posts()) { $queryCams->the_post(); wp_update_post(array('ID' => $post->ID, 'post_status' => 'draft')); $changedVideos++; } } wp_update_post(array('ID' => $page->ID, 'post_status' => 'draft')); echo "Set page to draft, also $changedVideos videos!"; $this->dataprovider->sendCallbackToVXCash([$hostId], 'draft', 'external'); exit; } }
[+]
img
[-] class-vxcash-bas-dataprovider.php
[edit]
[-] class-vxcash-bas-country.php
[edit]
[-] class-vxcash-public.php
[edit]
[-] index.php
[edit]
[+]
js
[+]
partials
[-] class-vxcash-bas-host.php
[edit]
[-] class-vxcash-bas.php
[edit]
[+]
..
[+]
css
[-] class-vxcash-crosselling.php
[edit]