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


PHP xmlentities函数代码示例

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


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

示例1: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     require_lang('activities');
     require_code('activities');
     list(, $whereville) = find_activities(get_member(), $_filters == '' ? 'all' : 'some_members', $_filters == '' ? NULL : array_map('intval', explode(',', $_filters)));
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . get_table_prefix() . 'activities WHERE (' . $whereville . ') AND a_time>' . strval($cutoff) . ' ORDER BY a_time DESC', $max, 0);
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = $GLOBALS['FORUM_DRIVER']->get_username($row['a_member_id']);
         if (is_null($author)) {
             $author = do_lang('UNKNOWN');
         }
         $news_date = date($date_string, $row['a_time']);
         $edit_date = '';
         list($_title, ) = render_activity($row);
         $news_title = xmlentities($_title->evaluate());
         $summary = xmlentities('');
         $news = '';
         $category = '';
         $category_raw = '';
         $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['a_member_id']), get_module_zone('members'), NULL, false, false, true);
         $if_comments = new ocp_tempcode();
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     return array($content, do_lang('ACTIVITIES_TITLE'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:38,代码来源:activities.php

示例2: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!has_actual_page_access(get_member(), 'members')) {
         return NULL;
     }
     $rows = $GLOBALS['FORUM_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'f_members p WHERE m_join_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND m_validated=1 AND m_validated_email_confirm_code=\'\' ' : '') . ' ORDER BY m_join_time DESC', $max);
     $categories = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(true);
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = '';
         $news_date = date($date_string, $row['m_join_time']);
         $edit_date = '';
         $news_title = xmlentities($row['m_username']);
         $summary = '';
         $news = '';
         $category = array_key_exists($row['m_primary_group'], $categories) ? $categories[$row['m_primary_group']] : '';
         $category_raw = strval($row['m_primary_group']);
         $view_url = build_url(array('page' => 'members', 'type' => 'view', 'id' => $row['id']), get_module_zone('members'), NULL, false, false, true);
         $if_comments = new ocp_tempcode();
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     require_lang('ocf');
     return array($content, do_lang('MEMBERS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:36,代码来源:ocf_members.php

示例3: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     require_code('ocf_forums');
     require_code('ocf_forums2');
     $tree = ocf_get_topic_tree(is_null($id) ? NULL : intval($id), NULL, NULL, is_null($id) ? 0 : 1);
     if (!has_actual_page_access(NULL, 'forumview')) {
         $tree = array();
     }
     $out = '';
     foreach ($tree as $t) {
         $_id = $t['id'];
         if ($id === strval($_id)) {
             foreach ($t['entries'] as $eid => $etitle) {
                 $out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>';
             }
             continue;
         }
         $title = $t['title'];
         $has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0;
         $out .= '<category id="' . xmlentities(strval($_id)) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>';
     }
     // Mark parent cats for pre-expansion
     if (!is_null($default) && $default != '') {
         $cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_topics', 't_forum_id', array('id' => intval($default)));
         while (!is_null($cat)) {
             $out .= '<expand>' . strval($cat) . '</expand>';
             $cat = $GLOBALS['FORUM_DB']->query_value_null_ok('f_forums', 'f_parent_forum', array('id' => $cat));
         }
     }
     return '<result>' . $out . '</result>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:39,代码来源:choose_forum_topic.php

示例4: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('cedi')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'cedi')) {
         return NULL;
     }
     $filters = ocfilter_to_sqlfragment($_filters, 'id', 'seedy_children', 'parent_id', 'parent_id', 'child_id');
     $content = new ocp_tempcode();
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'seedy_pages WHERE ' . $filters . ' AND add_date>' . strval((int) $cutoff) . ' ORDER BY add_date DESC', $max);
     foreach ($rows as $row) {
         $id = strval($row['id']);
         if (!has_category_access(get_member(), 'seedy_page', strval($row['id']))) {
             continue;
         }
         $author = '';
         $news_date = date($date_string, $row['add_date']);
         $edit_date = '';
         $news_title = xmlentities(escape_html(get_translated_text($row['title'])));
         $_summary = get_translated_tempcode($row['description']);
         $summary = xmlentities($_summary->evaluate());
         $news = '';
         $category = '';
         $category_raw = '';
         $view_url = build_url(array('page' => 'cedi', 'type' => 'misc', 'id' => $row['id'] == db_get_first_id() ? NULL : $row['id']), get_module_zone('cedi'), NULL, false, false, true);
         $if_comments = new ocp_tempcode();
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     require_lang('cedi');
     return array($content, do_lang('CEDI_PAGES'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:43,代码来源:cedi.php

示例5: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('news')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'news')) {
         return NULL;
     }
     $filters_1 = ocfilter_to_sqlfragment($_filters, 'p.news_category', 'news_categories', NULL, 'p.news_category', '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)
     $filters_2 = ocfilter_to_sqlfragment($_filters, 'd.news_entry_category', 'news_categories', NULL, 'd.news_category', '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)
     $filters = '(' . $filters_1 . ' OR ' . $filters_2 . ')';
     $rows = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news p LEFT JOIN ' . get_table_prefix() . 'news_category_entries d ON d.news_entry=p.id WHERE date_and_time>' . strval($cutoff) . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' AND ' . $filters . (can_arbitrary_groupby() ? ' GROUP BY p.id' : '') . ' ORDER BY date_and_time DESC', $max);
     $rows = remove_duplicate_rows($rows, 'id');
     $_categories = $GLOBALS['SITE_DB']->query_select('news_categories', array('id', 'nc_title'), array('nc_owner' => NULL));
     foreach ($_categories as $i => $_category) {
         $_categories[$i]['text_original'] = get_translated_text($_category['nc_title']);
     }
     $categories = collapse_2d_complexity('id', 'text_original', $_categories);
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if (has_category_access(get_member(), 'news', strval($row['news_category']))) {
             $id = strval($row['id']);
             $author = $row['author'];
             $news_date = date($date_string, $row['date_and_time']);
             $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
             $_title = get_translated_tempcode($row['title']);
             $news_title = xmlentities($_title->evaluate());
             $_summary = get_translated_tempcode($row['news']);
             if ($_summary->is_empty()) {
                 $_summary = get_translated_tempcode($row['news_article']);
             }
             $summary = xmlentities($_summary->evaluate());
             if (!is_null($row['news_article'])) {
                 $_news = get_translated_tempcode($row['news_article']);
                 if ($_news->is_empty()) {
                     $news = '';
                 } else {
                     $news = xmlentities($_news->evaluate());
                 }
             } else {
                 $news = '';
             }
             if (!array_key_exists($row['news_category'], $categories)) {
                 $categories[$row['news_category']] = get_translated_text($GLOBALS['SITE_DB']->query_value('news_categories', 'nc_title', array('id' => $row['news_category'])));
             }
             $category = $categories[$row['news_category']];
             $category_raw = strval($row['news_category']);
             $view_url = build_url(array('page' => 'news', 'type' => 'view', 'id' => $row['id']), get_module_zone('news'), NULL, false, false, true);
             if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= 1) {
                 $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
             } else {
                 $if_comments = new ocp_tempcode();
             }
             $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
         }
     }
     return array($content, do_lang('NEWS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:news.php

示例6: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('galleries')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'galleries')) {
         return NULL;
     }
     $filters_1 = ocfilter_to_sqlfragment($_filters, 'name', 'galleries', 'parent_id', 'name', 'name', false, false);
     // 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)
     $filters = ocfilter_to_sqlfragment($_filters, 'cat', 'galleries', 'parent_id', 'cat', 'name', false, false);
     // 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)
     require_lang('galleries');
     $content = new ocp_tempcode();
     $_galleries = array();
     if ($GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1) < 3000) {
         $_galleries = $GLOBALS['SITE_DB']->query('SELECT fullname,name FROM ' . get_table_prefix() . 'galleries WHERE ' . $filters_1);
         foreach ($_galleries as $i => $_gallery) {
             $_galleries[$i]['text_original'] = get_translated_text($_gallery['fullname']);
         }
     }
     $galleries = collapse_2d_complexity('name', 'text_original', $_galleries);
     $rows1 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'videos WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
     $rows2 = $GLOBALS['SITE_DB']->query('SELECT * FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'images WHERE add_date>' . strval((int) $cutoff) . ' AND ' . $filters . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND validated=1 ' : '') . ' ORDER BY add_date DESC', $max);
     $rows = array_merge($rows1, $rows2);
     foreach ($rows as $row) {
         $id = strval($row['id']);
         $author = $GLOBALS['FORUM_DRIVER']->get_username($row['submitter']);
         if (is_null($author)) {
             $author = '';
         }
         $news_date = date($date_string, $row['add_date']);
         $edit_date = is_null($row['edit_date']) ? '' : date($date_string, $row['edit_date']);
         $news_title = xmlentities(do_lang('THIS_WITH_SIMPLE', array_key_exists('video_views', $row) ? do_lang('VIDEO') : do_lang('IMAGE'), strval($row['id'])));
         $_summary = get_translated_tempcode($row['comments']);
         $summary = xmlentities($_summary->evaluate());
         $news = '';
         if (!array_key_exists($row['cat'], $galleries)) {
             $_fullname = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'fullname', array('name' => $row['cat']));
             if (is_null($_fullname)) {
                 continue;
             }
             $galleries[$row['cat']] = get_translated_text($_fullname);
         }
         $category = $galleries[$row['cat']];
         $category_raw = $row['cat'];
         $view_url = build_url(array('page' => 'galleries', 'type' => array_key_exists('video_views', $row) ? 'video' : 'image', 'id' => $row['id']), get_module_zone('galleries'), NULL, false, false, true);
         if ($prefix == 'RSS_' && get_option('is_on_comments') == '1' && $row['allow_comments'] >= '1') {
             $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => '65dc0cec8c75f565c58c95fa1667aa1e', 'COMMENT_URL' => $view_url, 'ID' => strval($row['id'])));
         } else {
             $if_comments = new ocp_tempcode();
         }
         require_code('images');
         $enclosure_url = ensure_thumbnail($row['url'], $row['thumb_url'], 'galleries', array_key_exists('video_views', $row) ? 'videos' : 'images', $row['id']);
         list($enclosure_length, $enclosure_type) = get_enclosure_details($row['url'], $enclosure_url);
         $content->attach(do_template($prefix . 'ENTRY', array('ENCLOSURE_URL' => $enclosure_url, 'ENCLOSURE_LENGTH' => $enclosure_length, 'ENCLOSURE_TYPE' => $enclosure_type, 'VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
     }
     require_lang('galleries');
     return array($content, do_lang('GALLERIES'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:71,代码来源:galleries.php

示例7: writeInternal

 function writeInternal($str)
 {
     global $opt;
     // close the last file?
     if ($this->oSitemapFile !== false && ($this->nWrittenSize + strlen($str) > $this->nMaxFileSize || $this->nWrittenCount >= $this->nMaxUrlCount)) {
         gzwrite($this->oSitemapFile, '</urlset>');
         gzclose($this->oSitemapFile);
         $this->oSitemapFile = false;
     }
     // open new XML file?
     if ($this->oSitemapFile === false) {
         $this->nSitemapIndex++;
         $sFilename = 'sitemap-' . $this->nSitemapIndex . '.xml.gz';
         $this->oSitemapFile = gzopen($this->sPath . $sFilename, 'wb');
         fwrite($this->oIndexFile, '<sitemap><loc>' . xmlentities($this->sDomain . $sFilename) . '</loc><lastmod>' . xmlentities(date('c')) . '</lastmod></sitemap>');
         gzwrite($this->oSitemapFile, '<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         gzwrite($this->oSitemapFile, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
         // includes end of xml-tag
         $this->nWrittenSize = 108;
         $this->nWrittenCount = 0;
     }
     // write string to XML
     gzwrite($this->oSitemapFile, $str);
     $this->nWrittenSize += strlen($str);
     $this->nWrittenCount++;
 }
开发者ID:RH-Code,项目名称:opencaching,代码行数:26,代码来源:sitemapxml.class.php

示例8: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     require_code('galleries');
     $only_owned = array_key_exists('only_owned', $options) ? is_null($options['only_owned']) ? NULL : intval($options['only_owned']) : NULL;
     $editable_filter = array_key_exists('editable_filter', $options) ? $options['editable_filter'] : false;
     $tree = get_gallery_content_tree('images', $only_owned, $id, NULL, NULL, is_null($id) ? 0 : 1, false, $editable_filter);
     if (!has_actual_page_access(NULL, 'galleries')) {
         $tree = array();
     }
     $out = '';
     foreach ($tree as $t) {
         $_id = $t['id'];
         if ($id === $_id) {
             foreach ($t['entries'] as $eid => $etitle) {
                 if (is_object($etitle)) {
                     $etitle = @html_entity_decode(strip_tags($etitle->evaluate()), ENT_QUOTES, get_charset());
                 }
                 $out .= '<entry id="' . xmlentities(strval($eid)) . '" title="' . xmlentities($etitle) . '" selectable="true"></entry>';
             }
             continue;
         }
         $title = $t['title'];
         $has_children = $t['child_count'] != 0 || $t['child_entry_count'] != 0;
         $out .= '<category id="' . xmlentities($_id) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="false"></category>';
     }
     // Mark parent cats for pre-expansion
     if (!is_null($default) && $default != '') {
         $cat = $GLOBALS['SITE_DB']->query_value_null_ok('images', 'cat', array('id' => intval($default)));
         while (!is_null($cat) && $cat != '') {
             $out .= '<expand>' . $cat . '</expand>';
             $cat = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => $cat));
         }
     }
     return '<result>' . $out . '</result>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:43,代码来源:choose_image.php

示例9: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('exit', array('h'), array()), '', '');
     } else {
         return array('if (document.getElementById(\'occle_box\')) load_occle(); else window.location.href=\'' . xmlentities(addslashes(static_evaluate_tempcode(build_url(array('page' => ''), '')))) . '\';', '', do_lang('SUCCESS'), '');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:16,代码来源:exit.php

示例10: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('tickets')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'tickets')) {
         return NULL;
     }
     if (is_guest()) {
         return NULL;
     }
     require_code('tickets');
     require_code('tickets2');
     $ticket_types = ocfilter_to_idlist_using_callback($_filters, '', NULL, NULL, NULL, NULL, false);
     if (count($ticket_types) != 0) {
         $rows = array();
         foreach ($ticket_types as $ticket_type) {
             if (!has_category_access(get_member(), 'tickets', get_translated_text($ticket_type))) {
                 continue;
             }
             $rows = array_merge($rows, get_tickets(get_member(), $ticket_type, false, false, true));
         }
     } else {
         $rows = get_tickets(get_member(), NULL, false, false, true);
     }
     require_code('feedback');
     $content = new ocp_tempcode();
     foreach ($rows as $i => $row) {
         if ($i == $max) {
             break;
         }
         if ($row['lasttime'] < $cutoff) {
             continue;
         }
         $ticket_id = extract_topic_identifier($row['description']);
         $ticket_type = $GLOBALS['SITE_DB']->query_value_null_ok('tickets', 'ticket_type', array('ticket_id' => $ticket_id));
         $author = $row['firstusername'];
         $date = date($date_string, $row['firsttime']);
         $edit_date = date($date_string, $row['lasttime']);
         $title = xmlentities($row['firsttitle']);
         $summary = xmlentities($row['firstpost']->evaluate());
         $category = '';
         $category_raw = '';
         if (!is_null($ticket_type)) {
             $category = get_translated_text($ticket_type);
             $category_raw = strval($ticket_type);
         }
         $view_url = build_url(array('page' => 'tickets', 'type' => 'ticket', 'id' => $ticket_id), get_module_zone('tickets'), NULL, false, false, true);
         if ($prefix == 'RSS_' && get_option('is_on_comments') == '1') {
             $if_comments = do_template('RSS_ENTRY_COMMENTS', array('_GUID' => 'b4f25f5cf68304f8d402bb06851489d6', 'COMMENT_URL' => $view_url, 'ID' => strval($ticket_id)));
         } else {
             $if_comments = new ocp_tempcode();
         }
         $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $ticket_id, 'NEWS' => '', 'DATE' => $date)));
     }
     require_lang('tickets');
     return array($content, do_lang('SUPPORT_TICKETS'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:69,代码来源:tickets.php

示例11: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     if ($id === NULL) {
         $id = '';
     }
     require_code('files2');
     require_code('images');
     $fullpath = get_custom_file_base() . '/uploads/filedump';
     if ($id != '') {
         $fullpath .= '/' . $id;
     }
     $folder = isset($options['folder']) && $options['folder'];
     // We want to select folders, not files
     $out = '';
     if (has_actual_page_access(NULL, 'filedump') && file_exists($fullpath)) {
         $files = get_directory_contents($fullpath, '', false, false);
         foreach ($files as $f) {
             $description = $GLOBALS['SITE_DB']->query_value_null_ok('filedump', 'description', array('name' => basename($f), 'path' => $id . '/'));
             if (isset($options['attachment_ready']) && $options['attachment_ready']) {
                 $entry_id = 'url_' . 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f);
             } else {
                 $entry_id = 'uploads/filedump/' . ($id == '' ? '' : rawurlencode($id) . '/') . rawurlencode($f);
             }
             if (is_dir($fullpath . '/' . $f)) {
                 $has_children = count(get_directory_contents($fullpath . '/' . $f, '', false, false)) > 0;
                 $out .= '<category id="' . xmlentities(($id == '' ? '' : $id . '/') . $f) . '" title="' . xmlentities($f) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($folder ? 'true' : 'false') . '"></category>';
             } elseif (!$folder) {
                 if (!isset($options['only_images']) || !$options['only_images'] || is_image($f)) {
                     if (is_null($description) || get_translated_text($description) == '') {
                         $_description = '';
                         if (is_image($f)) {
                             $url = get_custom_base_url() . '/uploads/filedump/' . ($id == '' ? '' : $id . '/') . $f;
                             $_description = static_evaluate_tempcode(do_image_thumb($url, '', true, true));
                         }
                     } else {
                         $_description = escape_html(get_translated_text($description));
                     }
                     $out .= '<entry id="' . xmlentities($entry_id) . '" title="' . xmlentities($f) . '" description_html="' . xmlentities($_description) . '" selectable="true"></entry>';
                 }
             }
         }
         // Mark parent cats for pre-expansion
         if (!is_null($default) && $default != '') {
             $cat = '';
             foreach (explode('/', $default) as $_cat) {
                 if ($_cat != '') {
                     $cat .= '/';
                     $cat .= $_cat;
                 }
                 $out .= '<expand>' . $cat . '</expand>';
             }
         }
     }
     return '<result>' . $out . '</result>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:63,代码来源:choose_filedump_file.php

示例12: run

 /**
  * Standard modular run function for RSS hooks.
  *
  * @param  string			A list of categories we accept from
  * @param  TIME			Cutoff time, before which we do not show results from
  * @param  string			Prefix that represents the template set we use
  * @set    RSS_ ATOM_
  * @param  string			The standard format of date to use for the syndication type represented in the prefix
  * @param  integer		The maximum number of entries to return, ordering by date
  * @return ?array			A pair: The main syndication section, and a title (NULL: error)
  */
 function run($_filters, $cutoff, $prefix, $date_string, $max)
 {
     if (!addon_installed('chat')) {
         return NULL;
     }
     if (!has_actual_page_access(get_member(), 'chat')) {
         return NULL;
     }
     $filters = ocfilter_to_sqlfragment($_filters, 'room_id', 'chat_rooms', NULL, 'room_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)
     require_code('chat');
     $rows = $GLOBALS['SITE_DB']->query('SELECT m.* FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_messages m LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'chat_rooms r ON r.id=m.room_id WHERE r.is_im=0 AND date_and_time>' . strval(time() - $cutoff) . ' AND ' . $filters . ' ORDER BY date_and_time DESC', $max);
     $count = $GLOBALS['SITE_DB']->query_value('chat_rooms', 'COUNT(*)', array('is_im' => 0));
     $categories = array();
     if ($count < 100) {
         $_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('is_im' => 0));
         foreach ($_categories as $category) {
             $categories[$category['id']] = $category;
         }
     }
     $content = new ocp_tempcode();
     foreach ($rows as $row) {
         if (!array_key_exists($row['room_id'], $categories) && $count >= 100) {
             $_categories = $GLOBALS['SITE_DB']->query_select('chat_rooms', array('*'), array('id' => $row['room_id']), '', 1);
             if (array_key_exists(0, $_categories)) {
                 $categories[$row['room_id']] = $_categories[0];
             }
         }
         if (!array_key_exists($row['room_id'], $categories)) {
             continue;
         }
         // Message is in deleted room (although should not exist in DB anymore!)
         if (check_chatroom_access($categories[$row['room_id']], true)) {
             $id = strval($row['id']);
             $author = $GLOBALS['FORUM_DRIVER']->get_username($row['user_id']);
             if (is_null($author)) {
                 $author = '';
             }
             $news_date = date($date_string, $row['date_and_time']);
             $edit_date = '';
             $_title = get_translated_tempcode($row['the_message']);
             $news_title = xmlentities($_title->evaluate());
             $summary = '';
             $news = '';
             $category = $categories[$row['room_id']]['room_name'];
             $category_raw = strval($row['room_id']);
             $view_url = build_url(array('page' => 'chat', 'type' => 'room', 'id' => $row['room_id']), get_module_zone('chat'), NULL, false, false, true);
             $if_comments = new ocp_tempcode();
             $content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
         }
     }
     require_lang('chat');
     return array($content, do_lang('MESSAGES'));
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:65,代码来源:chat.php

示例13: echo_sitemap_url

function echo_sitemap_url($loc, $priority, $freq)
{
    $loc_xml = isset($_SERVER['HTTP_HOST']) ? xmlentities("http://{$_SERVER['HTTP_HOST']}/{$loc}") : xmlentities("http://www.boost.org/{$loc}");
    echo <<<EOL
<url>
<loc>{$loc_xml}</loc>
<priority>{$priority}</priority>
<changefreq>{$freq}</changefreq>
</url>

EOL;
}
开发者ID:raffienficiaud,项目名称:website,代码行数:12,代码来源:sitemap.xml.php

示例14: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     require_code('galleries');
     require_lang('galleries');
     $must_accept_images = array_key_exists('must_accept_images', $options) ? $options['must_accept_images'] : false;
     $must_accept_videos = array_key_exists('must_accept_videos', $options) ? $options['must_accept_videos'] : false;
     $filter = array_key_exists('filter', $options) ? $options['filter'] : NULL;
     $purity = array_key_exists('purity', $options) ? $options['purity'] : false;
     $member_id = array_key_exists('member_id', $options) ? $options['member_id'] : NULL;
     $compound_list = array_key_exists('compound_list', $options) ? $options['compound_list'] : false;
     $addable_filter = array_key_exists('addable_filter', $options) ? $options['addable_filter'] : false;
     $stripped_id = $compound_list ? preg_replace('#,.*$#', '', $id) : $id;
     $tree = get_gallery_tree(is_null($id) ? 'root' : $stripped_id, '', NULL, true, $filter, false, false, $purity, $compound_list, is_null($id) ? 0 : 1, $member_id, $addable_filter);
     if (!has_actual_page_access(NULL, 'galleries')) {
         $tree = array();
     }
     if ($compound_list) {
         list($tree, ) = $tree;
     }
     $out = '';
     for ($i = 0; $i < count($tree); $i++) {
         $t = $tree[$i];
         $_id = $compound_list ? $t['compound_list'] : $t['id'];
         if ($stripped_id === $t['id']) {
             // Possible when we look under as a root
             if (array_key_exists('children', $t)) {
                 $tree = $t['children'];
                 $i = 0;
             }
             continue;
         }
         $title = $t['title'];
         if (is_object($title)) {
             $title = @html_entity_decode(strip_tags($title->evaluate()), ENT_QUOTES, get_charset());
         }
         $has_children = $t['child_count'] != 0;
         $selectable = ($addable_filter !== true || $t['addable']) && ($t['accept_videos'] == 1 && $t['is_member_synched'] == 0 || !$must_accept_videos) && ($t['accept_images'] == 1 && $t['is_member_synched'] == 0 || !$must_accept_images);
         $tag = 'category';
         // category
         $out .= '<' . $tag . ' id="' . xmlentities($_id) . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($selectable ? 'true' : 'false') . '"></' . $tag . '>';
         // Mark parent cats for pre-expansion
         if (!is_null($default) && $default != '') {
             $cat = $default;
             while (!is_null($cat) && $cat != '') {
                 $out .= '<expand>' . $cat . '</expand>';
                 $cat = $GLOBALS['SITE_DB']->query_value_null_ok('galleries', 'parent_id', array('name' => $cat));
             }
         }
     }
     $tag = 'result';
     // result
     return '<' . $tag . '>' . $out . '</' . $tag . '>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:61,代码来源:choose_gallery.php

示例15: run

 /**
  * Standard modular run function for ajax-tree hooks. Generates XML for a tree list, which is interpreted by Javascript and expanded on-demand (via new calls).
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @param  array			Options being passed through
  * @param  ?ID_TEXT		The ID to select by default (NULL: none)
  * @return string			XML in the special category,entry format
  */
 function run($id, $options, $default = NULL)
 {
     require_code('catalogues');
     require_lang('catalogues');
     $catalogue_name = array_key_exists('catalogue_name', $options) ? $options['catalogue_name'] : NULL;
     $addable_filter = array_key_exists('addable_filter', $options) ? $options['addable_filter'] : false;
     $compound_list = array_key_exists('compound_list', $options) ? $options['compound_list'] : false;
     $stripped_id = $compound_list ? preg_replace('#,.*$#', '', $id) : $id;
     if (is_null($catalogue_name)) {
         $tree = array();
         $catalogues = $GLOBALS['SITE_DB']->query_select('catalogues', array('c_name'));
         foreach ($catalogues as $catalogue) {
             $tree = array_merge($tree, get_catalogue_category_tree($catalogue['c_name'], is_null($id) ? NULL : intval($id), NULL, NULL, 1, $addable_filter, $compound_list));
         }
     } else {
         $tree = get_catalogue_category_tree($catalogue_name, is_null($id) ? NULL : intval($id), NULL, NULL, 1, $addable_filter, $compound_list);
     }
     if (!has_actual_page_access(NULL, 'catalogues')) {
         $tree = array();
     }
     $out = '';
     foreach ($tree as $t) {
         if ($compound_list) {
             $_id = $t['compound_list'];
         } else {
             $_id = strval($t['id']);
         }
         if ($stripped_id === strval($t['id'])) {
             continue;
         }
         // Possible when we look under as a root
         $title = $t['title'];
         $has_children = $t['child_count'] != 0;
         $selectable = $addable_filter !== true || $t['addable'];
         $tag = 'category';
         // category
         $out .= '<' . $tag . ' id="' . $_id . '" title="' . xmlentities($title) . '" has_children="' . ($has_children ? 'true' : 'false') . '" selectable="' . ($selectable ? 'true' : 'false') . '"></' . $tag . '>';
     }
     // Mark parent cats for pre-expansion
     if (!is_null($default) && $default != '') {
         $cat = intval($default);
         while (!is_null($cat)) {
             $out .= '<expand>' . strval($cat) . '</expand>';
             $cat = $GLOBALS['SITE_DB']->query_value_null_ok('catalogue_categories', 'cc_parent_id', array('id' => $cat));
         }
     }
     $tag = 'result';
     // result
     return '<' . $tag . '>' . $out . '</' . $tag . '>';
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:58,代码来源:choose_catalogue_category.php


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