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


PHP hyperlink函数代码示例

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


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

示例1: format_messages

function format_messages($messages)
{
    global $PHP_SELF;
    $out .= "<table class='messages'>";
    if (count($messages) == 0 or !is_array($messages)) {
        $out .= '<tr><td>No posts on this page</td></tr>';
    } else {
        foreach ($messages as $row) {
            extract($row);
            $shaded = !$shaded;
            $out .= '<tr class="' . ($shaded ? 'shaded' : 'unshaded') . '">';
            $out .= "<td rowspan='2' valign='top' class='poster'>{$poster}<br />{$date}</td>";
            $out .= "<td class='subject'>{$subject}</td>";
            $out .= "</tr>";
            $out .= '<tr class="' . ($shaded ? 'shaded' : 'unshaded') . '">';
            $out .= "<td class='body'>" . wiki_render($body) . "</td>";
            $out .= '</tr>';
        }
    }
    $out .= '</table>';
    if (authorized($USERNAME, 'postcomment')) {
        $out .= hyperlink("{$PHP_SELF}/Comment", 'Post Comment');
    }
    return "<center>" . $out . "</center>";
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:25,代码来源:message.php

示例2: 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)) {
         $ev = $ev->evaluate();
     }
     return hyperlink('http://isbndb.com/search-all.html?kw=' . $ev, $ev, true, true);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:14,代码来源:isbn.php

示例3: _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;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:lang_urlise.php

示例4: get_page_warning_details

/**
 * A page is not validated, so show a warning.
 *
 * @param  ID_TEXT		The zone the page is being loaded from
 * @param  ID_TEXT		The codename of the page
 * @param  tempcode		The edit URL (blank if no edit access)
 * @return tempcode		The warning
 */
function get_page_warning_details($zone, $codename, $edit_url)
{
    $warning_details = new ocp_tempcode();
    if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
        access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
    }
    $uv_warning = do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT');
    // Wear sun cream
    if (!$edit_url->is_empty()) {
        $menu_links = $GLOBALS['SITE_DB']->query('SELECT DISTINCT i_menu FROM ' . get_table_prefix() . 'menu_items WHERE ' . db_string_equal_to('i_url', $zone . ':' . $codename) . ' OR ' . db_string_equal_to('i_url', '_SEARCH:' . $codename));
        if (count($menu_links) != 0) {
            $menu_items_linking = new ocp_tempcode();
            foreach ($menu_links as $menu_link) {
                if (!$menu_items_linking->is_empty()) {
                    $menu_items_linking->attach(do_lang_tempcode('LIST_SEP'));
                }
                $menu_edit_url = build_url(array('page' => 'admin_menus', 'type' => 'edit', 'id' => $menu_link['i_menu']), get_module_zone('admin_menus'));
                $menu_items_linking->attach(hyperlink($menu_edit_url, $menu_link['i_menu'], false, true));
            }
            $uv_warning = do_lang_tempcode('UNVALIDATED_TEXT_STAFF', $menu_items_linking);
        }
    }
    $warning_details->attach(do_template('WARNING_TABLE', array('WARNING' => $uv_warning)));
    return $warning_details;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:33,代码来源:site2.php

示例5: 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);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:37,代码来源:warnings.php

示例6: initializeMembers

 function initializeMembers($tnum)
 {
     //var_dump($tnum['tweetID']); echo "<br>";
     //var_dump($tnum['userID']); echo "<br>";
     $this->tweetID = (string) $tnum['tweetID'];
     $this->userID = (string) $tnum['userID'];
     $this->tweetTokens = (string) $tnum['tweetTokens'];
     $this->longitude = (string) $tnum['longitude'];
     $this->latitude = (string) $tnum['latitude'];
     $this->text = (string) $tnum['text'];
     $this->date = (string) $tnum['date'];
     $this->text = hyperlink($this->text);
     $this->datatype = (string) $tnum['datatype'];
     $this->screenname = (string) $tnum['screenname'];
     $this->sentiment = (string) $tnum['sentiment'];
 }
开发者ID:rivulet-zhang,项目名称:Location-Centric-Real-Time-Visual-Analytics,代码行数:16,代码来源:Tweet.php

示例7: 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;
     }
     if ($ev == '') {
         return '';
     }
     $_ev = explode(' ', $ev, 2);
     if (!array_key_exists(1, $_ev)) {
         $_ev[1] = $_ev[0];
     }
     list($zone, $attributes, ) = page_link_decode($_ev[0]);
     $url = build_url($attributes, $zone);
     return hyperlink($url, escape_html($_ev[1]));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:page_link.php

示例8: actionlog_linkage

/**
 * Try and make an action log entry into a proper link.
 *
 * @param  ID_TEXT		Action type
 * @param  string			First parameter
 * @param  string			Second parameter
 * @param  tempcode		First parameter (cropped)
 * @param  tempcode		Second parameter (cropped)
 * @return ?array			Pair: first parameter as possible link, second parameter as possible link (NULL: could not construct a nice link)
 */
function actionlog_linkage($type, $a, $b, $_a, $_b)
{
    $type_str = do_lang($type, $a, $b, NULL, NULL, false);
    if (is_null($type_str)) {
        $type_str = $type;
    }
    // TODO: This will be replaced later with a more thorough system
    if ($type == 'EDIT_TEMPLATES' && strpos($a, ',') === false) {
        if ($b == '') {
            $b = 'default';
        }
        $tmp_url = build_url(array('page' => 'admin_themes', 'type' => '_edit_templates', 'theme' => $b, 'f0file' => $a), get_module_zone('admin_themes'));
        $a = basename($a, '.tpl');
        $_a = tpl_crop_text_mouse_over($a, 14);
        $_a = hyperlink($tmp_url, $_a, false, false, $type_str);
        return array($_a, $_b);
    }
    if ($type == 'EDIT_CSS') {
        if ($b == '') {
            $b = 'global.css';
        }
        $tmp_url = build_url(array('page' => 'admin_themes', 'type' => 'edit_css', 'theme' => $a, 'file' => $b), get_module_zone('admin_themes'));
        $b = basename($b, '.css');
        $_b = hyperlink($tmp_url, $_b, false, false, $type_str);
        return array($_a, $_b);
    }
    if ($type == 'COMCODE_PAGE_EDIT') {
        $tmp_url = build_url(array('page' => 'cms_comcode_pages', 'type' => '_ed', 'page_link' => $b . ':' . $a), get_module_zone('cms_comcode_pages'));
        $_a = hyperlink($tmp_url, $_a, false, false, $type_str);
        return array($_a, $_b);
    }
    if ($type == 'ADD_CATALOGUE_ENTRY' || $type == 'EDIT_CATALOGUE_ENTRY') {
        $tmp_url = build_url(array('page' => 'catalogues', 'type' => 'entry', 'id' => $a), get_module_zone('catalogues'));
        $_b = hyperlink($tmp_url, $b == '' ? $_a : $_b, false, false, $type_str);
        return array($_a, $_b);
    }
    if (($type == 'ADD_CATALOGUE_CATEGORY' || $type == 'EDIT_CATALOGUE_CATEGORY') && $b != '') {
        $tmp_url = build_url(array('page' => 'catalogues', 'type' => 'misc', 'id' => !is_numeric($a) ? $b : $a), get_module_zone('catalogues'));
        $_b = hyperlink($tmp_url, $_b, false, false, $type_str);
        return array($_a, $_b);
    }
    return NULL;
    // Could not get a match
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:actionlog.php

示例9: run

 /**
  * Standard modular run function for preview hooks.
  *
  * @return array			A pair: The preview, the updated post Comcode
  */
 function run()
 {
     require_code('uploads');
     $cat = post_param('cat');
     $urls = get_url('url', 'file', 'uploads/galleries' . (get_value('use_gallery_subdirs') == '1' ? '/' . $cat : ''), 0, OCP_UPLOAD_IMAGE, true, '', 'file2');
     if ($urls[0] == '') {
         if (!is_null(post_param_integer('id', NULL))) {
             $rows = $GLOBALS['SITE_DB']->query_select('images', 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];
     }
     require_code('images');
     $thumb = do_image_thumb(url_is_local($thumb_url) ? get_custom_base_url() . '/' . $thumb_url : $thumb_url, post_param('comments'), true);
     $preview = hyperlink(url_is_local($url) ? get_custom_base_url() . '/' . $url : $url, $thumb);
     return array($preview, NULL);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:28,代码来源:image.php

示例10: render_table

function render_table($objects, $link_url, $id_col, $link_col, $table_header = '', $show_headers = true, $skip_col_names = array())
{
    if (empty($objects)) {
        return '';
    }
    $html = '<table border="1">';
    $display_col_names = array_diff_key($objects[0], $skip_col_names);
    unset($display_col_names[$id_col]);
    $display_col_names = array_keys($display_col_names);
    if (!empty($table_header)) {
        $html .= '<tr><th colspan="' . sizeof($display_col_names) . '">' . $table_header . '</th></tr>';
    }
    if ($show_headers) {
        $html .= '<tr>';
        foreach ($display_col_names as $col) {
            $html .= "<td><strong>{$col}</strong></td>";
        }
        $html .= '</tr>';
    }
    foreach ($objects as $o) {
        $html .= '<tr>';
        $id = $o[$id_col];
        foreach ($display_col_names as $col) {
            $html .= '<td>';
            if ($id && $link_url && $col === $link_col) {
                $html .= hyperlink($link_url, $id, $o[$col]);
            } else {
                $html .= $o[$col];
            }
            $html .= '</td>';
        }
        $html .= '</tr>';
    }
    $html .= '</table>';
    return $html;
}
开发者ID:youaregreathk,项目名称:CS143-Movie-Data-Base,代码行数:36,代码来源:funCollection.php

示例11: nice_get_choose_table

 /**
  * Standard aed_module table function.
  *
  * @param  array			Details to go to build_url for link to the next screen.
  * @return array			A pair: The choose table, Whether re-ordering is supported from this screen.
  */
 function nice_get_choose_table($url_map)
 {
     require_code('templates_results_table');
     $current_ordering = get_param('sort', 'cf_order ASC');
     if (strpos($current_ordering, ' ') === false) {
         warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
     }
     list($sortable, $sort_order) = explode(' ', $current_ordering, 2);
     $sortables = array('cf_name' => do_lang_tempcode('NAME'), 'cf_owner_view' => do_lang_tempcode('OWNER_VIEW'), 'cf_owner_set' => do_lang_tempcode('OWNER_SET'), 'cf_public_view' => do_lang_tempcode('PUBLIC_VIEW'), 'cf_required' => do_lang_tempcode('REQUIRED'), 'cf_order' => do_lang_tempcode('ORDER'));
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $fh = array(do_lang_tempcode('NAME'), do_lang_tempcode('OWNER_VIEW'), do_lang_tempcode('OWNER_SET'), do_lang_tempcode('PUBLIC_VIEW'), do_lang_tempcode('REQUIRED'));
     $fh[] = do_lang_tempcode('SHOW_ON_JOIN_FORM');
     //$fh[]=do_lang_tempcode('SHOW_IN_POSTS');
     //$fh[]=do_lang_tempcode('SHOW_IN_POST_PREVIEWS');
     $fh[] = do_lang_tempcode('ORDER');
     $fh[] = do_lang_tempcode('ACTIONS');
     $header_row = results_field_title($fh, $sortables, 'sort', $sortable . ' ' . $sort_order);
     // Load up filters
     $hooks = find_all_hooks('systems', 'ocf_cpf_filter');
     $to_keep = array();
     foreach (array_keys($hooks) as $hook) {
         require_code('hooks/systems/ocf_cpf_filter/' . $hook);
         $_hook = object_factory('Hook_ocf_cpf_filter_' . $hook, true);
         if (is_null($_hook)) {
             continue;
         }
         $to_keep += $_hook->to_enable();
     }
     $fields = new ocp_tempcode();
     list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering, NULL);
     $changed = false;
     foreach ($rows as $row) {
         $order = post_param_integer('order_' . strval($row['id']), NULL);
         if (!is_null($order)) {
             $GLOBALS['FORUM_DB']->query_update('f_custom_fields', array('cf_order' => $order), array('id' => $row['id']), '', 1);
             $changed = true;
         }
     }
     if ($changed) {
         list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering);
     }
     require_code('form_templates');
     foreach ($rows as $row) {
         $trans = get_translated_text($row['cf_name'], $GLOBALS['FORUM_DB']);
         $used = true;
         if (substr($trans, 0, 4) == 'ocp_') {
             // See if it gets filtered
             if (!array_key_exists(substr($trans, 4), $to_keep)) {
                 $used = false;
             }
             $test = do_lang('SPECIAL_CPF__' . $trans, NULL, NULL, NULL, NULL, false);
             if (!is_null($test)) {
                 $trans = $test;
             }
         }
         $edit_link = build_url($url_map + array('id' => $row['id']), '_SELF');
         $orderlist = new ocp_tempcode();
         $num_cpfs = $GLOBALS['FORUM_DB']->query_value('f_custom_fields', 'COUNT(*)');
         $selected_one = false;
         $order = $row['cf_order'];
         for ($i = 0; $i < max($num_cpfs, $order); $i++) {
             $selected = $i === $order;
             if ($selected) {
                 $selected_one = true;
             }
             $orderlist->attach(form_input_list_entry(strval($i), $selected, integer_format($i + 1)));
         }
         if (!$selected_one) {
             $orderlist->attach(form_input_list_entry(strval($order), true, integer_format($order + 1)));
         }
         $orderer = do_template('TABLE_TABLE_ROW_CELL_SELECT', array('LABEL' => do_lang_tempcode('ORDER'), 'NAME' => 'order_' . strval($row['id']), 'LIST' => $orderlist));
         $fr = array();
         $fr[] = $trans;
         $fr[] = $row['cf_owner_view'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
         $fr[] = $row['cf_owner_set'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
         $fr[] = $row['cf_public_view'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
         $fr[] = $row['cf_required'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
         $fr[] = $row['cf_show_on_join_form'] == 1 ? do_lang_tempcode('YES') : do_lang_tempcode('NO');
         //$fr[]=($row['cf_show_in_posts']==1)?do_lang_tempcode('YES'):do_lang_tempcode('NO');
         //$fr[]=($row['cf_show_in_post_previews']==1)?do_lang_tempcode('YES'):do_lang_tempcode('NO');
         $fr[] = protect_from_escaping($orderer);
         if ($used) {
             $edit_link = hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id']));
         } else {
             $edit_link = do_lang_tempcode('UNUSED_CPF');
         }
         $fr[] = protect_from_escaping($edit_link);
         $fields->attach(results_entry($fr, true));
     }
     return array(results_table(do_lang($this->menu_label), get_param_integer('start', 0), 'start', either_param_integer('max', 20), 'max', $max_rows, $header_row, $fields, $sortables, $sortable, $sort_order, 'sort', NULL, NULL, NULL, 8, 'gdfg43tfdgdfgdrfgd', true), true);
//.........这里部分代码省略.........
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:admin_ocf_customprofilefields.php

示例12: _survey_results

 /**
  * View survey results.
  *
  * @return tempcode	The result of execution.
  */
 function _survey_results()
 {
     $title = get_page_title('SURVEY_RESULTS');
     breadcrumb_set_parents(array(array('_SELF:_SELF', do_lang_tempcode('MANAGE_QUIZZES'))));
     $GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/survey_results';
     $id = get_param_integer('id');
     // quiz ID
     $fields = new ocp_tempcode();
     require_code('templates_results_table');
     require_code('templates_view_space');
     // Show summary
     $question_rows = $GLOBALS['SITE_DB']->query_select('quiz_questions', array('*'), array('q_quiz' => $id), 'ORDER BY id');
     foreach ($question_rows as $q) {
         $question = get_translated_text($q['q_question_text']);
         $answers = new ocp_tempcode();
         $answer_rows = $GLOBALS['SITE_DB']->query_select('quiz_question_answers', array('*'), array('q_question' => $q['id']), 'ORDER BY id');
         $all_answers = array();
         foreach ($answer_rows as $i => $a) {
             $answer = get_translated_text($a['q_answer_text']);
             $count = $GLOBALS['SITE_DB']->query_value('quiz_entry_answer', 'COUNT(*)', array('q_answer' => strval($a['id'])));
             $all_answers[serialize(array($answer, $i))] = $count;
         }
         arsort($all_answers);
         foreach ($all_answers as $bits => $count) {
             list($answer, $i) = unserialize($bits);
             $answers->attach(paragraph(do_lang_tempcode('SURVEY_ANSWER_RESULT', escape_html($answer), integer_format($count), integer_format($i + 1))));
         }
         if ($answers->is_empty()) {
             $answers = do_lang_tempcode('FREE_ENTRY_ANSWER');
         }
         $fields->attach(view_space_field($question, $answers, true));
     }
     $summary = do_template('VIEW_SPACE', array('_GUID' => '2b0c2ba0070ba810c5e4b5b4aedcb15f', 'WIDTH' => '300', 'FIELDS' => $fields));
     // Show results table
     $start = get_param_integer('start', 0);
     $max = get_param_integer('max', 50);
     $sortables = array('q_time' => do_lang_tempcode('DATE'));
     $test = explode(' ', get_param('sort', 'q_time DESC'), 2);
     if (count($test) == 1) {
         $test[1] = 'DESC';
     }
     list($sortable, $sort_order) = $test;
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $max_rows = $GLOBALS['SITE_DB']->query_value('quiz_entries', 'COUNT(*)', array('q_quiz' => $id));
     $rows = $GLOBALS['SITE_DB']->query_select('quiz_entries', array('id', 'q_time', 'q_member'), array('q_quiz' => $id), 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
     if (count($rows) == 0) {
         return inform_screen($title, do_lang_tempcode('NO_ENTRIES'));
     }
     $fields = new ocp_tempcode();
     $fields_title = results_field_title(array(do_lang_tempcode('DATE'), do_lang_tempcode('USERNAME')), $sortables, 'sort', $sortable . ' ' . $sort_order);
     foreach ($rows as $myrow) {
         $date_link = hyperlink(build_url(array('page' => '_SELF', 'type' => '__survey_results', 'id' => $myrow['id']), '_SELF'), escape_html(get_timezoned_date($myrow['q_time'])));
         $member_link = $GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($myrow['q_member']);
         $fields->attach(results_entry(array($date_link, $member_link), false));
     }
     if ($fields->is_empty()) {
         warn_exit(do_lang_tempcode('NO_ENTRIES'));
     }
     $results = results_table(do_lang_tempcode('SURVEY_RESULTS'), $start, 'start', $max, 'max', $max_rows, $fields_title, $fields, $sortables, $sortable, $sort_order, 'sort');
     return do_template('SURVEY_RESULTS_SCREEN', array('_GUID' => '3f38ac1b94fb4de8219b8f7108c7b0a3', 'TITLE' => $title, 'SUMMARY' => $summary, 'RESULTS' => $results));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:70,代码来源:admin_quiz.php

示例13: render_attachment


//.........这里部分代码省略.........
    if (!array_key_exists('a_description', $attachment)) {
        if (array_key_exists('description', $attributes)) {
            $attachment['description'] = $attributes['description'];
        }
        if (!array_key_exists('description', $attachment)) {
            $attachment['description'] = '';
        }
        $attachment['a_description'] = is_object($attachment['description']) ? $attachment['description'] : comcode_to_tempcode($attachment['description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
    } else {
        $attachment['a_description'] = comcode_to_tempcode($attachment['a_description'], $source_member, $as_admin, 60, NULL, $connection, false, false, false, false, false, NULL, $on_behalf_of_member);
    }
    $attachment['a_type'] = $type;
    $attachment['a_thumb'] = array_key_exists('thumb', $attributes) ? $attributes['thumb'] : '1';
    if ($attachment['a_thumb'] != '0') {
        $attachment['a_thumb'] = '1';
    }
    $attachment['a_thumb_url'] = array_key_exists('thumb_url', $attributes) ? $attributes['thumb_url'] : $attachment['a_thumb_url'];
    switch ($type) {
        case 'email':
            require_code('mail');
            global $EMAIL_ATTACHMENTS;
            if (url_is_local($attachment['a_url'])) {
                $attachment['a_url'] = get_custom_base_url() . '/' . $attachment['a_url'];
            }
            $EMAIL_ATTACHMENTS[$attachment['a_url']] = $attachment['a_original_filename'];
            $temp_tpl = new ocp_tempcode();
            break;
        case 'code':
            $url = $attachment['a_url'];
            if (url_is_local($url)) {
                $url = get_custom_base_url() . '/' . $url;
            }
            $file_contents = http_download_file($url, 1024 * 1024 * 20);
            list($_embed, $title) = do_code_box($extension, make_string_tempcode($file_contents));
            if ($attachment['a_original_filename'] != '') {
                $title = escape_html($attachment['a_original_filename']);
            }
            $temp_tpl = do_template('COMCODE_CODE', array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'STYLE' => '', 'TYPE' => $extension, 'CONTENT' => $_embed, 'TITLE' => $title));
            break;
        case 'hyperlink':
            if ($tag == 'attachment') {
                $keep = symbol_tempcode('KEEP');
                $_url = new ocp_tempcode();
                $_url->attach(find_script('attachment') . '?id=' . urlencode($attachment['id']) . $keep->evaluate());
                if (get_option('anti_leech') == '1') {
                    $_url->attach('&for_session=');
                    $_url->attach(symbol_tempcode('SESSION_HASHED'));
                }
            } else {
                $url = $attachment['a_url'];
                if (url_is_local($url)) {
                    $url = get_custom_base_url() . '/' . $url;
                }
                $_url = make_string_tempcode($url);
            }
            $temp_tpl = hyperlink($_url, is_object($attachment['a_description']) ? $attachment['a_description']->evaluate() : $attachment['a_description'] != '' ? $attachment['a_description'] : $attachment['a_original_filename'], true);
            break;
        default:
            if (is_image($attachment['a_original_filename'])) {
                if ($type == 'inline' || $type == 'left_inline' || $type == 'right_inline') {
                    $attachment['mini'] = '1';
                }
                require_code('images');
                ensure_thumbnail($attachment['a_url'], $attachment['a_thumb_url'], 'attachments', 'attachments', intval($attachment['id']), 'a_thumb_url');
                $temp_tpl = do_template('ATTACHMENT_IMG' . (array_key_exists('mini', $attachment) && $attachment['mini'] == '1' ? '_MINI' : ''), map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                if ($type == 'left' || $type == 'left_inline') {
                    $temp_tpl = do_template('ATTACHMENT_LEFT', array('_GUID' => 'aee2a6842d369c8dae212c3478a3a3e9', 'WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'CONTENT' => $temp_tpl));
                }
                if ($type == 'right' || $type == 'right_inline') {
                    $temp_tpl = do_template('ATTACHMENT_RIGHT', array('_GUID' => '1a7209d67d91db740c86e7a331720195', 'WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true, 'CONTENT' => $temp_tpl));
                }
                break;
            } elseif ($extension == 'swf') {
                $temp_tpl = do_template('ATTACHMENT_SWF', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif (addon_installed('jwplayer') && ($mime_type == 'video/x-flv' || $mime_type == 'video/mp4' || $mime_type == 'video/webm')) {
                $temp_tpl = do_template('ATTACHMENT_FLV', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif ($mime_type == 'video/quicktime') {
                $temp_tpl = do_template('ATTACHMENT_QT', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif ($mime_type == 'audio/x-pn-realaudio') {
                $temp_tpl = do_template('ATTACHMENT_RM', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            } elseif (substr($mime_type, 0, 5) == 'video' || substr($mime_type, 0, 5) == 'audio') {
                $temp_tpl = do_template('ATTACHMENT_MEDIA', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
                break;
            }
            // Continues on, as it's not a media type...
        // Continues on, as it's not a media type...
        case 'download':
            if (is_null($attachment['a_file_size'])) {
                $temp_tpl = do_template('ATTACHMENT_DOWNLOAD_REMOTE', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
            } else {
                $temp_tpl = do_template('ATTACHMENT_DOWNLOAD', map_keys_to_upper($attachment) + array('WYSIWYG_SAFE' => $tag == 'attachment' ? NULL : true));
            }
            break;
    }
    return $temp_tpl;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:attachments.php

示例14: cedi_breadcrumbs

/**
 * Convert a CEDI chain to a nice formatted XHTML tree.
 *
 * @param  string			The chain to convert (which should include the current page ID)
 * @param  ?string		The title of the current CEDI page (if not given, it is looked up) (NULL: work it out)
 * @param  boolean		Whether to show the final tree element with a link to it (all others will always have links if $links is true)
 * @param  boolean		Whether to show links to pages in the tree
 * @param  boolean		Whether to make the link as a virtual-root link (only applies if $final_link is true)
 * @return tempcode		Tempcode of the breadcrumb XHTML
 */
function cedi_breadcrumbs($chain, $current_title = NULL, $final_link = false, $links = true, $this_link_virtual_root = false)
{
    $instree = new ocp_tempcode();
    $token = strtok($chain, '/');
    $rebuild_chain = '';
    while ($token !== false) {
        $next_token = strtok('/');
        if ($rebuild_chain != '') {
            $rebuild_chain .= '/';
        }
        $rebuild_chain .= $token;
        $id = $this_link_virtual_root && $next_token === false ? $token : $rebuild_chain;
        $url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $id == strval(db_get_first_id()) ? NULL : $id) + ($this_link_virtual_root && $next_token === false ? array('keep_cedi_root' => $id) : array()), get_module_zone('cedi'));
        if ($next_token !== false) {
            $title = $GLOBALS['SITE_DB']->query_value_null_ok('seedy_pages', 'title', array('id' => intval($token)));
            if (is_null($title)) {
                continue;
            }
            $token_title = get_translated_text($title);
            $content = $links ? hyperlink($url, escape_html($token_title), false, false, do_lang_tempcode('GO_BACKWARDS_TO', $token_title), NULL, NULL, 'up') : make_string_tempcode(escape_html($token_title));
            if ($instree->is_empty()) {
                $instree->attach($content);
            } else {
                $instree->attach(do_template('BREADCRUMB_ESCAPED'));
                $instree->attach($content);
            }
        } else {
            if (!$instree->is_empty()) {
                $instree->attach(do_template('BREADCRUMB_ESCAPED'));
            }
            if (is_null($current_title)) {
                $_current_title = $GLOBALS['SITE_DB']->query_value_null_ok('seedy_pages', 'title', array('id' => intval($token)));
                $current_title = is_null($_current_title) ? do_lang('MISSING_RESOURCE') : get_translated_text($_current_title);
            }
            if ($final_link) {
                $instree->attach(hyperlink($url, escape_html($current_title), false, false, $this_link_virtual_root ? do_lang_tempcode('VIRTUAL_ROOT') : do_lang_tempcode('GO_BACKWARDS_TO', $current_title), NULL, NULL, 'up'));
            } else {
                $instree->attach($current_title);
            }
        }
        $token = $next_token;
    }
    return $instree;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:54,代码来源:cedi.php

示例15: nice_get_choose_table

 /**
  * Standard aed_module table function.
  *
  * @param  array			Details to go to build_url for link to the next screen.
  * @return array			A pair: The choose table, Whether re-ordering is supported from this screen.
  */
 function nice_get_choose_table($url_map)
 {
     require_code('templates_results_table');
     $current_ordering = get_param('sort', 'title ASC', true);
     list($sortable, $sort_order) = array(substr($current_ordering, 0, strrpos($current_ordering, ' ')), substr($current_ordering, strrpos($current_ordering, ' ') + 1));
     $sortables = array('title' => do_lang_tempcode('TITLE'));
     if (db_has_subqueries($GLOBALS['SITE_DB']->connection_read)) {
         $sortables['(SELECT COUNT(*) FROM ' . get_table_prefix() . 'newsletter n JOIN ' . get_table_prefix() . 'newsletter_subscribe s ON n.id=s.newsletter_id WHERE code_confirm=0)'] = do_lang_tempcode('COUNT_MEMBERS');
     }
     if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
         log_hack_attack_and_exit('ORDERBY_HACK');
     }
     global $NON_CANONICAL_PARAMS;
     $NON_CANONICAL_PARAMS[] = 'sort';
     $header_row = results_field_title(array(do_lang_tempcode('TITLE'), do_lang_tempcode('COUNT_MEMBERS'), do_lang_tempcode('ACTIONS')), $sortables, 'sort', $sortable . ' ' . $sort_order);
     $fields = new ocp_tempcode();
     require_code('form_templates');
     list($rows, $max_rows) = $this->get_entry_rows(false, $current_ordering);
     foreach ($rows as $row) {
         $edit_link = build_url($url_map + array('id' => $row['id']), '_SELF');
         $num_readers = $GLOBALS['SITE_DB']->query_value('newsletter n JOIN ' . get_table_prefix() . 'newsletter_subscribe s ON n.id=s.newsletter_id', 'COUNT(*)', array('code_confirm' => 0));
         $fields->attach(results_entry(array(get_translated_text($row['title']), integer_format($num_readers), protect_from_escaping(hyperlink($edit_link, do_lang_tempcode('EDIT'), false, true, '#' . strval($row['id'])))), true));
     }
     return array(results_table(do_lang($this->menu_label), get_param_integer('start', 0), 'start', either_param_integer('max', 20), 'max', $max_rows, $header_row, $fields, $sortables, $sortable, $sort_order), false);
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:admin_newsletter.php


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