本文整理汇总了PHP中comcode_to_tempcode函数的典型用法代码示例。如果您正苦于以下问题:PHP comcode_to_tempcode函数的具体用法?PHP comcode_to_tempcode怎么用?PHP comcode_to_tempcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了comcode_to_tempcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$type = get_param('type');
if (!has_zone_access(get_member(), 'adminzone')) {
return new ocp_tempcode();
}
decache('main_staff_checklist');
require_lang('staff_checklist');
switch ($type) {
case 'add':
$recurinterval = get_param_integer('recurinterval', 0);
$task_title = get_param('tasktitle', false, true);
$id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true);
require_code('notifications');
$subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title);
$mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title));
dispatch_notification('checklist_task', NULL, $subject, $mail);
return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id)));
case 'delete':
$GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_done':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_undone':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1);
break;
}
return new ocp_tempcode();
}
示例2: check_comcode
/**
* Check the Comcode is valid.
*
* @param LONG_TEXT The comcode to convert
* @param ?MEMBER The member the evaluation is running as. This is a security issue, and you should only run as an administrator if you have considered where the comcode came from carefully (NULL: current member)
* @param boolean Whether to explicitly execute this with admin rights. There are a few rare situations where this should be done, for data you know didn't come from a member, but is being evaluated by one.
* @param ?object The database connection to use (NULL: standard site connection)
* @param boolean Whether there might be new attachments. If there are, we will check as lax- as attachments are always preserved by forcing lax parsing.
*/
function check_comcode($comcode, $source_member = NULL, $as_admin = false, $connection = NULL, $attachment_possibility = false)
{
if (running_script('stress_test_loader')) {
return;
}
global $LAX_COMCODE;
$temp = $LAX_COMCODE;
if ($attachment_possibility) {
$has_one = false;
foreach ($_POST as $key => $value) {
if (preg_match('#^hidFileID\\_#i', $key) != 0) {
require_code('uploads');
$has_one = is_swf_upload();
}
}
foreach ($_FILES as $key => $file) {
$matches = array();
if (is_uploaded_file($file['tmp_name']) && preg_match('#file(\\d)#', $key, $matches) != 0) {
$has_one = true;
}
}
if ($has_one) {
$LAX_COMCODE = true;
}
// We don't want a simple syntax error to cause us to lose our attachments
}
comcode_to_tempcode($comcode, $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, true);
$LAX_COMCODE = $temp;
}
示例3: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('comcode_add');
$comcode = _get_preview_environment_comcode(post_param('tag'));
$temp_tpl = comcode_to_tempcode($comcode[0]);
return array($temp_tpl, NULL);
}
示例4: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
if (!has_specific_permission(get_member(), 'comcode_dangerous')) {
exit;
}
require_code('zones2');
require_code('zones3');
$bparameters = '';
$bparameters_xml = '';
$block = post_param('block');
$parameters = get_block_parameters($block);
$parameters[] = 'failsafe';
$parameters[] = 'cache';
$parameters[] = 'quick_cache';
foreach ($parameters as $parameter) {
$value = post_param($parameter, NULL);
if (is_null($value)) {
if (post_param_integer('tick_on_form__' . $parameter, NULL) === NULL) {
continue;
}
// If not on form, continue, otherwise must be 0
$value = '0';
}
if ($value != '' && ($parameter != 'failsafe' || $value == '1') && ($parameter != 'cache' || $value != block_cache_default($block)) && ($parameter != 'quick_cache' || $value == '1')) {
$bparameters .= ' ' . $parameter . '="' . str_replace('"', '\\"', $value) . '"';
$bparameters_xml = '<blockParam key="' . escape_html($parameter) . '" val="' . escape_html($value) . '" />';
}
}
$comcode = '[block' . $bparameters . ']' . $block . '[/block]';
$preview = comcode_to_tempcode($comcode);
return array($preview, NULL);
}
示例5: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
$forum = get_forum_type();
$out = new ocp_tempcode();
if ($forum != 'none') {
// Standard welcome back vs into greeting
$member = get_member();
if (is_guest($member)) {
$redirect = get_self_url(true, true);
$login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login'));
$join_url = $GLOBALS['FORUM_DRIVER']->join_url();
$join_bits = do_template('JOIN_OR_LOGIN', array('LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url));
$p = do_lang_tempcode('WELCOME', $join_bits);
$out->attach(paragraph($p, 'hhrt4dsgdsgd'));
} else {
$out->attach(paragraph(do_lang_tempcode('WELCOME_BACK', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member))), 'gfgdf9gjd'));
}
}
$message = get_option('welcome_message');
if (has_actual_page_access(get_member(), 'admin_config')) {
if ($message != '') {
$message .= ' [[page="_SEARCH:admin_config:category:SITE#group_GENERAL"]' . do_lang('EDIT') . '[/page]]';
}
}
$out->attach(comcode_to_tempcode($message, NULL, true));
return $out;
}
示例6: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('uploads');
$urls = get_url('', 'file', 'uploads/iotds', 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
if ($urls[0] == '') {
if (!is_null(post_param_integer('id', NULL))) {
$rows = $GLOBALS['SITE_DB']->query_select('iotds', array('url', 'thumb_url'), array('id' => post_param_integer('id')), '', 1);
$urls = $rows[0];
$url = $urls['url'];
$thumb_url = $urls['thumb_url'];
} else {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD'));
}
} else {
$url = $urls[0];
$thumb_url = $urls[1];
}
$caption = comcode_to_tempcode(post_param('caption', ''));
$title = comcode_to_tempcode(post_param('title', ''));
require_code('images');
$thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, $caption, true);
$url = url_is_local($url) ? get_custom_base_url() . '/' . $url : $url;
$preview = do_template('IOTD', array('ID' => '', 'IMAGE_URL' => $url, 'SUBMITTER' => strval(get_member()), 'VIEW_URL' => $url, 'IMAGE' => $thumb, 'CAPTION' => $title));
return array($preview, NULL);
}
示例7: testHtml
function testHtml()
{
$expectations = array(" - foo" => "<ul><li>foo</li></ul>");
foreach ($expectations as $comcode => $html) {
$actual = comcode_to_tempcode($comcode);
assertTrue(preg_replace('#\\s#', '', $html) == preg_replace('#\\s#', '', $actual->evaluate()));
}
}
示例8: testComcode
function testComcode()
{
$expectations = array(" - foo " => "<ul><li>foo</li></ul>", " - foo\n - bar" => "<ul><li>foo</li><li>bar</li></ul>", " - foo - bar" => " - foo - bar", "" => " ", " -foo" => "-foo", "-foo" => "-foo", "--foo" => "--foo", "[b]bar[/b]" => "<strongclass=\"comcode_bold\">bar</strong>");
foreach ($expectations as $comcode => $html) {
$actual = comcode_to_tempcode($comcode, NULL, false, 60, NULL, NULL, false, false, false, false, false, NULL, NULL);
$matches = preg_replace('#\\s#', '', $html) == str_replace(" ", "", preg_replace('#\\s#', '', $actual->evaluate()));
// if (!$matches)
// exit(preg_replace('#\s#','',$html).' vs '.str_replace(" ","",preg_replace('#\s#','',$actual->evaluate())));
$this->assertTrue($matches);
}
}
示例9: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
if (!array_key_exists('param', $map)) {
return new ocp_tempcode();
}
if (match_key_match($map['param'])) {
$caption = array_key_exists('caption', $map) ? $map['caption'] : '';
return comcode_to_tempcode($caption, get_member(), true);
}
return new ocp_tempcode();
}
示例10: download_licence_script
/**
* Show a download licence for display
*/
function download_licence_script()
{
$id = get_param_integer('id');
$rows = $GLOBALS['SITE_DB']->query_select('download_licences', array('*'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$licence_title = $rows[0]['l_title'];
$licence_text = $rows[0]['l_text'];
$echo = do_template('POPUP_HTML_WRAP', array('_GUID' => 'd8f60d5f6f56b08589ed6f4b874dad85', 'TITLE' => $licence_title, 'CONTENT' => comcode_to_tempcode($licence_text, $GLOBALS['FORUM_DRIVER']->get_guest_id(), false)));
$echo->evaluate_echo();
}
示例11: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
// Find review, if there is one
$individual_review_ratings = array();
$review_rating = post_param('review_rating', '');
if ($review_rating != '') {
$individual_review_ratings[''] = array('REVIEW_TITLE' => '', 'REVIEW_RATING' => $review_rating);
}
$poster_name = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
$post = comcode_to_tempcode(post_param('post'));
// OCF renderings of poster
static $hooks = NULL;
if (is_null($hooks)) {
$hooks = find_all_hooks('modules', 'topicview');
}
static $hook_objects = NULL;
if (is_null($hook_objects)) {
$hook_objects = array();
foreach (array_keys($hooks) as $hook) {
require_code('hooks/modules/topicview/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$hook_objects[$hook] = $object;
}
}
if (!is_guest()) {
require_code('ocf_members2');
$poster_details = ocf_show_member_box(get_member(), false, $hooks, $hook_objects, false);
} else {
$custom_fields = new ocp_tempcode();
$poster_details = new ocp_tempcode();
}
if (addon_installed('ocf_forum')) {
if (!is_guest()) {
$poster = do_template('OCF_POSTER_MEMBER', array('ONLINE' => true, 'ID' => strval(get_member()), 'POSTER_DETAILS' => $poster_details, 'PROFILE_URL' => $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member(), false, true), 'POSTER_USERNAME' => $poster_name));
} else {
$poster = do_template('OCF_POSTER_GUEST', array('IP_LINK' => '', 'POSTER_DETAILS' => $poster_details, 'POSTER_USERNAME' => $poster_name));
}
} else {
$poster = make_string_tempcode(escape_html($poster_name));
// Should never happen actually, as applies discounts hook from even running
}
$highlight = false;
$datetime_raw = time();
$datetime = get_timezoned_date(time());
$poster_url = $GLOBALS['FORUM_DRIVER']->member_profile_url(get_member());
$title = post_param('title', '');
$tpl = do_template('POST', array('INDIVIDUAL_REVIEW_RATINGS' => $individual_review_ratings, 'HIGHLIGHT' => $highlight, 'TITLE' => $title, 'TIME_RAW' => strval($datetime_raw), 'TIME' => $datetime, 'POSTER_URL' => $poster_url, 'POSTER_NAME' => $poster_name, 'POST' => $post, 'POSTER_ID' => strval(get_member()), 'POSTER' => $poster, 'POSTER_DETAILS' => $poster_details, 'ID' => '', 'CHILDREN' => '', 'RATING' => '', 'EMPHASIS' => '', 'BUTTONS' => '', 'TOPIC_ID' => '', 'UNVALIDATED' => '', 'IS_SPACER_POST' => false, 'NUM_TO_SHOW_LIMIT' => '0'));
return array($tpl, NULL);
}
示例12: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('quotes');
$file = array_key_exists('param', $map) ? $map['param'] : 'quotes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('QUOTES');
require_code('textfiles');
$place = _find_text_file_path($file, '');
if (!file_exists($place)) {
warn_exit(do_lang_tempcode('DIRECTORY_NOT_FOUND', escape_html($place)));
}
$edit_url = new ocp_tempcode();
if ($file == 'quotes' && has_actual_page_access(get_member(), 'quotes', 'adminzone')) {
$edit_url = build_url(array('page' => 'quotes'), 'adminzone');
}
return do_template('BLOCK_MAIN_QUOTES', array('_GUID' => '7cab7422f603f7b1197c940de48b99aa', 'TITLE' => $title, 'EDIT_URL' => $edit_url, 'FILE' => $file, 'CONTENT' => comcode_to_tempcode($this->get_random_line($place), NULL, true)));
}
示例13: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
$original_comcode = post_param('post');
$posting_ref_id = post_param_integer('posting_ref_id', mt_rand(0, 100000));
$post_bits = do_comcode_attachments($original_comcode, 'news', strval(-$posting_ref_id), true, $GLOBALS['SITE_DB']);
$post_comcode = $post_bits['comcode'];
$post_html = $post_bits['tempcode'];
$view_space_map = array();
$view_space_map[post_param('label_for__title')] = escape_html(post_param('title'));
$view_space_map[post_param('label_for__post')] = $post_html;
$view_space_map[post_param('label_for__news')] = comcode_to_tempcode(post_param('news', ''));
require_code('templates_view_space');
$view_space_fields = new ocp_tempcode();
foreach ($view_space_map as $key => $val) {
$view_space_fields->attach(view_space_field($key, $val, true));
}
$output = do_template('VIEW_SPACE', array('WIDTH' => '170', 'FIELDS' => $view_space_fields));
return array($output, $post_comcode);
}
示例14: activities_ajax_submit_handler
function activities_ajax_submit_handler()
{
header('Content-Type: text/xml');
// header('HTTP/1.0 200 Ok');
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
$response = '<' . '?xml version="1.0" encoding="' . get_charset() . '" ?' . '>';
$response .= '<response><content>';
$map = array();
$guest_id = intval($GLOBALS['FORUM_DRIVER']->get_guest_id());
if (!is_guest(get_member())) {
$map['STATUS'] = trim(either_param('status', ''));
if (post_param('zone', '') != '' && $map['STATUS'] != '' && $map['STATUS'] != do_lang('activities:TYPE_HERE')) {
comcode_to_tempcode($map['STATUS'], $guest_id, false, NULL);
$map['PRIVACY'] = either_param('privacy', 'private');
if (strlen(strip_tags($map['STATUS'])) < strlen($map['STATUS'])) {
$cc_guide = build_url(array('page' => 'userguide_comcode'), 'site');
$response .= '<success>0</success><feedback><![CDATA[No HTML allowed. See <a href="' . $cc_guide->evaluate() . '">Comcode Help</a> for info on the alternative.]]></feedback>';
} else {
if (strlen($map['STATUS']) > 255) {
$response .= '<success>0</success><feedback>Message is ' . strval(strlen($map['STATUS']) - 255) . ' characters too long</feedback>';
} else {
$stored_id = activities_addon_syndicate_described_activity('RAW_DUMP', $map['STATUS'], '', '', '', '', '', '', $map['PRIVACY'] == 'public' ? 1 : 0);
if ($stored_id > 0) {
$response .= '<success>1</success><feedback>Message received.</feedback>';
} elseif ($stored_id == -1) {
$response .= '<success>0</success><feedback>Message already received.</feedback>';
}
}
}
}
} else {
$response .= '<success>0</success><feedback>' . do_lang('LOGIN_EXPIRED_POST') . '</feedback>';
}
$response .= '</content></response>';
echo $response;
}
示例15: run
/**
* Standard modular run function for preview hooks.
*
* @return array A pair: The preview, the updated post Comcode
*/
function run()
{
require_code('uploads');
require_lang('banners');
// Check according to banner type
$title_text = post_param('title_text', '');
$direct_code = post_param('direct_code', '');
$url_param_name = 'image_url';
$file_param_name = 'file';
require_code('uploads');
$is_upload = is_swf_upload() || array_key_exists($file_param_name, $_FILES) && (array_key_exists('tmp_name', $_FILES[$file_param_name]) && is_uploaded_file($_FILES[$file_param_name]['tmp_name']));
$_banner_type_rows = $GLOBALS['SITE_DB']->query_select('banner_types', array('*'), array('id' => post_param('b_type')), '', 1);
if (!array_key_exists(0, $_banner_type_rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$banner_type_row = $_banner_type_rows[0];
if ($banner_type_row['t_is_textual'] == 0) {
if ($direct_code == '') {
$urls = get_url($url_param_name, $file_param_name, 'uploads/banners', 0, $is_upload ? OCP_UPLOAD_IMAGE : OCP_UPLOAD_ANYTHING);
$img_url = fixup_protocolless_urls($urls[0]);
if ($img_url == '') {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_UPLOAD_BANNERS'));
}
} else {
$img_url = '';
}
} else {
$img_url = '';
if ($title_text == '') {
warn_exit(do_lang_tempcode('IMPROPERLY_FILLED_IN_BANNERS'));
}
if (strlen($title_text) > $banner_type_row['t_max_file_size']) {
warn_exit(do_lang_tempcode('BANNER_TOO_LARGE_2', integer_format(strlen($title_text)), integer_format($banner_type_row['t_max_file_size'])));
}
}
require_code('banners');
$preview = show_banner(post_param('name'), post_param('title_text', ''), comcode_to_tempcode(post_param('caption')), $img_url, '', post_param('site_url'), post_param('b_type'));
return array($preview, NULL);
}