当前位置: 首页>>代码示例>>PHP>>正文


PHP parseTemplate函数代码示例

本文整理汇总了PHP中parseTemplate函数的典型用法代码示例。如果您正苦于以下问题:PHP parseTemplate函数的具体用法?PHP parseTemplate怎么用?PHP parseTemplate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parseTemplate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderizar

function renderizar($vista, $datos)
{
    if (!is_array($datos)) {
        http_response_code(404);
        die("Error de renderizador: datos no es un arreglo");
    }
    //union de los dos arreglos
    global $global_context;
    $datos = array_merge($global_context, $datos);
    $viewsPath = "views/";
    $fileTemplate = $vista . ".view.tpl";
    $layoutFile = "layout.view.tpl";
    $htmlContent = "";
    if (file_exists($viewsPath . $layoutFile)) {
        $htmlContent = file_get_contents($viewsPath . $layoutFile);
        if (file_exists($viewsPath . $fileTemplate)) {
            $tmphtml = file_get_contents($viewsPath . $fileTemplate);
            $htmlContent = str_replace("{{{page_content}}}", $tmphtml, $htmlContent);
            //Limpiar Saltos de Pagina
            $htmlContent = str_replace("\n", "", $htmlContent);
            $htmlContent = str_replace("\r", "", $htmlContent);
            $htmlContent = str_replace("\t", "", $htmlContent);
            $htmlContent = str_replace("  ", "", $htmlContent);
            //obtiene un arreglo separando lo distintos tipos de nodos
            $template_code = parseTemplate($htmlContent);
            $htmlResult = renderTemplate($template_code, $datos);
            echo $htmlResult;
        }
    }
}
开发者ID:aetherage,项目名称:Github-Aetherage,代码行数:30,代码来源:template_engine.php

示例2: parseTemplate

<?php

$GLOBALS["KAV4PROXY_NOSESSION"] = true;
$GLOBALS["RELOAD"] = false;
$_GET["LOGFILE"] = "/var/log/artica-postfix/dansguardian.compile.log";
if (posix_getuid() != 0) {
    parseTemplate();
    die;
}
include_once dirname(__FILE__) . "/ressources/class.user.inc";
include_once dirname(__FILE__) . "/ressources/class.groups.inc";
include_once dirname(__FILE__) . "/ressources/class.ldap.inc";
include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
include_once dirname(__FILE__) . "/ressources/class.dansguardian.inc";
include_once dirname(__FILE__) . "/ressources/class.squid.inc";
include_once dirname(__FILE__) . "/ressources/class.squidguard.inc";
include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . "/framework/frame.class.inc";
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (count($argv) > 0) {
    $imploded = implode(" ", $argv);
    if (preg_match("#--verbose#", $imploded)) {
        $GLOBALS["VERBOSE"] = true;
        $GLOBALS["debug"] = true;
        ini_set_verbosed();
    }
    if (preg_match("#--reload#", $imploded)) {
        $GLOBALS["RELOAD"] = true;
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:31,代码来源:exec.squidguard.old.php

示例3: GetContent

function GetContent($part, &$attachments, $post_id, $config)
{
    global $charset, $encoding;
    /*
    if (!function_exists(imap_mime_header_decode))
      echo "you need to install the php-imap extension for full functionality, including mime header decoding\n";
    */
    $meta_return = NULL;
    echo "primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary . "\n";
    DecodeBase64Part($part);
    if (BannedFileName($part->ctype_parameters['name'], $config['BANNED_FILES_LIST'])) {
        return NULL;
    }
    if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") {
        if ($part->disposition == "attachment") {
            $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg");
            foreach ($image_endings as $type) {
                if (eregi(".{$type}\$", $part->d_parameters["filename"])) {
                    $part->ctype_primary = "image";
                    $part->ctype_secondary = $type;
                    break;
                }
            }
        } else {
            $mimeDecodedEmail = DecodeMIMEMail($part->body);
            FilterTextParts($mimeDecodedEmail, $config['PREFER_TEXT_TYPE']);
            foreach ($mimeDecodedEmail->parts as $section) {
                $meta_return .= GetContent($section, $attachments, $post_id, $config);
            }
        }
    }
    if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") {
        $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
        FilterTextParts($mimeDecodedEmail, $config['PREFER_TEXT_TYPE']);
        FilterAppleFile($mimeDecodedEmail);
        foreach ($mimeDecodedEmail->parts as $section) {
            $meta_return .= GetContent($section, $attachments, $post_id, $config);
        }
    } else {
        switch (strtolower($part->ctype_primary)) {
            case 'multipart':
                FilterTextParts($part, $config['PREFER_TEXT_TYPE']);
                foreach ($part->parts as $section) {
                    $meta_return .= GetContent($section, $attachments, $post_id, $config);
                }
                break;
            case 'text':
                $tmpcharset = trim($part->ctype_parameters['charset']);
                if ($tmpcharset != '') {
                    $charset = $tmpcharset;
                }
                $tmpencoding = trim($part->headers['content-transfer-encoding']);
                if ($tmpencoding != '') {
                    $encoding = $tmpencoding;
                }
                $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $config['MESSAGE_ENCODING'], $config['MESSAGE_DEQUOTE']);
                //go through each sub-section
                if ($part->ctype_secondary == 'enriched') {
                    //convert enriched text to HTML
                    $meta_return .= etf2HTML($part->body) . "\n";
                } elseif ($part->ctype_secondary == 'html') {
                    //strip excess HTML
                    //$meta_return .= HTML2HTML($part->body ) . "\n";
                    $meta_return .= $part->body . "\n";
                } else {
                    //regular text, so just strip the pgp signature
                    if (ALLOW_HTML_IN_BODY) {
                        $meta_return .= $part->body . "\n";
                    } else {
                        $meta_return .= htmlentities($part->body) . "\n";
                    }
                    $meta_return = StripPGP($meta_return);
                }
                break;
            case 'image':
                echo "looking at an image\n";
                $file_id = postie_media_handle_upload($part, $post_id);
                $file = wp_get_attachment_url($file_id);
                $cid = trim($part->headers["content-id"], "<>");
                //cids are in <cid>
                $the_post = get_post($file_id);
                /* TODO make these options */
                $attachments["html"][] = parseTemplate($file_id, $part->ctype_primary, $config['IMAGETEMPLATE']);
                if ($cid) {
                    $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1);
                }
                break;
            case 'audio':
                $file_id = postie_media_handle_upload($part, $post_id);
                $file = wp_get_attachment_url($file_id);
                $cid = trim($part->headers["content-id"], "<>");
                //cids are in <cid>
                if (in_array($part->ctype_secondary, $config['AUDIOTYPES'])) {
                    $audioTemplate = $config['AUDIOTEMPLATE'];
                } else {
                    $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $config['ICON_SET'], $config['ICON_SIZE']);
                    $audioTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>';
                }
                $attachments["html"][] = parseTemplate($file_id, $part->ctype_primary, $audioTemplate);
                break;
//.........这里部分代码省略.........
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:101,代码来源:postie-functions.php

示例4: parseTemplate

function parseTemplate($subject, $template, $language = NULL)
{
    // If template/subTemplate is listed as ignored, return false
    if (isIgnored($template, $tplName)) {
        return false;
    }
    // Find subtemplates and remove Subtemplates, which are listed as ignored!
    preg_match_all('~\\{((?>[^{}]+)|(?R))*\\}~x', $template, $subTemplates);
    foreach ($subTemplates[0] as $key => $subTemplate) {
        $subTemplate = preg_replace("/(^\\{\\{)|(\\}\\}\$)/", "", $subTemplate);
        // Cut Brackets / {}
        if (isIgnored($subTemplate, $tplName)) {
            $template = str_replace('{{' . $subTemplate . '}}', '', $template);
        }
    }
    // Replace "|" inside subtemplates with "\\" to avoid splitting them like triples
    $template = preg_replace_callback("/(\\{{2})([^\\}\\|]+)(\\|)([^\\}]+)(\\}{2})/", 'replaceBarInSubtemplate', $template);
    $equal = preg_match('~=~', $template);
    // Gruppe=[[Gruppe-3-Element|3]]  ersetzt durch Gruppe=[[Gruppe-3-Element***3]]
    do {
        $template = preg_replace('/\\[\\[([^\\]]+)\\|([^\\]]*)\\]\\]/', '[[\\1***\\2]]', $template, -1, $count);
    } while ($count);
    $triples = explode('|', $template);
    if (count($triples) <= $GLOBALS['W2RCFG']['minAttributeCount']) {
        return false;
    }
    $templateName = strtolower(trim(array_shift($triples)));
    //	if(!isBlanknote($subject) && !$GLOBALS['onefile'])
    //		$GLOBALS['filename']=urlencode($templateName).'.'.$GLOBALS['outputFormat'];
    // Array containing URIs to subtemplates. If the same URI is in use already, add a number to it
    $knownSubTemplateURI = array();
    // subject
    $s = $subject;
    $z = 0;
    foreach ($triples as $triple) {
        if ($equal) {
            $split = explode('=', $triple, 2);
            if (count($split) < 2) {
                continue;
            }
            list($p, $o) = $split;
            $p = trim($p);
        } else {
            $p = "property" . ++$z;
            $o = $triple;
        }
        $o = trim($o);
        //if property date and object an timespan we extract it with following special case
        if ($p == "date") {
            $o = str_replace("[", "", str_replace("]", "", $o));
            $o = str_replace("&ndash;", "-", $o);
        }
        // Do not allow empty Properties
        if (strlen($p) < 1) {
            continue;
        }
        if (in_array($p, $GLOBALS['W2RCFG']['ignoreProperties'])) {
            continue;
        }
        if ($o !== '' & $o !== NULL) {
            $pred = $p;
            // if(!$GLOBALS['templateStatistics'] && $GLOBALS['propertyStat'][$p]['count']<10)
            //continue;
            // predicate
            // Write properties CamelCase, no underscores, no hyphens. If first char is digit, add _ at the beginning
            $p = propertyToCamelCase($p);
            // Add prefixProperties if set true in config.inc.php
            if ($GLOBALS['prefixPropertiesWithTemplateName']) {
                $p = propertyToCamelCase($templateName) . '_' . $p;
            } else {
                if (!$equal) {
                    $p = propertyToCamelCase($templateName . "_" . $p);
                }
            }
            // object
            $o = str_replace('***', '|', $o);
            // Remove HTML Markup for whitespaces
            $o = str_replace('&nbsp;', ' ', $o);
            //remove <ref> Content</ref>
            //$o = preg_replace('/(<ref>.+?<\/ref>)/s','',$o);
            // Parse Subtemplates (only parse Subtemplates with values!)
            if (preg_match_all("/(\\{{2})([^\\}]+)(\\}{2})/", $o, $subTemplates, PREG_SET_ORDER)) {
                foreach ($subTemplates as $subTemplate) {
                    // Replace #### back to |, in order to parse subtemplate properly
                    $tpl = str_replace("####", "|", $subTemplate[2]);
                    // If subtemplate contains values, the subject is only the first word
                    if (preg_match("/(^[^\\|]+)(\\|)/", $tpl, $match)) {
                        $subTemplateSubject = $subject . '/' . $p . '/' . $match[1];
                    } else {
                        $subTemplateSubject = $subject . '/' . $p . '/' . $tpl;
                    }
                    // Look up URI in Array containing known URIs, if found add counter to URI.
                    // e.g. http://dbpedia.org/United_Kingdom/footnote/cite_web
                    // ==>  http://dbpedia.org/United_Kingdom/footnote/cite_web1 ...
                    if (!isset($knownSubTemplateURI[$subTemplateSubject])) {
                        // array_push( $knownSubTemplateURI, $subTemplateSubject );
                        $knownSubTemplateURI[$subTemplateSubject] = 0;
                    } else {
                        $knownSubTemplateURI[$subTemplateSubject]++;
                        $subTemplateSubject .= $knownSubTemplateURI[$subTemplateSubject];
//.........这里部分代码省略.........
开发者ID:ljarray,项目名称:dbpedia,代码行数:101,代码来源:extractTemplates.php

示例5: sendNotificationEmail

 function sendNotificationEmail($type)
 {
     jTipsLogger::_log('preparing to send ' . $type . ' notification email', 'INFO');
     global $jTips, $database;
     $subject = stripslashes($jTips["UserNotify" . $type . "Subject"]);
     $message = stripslashes($jTips["UserNotify" . $type . "Message"]);
     $from_name = $jTips['UserNotifyFromName'];
     $from_email = $jTips['UserNotifyFromEmail'];
     $variables = array();
     $values = array();
     foreach (get_object_vars($this) as $key => $val) {
         if (is_string($key)) {
             array_push($variables, $key);
             $values[$key] = $val;
         }
     }
     if (isJoomla15()) {
         $user = new JUser();
     } else {
         $user = new mosUser($database);
     }
     $user->load($this->user_id);
     foreach (get_object_vars($user) as $key => $val) {
         if (is_string($key)) {
             array_push($variables, $key);
             $values[$key] = $val;
         }
     }
     // find out which season this is for an add it to the avaialble variables
     $query = "SELECT name FROM #__jtips_seasons WHERE id = '" . $this->season_id . "'";
     $database->setQuery($query);
     $season = $database->loadResult();
     $values['competition'] = $season;
     $values['season'] = $season;
     $body = parseTemplate($message, $variables, $values);
     jTipsLogger::_log('sending email: ' . $body, 'INFO');
     if (jTipsMail($from_email, $from_name, $this->getUserField('email'), $subject, $body)) {
         jTipsLogger::_log('notification email sent successfully', 'INFO');
         return TRUE;
     } else {
         jTipsLogger::_log('sending notification email failed', 'ERROR');
         return FALSE;
     }
 }
开发者ID:joomux,项目名称:jTips,代码行数:44,代码来源:juser.class.php

示例6: IN

 $query = "SELECT ju.*, u.email, u.name, u.username FROM #__jtips_users ju JOIN #__users u ON ju.user_id = u.id WHERE ju.status = 1 AND season_id = {$season_id} AND ju.id NOT IN ('" . implode("', '", $user_ids) . "') AND u.block = 0";
 //echo $query;
 $database->setQuery($query);
 $rows = (array) $database->loadAssocList();
 jTipsLogger::_log('found ' . count($rows) . ' users to try to send to ', 'info');
 foreach ($rows as $user) {
     ksort($user);
     $jTipsUser = new jTipsUser($database);
     $jTipsUser->load($user['id']);
     //jTipsLogger::_log($jTipsUser);
     if ($jTipsUser->getPreference('email_reminder')) {
         $recipient = $user['email'];
         $user['round'] = $round[0]['round'];
         $user['competition'] = $round[0]['season'];
         $user['season'] = $round[0]['season'];
         $body = parseTemplate($body, $variables, $user);
         $record = array('round_id' => $round[0]['id'], 'user_id' => $user['id'], 'notified' => 0);
         $attempted++;
         if (jTipsMail($from, $fromname, $recipient, $subject, $body)) {
             $record['notified'] = 1;
             jTipsLogger::_log('sent reminder email to ' . $recipient . ' subject: ' . $subject . ' from: ' . $fromname . ' <' . $from . '>', 'info');
             $sent++;
         } else {
             jTipsLogger::_log('failed to send reminder email to ' . $recipient, 'error');
         }
         $jRemind = new jRemind($database);
         $jRemindParams = array('round_id' => $record['round_id'], 'user_id' => $record['user_id']);
         $jRemind->loadByParams($jRemindParams);
         $jRemind->attempts++;
         $jRemind->bind($record);
         $jRemind->save();
开发者ID:joomux,项目名称:jTips,代码行数:31,代码来源:MailMan.php

示例7: parseCommand

function parseCommand($line, $vars, $handle)
{
    global $ignore, $ignorestack, $ignorelevel, $config, $listing, $vars;
    // process content of included file
    if (strncmp(trim($line), '[websvn-include:', 16) == 0) {
        if (!$ignore) {
            $line = trim($line);
            $file = substr($line, 16, -1);
            parseTemplate($config->getTemplatePath() . $file, $vars, $listing);
        }
        return true;
    }
    // Check for test conditions
    if (strncmp(trim($line), '[websvn-test:', 13) == 0) {
        if (!$ignore) {
            $line = trim($line);
            $var = substr($line, 13, -1);
            $neg = $var[0] == '!';
            if ($neg) {
                $var = substr($var, 1);
            }
            if (empty($vars[$var]) ^ $neg) {
                array_push($ignorestack, $ignore);
                $ignore = true;
            }
        } else {
            $ignorelevel++;
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-else]', 13) == 0) {
        if ($ignorelevel == 0) {
            $ignore = !$ignore;
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-endtest]', 16) == 0) {
        if ($ignorelevel > 0) {
            $ignorelevel--;
        } else {
            $ignore = array_pop($ignorestack);
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-getlisting]', 19) == 0) {
        global $svnrep, $path, $rev, $peg;
        if (!$ignore) {
            $svnrep->listFileContents($path, $rev, $peg);
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-defineicons]', 19) == 0) {
        global $icons;
        if (!isset($icons)) {
            $icons = array();
        }
        // Read all the lines until we reach the end of the definition, storing
        // each one...
        if (!$ignore) {
            while (!feof($handle)) {
                $line = trim(fgets($handle));
                if (strncmp($line, '[websvn-enddefineicons]', 22) == 0) {
                    return true;
                }
                $eqsign = strpos($line, '=');
                $match = substr($line, 0, $eqsign);
                $def = substr($line, $eqsign + 1);
                $icons[$match] = $def;
            }
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-icon]', 13) == 0) {
        global $icons, $vars;
        if (!$ignore) {
            // The current filetype should be defined my $vars['filetype']
            if (!empty($icons[$vars['filetype']])) {
                echo parseTags($icons[$vars['filetype']], $vars);
            } else {
                if (!empty($icons['*'])) {
                    echo parseTags($icons['*'], $vars);
                }
            }
        }
        return true;
    }
    if (strncmp(trim($line), '[websvn-treenode]', 17) == 0) {
        global $icons, $vars;
        if (!$ignore) {
            if (!empty($icons['i-node']) && !empty($icons['t-node']) && !empty($icons['l-node'])) {
                for ($n = 1; $n < $vars['level']; $n++) {
                    if ($vars['last_i_node'][$n]) {
                        echo parseTags($icons['e-node'], $vars);
                    } else {
                        echo parseTags($icons['i-node'], $vars);
                    }
                }
                if ($vars['level'] != 0) {
                    if ($vars['node'] == 0) {
                        echo parseTags($icons['t-node'], $vars);
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:suitex,代码行数:101,代码来源:template.php

示例8: str_replace

        $listing[$i]['projectlink'] = null;
        // Because template.php won't unset this
        $i++;
        // Causes the subsequent lines to store data in the next array slot.
        $listing[$i]['groupid'] = null;
        // Because template.php won't unset this
    }
    $listing[$i]['clientrooturl'] = $project->clientRootURL;
    // Create project (repository) listing
    $url = str_replace('&amp;', '', $config->getURL($project, '', 'dir'));
    $name = $config->flatIndex ? $project->getDisplayName() : $project->name;
    $listing[$i]['projectlink'] = '<a href="' . $url . '">' . $name . '</a>';
    $listing[$i]['rowparity'] = $parity % 2;
    $parity++;
    $listing[$i]['groupparity'] = $groupparity % 2;
    $groupparity++;
    $i++;
}
if (empty($listing) && !empty($projects)) {
    $vars['error'] = $lang['NOACCESS'];
}
$vars['flatview'] = $config->flatIndex;
$vars['treeview'] = !$config->flatIndex;
$vars['opentree'] = $config->openTree;
$vars['groupcount'] = $groupcount;
// Indicates whether any groups were present.
$vars['template'] = 'index';
parseTemplate($config->getTemplatePath() . 'header.tmpl', $vars, $listing);
parseTemplate($config->getTemplatePath() . 'index.tmpl', $vars, $listing);
parseTemplate($config->getTemplatePath() . 'footer.tmpl', $vars, $listing);
开发者ID:laiello,项目名称:suitex,代码行数:30,代码来源:index.php

示例9: tempnam

                $vars['showalllink'] = '<a href="' . $diff . $passIgnoreWhitespace . '&amp;all=1' . '">' . $lang['SHOWENTIREFILE'] . '</a>';
            }
            $passShowAll = $all ? '&amp;all=1' : '';
            if ($ignoreWhitespace) {
                $vars['regardwhitespacelink'] = '<a href="' . $diff . $passShowAll . '">' . $lang['REGARDWHITESPACE'] . '</a>';
            } else {
                $vars['ignorewhitespacelink'] = '<a href="' . $diff . $passShowAll . '&amp;ignorews=1">' . $lang['IGNOREWHITESPACE'] . '</a>';
            }
            // Get the contents of the two files
            $newerFile = tempnam($config->getTempDir(), '');
            $highlightedNew = $svnrep->getFileContents($history->entries[0]->path, $newerFile, $history->entries[0]->rev, $peg, '', true);
            $olderFile = tempnam($config->getTempDir(), '');
            $highlightedOld = $svnrep->getFileContents($history->entries[1]->path, $olderFile, $history->entries[1]->rev, $peg, '', true);
            // TODO: Figured out why diffs across a move/rename are currently broken.
            $ent = !$highlightedNew && !$highlightedOld;
            $listing = do_diff($all, $ignoreWhitespace, $ent, $newerFile, $olderFile);
            // Remove our temporary files
            @unlink($newerFile);
            @unlink($olderFile);
        }
    }
    if (!$rep->hasReadAccess($path, false)) {
        $vars['error'] = $lang['NOACCESS'];
    }
}
$vars['template'] = 'diff';
$template = $rep ? $rep->getTemplatePath() : $config->getTemplatePath();
parseTemplate($template . 'header.tmpl', $vars, $listing);
parseTemplate($template . 'diff.tmpl', $vars, $listing);
parseTemplate($template . 'footer.tmpl', $vars, $listing);
开发者ID:laiello,项目名称:suitex,代码行数:30,代码来源:diff.php

示例10: requestResources

 public function requestResources($format = 'json')
 {
     $accountId = $this->input->get_post('account_id', TRUE);
     $gameId = $this->input->get_post('game_id', TRUE);
     if (!empty($accountId)) {
         /*
          * 检测参数合法性
          */
         $authToken = $this->authKey[$gameId]['auth_key'];
         $check = array($accountId, $gameId);
         //$this->load->helper('security');
         //exit(do_hash(do_hash(implode('|||', $check) . '|||' . $authToken, 'md5')));
         if (!$this->param_check->check($check, $authToken)) {
             $jsonData = array('flag' => 0x1, 'message' => 0);
             echo $this->return_format->format($jsonData, $format);
             $logParameter = array('log_action' => 'PARAM_INVALID', 'account_guid' => '', 'account_name' => $accountId);
             $this->logs->write($logParameter);
             exit;
         }
         /*
          * 检查完毕
          */
         $this->load->model('data/resources', 'resource');
         $this->load->helper('template');
         $this->load->config('game_init_data');
         $sql = $this->config->item('sql_update_resource_amount');
         $parser = array('update_time' => $this->config->item('resource_update_time'), 'account_id' => $accountId);
         $this->resource->query(parseTemplate($sql, $parser));
         $result = $this->resource->get($accountId);
         if ($result != FALSE) {
             $jsonData = array('flag' => 0x1, 'message' => 1, 'resource_list' => $result);
             echo $this->return_format->format($jsonData, $format);
             $logParameter = array('log_action' => 'ACCOUNT_REQUEST_RESOURCE_SUCCESS', 'account_guid' => '', 'account_name' => $accountId);
             $this->logs->write($logParameter);
         } else {
             $jsonData = array('flag' => 0x1, 'message' => -1);
             echo $this->return_format->format($jsonData, $format);
             $logParameter = array('log_action' => 'ACCOUNT_ERROR_NO_ACCOUNTID', 'account_guid' => '', 'account_name' => $accountId);
             $this->logs->write($logParameter);
         }
     } else {
         $jsonData = array('flag' => 0x1, 'message' => -99);
         echo $this->return_format->format($jsonData, $format);
         $logParameter = array('log_action' => 'ACCOUNT_ERROR_NO_PARAM', 'account_guid' => '', 'account_name' => '');
         $this->logs->write($logParameter);
     }
 }
开发者ID:johnnyeven,项目名称:zeus-flash-engine,代码行数:47,代码来源:initialization.php

示例11: wikiplugin_showreference

function wikiplugin_showreference($data, $params)
{
    global $prefs;
    $params['title'] = trim($params['title']);
    $params['showtitle'] = trim($params['showtitle']);
    $params['hlevel'] = trim($params['hlevel']);
    $title = 'Bibliography';
    if (isset($params['title']) && $params['title'] != '') {
        $title = $params['title'];
    }
    if (isset($params['showtitle'])) {
        $showtitle = $params['showtitle'];
    }
    if ($showtitle == 'yes' || $showtitle == '') {
        $showtitle = 1;
    } else {
        $showtitle = 0;
    }
    $hlevel_start = '<h1>';
    $hlevel_end = '</h1>';
    if (isset($params['hlevel']) && $params['hlevel'] != '') {
        if ($params['hlevel'] != '0') {
            $hlevel_start = '<h' . $params['hlevel'] . '>';
            $hlevel_end = '</h' . $params['hlevel'] . '>';
        } else {
            $hlevel_start = '';
            $hlevel_end = '';
        }
    } else {
        $hlevel_start = '<h1>';
        $hlevel_end = '</h1>';
    }
    if ($prefs['wikiplugin_showreference'] == 'y') {
        $page_id = $GLOBALS['info']['page_id'];
        $tags = array('~biblio_code~' => 'biblio_code', '~author~' => 'author', '~title~' => 'title', '~year~' => 'year', '~part~' => 'part', '~uri~' => 'uri', '~code~' => 'code', '~publisher~' => 'publisher', '~location~' => 'location');
        $htm = '';
        $referenceslib = TikiLib::lib('references');
        $references = $referenceslib->list_assoc_references($page_id);
        $referencesData = array();
        $is_global = 1;
        if (isset($GLOBALS['referencesData']) && is_array($GLOBALS['referencesData'])) {
            $referencesData = $GLOBALS['referencesData'];
            $is_global = 1;
        } else {
            foreach ($references['data'] as $data) {
                array_push($referencesData, $data['biblio_code']);
            }
            $is_global = 0;
        }
        if (is_array($referencesData)) {
            $referencesData = array_unique($referencesData);
            $htm .= '<div class="references">';
            if ($showtitle) {
                $htm .= $hlevel_start . $title . $hlevel_end;
            }
            $htm .= '<hr>';
            $htm .= '<ul style="list-style: none outside none;">';
            if (count($referencesData)) {
                $values = $referenceslib->get_reference_from_code_and_page($referencesData, $page_id);
            } else {
                $values = array();
            }
            if ($is_global) {
                $excluded = array();
                foreach ($references['data'] as $key => $value) {
                    if (!array_key_exists($key, $values['data'])) {
                        $excluded[$key] = $references['data'][$key]['biblio_code'];
                    }
                }
                foreach ($excluded as $ex) {
                    array_push($referencesData, $ex);
                }
            }
            foreach ($referencesData as $index => $ref) {
                $ref_no = $index + 1;
                $text = '';
                $cssClass = '';
                if (array_key_exists($ref, $values['data'])) {
                    if ($values['data'][$ref]['style'] != '') {
                        $cssClass = $values['data'][$ref]['style'];
                    }
                    $text = parseTemplate($tags, $ref, $values['data']);
                } else {
                    if (array_key_exists($ref, $excluded)) {
                        $text = parseTemplate($tags, $ref, $references['data']);
                    }
                }
                $anchor = "<a name='" . $ref . "'>&nbsp;</a>";
                if (strlen($text)) {
                    $htm .= "<li class='" . $cssClass . "'>" . $anchor . $ref_no . ". " . $text . '</li>';
                } else {
                    $htm .= "<li class='" . $cssClass . "' style='font-style:italic'>" . $anchor . $ref_no . '. missing bibliography definition' . '</li>';
                }
            }
            $htm .= '</ul>';
            $htm .= '<hr>';
            $htm .= '</div>';
        }
        return $htm;
    }
//.........这里部分代码省略.........
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:101,代码来源:wikiplugin_showreference.php

示例12: array

    // Hook supported.
    $base_hook = array('hook_entity_presave' => 'entity_presave', 'hook_entity_update' => 'entity_update', 'hook_entity_view' => 'entity_view', 'hook_node_load' => 'node_load', 'hook_node_presave' => 'node_presave', 'hook_node_update' => 'node_update', 'hook_node_insert' => 'node_insert', 'hook_node_view' => 'node_view', 'hook_user_insert' => 'user_insert', 'hook_user_presave' => 'user_presave', 'hook_user_update' => 'user_update', 'hook_menu' => 'menu', 'hook_action_info' => 'action_info');
    // Special case for 'model.module' file.
    if (!isset($_POST['hooks'])) {
        $data = str_replace('%HOOKS%', '', $data);
    } else {
        $hook_info = '';
        foreach ($_POST['hooks'] as $key => $hook) {
            $hook_info .= "module_load_include('inc', '" . $_POST['machine_name'] . "', '" . $_POST['machine_name'] . "." . $base_hook[$hook] . "');" . PHP_EOL;
            parseTemplate('model.' . $base_hook[$hook] . '.inc', $dir, $replace_tokens);
        }
        $data = str_replace('%HOOKS%', $hook_info, $data);
    }
    file_put_contents($destination, $data);
    $files = array('model.install', 'model.features.inc', 'model.views_default.inc', 'model_modelentity.admin.inc', 'model_modelentity_type.admin.inc', 'templates/entities/modelentity.tpl.php', 'includes/Modelentity.inc', 'includes/ModelentityController.inc', 'includes/ModelentityType.inc', 'includes/ModelentityTypeController.inc', 'includes/views/model.views.inc', 'includes/views/modelentity_handler_link_field.inc', 'includes/views/modelentity_handler_modelentity_operations_field.inc', 'includes/views/modelentity_handler_edit_link_field.inc', 'includes/views/modelentity_handler_delete_link_field.inc');
    foreach ($files as $file) {
        parseTemplate($file, $dir, $replace_tokens);
    }
    // Create and send zip file.
    $file = createZipFile($dir, $dir . '.zip', true);
    $file_name = basename($dir . '.zip');
    header('Content-Type: application/zip');
    header("Content-Disposition: attachment; filename={$file_name}");
    header('Content-Length: ' . filesize($dir . '.zip'));
    readfile($dir . '.zip');
    exit;
}
// Detect language.
$language = detectLanguage(array('en', 'fr'), 'en');
// Display form generator.
include 'generator/index.html';
开发者ID:GoZOo,项目名称:entity-generator,代码行数:31,代码来源:index.php

示例13:

<?php
$GLOBALS["KAV4PROXY_NOSESSION"]=true;
$GLOBALS["RELOAD"]=false;
$_GET["LOGFILE"]="/var/log/artica-postfix/dansguardian.compile.log";
if(posix_getuid()<>0){parseTemplate();die();}

include_once(dirname(__FILE__)."/ressources/class.user.inc");
include_once(dirname(__FILE__)."/ressources/class.groups.inc");
include_once(dirname(__FILE__)."/ressources/class.ldap.inc");
include_once(dirname(__FILE__)."/ressources/class.system.network.inc");
include_once(dirname(__FILE__)."/ressources/class.dansguardian.inc");
include_once(dirname(__FILE__)."/ressources/class.squid.inc");
include_once(dirname(__FILE__)."/ressources/class.squidguard.inc");
include_once(dirname(__FILE__)."/ressources/class.mysql.inc");
include_once(dirname(__FILE__).'/framework/class.unix.inc');
include_once(dirname(__FILE__)."/framework/frame.class.inc");


if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
if(count($argv)>0){
	$imploded=implode(" ",$argv);
	if(preg_match("#--verbose#",$imploded)){$GLOBALS["VERBOSE"]=true;$GLOBALS["debug"]=true;ini_set_verbosed(); }
	if(preg_match("#--reload#",$imploded)){$GLOBALS["RELOAD"]=true;}
	if(preg_match("#--shalla#",$imploded)){$GLOBALS["SHALLA"]=true;}
	if(preg_match("#--catto=(.+?)\s+#",$imploded,$re)){$GLOBALS["CATTO"]=$re[1];}
	if($argv[1]=="--inject"){echo inject($argv[2],$argv[3]);exit;}
	if($argv[1]=="--conf"){echo conf();exit;}
	if($argv[1]=="--ufdbguard-compile"){echo UFDBGUARD_COMPILE_SINGLE_DB($argv[2]);exit;}	
	if($argv[1]=="--ufdbguard-dbs"){echo UFDBGUARD_COMPILE_DB();exit;}
	if($argv[1]=="--ufdbguard-miss-dbs"){echo ufdbguard_recompile_missing_dbs();exit;}
	if($argv[1]=="--ufdbguard-recompile-dbs"){echo ufdbguard_recompile_dbs();exit;}
开发者ID:rsd,项目名称:artica-1.5,代码行数:31,代码来源:exec.squidguard.php

示例14: processData

function processData($data, $path, $file)
{
    // Check if the file contained a class definition
    if ($data[0]['type'] === 'class') {
        $outFile = OUT_FOLDER . '/' . $data[0]['name'] . '.html';
        foreach ($data as $key => $item) {
            //var_dump($item);
            switch ($item['type']) {
                case 'class':
                    // Write the class header details
                    file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classHeader.html'), $item, $path, $file));
                    file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classBody.html'), $item, $path, $file), FILE_APPEND);
                    break;
                case 'function':
                    file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/functionBody.html'), $item, $path, $file), FILE_APPEND);
                    break;
            }
        }
        file_put_contents($outFile, parseTemplate(file_get_contents(TEMPLATES_FOLDER . '/classFooter.html'), $item, $path, $file), FILE_APPEND);
    } else {
        $outFile = OUT_FOLDER . '/globals.html';
    }
}
开发者ID:ParallaxMaster,项目名称:ige,代码行数:23,代码来源:generate.php

示例15: GetContent

function GetContent($part, &$attachments, $post_id, $poster, $config)
{
    extract($config);
    global $charset, $encoding;
    /*
    if (!function_exists(imap_mime_header_decode))
      echo "you need to install the php-imap extension for full functionality, including mime header decoding\n";
    */
    $meta_return = NULL;
    echo "primary= " . $part->ctype_primary . ", secondary = " . $part->ctype_secondary . "\n";
    DecodeBase64Part($part);
    if (BannedFileName($part->ctype_parameters['name'], $banned_files_list)) {
        return NULL;
    }
    if ($part->ctype_primary == "application" && $part->ctype_secondary == "octet-stream") {
        if ($part->disposition == "attachment") {
            $image_endings = array("jpg", "png", "gif", "jpeg", "pjpeg");
            foreach ($image_endings as $type) {
                if (eregi(".{$type}\$", $part->d_parameters["filename"])) {
                    $part->ctype_primary = "image";
                    $part->ctype_secondary = $type;
                    break;
                }
            }
        } else {
            $mimeDecodedEmail = DecodeMIMEMail($part->body);
            FilterTextParts($mimeDecodedEmail, $prefer_text_type);
            foreach ($mimeDecodedEmail->parts as $section) {
                $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config);
            }
        }
    }
    if ($part->ctype_primary == "multipart" && $part->ctype_secondary == "appledouble") {
        $mimeDecodedEmail = DecodeMIMEMail("Content-Type: multipart/mixed; boundary=" . $part->ctype_parameters["boundary"] . "\n" . $part->body);
        FilterTextParts($mimeDecodedEmail, $prefer_text_type);
        FilterAppleFile($mimeDecodedEmail);
        foreach ($mimeDecodedEmail->parts as $section) {
            $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config);
        }
    } else {
        // fix filename (remove non-standard characters)
        $filename = preg_replace("/[^\t\n\r -]/", "", $part->ctype_parameters['name']);
        switch (strtolower($part->ctype_primary)) {
            case 'multipart':
                FilterTextParts($part, $prefer_text_type);
                foreach ($part->parts as $section) {
                    $meta_return .= GetContent($section, $attachments, $post_id, $poster, $config);
                }
                break;
            case 'text':
                $tmpcharset = trim($part->ctype_parameters['charset']);
                if ($tmpcharset != '') {
                    $charset = $tmpcharset;
                }
                $tmpencoding = trim($part->headers['content-transfer-encoding']);
                if ($tmpencoding != '') {
                    $encoding = $tmpencoding;
                }
                $part->body = HandleMessageEncoding($part->headers["content-transfer-encoding"], $part->ctype_parameters["charset"], $part->body, $message_encoding, $message_dequote);
                //go through each sub-section
                if ($part->ctype_secondary == 'enriched') {
                    //convert enriched text to HTML
                    $meta_return .= etf2HTML($part->body) . "\n";
                } elseif ($part->ctype_secondary == 'html') {
                    //strip excess HTML
                    //$meta_return .= HTML2HTML($part->body ) . "\n";
                    $meta_return .= $part->body . "\n";
                } else {
                    //regular text, so just strip the pgp signature
                    if (ALLOW_HTML_IN_BODY) {
                        $meta_return .= $part->body . "\n";
                    } else {
                        $meta_return .= htmlentities($part->body) . "\n";
                    }
                    $meta_return = StripPGP($meta_return);
                }
                break;
            case 'image':
                $file_id = postie_media_handle_upload($part, $post_id, $poster);
                $file = wp_get_attachment_url($file_id);
                $cid = trim($part->headers["content-id"], "<>");
                //cids are in <cid>
                $the_post = get_post($file_id);
                $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $imagetemplate);
                if ($cid) {
                    $attachments["cids"][$cid] = array($file, count($attachments["html"]) - 1);
                }
                break;
            case 'audio':
                $file_id = postie_media_handle_upload($part, $post_id, $poster);
                $file = wp_get_attachment_url($file_id);
                $cid = trim($part->headers["content-id"], "<>");
                //cids are in <cid>
                if (in_array($part->ctype_secondary, $audiotypes)) {
                    $audioTemplate = $audiotemplate;
                } else {
                    $icon = chooseAttachmentIcon($file, $part->ctype_primary, $part->ctype_secondary, $icon_set, $icon_size);
                    $audioTemplate = '<a href="{FILELINK}">' . $icon . '{FILENAME}</a>';
                }
                $attachments["html"][$filename] = parseTemplate($file_id, $part->ctype_primary, $audioTemplate);
//.........这里部分代码省略.........
开发者ID:raamdev,项目名称:postie,代码行数:101,代码来源:postie-functions.php


注:本文中的parseTemplate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。