本文整理汇总了PHP中SPrintF函数的典型用法代码示例。如果您正苦于以下问题:PHP SPrintF函数的具体用法?PHP SPrintF怎么用?PHP SPrintF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SPrintF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XML_Read
function XML_Read($Object, $Level = 1)
{
#-----------------------------------------------------------------------------
static $Index = 1;
#-----------------------------------------------------------------------------
$Md5 = Md5($Index++);
#-----------------------------------------------------------------------------
$Attribs = $Object->Attribs;
#-----------------------------------------------------------------------------
$Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name;
#-----------------------------------------------------------------------------
$P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name));
#-----------------------------------------------------------------------------
$Node = new Tag('DIV', array('class' => 'Node'), $P);
#-----------------------------------------------------------------------------
if (Count($Attribs)) {
#---------------------------------------------------------------------------
foreach (Array_Keys($Attribs) as $AttribID) {
$Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID])));
}
}
#-----------------------------------------------------------------------------
if (Count($Childs = $Object->Childs)) {
#---------------------------------------------------------------------------
$Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5));
#---------------------------------------------------------------------------
foreach ($Childs as $Child) {
$Content->AddChild(XML_Read($Child, $Level + 1));
}
#---------------------------------------------------------------------------
$Node->AddChild($Content);
}
#-----------------------------------------------------------------------------
return $Node;
}
示例2: filterPostsOrderBy
static function filterPostsOrderBy($orderby, $query)
{
if ($query->Get('orderby') == 'post_title_length') {
$orderby = SPrintF('post_title_length %s', $query->Get('order'));
}
return $orderby;
}
示例3: send
public function send(Msg $msg)
{
// Get template file path.
$templatePath = SPrintF('Notifies/SMS/%s.tpl', $msg->getTemplate());
$smarty = JSmarty::get();
if (!$smarty->templateExists($templatePath)) {
throw new jException('Template file not found: ' . $templatePath);
}
$smarty->assign('Config', Config());
foreach (array_keys($msg->getParams()) as $paramName) {
$smarty->assign($paramName, $msg->getParam($paramName));
}
try {
$message = $smarty->fetch($templatePath);
} catch (Exception $e) {
throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
}
$recipient = $msg->getParam('User');
if (!$recipient['Params']['NotificationMethods']['SMS']['Address']) {
throw new jException('Mobile phone number not found for user: ' . $recipient['ID']);
}
$taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'SMS', 'Params' => array($recipient['Params']['NotificationMethods']['SMS']['Address'], $message, $recipient['ID'], $msg->getParam('ChargeFree') ? TRUE : FALSE));
#Debug(SPrintF('[system/classes/SMS.class.php]: msg = %s,',print_r($msg,true)));
$result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
switch (ValueOf($result)) {
case 'error':
throw new jException("Couldn't add task to queue: " . $result);
case 'exception':
throw new jException("Couldn't add task to queue: " . $result->String);
case 'array':
return TRUE;
default:
throw new jException("Unexpected error.");
}
}
示例4: getParams
public function getParams()
{
$Server = DB_Select('Servers', array('Address', 'Params'), array('UNIQ', 'Where' => SPrintF('(SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = %u) = `Servers`.`ID`', $this->params['OrderID'])));
if (!Is_Array($Server)) {
return ERROR | @Trigger_Error(500);
}
$this->params['Server'] = $Server;
return $this->params;
}
示例5: __construct
/**
* Constructor.
*
* @param <type> $CodeID
* @param <type> $String
* @param <type> $Parent
* @return <type>
*/
function __construct($CodeID, $String, $Parent = NULL)
{
$__args_types = array('string', 'string', 'NULL,object');
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
Debug(SPrintF('[Exception]: [%s]=(%s)', $CodeID, $String));
$this->CodeID = $CodeID;
$this->String = $String;
$this->Parent = $Parent;
return $this;
}
示例6: Comp_Load
function Comp_Load($Element)
{
/****************************************************************************/
$__args_types = array('string', '*');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$HostsIDs = System_HostsIDs(SPrintF('comp/%s.comp.php', $Element));
if (Is_Error($HostsIDs)) {
return ERROR | @Trigger_Error('[Comp_Load]: не возможно найти компонент');
}
#-----------------------------------------------------------------------------
$IsCascade = In_Array(COMP_ALL_HOSTS, $__args__, TRUE);
#-----------------------------------------------------------------------------
if ($IsCascade) {
$HostsIDs = Array_Reverse($HostsIDs);
}
#-----------------------------------------------------------------------------
$Result = array();
#-----------------------------------------------------------------------------
foreach ($HostsIDs as $HostID) {
#---------------------------------------------------------------------------
$Path = SPrintF('%s/hosts/%s/comp/%s.comp.php', SYSTEM_PATH, $HostID, $Element);
#---------------------------------------------------------------------------
if (Is_Dir($Path)) {
return ERROR | @Trigger_Error('[Comp_Load]: объект не является компонентом');
}
#---------------------------------------------------------------------------
$Args = $__args__;
#---------------------------------------------------------------------------
Array_UnShift($Args, $Path);
#---------------------------------------------------------------------------
$Comp = Call_User_Func_Array('LoadComp', $Args);
if (Is_Error($Comp)) {
return ERROR | @Trigger_Error('[Comp_Load]: не возможно загрузить компонент');
}
#---------------------------------------------------------------------------
if ($IsCascade) {
$Result[] = $Comp;
} else {
#-------------------------------------------------------------------------
$Result = $Comp;
#-------------------------------------------------------------------------
break;
}
}
#-----------------------------------------------------------------------------
$Loaded =& Link_Get('Comp/Loaded', 'array');
#-----------------------------------------------------------------------------
$Loaded[] = $Element;
#-----------------------------------------------------------------------------
return $Result;
}
示例7: load
static function load($template_name, $vars = array())
{
Extract($vars);
$template_path = Locate_Template($template_name);
Ob_Start();
if (!empty($template_path)) {
include $template_path;
} else {
include SPrintF('%s/templates/%s', Core::$plugin_folder, $template_name);
}
return Ob_Get_Clean();
}
示例8: get
public function get($key)
{
// Check args.
$__args_types = array('string');
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
$result = apc_fetch($key);
if (!$result) {
Debug(SPrintF('[APCCache::get]: не удалось извлечь объект [key=%s]', $key));
}
return $result;
}
示例9: get
function get($key)
{
// Check args.
$__args_types = array('string');
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
$key = SPrintF('[%s]-%s', HOST_ID, $key);
$result = self::$memcached->get($key);
if (!$result) {
Debug(SPrintF('[MemcachedCache::get]: не удалось извлечь объект [key=%s]', $key));
}
return $result;
}
示例10: getParams
public function getParams()
{
#-------------------------------------------------------------------------------
$Server = new DomainServer();
#-------------------------------------------------------------------------------
$IsSelected = $Server->Select((int) $this->params['ServerID']);
#-------------------------------------------------------------------------------
switch (ValueOf($IsSelected)) {
#-------------------------------------------------------------------------------
case 'error':
return ERROR | @Trigger_Error(500);
case 'true':
#-------------------------------------------------------------------------------
// For RegRu only
if ($Server->Settings['Params']['SystemID'] == 'RegRu' && In_Array($this->params['Name'], array('ru', 'su', 'рф'))) {
#-------------------------------------------------------------------------------
$Domain = SprintF("%s.%s", $this->params['DomainName'], $this->params['Name']);
#-------------------------------------------------------------------------------
$Result = $Server->GetUploadID($Domain);
#-------------------------------------------------------------------------------
switch (ValueOf($Result)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'array':
#-------------------------------------------------------------------------------
$UploadID = $Result['UploadID'];
#-------------------------------------------------------------------------------
$this->params['UploadID'] = $UploadID;
#-------------------------------------------------------------------------------
Debug(SPrintF('[system/classes/DomainOrdersOnRegisterMsg.class.php]: UploadID = %s', $UploadID));
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
break;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
return $this->params;
#-------------------------------------------------------------------------------
}
示例11: init
public static function init()
{
#-------------------------------------------------------------------------------
if (self::$instance === NULL) {
#-------------------------------------------------------------------------------
try {
#-------------------------------------------------------------------------------
Debug("[system/classes/auto/CacheManager.class.php]: Start initializing cache system.");
#-------------------------------------------------------------------------------
if (Extension_Loaded(MemcachedCache::EXT_NAME) && File_Exists(SPrintF('%s/.memcached', SYSTEM_PATH))) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Force load MemcachedCache');
#-------------------------------------------------------------------------------
self::$instance = MemcachedCache::getInstance();
#-------------------------------------------------------------------------------
} else {
if (Extension_Loaded(APCCache::EXT_NAME)) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Load APCCache');
#-------------------------------------------------------------------------------
self::$instance = APCCache::getInstance();
#-------------------------------------------------------------------------------
} else {
if (Extension_Loaded(MemcachedCache::EXT_NAME)) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Load MemcachedCache');
#-------------------------------------------------------------------------------
self::$instance = MemcachedCache::getInstance();
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
throw new Exception("Any supported cache not installed in your sysytem.");
}
}
}
#-------------------------------------------------------------------------------
Debug("Cache system has been initialized.");
#-------------------------------------------------------------------------------
} catch (Exception $e) {
#-------------------------------------------------------------------------------
Debug("Cache system has not been installed: " . $e->getTraceAsString());
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
return self::$instance;
#-------------------------------------------------------------------------------
}
示例12: getParams
public function getParams()
{
#-------------------------------------------------------------------------------
#$Server = DB_Select('HostingServers', Array('Address', 'Url', 'Ns1Name', 'Ns2Name', 'MySQL'), Array('UNIQ', 'ID' => $this->params['ServerID']));
$Server = DB_Select('Servers', array('Address', 'Params'), array('UNIQ', 'Where' => SPrintF('(SELECT `ServerID` FROM `OrdersOwners` WHERE `OrdersOwners`.`ID` = %u) = `Servers`.`ID`', $this->params['OrderID'])));
if (!Is_Array($Server)) {
return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$this->params['Server'] = $Server;
#-------------------------------------------------------------------------------
return $this->params;
#-------------------------------------------------------------------------------
}
示例13: Color_RGB_Implode
function Color_RGB_Implode($R, $G, $B)
{
/****************************************************************************/
$__args_types = array('integer');
#-----------------------------------------------------------------------------
$__args__ = Func_Get_Args();
eval(FUNCTION_INIT);
/****************************************************************************/
$R = SPrintF('%02X', $R);
$G = SPrintF('%02X', $G);
$B = SPrintF('%02X', $B);
#-----------------------------------------------------------------------------
return SPrintF('%s%s%s', $R, $G, $B);
}
示例14: send
public function send(Msg $msg)
{
#-------------------------------------------------------------------------------
// Get template file path.
$templatePath = SPrintF('Notifies/ICQ/%s.tpl', $msg->getTemplate());
#-------------------------------------------------------------------------------
$smarty = JSmarty::get();
#-------------------------------------------------------------------------------
if (!$smarty->templateExists($templatePath)) {
throw new jException('Template file not found: ' . $templatePath);
}
#-------------------------------------------------------------------------------
$smarty->assign('Config', Config());
#-------------------------------------------------------------------------------
foreach (array_keys($msg->getParams()) as $paramName) {
$smarty->assign($paramName, $msg->getParam($paramName));
}
#-------------------------------------------------------------------------------
try {
#-------------------------------------------------------------------------------
$message = $smarty->fetch($templatePath);
#-------------------------------------------------------------------------------
} catch (Exception $e) {
#-------------------------------------------------------------------------------
throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$recipient = $msg->getParam('User');
#-------------------------------------------------------------------------------
if (!$recipient['Params']['NotificationMethods']['ICQ']['Address']) {
throw new jException("ICQ UIN not found for user: " . $recipient['ID']);
}
#-------------------------------------------------------------------------------
$taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'ICQ', 'Params' => array($recipient['Params']['NotificationMethods']['ICQ']['Address'], $message, $recipient['ID']));
#-------------------------------------------------------------------------------
$result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
switch (ValueOf($result)) {
case 'error':
throw new jException("Couldn't add task to queue: " . $result);
case 'exception':
throw new jException("Couldn't add task to queue: " . $result->String);
case 'array':
return TRUE;
default:
throw new jException("Unexpected error.");
}
#-------------------------------------------------------------------------------
}
示例15: getArchiveLink
static function getArchiveLink($filter = '', $taxonomy_term = Null)
{
$permalink_structure = Get_Option('permalink_structure');
# Get base url
if ($taxonomy_term) {
$base_url = Get_Term_Link($taxonomy_term);
} else {
$base_url = Get_Post_Type_Archive_Link(self::$post_type_name);
}
if (!empty($permalink_structure)) {
return User_TrailingSlashIt(SPrintF('%1$s/filter:%2$s', RTrim($base_url, '/'), RawURLEncode($filter)));
} else {
return Add_Query_Arg(array('filter' => RawURLEncode($filter)), $base_url);
}
}