本文整理汇总了PHP中smarty_function_mtcgipath函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_function_mtcgipath函数的具体用法?PHP smarty_function_mtcgipath怎么用?PHP smarty_function_mtcgipath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_function_mtcgipath函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_mttagsearchlink
function smarty_function_mttagsearchlink($args, &$ctx)
{
$tag = $ctx->stash('Tag');
if (!$tag) {
return '';
}
if (is_array($tag)) {
$name = $tag['tag_name'];
} else {
$name = $tag;
}
$param = '';
if ($include_blogs = $args['include_blogs'] ? $args['include_blogs'] : $ctx->stash('include_blogs')) {
if ($args['include_blogs'] != 'all') {
$param = 'IncludeBlogs=' . $include_blogs;
}
} elseif ($exclude_blogs = $args['exclude_blogs'] ? $args['exclude_blogs'] : $ctx->stash('exclude_blogs')) {
$param = 'ExcludeBlogs=' . $exclude_blogs;
} elseif ($blog_ids = $args['blog_ids'] ? $args['blog_ids'] : $ctx->stash('blog_ids')) {
$param = 'IncludeBlogs=' . $blog_ids;
} else {
$blog_id = $ctx->stash('blog_id');
$param = 'blog_id=' . $blog_id;
}
require_once "function.mtcgipath.php";
$search = smarty_function_mtcgipath($args, $ctx);
$search .= $ctx->mt->config('SearchScript');
$link = $search . '?' . $param . ($param ? '&' : '') . 'tag=' . urlencode($name);
$link .= '&limit=' . $ctx->mt->config('MaxResults');
return $link;
}
示例2: smarty_function_mtremotesigninlink
function smarty_function_mtremotesigninlink($args, &$ctx)
{
// status: complete
// parameters: none
global $_typekeytoken_cache;
$blog = $ctx->stash('blog');
$auths = $blog['blog_commenter_authenticators'];
if (!preg_match('/TypeKey/', $auths)) {
return $ctx->error($ctx->mt->translate("TypePad authentication is not enabled in this blog. MTRemoteSignInLink can't be used."));
}
$blog_id = $blog['blog_id'];
$token = 0;
if (isset($_typekeytoken_cache[$blog_id])) {
$token = $_typekeytoken_cache[$blog_id];
} else {
$token = $blog['blog_remote_auth_token'];
if ($token) {
$_typekeytoken_cache[$blog_id] = $token;
}
}
$entry = $ctx->stash('entry');
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$return = $path . $ctx->mt->config('CommentScript') . '%3f__mode=handle_sign_in%26' . 'key=TypeKey%26' . ($args['static'] ? 'static=1' : 'static=0') . '%26entry_id=' . $entry['entry_id'];
$lang = $args['lang'];
$lang or $lang = $ctx->mt->config('DefaultLanguage');
$lang or $lang = $blog['blog_language'];
return $ctx->mt->config('SignOnURL') . '&lang=' . $lang . (isset($blog['blog_require_typekey_emails']) && $blog['blog_require_typekey_emails'] ? '&need_email=1' : '') . '&t=' . $token . '&v=' . $ctx->mt->config('TypeKeyVersion') . '&_return=' . $return;
}
示例3: smarty_function_mtremotesignoutlink
function smarty_function_mtremotesignoutlink($args, &$ctx)
{
// status: complete
// parameters: none
$entry = $ctx->stash('entry');
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$static_arg;
if (isset($args['no_static']) && $args['no_static'] == 1) {
$static_arg = '';
} else {
$url = $args['static'];
if (isset($url) && $url != '1') {
$static_arg = "&static=" . urlencode($url);
} else {
if (isset($url) && $url == 1) {
$static_arg = "&static=1";
} else {
$static_arg = "&static=0";
}
}
}
$path = $path . $ctx->mt->config('CommentScript') . '?__mode=handle_sign_in' . $static_arg . '&logout=1';
if ($entry) {
$path .= '&entry_id=' . $entry->entry_id;
}
return $path;
}
示例4: smarty_block_mtifentryrecommended
function smarty_block_mtifentryrecommended($args, $content, &$ctx, &$repeat)
{
$localvars = array('cp_if_recommended', 'cp_if_recommended_else');
if (!isset($content)) {
$ctx->localize(array('_ifrc_counter', 'conditional', 'else_content'));
$ctx->stash('_ifrc_counter', 0);
$ctx->stash('cp_if_recommended_else', 1);
} else {
$counter = $ctx->stash('_ifrc_counter');
if ($counter < 1) {
$repeat = true;
$false_block = $ctx->stash('else_content');
$ctx->stash('_ifrc_false_block', $false_block);
$ctx->stash('_ifrc_counter', $counter + 1);
$ctx->stash('conditional', 1);
$ctx->__stash['cp_if_recommended_else'] = null;
$ctx->stash('cp_if_recommended', '1');
return '';
} else {
$ctx->restore(array('_ifrc_counter', 'conditional', 'else_content'));
$repeat = false;
}
$false_block = $ctx->stash('_ifrc_false_block');
$true_block = $content;
$ctx->__stash['cp_if_recommended'] = null;
$ctx->__stash['_ifrc_false_block'] = null;
$entry = $ctx->stash('entry');
if (!isset($entry)) {
return $ctx->error('No entry available.');
}
$class = $args['class'];
if (!$class) {
$class = 'scored';
}
if ($class) {
require_once "MTUtil.php";
$class = strip_tags($class);
$class = ' class="' . $class . '"';
}
$class_else = $args['class_else'];
if (!$class_else) {
$class_else = 'scored-else';
}
if ($class_else) {
require_once "MTUtil.php";
$class_else = strip_tags($class_else);
$class_else = ' class="' . $class_else . '"';
}
require_once "function.mtstaticwebpath.php";
$static_path = smarty_function_mtstaticwebpath($args, $ctx);
require_once "function.mtcgipath.php";
$cgi_path = smarty_function_mtcgipath($args, $ctx);
$entry_id = $entry['entry_id'];
$blog_id = $entry['entry_blog_id'];
$script = "\n<script type=\"text/javascript\" src=\"{$static_path}mt.js\"></script>\n<script type=\"text/javascript\" src=\"{$static_path}js/tc.js\"></script>\n<script type=\"text/javascript\" src=\"{$static_path}js/tc/client.js\"></script>\n<script type=\"text/javascript\">\nfunction scoredby_script_vote(id) {\n TC.Client.call({\n 'load': function(c, result) { eval(result); },\n 'method': 'POST',\n 'uri': '{$cgi_path}mt-cp.cgi',\n 'arguments': {\n '__mode': 'vote',\n 'blog_id': '{$blog_id}',\n 'id': id,\n 'f': 'scored,sum',\n 'jsonp': 'scoredby_script_callback'\n }\n });\n}\nfunction scoredby_script_callback(scores_hash) {\n var true_block = getByID('scored_' + {$entry_id});\n var false_block = getByID('scored_' + {$entry_id} + '_else');\n var span;\n if (scores_hash['{$entry_id}'] && scores_hash['{$entry_id}'].scored) {\n span = getByID('cp_total_' + {$entry_id});\n if (true_block)\n true_block.style.display = '';\n if (false_block) \n false_block.style.display = 'none';\n }\n else {\n span = getByID('cp_total_' + {$entry_id} + '_else');\n if (true_block)\n true_block.style.display = 'none';\n if (false_block) \n false_block.style.display = '';\n }\n if (span) {\n if (scores_hash['{$entry_id}'] && scores_hash['{$entry_id}'].sum)\n span.innerHTML = scores_hash['{$entry_id}'].sum;\n else\n span.innerHTML = 0;\n }\n}\n</script>";
$out = "\n{$script}\n<div id=\"scored_{$entry_id}\"{$class} style=\"display:none\">\n {$true_block}\n</div>\n<div id=\"scored_{$entry_id}_else\"{$class_else} style=\"display:none\">\n {$false_block}\n</div>\n<script type=\"text/javascript\" src=\"{$cgi_path}mt-cp.cgi?__mode=score&blog_id={$blog_id}&id={$entry_id}&f=scored,sum&jsonp=scoredby_script_callback\"></script>";
return $out;
}
}
示例5: smarty_function_mttagsearchlink
function smarty_function_mttagsearchlink($args, &$ctx)
{
$mt = MT::get_instance();
$blog = $ctx->stash('blog');
$tag = $ctx->stash('Tag');
if (!$tag) {
return '';
}
if (is_object($tag)) {
$name = $tag->tag_name;
} else {
$name = $tag;
}
$param = '';
$include_blogs = $args['include_blogs'] ? $args['include_blogs'] : $ctx->stash('include_blogs');
$include_blogs or $include_blogs = $args['blog_ids'] ? $args['blog_ids'] : $ctx->stash('blog_ids');
if ($include_blogs) {
if ($include_blogs != 'all') {
$incl = $mt->db()->parse_blog_ids($include_blogs, $include_with_website);
if (!$blog->is_blog) {
array_unshift($incl, $blog->id);
}
$param = 'IncludeBlogs=' . implode(',', $incl);
}
} else {
$blog_id = $ctx->stash('blog_id');
$param = 'IncludeBlogs=' . $blog_id;
}
if ($exclude_blogs = $args['exclude_blogs'] ? $args['exclude_blogs'] : $ctx->stash('exclude_blogs')) {
$excl = $mt->db()->parse_blog_ids($exclude_blogs);
$param = 'ExcludeBlogs=' . implode(',', $excl);
}
$tmpl_blog_id = null;
if (isset($args['tmpl_blog_id'])) {
$tmpl_blog_id = $args['tmpl_blog_id'];
if ('parent' == strtolower($tmpl_blog_id)) {
if ($blog->is_blog) {
$blog = $blog->website();
}
$tmpl_blog_id = $blog->id;
} else {
if (!preg_match('/^\\d+$/', $tmpl_blog_id) || $tmpl_blog_id < 1) {
$mt = MT::get_instance();
$ctx->error($mt->translate('Invalid [_1] parameter.', 'tmpl_blog_id'));
}
}
}
require_once "function.mtcgipath.php";
$search = smarty_function_mtcgipath($args, $ctx);
$search .= $ctx->mt->config('SearchScript');
$link = $search . '?' . $param . ($param ? '&' : '') . 'tag=' . urlencode($name);
$link .= '&limit=' . $ctx->mt->config('MaxResults');
if ($tmpl_blog_id) {
$link .= '&blog_id=' . $tmpl_blog_id;
}
return $link;
}
示例6: smarty_function_mtcommentauthorlink
function smarty_function_mtcommentauthorlink($args, &$ctx)
{
$mt = MT::get_instance();
$comment = $ctx->stash('comment');
$name = $comment->comment_author;
if (!$name && isset($args['default_name'])) {
$name = $args['default_name'];
}
$name or $name = $mt->translate("Anonymous");
require_once "MTUtil.php";
$name = encode_html($name);
$email = $comment->comment_email;
$url = $comment->comment_url;
if (isset($args['show_email'])) {
$show_email = $args['show_email'];
} else {
$show_email = 0;
}
if (isset($args['show_url'])) {
$show_url = $args['show_url'];
} else {
$show_url = 1;
}
$target = isset($args['new_window']) && $args['new_window'] ? ' target="_blank"' : '';
_comment_follow($args, $ctx);
$cmntr = $ctx->stash('commenter');
if (!isset($cmntr) && isset($comment->comment_commenter_id)) {
$cmntr = $comment->commenter();
}
if ($cmntr) {
$name = isset($cmntr->author_nickname) ? encode_html($cmntr->author_nickname) : $name;
if ($cmntr->author_url) {
return sprintf('<a title="%s" href="%s"%s>%s</a>', encode_html($cmntr->author_url), encode_html($cmntr->author_url), $target, $name);
}
return $name;
} elseif ($show_url && $url) {
require_once "function.mtcgipath.php";
$cgi_path = smarty_function_mtcgipath($args, $ctx);
$comment_script = $ctx->mt->config('CommentScript');
$name = strip_tags($name);
$url = encode_html(strip_tags($url));
if ($comment->comment_id && (!isset($args['no_redirect']) || isset($args['no_redirect']) && !$args['no_redirect']) && (!isset($args['nofollowfy']) || isset($args['nofollowfy']) && !$args['nofollowfy'])) {
return sprintf('<a title="%s" href="%s%s?__mode=red;id=%d"%s>%s</a>', $url, $cgi_path, $comment_script, $comment->comment_id, $target, $name);
} else {
return sprintf('<a title="%s" href="%s"%s>%s</a>', $url, $url, $target, $name);
}
} elseif ($show_email && $email && is_valid_email($email)) {
$email = encode_html(strip_tags($email));
$str = 'mailto:' . $email;
if ($args['spam_protect']) {
$str = spam_protect($str);
}
return sprintf('<a href="%s">%s</a>', $str, $name);
}
return $name;
}
示例7: smarty_function_mtcgihost
function smarty_function_mtcgihost($args, &$ctx)
{
// status: complete
// parameters: none
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
if (preg_match('/^https?:\\/\\/([^\\/:]+)(:\\d+)?\\//', $path, $matches)) {
return $args['exclude_port'] ? $matches[1] : $matches[1] . $matches[2];
}
return '';
}
示例8: smarty_function_mtcategorytrackbacklink
function smarty_function_mtcategorytrackbacklink($args, &$ctx)
{
$cat = $ctx->stash('category');
if (!$cat) {
return '';
}
if (!$cat->trackback()->id) {
return '';
}
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$path .= $ctx->mt->config('TrackbackScript') . '/' . $cat->trackback()->id;
return $path;
}
示例9: smarty_function_mtentrytrackbacklink
function smarty_function_mtentrytrackbacklink($args, &$ctx)
{
$entry = $ctx->stash('entry');
if (!$entry) {
return '';
}
if (!$entry['trackback_id']) {
return '';
}
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$path .= $ctx->mt->config('TrackbackScript') . '/' . $entry['trackback_id'];
return $path;
}
示例10: smarty_function_mtsigninlink
function smarty_function_mtsigninlink($args, &$ctx)
{
$blog = $ctx->stash('blog');
$entry = $ctx->stash('entry');
$static_arg = $args['static'] ? "&static=1" : "&static=0";
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$return = $path . $ctx->mt->config('CommentScript') . '?__mode=login' . $static_arg;
if ($blog) {
$return .= '&blog_id=' . $blog->blog_id;
}
if ($entry) {
$return .= '&entry_id=' . $entry->entry_id;
}
return $return;
}
示例11: smarty_function_mtcommenternamethunk
function smarty_function_mtcommenternamethunk($args, &$ctx)
{
$blog = $ctx->stash('blog');
$archive_url = $ctx->tag('BlogArchiveURL');
if (preg_match('|://([^/]*)|', $archive_url, $matches)) {
$blog_domain = $matches[1];
}
require_once "function.mtcgipath.php";
$cgi_path = smarty_function_mtcgipath($args, $ctx);
$mt_domain = $cgi_path;
if (preg_match('|://([^/]*)|', $mt_domain, $matches)) {
$mt_domain = $matches[1];
}
if ($blog_domain != $mt_domain) {
$cmt_script = $ctx->mt->config('CommentScript');
return "<script type='text/javascript' src='{$cgi_path}{$cmt_script}?__mode=cmtr_name_js'></script>";
} else {
return "<script type='text/javascript'>var commenter_name = getCookie('commenter_name')</script>";
}
}
示例12: smarty_function_mtstaticwebpath
function smarty_function_mtstaticwebpath($args, &$ctx)
{
$path = $ctx->mt->config('StaticWebPath');
if (!$path) {
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$path .= 'mt-static/';
} elseif (substr($path, 0, 1) == '/') {
$blog = $ctx->stash('blog');
$host = $blog['blog_site_url'];
if (!preg_match('!/$!', $host)) {
$host .= '/';
}
if (preg_match('!^(https?://[^/:]+)(:\\d+)?/!', $host, $matches)) {
$path = $matches[1] . $path;
}
}
if (substr($path, strlen($path) - 1, 1) != '/') {
$path .= '/';
}
return $path;
}
示例13: smarty_function_mtentrytrackbackdata
function smarty_function_mtentrytrackbackdata($args, &$ctx)
{
$e = $ctx->stash('entry');
$tb = $e->trackback();
if (empty($tb)) {
return '';
}
if ($tb->trackback_is_disabled) {
return '';
}
$blog = $ctx->stash('blog');
$entry = $ctx->stash('entry');
$blog_accepted = $blog->blog_allow_pings && $ctx->mt->config('AllowPings');
if ($entry) {
$accepted = $blog_accepted && $entry->entry_allow_pings;
} else {
$accepted = $blog_accepted;
}
if (!$accepted) {
return '';
}
require_once "function.mtcgipath.php";
$path = smarty_function_mtcgipath($args, $ctx);
$path .= $ctx->mt->config('TrackbackScript') . '/' . $tb->trackback_id;
$at = $ctx->stash('current_archive_type');
if ($at) {
$at = ArchiverFactory::get_archiver($at);
}
if ($at && !$at instanceof IndividualArchiver) {
$url = $ctx->tag('ArchiveLink');
$url .= '#entry-' . sprintf("%06d", $e->entry_id);
} else {
$url = $ctx->tag($e->entry_class . 'Permalink', array('archive_type' => 'Individual'));
}
$rdf = '';
$comment_wrap = isset($args['comment_wrap']) ? $args['comment_wrap'] : 1;
if ($comment_wrap) {
$rdf .= "<!--\n";
}
require_once "MTUtil.php";
## SGML comments cannot contain double hyphens, so we convert
## any double hyphens to single hyphens.
$title = encode_xml(strip_hyphen($e->entry_title), 1);
$subject = encode_xml(strip_hyphen($ctx->tag('EntryCategory')), 1);
$excerpt = encode_xml(strip_hyphen($ctx->tag('EntryExcerpt')), 1);
$creator = encode_xml(strip_hyphen($ctx->tag('EntryAuthorDisplayName')), 1);
$date = $ctx->_hdlr_date(array('format' => '%Y-%m-%dT%H:%M:%S'), $ctx) . $ctx->tag('BlogTimezone');
$rdf .= <<<RDF
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description
rdf:about="{$url}"
trackback:ping="{$path}"
dc:title="{$title}"
dc:identifier="{$url}"
dc:subject="{$subject}"
dc:description="{$excerpt}"
dc:creator="{$creator}"
dc:date="{$date}" />
</rdf:RDF>
RDF;
if ($comment_wrap) {
$rdf .= "-->\n";
}
return $rdf;
}
示例14: smarty_block_mtifloggedin
function smarty_block_mtifloggedin($args, $content, &$ctx, &$repeat)
{
$localvars = array('cp_if_loggedin', 'cp_if_loggedin_else');
if (!isset($content)) {
$ctx->localize(array('_iflg_counter', 'conditional', 'else_content'));
$ctx->stash('_iflg_counter', 0);
$ctx->stash('cp_if_loggedin_else', 1);
} else {
$counter = $ctx->stash('_iflg_counter');
if ($counter < 1) {
$repeat = true;
$false_block = $ctx->stash('else_content');
$ctx->stash('_iflg_false_block', $false_block);
$ctx->stash('_iflg_counter', $counter + 1);
$ctx->stash('conditional', 1);
$ctx->__stash['cp_if_loggedin_else'] = null;
$ctx->stash('cp_if_loggedin', '1');
return '';
} else {
$ctx->restore(array('_iflg_counter', 'conditional', 'else_content'));
$repeat = false;
}
$false_block = $ctx->stash('_iflg_false_block');
$true_block = $content;
$ctx->__stash['cp_if_loggedin'] = null;
$ctx->__stash['_iflg_false_block'] = null;
$elem_id = 'logged_in';
if (isset($args['element_id'])) {
$elem_id = $args['element_id'];
}
if ($elem_id) {
require_once "MTUtil.php";
$class_else = strip_tags($class_else);
}
$class = 'logged-in';
if (isset($args['class'])) {
$class = $args['class'];
}
if ($class) {
require_once "MTUtil.php";
$class = strip_tags($class);
$class = ' class="' . $class . '"';
}
$class_else = 'logged-in-else';
if (isset($args['class_else'])) {
$class_else = $args['class_else'];
}
if ($class_else) {
require_once "MTUtil.php";
$class_else = strip_tags($class_else);
$class_else = ' class="' . $class_else . '"';
}
require_once "function.mtcgipath.php";
$cgipath = smarty_function_mtcgipath($args, $ctx);
require_once "function.mtcgihost.php";
$cgihost = smarty_function_mtcgihost($args, $ctx);
require_once "function.mtbloghost.php";
$bloghost = smarty_function_mtbloghost($args, $ctx);
$cpscript = $ctx->mt->config('CommunityScript');
$names_script_block = $cgihost === $bloghost ? "commenter_name = getCookie('commenter_name');\nuser_name = getCookie('mt_user');" : "document.write('<script src=\"{$cgipath}{$cpscript}?__mode=loggedin_js\"></scr' + 'ipt>');";
$script_block = "";
$script = "";
if (isset($args['script'])) {
$script = $args['script'];
}
if ($script) {
$script_block = "\n<script type=\"text/javascript\">\nvar is_loggedin = false;\nif ( typeof(mtGetUser) == 'undefined' )\n is_loggedin = user ? true : false;\nelse {\n var u = mtGetUser();\n is_loggedin = u && u.name ? true : false;\n}\n{$script}(is_loggedin ? 1 : 0, '{$elem_id}');\n</script>";
}
$out = "\n<div id=\"{$elem_id}\"{$arg_class} style=\"display:none\" class=\"inline\">\n{$true_block}\n</div>\n<div id=\"{$elem_id}_else\"{$arg_class_else} style=\"display:none\" class=\"inline\">\n{$false_block}\n</div>\n{$script_block}";
return $out;
}
}