Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php //error_reporting( E_ALL ); /* Plugin Name: monoservier Importer Plugin URI: h..
Decoded Output download
<?php
//error_reporting( E_ALL );
/*
Plugin Name: monoservier Importer
Plugin URI: http://monoservice.con
Description: [TH/EN]
Author: monoservice.con
Version: 1.2 bulid 3
Author URI: http://monoservice.con
*/
define('__PATH',realpath(dirname(__FILE__)));//
Class curl{
Private $curlResult;
Private $curlObj;
Public function __construct(){
$this->curlObj = curl_init();
//curl_setopt($this->curlObj,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curlObj, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($this->curlObj, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($this->curlObj, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYHOST, false );
}
Public Function URL($urls){
curl_setopt($this->curlObj, CURLOPT_URL, $urls);
return $this;
}
Public function info(){
return curl_getinfo($this->curlObj);
}
Public Function SetCookie($value){
curl_setopt($this->curlObj, CURLOPT_COOKIE,$value);
return $this;
}
Public Function SetRefer($value){
curl_setopt($this->curlObj, CURLOPT_REFERER, $value);
return $this;
}
Public function SSL(){
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYPEER, False);
return $this;
}
Public function POST($data){
curl_setopt($this->curlObj, CURLOPT_POST, 1 );
curl_setopt($this->curlObj, CURLOPT_POSTFIELDS,$data);
return $this;
}
Public function Header(){
curl_setopt($this->curlObj, CURLOPT_HEADER, 1);
return $this;
}
Public function exec(){
$this->curlResult = curl_exec($this->curlObj);
return $this;
}
Public function result(){
return $this->curlResult;
}
Public function connect(){
curl_setopt($this->curlObj, CURLOPT_NOBODY, true);
return $this;
}
Public function status(){
return curl_getinfo($this->curlObj, CURLINFO_HTTP_CODE);
}
Public function __destruct(){
curl_close($this->curlObj);
}
}
Class monoservice{
Private $option_default = array(
'mediazone_title_template' => '{title}',
//'mediazone_content_template' => '{image}<br>{aticle}<br>{iframe}',
'mediazone_content_template' => '{aticle}',
);
Private $option;
Public function init(){
add_action('admin_menu',array( $this, 'menu'));
}
Public function menu(){
add_menu_page('monoservice Importer', 'monoservice', 'manage_options', 'setting', null, null , 100 );
add_submenu_page( 'setting', 'Mediazone Settings Page', 'Settings', 'manage_options', 'setting', array( $this,'setting') );
add_submenu_page( 'setting', 'Mediazone Import', ' Import', 'manage_options', 'all-import', array( $this,'import'));
}
Public function update(){
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
if(!isset($_GET['update'])) return true;
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('http://localhost:8888/getv1.php')->exec()->result())),TRUE);
$this->post();
}
Public function update2(){
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
if(!isset($_GET['update'])) return true;
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.talknews.today/getv1.php')->exec()->result())),TRUE);
$this->post();
}
Public function import(){
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.krupatom.com/getv3.php')->exec()->result())),TRUE);
//$shows = $curl->URL('https://www.talknews.today/getv1.php');
$shows = $this->item;
//echo '<br><br><br>tee<br><br>';
//print_r($shows);
//echo $shows['item'][0]['title'];
//echo '<br><br><br>tee<br><br>';
//exit ("Error !");
//$this->post();
$this->post();
}
//create your function, that runs on cron
Public function myprefix_cron_function() {
//your function...
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.talknews.today/getv1.php')->exec()->result())),TRUE);
$shows = $this->item;
//echo '<br><br><br><br><br>';
//print_r($shows);
//echo $shows['item'][0]['title'];
$this->post();
}
// ///
Public function setting(){
$this->get_option();
if(isset($_POST)){
foreach($_POST as $key=>$val){
update_option($key, $val);
}
}
$this->get_option();
//$post_info = get_page_by_title('[BIST-004] Bi STYLE beauty Big Yoshishirahada peerless ultimate BODY Ayumi Mao',ARRAY_N, 'post');
//var_dump(count($post_info));
//echo 'd';
include __PATH.'/template/setting.html';
}
Public function setup(){
foreach ( $this->option_default as $k => $v ){
update_option($k, $v);
}
//Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'isa_add_every_three_minutes' ) ) {
wp_schedule_event( time(), 'every_1/2_hours', 'isa_add_every_three_minutes' );
}
// ///
}
Public function remove(){
foreach ( $this->option_default as $k => $v ){
update_option($k, $v);
}
if( wp_next_scheduled( 'isa_add_every_three_minutes' ) ){
wp_clear_scheduled_hook( 'isa_add_every_three_minutes' );
}
}
Private function get_option(){
foreach ( $this->option_default as $k => $v ){
$k = str_replace('mediazone_','',$k);
$this->$k=get_option('mediazone_'.$k);
}
}
Private function post(){
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(3600);
session_write_close();
$this->get_option();
$item=$this->item['item'];
foreach ($item as $val){
require_once(ABSPATH . 'wp-config.php');
require_once(ABSPATH . 'wp-includes/wp-db.php');
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
require_once( ABSPATH . 'wp-admin/includes/post.php' );
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
//$iframe='<iframe src="'.$val['link'].'" width="95%" height="480" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>';
//if(empty($val['link'])){$val['link'] = "#";};
//$iframe='<a href="'.$val['link'].'" target="_blank" title=""></a>';
//regen
echo "link:<br>";
//var_dump($val['link']);
echo "<br>";
$re_aticle=htmlspecialchars_decode($val['aticle']);
$post_title = str_replace("{title}", rtrim(ltrim($val['title'])), $this->title_template);
$post_content = str_replace("{title}", rtrim(ltrim($val['title'])), $this->content_template);
$post_content = str_replace("{aticle}", $re_aticle, $post_content);
//$post_content = str_replace("{iframe}", $iframe, $post_content);
//$post_content = str_replace("{image}", '<img src="'.$val['image'].'" width="95%" height="480" >', $post_content);
$my_post = array(
'post_title' => $post_title,
'post_content' => $post_content,
'post_status' => 'draft',
//'post_status' => 'publish',
'post_author' => 1,
'post_category' => array('category' => wp_create_category($val['category'])),
'tags_input' => array($val['title'],$val['tag'])
);
//
$post_info = get_page_by_title(rtrim(ltrim($post_title)),ARRAY_N, 'post');
if(post_exists(rtrim(ltrim($post_title)))==0){
$post_id = wp_insert_post( $my_post );
echo 'insert =>'.$val['title'].'<br>';
}else{
continue;
}
//
/*$thumb_url = $val['image'];
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
$curl = new curl();
$exists = $curl->URL($thumb_url)->connect()->exec()->status();
//check
// echo 'tee '.$thumb_url.'<br>';
// echo 'yim '.$exists.'<br>';
// echo 'teerapat '.count($post_info).'<br>';
//if (( ! empty($thumb_url) )and($exists=== 200)and(count($post_info)===0)){
if (( ! empty($thumb_url) )and($exists== 200)and(count($post_info)==0)){
// Download file to temp location
$tmp = download_url( $thumb_url ,120);
// Set variables for storage
// fix file filename for query strings
preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $thumb_url, $matches);
$file_array['name'] = basename($matches[0]);
$file_array['tmp_name'] = $tmp;
// If error storing temporarily, unlink
if ( is_wp_error( $tmp ) ) {
//@unlink($file_array['tmp_name']);
$file_array['tmp_name'] = '';
var_dump($tmp);
}
// do the validation and storage stuff
$thumbid = media_handle_sideload( $file_array, $post_id, 1 );
// If error storing permanently, unlink
if ( is_wp_error($thumbid) ) {
//@unlink($file_array['tmp_name']);
var_dump($tmp);
return $thumbid;
}
echo 'download =>'.$thumb_url.'<br>';
}
set_post_thumbnail( $post_id, $thumbid );*/
echo '==============================================><br>';
flush();
ob_flush();
sleep(1);
}
}
}
$init=new monoservice();
register_activation_hook(__FILE__,array($init,'setup'));
register_deactivation_hook( __FILE__,array($init,'remove'));
add_action('wp_loaded',array($init, 'init'));
add_action('init',array($init, 'update'));
// ///
///Hook into that action that'll fire every six hours
//add_action( 'myprefix_cron_hook', 'myprefix_cron_function' );
//add_action( 'myprefix_cron_hook',array($init,'import') );
////////////////////////
add_filter( 'cron_schedules', 'isa_add_every_three_minutes' );
function isa_add_every_three_minutes( $schedules ) {
$schedules['every_three_minutes'] = array(
'interval' => 60,
'display' => __( 'teeEvery 60 Minutes', 'textdomain' )
);
return $schedules;
}
// Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'isa_add_every_three_minutes' ) ) {
wp_schedule_event( time(), 'every_three_minutes', 'isa_add_every_three_minutes' );
}
// Hook into that action that'll fire every three minutes
//add_action( 'isa_add_every_three_minutes', 'every_three_minutes_event_func' );
add_action( 'isa_add_every_three_minutes', 'every_three_minutes_event_func');
function every_three_minutes_event_func() {
// set_time_limit(3600);
// require_once(ABSPATH . 'wp-config.php');
// require_once(ABSPATH . 'wp-includes/wp-db.php');
// require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
// require_once(ABSPATH . 'wp-admin/includes/file.php');
// require_once(ABSPATH . 'wp-admin/includes/media.php');
// $inits=new monoservice();
// $inits->import();
// do something
//add_action('init',array($init, 'import'));
// $ch = curl_init($url);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// curl_setopt($ch, CURLOPT_HEADER, false);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER,array("DATA SYNC"));
// $result = curl_exec($ch);
// curl_close($ch);
// $response = json_decode($result, true);
// mail("[email protected]", "wp Cron test", $response);
}
?>
Did this file decode correctly?
Original Code
<?php
//error_reporting( E_ALL );
/*
Plugin Name: monoservier Importer
Plugin URI: http://monoservice.con
Description: [TH/EN]
Author: monoservice.con
Version: 1.2 bulid 3
Author URI: http://monoservice.con
*/
define('__PATH',realpath(dirname(__FILE__)));//
Class curl{
Private $curlResult;
Private $curlObj;
Public function __construct(){
$this->curlObj = curl_init();
//curl_setopt($this->curlObj,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->curlObj, CURLOPT_RETURNTRANSFER, 1);
@curl_setopt($this->curlObj, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($this->curlObj, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYHOST, false );
}
Public Function URL($urls){
curl_setopt($this->curlObj, CURLOPT_URL, $urls);
return $this;
}
Public function info(){
return curl_getinfo($this->curlObj);
}
Public Function SetCookie($value){
curl_setopt($this->curlObj, CURLOPT_COOKIE,$value);
return $this;
}
Public Function SetRefer($value){
curl_setopt($this->curlObj, CURLOPT_REFERER, $value);
return $this;
}
Public function SSL(){
curl_setopt($this->curlObj, CURLOPT_SSL_VERIFYPEER, False);
return $this;
}
Public function POST($data){
curl_setopt($this->curlObj, CURLOPT_POST, 1 );
curl_setopt($this->curlObj, CURLOPT_POSTFIELDS,$data);
return $this;
}
Public function Header(){
curl_setopt($this->curlObj, CURLOPT_HEADER, 1);
return $this;
}
Public function exec(){
$this->curlResult = curl_exec($this->curlObj);
return $this;
}
Public function result(){
return $this->curlResult;
}
Public function connect(){
curl_setopt($this->curlObj, CURLOPT_NOBODY, true);
return $this;
}
Public function status(){
return curl_getinfo($this->curlObj, CURLINFO_HTTP_CODE);
}
Public function __destruct(){
curl_close($this->curlObj);
}
}
Class monoservice{
Private $option_default = array(
'mediazone_title_template' => '{title}',
//'mediazone_content_template' => '{image}<br>{aticle}<br>{iframe}',
'mediazone_content_template' => '{aticle}',
);
Private $option;
Public function init(){
add_action('admin_menu',array( $this, 'menu'));
}
Public function menu(){
add_menu_page('monoservice Importer', 'monoservice', 'manage_options', 'setting', null, null , 100 );
add_submenu_page( 'setting', 'Mediazone Settings Page', 'Settings', 'manage_options', 'setting', array( $this,'setting') );
add_submenu_page( 'setting', 'Mediazone Import', ' Import', 'manage_options', 'all-import', array( $this,'import'));
}
Public function update(){
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
if(!isset($_GET['update'])) return true;
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('http://localhost:8888/getv1.php')->exec()->result())),TRUE);
$this->post();
}
Public function update2(){
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
if(!isset($_GET['update'])) return true;
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.talknews.today/getv1.php')->exec()->result())),TRUE);
$this->post();
}
Public function import(){
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.krupatom.com/getv3.php')->exec()->result())),TRUE);
//$shows = $curl->URL('https://www.talknews.today/getv1.php');
$shows = $this->item;
//echo '<br><br><br>tee<br><br>';
//print_r($shows);
//echo $shows['item'][0]['title'];
//echo '<br><br><br>tee<br><br>';
//exit ("Error !");
//$this->post();
$this->post();
}
//create your function, that runs on cron
Public function myprefix_cron_function() {
//your function...
$curl = new curl();
$this->item=json_decode(json_encode(simplexml_load_string($curl->URL('https://www.talknews.today/getv1.php')->exec()->result())),TRUE);
$shows = $this->item;
//echo '<br><br><br><br><br>';
//print_r($shows);
//echo $shows['item'][0]['title'];
$this->post();
}
// ///
Public function setting(){
$this->get_option();
if(isset($_POST)){
foreach($_POST as $key=>$val){
update_option($key, $val);
}
}
$this->get_option();
//$post_info = get_page_by_title('[BIST-004] Bi STYLE beauty Big Yoshishirahada peerless ultimate BODY Ayumi Mao',ARRAY_N, 'post');
//var_dump(count($post_info));
//echo 'd';
include __PATH.'/template/setting.html';
}
Public function setup(){
foreach ( $this->option_default as $k => $v ){
update_option($k, $v);
}
//Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'isa_add_every_three_minutes' ) ) {
wp_schedule_event( time(), 'every_1/2_hours', 'isa_add_every_three_minutes' );
}
// ///
}
Public function remove(){
foreach ( $this->option_default as $k => $v ){
update_option($k, $v);
}
if( wp_next_scheduled( 'isa_add_every_three_minutes' ) ){
wp_clear_scheduled_hook( 'isa_add_every_three_minutes' );
}
}
Private function get_option(){
foreach ( $this->option_default as $k => $v ){
$k = str_replace('mediazone_','',$k);
$this->$k=get_option('mediazone_'.$k);
}
}
Private function post(){
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(3600);
session_write_close();
$this->get_option();
$item=$this->item['item'];
foreach ($item as $val){
require_once(ABSPATH . 'wp-config.php');
require_once(ABSPATH . 'wp-includes/wp-db.php');
require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
require_once( ABSPATH . 'wp-admin/includes/post.php' );
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
//$iframe='<iframe src="'.$val['link'].'" width="95%" height="480" frameborder="0" scrolling="no" allowfullscreen="true"></iframe>';
//if(empty($val['link'])){$val['link'] = "#";};
//$iframe='<a href="'.$val['link'].'" target="_blank" title=""></a>';
//regen
echo "link:<br>";
//var_dump($val['link']);
echo "<br>";
$re_aticle=htmlspecialchars_decode($val['aticle']);
$post_title = str_replace("{title}", rtrim(ltrim($val['title'])), $this->title_template);
$post_content = str_replace("{title}", rtrim(ltrim($val['title'])), $this->content_template);
$post_content = str_replace("{aticle}", $re_aticle, $post_content);
//$post_content = str_replace("{iframe}", $iframe, $post_content);
//$post_content = str_replace("{image}", '<img src="'.$val['image'].'" width="95%" height="480" >', $post_content);
$my_post = array(
'post_title' => $post_title,
'post_content' => $post_content,
'post_status' => 'draft',
//'post_status' => 'publish',
'post_author' => 1,
'post_category' => array('category' => wp_create_category($val['category'])),
'tags_input' => array($val['title'],$val['tag'])
);
//
$post_info = get_page_by_title(rtrim(ltrim($post_title)),ARRAY_N, 'post');
if(post_exists(rtrim(ltrim($post_title)))==0){
$post_id = wp_insert_post( $my_post );
echo 'insert =>'.$val['title'].'<br>';
}else{
continue;
}
//
/*$thumb_url = $val['image'];
require_once(ABSPATH . 'wp-admin/includes/file.php');
require_once(ABSPATH . 'wp-admin/includes/media.php');
$curl = new curl();
$exists = $curl->URL($thumb_url)->connect()->exec()->status();
//check
// echo 'tee '.$thumb_url.'<br>';
// echo 'yim '.$exists.'<br>';
// echo 'teerapat '.count($post_info).'<br>';
//if (( ! empty($thumb_url) )and($exists=== 200)and(count($post_info)===0)){
if (( ! empty($thumb_url) )and($exists== 200)and(count($post_info)==0)){
// Download file to temp location
$tmp = download_url( $thumb_url ,120);
// Set variables for storage
// fix file filename for query strings
preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $thumb_url, $matches);
$file_array['name'] = basename($matches[0]);
$file_array['tmp_name'] = $tmp;
// If error storing temporarily, unlink
if ( is_wp_error( $tmp ) ) {
//@unlink($file_array['tmp_name']);
$file_array['tmp_name'] = '';
var_dump($tmp);
}
// do the validation and storage stuff
$thumbid = media_handle_sideload( $file_array, $post_id, 1 );
// If error storing permanently, unlink
if ( is_wp_error($thumbid) ) {
//@unlink($file_array['tmp_name']);
var_dump($tmp);
return $thumbid;
}
echo 'download =>'.$thumb_url.'<br>';
}
set_post_thumbnail( $post_id, $thumbid );*/
echo '==============================================><br>';
flush();
ob_flush();
sleep(1);
}
}
}
$init=new monoservice();
register_activation_hook(__FILE__,array($init,'setup'));
register_deactivation_hook( __FILE__,array($init,'remove'));
add_action('wp_loaded',array($init, 'init'));
add_action('init',array($init, 'update'));
// ///
///Hook into that action that'll fire every six hours
//add_action( 'myprefix_cron_hook', 'myprefix_cron_function' );
//add_action( 'myprefix_cron_hook',array($init,'import') );
////////////////////////
add_filter( 'cron_schedules', 'isa_add_every_three_minutes' );
function isa_add_every_three_minutes( $schedules ) {
$schedules['every_three_minutes'] = array(
'interval' => 60,
'display' => __( 'teeEvery 60 Minutes', 'textdomain' )
);
return $schedules;
}
// Schedule an action if it's not already scheduled
if ( ! wp_next_scheduled( 'isa_add_every_three_minutes' ) ) {
wp_schedule_event( time(), 'every_three_minutes', 'isa_add_every_three_minutes' );
}
// Hook into that action that'll fire every three minutes
//add_action( 'isa_add_every_three_minutes', 'every_three_minutes_event_func' );
add_action( 'isa_add_every_three_minutes', 'every_three_minutes_event_func');
function every_three_minutes_event_func() {
// set_time_limit(3600);
// require_once(ABSPATH . 'wp-config.php');
// require_once(ABSPATH . 'wp-includes/wp-db.php');
// require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
// require_once(ABSPATH . 'wp-admin/includes/file.php');
// require_once(ABSPATH . 'wp-admin/includes/media.php');
// $inits=new monoservice();
// $inits->import();
// do something
//add_action('init',array($init, 'import'));
// $ch = curl_init($url);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// curl_setopt($ch, CURLOPT_HEADER, false);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HTTPHEADER,array("DATA SYNC"));
// $result = curl_exec($ch);
// curl_close($ch);
// $response = json_decode($result, true);
// mail("[email protected]", "wp Cron test", $response);
}
?>
Function Calls
dirname | 1 |
realpath | 1 |
Stats
MD5 | cdcc0d3cfd308be4d853e4cfe8494d21 |
Eval Count | 0 |
Decode Time | 141 ms |