本文整理汇总了PHP中printr函数的典型用法代码示例。如果您正苦于以下问题:PHP printr函数的具体用法?PHP printr怎么用?PHP printr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Whenever controller is created, load the model and the template.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @param $route
* @param $hooks
* @param $plugin_manager
* @param $pdo
*/
public function __construct($request, $response, $route, $hooks, $plugin_manager, $pdo)
{
$this->request = $request;
$this->response = $response;
if ($this->grantAccess()) {
$model = $route['model']['class'];
/* Check if model class extends the core model */
if ($model == 'Leap\\Core\\Model' || is_subclass_of($model, "Leap\\Core\\Model")) {
/* Create the model instance */
$this->model = new $model($pdo);
} else {
if (class_exists($route['model']['class'])) {
printr("Model class '" . $model . "' does not extend the base 'Leap\\Core\\Model' class");
} else {
printr("Model class '" . $model . "' not found");
}
}
$this->hooks = $hooks;
$this->plugin_manager = $plugin_manager;
/* TODO: pass whole route variable */
$this->template = new Template($route['template'], $route['page'], $hooks, $this->plugin_manager->enabled_plugins, $route['stylesheets'], $route['scripts']);
$this->page = $route['page'];
$this->init();
$this->access = true;
if (isset($route['title'])) {
$this->set('title', $route['title']);
} else {
$tmp_page = explode("/", explode(".", $this->page['value'])[0]);
$this->set('title', ucfirst(end($tmp_page)));
}
} else {
$this->access = false;
}
}
示例2: printrx
function printrx($data)
{
if (isset($_COOKIE['debug']) && $_COOKIE['debug']) {
printr($data);
die;
}
}
示例3: format
protected function format($values = false)
{
$query = "SET ";
$cvs = [];
printr($values);
$count = count($this->sets);
for ($i = 0; $i < $count; $i++) {
// Grab an individual set
$set = $this->sets[$i];
// Set the column for the query
$query .= $set->Column() . " = ";
// Parse the value. This is used because we don't know if the value should be a value, column,
// or static statement (ie UNIX_TIMESTAMP()).
$ret = self::parseValue($values, $set->BoundColumn(), $set->Value());
// The first element in the array will be the value to be added
$query .= $ret[1];
// The second element determines if the column has an associated value that the DatabaseManager
// will need or not
if ($ret[0]) {
$cvs[] = $set;
}
//new CVPair($set->Column(), $set->Value());
// Append as needed to maintain a CSV list
if ($i < $count - 1) {
$query .= ", ";
}
}
// Return the query along with the cvs's as needed
return [$query, $cvs];
}
示例4: errorHandler
function errorHandler($msg, $error)
{
if (!error_reporting()) {
return;
}
printr($error['message'], "Error");
}
示例5: fnFrete
public function fnFrete($tipoFrete = null, $idPedido = null)
{
$idPedido = sqlvalue($idPedido, false);
$tipoFrete = sqlvalue($tipoFrete, false);
if (isset($tipoFrete) and isset($idPedido)) {
$queryPeso = "SELECT \r\n\t\t\t\t\t\t\t ROUND((SUM((IFNULL(PROD.ALTURA_CM,0)*PEIT.QUANTIDADE))*SUM((IFNULL(PROD.LARGURA_CM,0)*PEIT.QUANTIDADE))*SUM((IFNULL(PROD.PROFUNDIDADE_CM,0)*PEIT.QUANTIDADE)))/6000,2) TOTAL_PESO_CUBICO,\r\n\t\t\t\t\t\t\t ROUND(SUM((IFNULL(PROD.PESO_KG,0)*PEIT.QUANTIDADE)),2) TOTAL_PESO_KG,\r\n\t\t\t\t\t\t\t ROUND(SUM((IFNULL(PROD.ALTURA_CM,0)*PEIT.QUANTIDADE)),2) TOTAL_ALTURA,\r\n\t\t\t\t\t\t\t ROUND(SUM((IFNULL(PROD.LARGURA_CM,0)*PEIT.QUANTIDADE)),2) TOTAL_LARGURA,\r\n\t\t\t\t\t\t\t ROUND(SUM((IFNULL(PROD.PROFUNDIDADE_CM,0)*PEIT.QUANTIDADE)),2) TOTAL_PROFUNDIDADE,\r\n\t\t\t\t\t\t\t PEEN.CEP_ID_CEP\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t e_PEDIDO PEDI,\r\n\t\t\t\t\t\t\t e_PEDIDO_ITEM PEIT,\r\n\t\t\t\t\t\t\t e_PRODUTO_COMBINACAO_ATRIBUTO_VALOR PCAV,\r\n\t\t\t\t\t\t\t e_PRODUTO_COMBINACAO PRCO,\r\n\t\t\t\t\t\t\t e_PRODUTO PROD,\r\n\t\t\t\t\t\t\t e_PEDIDO_ENDERECO PEEN\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t PEDI.ID_PEDIDO = PEIT.PEDI_ID_PEDIDO\r\n\t\t\t\t\t\t\tAND PEIT.PCAV_ID_PRODUTO_COMBINACAO_ATRIBUTO_VALOR = PCAV.ID_PRODUTO_COMBINACAO_ATRIBUTO_VALOR\r\n\t\t\t\t\t\t\tAND PCAV.PRCO_ID_PRODUTO_COMBINACAO = PRCO.ID_PRODUTO_COMBINACAO\r\n\t\t\t\t\t\t\tAND PRCO.PROD_ID_PRODUTO = PROD.ID_PRODUTO\r\n\t\t\t\t\t\t\tAND PEDI.ID_PEDIDO = " . $idPedido . "\r\n\t\t\t\t\t\t\tAND PEDI.ID_PEDIDO = PEEN.PEDI_ID_PEDIDO\r\n\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tPEEN.CEP_ID_CEP";
$resultQueryPeso = $mysqli->ExecutarSQL($queryPeso);
$rowQueryPeso = @mssql_fetch_array($resultQueryPeso);
$totalPesoCubico = number_format($rowQueryPeso["TOTAL_PESO_CUBICO"], 2, ',', '.');
$totalPesoKg = number_format($rowQueryPeso["TOTAL_PESO_KG"], 2, ',', '.');
$totalAltura = number_format($rowQueryPeso["TOTAL_ALTURA"], 2, ',', '.');
$totalLargura = number_format($rowQueryPeso["TOTAL_LARGURA"], 2, ',', '.');
$totalProfundidade = number_format($rowQueryPeso["TOTAL_PROFUNDIDADE"], 2, ',', '.');
$cepDestino = $rowQueryPeso["CEP_ID_CEP"];
if ($totalAltura <= 105 or $totalLargura <= 105 or $totalProfundidade <= 105) {
/*WEBSERVICE CORREIOS*/
$xml = simplexml_load_file("http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx?nCdEmpresa=08132828&sDsSenha=02804744&sCepOrigem=93525240&sCepDestino=" . $cepDestino . "&nVlPeso=" . $totalPesoKg . "&nCdFormato=1&nVlComprimento=" . $totalProfundidade . "&nVlAltura=" . $totalAltura . "&nVlLargura=" . $totalLargura . "&sCdMaoPropria=n&nVlValorDeclarado=0&sCdAvisoRecebimento=n&nCdServico=" . $tipoFrete . "&nVlDiametro=0&StrRetorno=xml&nIndicaCalculo=3");
//printr($xml);
} else {
$xml = "";
$tipoFrete = ID_TIPO_FRETE_TRANSP_PADRAO;
}
}
if ($xml->cServico->Codigo) {
$valorFrete = formataPrecoInsert($xml->cServico->Valor);
$codErro = $xml->cServico->Erro;
$MsgErro = $xml->cServico->MsgErro;
if ($codErro == '0') {
$retorno = array(array("VALOR_FRETE" => $valorFrete));
$mysqli->ExecutarSQL("UPDATE e_PEDIDO SET VALOR_FRETE = " . $valorFrete . ", TIFR_ID_TIPO_FRETE = " . $tipoFrete . " WHERE ID_PEDIDO = " . $idPedido . "");
} else {
$retorno = array(array("MENSAGEM_ERRO" => $MsgErro, "COD_ERRO" => $codErro));
//printr($retorno);
}
} else {
if (isset($tipoFrete)) {
$tipoFrete = sqlvalue($tipoFrete, true);
} else {
$tipoFrete = "PEDI.TIFR_ID_TIPO_FRETE";
}
if ($totalPesoCubico > $totalPesoKg) {
if ($totalPesoCubico > PESO_MAXIMO_CORREIOS) {
$adicionalTotalPesoCubico = $totalPesoCubico / PESO_MAXIMO_CORREIOS;
$peso = PESO_MAXIMO_CORREIOS;
$coluna = "IFNULL(PRUF.VALOR_FRETE, 0)*" . $adicionalTotalPesoCubico;
} else {
$peso = $totalPesoCubico;
$coluna = "IFNULL(PRUF.VALOR_FRETE, 0)";
}
} else {
$peso = $totalPesoKg;
$coluna = "IFNULL(PRUF.VALOR_FRETE, 0)";
}
$query = "DECLARE @FRETE_GRATIS VARCHAR(1),\r\n\t\t\t\t\t\t\t\t@VALOR_FRETE NUMERIC(14,4),\r\n\t\t\t\t\t\t\t\t@TIPO_FRETE VARCHAR(10),\r\n\t\t\t\t\t\t\t\t@PESO_TOTAL NUMERIC(14,4)\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tSET @PESO_TOTAL = " . $peso . "\r\n\t\t\t\t\t\tSET @TIPO_FRETE = " . $tipoFrete . "\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tIF(@TIPO_FRETE <> " . ID_TIPO_FRETE_TRANSP_PADRAO . ")\r\n\t\t\t\t\t\tBEGIN\r\n\t\t\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t\t\t@FRETE_GRATIS = IFNULL(PRUF.FRETE_GRATIS, 'N'),\r\n\t\t\t\t\t\t\t\t@VALOR_FRETE = ROUND(" . $coluna . ",2),\r\n\t\t\t\t\t\t\t\t@TIPO_FRETE = " . $tipoFrete . " \r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\te_PEDIDO PEDI,\r\n\t\t\t\t\t\t\t\te_PEDIDO_ENDERECO PEEN,\r\n\t\t\t\t\t\t\t\te_MUNICIPIO MUNI,\r\n\t\t\t\t\t\t\t\te_CEP_PRECIFICACAO_UF PRUF\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tPEDI.ID_PEDIDO = PEEN.PEDI_ID_PEDIDO\r\n\t\t\t\t\t\t\tAND PEDI.ID_PEDIDO = " . $idPedido . "\r\n\t\t\t\t\t\t\tAND PEEN.MUNI_ID_MUNICIPIO = MUNI.ID_MUNICIPIO\r\n\t\t\t\t\t\t\tAND PRUF.TIFR_ID_TIPO_FRETE = " . $tipoFrete . "\r\n\t\t\t\t\t\t\tAND MUNI.UNFE_ID_ESTADO = PRUF.UNFE_ID_ESTADO\r\n\t\t\t\t\t\t\tAND " . $peso . " BETWEEN PRUF.PESO_INICIAL AND PRUF.PESO_FINAL\r\n\t\t\t\t\t\t\tAND PEEN.CEP_ID_CEP BETWEEN PRUF.CEP_INICIAL AND PRUF.CEP_FINAL\r\n\t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_PERCENTUAL)/100 < TIFR.GRIS_MINIMO\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTHEN TIFR.GRIS_MINIMO\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tELSE ((SUM(PEIT.PRECO_UNITARIO_VENDA*PEIT.QUANTIDADE)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+SUM(IFNULL(PEIT.VALOR_PACOTE_PRESENTE,0)*PEIT.QUANTIDADE)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t-IFNULL(PEIT.VALOR_DESCONTO,0))*TIFR.GRIS_PERCENTUAL)/100\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tEND,\r\n\t\t\t\t\t\t\t\t\t@TIPO_FRETE = " . $tipoFrete . "\r\n\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\te_PEDIDO PEDI,\r\n\t\t\t\t\t\t\t\t\te_PEDIDO_ENDERECO PEEN,\r\n\t\t\t\t\t\t\t\t\te_MUNICIPIO MUNI,\r\n\t\t\t\t\t\t\t\t\te_PRECIFICACAO_TRANSP PRUF,\r\n\t\t\t\t\t\t\t\t\te_TIPO_FRETE TIFR,\r\n\t\t\t\t\t\t\t\t\te_PEDIDO_ITEM PEIT\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\tPEDI.ID_PEDIDO = PEEN.PEDI_ID_PEDIDO\r\n\t\t\t\t\t\t\t\tAND PEDI.ID_PEDIDO = " . $idPedido . "\r\n\t\t\t\t\t\t\t\tAND PEEN.MUNI_ID_MUNICIPIO = MUNI.ID_MUNICIPIO\r\n\t\t\t\t\t\t\t\tAND PRUF.TIFR_ID_TIPO_FRETE = " . $tipoFrete . "\r\n\t\t\t\t\t\t\t\tAND MUNI.UNFE_ID_ESTADO = PRUF.UNFE_ID_ESTADO\r\n\t\t\t\t\t\t\t\tAND PRUF.MUNI_ID_MUNICIPIO IS NULL\r\n\t\t\t\t\t\t\t\tAND PRUF.TIFR_ID_TIPO_FRETE = TIFR.ID_TIPO_FRETE\r\n\t\t\t\t\t\t\t\tAND PEDI.ID_PEDIDO = PEIT.PEDI_ID_PEDIDO\r\n\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\t((@PESO_TOTAL*PRUF.FRETE_KG)+PRUF.TAXA_FRETE_KG)+IFNULL(PRUF.PEDAGIO,0),\r\n\t\t\t\t\t\t\t\tTIFR.GRIS_MINIMO,\r\n\t\t\t\t\t\t\t\tTIFR.GRIS_PERCENTUAL,\r\n\t\t\t\t\t\t\t\tTIFR.TAS_VALOR,\r\n\t\t\t\t\t\t\t\tPEIT.VALOR_DESCONTO\r\n\t\t\t\t\t\t\tEND\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\tEND\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tUPDATE e_PEDIDO SET VALOR_FRETE = @VALOR_FRETE, FRETE_GRATIS = @FRETE_GRATIS, TIFR_ID_TIPO_FRETE = @TIPO_FRETE \r\n\t\t\t\t\t\tWHERE ID_PEDIDO = " . $idPedido . ";\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tSELECT @FRETE_GRATIS FRETE_GRATIS, @VALOR_FRETE VALOR_FRETE";
printr($query);
$retorno = $mysqli->ConsultarSQL($query);
}
//fim else xml
return $retorno;
}
示例6: login
function login()
{
printr($_POST['referer']);
$referer = isset($_POST['referer']) && !empty($_POST['referer']) ? $_POST['referer'] : _BASE_URL_ . "/manager/posts/view_all";
if (!trim($_POST['user_id']) || !trim($_POST['password'])) {
msg_page("Required fields are missing.");
}
$data = array("user_id" => trim(strval($_POST['user_id'])), "password" => SHA1($_POST['password'] . SALT));
$user = $this->User->getUser("*", $data);
if ($this->User->count > 0) {
if ($user['level'] >= 5) {
$_SESSION['LOGIN_NO'] = $user["id"];
$_SESSION['LOGIN_ID'] = $user["user_id"];
$_SESSION['LOGIN_NAME'] = $user["name"];
$_SESSION['LOGIN_EMAIL'] = $user["email"];
$_SESSION['LOGIN_LEVEL'] = $user["level"];
/*check is save id */
$is_save_id = isset($_POST['is_save_id']) ? trim(strval($_POST['is_save_id'])) : "N";
if ($is_save_id == "Y") {
setcookie("is_save_id", "Y", time() + 60 * 60 * 24 * 365, "/");
setcookie("LOGIN_ID", $user['user_id'], time() + 60 * 60 * 24 * 365, "/");
} else {
setcookie("is_save_id", "", time() + 60 * 60 * 24 * 365, "/");
}
} else {
msg_page("You do not have permission to access.");
}
} else {
msg_page("information does not match.");
}
printr($referer);
redirect($referer);
}
示例7: get_partner
function get_partner($id)
{
$sql = "select * from partner where id = :id";
$res = $this->db->query($sql, array(":id" => $id));
if (count($res) == 0) {
printr('no data');
}
//$res = $res[0];
return $res;
}
示例8: errorHandler
function errorHandler($msg, $error)
{
if (!error_reporting()) {
return;
}
$dir = dirname(__FILE__) . '/';
$rpath = str_replace($dir, '', $error['context']);
printr($error['message'], "Error");
printr($rpath, "Context");
}
示例9: parseTemplate
private function parseTemplate($template, $data)
{
printr($data);
$keys = array_keys($data);
$values = array_values($data);
// key prep for replace
array_walk($keys, function (&$value, $key) {
$value = "[-{$value}-]";
});
// replace the basic or easy stuff
$partial = str_replace($keys, $values, $template);
$partial = $this->parseLogic($partial, $keys, $values);
return $partial;
}
示例10: getComments
/**
* getComments
*
* @param string $url
* @param string $type
* @param string $params
*
* @return void
*/
function getComments($url, $type, $params)
{
$comments = '';
switch ($type) {
case 'video':
$comments = getVideoComments($url, $params);
break;
default:
printr(debug_backtrace());
die("Invalid Type for getComments");
break;
}
return $comments;
}
示例11: test
function test()
{
$request = Yaf_Dispatcher::getInstance()->getRequest();
$type = key($request->getParams());
$params = array();
$params['request'] = $request->getRequest();
$params['query'] = $request->getQuery();
$params['post'] = $request->getPost();
$params['input'] = file_get_contents('php://input');
$isJson = false;
if (array_key_exists('_json', $params['query'])) {
$isJson = true;
unset($params['query']['_json'], $params['request']['_json']);
}
if ($type == 'param') {
printr($params, true, false, true);
} elseif ($type == 'curl') {
$str = 'curl';
if (!empty($params['post'])) {
if (!empty($params['query']['json']) && $params['query']['json'] == 'yes') {
$str .= ' -X POST -d ' . escapeshellarg($params['input']);
} else {
$str .= ' -X POST -d ' . escapeshellarg(http_build_query($params['post']));
}
}
if (!empty($params['query'])) {
$qstr = '';
if (!empty($params['query']['_url'])) {
$qstr .= $params['query']['_url'] . '?';
unset($params['query']['_url'], $params['request']['_url']);
} else {
$qstr .= '?';
}
$qstr .= http_build_query($params['query']);
$str .= ' ' . escapeshellarg($qstr);
}
if ($isJson) {
$str = json_encode($str);
}
echo $str;
} else {
echo 'api error, contact the administrator';
}
}
示例12: printr
function printr($a, $l = 0)
{
if (is_array($a)) {
foreach ($a as $b => $sa) {
if (count($sa) < 2) {
if (!is_array($sa)) {
echo str_repeat(' ', $l) . $b . " => " . $sa . "\n";
} else {
if (!is_numeric($b)) {
echo str_repeat(' ', $l) . $b . "\n";
}
}
} else {
echo str_repeat(' ', $l) . $b . "\n";
}
printr($sa, $l + 1);
}
}
}
示例13: reset
$dependenton =& $task->getDependentOn();
if (count($dependenton) == 1 && $dependenton[100]) {
//skip if only one user - the 100 user
} else {
$return .= '<dependenton>';
reset($dependenton);
while (list($id, $link_type) = each($dependenton)) {
$return .= '<task id="' . $id . '" linktype="' . $link_type . '"></task>';
}
$return .= '</dependenton>';
}
$return .= '<notes>' . $task->getDetails() . '</notes>';
$return .= '</task>';
}
$return .= '</tasks>';
printr($return, 'download XML');
print $return;
} else {
print $return . '<response handle="error">';
print '<error><description>' . $gforgeresult["errormessage"] . '</description></error>';
}
print '</response>';
print '</xml>';
}
break;
//MSPCheckin
//MSPCheckin
case $result["REQUEST"] == "upload":
if (trim($result["ACTION"]) == "Checkin") {
$gforgeresult = MSPCheckin($result["session_id"], $result["subproject"][0]["id"], $result["tasks"]);
print '<?xml version="1.0"?>';
示例14: printr2
/**
* array or obj print to html and exit
*/
function printr2($var, $title = null)
{
printr($var, $title);
exit;
}
示例15: mw_newPost
function mw_newPost($args) {
global $wpdb, $post_default_category;
$this->escape($args);
$blog_ID = $args[0]; // we will support this in the near future
$user_login = $args[1];
$user_pass = $args[2];
$content_struct = $args[3];
$publish = $args[4];
if (!$this->login_pass_ok($user_login, $user_pass)) {
return $this->error;
}
$user = set_current_user(0, $user_login);
if ( !current_user_can('publish_posts') )
return new IXR_Error(401, 'Sorry, you can not post on this weblog or category.');
$post_author = $user->ID;
$post_title = $content_struct['title'];
$post_content = apply_filters( 'content_save_pre', $content_struct['description'] );
$post_status = $publish ? 'publish' : 'draft';
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
$comment_status = (empty($content_struct['mt_allow_comments'])) ?
get_option('default_comment_status')
: $content_struct['mt_allow_comments'];
$ping_status = (empty($content_struct['mt_allow_pings'])) ?
get_option('default_ping_status')
: $content_struct['mt_allow_pings'];
if ($post_more) {
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
}
$to_ping = $content_struct['mt_tb_ping_urls'];
if ( is_array($to_ping) )
$to_ping = implode(' ', $to_ping);
// Do some timestamp voodoo
$dateCreatedd = $content_struct['dateCreated'];
if (!empty($dateCreatedd)) {
$dateCreated = $dateCreatedd->getIso();
$post_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
$post_date_gmt = iso8601_to_datetime($dateCreated, GMT);
} else {
$post_date = current_time('mysql');
$post_date_gmt = current_time('mysql', 1);
}
$catnames = $content_struct['categories'];
logIO('O', 'Post cats: ' . printr($catnames,true));
$post_category = array();
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
}
// We've got all the data -- post it:
$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
$post_ID = wp_insert_post($postdata);
if (!$post_ID) {
return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.');
}
$this->attach_uploads( $post_ID, $post_content );
logIO('O', "Posted ! ID: $post_ID");
return strval($post_ID);
}