Online PHP and Javascript Decoder decode hidden script to uncover its real functionality


Show other level

	${
	"GLOBALS"
}
["vhoxozot"]="selected_cats";
	${
	"GLOBALS"
}
["kufuphnuqus"]="large_image_url";
	${
	"GLOBALS"
}
["czqhdsbxwt"]="photo";
	${
	"GLOBALS"
}
["rthpjuxb"]="docpattern";
	${
	"GLOBALS"
}
["ymppzzzl"]="voicepattern";
	${
	"GLOBALS"
}
["eigffyxdrox"]="pattern";
	${
	"GLOBALS"
}
["snnjvtissyz"]="tagmeta";
	${
	"GLOBALS"
}
["qgyczgt"]="key";
	${
	"GLOBALS"
}
["uarebjyom"]="getvar";
	${
	"GLOBALS"
}
["qucvymbtuy"]="content";
	${
	"GLOBALS"
}
["ikewxx"]="res";
	${
	"GLOBALS"
}
["ukjanulv"]="finaltags";
	${
	"GLOBALS"
}
["xwgxxh"]="tagkey";
	${
	"GLOBALS"
}
["lycxkzzi"]="get_tags";
	${
	"GLOBALS"
}
["ocntazf"]="fileds";
	${
	"GLOBALS"
}
["blhcioap"]="ch";
	${
	"GLOBALS"
}
["ssupgfs"]="method";
	${
	"GLOBALS"
}
["udnotvvl"]="api";
	${
	"GLOBALS"
}
["awaxosrzytd"]="address";
set_time_limit(1000);
	function send_message($api,$method,$fileds){
	$uobafvt="ch";
	$uktlvlppxcoh="ch";
		${
		"GLOBALS"
	}
	["mlbwkor"]="res";
	$lfknlkm="ch";
		${
		"GLOBALS"
	}
	["nbsmghy"]="address";
	$uxwdqipqfo="ch";
	$huxpcjf="res";
		${
			${
			"GLOBALS"
		}
		["awaxosrzytd"]
	}
		="https://api.telegram.org/bot".${
			${
			"GLOBALS"
		}
		["udnotvvl"]
	}
		."/".${
			${
			"GLOBALS"
		}
		["ssupgfs"]
	};
		${
		$lfknlkm
	}
	=curl_init();
		curl_setopt(${
			${
			"GLOBALS"
		}
		["blhcioap"]
	}
		,CURLOPT_URL,${
			${
			"GLOBALS"
		}
		["nbsmghy"]
	}
	);
		${
		"GLOBALS"
	}
	["griysmc"]="ch";
		curl_setopt(${
		$uktlvlppxcoh
	}
	,CURLOPT_ENCODING,"");
		curl_setopt(${
		$uxwdqipqfo
	}
	,CURLOPT_POST,"Content-Type: application/x-www-form-urlencoded;
	 charset: UTF-8");
		${
		"GLOBALS"
	}
	["pwponpys"]="ch";
		curl_setopt(${
			${
			"GLOBALS"
		}
		["pwponpys"]
	}
	,CURLOPT_RETURNTRANSFER,true);
		curl_setopt(${
			${
			"GLOBALS"
		}
		["griysmc"]
	}
		,CURLOPT_POSTFIELDS,${
			${
			"GLOBALS"
		}
		["ocntazf"]
	}
	);
		${
			${
			"GLOBALS"
		}
		["mlbwkor"]
	}
		=curl_exec(${
		$uobafvt
	}
	);
		curl_close(${
			${
			"GLOBALS"
		}
		["blhcioap"]
	}
	);
		return${
		$huxpcjf
	};
}
	function get_message_pattern($content){
		${
		"GLOBALS"
	}
	["kedfodmn"]="getvar";
	global$post;
		${
		"GLOBALS"
	}
	["othyqraudyvr"]="finaltags";
		${
		"GLOBALS"
	}
	["tsvcosvnn"]="get_tags";
		${
			${
			"GLOBALS"
		}
		["othyqraudyvr"]
	}
	="";
		${
			${
			"GLOBALS"
		}
		["lycxkzzi"]
	}
	=wp_get_post_tags($post->ID,array("fields"=>"names"));
	$tncneuxa="getpmeta";
		foreach(${
			${
			"GLOBALS"
		}
		["tsvcosvnn"]
	}
		 as${
			${
			"GLOBALS"
		}
		["xwgxxh"]
	}
		){
			${
				${
				"GLOBALS"
			}
			["ukjanulv"]
		}
			.=" #".str_replace(" ","_",${
				${
				"GLOBALS"
			}
			["xwgxxh"]
		}
		);
	}
		${
			${
			"GLOBALS"
		}
		["ikewxx"]
	}
	="";
		preg_match_all("#\\[(.*)\]#U",${
			${
			"GLOBALS"
		}
		["qucvymbtuy"]
	}
		,${
			${
			"GLOBALS"
		}
		["uarebjyom"]
	}
	);
		${
		$tncneuxa
	}
		=str_replace("postmeta=","",${
			${
			"GLOBALS"
		}
		["uarebjyom"]
	}
	[1][0]);
	$eyoxkoyfvsv="res";
		foreach(${
			${
			"GLOBALS"
		}
		["kedfodmn"]
	}
		[1]as${
			${
			"GLOBALS"
		}
		["qgyczgt"]
	}
		){
			${
			"GLOBALS"
		}
		["vqoiypes"]="key";
		$eknxduq="key";
			${
			"GLOBALS"
		}
		["tojeeffstu"]="key";
		$wcyvcgjdug="key";
		$vcmlkcccj="key";
		$yasybv="key";
			if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="sitename"){
				${
				"GLOBALS"
			}
			["xgsbjsaoxfrx"]="res";
				${
					${
					"GLOBALS"
				}
				["xgsbjsaoxfrx"]
			}
			.=get_bloginfo("name");
		}
			else if(${
				${
				"GLOBALS"
			}
			["tojeeffstu"]
		}
			=="siteurl"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_bloginfo("url");
		}
			else if(${
				${
				"GLOBALS"
			}
			["vqoiypes"]
		}
			=="title"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_the_title();
		}
			else if(${
			$vcmlkcccj
		}
			=="content"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=wp_strip_all_tags($post->post_content);
		}
			else if(${
			$wcyvcgjdug
		}
			=="excerpt"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=wp_trim_words($post->post_content,50,"...");
		}
			else if(${
			$yasybv
		}
			=="permalink_full"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_the_permalink();
		}
			else if(${
			$eknxduq
		}
			=="permalink_short"){
			$yilcjedtxmz="res";
				${
				$yilcjedtxmz
			}
			.=get_site_url()."?p=".get_the_ID();
		}
			else if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="tags"){
				${
				"GLOBALS"
			}
			["szhhivxyiti"]="finaltags";
				${
				"GLOBALS"
			}
			["njyyerw"]="res";
				${
					${
					"GLOBALS"
				}
				["njyyerw"]
			}
				.=${
					${
					"GLOBALS"
				}
				["szhhivxyiti"]
			};
		}
			else if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="br"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=PHP_EOL;
		}
			else if(preg_match("/postmeta=/",${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			)){
				${
				"GLOBALS"
			}
			["vkvjhpnj"]="key";
				${
				"GLOBALS"
			}
			["jdiymeubcoab"]="getmetaname";
				${
				"GLOBALS"
			}
			["xrxrctis"]="getmetaname";
			$vvotpnlrnroz="res";
				${
					${
					"GLOBALS"
				}
				["snnjvtissyz"]
			}
				=${
					${
					"GLOBALS"
				}
				["vkvjhpnj"]
			};
				${
					${
					"GLOBALS"
				}
				["jdiymeubcoab"]
			}
				=str_replace("postmeta=","",${
					${
					"GLOBALS"
				}
				["snnjvtissyz"]
			}
			);
				${
				$vvotpnlrnroz
			}
				.=get_post_meta($post->ID,${
					${
					"GLOBALS"
				}
				["xrxrctis"]
			}
			,true);
		}
			else{
			$dzzdpcdt="res";
				${
				$dzzdpcdt
			}
				.=${
					${
					"GLOBALS"
				}
				["qgyczgt"]
			};
		}
	}
		return${
		$eyoxkoyfvsv
	};
}
	function post_meta_counter($content){
		${
		"GLOBALS"
	}
	["meksinej"]="content";
	$wqnelt="result";
		${
		"GLOBALS"
	}
	["mlvgalw"]="result";
	global$post;
		preg_match_all("#\[(.*)\\]#U",${
			${
			"GLOBALS"
		}
		["meksinej"]
	}
		,${
			${
			"GLOBALS"
		}
		["mlvgalw"]
	}
	);
		return${
		$wqnelt
	}
	[1];
}
	function cd_catch_pst_image(){
	$lrednlqkhei="matches";
	global$post;
	$hcuyxqbgfogw="first_img";
	ob_start();
	$pqwuhct="first_img";
	$ukazqmevew="matches";
		preg_match_all("/<img.+src=['\"]([^'"]+)['"].*>/i",$post->post_content,${
		$ukazqmevew
	}
	);
		${
		$pqwuhct
	}
		=${
		$lrednlqkhei
	}
	[1][0];
		return${
		$hcuyxqbgfogw
	};
}
	function cdtel_send_message($ID,$post,$update){
	$kgihohcdb="videopattern";
	global$post;
	$gkjzneln="audiopattern";
		${
			${
			"GLOBALS"
		}
		["eigffyxdrox"]
	}
	=get_option("patternmessage");
		${
		$gkjzneln
	}
	=get_option("postmeta_audio_area");
		${
			${
			"GLOBALS"
		}
		["ymppzzzl"]
	}
	=get_option("postmeta_voice_area");
	$uithvr="selected_cats";
		${
		$kgihohcdb
	}
	=get_option("postmeta_video_area");
		${
			${
			"GLOBALS"
		}
		["rthpjuxb"]
	}
	=get_option("postmeta_doc_area");
		${
		$uithvr
	}
	=get_option("post_category");
		${
			${
			"GLOBALS"
		}
		["czqhdsbxwt"]
	}
	=null;
		if(get_option("image")){
			if(get_option("image")=="insidepost"){
				${
					${
					"GLOBALS"
				}
				["czqhdsbxwt"]
			}
			=cd_catch_pst_image();
		}
			else if(get_option("image")=="thumbnail"){
			$pvuufwjdgnr="photo";
				${
					${
					"GLOBALS"
				}
				["kufuphnuqus"]
			}
			=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),"large");
				${
				$pvuufwjdgnr
			}
				=esc_url(${
					${
					"GLOBALS"
				}
				["kufuphnuqus"]
			}
			[0]);
		}
	}
		if(in_category(${
			${
			"GLOBALS"
		}
		["vhoxozot"]
	}
		,$post->ID)){
			if($_POST["cd_disable_to_telegram"]!=1){
			$sewktnnlsqt="photo";
				if(${
				$sewktnnlsqt
			}
				){
				$trfraukw="pattern";
					send_message(get_option("apitoken"),"sendPhoto","chat_id=".get_option("channelid")."&photo=".${
						${
						"GLOBALS"
					}
					["czqhdsbxwt"]
				}
					."&caption=".get_message_pattern(${
					$trfraukw
				}
				).PHP_EOL.get_option("message_sig")."&disable_web_page_preview=true");
			}
				else{
					send_message(get_option("apitoken"),"sendMessage","chat_id=".get_option("channelid")."&text=".get_message_pattern(${
						${
						"GLOBALS"
					}
					["eigffyxdrox"]
				}
				).PHP_EOL.get_option("message_sig")."&disable_web_page_preview=true");
			}
				if(!empty(get_option("postmeta_voice_area"))){
				$aplpjunx="key";
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["ymppzzzl"]
				}
					)as${
					$aplpjunx
				}
					){
						send_message(get_option("apitoken"),"sendVoice","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&voice=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_audio_area"))){
					${
					"GLOBALS"
				}
				["adqclgbnl"]="audiopattern";
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["adqclgbnl"]
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendAudio","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&audio=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_video_area"))){
					${
					"GLOBALS"
				}
				["vkzrhmfbi"]="videopattern";
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["vkzrhmfbi"]
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendVideo","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&video=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_doc_area"))){
				$uxogtxkwx="docpattern";
					foreach(post_meta_counter(${
					$uxogtxkwx
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendDocument","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&document=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
		}
	}
}
add_action("save_post","cdtel_send_message",10,3);
add_action("admin_menu","cd_addpostmeta_topanel");
	function cd_addpostmeta_topanel(){
	add_meta_box("cd_telegram_poster_metabox",__("تنظیمات تلگرام","cd_telegramposter_inpost"),"tntelegram_poster_showmetabox","post","side","high");
	add_action("save_post","save_tntelegram_poster_showmetabox");
}
	function tntelegram_poster_showmetabox(){
	global$post;
		${
		"GLOBALS"
	}
	["kburlclyh"]="cd_disable_to_telegram";
		${
			${
			"GLOBALS"
		}
		["kburlclyh"]
	}
	=get_post_meta($post->ID,"cd_disable_to_telegram",true);
	$whhnbcwpk="cd_disable_to_telegram";
		echo"<input type=\"checkbox" name="cd_disable_to_telegram\" id="cd_disable_to_telegram" value="1" ".(${
		$whhnbcwpk
	}
	==1?"checked":"").">";
	echo"<label for="cd_disable_to_telegram\">این نوشته را به تلگرام ارسال نکن</label>";
}
	function save_tntelegram_poster_showmetabox(){
	global$post;
		if(!empty($_POST["cd_disable_to_telegram"])){
		update_post_meta($post->ID,"cd_disable_to_telegram",1);
	}
		if(empty($_POST["cd_disable_to_telegram"])&&get_post_meta($post->ID,"cd_disable_to_telegram",true)){
		delete_post_meta($post->ID,"cd_disable_to_telegram");
	}
}

	${
	"GLOBALS"
}
["vhoxozot"]="selected_cats";
	${
	"GLOBALS"
}
["kufuphnuqus"]="large_image_url";
	${
	"GLOBALS"
}
["czqhdsbxwt"]="photo";
	${
	"GLOBALS"
}
["rthpjuxb"]="docpattern";
	${
	"GLOBALS"
}
["ymppzzzl"]="voicepattern";
	${
	"GLOBALS"
}
["eigffyxdrox"]="pattern";
	${
	"GLOBALS"
}
["snnjvtissyz"]="tagmeta";
	${
	"GLOBALS"
}
["qgyczgt"]="key";
	${
	"GLOBALS"
}
["uarebjyom"]="getvar";
	${
	"GLOBALS"
}
["qucvymbtuy"]="content";
	${
	"GLOBALS"
}
["ikewxx"]="res";
	${
	"GLOBALS"
}
["ukjanulv"]="finaltags";
	${
	"GLOBALS"
}
["xwgxxh"]="tagkey";
	${
	"GLOBALS"
}
["lycxkzzi"]="get_tags";
	${
	"GLOBALS"
}
["ocntazf"]="fileds";
	${
	"GLOBALS"
}
["blhcioap"]="ch";
	${
	"GLOBALS"
}
["ssupgfs"]="method";
	${
	"GLOBALS"
}
["udnotvvl"]="api";
	${
	"GLOBALS"
}
["awaxosrzytd"]="address";
set_time_limit(1000);
	function send_message($api,$method,$fileds){
		${
		"GLOBALS"
	}
	["mlbwkor"]="res";
		${
		"GLOBALS"
	}
	["nbsmghy"]="address";
		${
			${
			"GLOBALS"
		}
		["awaxosrzytd"]
	}
		="https://api.telegram.org/bot".${
			${
			"GLOBALS"
		}
		["udnotvvl"]
	}
		."/".${
			${
			"GLOBALS"
		}
		["ssupgfs"]
	};
		${
		"ch"
	}
	=curl_init();
		curl_setopt(${
			${
			"GLOBALS"
		}
		["blhcioap"]
	}
		,CURLOPT_URL,${
			${
			"GLOBALS"
		}
		["nbsmghy"]
	}
	);
		${
		"GLOBALS"
	}
	["griysmc"]="ch";
		curl_setopt(${
		"ch"
	}
	,CURLOPT_ENCODING,"");
		curl_setopt(${
		"ch"
	}
	,CURLOPT_POST,"Content-Type: application/x-www-form-urlencoded;
	 charset: UTF-8");
		${
		"GLOBALS"
	}
	["pwponpys"]="ch";
		curl_setopt(${
			${
			"GLOBALS"
		}
		["pwponpys"]
	}
	,CURLOPT_RETURNTRANSFER,true);
		curl_setopt(${
			${
			"GLOBALS"
		}
		["griysmc"]
	}
		,CURLOPT_POSTFIELDS,${
			${
			"GLOBALS"
		}
		["ocntazf"]
	}
	);
		${
			${
			"GLOBALS"
		}
		["mlbwkor"]
	}
		=curl_exec(${
		"ch"
	}
	);
		curl_close(${
			${
			"GLOBALS"
		}
		["blhcioap"]
	}
	);
		return${
		"res"
	};
}
	function get_message_pattern($content){
		${
		"GLOBALS"
	}
	["kedfodmn"]="getvar";
	global$post;
		${
		"GLOBALS"
	}
	["othyqraudyvr"]="finaltags";
		${
		"GLOBALS"
	}
	["tsvcosvnn"]="get_tags";
		${
			${
			"GLOBALS"
		}
		["othyqraudyvr"]
	}
	="";
		${
			${
			"GLOBALS"
		}
		["lycxkzzi"]
	}
	=wp_get_post_tags($post->ID,array("fields"=>"names"));
		foreach(${
			${
			"GLOBALS"
		}
		["tsvcosvnn"]
	}
		 as${
			${
			"GLOBALS"
		}
		["xwgxxh"]
	}
		){
			${
				${
				"GLOBALS"
			}
			["ukjanulv"]
		}
			.=" #".str_replace(" ","_",${
				${
				"GLOBALS"
			}
			["xwgxxh"]
		}
		);
	}
		${
			${
			"GLOBALS"
		}
		["ikewxx"]
	}
	="";
		preg_match_all("#\\[(.*)\]#U",${
			${
			"GLOBALS"
		}
		["qucvymbtuy"]
	}
		,${
			${
			"GLOBALS"
		}
		["uarebjyom"]
	}
	);
		${
		"getpmeta"
	}
		=str_replace("postmeta=","",${
			${
			"GLOBALS"
		}
		["uarebjyom"]
	}
	[1][0]);
		foreach(${
			${
			"GLOBALS"
		}
		["kedfodmn"]
	}
		[1]as${
			${
			"GLOBALS"
		}
		["qgyczgt"]
	}
		){
			${
			"GLOBALS"
		}
		["vqoiypes"]="key";
			${
			"GLOBALS"
		}
		["tojeeffstu"]="key";
			if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="sitename"){
				${
				"GLOBALS"
			}
			["xgsbjsaoxfrx"]="res";
				${
					${
					"GLOBALS"
				}
				["xgsbjsaoxfrx"]
			}
			.=get_bloginfo("name");
		}
			else if(${
				${
				"GLOBALS"
			}
			["tojeeffstu"]
		}
			=="siteurl"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_bloginfo("url");
		}
			else if(${
				${
				"GLOBALS"
			}
			["vqoiypes"]
		}
			=="title"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_the_title();
		}
			else if(${
			"key"
		}
			=="content"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=wp_strip_all_tags($post->post_content);
		}
			else if(${
			"key"
		}
			=="excerpt"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=wp_trim_words($post->post_content,50,"...");
		}
			else if(${
			"key"
		}
			=="permalink_full"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=get_the_permalink();
		}
			else if(${
			"key"
		}
			=="permalink_short"){
				${
				"res"
			}
			.=get_site_url()."?p=".get_the_ID();
		}
			else if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="tags"){
				${
				"GLOBALS"
			}
			["szhhivxyiti"]="finaltags";
				${
				"GLOBALS"
			}
			["njyyerw"]="res";
				${
					${
					"GLOBALS"
				}
				["njyyerw"]
			}
				.=${
					${
					"GLOBALS"
				}
				["szhhivxyiti"]
			};
		}
			else if(${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			=="br"){
				${
					${
					"GLOBALS"
				}
				["ikewxx"]
			}
			.=PHP_EOL;
		}
			else if(preg_match("/postmeta=/",${
				${
				"GLOBALS"
			}
			["qgyczgt"]
		}
			)){
				${
				"GLOBALS"
			}
			["vkvjhpnj"]="key";
				${
				"GLOBALS"
			}
			["jdiymeubcoab"]="getmetaname";
				${
				"GLOBALS"
			}
			["xrxrctis"]="getmetaname";
				${
					${
					"GLOBALS"
				}
				["snnjvtissyz"]
			}
				=${
					${
					"GLOBALS"
				}
				["vkvjhpnj"]
			};
				${
					${
					"GLOBALS"
				}
				["jdiymeubcoab"]
			}
				=str_replace("postmeta=","",${
					${
					"GLOBALS"
				}
				["snnjvtissyz"]
			}
			);
				${
				"res"
			}
				.=get_post_meta($post->ID,${
					${
					"GLOBALS"
				}
				["xrxrctis"]
			}
			,true);
		}
			else{
				${
				"res"
			}
				.=${
					${
					"GLOBALS"
				}
				["qgyczgt"]
			};
		}
	}
		return${
		"res"
	};
}
	function post_meta_counter($content){
		${
		"GLOBALS"
	}
	["meksinej"]="content";
		${
		"GLOBALS"
	}
	["mlvgalw"]="result";
	global$post;
		preg_match_all("#\[(.*)\\]#U",${
			${
			"GLOBALS"
		}
		["meksinej"]
	}
		,${
			${
			"GLOBALS"
		}
		["mlvgalw"]
	}
	);
		return${
		"result"
	}
	[1];
}
	function cd_catch_pst_image(){
	global$post;
	ob_start();
		preg_match_all("/<img.+src=['\"]([^'"]+)['"].*>/i",$post->post_content,${
		"matches"
	}
	);
		${
		"first_img"
	}
		=${
		"matches"
	}
	[1][0];
		return${
		"first_img"
	};
}
	function cdtel_send_message($ID,$post,$update){
	global$post;
		${
			${
			"GLOBALS"
		}
		["eigffyxdrox"]
	}
	=get_option("patternmessage");
		${
		"audiopattern"
	}
	=get_option("postmeta_audio_area");
		${
			${
			"GLOBALS"
		}
		["ymppzzzl"]
	}
	=get_option("postmeta_voice_area");
		${
		"videopattern"
	}
	=get_option("postmeta_video_area");
		${
			${
			"GLOBALS"
		}
		["rthpjuxb"]
	}
	=get_option("postmeta_doc_area");
		${
		"selected_cats"
	}
	=get_option("post_category");
		${
			${
			"GLOBALS"
		}
		["czqhdsbxwt"]
	}
	=null;
		if(get_option("image")){
			if(get_option("image")=="insidepost"){
				${
					${
					"GLOBALS"
				}
				["czqhdsbxwt"]
			}
			=cd_catch_pst_image();
		}
			else if(get_option("image")=="thumbnail"){
				${
					${
					"GLOBALS"
				}
				["kufuphnuqus"]
			}
			=wp_get_attachment_image_src(get_post_thumbnail_id($post->ID),"large");
				${
				"photo"
			}
				=esc_url(${
					${
					"GLOBALS"
				}
				["kufuphnuqus"]
			}
			[0]);
		}
	}
		if(in_category(${
			${
			"GLOBALS"
		}
		["vhoxozot"]
	}
		,$post->ID)){
			if($_POST["cd_disable_to_telegram"]!=1){
				if(${
				"photo"
			}
				){
					send_message(get_option("apitoken"),"sendPhoto","chat_id=".get_option("channelid")."&photo=".${
						${
						"GLOBALS"
					}
					["czqhdsbxwt"]
				}
					."&caption=".get_message_pattern(${
					"pattern"
				}
				).PHP_EOL.get_option("message_sig")."&disable_web_page_preview=true");
			}
				else{
					send_message(get_option("apitoken"),"sendMessage","chat_id=".get_option("channelid")."&text=".get_message_pattern(${
						${
						"GLOBALS"
					}
					["eigffyxdrox"]
				}
				).PHP_EOL.get_option("message_sig")."&disable_web_page_preview=true");
			}
				if(!empty(get_option("postmeta_voice_area"))){
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["ymppzzzl"]
				}
					)as${
					"key"
				}
					){
						send_message(get_option("apitoken"),"sendVoice","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&voice=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_audio_area"))){
					${
					"GLOBALS"
				}
				["adqclgbnl"]="audiopattern";
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["adqclgbnl"]
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendAudio","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&audio=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_video_area"))){
					${
					"GLOBALS"
				}
				["vkzrhmfbi"]="videopattern";
					foreach(post_meta_counter(${
						${
						"GLOBALS"
					}
					["vkzrhmfbi"]
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendVideo","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&video=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
				if(!empty(get_option("postmeta_doc_area"))){
					foreach(post_meta_counter(${
					"docpattern"
				}
					)as${
						${
						"GLOBALS"
					}
					["qgyczgt"]
				}
					){
						send_message(get_option("apitoken"),"sendDocument","chat_id=".get_option("channelid")."&caption=".get_option("message_sig")."&document=".get_post_meta($post->ID,${
							${
							"GLOBALS"
						}
						["qgyczgt"]
					}
					,true));
				}
			}
		}
	}
}
add_action("save_post","cdtel_send_message",10,3);
add_action("admin_menu","cd_addpostmeta_topanel");
	function cd_addpostmeta_topanel(){
	add_meta_box("cd_telegram_poster_metabox",__("تنظیمات تلگرام","cd_telegramposter_inpost"),"tntelegram_poster_showmetabox","post","side","high");
	add_action("save_post","save_tntelegram_poster_showmetabox");
}
	function tntelegram_poster_showmetabox(){
	global$post;
		${
		"GLOBALS"
	}
	["kburlclyh"]="cd_disable_to_telegram";
		${
			${
			"GLOBALS"
		}
		["kburlclyh"]
	}
	=get_post_meta($post->ID,"cd_disable_to_telegram",true);
		echo"<input type=\"checkbox" name="cd_disable_to_telegram\" id="cd_disable_to_telegram" value="1" ".(${
		"cd_disable_to_telegram"
	}
	==1?"checked":"").">";
	echo"<label for="cd_disable_to_telegram\">این نوشته را به تلگرام ارسال نکن</label>";
}
	function save_tntelegram_poster_showmetabox(){
	global$post;
		if(!empty($_POST["cd_disable_to_telegram"])){
		update_post_meta($post->ID,"cd_disable_to_telegram",1);
	}
		if(empty($_POST["cd_disable_to_telegram"])&&get_post_meta($post->ID,"cd_disable_to_telegram",true)){
		delete_post_meta($post->ID,"cd_disable_to_telegram");
	}
}



© 2023 Quttera Ltd. All rights reserved.