function postToWebSocket($property, $value, $post_action = 'PostProperty') { if (defined('DISABLE_WEBSOCKETS') && DISABLE_WEBSOCKETS == 1) { return; } require_once ROOT . 'lib/websockets/client/lib/class.websocket_client.php'; global $wsClient; if (!Is_Object($wsClient)) { $wsClient = new WebsocketClient(); if (!@$wsClient->connect('127.0.0.1', WEBSOCKETS_PORT, '/majordomo')) { $wsClient = false; } } if (!Is_Object($wsClient) && isset($_SERVER['REQUEST_METHOD'])) { return false; } $payload = json_encode(array('action' => $post_action, 'data' => array('NAME' => $property, 'VALUE' => $value))); $data_sent = false; if (Is_Object($wsClient)) { $data_sent = @$wsClient->sendData($payload); } if (!$data_sent && !isset($_SERVER['REQUEST_METHOD'])) { //reconnect $wsClient = new WebsocketClient(); if (@$wsClient->connect('127.0.0.1', WEBSOCKETS_PORT, '/majordomo')) { $wsClient->sendData($payload); } } }
function Get_Meta($key = Null, $default = False, $post_id = Null) { # Get the post id if ($post_id == Null && Is_Object($GLOBALS['post'])) { $post_id = $GLOBALS['post']->ID; } elseif ($post_id == Null && !Is_Object($GLOBALS['post'])) { return False; } # Read meta data $arr_meta = (array) Get_Post_Meta($post_id, '_wp_plugin_fancy_gallery', True); if (empty($arr_meta) || !Is_Array($arr_meta)) { $arr_meta = array(); } # Clean Meta data foreach ($arr_meta as $k => $v) { if (!$v) { unset($arr_meta[$k]); } } # Load default Meta data $arr_meta = Array_Merge($this->Default_Meta(), $arr_meta); # Get the key value if ($key == Null) { return $arr_meta; } elseif (isset($arr_meta[$key]) && $arr_meta[$key]) { return $arr_meta[$key]; } else { return $default; } }
/** * Конструктор класса * * Создает документ из XML строки. * * @param string <иницилиазирующая строка> */ public function DOM($Source = NULL) { /****************************************************************************/ $__args_types = array('string,object'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ if (!Is_Null($Source)) { #--------------------------------------------------------------------------- if (Is_Object($Source)) { #------------------------------------------------------------------------- $this->Object = $Source; #------------------------------------------------------------------------- $this->Linking(); } #--------------------------------------------------------------------------- if (Is_String($Source)) { #------------------------------------------------------------------------- if (Mb_StrLen($Source) > 1) { #----------------------------------------------------------------------- $this->Object = String_XML_Parse($Source); if (Is_Exception($this->Object)) { return ERROR | Trigger_Error('[DOM->DOM]: не удалось преобразовать XML'); } #----------------------------------------------------------------------- $this->Object = Current($this->Object->Childs); #----------------------------------------------------------------------- $this->Linking(); } } } }
/** * Object constructor * * @access public * @param string $template input template filename * @param array $data input data * @param object $owner parser owner */ function jTemplate($template, &$data, &$owner) { // set current directory for template includes if (strpos($template, "/") !== FALSE) { $root=preg_replace("/\/[^\/]*?$/","",$template)."/"; } else { $root=""; } $this->data=&$data; $this->template=$template; if (Is_Object($owner)) { $this->owner=&$owner; } if (is_file($template)) { $template_file=$this->loadfile($template); } else { //echo $template;exit; $template_file=$template; } $res=""; if (Defined("DEBUG_TEMPLATES")) { // creating layer for debugging purpose $res.="<div name=\"$template\" onMouseOver=\"dmo(event)\" onMouseOut=\"dmu(event)\" style=\"margin:0px\">"; } if ($this->owner->ajax) { $this->ajax=1; $this->div_id=$this->owner->name; if ($this->owner->owner->name) { $this->div_id=$this->div_id.'_'.$this->owner->owner->name; } $res.="<div id=\"".$this->div_id."\"><!-- begin_data [".$this->div_id."] -->"; // dyn } $res.=$this->parse($template_file, $this->data, $root); if (strpos($res, '{#')) { //second pass $res=str_replace('{#', '[#', $res); $res=str_replace('#}', '#]', $res); $res=$this->parse($res, $this->data, $root); } if ($this->ajax) { $res.="<!-- end_data [".$this->div_id."] --></div>"; // dyn } if (Defined("DEBUG_TEMPLATES")) { $res.="</div>"; } $this->result=$res; }
/** * Object constructor * * @access public * @param string $template input template filename * @param array $data input data * @param object $owner parser owner */ function jTemplate($template, &$data, &$owner) { // set current directory for template includes if (strpos($template, "/") !== FALSE) { $root = preg_replace("/\\/[^\\/]*?\$/", "", $template) . "/"; } else { $root = ""; } $this->data =& $data; $this->template = $template; if (Is_Object($owner)) { $this->owner =& $owner; } if (defined('ALTERNATIVE_TEMPLATES')) { $alt_path = str_replace('templates/', ALTERNATIVE_TEMPLATES . '/', $template); if (file_exists($alt_path)) { $template = $alt_path; } } if (is_file($template)) { $template_file = $this->loadfile($template); } else { $template_file = $template; $template = 'inner_code'; } $res = ""; if (Defined("DEBUG_MODE")) { // creating layer for debugging purpose $res .= "<!-- begin of file {$template} -->"; } if ($this->owner->ajax) { $this->ajax = 1; $this->div_id = $this->owner->name; if ($this->owner->owner->name) { $this->div_id = $this->div_id . '_' . $this->owner->owner->name; } $res .= "<div id=\"" . $this->div_id . "\"><!-- begin_data [" . $this->div_id . "] -->"; // dyn } $res .= $this->parse($template_file, $this->data, $root); if (strpos($res, '{#')) { //second pass $res = str_replace('{#', '[#', $res); $res = str_replace('#}', '#]', $res); $res = $this->parse($res, $this->data, $root); } if ($this->ajax) { $res .= "<!-- end_data [" . $this->div_id . "] --></div>"; // dyn } if (Defined("DEBUG_MODE")) { $res .= "<!-- end of file {$template} -->"; } $this->result = $res; }
function __construct() { // Get Fancy Gallery if (isset($GLOBALS['wp_plugin_fancy_gallery']) && Is_Object($GLOBALS['wp_plugin_fancy_gallery'])) { $this->fancy_gallery = $GLOBALS['wp_plugin_fancy_gallery']; } else { return False; } // Setup the Widget data parent::__construct(False, $this->t('Fancy Taxonomy Cloud'), array('description' => $this->t('Displays your Gallery taxonomies as "Tag Cloud".'))); }
function __construct() { // Get Fancy Gallery if (isset($GLOBALS['wp_plugin_fancy_gallery']) && Is_Object($GLOBALS['wp_plugin_fancy_gallery'])) { $this->fancy_gallery = $GLOBALS['wp_plugin_fancy_gallery']; } else { return False; } // Setup the Widget data parent::__construct(False, $this->t('Fancy Random Images'), array('description' => $this->t('Displays some random images from your galleries.'))); }
function __construct() { // Get Fancy Gallery if (isset($GLOBALS['wp_plugin_fancy_gallery']) && Is_Object($GLOBALS['wp_plugin_fancy_gallery'])) { $this->fancy_gallery = $GLOBALS['wp_plugin_fancy_gallery']; } else { return False; } // Setup the Widget data parent::__construct(False, $this->t('Fancy Taxonomies'), array('description' => $this->t('Displays your Gallery taxonomies like Gallery Categories, Tags, Events, Photographers, etc.'))); }
function redirect($url, $owner = "", $no_sid = 0) { // redirect inside module global $session; if (Is_Object($owner)) { $owner->redirect($url); } else { $param_str = ""; if (!$no_sid) { $url = str_replace('?', $_SERVER['PHP_SELF'] . '?' . session_name() . '=' . session_id() . '&pd=' . $param_str . '&md=' . $owner->name . '&inst=' . $owner->instance . '&', $url); } $url = "Location:{$url}\n\n"; $session->save(); header($url); exit; } }
function DB_Escape($String) { /******************************************************************************/ #$__args_types = Array('string'); #------------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /******************************************************************************/ $Link =& Link_Get('DB'); #------------------------------------------------------------------------------- if (!Is_Object($Link)) { #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Link = new MySQL($Config['DBConnection']); #------------------------------------------------------------------------------- if (Is_Error($Link->Open())) { #------------------------------------------------------------------------------- $Link = NULL; #------------------------------------------------------------------------------- return ERROR | @Trigger_Error('[DB_Query]: невозможно соединиться с базой данных'); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (Is_Error($Link->SelectDB())) { #------------------------------------------------------------------------------- $Link = NULL; #------------------------------------------------------------------------------- return ERROR | @Trigger_Error('[DB_Query]: невозможно выбрать базу данных'); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return MySQL_Real_Escape_String($String); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
function Get_Meta($key = Null, $default = False, $post_id = Null) { # Get the post id if ($post_id == Null && Is_Object($GLOBALS['post'])) { $post_id = $GLOBALS['post']->ID; } elseif ($post_id == Null && !Is_Object($GLOBALS['post'])) { return False; } # Read meta data $arr_meta = Get_Post_Meta($post_id, '_wp_plugin_fancy_gallery', True); $arr_meta = Is_Array($arr_meta) ? $arr_meta : array(); # Clean Meta data $arr_meta = Array_Filter($arr_meta); # Load default Meta data $arr_meta = Array_Merge($this->Default_Meta(), $arr_meta); # Get the key value if ($key == Null) { return $arr_meta; } elseif (isset($arr_meta[$key]) && $arr_meta[$key]) { return $arr_meta[$key]; } else { return $default; } }
$Tr = new Tag('TR'); #----------------------------------------------------------------------------- foreach ($After as $After) { #--------------------------------------------------------------------------- $Params = array($After['Comp'], $LinkID); #--------------------------------------------------------------------------- if (Count($After['Args'])) { $Params = Array_Merge($Params, $After['Args']); } #--------------------------------------------------------------------------- $Comp = Call_User_Func_Array('Comp_Load', $Params); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- if (Is_Object($Comp)) { #------------------------------------------------------------------------- if (isset($After['NoBlock'])) { #----------------------------------------------------------------------- if (Count($Tr->Childs)) { $Table->AddChild(new Tag('TR', new Tag('TD', new Tag('TABLE', array('cellspacing' => 0), $Tr)))); } #----------------------------------------------------------------------- $Table->AddChild(new Tag('TR', new Tag('TD', $Comp))); #----------------------------------------------------------------------- $Tr = new Tag('TR'); } else { $Tr->AddChild(new Tag('TD', $Comp)); } } }
#------------------------------------------------------------------------------- $Img = new Tag('IMG', array('alt' => 'Закрыть', 'align' => 'center', 'height' => 10, 'width' => 10, 'src' => 'SRC:{Images/Icons/Close.gif}', 'border' => 0)); #------------------------------------------------------------------------------- $Button = new Tag('BUTTON', array('class' => 'Transparent', 'style' => 'cursor: pointer;', 'onclick' => SPrintF('JavaScript: HideNote(\'%s\');', $MessageID)), $Img); #------------------------------------------------------------------------------- $Div->AddChild(new Tag('DIV', array('style' => 'text-align: right;'), $Button)); #------------------------------------------------------------------------------- #$Span = new Tag('SPAN',Array('title'=>'Закрыть'),new Tag('B','x')); #------------------------------------------------------------------------------- #$Div->AddChild(new Tag('DIV',Array('style'=>'cursor: pointer; text-align: right;','OnClick'=>SPrintF('JavaScript: HideNote("%s");',$MessageID)),$Span)); #------------------------------------------------------------------------------- $Div->{Is_Object($Adding) ? 'AddChild' : 'AddText'}($Adding); #------------------------------------------------------------------------------- return $Div; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Td = new Tag('TD', array('style' => 'padding:5px;')); #------------------------------------------------------------------------------- $Td->{Is_Object($Adding) ? 'AddChild' : 'AddText'}($Adding); #------------------------------------------------------------------------------- $Tr = new Tag('TR', $Td); #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('class' => $TypeID, 'cellspacing' => 5, 'align' => 'center'), $Tr); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Table; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function smarty_parse($template_file, &$data) { define(SMARTY_DIR, ROOT . 'smarty/'); require SMARTY_DIR . 'Smarty.class.php'; $smarty = new Smarty(); $smarty->compile_dir = SMARTY_DIR . 'templates_c/'; if (isset($this->owner)) { $smarty->template_dir = DIR_TEMPLATES . $this->owner->name . "/"; } $data["ROOTHTML"] = ROOTHTML; foreach ($data as $k => $v) { $smarty->assign_by_ref($k, $data[$k]); } if (Is_Object($this->owner)) { $smarty->owner =& $this->owner; } $result = $smarty->fetch($template_file); return $result; }
function HTMLDoc_CreatePDF($ModeID, $HTML, $Prefix = '/') { /****************************************************************************/ $__args_types = array('string', 'string,object', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ if (Is_Object($HTML)) { #--------------------------------------------------------------------------- $Tables = $HTML->GetByTagName('TABLE'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Tables); $i++) { #------------------------------------------------------------------------- $Table =& $Tables[$i]; #------------------------------------------------------------------------- switch (@$Table->Attribs['class']) { case 'Standard': $Table->AddAttribs(array('border' => 2, 'cellspacing' => 0, 'cellpadding' => 5), TRUE); break; default: # No more... } } #--------------------------------------------------------------------------- $Tds = $HTML->GetByTagName('TD'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Tds); $i++) { #------------------------------------------------------------------------- $Td =& $Tds[$i]; #------------------------------------------------------------------------- switch (@$Td->Attribs['class']) { case 'Head': $Td->AddAttribs(array('bgcolor' => '#ADC1F0'), TRUE); break; case 'Separator': $Td->AddAttribs(array('bgcolor' => '#EAEAEA'), TRUE); break; default: # No more... } } #--------------------------------------------------------------------------- $Imgs = $HTML->GetByTagName('IMG'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Imgs); $i++) { #------------------------------------------------------------------------- $Img =& $Imgs[$i]; #------------------------------------------------------------------------- $Img->AddAttribs(array('src' => SPrintF('%s/%s', $Prefix, $Img->Attribs['src'])), TRUE); } #--------------------------------------------------------------------------- $HTML = $HTML->Build(); } #----------------------------------------------------------------------------- $Config = Config(); #----------------------------------------------------------------------------- $Settings = $Config['HTMLDOC']; #----------------------------------------------------------------------------- $Modes = $Settings['Modes']; #----------------------------------------------------------------------------- $Mode = isset($Modes[$ModeID]) ? $Modes[$ModeID] : $ModeID; #----------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: временная папка не найдена'); } #----------------------------------------------------------------------------- $Logs = SPrintF('%s/logs', $Tmp); #----------------------------------------------------------------------------- if (!File_Exists($Logs)) { #--------------------------------------------------------------------------- if (!@MkDir($Logs, 0777, TRUE)) { return ERROR | @Trigger_Error(500); } } #----------------------------------------------------------------------------- $HTML = @Mb_Convert_Encoding($HTML, $Settings['ConvertToCharset']); if (!$HTML) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось преобразовать кодировку'); } #----------------------------------------------------------------------------- $UniqID = UniqID('HTMLDOC'); #----------------------------------------------------------------------------- $File = IO_Write($Path = SPrintF('%s/%s', $Tmp, $UniqID), $HTML); Debug($File); if (Is_Error($File)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось создать временный файл'); } #----------------------------------------------------------------------------- $Command = SPrintF('htmldoc %s %s', $Mode, $Path); #----------------------------------------------------------------------------- Debug($Command); #----------------------------------------------------------------------------- if (!PutENV('HTMLDOC_NOCGI=1')) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось установить переменную окружения HTMLDOC_NOCGI'); } #----------------------------------------------------------------------------- $HTMLDOC = @Proc_Open($Command, array(array('pipe', 'r'), array('pipe', 'w'), array('file', $Log = SPrintF('%s/HTMLDOC.log', $Logs), 'a')), $Pipes); if (!Is_Resource($HTMLDOC)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось открыть процесс'); } #----------------------------------------------------------------------------- $StdOut =& $Pipes[1]; #----------------------------------------------------------------------------- $Result = ''; #----------------------------------------------------------------------------- while (!Feof($StdOut)) { $Result .= FRead($StdOut, 1024); } #----------------------------------------------------------------------------- Proc_Close($HTMLDOC); #----------------------------------------------------------------------------- if (!UnLink($Path)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось удалить временный файл'); } #----------------------------------------------------------------------------- if (!$Result) { return ERROR | @Trigger_Error(SPrintF('[HTMLDoc_CreatePDF]: ошибка формирования PDF, смотрите (%s)', $Log)); } #----------------------------------------------------------------------------- return $Result; }
?> <div class="tablenav"> <div class="tablenav-pages"><?php echo $page_links; ?> </div> </div> <?php } ?> <?php foreach ($images_query->posts as $image) { $attachment_counter++; $image->parent = Get_Post($image->post_parent); if (Is_Object($image->parent)) { $image->parent->title = Get_The_Title($image->parent->ID); $image->parent->link = Get_Permalink($image->parent->ID); $image->parent->type = Get_Post_Type_Object($image->parent->post_type); } else { $image->parent = False; } $image->move_link = Add_Query_Arg(array('move_attachment' => $image->ID, 'move_to' => $current_gallery->ID)); ?> <div class="attachment" id="attachment-<?php echo $image->ID; ?> "> <?php echo wp_get_attachment_image($image->ID); ?>
/** * * @param Object $Value * @return boolean Возвращает true, если $Value является исключением и false в противном случае */ function Is_Exception($Value) { #------------------------------------------------------------------------------- return Is_Object($Value) && Get_Class($Value) == 'gException'; #------------------------------------------------------------------------------- }
function Get_Image_Title($attachment) { if (!Is_Object($attachment)) { return False; } // Image title $image_title = $attachment->post_title; // Alternative Text $alternative_text = Get_Post_Meta($attachment->ID, '_wp_attachment_image_alt', True); if (empty($alternative_text)) { $alternative_text = $image_title; } // Image caption $caption = $attachment->post_excerpt; if (empty($caption)) { $caption = $image_title; } // Image description $description = nl2br($attachment->post_content); $description = Str_Replace("\n", '', $description); $description = Str_Replace("\r", '', $description); if (empty($description)) { $description = $caption; } // return Title switch ($this->get_option('use_as_image_title')) { case 'none': return False; case 'alt_text': return $alternative_text; case 'caption': return $caption; case 'description': return $description; default: return $image_title; } }
if (isset($GLOBALS['__USER'])) { #----------------------------------------------------------------------------- $Comp = Comp_Load('Information', 'Вы авторизованы в биллинговой системе. Для выхода из системы, нажмите кнопку [выход] на панели верхнего меню.', 'Notice'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $DOM->AddChild('Into', $Comp); } else { #----------------------------------------------------------------------------- $Script = new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Logon.js}')); #----------------------------------------------------------------------------- $DOM->AddChild('Head', $Script); #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- if (Is_Object($Exception)) { #--------------------------------------------------------------------------- if (XML_HTTP_REQUEST) { return $Exception; } #--------------------------------------------------------------------------- $String = HtmlSpecialChars($Exception->String); #--------------------------------------------------------------------------- $DOM->AddAttribs('Body', array('onload' => SPrintF("ShowAlert('%s','Warning');", $String))); } #----------------------------------------------------------------------------- $Messages = Messages(); #----------------------------------------------------------------------------- $Table = array(); #----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => 'Email', 'onclick' => '', 'type' => 'text', 'class' => 'InputField', 'prompt' => $Messages['Prompts']['Email'], 'value' => @$_COOKIE['Email']));
} #------------------------------------------------------------------------------- $DOM->AddChild('Into', $Comp); #------------------------------------------------------------------------------- switch ($Format) { case 'CSV': #------------------------------------------------------------------------------- $Csv = array(); #------------------------------------------------------------------------------- foreach ($Table as $Row) { #------------------------------------------------------------------------------- $Array = array(); #------------------------------------------------------------------------------- foreach ($Row as $Column) { #------------------------------------------------------------------------------- if (Is_Object($Column)) { #------------------------------------------------------------------------------- $Array[] = SPrintF('"%s"', $Column->Text); #------------------------------------------------------------------------------- $Attribs = $Column->Attribs; #------------------------------------------------------------------------------- if (isset($Attribs['colspan'])) { $Array = Array_Merge($Array, Array_Fill(0, $Attribs['colspan'] - 1, NULL)); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Array[] = SPrintF('"%s"', $Column); #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------