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 /*GENI Versi 4.01 - 23.08.2016 - 23:17 - Baransari, Sleman, Yogyakarta ..
Decoded Output download
<?php
/*GENI Versi 4.01
- 23.08.2016
- 23:17
- Baransari, Sleman, Yogyakarta
- By : me
*/
/*API BACKEND*/
//include(TEMPLATEPATH.'/geni/apilibs.php');
/* JS Flamma7
** Version 2.03 [01.34 12/08/2016]
** $q : string. Query
** $z : string. Size
*/
function js_flamma7($q,$z) {
$ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0|Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0|Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1|Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0';$xua = explode('|',$ua); shuffle($xua); $theua = $xua[0]; $b = 'https://www.google.com/search?hl=en&site=imghp&tbm=isch'.$z.'&q='.urlencode($q); ini_set('user_agent',$theua); $g = file_get_contents($b,false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"Accept-language: en-us,en
"))));if($g !== false) {$d = str_replace('</a><div class="rg_meta">','</a><i class="rg_meta">',str_replace('</div></div><!--n-->','</i></div></code><!--n-->',str_replace('<!--m-->','<!--m--><code>',$g)));$n=new DOMDocument();@$n->loadHTML($d);$c=$n->getElementsByTagName('code');$u=1;$av=array();foreach($c as $dv){$ei=$dv->getElementsByTagName('i');foreach($ei as $i){$j=json_decode($i->nodeValue);$imgurl=$j->ou;$pgurl=$j->ru;$v=$j->isu;$e=$j->ity;$width=$j->ow;$height=$j->oh;$sz=$j->os;$title=$j->pt;$desc=$j->s;$tmb=$j->tu;$tw=$j->tw;$th=$j->th;$av[]=array("url"=>$imgurl,"ref"=>$pgurl,"title"=>$title,"desc"=>$desc,"width"=>$width,"height"=>$height,"ext"=>$e,"sz"=>$sz,"via"=>$v,"tb"=>$tmb,"tw"=>$tw,"th"=>$th);}$u++;}$av[]='';return json_encode($av);}else{return '';}
}
/* JS Get Images v3.1b
** Created: 1:23 19/06/2015
$f : string. Nama file jadi.
$u : string. url asli image. (url target)
$r : string. url referrer
*/
function js_getimages($f,$u,$r) {
$updir = wp_upload_dir();
$d = $updir['path'];
//USER AGENTS
$ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0|Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0|Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0|Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0|Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/23.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0|Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20131011 Firefox/23.0|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36|Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36|Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1464.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14|Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14|Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14|Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02|Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00|Opera/9.80 (Windows NT 5.1; U; zh-sg) Presto/2.9.181 Version/12.00|Opera/12.0(Windows NT 5.2;U;en)Presto/22.9.168 Version/12.00|Opera/12.0(Windows NT 5.1;U;en)Presto/22.9.168 Version/12.00|Mozilla/5.0 (Windows NT 5.1) Gecko/20100101 Firefox/14.0 Opera/12.0|Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62|Opera/9.80 (Windows NT 6.0; U; pl) Presto/2.10.229 Version/11.62|Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52|Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)|Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)|Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)|Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)|Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))|Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)';
$xua = explode('|',$ua);
shuffle($xua);
$theua = $xua[0];
//Set Headers
$hdrs = array(
"HTTP_FORWARDED: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_X_FORWARDED_FOR: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_CLIENT_IP: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_VIA: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_XROXY_CONNECTION: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_PROXY_CONNECTION: ".$_SERVER['REMOTE_ADDR']."",
"Accept: text/xml,text/html,application/xhtml+xml,application/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Accept-Language: en-us,en",
"Cache-Control: max-age=0",
"Connection: keep-alive",
"Keep-Alive: 300",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Pragma: "
);
//Init Curl
$c = curl_init();
//Set Curl Options
curl_setopt($c, CURLOPT_URL, $u);
curl_setopt($c, CURLOPT_USERAGENT, $theua);
curl_setopt($c, CURLOPT_HTTPHEADER, $hdrs);
if(!empty($r)) {
curl_setopt($c, CURLOPT_REFERER, $r);
}
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_CAINFO, dirname(__FILE__)."/cacert.pem");
//Execute & Return
$g = curl_exec($c);
//Close Curl
curl_close($c);
if(empty($g) || strpos($g,'<meta ') !== false || strpos($g,'<html') !== false || strpos($g,'<!DOCTYPE ') !== false || strpos($g,'<!doctype ') !== false) {
return false;
} else {
if (false === $g){
return false;
} else {
$put = file_put_contents($d.'/'.$f,$g);
if($put !== false) {
return true;
} else {
return false;
}
}
}
}
/*SUSU AUTOTAGS
** Simple auto tags
** $s : string. keyword
** $l : integer. limit
**
*/
function ss_autotags($s,$l) {
$s = urlencode($s);
$h = @file_get_contents("http://www.bing.com/AS/Suggestions?pt=page.serp&bq=&qry={$s}&cp=15&cvid=97b982e1e70345f5ae3df3d71e291859");
if(!empty($h)) {
$h = str_replace(array("<strong>","</strong>"),'',$h);
preg_match_all("/>([\w{3,}\s]+)</",$h,$m,PREG_SET_ORDER);
$r = array();
foreach($m as $k=>$v) { if($k == $l) break; $r[] = $v[1]; }
return implode(',', $r);exit;
}
}
/*SUSU AUTO TAGS LEVEL 3*/
function ss_autotags3($s) {
$t3 = ',';
$t1 = explode(',',ss_autotags($s,5));
foreach($t1 as $s1) {
$t2 = explode(',',ss_autotags($s1,7));
foreach($t2 as $s2) {
$t3 .= ss_autotags($s2,12);
}
}
$t3 .= '';
return $t3;
}
/*FUNCTION IM CHECKIT*/
function im_checkit($a,$b){
if($a==$b) {
return ' selected="selected"';
} else {
return '';
}
}
/* JS KS
** Simple Keyword Suggestion
** v1:02 23:45 02/02/2016
*/
function js_ks($s) {
$q = array();
ini_set('user_agent',$theua); $d = file_get_contents('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($s),false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"Accept-language: en-us,en
"))));
if (($d = json_decode($d,true)) !== null) {$q = $d[1];}
return $q;
}
/* SIMPLE PIN6 */
function pin6($h,$p=80,$t=6){
$c = fsockopen($h,$p,$errno,$errstr,$t);
if(!$c) {return false;} else {return true;}
}
//ini_set('display_errors',0);
/*ADD OPTIONS*/
add_option('laurl','','','yes');//last progres api url
add_option('ptemp','','','yes');//data temporary post yang dipublish
add_option('lpurl','','','yes');//last progres publish url
add_option('new_image_format','','','yes');//new image format url
add_option('latflow','','','yes'); //last attachment flow progress
add_option('autopublish','','','yes'); //auto publish
add_option('autocat','','','yes'); //auto category
add_option('autosize','','','yes'); //auto category
add_option('metadata','','','yes'); //meta image data
add_option('dpost','','','yes'); //d post
add_option('rti','','','yes'); //random total image
add_option('autoretry','','','yes'); //auto retry
$ixurl = 'http://hackpad.imgix.net/';
add_action('init','cw_api_domain');
/* 0.1 FUNCTION TEXT DOMAIN--------------*/
function cw_api_domain() {
load_plugin_textdomain('kimcil',false,'kimcil');
}
/* 0.2 FUNCTION ICON---------------------*/
function cw_icon($d) {
$t = get_bloginfo('template_directory');
$i = $t.'/'.$d;
return $i;
}
/* 0.3 FUNCTION API MENU-----------------*/
add_action('admin_menu','cw_apimenu');
function cw_apimenu() {
/* 3.1 TOP MENU------------------------*/
if(function_exists('add_menu_page')) {
$topmenu = add_menu_page(
__('Api Page','kimcil'), //page title, text domain
__('API Backend','kimcil'), //menu label, text domain
'manage_options', // privilage (siapa yang boleh melihat menu ini)
'cw-api', //slug
'cw_api_page', //functiona page
'dashicons-shield', //icon 16x16px
'2' //posisi
);
add_action("admin_print_scripts-$topmenu",'css_api');
} else {}
/* 3.2 SUB MENU------------------------*/
if(function_exists('add_submenu_page')) {
//01. Pflow
$cwpflow = add_submenu_page( // variable publish flow
'cw-api', // slug dari top menu
__('Publish flow Page','kimcil'), //page title, text domain
__('Publish Flow','kimcil'), //menu label, text domain
'manage_options', //privilage
'cw-api-publish', //slug
'cw_publish' //function page
);
add_action("admin_print_scripts-$cwpflow",'css_api');
//02. attachment flow
$cwattach = add_submenu_page(
'cw-api',
__('Atachment Flow Page', 'kimcil'),
__('Attachment Flow', 'kimcil'),
'manage_options',
'cw-attach',
'cw_attach_page'
);
add_action("admin_print_scripts-$cwattach", 'css_api');
//03. Array Maker
$cwarray = add_submenu_page(
'cw-api',
__('Add Query Page', 'kimcil'),
__('Add Query', 'kimcil'),
'manage_options',
'cw-addquery',
'cw_addquery_page'
);
add_action("admin_print_scripts-$cwarray", 'css_api');
//04. Get Rel
$cwgetrel = add_submenu_page(
'cw-api',
__('Get Rel Page', 'kimcil'),
__('Get Rel', 'kimcil'),
'manage_options',
'cw-getrel',
'cw_getrel_page'
);
add_action("admin_print_scripts-$cwgetrel", 'css_api');
//05. API SETTING
$cwapisetting = add_submenu_page(
'cw-api',
__('JS Api Setting', 'ohyess'),
__('Api Setting', 'ohyess'),
'manage_options',
'cw-apisetting',
'cw_apisetting_page'
);
add_action("admin_print_scripts-$cwapisetting", 'css_api');
//05. API ACAK TANGGAL
$cwapitanggal = add_submenu_page(
'cw-api',
__('JS Api Shuffle Post Date', 'ohyess'),
__('Api Shuffle Post Date', 'ohyess'),
'manage_options',
'cw-apitanggal',
'cw_apitanggal_page'
);
add_action("admin_print_scripts-$cwapitanggal", 'css_api');
//05. API IMAGE
$cwapiimage = add_submenu_page(
'cw-api',
__('JS Api Add Attachment', 'ohyess'),
__('Api Add Attachment', 'ohyess'),
'manage_options',
'cw-apiimage',
'cw_apiimage_page'
);
add_action("admin_print_scripts-$cwapiimage", 'css_api');
//05. Sandbox
$cwapisandbox = add_submenu_page(
'cw-api',
__('API SANDBOX', 'kimcil'),
__('Sandbox', 'kimcil'),
'manage_options',
'cw-apisandbox',
'cw_apisandbox_page'
);
add_action("admin_print_scripts-$cwapisandbox", 'css_api');
} else {}
/*END OF SUBMENU-----------------------*/
}
/*END OF FUNCTION MENU-------------------*/
/*FUNCTION API PAGE----------------------*/
function cw_api_page() {
global $wpdb;
$aurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api';
$arurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-addquery';
$laurl = get_option('laurl');
$kfile = TEMPLATEPATH.'/geni/kwds.php';
echo '<div class="wrap">
<h2>API Backend</h2>
<div class="inside">';
/*Pengecekan tabel api exists atau belum*/
$tbname = 'wp_apidata';
if($wpdb->get_var("SHOW TABLES LIKE '$tbname' ") != $tbname) {
$tbono = false;
} else {
$tbono = true;
}
if(!$tbono) {
$charsetc = $wpdb->get_charset_collate();
$tb1 = 'wp_apidata';
$tb2 = 'wp_apiquery';
$ctb1 = "CREATE TABLE $tb1 (
api_id bigint(20) unsigned NOT NULL auto_increment,
api_query varchar(200) NOT NULL,
api_title text NOT NULL,
api_url varchar(512) NOT NULL,
api_content text NOT NULL,
api_via text NOT NULL,
api_wh text NOT NULL,
api_ext text NOT NULL,
api_tmb text NOT NULL,
api_ref text NOT NULL,
api_size text NOT NULL,
api_status varchar(7) NOT NULL,
UNIQUE KEY api_id (api_id),
KEY api_url (api_url),
KEY api_query (api_query),
KEY api_status (api_status)
) $charsetc;";
$ctb2 = "CREATE TABLE $tb2 (
api_id bigint(20) unsigned NOT NULL auto_increment,
api_query varchar(200) NOT NULL,
api_rel longtext NOT NULL,
api_status varchar(7) NOT NULL,
UNIQUE KEY api_id (api_id),
KEY api_query (api_query),
KEY api_status (api_status)
) $charsetc;";
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
dbDelta($ctb1);
dbDelta($ctb2);
/*ISI DEFAULT API SETTINGS*/
update_option('new_image_format','postitle[(.Y.)]imgtitle[(.Y.)]kueri[(.Y.)]imgurl[(.Y.)]cats[(.Y.)]tags');
update_option('autopublish','yes');
update_option('autocat','catdefault');
update_option('autosize','size1');
update_option('metadata','metadefault');
update_option('dpost','future');
update_option('rti','18,26');
echo '<p>Lagi bikin tabel mbro tinggal udud sek....!!!</p>
<meta http-equiv="refresh" content="2; url='.$aurl.'"/>';
exit;
} else {}
/*CHECK KUERI FILE*/
if(!file_exists($kfile)) {
echo '<meta http-equiv="refresh" content="0; url='.$arurl.'"/>';
exit;
} else {}
/*02. HANDLER*/
if(isset($_POST['apisubmit'])) {
$issubmit = true;
$idx = 0;
} elseif(isset($_REQUEST['rsubmit'])) {
$issubmit = true;
$idx = $_REQUEST['idx'];
} else {
$issubmit = false;
$idx = 0;
}
/*03. KONFIRMASI*/
if(empty($laurl)) {
$sb = '<input class="button-primary" type="submit" name="apisubmit" value="Angkut Mbro..."/>';
} else {
parse_str($laurl,$la);
if($issubmit) {} else {
$idx = $la['idx'];
}
$sb = '<a href="'.$laurl.'" class="button-primary">Resume</a>';
}
include($kfile);
$tk = count($kwds);
$kueri = $kwds[$idx];
/*06. ENDIT*/
if($idx>($tk-1)) {
echo '<h2 class="gr">Kelar Mbroo...!!!</h2>';
} else {
echo '<p>
<label>Prosessing</label>: '.$kueri.'<br/>
<label>Number</label>: '.number_format($idx+1).' of '.number_format($tk).'<br/>
</p>';
/*01. FORM*/
echo '<form action="'.$aurl.'" method="post">
'.$sb.'
<a href="'.$aurl.'" class="button">Pause</a>
</form>';
/*04. EXECUTE*/
if($issubmit) {
ini_set('display_errors',0);
echo '<div class="res">';
/*Insert Database---------------------------------------------*/
$sizes = array(
"size1"=>"isz:l",
"size2"=>"isz:lt,islt:xga",
"size3"=>"isz:lt,islt:2mp",
"size4"=>"isz:lt,islt:4mp",
"size5"=>"isz:lt,islt:6mp"
);
$settingsize = get_option('autosize');
$size = '&tbs='.$sizes[$settingsize];
//$kueri = $kueri.' site:netcarshow.coom';//contoh pengambilan data spesifik dari website tertentu
$r = js_flamma7($kueri,$size);
if(!empty($r)) {
$r = json_decode($r);
//echo '<pre>'.print_r(json_decode($r),true).'</pre>';
//print_r($r);
$i = 1;
foreach($r as $d) {
if(empty($d)) {} else {
$url = $d->url;
$ref = $d->ref;
$title = remove_accents($d->title);
$desc = $d->desc;
$width = $d->width;
$height = $d->height;
$wh = $width.'_'.$height;
$ext = $d->ext;
$sz = $d->sz;
$via = $d->via;
$tb = $d->tb;
$tw = $d->tw;
$th = $d->th;
$tmb = $tb.'_'.$tw.'_'.$th;
//echo '<img src="'.$tb.'" alt=""/>';
/*DETECT URL GAMBAR*/
$eurl = urlencode(basename($url));
if(strpos($eurl,'%') !== false) {
} else {
/*DATA EXISTENCE CHECK----------------------------pengecekan data sudah ada atau belum*/
$datachk = $wpdb->get_var( "SELECT COUNT(api_id) FROM wp_apidata WHERE api_query = '".$kueri."' AND api_url = '".$url."' " );
if($datachk>0) {
echo '<span class="rd">Data '.$title.' sampun disimpen mbro ampun nyimpen malih nggih...</span><br/>';
} else {
/*Penyimpanan data*/
$savit = $wpdb->query( $wpdb->prepare("INSERT INTO wp_apidata
(api_query,api_title,api_url,api_content,api_via,api_wh,api_ext,api_tmb,api_ref,api_size,api_status)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
$kueri,$title,$url,$desc,$via,$wh,$ext,$tmb,$ref,$z,''
));
if($savit !== false) {
echo '<span class="gr">Data '.$title.' sampun dados disimpen mbro...</span><br/>';
} else {
$err .= '1';
echo '<span class="rd">Data '.$title.' mboten dados disimpen mbro...</span><br/>';
$wpdb->show_errors();
$wpdb->print_error();
}
}
}
/*echo '<img src="'.$tb.'" alt=""/>';
echo $i.'. '.$title.'<br/>';
echo $width.'x'.$height.'<br/>';
echo $desc.'<br/>';
echo $ext.'<br/>';
echo $via.'<br/>';
echo '<hr/>';*/
}
$i++;
}
$err .= '';
if(!empty($err)) {
echo '<p class="rd">Wonten insertion database ingkang mboten dados, mboten saged nglanjut mbro...</p>';
} else {
/*05. TRANSISI*/
$requrl = $aurl.'&rsubmit=true&idx='.($idx+1);
$reload = mt_rand(3,5);
/*Last Progress*/
update_option('laurl',$requrl);
echo '<style>#jload {width:100%;height:5px; padding:0; margin:10px auto; background:#ddd;position:relative;}.expand {width:100%;height:5px; margin:0; background:#390; position:absolute;box-shadow:0 1px 0 0 rgba(255,255,255,1.0); -moz-animation:fullexpand '.$reload.'s ease-out;-webkit-animation:fullexpand '.$reload.'s ease-out;}@-moz-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}@-webkit-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}</style>';
echo '<div id="lw"><div id="jload"><span class="expand"></span></div></div>';
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$requrl.'"/>';
}
} else {
echo '<p class="rd">No Result</p>';
}
/*End of Insert database--------------------------------------*/
/*CATATAN
NEXT :
- Endit
http://localhost/api14/wp-admin/admin.php?page=cw-api&rsubmit=true&idx=19
- Insert Database
*/
echo '</div>';
} else {}
//disini
}
echo '</div>
</div>';
}
/*END OF FUNCTION API PAGE---------------*/
/*FUNCTION API PUBLISH-------------------*/
function cw_publish() {
global $wpdb,$ixurl;
$purl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api-publish';
$aturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-attach';
$laurl = get_option('laurl');
$lpurl = get_option('lpurl');
$ptemp = get_option('ptemp');
$autopublish = get_option('autopublish');
$rti = get_option('rti');
$dpost = get_option('dpost');
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
if(!empty($laurl)) {
include(TEMPLATEPATH.'/geni/kwds.php');
parse_str($laurl,$la);
$lidx = ($la['idx']-1);
if(empty($lpurl)) {
$idx = 0;
} else {
parse_str($lpurl,$lp);
$idx = $lp['idx'];
}
$kueri = $kwds[$idx];
echo '<p>';
echo '<label>Avaliable Data : </label>'.($lidx+1).' Data <br/>';
echo '<label>Currently Publishing : </label>'.$kueri.'<br/>';
echo '</p><hr/>';
$datas = $wpdb->get_results( "SELECT * FROM wp_apidata WHERE api_query = '".$kueri."' AND api_status='' ");
/*HANDLER RANDOM TOTAL IMAGE*/
$xrti = explode(',',$rti);
if(count($datas) < $xrti[0] || count($datas) > $xrti[1]) {
$ri = mt_rand($xrti[0],($xrti[1]-1));
$i =1;
foreach($datas as $data) {
$aid = $data->api_id;
if($i>$ri) {
$apdet = $wpdb->query("UPDATE wp_apidata SET api_status = 'exclude' WHERE api_id = $aid ");
} else {}
$i++;
}
echo '<meta http-equiv="refresh" content="0; url='.$purl.'"/>';
exit;
} else {}
/*HANDLER*/
if(isset($_POST['esubmit'])) {
$issubmit = true;
$du = 'edit';
$r2 = 'form';
} elseif(isset($_POST['psubmit'])) {
$issubmit = true;
$du = 'edit';
$r2 = 'publish';
} elseif(isset($_REQUEST['pflow'])) {
$issubmit = true;
$du = 'publish';
$r2 = '';
} else {
$issubmit = false;
$du = '';
$r2 = '';
}
/*EXECUTE*/
if($issubmit) {
if($du=='edit') {
$ptitle = $_POST['ptitle'];
$pcontent = $_POST['pcontent'];
$ptags = $_POST['ptags'];
if(empty($_POST['pcat'])) {
$pcat = '';
} else {
$pcat = implode(',',$_POST['pcat']);
}
$ptempdata = $kueri.'[(.Y.)]'.$ptitle.'[(.Y.)]'.$pcat.'[(.Y.)]'.$ptags.'[(.Y.)]'.$pcontent;
update_option('ptemp',$ptempdata);
$tdata = count($_POST['atitle']);
foreach(range(1,$tdata) as $i) {
$aid = $_POST['aid'][$i];
$atitle = $_POST['atitle'][$i];
$adesc = $_POST['adesc'][$i];
$aurl = $_POST['aurl'][$i];
$avia = $_POST['avia'][$i];
$awh = $_POST['awh'][$i];
if(!empty($_POST['exc'][$i])) {
$apdet = $wpdb->query("UPDATE wp_apidata SET api_status = 'exclude' WHERE api_id = $aid ");
} else {
$apdet = $wpdb->query("UPDATE wp_apidata SET
api_title = '".$atitle."',
api_content = '".$adesc."',
api_url = '".$aurl."',
api_wh = '".$awh."'
WHERE api_id = $aid ");
}
if($apdet !== false) {} else {
$err .= '1';
$wpdb->show_errors();
$wpdb->print_error();
}
}
$err .= '';
if(!empty($err)) {
echo '<p class="rd">Update data gagal mbro...</p>';
} else {
if($r2 == 'publish') {
$r2url = $purl.'&pflow=true';
} else {
$r2url = $purl.'';
}
echo '<p class="gr">Update data berhasil mbro...</p>'.
'<meta http-equiv="refresh" content="1; url='.$r2url.'"/>';
}
} elseif($du == 'publish') {
echo '<p>Publish disini mbro...</p>';
if(empty($ptemp)) {
echo '<p class="rd">Ada yang kosong dan kudu di isi broo...</p>
<a href="'.$purl.'" class="button-primary">Back</a>
';
} else {
/*==========POST EXISTANCE CHECK==========*/
$pchk = $wpdb->get_var( "SELECT COUNT(ID) FROM $wpdb->posts WHERE pinged = '".base64_encode($kueri)."' " );
if($pchk>0) {
echo '<p class="rd">Post ini sudah pernah terinsert broo</p>';
} else {
$xtemp = explode('[(.Y.)]',$ptemp);
$ptitle = $xtemp[1];
$xcat = explode(',',$xtemp[2]);
$ptags = $xtemp[3];
$pcontent = $xtemp[4];
$author= mt_rand(1,5);//==============edit author disini===============
/*Data Gambar*/
$pimgs = '';
$i = 1;
foreach($datas as $data) {
$api_title = $data->api_title;
$api_url = $data->api_url;
$api_ref = $data->api_ref;
$api_ext = $data->api_ext;
$pimgs .= $api_title.'[{|}]'.$api_url.'[{|}]'.$api_ref.'[{|}]'.$api_ext.
'[(.Y.)]';
$i++;
}
$pimgs .= '';
$pimgs = substr($pimgs,0,-7);
/*Construksi tanggal*/
$today = date('Y-m-d H:i:s');
//$plusday = mt_rand(1,365);
$plusday = 0;
$plushour = mt_rand(1,23);
$plousmin = mt_rand(1,59);
$ploussec = mt_rand(1,59);
if($dpost == 'backdate') {
$backfu = '-';
} else {
$backfu = '+';
}
$newdate = date('Y-m-d H:i:s',strtotime($backfu.$plusday.' day '.$backfu.$plushour.' hour '.$backfu.$plousmin.' minutes '.$backfu.$ploussec.' seconds',''.strtotime($today)));
// Create post object
$my_post = array(
'post_title' => $ptitle,
'post_name' => sanitize_title_with_dashes($ptitle),
'post_content' => $pcontent,
'post_excerpt' => $pimgs,
'post_status' => 'draft',//draft,publish,pending,schedule,future
'post_date' => $newdate,
'post_date_gmt' => $newdate,
'post_modified' => $newdate,
'post_modified_gmt' => $newdate,
'post_author' => $author,
'pinged' => base64_encode($kueri),
'post_category' => $xcat
);
// Insert the post into the database
$posid = wp_insert_post($my_post);
if(empty($posid)) {
echo '<p class="rd">Insert Post '.$ptitle.' Gagal mbroo...</p>';
$wpdb->show_errors();
$wpdb->print_error();
} else {
echo '<p class="gr">Insert Post '.$ptitle.' Berhasil mbroo...</p>';
//Insert tags
wp_add_post_tags($posid,$ptags);
echo '<meta http-equiv="refresh" content="1; url='.$aturl.'&atflow=true&pid='.$posid.'&aidx=0"/>';
/*NEXT
1. Transisi ke attachment flow
2. Definisi url halaman attachment flow
3. wp_insert_attachment -> fungsi yang akan kita pakai
4. Bahaslah
*/
}
}
}
} else {}
exit;
} else {}
/*DATA YANG AKAN DI PUBLISHKAN----------------------------------*/
//print_r($datas);
/*POST TITLE, KONTEN, CATEGORY, TAGS-----------------------------*/
if($autopublish == 'yes') {
$fid = 'af';
$bsave = '';
$bpub = '<input type="hidden" name="psubmit" value="Publish"/>';
$xap = '<script>document.getElementById("af").submit();</script>';//executor autopublish
$timg = count($datas);
$prefix = array('awesome','stunning','excelent','remarkable', 'extraordinary','staggering','incredible','outstanding','amazing','astonishing','marvelous','phenomenal','splendid','informalfabulous','fantastic','tremendous','jaw-dropping');
shuffle($prefix);
$suffix1 = array('picture','image','photo','pics','pictures','images');
shuffle($suffix1);
$suffix2 = array('ideas','inspirations');
shuffle($suffix2);
$ptitle = ucwords($kueri);
$ptags = ss_autotags3($kueri);
$pcontent = str_replace($str2rm,' ',$pcontent);
$defcat = get_option('default_category');
if($autocat == 'catdefault') {
$xcat = array($defcat);
} else {
$dcfile = TEMPLATEPATH.'/geni/defcat.php';
if(!file_exists($dcfile)) {
$xcat = array($defcat);
} else {
include($dcfile);
$cats = get_categories('hide_empty=0&hierarchical=0');
$cids = '';
foreach($cats as $cat) {
$catvar = ${str_replace('-','_',$cat->slug)};
//$catvar = $dining_room;
foreach($catvar as $cv) {
if(strpos(strtolower($kueri),strtolower($cv)) !== false) {
$cids .= $cat->term_id.',';
} else {}
}
}
$cids .= '';
if(!empty($cids)) {
$cids = substr($cids,0,-1);
$xcat = explode(',',$cids);
} else {
$xcat = array($defcat);
}
}
}
} else {
$fid = 'ef';
$bsave = '<input class="button-primary" type="submit" name="esubmit" value="Save Changes"/>';
$bpub = '<input class="button-primary" type="submit" name="psubmit" value="Publish"/>';
$xap = '';//executor autopublish
$xtemp = explode('[(.Y.)]',$ptemp);
$ptitle = $xtemp[1];
$xcat = explode(',',$xtemp[2]);
$ptags = $xtemp[3];
$pcontent = $xtemp[4];
if(empty($ptags)) {
$ptags = ss_autotags3($kueri);
} else {}
}
echo '<form id="'.$fid.'" action="'.$purl.'" method="post">';
/*Dari sini*/
echo '<p><label>Post Title</label><input type="text" name="ptitle" value="'.$ptitle.'" required/></p>';
$cats = get_categories('hide_empty=0&hierarchical=0');
echo '<div><label>Category</label><div class="ed mb">';
foreach($cats as $cat) {
$catid = $cat->term_id;
$catname = $cat->name;
if(in_array($catid,$xcat)) {
$cekit = ' checked="checked"';
} else {
$cekit = '';
}
echo '<label><input type="checkbox" name="pcat[]" value="'.$catid.'"'.$cekit.'/> '.$catname.'</label>';
}
echo '<div class="c"></div></div></div>';
//echo '<p><label>Tags</label><input type="text" name="ptags" value="'.$ptags.'" required/></p>'; iki input tags
echo '<p><label>Content</label><i class="ed mb"><textarea name="pcontent">'.$pcontent.'</textarea></i></p>';
/*END OFPOST TITLE, KONTEN, CATEGORY, TAGS-----------------------*/
$i = 1;
foreach($datas as $data) {
$api_id = $data->api_id;
$api_query = $data->api_query;
$api_title = $data->api_title;
$api_url = $data->api_url;
$api_content = $data->api_content;
$api_via = $data->api_via;
$api_wh = $data->api_wh;
$api_tmb = $data->api_tmb;
$api_ref = $data->api_ref;
$api_ext = $data->api_ext;
//$api_title = str_replace('','',$)
if($autopublish == 'yes') {
$tmb_url = '';
} else {
$tmb_url = $ixurl.$api_url.'?w=150&h=150&crop=faces&fit=crop';
}
echo '<input type="hidden" name="aid['.$i.']" value="'.$api_id.'">';
echo '<div>
<div class="ei"><img src="'.$tmb_url.'"/></div>
<input type="text" name="atitle['.$i.']" value="'.$api_title.'"/>
<input type="text" name="adesc['.$i.']" value="'.$api_content.'"/>
<input type="text" name="avia['.$i.']" value="'.$api_via.'"/>
<input type="text" name="aurl['.$i.']" value="'.$api_url.'"/>
<input type="text" name="awh['.$i.']" value="'.$api_wh.'"/><br/>
<input type="checkbox" name="exc['.$i.']" value="1"/> Exclude
</div><hr/>';
$i++;
}
echo '<p class="psbmt">'.$bsave.$bpub.'
</p>';
echo '</form>'.$xap;
} else {
echo '<p class="rd">Beloom ada data broo usung-usung data dulu.......!!!!</p>';
}
echo '</div>
</div>';
}
/*END OF FUNCTION API PUBLISH-------------------*/
/*FUNCTION ATTACHMENT FLOW-------------------*/
function cw_attach_page() {
global $wpdb;
$purl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api-publish';
$aturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-attach';
$latflow = get_option('latflow');
$aretry = get_option('autoretry');
echo '<div class="wrap">
<h2>Api Attachment Flow :</h2>
<div class="inside">';
if(isset($_REQUEST['atflow']) && !empty($_REQUEST['pid'])) {//logika pengecekan user yang masuk ke attachment flow
echo '<p class="gr">Attachment Flow disini mbroo....</p>';
$pid = $_REQUEST['pid'];
$aidx = $_REQUEST['aidx'];
$pos = get_post($pid);
$postitle = $pos->post_title;
$posdate = $pos->post_date;
$kueri = base64_decode($pos->pinged);
$imgs = explode('[(.Y.)]',$pos->post_excerpt);
$img = explode('[{|}]',$imgs[$aidx]);
$timg = count($imgs);
//ENDIT
if($aidx > ($timg-1)) {
echo '<hr class="gr">Wes kelar bikin attachment mbroo...</h2>';
/*NEXT
1. Kosongkan Data Excerpt (post_excerpt)
2. Update Draft jadi Publish/schedule/future (post_status)
3. Kosongin ptemp
4. Update lpurl
*/
//AMBIL DATA ATTACHMENT=============
$args = array(
'numberposts' => -1,
'order' => 'ASC',
'post_mime_type' => 'image',
'post_parent' => $pid,
'post_status' => null,
'post_type' => 'attachment',
);
$atts = get_children( $args );
$atlimit = 10;//komposisi 3,3,4
$ai = 1;
$attpar = '';
foreach($atts as $att) {
if($ai > $atlimit) {
break;
} else {
if($ai == 3 || $ai == 6) {
$sparator = "
";
} else {
$sparator = ' ';
}
$atid = $att->ID;
$ext = str_replace('image/','',$att->post_mime_type);
$fi = wp_get_attachment_image_src($atid,'full');
$attpar .= ucfirst(strtolower(str_replace('-',' ',str_replace('.'.$ext,'',basename($fi[0]))))).'.'.$sparator;//menghilangkan http://domainmu.com basename()
}
$ai++;
}
$attpar .= '';
$attpar = '<blockquote>'.str_replace(array("
","
"," "),'',wpautop($attpar)).'</blockquote>';
$abdet = $wpdb->query("UPDATE $wpdb->posts SET
post_content = '".$attpar."',
post_excerpt = '',
post_status = 'draft'
WHERE ID = $pid");
if($abdet !== false) {
$lpurl = get_option('lpurl');
parse_str($lpurl,$lp);
$idx = $lp['idx'];
update_option('ptemp','');
update_option('lpurl',$purl.'&idx='.($idx+1));
echo '<meta http-equiv="refresh" content="1; url='.$purl.'"/>';
} else {
echo '<p class="rd">Update Status Publish Gagal Mbroo</p>';
$wpdb->show_errors();
$wpdb->print_error();
}
} else {
$imgtitle = $img[0];
$imgurl = $img[1];
$imgvia = $img[2];
$imgext = $img[3];
if(empty($imgext)) {
$imgext = 'jpg';
} else {}
echo '<a href="'.$aturl.'" class="button-primary r">Pause</a>
<p>
<label>Currently Processing </label>: '.$imgtitle.' ['.($aidx+1).' of '.$timg.']<br/>
<label>Image Url </label>: '.$imgurl.'<br/>
<label>Image Via </label>: '.$imgvia.'<br/>
<label>Extension </label>: '.$imgext.'
</p><div class="res">';
//print_r($img);
/*Insert attachment*/
$wp_upload_dir = wp_upload_dir();
/*Construksi new file
1. Judul Post
2. Judul Gambar
3. Kueri
4. Nama File
5. Kategory*
6. Tags*
PR
=============
BAHASLAH Nfile berisi komponen apa aja?????
*/
$new_image_format = explode('[(.Y.)]',get_option('new_image_format'));
//CATEGORY
if(in_array('cats',$new_image_format)) {
$cats = get_the_category($pid);
//print_r($cats);
$catname = $cats[0]->name.' ';
} else {
$catname = ''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
}
//TAGS
if(in_array('tags',$new_image_format)) {
$tags = get_the_tags($pid);
shuffle($tags);
$i = 1;
$tagname = ''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
foreach($tags as $tag) {
if($i>15) {
} else {
$tagname .= $tag->name.''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
}
$i++;
}
$tagname .= '';// BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
} else {
$tagname = ',';
}
/*Postitle*/
if(!in_array('postitle',$new_image_format)) {
$postitle = '';
} else {}
//Imgtitle
if(!in_array('imgtitle',$new_image_format)) {
$imgtitle = '';
} else {}
/*Kueri*/
if(!in_array('kueri',$new_image_format)) {
$kueri = '';
} else {}
/*Imgurl*/
if(!in_array('imgurl',$new_image_format)) {
$imgname = ' ';// BISA BUAT RENAME GAMBAR KOHKONO
} else {
$imgname = str_replace('.'.$imgext,'',basename($imgurl)).' ';
}
$str2aan = array(
/*Space*/
' ',' ',' ',
/* Number */
'0','1','2','3','4','5','6','7','8','9',
/* rem2sp*/
'%','=','?','&',';',',','','Part','!','~ ','(',')','','|','[',']','{','}','...','..','.',':','/','_','+','-','','','','','','','#','','','','','*','@','$',"'",'"','--','wikimedia commons','.','www','download','8 Ball','eBay','ebay','decobizz','e-bay','free','visit','hgtv','houzz','freshome','homedsgn','youtube','read ','avanesova','on pinterest','india','ltd','maxresdefault','blogs ',' blogs','glubvon','etsy',' blogs ','moyuc',' dsc',' dsc ','dsc ','pinterest',' find ','wallpapers','wallpaper','domain','sale','wikipedia',' img ','img ',' img','kenthus','xyz','singaporeconcoclassified','deviantart','wikimedia',' wikipedia','essaypedia','maxresde',
/* extensi */
'.jfif','jpg','.jpeg','.exif','.tiff','.rif','.gif','.bmp','.png','.ppm','.pgm','.pbm','.pnm','.webp','.jfif','.jpg','.jpeg','.exif','.tiff','.rif','.gif','.bmp','.png','.ppm','.pgm','.pbm','.pnm','.webp','pdf',
/* country */
'afghanistan','albania','algeria','andorra','angola','antigua and barbuda','argentina','armenia','australia','austria','azerbaijan','bahamas','bahrain','bangladesh','barbados','belarus','belgium','belize','benin','bhutan','bolivia','bosnia and herzegovina','botswana','brazil','brunei','bulgaria','burkina faso','burundi','cabo verde','cambodia','cameroon','central african republic','chile','china','colombia','comoros','democratic republic of the congo','republic of the congo','costa rica','cote d ivoire','croatia','cuba','cyprus','czech republic','denmark','djibouti','dominica','dominican republic','ecuador','egypt','el salvador','equatorial guinea','eritrea','estonia','ethiopia','fiji','finland','france','gabon','gambia','georgia','germany','ghana','greece','grenada','guatemala','guinea','guinea-bissau','guyana','haiti','honduras','hungary','iceland','india','indonesia','iran','iraq','ireland','israel','italy','jamaica','japan','jordan','kazakhstan','kenya','kiribati','kosovo','kuwait','kyrgyzstan','laos','latvia','lebanon','lesotho','liberia','libya','liechtenstein','lithuania','luxembourg','macedonia','madagascar','malawi','malaysia','maldives','malta','marshall islands','mauritania','mauritius','micronesia','moldova','monaco','mongolia','montenegro','morocco','mozambique','myanmar (burma)','namibia','nauru','nepal','netherlands','new zealand','nicaragua','niger','nigeria','north korea','norway','pakistan','palau','palestine','panama','papua new guinea','paraguay','philippines','poland','portugal',
/* nama blog2 */
'aida','freshome','decoist','khvost',' Zisne','source','via','luisquin','blog','blogspot','attachment','signature','HGTV’s','1000+','traba',
/* Bulan */
'january','february','march','april','may','june','july','august','september','october','november','december');
$niraw = array($catname,$tagname,$postitle,$imgtitle,$kueri);
shuffle($niraw);
$climit = 750;
$niraw = str_replace('%','',sanitize_title_with_dashes(trim(implode(' ',$niraw))));
$niraw = implode('-',array_splice(array_unique(explode('-',$niraw)),0,$climit));
$xnraw = explode('-',$niraw);
$niraw = str_replace('-'.end($xnraw),'',$niraw);
$direplacapakeini = "";
$imgtitle = str_ireplace($str2aan,'',$imgtitle);
$parse = parse_url($imgurl);
$hoste = $parse['host'];
$host_names = explode(".", $hoste);
$domuta = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
$arradom = array( 's-media-cache-ak0.pinimg.com','hgtvhome.sndimg.com','1.bp.blogspot.com','2.bp.blogspot.com','3.bp.blogspot.com','4.bp.blogspot.com','5.bp.blogspot.com','6.bp.blogspot.com','7.bp.blogspot.com','8.bp.blogspot.com','9.bp.blogspot.com','pinimg.com','sndimg.com','homedepot.com','tinypic.com','staticflickr.com' );
if ( ! in_array($parse['host'], $arradom ) ) {
$imgname = str_ireplace('.'.$imgext,'',basename($imgurl));
} else {
$imgname = '';
}
$imgname = str_ireplace(array('0','1','2','3','4','5','6','7','8','9','@','-','%','_','+','pdf','.jpg.rend.','hgtvcom','',' . ','.',' a ',' b ',' c ',' d ',' e ',' f ',' g ',' h ',' i ',' j ',' k ',' l ',' m ',' n ',' o ',' p ',' q ',' r ',' s ',' t ',' u ',' v ',' w ',' x ',' y ',' z '),' ',$imgname);
$namadom = $parse['host'];
$namadom = ucwords(strtolower(str_ireplace(array('www','.','-'),'',$namadom)));
$imgtitle = str_ireplace(array('cdn'.$namadom.'',''.$namadom.'couk',''.$namadom.'xyz',''.$namadom.'tk',''.$namadom.''),'',$imgtitle);
$niraw = str_ireplace(array('.com','.net','xyz','.co.uk','.tk','.','-','|','.','jpg','_','"'),'',$niraw);
function some_function($limiten){
$limiten = substr($limiten,0,45);
$limiten = substr($limiten,0,strrpos($limiten," "));
return $limiten;
}
$lmgambar = some_function($imgname);
/*Tambahan Variasi*/
$enake = array('2017','inspirations','trends','images','pictures');
shuffle($enake);
$sambung = array('newest','latest','makeovers');
shuffle($sambung);
$niraw = strtolower($imgtitle.' '.$sambung[0].' '.$kueri);
$niraw = implode(' ',array_unique(explode(' ', $niraw))); //menghilangkan duplikat kata "yg dihapus kata terahir"
$niraw = str_replace(array(' ',' ',' ',' ',' '),' ',$niraw);
echo '<label>Kw ku </label>: '.$postitle.'<br/><br/>';
//echo 'Domain ='.$namadom.'<br/><br/>';
echo '<label>Image Name Asli </label>: '.$imgname.'<br/><br/>';
echo '<label>Image Limit </label>: '.$lmgambar.'<br/><br/>';
//echo 'img t ='.$imgtitle.'<br/><br/>';
//Variable New FILE
$gamtitle = $niraw;
$gamtitle = str_replace(' ','-',$niraw);
$newfile = $gamtitle.'.'.$imgext;
$new_title = ucwords(str_replace('-',' ',$niraw)).' ';
$wp_upload_dir = wp_upload_dir();
$guid = $wp_upload_dir['url'].'/'.$newfile;
$filename = $wp_upload_dir['path'].'/'.$newfile;
$pu = parse_url($imgurl);
$sdomain = $pu['scheme'].'://'.$pu['host'];
if(strpos($imgvia,'youtube.com') !== false) {
$imgurl = str_replace('https://','http://',$imgurl);
} else {}
if(pin6($pu['host'])) {//handle request gak ada jawaban
$savim = js_getimages($newfile,$imgurl,$sdomain);
} else {
$savim = false;
}
echo '<label>File Akhir </label>: '.$newfile.'<br/><br/>';
if($savim) {
echo '<p class="gr">Gambar berhasil disimpan</p>';
update_option('autoretry',0);
/*Construksi tanggal*/
$today = $posdate;
//$plusday = mt_rand(1,365);
$plusday = 0;
$plushour = 0;
$plousmin = mt_rand(1,59);
$ploussec = mt_rand(1,59);
$newdate = date('Y-m-d H:i:s',strtotime('+'.$plusday.' day +'.$plushour.' hour +'.$plousmin.' minutes +'.$ploussec.' seconds',''.strtotime($today)));
// Prepare an array of post data for the attachment.
$attachment = array(
'guid' => $guid,
'post_mime_type' => 'image/'.$imgext,
'post_title' => $niraw,
'post_name' => sanitize_title_with_dashes($niraw),
'post_content' => $imgurl,
'post_date' => $newdate,
'post_date_gmt' => $newdate,
'post_modified' => $newdate,
'post_modified_gmt' => $newdate,
'post_status' => 'inherit'
);
// Insert the attachment.
$attach_id = wp_insert_attachment( $attachment, $filename, $pid );
// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
require_once( ABSPATH . 'wp-admin/includes/image.php' );
// Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
/*TRANSISI ATTACHMENT*/
$requrl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.($aidx+1);
$reload = mt_rand(3,5);
update_option('latflow',$requrl);
echo '<style>#jload {width:100%;height:5px; padding:0; margin:10px auto; background:#ddd;position:relative;}.expand {width:100%;height:5px; margin:0; background:#390; position:absolute;box-shadow:0 1px 0 0 rgba(255,255,255,1.0); -moz-animation:fullexpand '.$reload.'s ease-out;-webkit-animation:fullexpand '.$reload.'s ease-out;}@-moz-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}@-webkit-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}</style>';
echo '<div id="lw"><div id="jload"><span class="expand"></span></div></div>';
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$requrl.'"/>';
//disini
} else {
$reload = mt_rand(3,5);
$rturl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.$aidx;
$requrl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.($aidx+1);
echo '<p class="rd">Gambar gagal disimpan</p>';
echo '<p>
<a href="'.$rturl.'" class="button-primary">Retry</a>
<a href="'.$requrl.'" class="button-primary">Skip</a>
</p>';
//Auto skip
stream_context_set_default(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
));
$gh = get_headers($imgurl);
if(strpos($gh[0],'404 Not Found') !== false || ($aretry>3)) {
echo '<meta http-equiv="refresh" content="1; url='.$requrl.'"/>';
} else {
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$rturl.'"/>';
update_option('autoretry',($aretry+1));
}
/*KETIKA GAMBAR GAGAL DISIMPAN
1. tombol retry (auto retry)
2. 2x retry
3. Cek koneksi, jika masih gagal
4. lanjut berikutnya jika koneksi ada
5. stop jika gak ada koneksi
NOTE
Apabila url gambar dengan via gambar berbeda domain, gambar akan disimpan
*/
}
//print_r($new_image_format);
exit;
echo '</div>';
}
} else {
/*Tombol Resume
- Akan muncul bila pernah pencet tombol pause di attachment flow
*/
if(!empty($latflow)) {
echo '<a href="'.$latflow.'" class="button-primary">Resume</a>';
} else {
echo '<h2 class="rd">Ra ono opo2 mbroo!!!! </h2>';
}
}
exit;
echo '</div>
</div>';
}
/*END OF ATTACHMENT FLOW-------------------*/
/*FUNCTION ARRAY MAKER-------------------*/
function cw_addquery_page() {
$arurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-addquery';
$aurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api';
echo '<div class="wrap">
<h2>Add Query</h2>
<div class="inside">';
/*02. HANDLER*/
if(isset($_POST['arsubmit'])) {
$issubmit = true;
$kwdss = $_POST['kwds'];
} else {
$issubmit = false;
$kwdss = '';
}
/*02. END OFF HANDLER*/
/*03. EXECUTE*/
if($issubmit) {
$kfile = TEMPLATEPATH.'/geni/kwds.php';
$bfile = TEMPLATEPATH.'/geni/badwords.php';
include($bfile);
if(file_exists($kfile)) {
include($kfile);
//$klama = "'".implode("','",$kwds)."',";
$klama = implode(",",$kwds).",";
} else {
$klama = '';
}
$xk = explode("
",$kwdss);
$kueri = '';
foreach($xk as $kw) {
$kw = str_replace(array("
","
"),'',$kw);
//$badwords
//print_r($badwords);
//exit;
$isbad = '';
foreach($badwords as $bw) {
if($bw == $kw || (strpos($kw,$bw) !== false)) {
$isbad = '1';
} else {}
}
$isbad .= '';
if(!empty($isbad)) {} else {
$kueri .= $kw.',';
}
}
$kueri .= '';
$kueri = substr($kueri,0,-1);
if(empty($kueri)) {
$ktulis = true;
} else {
$xkueri = array_unique(explode(',',$klama.$kueri));
$isikueri = "'".implode("','",$xkueri)."'";
$vkueri = "<?php
".'$kwds = array('.$isikueri.'); '."
?>";
$ktulis = file_put_contents($kfile,$vkueri,LOCK_EX);
}
if($ktulis !== false) {
echo '<p class="gr">Query berhasil tersimpan mbro</p><meta http-equiv="refresh" content="2; url='.$aurl.'"/>';
} else {}
} else {
/*01. FORM
- action = tujuan dikirimkan data
- method = cara dikirimkan data
- post = ngirim - selalu digunakan untuk aplikasi
- get = ngambil
- request = meminta - selalu digunakan di URL
*/
echo '<form action="'.$arurl.'" method="post">
<textarea name="kwds" required></textarea>
<input type="submit" name="arsubmit" value="kirim" class="button-primary"/>
</form>';
/*END OFF FORM*/
}
echo '</div>
</div>';
}
/*END OF ARRAY MAKER-------------------*/
/*FUNCTION GET RELATED-------------------*/
function cw_getrel_page() {
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF FUNCTION GET RELATED-------------------*/
/*FUNCTION API SETTINGS-------------------*/
function cw_apisetting_page() {
$aseturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-apisetting';
$niformat = explode('[(.Y.)]',get_option('new_image_format'));
$autopublish = get_option('autopublish');
$autocat = get_option('autocat');
$autosize = get_option('autosize');
$metadata = get_option('metadata');
$dpost = get_option('dpost');
$rti = get_option('rti');
echo '<div class="wrap">
<h2>Api Settings</h2>
<div class="inside">';
/*HANDLER*/
if(isset($_POST['asubmit'])) {
$issubmit = true;
$newimageformat = $_POST['new_image_format'];
$autopublish = $_POST['autopublish'];
$autocat = $_POST['autocat'];
$autosize = $_POST['autosize'];
$metadata = $_POST['metadata'];
$dpost = $_POST['dpost'];
$rti = $_POST['rti'];
//print_r($newimageformat);
update_option('new_image_format',implode('[(.Y.)]',$newimageformat));
update_option('autopublish',$autopublish);
update_option('autocat',$autocat);
update_option('autosize',$autosize);
update_option('metadata',$metadata);
update_option('dpost',$dpost);
update_option('rti',$rti);
echo '<meta http-equiv="refresh" content="0; url='.$aseturl.'"/>';
} else {}
/*END HANDLER*/
echo '<form action="'.$aseturl.'" method="post">';
echo '<h3>New Image Format</h3><p>';
$nif = array('postitle','imgtitle','kueri','imgurl','cats','tags');
foreach($nif as $ni) {
if(in_array($ni,$niformat)) {
$cekit = 'checked';
} else {
$cekit = '';
}
echo '<input type="checkbox" name="new_image_format[]" value="'.$ni.'" '.$cekit.'/> '.$ni.'';
}
echo '</p><br/>';
echo '<h3>Auto Publish</h3>';
echo '<p><label>Active</label>
<select name="autopublish" required>
<option value="">Select</option>
<option value="yes" '.im_checkit($autopublish,'yes',false).'>Yes</option>
<option value="no" '.im_checkit($autopublish,'no',false).'>No</option>
</select>
</p>';
echo '<h3>Auto Publish Category</h3>';
echo '<p><label>Active</label>
<select name="autocat" required>
<option value="">Select</option>
<option value="catauto" '.im_checkit($autocat,'catauto',false).'>Auto Detect</option>
<option value="catdefault" '.im_checkit($autocat,'catdefault',false).'>Default</option>
</select>
</p>';
echo '<h3>Sizeparameter</h3>';
echo '<p><label>Pilih</label>
<select name="autosize" required>
<option value="">Select</option>
<option value="size1" '.im_checkit($autosize,'size1',false).'>Large</option>
<option value="size2" '.im_checkit($autosize,'size2',false).'>X Large</option>
<option value="size3" '.im_checkit($autosize,'size3',false).'>1600 2MP</option>
<option value="size4" '.im_checkit($autosize,'size4',false).'>2272 4MP</option>
<option value="size5" '.im_checkit($autosize,'size5',false).'>2816 6MP</option>
</select>
</p>';
echo '<h3>Isi meta data</h3>';
echo '<p><label>Pilih</label>
<select name="metadata" required>
<option value="">Select</option>
<option value="metaauto" '.im_checkit($metadata,'metaauto',false).'>Yes</option>
<option value="metadefault" '.im_checkit($metadata,'metadefault',false).'>No</option>
</select>
</p>';
echo '<h3>Random total image</h3>';
echo '<p><label>Total Image</label><input type="text" name="rti" value="'.$rti.'" placeholder="18,26 atau 16,25 image....!!"/></p>';
echo '<h3>Date Post</h3>';
echo '<p><label>Pilih</label>
<select name="dpost" required>
<option value="">Select</option>
<option value="future" '.im_checkit($dpost,'future',false).'>Future</option>
<option value="bdate" '.im_checkit($dpost,'bdate',false).'>DRAFT</option>
</select>
</p>';
echo '<p><input class="green-primary" type="submit" name="asubmit" value="Save Changes"/>
</form>';
echo '</div>
</div>';
}
/*END OF FUNCTION API SETTINGS-------------------*/
/*FUNCTION API ACAK TANGGAL-------------------*/
function cw_apitanggal_page() {
$acturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-apitanggal';
echo '<div class="wrap">
<h2>Api Acak Tanggal</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF ACAK TANGGAL-------------------*/
/*FUNCTION API SANDBOX-------------------*/
function cw_apiimage_page() {
$apimg = get_option('siteurl').'/wp-admin/admin.php?page=cw-apiimage';
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF FUNCTION API SANDBOX-------------------*/
/*FUNCTION API SANDBOX-------------------*/
function cw_apisandbox_page() {
$sb_url = get_option('siteurl').'/wp-admin/admin.php?page=cw-apisandbox';
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo 'sandbox disini broo';
/*
include(TEMPLATEPATH.'/geni/kwds.php');
echo '<p><textarea>';
foreach($kwds as $kwd) {
echo $kwd."
";
}
echo '</textarea></p>';
*/
$host = 'googleecok.com';
$up = pin6($host);
if($up) {
echo 'hidup';
} else {
echo 'mati';
}
echo '</div>
</div>';
}
/*END OF FUNCTION API SANDBOX-------------------*/
/*FUNCTION CSS API-----------------------*/
function css_api() {
echo '<style type="text/css">
i{font-style:normal;}
.gy{color:#999;}
.gr{color:#390;}
.rd{color:#900;}
hr,.c{clear:both;}
hr{height:1px;border:0 none;background:#ddd;color:#ddd;}
.inside{background:#f9f9f9;border:1px solid #ddd;width:97%;margin-top:15px;}
.inside,.ei i{padding:15px;}
.inside,img,.ei{-moz-border-radius:3px;-webit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;}
.ei i{-moz-border-radius:300px;-webit-border-radius:300px;-khtml-border-radius:300px;border-radius:300px;}
textarea{width:98%;height:250px;}
#ef textarea{width:800px;height:100px;}
label,.ei{float:left;width:150px;}
.r{float:right}
select{width:150px;}
form,p,h2,h3,h4,h5,h6,hr,.mb{margin:0 0 15px 0;}
form p{margin-bottom:5px;}
#lw,.ei i{position:absolute}
#lw{width:100%;height:5px;top:0;}
.res,.ei{position:relative;}
.res{padding-top:30px;}
.ei{height:150px;overflow:hidden;margin:0 15px 15px 0 ;}
img,.gbr img,.ei img{width:100%;height:auto;}
.ei i{top:15px;left:15px;background:#fff;}
input[type="text"]{width:945px;}
.ed{margin-left:150px;}
.psbmt{position:fixed;top:50px;right:30px;}
a{transition:all 3s}
#wpbody .button,#wpbody .button-primary{margin-left:5px;}
#wpbody #af {padding:0;height:0;overflow:hidden;}
.green-primary {
background: #390 none repeat scroll 0 0;
border-color: #390 #390 #390;
border-radius:3px;
padding:5px;
border:0 none;
cursor:pointer;
color: #fff;
text-decoration: none;
text-shadow: 0 -1px 1px #390, 1px 0 1px #390, 0 1px 1px #390, -1px 0 1px #390;
</style>';
}
/*END OF FUNCTION CSS API----------------*/
/* CONTEKAN -------------------------
echo '<div class="wrap">
<h2>Nama Halaman</h2>
<div class="inside">';
echo '</div>
</div>';
-------------------------------------- */
?>
Did this file decode correctly?
Original Code
<?php
/*GENI Versi 4.01
- 23.08.2016
- 23:17
- Baransari, Sleman, Yogyakarta
- By : me
*/
/*API BACKEND*/
//include(TEMPLATEPATH.'/geni/apilibs.php');
/* JS Flamma7
** Version 2.03 [01.34 12/08/2016]
** $q : string. Query
** $z : string. Size
*/
function js_flamma7($q,$z) {
$ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0|Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0|Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1|Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0';$xua = explode('|',$ua); shuffle($xua); $theua = $xua[0]; $b = 'https://www.google.com/search?hl=en&site=imghp&tbm=isch'.$z.'&q='.urlencode($q); ini_set('user_agent',$theua); $g = file_get_contents($b,false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"Accept-language: en-us,en\r\n"))));if($g !== false) {$d = str_replace('</a><div class="rg_meta">','</a><i class="rg_meta">',str_replace('</div></div><!--n-->','</i></div></code><!--n-->',str_replace('<!--m-->','<!--m--><code>',$g)));$n=new DOMDocument();@$n->loadHTML($d);$c=$n->getElementsByTagName('code');$u=1;$av=array();foreach($c as $dv){$ei=$dv->getElementsByTagName('i');foreach($ei as $i){$j=json_decode($i->nodeValue);$imgurl=$j->ou;$pgurl=$j->ru;$v=$j->isu;$e=$j->ity;$width=$j->ow;$height=$j->oh;$sz=$j->os;$title=$j->pt;$desc=$j->s;$tmb=$j->tu;$tw=$j->tw;$th=$j->th;$av[]=array("url"=>$imgurl,"ref"=>$pgurl,"title"=>$title,"desc"=>$desc,"width"=>$width,"height"=>$height,"ext"=>$e,"sz"=>$sz,"via"=>$v,"tb"=>$tmb,"tw"=>$tw,"th"=>$th);}$u++;}$av[]='';return json_encode($av);}else{return '';}
}
/* JS Get Images v3.1b
** Created: 1:23 19/06/2015
$f : string. Nama file jadi.
$u : string. url asli image. (url target)
$r : string. url referrer
*/
function js_getimages($f,$u,$r) {
$updir = wp_upload_dir();
$d = $updir['path'];
//USER AGENTS
$ua = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0|Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0|Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0|Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0|Mozilla/5.0 (Windows NT 6.2; rv:22.0) Gecko/20130405 Firefox/23.0|Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20130406 Firefox/23.0|Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:23.0) Gecko/20131011 Firefox/23.0|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36|Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36|Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1464.0 Safari/537.36|Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/12.0.1453.93 Safari/537.36|Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14|Mozilla/5.0 (Windows NT 6.0; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 12.14|Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0) Opera 12.14|Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02|Opera/9.80 (Windows NT 6.1; U; es-ES) Presto/2.9.181 Version/12.00|Opera/9.80 (Windows NT 5.1; U; zh-sg) Presto/2.9.181 Version/12.00|Opera/12.0(Windows NT 5.2;U;en)Presto/22.9.168 Version/12.00|Opera/12.0(Windows NT 5.1;U;en)Presto/22.9.168 Version/12.00|Mozilla/5.0 (Windows NT 5.1) Gecko/20100101 Firefox/14.0 Opera/12.0|Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62|Opera/9.80 (Windows NT 6.0; U; pl) Presto/2.10.229 Version/11.62|Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52|Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)|Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)|Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)|Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)|Mozilla/1.22 (compatible; MSIE 10.0; Windows 3.1)|Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))|Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)';
$xua = explode('|',$ua);
shuffle($xua);
$theua = $xua[0];
//Set Headers
$hdrs = array(
"HTTP_FORWARDED: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_X_FORWARDED_FOR: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_CLIENT_IP: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_VIA: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_XROXY_CONNECTION: ".$_SERVER['REMOTE_ADDR']."",
"HTTP_PROXY_CONNECTION: ".$_SERVER['REMOTE_ADDR']."",
"Accept: text/xml,text/html,application/xhtml+xml,application/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Accept-Language: en-us,en",
"Cache-Control: max-age=0",
"Connection: keep-alive",
"Keep-Alive: 300",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Pragma: "
);
//Init Curl
$c = curl_init();
//Set Curl Options
curl_setopt($c, CURLOPT_URL, $u);
curl_setopt($c, CURLOPT_USERAGENT, $theua);
curl_setopt($c, CURLOPT_HTTPHEADER, $hdrs);
if(!empty($r)) {
curl_setopt($c, CURLOPT_REFERER, $r);
}
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($c, CURLOPT_CAINFO, dirname(__FILE__)."/cacert.pem");
//Execute & Return
$g = curl_exec($c);
//Close Curl
curl_close($c);
if(empty($g) || strpos($g,'<meta ') !== false || strpos($g,'<html') !== false || strpos($g,'<!DOCTYPE ') !== false || strpos($g,'<!doctype ') !== false) {
return false;
} else {
if (false === $g){
return false;
} else {
$put = file_put_contents($d.'/'.$f,$g);
if($put !== false) {
return true;
} else {
return false;
}
}
}
}
/*SUSU AUTOTAGS
** Simple auto tags
** $s : string. keyword
** $l : integer. limit
**
*/
function ss_autotags($s,$l) {
$s = urlencode($s);
$h = @file_get_contents("http://www.bing.com/AS/Suggestions?pt=page.serp&bq=&qry={$s}&cp=15&cvid=97b982e1e70345f5ae3df3d71e291859");
if(!empty($h)) {
$h = str_replace(array("<strong>","</strong>"),'',$h);
preg_match_all("/>([\w{3,}\s]+)</",$h,$m,PREG_SET_ORDER);
$r = array();
foreach($m as $k=>$v) { if($k == $l) break; $r[] = $v[1]; }
return implode(',', $r);exit;
}
}
/*SUSU AUTO TAGS LEVEL 3*/
function ss_autotags3($s) {
$t3 = ',';
$t1 = explode(',',ss_autotags($s,5));
foreach($t1 as $s1) {
$t2 = explode(',',ss_autotags($s1,7));
foreach($t2 as $s2) {
$t3 .= ss_autotags($s2,12);
}
}
$t3 .= '';
return $t3;
}
/*FUNCTION IM CHECKIT*/
function im_checkit($a,$b){
if($a==$b) {
return ' selected="selected"';
} else {
return '';
}
}
/* JS KS
** Simple Keyword Suggestion
** v1:02 23:45 02/02/2016
*/
function js_ks($s) {
$q = array();
ini_set('user_agent',$theua); $d = file_get_contents('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($s),false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"Accept-language: en-us,en\r\n"))));
if (($d = json_decode($d,true)) !== null) {$q = $d[1];}
return $q;
}
/* SIMPLE PIN6 */
function pin6($h,$p=80,$t=6){
$c = fsockopen($h,$p,$errno,$errstr,$t);
if(!$c) {return false;} else {return true;}
}
//ini_set('display_errors',0);
/*ADD OPTIONS*/
add_option('laurl','','','yes');//last progres api url
add_option('ptemp','','','yes');//data temporary post yang dipublish
add_option('lpurl','','','yes');//last progres publish url
add_option('new_image_format','','','yes');//new image format url
add_option('latflow','','','yes'); //last attachment flow progress
add_option('autopublish','','','yes'); //auto publish
add_option('autocat','','','yes'); //auto category
add_option('autosize','','','yes'); //auto category
add_option('metadata','','','yes'); //meta image data
add_option('dpost','','','yes'); //d post
add_option('rti','','','yes'); //random total image
add_option('autoretry','','','yes'); //auto retry
$ixurl = 'http://hackpad.imgix.net/';
add_action('init','cw_api_domain');
/* 0.1 FUNCTION TEXT DOMAIN--------------*/
function cw_api_domain() {
load_plugin_textdomain('kimcil',false,'kimcil');
}
/* 0.2 FUNCTION ICON---------------------*/
function cw_icon($d) {
$t = get_bloginfo('template_directory');
$i = $t.'/'.$d;
return $i;
}
/* 0.3 FUNCTION API MENU-----------------*/
add_action('admin_menu','cw_apimenu');
function cw_apimenu() {
/* 3.1 TOP MENU------------------------*/
if(function_exists('add_menu_page')) {
$topmenu = add_menu_page(
__('Api Page','kimcil'), //page title, text domain
__('API Backend','kimcil'), //menu label, text domain
'manage_options', // privilage (siapa yang boleh melihat menu ini)
'cw-api', //slug
'cw_api_page', //functiona page
'dashicons-shield', //icon 16x16px
'2' //posisi
);
add_action("admin_print_scripts-$topmenu",'css_api');
} else {}
/* 3.2 SUB MENU------------------------*/
if(function_exists('add_submenu_page')) {
//01. Pflow
$cwpflow = add_submenu_page( // variable publish flow
'cw-api', // slug dari top menu
__('Publish flow Page','kimcil'), //page title, text domain
__('Publish Flow','kimcil'), //menu label, text domain
'manage_options', //privilage
'cw-api-publish', //slug
'cw_publish' //function page
);
add_action("admin_print_scripts-$cwpflow",'css_api');
//02. attachment flow
$cwattach = add_submenu_page(
'cw-api',
__('Atachment Flow Page', 'kimcil'),
__('Attachment Flow', 'kimcil'),
'manage_options',
'cw-attach',
'cw_attach_page'
);
add_action("admin_print_scripts-$cwattach", 'css_api');
//03. Array Maker
$cwarray = add_submenu_page(
'cw-api',
__('Add Query Page', 'kimcil'),
__('Add Query', 'kimcil'),
'manage_options',
'cw-addquery',
'cw_addquery_page'
);
add_action("admin_print_scripts-$cwarray", 'css_api');
//04. Get Rel
$cwgetrel = add_submenu_page(
'cw-api',
__('Get Rel Page', 'kimcil'),
__('Get Rel', 'kimcil'),
'manage_options',
'cw-getrel',
'cw_getrel_page'
);
add_action("admin_print_scripts-$cwgetrel", 'css_api');
//05. API SETTING
$cwapisetting = add_submenu_page(
'cw-api',
__('JS Api Setting', 'ohyess'),
__('Api Setting', 'ohyess'),
'manage_options',
'cw-apisetting',
'cw_apisetting_page'
);
add_action("admin_print_scripts-$cwapisetting", 'css_api');
//05. API ACAK TANGGAL
$cwapitanggal = add_submenu_page(
'cw-api',
__('JS Api Shuffle Post Date', 'ohyess'),
__('Api Shuffle Post Date', 'ohyess'),
'manage_options',
'cw-apitanggal',
'cw_apitanggal_page'
);
add_action("admin_print_scripts-$cwapitanggal", 'css_api');
//05. API IMAGE
$cwapiimage = add_submenu_page(
'cw-api',
__('JS Api Add Attachment', 'ohyess'),
__('Api Add Attachment', 'ohyess'),
'manage_options',
'cw-apiimage',
'cw_apiimage_page'
);
add_action("admin_print_scripts-$cwapiimage", 'css_api');
//05. Sandbox
$cwapisandbox = add_submenu_page(
'cw-api',
__('API SANDBOX', 'kimcil'),
__('Sandbox', 'kimcil'),
'manage_options',
'cw-apisandbox',
'cw_apisandbox_page'
);
add_action("admin_print_scripts-$cwapisandbox", 'css_api');
} else {}
/*END OF SUBMENU-----------------------*/
}
/*END OF FUNCTION MENU-------------------*/
/*FUNCTION API PAGE----------------------*/
function cw_api_page() {
global $wpdb;
$aurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api';
$arurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-addquery';
$laurl = get_option('laurl');
$kfile = TEMPLATEPATH.'/geni/kwds.php';
echo '<div class="wrap">
<h2>API Backend</h2>
<div class="inside">';
/*Pengecekan tabel api exists atau belum*/
$tbname = 'wp_apidata';
if($wpdb->get_var("SHOW TABLES LIKE '$tbname' ") != $tbname) {
$tbono = false;
} else {
$tbono = true;
}
if(!$tbono) {
$charsetc = $wpdb->get_charset_collate();
$tb1 = 'wp_apidata';
$tb2 = 'wp_apiquery';
$ctb1 = "CREATE TABLE $tb1 (
api_id bigint(20) unsigned NOT NULL auto_increment,
api_query varchar(200) NOT NULL,
api_title text NOT NULL,
api_url varchar(512) NOT NULL,
api_content text NOT NULL,
api_via text NOT NULL,
api_wh text NOT NULL,
api_ext text NOT NULL,
api_tmb text NOT NULL,
api_ref text NOT NULL,
api_size text NOT NULL,
api_status varchar(7) NOT NULL,
UNIQUE KEY api_id (api_id),
KEY api_url (api_url),
KEY api_query (api_query),
KEY api_status (api_status)
) $charsetc;";
$ctb2 = "CREATE TABLE $tb2 (
api_id bigint(20) unsigned NOT NULL auto_increment,
api_query varchar(200) NOT NULL,
api_rel longtext NOT NULL,
api_status varchar(7) NOT NULL,
UNIQUE KEY api_id (api_id),
KEY api_query (api_query),
KEY api_status (api_status)
) $charsetc;";
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
dbDelta($ctb1);
dbDelta($ctb2);
/*ISI DEFAULT API SETTINGS*/
update_option('new_image_format','postitle[(.Y.)]imgtitle[(.Y.)]kueri[(.Y.)]imgurl[(.Y.)]cats[(.Y.)]tags');
update_option('autopublish','yes');
update_option('autocat','catdefault');
update_option('autosize','size1');
update_option('metadata','metadefault');
update_option('dpost','future');
update_option('rti','18,26');
echo '<p>Lagi bikin tabel mbro tinggal udud sek....!!!</p>
<meta http-equiv="refresh" content="2; url='.$aurl.'"/>';
exit;
} else {}
/*CHECK KUERI FILE*/
if(!file_exists($kfile)) {
echo '<meta http-equiv="refresh" content="0; url='.$arurl.'"/>';
exit;
} else {}
/*02. HANDLER*/
if(isset($_POST['apisubmit'])) {
$issubmit = true;
$idx = 0;
} elseif(isset($_REQUEST['rsubmit'])) {
$issubmit = true;
$idx = $_REQUEST['idx'];
} else {
$issubmit = false;
$idx = 0;
}
/*03. KONFIRMASI*/
if(empty($laurl)) {
$sb = '<input class="button-primary" type="submit" name="apisubmit" value="Angkut Mbro..."/>';
} else {
parse_str($laurl,$la);
if($issubmit) {} else {
$idx = $la['idx'];
}
$sb = '<a href="'.$laurl.'" class="button-primary">Resume</a>';
}
include($kfile);
$tk = count($kwds);
$kueri = $kwds[$idx];
/*06. ENDIT*/
if($idx>($tk-1)) {
echo '<h2 class="gr">Kelar Mbroo...!!!</h2>';
} else {
echo '<p>
<label>Prosessing</label>: '.$kueri.'<br/>
<label>Number</label>: '.number_format($idx+1).' of '.number_format($tk).'<br/>
</p>';
/*01. FORM*/
echo '<form action="'.$aurl.'" method="post">
'.$sb.'
<a href="'.$aurl.'" class="button">Pause</a>
</form>';
/*04. EXECUTE*/
if($issubmit) {
ini_set('display_errors',0);
echo '<div class="res">';
/*Insert Database---------------------------------------------*/
$sizes = array(
"size1"=>"isz:l",
"size2"=>"isz:lt,islt:xga",
"size3"=>"isz:lt,islt:2mp",
"size4"=>"isz:lt,islt:4mp",
"size5"=>"isz:lt,islt:6mp"
);
$settingsize = get_option('autosize');
$size = '&tbs='.$sizes[$settingsize];
//$kueri = $kueri.' site:netcarshow.coom';//contoh pengambilan data spesifik dari website tertentu
$r = js_flamma7($kueri,$size);
if(!empty($r)) {
$r = json_decode($r);
//echo '<pre>'.print_r(json_decode($r),true).'</pre>';
//print_r($r);
$i = 1;
foreach($r as $d) {
if(empty($d)) {} else {
$url = $d->url;
$ref = $d->ref;
$title = remove_accents($d->title);
$desc = $d->desc;
$width = $d->width;
$height = $d->height;
$wh = $width.'_'.$height;
$ext = $d->ext;
$sz = $d->sz;
$via = $d->via;
$tb = $d->tb;
$tw = $d->tw;
$th = $d->th;
$tmb = $tb.'_'.$tw.'_'.$th;
//echo '<img src="'.$tb.'" alt=""/>';
/*DETECT URL GAMBAR*/
$eurl = urlencode(basename($url));
if(strpos($eurl,'%') !== false) {
} else {
/*DATA EXISTENCE CHECK----------------------------pengecekan data sudah ada atau belum*/
$datachk = $wpdb->get_var( "SELECT COUNT(api_id) FROM wp_apidata WHERE api_query = '".$kueri."' AND api_url = '".$url."' " );
if($datachk>0) {
echo '<span class="rd">Data '.$title.' sampun disimpen mbro ampun nyimpen malih nggih...</span><br/>';
} else {
/*Penyimpanan data*/
$savit = $wpdb->query( $wpdb->prepare("INSERT INTO wp_apidata
(api_query,api_title,api_url,api_content,api_via,api_wh,api_ext,api_tmb,api_ref,api_size,api_status)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
$kueri,$title,$url,$desc,$via,$wh,$ext,$tmb,$ref,$z,''
));
if($savit !== false) {
echo '<span class="gr">Data '.$title.' sampun dados disimpen mbro...</span><br/>';
} else {
$err .= '1';
echo '<span class="rd">Data '.$title.' mboten dados disimpen mbro...</span><br/>';
$wpdb->show_errors();
$wpdb->print_error();
}
}
}
/*echo '<img src="'.$tb.'" alt=""/>';
echo $i.'. '.$title.'<br/>';
echo $width.'x'.$height.'<br/>';
echo $desc.'<br/>';
echo $ext.'<br/>';
echo $via.'<br/>';
echo '<hr/>';*/
}
$i++;
}
$err .= '';
if(!empty($err)) {
echo '<p class="rd">Wonten insertion database ingkang mboten dados, mboten saged nglanjut mbro...</p>';
} else {
/*05. TRANSISI*/
$requrl = $aurl.'&rsubmit=true&idx='.($idx+1);
$reload = mt_rand(3,5);
/*Last Progress*/
update_option('laurl',$requrl);
echo '<style>#jload {width:100%;height:5px; padding:0; margin:10px auto; background:#ddd;position:relative;}.expand {width:100%;height:5px; margin:0; background:#390; position:absolute;box-shadow:0 1px 0 0 rgba(255,255,255,1.0); -moz-animation:fullexpand '.$reload.'s ease-out;-webkit-animation:fullexpand '.$reload.'s ease-out;}@-moz-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}@-webkit-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}</style>';
echo '<div id="lw"><div id="jload"><span class="expand"></span></div></div>';
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$requrl.'"/>';
}
} else {
echo '<p class="rd">No Result</p>';
}
/*End of Insert database--------------------------------------*/
/*CATATAN
NEXT :
- Endit
http://localhost/api14/wp-admin/admin.php?page=cw-api&rsubmit=true&idx=19
- Insert Database
*/
echo '</div>';
} else {}
//disini
}
echo '</div>
</div>';
}
/*END OF FUNCTION API PAGE---------------*/
/*FUNCTION API PUBLISH-------------------*/
function cw_publish() {
global $wpdb,$ixurl;
$purl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api-publish';
$aturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-attach';
$laurl = get_option('laurl');
$lpurl = get_option('lpurl');
$ptemp = get_option('ptemp');
$autopublish = get_option('autopublish');
$rti = get_option('rti');
$dpost = get_option('dpost');
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
if(!empty($laurl)) {
include(TEMPLATEPATH.'/geni/kwds.php');
parse_str($laurl,$la);
$lidx = ($la['idx']-1);
if(empty($lpurl)) {
$idx = 0;
} else {
parse_str($lpurl,$lp);
$idx = $lp['idx'];
}
$kueri = $kwds[$idx];
echo '<p>';
echo '<label>Avaliable Data : </label>'.($lidx+1).' Data <br/>';
echo '<label>Currently Publishing : </label>'.$kueri.'<br/>';
echo '</p><hr/>';
$datas = $wpdb->get_results( "SELECT * FROM wp_apidata WHERE api_query = '".$kueri."' AND api_status='' ");
/*HANDLER RANDOM TOTAL IMAGE*/
$xrti = explode(',',$rti);
if(count($datas) < $xrti[0] || count($datas) > $xrti[1]) {
$ri = mt_rand($xrti[0],($xrti[1]-1));
$i =1;
foreach($datas as $data) {
$aid = $data->api_id;
if($i>$ri) {
$apdet = $wpdb->query("UPDATE wp_apidata SET api_status = 'exclude' WHERE api_id = $aid ");
} else {}
$i++;
}
echo '<meta http-equiv="refresh" content="0; url='.$purl.'"/>';
exit;
} else {}
/*HANDLER*/
if(isset($_POST['esubmit'])) {
$issubmit = true;
$du = 'edit';
$r2 = 'form';
} elseif(isset($_POST['psubmit'])) {
$issubmit = true;
$du = 'edit';
$r2 = 'publish';
} elseif(isset($_REQUEST['pflow'])) {
$issubmit = true;
$du = 'publish';
$r2 = '';
} else {
$issubmit = false;
$du = '';
$r2 = '';
}
/*EXECUTE*/
if($issubmit) {
if($du=='edit') {
$ptitle = $_POST['ptitle'];
$pcontent = $_POST['pcontent'];
$ptags = $_POST['ptags'];
if(empty($_POST['pcat'])) {
$pcat = '';
} else {
$pcat = implode(',',$_POST['pcat']);
}
$ptempdata = $kueri.'[(.Y.)]'.$ptitle.'[(.Y.)]'.$pcat.'[(.Y.)]'.$ptags.'[(.Y.)]'.$pcontent;
update_option('ptemp',$ptempdata);
$tdata = count($_POST['atitle']);
foreach(range(1,$tdata) as $i) {
$aid = $_POST['aid'][$i];
$atitle = $_POST['atitle'][$i];
$adesc = $_POST['adesc'][$i];
$aurl = $_POST['aurl'][$i];
$avia = $_POST['avia'][$i];
$awh = $_POST['awh'][$i];
if(!empty($_POST['exc'][$i])) {
$apdet = $wpdb->query("UPDATE wp_apidata SET api_status = 'exclude' WHERE api_id = $aid ");
} else {
$apdet = $wpdb->query("UPDATE wp_apidata SET
api_title = '".$atitle."',
api_content = '".$adesc."',
api_url = '".$aurl."',
api_wh = '".$awh."'
WHERE api_id = $aid ");
}
if($apdet !== false) {} else {
$err .= '1';
$wpdb->show_errors();
$wpdb->print_error();
}
}
$err .= '';
if(!empty($err)) {
echo '<p class="rd">Update data gagal mbro...</p>';
} else {
if($r2 == 'publish') {
$r2url = $purl.'&pflow=true';
} else {
$r2url = $purl.'';
}
echo '<p class="gr">Update data berhasil mbro...</p>'.
'<meta http-equiv="refresh" content="1; url='.$r2url.'"/>';
}
} elseif($du == 'publish') {
echo '<p>Publish disini mbro...</p>';
if(empty($ptemp)) {
echo '<p class="rd">Ada yang kosong dan kudu di isi broo...</p>
<a href="'.$purl.'" class="button-primary">Back</a>
';
} else {
/*==========POST EXISTANCE CHECK==========*/
$pchk = $wpdb->get_var( "SELECT COUNT(ID) FROM $wpdb->posts WHERE pinged = '".base64_encode($kueri)."' " );
if($pchk>0) {
echo '<p class="rd">Post ini sudah pernah terinsert broo</p>';
} else {
$xtemp = explode('[(.Y.)]',$ptemp);
$ptitle = $xtemp[1];
$xcat = explode(',',$xtemp[2]);
$ptags = $xtemp[3];
$pcontent = $xtemp[4];
$author= mt_rand(1,5);//==============edit author disini===============
/*Data Gambar*/
$pimgs = '';
$i = 1;
foreach($datas as $data) {
$api_title = $data->api_title;
$api_url = $data->api_url;
$api_ref = $data->api_ref;
$api_ext = $data->api_ext;
$pimgs .= $api_title.'[{|}]'.$api_url.'[{|}]'.$api_ref.'[{|}]'.$api_ext.
'[(.Y.)]';
$i++;
}
$pimgs .= '';
$pimgs = substr($pimgs,0,-7);
/*Construksi tanggal*/
$today = date('Y-m-d H:i:s');
//$plusday = mt_rand(1,365);
$plusday = 0;
$plushour = mt_rand(1,23);
$plousmin = mt_rand(1,59);
$ploussec = mt_rand(1,59);
if($dpost == 'backdate') {
$backfu = '-';
} else {
$backfu = '+';
}
$newdate = date('Y-m-d H:i:s',strtotime($backfu.$plusday.' day '.$backfu.$plushour.' hour '.$backfu.$plousmin.' minutes '.$backfu.$ploussec.' seconds',''.strtotime($today)));
// Create post object
$my_post = array(
'post_title' => $ptitle,
'post_name' => sanitize_title_with_dashes($ptitle),
'post_content' => $pcontent,
'post_excerpt' => $pimgs,
'post_status' => 'draft',//draft,publish,pending,schedule,future
'post_date' => $newdate,
'post_date_gmt' => $newdate,
'post_modified' => $newdate,
'post_modified_gmt' => $newdate,
'post_author' => $author,
'pinged' => base64_encode($kueri),
'post_category' => $xcat
);
// Insert the post into the database
$posid = wp_insert_post($my_post);
if(empty($posid)) {
echo '<p class="rd">Insert Post '.$ptitle.' Gagal mbroo...</p>';
$wpdb->show_errors();
$wpdb->print_error();
} else {
echo '<p class="gr">Insert Post '.$ptitle.' Berhasil mbroo...</p>';
//Insert tags
wp_add_post_tags($posid,$ptags);
echo '<meta http-equiv="refresh" content="1; url='.$aturl.'&atflow=true&pid='.$posid.'&aidx=0"/>';
/*NEXT
1. Transisi ke attachment flow
2. Definisi url halaman attachment flow
3. wp_insert_attachment -> fungsi yang akan kita pakai
4. Bahaslah
*/
}
}
}
} else {}
exit;
} else {}
/*DATA YANG AKAN DI PUBLISHKAN----------------------------------*/
//print_r($datas);
/*POST TITLE, KONTEN, CATEGORY, TAGS-----------------------------*/
if($autopublish == 'yes') {
$fid = 'af';
$bsave = '';
$bpub = '<input type="hidden" name="psubmit" value="Publish"/>';
$xap = '<script>document.getElementById("af").submit();</script>';//executor autopublish
$timg = count($datas);
$prefix = array('awesome','stunning','excelent','remarkable', 'extraordinary','staggering','incredible','outstanding','amazing','astonishing','marvelous','phenomenal','splendid','informalfabulous','fantastic','tremendous','jaw-dropping');
shuffle($prefix);
$suffix1 = array('picture','image','photo','pics','pictures','images');
shuffle($suffix1);
$suffix2 = array('ideas','inspirations');
shuffle($suffix2);
$ptitle = ucwords($kueri);
$ptags = ss_autotags3($kueri);
$pcontent = str_replace($str2rm,' ',$pcontent);
$defcat = get_option('default_category');
if($autocat == 'catdefault') {
$xcat = array($defcat);
} else {
$dcfile = TEMPLATEPATH.'/geni/defcat.php';
if(!file_exists($dcfile)) {
$xcat = array($defcat);
} else {
include($dcfile);
$cats = get_categories('hide_empty=0&hierarchical=0');
$cids = '';
foreach($cats as $cat) {
$catvar = ${str_replace('-','_',$cat->slug)};
//$catvar = $dining_room;
foreach($catvar as $cv) {
if(strpos(strtolower($kueri),strtolower($cv)) !== false) {
$cids .= $cat->term_id.',';
} else {}
}
}
$cids .= '';
if(!empty($cids)) {
$cids = substr($cids,0,-1);
$xcat = explode(',',$cids);
} else {
$xcat = array($defcat);
}
}
}
} else {
$fid = 'ef';
$bsave = '<input class="button-primary" type="submit" name="esubmit" value="Save Changes"/>';
$bpub = '<input class="button-primary" type="submit" name="psubmit" value="Publish"/>';
$xap = '';//executor autopublish
$xtemp = explode('[(.Y.)]',$ptemp);
$ptitle = $xtemp[1];
$xcat = explode(',',$xtemp[2]);
$ptags = $xtemp[3];
$pcontent = $xtemp[4];
if(empty($ptags)) {
$ptags = ss_autotags3($kueri);
} else {}
}
echo '<form id="'.$fid.'" action="'.$purl.'" method="post">';
/*Dari sini*/
echo '<p><label>Post Title</label><input type="text" name="ptitle" value="'.$ptitle.'" required/></p>';
$cats = get_categories('hide_empty=0&hierarchical=0');
echo '<div><label>Category</label><div class="ed mb">';
foreach($cats as $cat) {
$catid = $cat->term_id;
$catname = $cat->name;
if(in_array($catid,$xcat)) {
$cekit = ' checked="checked"';
} else {
$cekit = '';
}
echo '<label><input type="checkbox" name="pcat[]" value="'.$catid.'"'.$cekit.'/> '.$catname.'</label>';
}
echo '<div class="c"></div></div></div>';
//echo '<p><label>Tags</label><input type="text" name="ptags" value="'.$ptags.'" required/></p>'; iki input tags
echo '<p><label>Content</label><i class="ed mb"><textarea name="pcontent">'.$pcontent.'</textarea></i></p>';
/*END OFPOST TITLE, KONTEN, CATEGORY, TAGS-----------------------*/
$i = 1;
foreach($datas as $data) {
$api_id = $data->api_id;
$api_query = $data->api_query;
$api_title = $data->api_title;
$api_url = $data->api_url;
$api_content = $data->api_content;
$api_via = $data->api_via;
$api_wh = $data->api_wh;
$api_tmb = $data->api_tmb;
$api_ref = $data->api_ref;
$api_ext = $data->api_ext;
//$api_title = str_replace('','',$)
if($autopublish == 'yes') {
$tmb_url = '';
} else {
$tmb_url = $ixurl.$api_url.'?w=150&h=150&crop=faces&fit=crop';
}
echo '<input type="hidden" name="aid['.$i.']" value="'.$api_id.'">';
echo '<div>
<div class="ei"><img src="'.$tmb_url.'"/></div>
<input type="text" name="atitle['.$i.']" value="'.$api_title.'"/>
<input type="text" name="adesc['.$i.']" value="'.$api_content.'"/>
<input type="text" name="avia['.$i.']" value="'.$api_via.'"/>
<input type="text" name="aurl['.$i.']" value="'.$api_url.'"/>
<input type="text" name="awh['.$i.']" value="'.$api_wh.'"/><br/>
<input type="checkbox" name="exc['.$i.']" value="1"/> Exclude
</div><hr/>';
$i++;
}
echo '<p class="psbmt">'.$bsave.$bpub.'
</p>';
echo '</form>'.$xap;
} else {
echo '<p class="rd">Beloom ada data broo usung-usung data dulu.......!!!!</p>';
}
echo '</div>
</div>';
}
/*END OF FUNCTION API PUBLISH-------------------*/
/*FUNCTION ATTACHMENT FLOW-------------------*/
function cw_attach_page() {
global $wpdb;
$purl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api-publish';
$aturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-attach';
$latflow = get_option('latflow');
$aretry = get_option('autoretry');
echo '<div class="wrap">
<h2>Api Attachment Flow :</h2>
<div class="inside">';
if(isset($_REQUEST['atflow']) && !empty($_REQUEST['pid'])) {//logika pengecekan user yang masuk ke attachment flow
echo '<p class="gr">Attachment Flow disini mbroo....</p>';
$pid = $_REQUEST['pid'];
$aidx = $_REQUEST['aidx'];
$pos = get_post($pid);
$postitle = $pos->post_title;
$posdate = $pos->post_date;
$kueri = base64_decode($pos->pinged);
$imgs = explode('[(.Y.)]',$pos->post_excerpt);
$img = explode('[{|}]',$imgs[$aidx]);
$timg = count($imgs);
//ENDIT
if($aidx > ($timg-1)) {
echo '<hr class="gr">Wes kelar bikin attachment mbroo...</h2>';
/*NEXT
1. Kosongkan Data Excerpt (post_excerpt)
2. Update Draft jadi Publish/schedule/future (post_status)
3. Kosongin ptemp
4. Update lpurl
*/
//AMBIL DATA ATTACHMENT=============
$args = array(
'numberposts' => -1,
'order' => 'ASC',
'post_mime_type' => 'image',
'post_parent' => $pid,
'post_status' => null,
'post_type' => 'attachment',
);
$atts = get_children( $args );
$atlimit = 10;//komposisi 3,3,4
$ai = 1;
$attpar = '';
foreach($atts as $att) {
if($ai > $atlimit) {
break;
} else {
if($ai == 3 || $ai == 6) {
$sparator = "\n\n";
} else {
$sparator = ' ';
}
$atid = $att->ID;
$ext = str_replace('image/','',$att->post_mime_type);
$fi = wp_get_attachment_image_src($atid,'full');
$attpar .= ucfirst(strtolower(str_replace('-',' ',str_replace('.'.$ext,'',basename($fi[0]))))).'.'.$sparator;//menghilangkan http://domainmu.com basename()
}
$ai++;
}
$attpar .= '';
$attpar = '<blockquote>'.str_replace(array("\n","\r","\t"),'',wpautop($attpar)).'</blockquote>';
$abdet = $wpdb->query("UPDATE $wpdb->posts SET
post_content = '".$attpar."',
post_excerpt = '',
post_status = 'draft'
WHERE ID = $pid");
if($abdet !== false) {
$lpurl = get_option('lpurl');
parse_str($lpurl,$lp);
$idx = $lp['idx'];
update_option('ptemp','');
update_option('lpurl',$purl.'&idx='.($idx+1));
echo '<meta http-equiv="refresh" content="1; url='.$purl.'"/>';
} else {
echo '<p class="rd">Update Status Publish Gagal Mbroo</p>';
$wpdb->show_errors();
$wpdb->print_error();
}
} else {
$imgtitle = $img[0];
$imgurl = $img[1];
$imgvia = $img[2];
$imgext = $img[3];
if(empty($imgext)) {
$imgext = 'jpg';
} else {}
echo '<a href="'.$aturl.'" class="button-primary r">Pause</a>
<p>
<label>Currently Processing </label>: '.$imgtitle.' ['.($aidx+1).' of '.$timg.']<br/>
<label>Image Url </label>: '.$imgurl.'<br/>
<label>Image Via </label>: '.$imgvia.'<br/>
<label>Extension </label>: '.$imgext.'
</p><div class="res">';
//print_r($img);
/*Insert attachment*/
$wp_upload_dir = wp_upload_dir();
/*Construksi new file
1. Judul Post
2. Judul Gambar
3. Kueri
4. Nama File
5. Kategory*
6. Tags*
PR
=============
BAHASLAH Nfile berisi komponen apa aja?????
*/
$new_image_format = explode('[(.Y.)]',get_option('new_image_format'));
//CATEGORY
if(in_array('cats',$new_image_format)) {
$cats = get_the_category($pid);
//print_r($cats);
$catname = $cats[0]->name.' ';
} else {
$catname = ''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
}
//TAGS
if(in_array('tags',$new_image_format)) {
$tags = get_the_tags($pid);
shuffle($tags);
$i = 1;
$tagname = ''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
foreach($tags as $tag) {
if($i>15) {
} else {
$tagname .= $tag->name.''; // BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
}
$i++;
}
$tagname .= '';// BISA BUAT RENAME GAMBAR KOHKONO DIAKHIR KLU MAU DISI KATA DIKASIH SPASI JUGA YA
} else {
$tagname = ',';
}
/*Postitle*/
if(!in_array('postitle',$new_image_format)) {
$postitle = '';
} else {}
//Imgtitle
if(!in_array('imgtitle',$new_image_format)) {
$imgtitle = '';
} else {}
/*Kueri*/
if(!in_array('kueri',$new_image_format)) {
$kueri = '';
} else {}
/*Imgurl*/
if(!in_array('imgurl',$new_image_format)) {
$imgname = ' ';// BISA BUAT RENAME GAMBAR KOHKONO
} else {
$imgname = str_replace('.'.$imgext,'',basename($imgurl)).' ';
}
$str2aan = array(
/*Space*/
' ',' ',' ',
/* Number */
'0','1','2','3','4','5','6','7','8','9',
/* rem2sp*/
'%','=','?','&',';',',','','Part','!','~ ','(',')','','|','[',']','{','}','...','..','.',':','/','_','+','-','','','','','','','#','','','','','*','@','$',"'",'"','--','wikimedia commons','.','www','download','8 Ball','eBay','ebay','decobizz','e-bay','free','visit','hgtv','houzz','freshome','homedsgn','youtube','read ','avanesova','on pinterest','india','ltd','maxresdefault','blogs ',' blogs','glubvon','etsy',' blogs ','moyuc',' dsc',' dsc ','dsc ','pinterest',' find ','wallpapers','wallpaper','domain','sale','wikipedia',' img ','img ',' img','kenthus','xyz','singaporeconcoclassified','deviantart','wikimedia',' wikipedia','essaypedia','maxresde',
/* extensi */
'.jfif','jpg','.jpeg','.exif','.tiff','.rif','.gif','.bmp','.png','.ppm','.pgm','.pbm','.pnm','.webp','.jfif','.jpg','.jpeg','.exif','.tiff','.rif','.gif','.bmp','.png','.ppm','.pgm','.pbm','.pnm','.webp','pdf',
/* country */
'afghanistan','albania','algeria','andorra','angola','antigua and barbuda','argentina','armenia','australia','austria','azerbaijan','bahamas','bahrain','bangladesh','barbados','belarus','belgium','belize','benin','bhutan','bolivia','bosnia and herzegovina','botswana','brazil','brunei','bulgaria','burkina faso','burundi','cabo verde','cambodia','cameroon','central african republic','chile','china','colombia','comoros','democratic republic of the congo','republic of the congo','costa rica','cote d ivoire','croatia','cuba','cyprus','czech republic','denmark','djibouti','dominica','dominican republic','ecuador','egypt','el salvador','equatorial guinea','eritrea','estonia','ethiopia','fiji','finland','france','gabon','gambia','georgia','germany','ghana','greece','grenada','guatemala','guinea','guinea-bissau','guyana','haiti','honduras','hungary','iceland','india','indonesia','iran','iraq','ireland','israel','italy','jamaica','japan','jordan','kazakhstan','kenya','kiribati','kosovo','kuwait','kyrgyzstan','laos','latvia','lebanon','lesotho','liberia','libya','liechtenstein','lithuania','luxembourg','macedonia','madagascar','malawi','malaysia','maldives','malta','marshall islands','mauritania','mauritius','micronesia','moldova','monaco','mongolia','montenegro','morocco','mozambique','myanmar (burma)','namibia','nauru','nepal','netherlands','new zealand','nicaragua','niger','nigeria','north korea','norway','pakistan','palau','palestine','panama','papua new guinea','paraguay','philippines','poland','portugal',
/* nama blog2 */
'aida','freshome','decoist','khvost',' Zisne','source','via','luisquin','blog','blogspot','attachment','signature','HGTV’s','1000+','traba',
/* Bulan */
'january','february','march','april','may','june','july','august','september','october','november','december');
$niraw = array($catname,$tagname,$postitle,$imgtitle,$kueri);
shuffle($niraw);
$climit = 750;
$niraw = str_replace('%','',sanitize_title_with_dashes(trim(implode(' ',$niraw))));
$niraw = implode('-',array_splice(array_unique(explode('-',$niraw)),0,$climit));
$xnraw = explode('-',$niraw);
$niraw = str_replace('-'.end($xnraw),'',$niraw);
$direplacapakeini = "";
$imgtitle = str_ireplace($str2aan,'',$imgtitle);
$parse = parse_url($imgurl);
$hoste = $parse['host'];
$host_names = explode(".", $hoste);
$domuta = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
$arradom = array( 's-media-cache-ak0.pinimg.com','hgtvhome.sndimg.com','1.bp.blogspot.com','2.bp.blogspot.com','3.bp.blogspot.com','4.bp.blogspot.com','5.bp.blogspot.com','6.bp.blogspot.com','7.bp.blogspot.com','8.bp.blogspot.com','9.bp.blogspot.com','pinimg.com','sndimg.com','homedepot.com','tinypic.com','staticflickr.com' );
if ( ! in_array($parse['host'], $arradom ) ) {
$imgname = str_ireplace('.'.$imgext,'',basename($imgurl));
} else {
$imgname = '';
}
$imgname = str_ireplace(array('0','1','2','3','4','5','6','7','8','9','@','-','%','_','+','pdf','.jpg.rend.','hgtvcom','',' . ','.',' a ',' b ',' c ',' d ',' e ',' f ',' g ',' h ',' i ',' j ',' k ',' l ',' m ',' n ',' o ',' p ',' q ',' r ',' s ',' t ',' u ',' v ',' w ',' x ',' y ',' z '),' ',$imgname);
$namadom = $parse['host'];
$namadom = ucwords(strtolower(str_ireplace(array('www','.','-'),'',$namadom)));
$imgtitle = str_ireplace(array('cdn'.$namadom.'',''.$namadom.'couk',''.$namadom.'xyz',''.$namadom.'tk',''.$namadom.''),'',$imgtitle);
$niraw = str_ireplace(array('.com','.net','xyz','.co.uk','.tk','.','-','|','.','jpg','_','"'),'',$niraw);
function some_function($limiten){
$limiten = substr($limiten,0,45);
$limiten = substr($limiten,0,strrpos($limiten," "));
return $limiten;
}
$lmgambar = some_function($imgname);
/*Tambahan Variasi*/
$enake = array('2017','inspirations','trends','images','pictures');
shuffle($enake);
$sambung = array('newest','latest','makeovers');
shuffle($sambung);
$niraw = strtolower($imgtitle.' '.$sambung[0].' '.$kueri);
$niraw = implode(' ',array_unique(explode(' ', $niraw))); //menghilangkan duplikat kata "yg dihapus kata terahir"
$niraw = str_replace(array(' ',' ',' ',' ',' '),' ',$niraw);
echo '<label>Kw ku </label>: '.$postitle.'<br/><br/>';
//echo 'Domain ='.$namadom.'<br/><br/>';
echo '<label>Image Name Asli </label>: '.$imgname.'<br/><br/>';
echo '<label>Image Limit </label>: '.$lmgambar.'<br/><br/>';
//echo 'img t ='.$imgtitle.'<br/><br/>';
//Variable New FILE
$gamtitle = $niraw;
$gamtitle = str_replace(' ','-',$niraw);
$newfile = $gamtitle.'.'.$imgext;
$new_title = ucwords(str_replace('-',' ',$niraw)).' ';
$wp_upload_dir = wp_upload_dir();
$guid = $wp_upload_dir['url'].'/'.$newfile;
$filename = $wp_upload_dir['path'].'/'.$newfile;
$pu = parse_url($imgurl);
$sdomain = $pu['scheme'].'://'.$pu['host'];
if(strpos($imgvia,'youtube.com') !== false) {
$imgurl = str_replace('https://','http://',$imgurl);
} else {}
if(pin6($pu['host'])) {//handle request gak ada jawaban
$savim = js_getimages($newfile,$imgurl,$sdomain);
} else {
$savim = false;
}
echo '<label>File Akhir </label>: '.$newfile.'<br/><br/>';
if($savim) {
echo '<p class="gr">Gambar berhasil disimpan</p>';
update_option('autoretry',0);
/*Construksi tanggal*/
$today = $posdate;
//$plusday = mt_rand(1,365);
$plusday = 0;
$plushour = 0;
$plousmin = mt_rand(1,59);
$ploussec = mt_rand(1,59);
$newdate = date('Y-m-d H:i:s',strtotime('+'.$plusday.' day +'.$plushour.' hour +'.$plousmin.' minutes +'.$ploussec.' seconds',''.strtotime($today)));
// Prepare an array of post data for the attachment.
$attachment = array(
'guid' => $guid,
'post_mime_type' => 'image/'.$imgext,
'post_title' => $niraw,
'post_name' => sanitize_title_with_dashes($niraw),
'post_content' => $imgurl,
'post_date' => $newdate,
'post_date_gmt' => $newdate,
'post_modified' => $newdate,
'post_modified_gmt' => $newdate,
'post_status' => 'inherit'
);
// Insert the attachment.
$attach_id = wp_insert_attachment( $attachment, $filename, $pid );
// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
require_once( ABSPATH . 'wp-admin/includes/image.php' );
// Generate the metadata for the attachment, and update the database record.
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
/*TRANSISI ATTACHMENT*/
$requrl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.($aidx+1);
$reload = mt_rand(3,5);
update_option('latflow',$requrl);
echo '<style>#jload {width:100%;height:5px; padding:0; margin:10px auto; background:#ddd;position:relative;}.expand {width:100%;height:5px; margin:0; background:#390; position:absolute;box-shadow:0 1px 0 0 rgba(255,255,255,1.0); -moz-animation:fullexpand '.$reload.'s ease-out;-webkit-animation:fullexpand '.$reload.'s ease-out;}@-moz-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}@-webkit-keyframes fullexpand {0% { width:0px;}100%{ width:100%;}}</style>';
echo '<div id="lw"><div id="jload"><span class="expand"></span></div></div>';
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$requrl.'"/>';
//disini
} else {
$reload = mt_rand(3,5);
$rturl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.$aidx;
$requrl = $aturl.'&atflow=true&pid='.$pid.'&aidx='.($aidx+1);
echo '<p class="rd">Gambar gagal disimpan</p>';
echo '<p>
<a href="'.$rturl.'" class="button-primary">Retry</a>
<a href="'.$requrl.'" class="button-primary">Skip</a>
</p>';
//Auto skip
stream_context_set_default(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
));
$gh = get_headers($imgurl);
if(strpos($gh[0],'404 Not Found') !== false || ($aretry>3)) {
echo '<meta http-equiv="refresh" content="1; url='.$requrl.'"/>';
} else {
echo '<meta http-equiv="refresh" content="'.$reload.'; url='.$rturl.'"/>';
update_option('autoretry',($aretry+1));
}
/*KETIKA GAMBAR GAGAL DISIMPAN
1. tombol retry (auto retry)
2. 2x retry
3. Cek koneksi, jika masih gagal
4. lanjut berikutnya jika koneksi ada
5. stop jika gak ada koneksi
NOTE
Apabila url gambar dengan via gambar berbeda domain, gambar akan disimpan
*/
}
//print_r($new_image_format);
exit;
echo '</div>';
}
} else {
/*Tombol Resume
- Akan muncul bila pernah pencet tombol pause di attachment flow
*/
if(!empty($latflow)) {
echo '<a href="'.$latflow.'" class="button-primary">Resume</a>';
} else {
echo '<h2 class="rd">Ra ono opo2 mbroo!!!! </h2>';
}
}
exit;
echo '</div>
</div>';
}
/*END OF ATTACHMENT FLOW-------------------*/
/*FUNCTION ARRAY MAKER-------------------*/
function cw_addquery_page() {
$arurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-addquery';
$aurl = get_option('siteurl').'/wp-admin/admin.php?page=cw-api';
echo '<div class="wrap">
<h2>Add Query</h2>
<div class="inside">';
/*02. HANDLER*/
if(isset($_POST['arsubmit'])) {
$issubmit = true;
$kwdss = $_POST['kwds'];
} else {
$issubmit = false;
$kwdss = '';
}
/*02. END OFF HANDLER*/
/*03. EXECUTE*/
if($issubmit) {
$kfile = TEMPLATEPATH.'/geni/kwds.php';
$bfile = TEMPLATEPATH.'/geni/badwords.php';
include($bfile);
if(file_exists($kfile)) {
include($kfile);
//$klama = "'".implode("','",$kwds)."',";
$klama = implode(",",$kwds).",";
} else {
$klama = '';
}
$xk = explode("\n",$kwdss);
$kueri = '';
foreach($xk as $kw) {
$kw = str_replace(array("\n","\r"),'',$kw);
//$badwords
//print_r($badwords);
//exit;
$isbad = '';
foreach($badwords as $bw) {
if($bw == $kw || (strpos($kw,$bw) !== false)) {
$isbad = '1';
} else {}
}
$isbad .= '';
if(!empty($isbad)) {} else {
$kueri .= $kw.',';
}
}
$kueri .= '';
$kueri = substr($kueri,0,-1);
if(empty($kueri)) {
$ktulis = true;
} else {
$xkueri = array_unique(explode(',',$klama.$kueri));
$isikueri = "'".implode("','",$xkueri)."'";
$vkueri = "<?php \n".'$kwds = array('.$isikueri.'); '."\n?>";
$ktulis = file_put_contents($kfile,$vkueri,LOCK_EX);
}
if($ktulis !== false) {
echo '<p class="gr">Query berhasil tersimpan mbro</p><meta http-equiv="refresh" content="2; url='.$aurl.'"/>';
} else {}
} else {
/*01. FORM
- action = tujuan dikirimkan data
- method = cara dikirimkan data
- post = ngirim - selalu digunakan untuk aplikasi
- get = ngambil
- request = meminta - selalu digunakan di URL
*/
echo '<form action="'.$arurl.'" method="post">
<textarea name="kwds" required></textarea>
<input type="submit" name="arsubmit" value="kirim" class="button-primary"/>
</form>';
/*END OFF FORM*/
}
echo '</div>
</div>';
}
/*END OF ARRAY MAKER-------------------*/
/*FUNCTION GET RELATED-------------------*/
function cw_getrel_page() {
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF FUNCTION GET RELATED-------------------*/
/*FUNCTION API SETTINGS-------------------*/
function cw_apisetting_page() {
$aseturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-apisetting';
$niformat = explode('[(.Y.)]',get_option('new_image_format'));
$autopublish = get_option('autopublish');
$autocat = get_option('autocat');
$autosize = get_option('autosize');
$metadata = get_option('metadata');
$dpost = get_option('dpost');
$rti = get_option('rti');
echo '<div class="wrap">
<h2>Api Settings</h2>
<div class="inside">';
/*HANDLER*/
if(isset($_POST['asubmit'])) {
$issubmit = true;
$newimageformat = $_POST['new_image_format'];
$autopublish = $_POST['autopublish'];
$autocat = $_POST['autocat'];
$autosize = $_POST['autosize'];
$metadata = $_POST['metadata'];
$dpost = $_POST['dpost'];
$rti = $_POST['rti'];
//print_r($newimageformat);
update_option('new_image_format',implode('[(.Y.)]',$newimageformat));
update_option('autopublish',$autopublish);
update_option('autocat',$autocat);
update_option('autosize',$autosize);
update_option('metadata',$metadata);
update_option('dpost',$dpost);
update_option('rti',$rti);
echo '<meta http-equiv="refresh" content="0; url='.$aseturl.'"/>';
} else {}
/*END HANDLER*/
echo '<form action="'.$aseturl.'" method="post">';
echo '<h3>New Image Format</h3><p>';
$nif = array('postitle','imgtitle','kueri','imgurl','cats','tags');
foreach($nif as $ni) {
if(in_array($ni,$niformat)) {
$cekit = 'checked';
} else {
$cekit = '';
}
echo '<input type="checkbox" name="new_image_format[]" value="'.$ni.'" '.$cekit.'/> '.$ni.'';
}
echo '</p><br/>';
echo '<h3>Auto Publish</h3>';
echo '<p><label>Active</label>
<select name="autopublish" required>
<option value="">Select</option>
<option value="yes" '.im_checkit($autopublish,'yes',false).'>Yes</option>
<option value="no" '.im_checkit($autopublish,'no',false).'>No</option>
</select>
</p>';
echo '<h3>Auto Publish Category</h3>';
echo '<p><label>Active</label>
<select name="autocat" required>
<option value="">Select</option>
<option value="catauto" '.im_checkit($autocat,'catauto',false).'>Auto Detect</option>
<option value="catdefault" '.im_checkit($autocat,'catdefault',false).'>Default</option>
</select>
</p>';
echo '<h3>Sizeparameter</h3>';
echo '<p><label>Pilih</label>
<select name="autosize" required>
<option value="">Select</option>
<option value="size1" '.im_checkit($autosize,'size1',false).'>Large</option>
<option value="size2" '.im_checkit($autosize,'size2',false).'>X Large</option>
<option value="size3" '.im_checkit($autosize,'size3',false).'>1600 2MP</option>
<option value="size4" '.im_checkit($autosize,'size4',false).'>2272 4MP</option>
<option value="size5" '.im_checkit($autosize,'size5',false).'>2816 6MP</option>
</select>
</p>';
echo '<h3>Isi meta data</h3>';
echo '<p><label>Pilih</label>
<select name="metadata" required>
<option value="">Select</option>
<option value="metaauto" '.im_checkit($metadata,'metaauto',false).'>Yes</option>
<option value="metadefault" '.im_checkit($metadata,'metadefault',false).'>No</option>
</select>
</p>';
echo '<h3>Random total image</h3>';
echo '<p><label>Total Image</label><input type="text" name="rti" value="'.$rti.'" placeholder="18,26 atau 16,25 image....!!"/></p>';
echo '<h3>Date Post</h3>';
echo '<p><label>Pilih</label>
<select name="dpost" required>
<option value="">Select</option>
<option value="future" '.im_checkit($dpost,'future',false).'>Future</option>
<option value="bdate" '.im_checkit($dpost,'bdate',false).'>DRAFT</option>
</select>
</p>';
echo '<p><input class="green-primary" type="submit" name="asubmit" value="Save Changes"/>
</form>';
echo '</div>
</div>';
}
/*END OF FUNCTION API SETTINGS-------------------*/
/*FUNCTION API ACAK TANGGAL-------------------*/
function cw_apitanggal_page() {
$acturl = get_option('siteurl').'/wp-admin/admin.php?page=cw-apitanggal';
echo '<div class="wrap">
<h2>Api Acak Tanggal</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF ACAK TANGGAL-------------------*/
/*FUNCTION API SANDBOX-------------------*/
function cw_apiimage_page() {
$apimg = get_option('siteurl').'/wp-admin/admin.php?page=cw-apiimage';
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo '</div>
</div>';
}
/*END OF FUNCTION API SANDBOX-------------------*/
/*FUNCTION API SANDBOX-------------------*/
function cw_apisandbox_page() {
$sb_url = get_option('siteurl').'/wp-admin/admin.php?page=cw-apisandbox';
echo '<div class="wrap">
<h2>Api publish</h2>
<div class="inside">';
echo 'sandbox disini broo';
/*
include(TEMPLATEPATH.'/geni/kwds.php');
echo '<p><textarea>';
foreach($kwds as $kwd) {
echo $kwd."\n";
}
echo '</textarea></p>';
*/
$host = 'googleecok.com';
$up = pin6($host);
if($up) {
echo 'hidup';
} else {
echo 'mati';
}
echo '</div>
</div>';
}
/*END OF FUNCTION API SANDBOX-------------------*/
/*FUNCTION CSS API-----------------------*/
function css_api() {
echo '<style type="text/css">
i{font-style:normal;}
.gy{color:#999;}
.gr{color:#390;}
.rd{color:#900;}
hr,.c{clear:both;}
hr{height:1px;border:0 none;background:#ddd;color:#ddd;}
.inside{background:#f9f9f9;border:1px solid #ddd;width:97%;margin-top:15px;}
.inside,.ei i{padding:15px;}
.inside,img,.ei{-moz-border-radius:3px;-webit-border-radius:3px;-khtml-border-radius:3px;border-radius:3px;}
.ei i{-moz-border-radius:300px;-webit-border-radius:300px;-khtml-border-radius:300px;border-radius:300px;}
textarea{width:98%;height:250px;}
#ef textarea{width:800px;height:100px;}
label,.ei{float:left;width:150px;}
.r{float:right}
select{width:150px;}
form,p,h2,h3,h4,h5,h6,hr,.mb{margin:0 0 15px 0;}
form p{margin-bottom:5px;}
#lw,.ei i{position:absolute}
#lw{width:100%;height:5px;top:0;}
.res,.ei{position:relative;}
.res{padding-top:30px;}
.ei{height:150px;overflow:hidden;margin:0 15px 15px 0 ;}
img,.gbr img,.ei img{width:100%;height:auto;}
.ei i{top:15px;left:15px;background:#fff;}
input[type="text"]{width:945px;}
.ed{margin-left:150px;}
.psbmt{position:fixed;top:50px;right:30px;}
a{transition:all 3s}
#wpbody .button,#wpbody .button-primary{margin-left:5px;}
#wpbody #af {padding:0;height:0;overflow:hidden;}
.green-primary {
background: #390 none repeat scroll 0 0;
border-color: #390 #390 #390;
border-radius:3px;
padding:5px;
border:0 none;
cursor:pointer;
color: #fff;
text-decoration: none;
text-shadow: 0 -1px 1px #390, 1px 0 1px #390, 0 1px 1px #390, -1px 0 1px #390;
</style>';
}
/*END OF FUNCTION CSS API----------------*/
/* CONTEKAN -------------------------
echo '<div class="wrap">
<h2>Nama Halaman</h2>
<div class="inside">';
echo '</div>
</div>';
-------------------------------------- */
?>
Function Calls
| add_option | 1 |
Stats
| MD5 | b14d1346508a27d24b017ee56d6bb3d0 |
| Eval Count | 0 |
| Decode Time | 273 ms |