Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
transistorization
/
19052025___siteeee
/
wp-content
/
themes
/
anka
/
lib
/
functions
:
ajax.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if(!defined('ABSPATH')) exit; ?> <?php // Clock add_action("wp_ajax_safirClock", "safirClock"); add_action("wp_ajax_nopriv_safirClock", "safirClock"); function safirClock() { if ( !wp_verify_nonce( $_REQUEST['nonce'], "safir_ajax_nonce")) { exit("HATA."); } $result = array(); $result['time'] = time() * 1000; if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $result = json_encode($result); echo $result; } else { header("Location: ".$_SERVER["HTTP_REFERER"]); } die(); } // Hits add_action("wp_ajax_safirHits", "safirHits"); add_action("wp_ajax_nopriv_safirHits", "safirHits"); function safirHits() { if ( !wp_verify_nonce( $_REQUEST['nonce'], "safir_ajax_nonce")) { exit("HATA."); } $id = $_POST['id']; $postHit = get_post_meta($id, 'hit', true); if ($postHit == NULL) { $postHit = 0; } $postHit++; update_post_meta($id, 'hit', $postHit); $result = array(); $result['data'] = $postHit; if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $result = json_encode($result); echo $result; } else { header("Location: ".$_SERVER["HTTP_REFERER"]); } die(); } add_action("wp_ajax_safirGetHits", "safirGetHits"); add_action("wp_ajax_nopriv_safirGetHits", "safirGetHits"); function safirGetHits() { if ( !wp_verify_nonce( $_REQUEST['nonce'], "safir_ajax_nonce")) { exit("HATA."); } $ids = $_POST['ids']; $hits = []; foreach($ids as $id) { if(is_numeric($id)) { $hit = get_post_meta($id, "hit", true); if ($hit == NULL) { $hit = 0; } $hits[$id] = $hit; } } $result = array(); $result['data'] = $hits; if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $result = json_encode($result); echo $result; } else { header("Location: ".$_SERVER["HTTP_REFERER"]); } die(); }