本文整理汇总了PHP中make_string_tempcode函数的典型用法代码示例。如果您正苦于以下问题:PHP make_string_tempcode函数的具体用法?PHP make_string_tempcode怎么用?PHP make_string_tempcode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_string_tempcode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _urlise_lang
/**
* URL'ise specially encoded text-acceptance language strings.
*
* @param string The language string
* @param mixed The URL (either tempcode or string)
* @param string The title of the hyperlink
* @param boolean Whether to use a new window
* @return tempcode The encoded version
*/
function _urlise_lang($string, $url, $title, $new_window)
{
$a = strpos($string, '<{');
$b = strpos($string, '}>');
if ($a === false || $b === false || $b < $a) {
return make_string_tempcode($string);
}
$section = substr($string, $a + 2, $b - $a - 2);
$prior = substr($string, 0, $a);
$after = substr($string, $b + 2);
if ($GLOBALS['XSS_DETECT']) {
ocp_mark_as_escaped($section);
ocp_mark_as_escaped($prior);
ocp_mark_as_escaped($after);
}
if (is_string($url)) {
if ($url == '') {
return protect_from_escaping($section);
}
} else {
if ($url->is_empty()) {
return protect_from_escaping($section);
}
}
$out = new ocp_tempcode();
$out->attach(protect_from_escaping($prior));
$out->attach(hyperlink($url, protect_from_escaping($section), $new_window, false, $title));
$out->attach(protect_from_escaping($after));
return $out;
}
示例2: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('quizzes')) {
return array();
}
return array(array('usage', 'quiz', array('admin_quiz', array('type' => 'misc'), get_module_zone('admin_quiz')), do_lang_tempcode('QUIZZES'), 'DOC_QUIZZES'), array('cms', 'quiz', array('cms_quiz', array('type' => 'misc'), get_module_zone('cms_quiz')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('QUIZZES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('quizzes', 'COUNT(*)', NULL, '', true))))), 'DOC_QUIZZES'));
}
示例3: ocf_check_post
/**
* Check a post would be valid.
*
* @param LONG_TEXT The post.
* @param ?AUTO_LINK The ID of the topic the post would be in (NULL: don't check with regard to any particular topic).
* @param ?MEMBER The poster (NULL: current member).
* @return ?array Row of the existing post if a double post (single row map-element in a list of rows) (NULL: not a double post).
*/
function ocf_check_post($post, $topic_id = NULL, $poster = NULL)
{
if (is_null($poster)) {
$poster = get_member();
}
require_code('comcode_check');
check_comcode($post, NULL, false, NULL, true);
if (strlen($post) == 0) {
warn_exit(do_lang_tempcode('POST_TOO_SHORT'));
}
require_code('ocf_groups');
if (strlen($post) > ocf_get_member_best_group_property($poster, 'max_post_length_comcode')) {
warn_exit(make_string_tempcode(escape_html(do_lang('_POST_TOO_LONG'))));
}
if (!is_null($topic_id)) {
if (running_script('stress_test_loader')) {
return NULL;
}
// Check this isn't the same as the last post here
$last_posts = $GLOBALS['FORUM_DB']->query_select('f_posts', array('p_post', 'p_poster', 'p_ip_address'), array('p_topic_id' => $topic_id), 'ORDER BY p_time DESC,id DESC', 1);
if (array_key_exists(0, $last_posts)) {
if ($last_posts[0]['p_poster'] == $GLOBALS['OCF_DRIVER']->get_guest_id() && get_ip_address() != $last_posts[0]['p_ip_address']) {
$last_posts[0]['p_poster'] = -1;
}
if ($last_posts[0]['p_poster'] == $poster && get_translated_text($last_posts[0]['p_post'], $GLOBALS['FORUM_DB']) == $post && get_param_integer('keep_debug_notifications', 0) != 1) {
warn_exit(do_lang_tempcode('DOUBLE_POST_PREVENTED'));
}
}
return $last_posts;
}
return NULL;
}
示例4: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('galleries')) {
return array();
}
return array(array('cms', 'galleries', array('cms_galleries', array('type' => 'misc'), get_module_zone('cms_galleries')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('GALLERIES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('images', 'COUNT(*)', NULL, '', true) + $GLOBALS['SITE_DB']->query_value_null_ok('videos', 'COUNT(*)', NULL, '', true))))), 'DOC_GALLERIES'));
}
示例5: render_field_value
/**
* Convert a field value to something renderable.
*
* @param array The field details
* @param mixed The raw value
* @return mixed Rendered field (tempcode or string)
*/
function render_field_value($field, $ev)
{
if (is_object($ev)) {
return $ev;
}
return make_string_tempcode(nl2br(escape_html($ev)));
}
示例6: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('chat')) {
return array();
}
return array(array('cms', 'chatrooms', array('cms_chat', array('type' => 'misc'), get_module_zone('cms_chat')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('ROOMS'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('chat_rooms', 'COUNT(*)', NULL, '', true))))), 'DOC_CHAT'), array('structure', 'chatrooms', array('admin_chat', array('type' => 'misc'), get_module_zone('admin_chat')), do_lang_tempcode('ROOMS'), 'DOC_CHAT'));
}
示例7: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('calendar')) {
return array();
}
return array(array('cms', 'calendar', array('cms_calendar', array('type' => 'misc'), get_module_zone('cms_calendar')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CALENDAR'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('calendar_events', 'COUNT(*)', NULL, '', true))))), 'DOC_CALENDAR'));
}
示例8: get_future_version_information
/**
* Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
*
* @return tempcode Information about the installed ocPortal version
*/
function get_future_version_information()
{
require_lang('version');
$url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
$data = http_download_file($url, NULL, false);
if (!is_null($data)) {
$data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
if ($GLOBALS['XSS_DETECT']) {
ocp_mark_as_escaped($data);
}
require_code('character_sets');
$data = convert_to_internal_encoding($data);
$table = new ocp_tempcode();
$lines = explode(chr(10), $data);
foreach ($lines as $line) {
if (trim($line) != '') {
$table->attach(paragraph($line));
}
}
$table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
} else {
$table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
}
require_code('xhtml');
/*$table->attach('<script type="text/javascript">// <![CDATA[
window.open(\''.$url.'\');
//]]></script>');*/
return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
示例9: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_javascript('javascript_realtime_rain');
require_javascript('javascript_ajax');
require_javascript('javascript_more');
require_lang('realtime_rain');
require_css('realtime_rain');
$title = get_page_title('REALTIME_RAIN');
if (!has_js()) {
// Send them to the page permissions screen
$url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
require_code('site2');
assign_refresh($url, 5.0);
return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_REALTIME')));
}
$GLOBALS['TEMPCODE_SETGET']['chrome_frame'] = make_string_tempcode('1');
if (browser_matches('ie6')) {
attach_message(do_lang_tempcode('IE_OLD_PLEASE_UPGRADE'), 'warn');
}
if (!has_js()) {
// Send them to the stats screen
$url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
require_code('site2');
assign_refresh($url, 5.0);
return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_ADVANCED_SCREEN_REALTIME_RAIN')));
}
$min_time = $GLOBALS['SITE_DB']->query_value('stats', 'MIN(date_and_time)');
if (is_null($min_time)) {
$min_time = time();
}
return do_template('REALTIME_RAIN_OVERLAY', array('MIN_TIME' => strval($min_time)));
}
示例10: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('downloads');
require_css('downloads');
require_lang('downloads');
require_code('ocfiltering');
$number = array_key_exists('param', $map) ? intval($map['param']) : 10;
$filter = array_key_exists('filter', $map) ? $map['filter'] : '*';
$zone = array_key_exists('zone', $map) ? $map['zone'] : get_module_zone('downloads');
$sql_filter = ocfilter_to_sqlfragment($filter, 'p.category_id', 'download_categories', 'parent_id', 'p.category_id', 'id');
// Note that the parameters are fiddled here so that category-set and record-set are the same, yet SQL is returned to deal in an entirely different record-set (entries' record-set)
$rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'download_downloads p WHERE validated=1 AND (' . $sql_filter . ') ORDER BY add_date DESC', $number);
$title = do_lang_tempcode('RECENT', make_string_tempcode(integer_format($number)), do_lang_tempcode('SECTION_DOWNLOADS'));
if (array_key_exists('title', $map) && $map['title'] != '') {
$title = protect_from_escaping(escape_html($map['title']));
}
$out = new ocp_tempcode();
foreach ($rows as $i => $row) {
if ($i != 0) {
$out->attach(do_template('BLOCK_SEPARATOR'));
}
$out->attach(get_download_html($row, true, true, $zone));
}
if ($out->is_empty()) {
if (has_actual_page_access(NULL, 'cms_downloads', NULL, NULL) && has_submit_permission('mid', get_member(), get_ip_address(), 'cms_downloads')) {
$submit_url = build_url(array('page' => 'cms_downloads', 'type' => 'ad', 'redirect' => SELF_REDIRECT), get_module_zone('cms_downloads'));
} else {
$submit_url = new ocp_tempcode();
}
return do_template('BLOCK_NO_ENTRIES', array('_GUID' => '74399763a51102bdd6e6d92c2c11354f', 'HIGH' => false, 'TITLE' => $title, 'MESSAGE' => do_lang_tempcode('NO_DOWNLOADS_YET'), 'ADD_NAME' => do_lang_tempcode('ADD_DOWNLOAD'), 'SUBMIT_URL' => $submit_url));
}
return do_template('BLOCK_MAIN_RECENT_DOWNLOADS', array('_GUID' => '257fa1b83d1b6fe3acbceb2b618e6d7f', 'TITLE' => $title, 'CONTENT' => $out, 'NUMBER' => integer_format($number)));
}
示例11: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
if (!addon_installed('downloads')) {
return array();
}
return array(array('cms', 'downloads', array('cms_downloads', array('type' => 'misc'), get_module_zone('cms_downloads')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('SECTION_DOWNLOADS'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('download_downloads', 'COUNT(*)', NULL, '', true))))), 'DOC_DOWNLOADS'));
}
示例12: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @param boolean Whether to look deep into the database (or whatever else might be time-intensive) for links
* @return array Array of links and where to show
*/
function run($exhaustive = false)
{
if (!addon_installed('catalogues')) {
return array();
}
$ret = array();
if (has_specific_permission(get_member(), 'submit_cat_highrange_content', 'cms_catalogues')) {
$ret[] = array('cms', 'catalogues', array('cms_catalogues', array('type' => 'misc'), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('CATALOGUES'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogues', 'COUNT(*)', NULL, '', true))))), 'DOC_CATALOGUES');
}
if ($exhaustive) {
$catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name', 'c_title', 'c_description', 'c_ecommerce'), NULL, '', 10, NULL, true);
if (!is_null($catalogues)) {
$ret2 = array();
foreach ($catalogues as $row) {
if (substr($row['c_name'], 0, 1) == '_') {
continue;
}
if ($row['c_ecommerce'] == 0 || addon_installed('shopping')) {
if (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_catalogues', array('catalogues_catalogue', $row['c_name']))) {
$ret2[] = array('cms', 'of_catalogues', array('cms_catalogues', array('type' => 'misc', 'catalogue_name' => $row['c_name']), get_module_zone('cms_catalogues')), do_lang_tempcode('ITEMS_HERE', escape_html(get_translated_text($row['c_title'])), escape_html(integer_format($GLOBALS['SITE_DB']->query_value_null_ok('catalogue_entries', 'COUNT(*)', array('c_name' => $row['c_name']), '', true)))), get_translated_text($row['c_description']));
}
}
}
if (count($ret2) < 10) {
$ret = array_merge($ret, $ret2);
}
}
}
return $ret;
}
示例13: run
/**
* Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
*
* @return array Array of links and where to show
*/
function run()
{
// TODO: Make workflows register itself in the addon registry
//if (!addon_installed('workflows')) return array();
require_lang('workflows');
return array(array('cms', 'workflows', array('admin_workflow', array('type' => 'misc'), get_module_zone('admin_workflow')), do_lang_tempcode('ITEMS_HERE', do_lang_tempcode('WORKFLOWS'), make_string_tempcode(escape_html(integer_format($GLOBALS['SITE_DB']->query_value('workflow_requirements', 'COUNT(DISTINCT workflow_name)'))))), 'DOC_WORKFLOWS'));
}
示例14: render_tab
/**
* Standard modular render function for profile tab hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return array A triple: The tab title, the tab contents, the suggested tab order
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('MODULE_TRANS_NAME_warnings');
$order = 80;
if ($leave_to_ajax_if_possible) {
return array($title, NULL, $order);
}
require_lang('ocf');
require_css('ocf');
$warnings = new ocp_tempcode();
$rows = $GLOBALS['FORUM_DB']->query_select('f_warnings', array('*'), array('w_member_id' => $member_id_of, 'w_is_warning' => 1));
foreach ($rows as $row) {
$warning_by = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($row['w_by']);
$date = get_timezoned_date($row['w_time']);
if ($row['w_explanation'] == '') {
$row['w_explanation'] = '?';
} else {
$row['w_explanation'] = str_replace(chr(10), ' ', $row['w_explanation']);
}
$row['w_explanation_orig'] = $row['w_explanation'];
if (strlen($row['w_explanation']) > 30) {
$row['w_explanation'] = substr($row['w_explanation'], 0, 27) . '...';
}
$explanation = hyperlink(build_url(array('page' => 'warnings', 'type' => '_ed', 'id' => $row['id'], 'redirect' => get_self_url(true)), get_module_zone('warnings')), $row['w_explanation'], false, true, $row['w_explanation_orig']);
$warnings->attach(paragraph(do_lang_tempcode('MEMBER_WARNING', $explanation, $warning_by, array(make_string_tempcode(escape_html($date)))), 'treyerhy34y'));
}
$content = do_template('OCF_MEMBER_PROFILE_WARNINGS', array('MEMBER_ID' => strval($member_id_of), 'WARNINGS' => $warnings));
return array($title, $content, $order);
}
示例15: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$val = get_param('name');
$test = file_exists(get_file_base() . '/themes/' . $val) || file_exists(get_custom_file_base() . '/themes/' . $val);
if (!$test) {
return new ocp_tempcode();
}
return make_string_tempcode(str_replace(array('‘', '’', '“', '”'), array('"', '"', '"', '"'), html_entity_decode(do_lang('ALREADY_EXISTS', escape_html($val)), ENT_QUOTES)));
}