本文整理汇总了PHP中reason_htmlspecialchars函数的典型用法代码示例。如果您正苦于以下问题:PHP reason_htmlspecialchars函数的具体用法?PHP reason_htmlspecialchars怎么用?PHP reason_htmlspecialchars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reason_htmlspecialchars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reason_media_work_display_name_handler
/**
* A display name handler for media works
*
* Includes a thumbnail of the work's placard image as part of the display name
*
* @param mixed $id Reason ID or entity
* @return string
*/
function reason_media_work_display_name_handler($id)
{
if (!is_object($id)) {
$e = new entity($id);
} else {
$e = $id;
}
if ($e->get_value('transcoding_status') == 'converting' || $e->get_value('transcoding_status') == 'finalizing') {
return '<img src="' . REASON_HTTP_BASE_PATH . 'ui_images/spinner_16.gif" width="16" height="16" alt="Converting" /> ' . $e->get_value('name');
}
if ($e->get_value('transcoding_status') == 'error') {
return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/error.png" width="16" height="16" alt="Error" /> ' . $e->get_value('name');
}
if ($e->get_value('transcoding_status') && ($images = $e->get_left_relationship('av_to_primary_image'))) {
$image = current($images);
if ($path = reason_get_image_path($image, 'thumbnail')) {
if (file_exists($path)) {
if ($size = getimagesize($path)) {
return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
}
}
}
}
switch ($e->get_value('av_type')) {
case 'Audio':
return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/sound.png" width="16" height="16" alt="Audio" /> ' . $e->get_value('name');
case 'Video':
return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/television.png" width="16" height="16" alt="Video" /> ' . $e->get_value('name');
default:
return $e->get_value('name');
}
}
示例2: init
function init($args = array())
{
if (isset($this->params['site_unique_name'])) {
$this->_search_site = new entity(id_of($this->params['site_unique_name']));
} else {
$this->_search_site = $this->parent->site_info;
}
$this->default_text = isset($this->params['default_text']) ? $this->params['default_text'] : 'Search ' . reason_htmlspecialchars(strip_tags($this->_search_site->get_value('name')));
$this->header_text = isset($this->params['header_text']) ? $this->params['header_text'] : '';
}
示例3: get_more_link_markup
function get_more_link_markup()
{
$item = $this->passed_vars['item'];
$markup_string = '';
if ($item->get_value('content') && isset($this->passed_vars['link_to_full_item']) && !empty($this->passed_vars['link_to_full_item'])) {
$markup_string .= '<li class="more">';
$markup_string .= '<a href="' . $this->passed_vars['link_to_full_item'] . '" title="' . reason_htmlspecialchars($item->get_value('release_title'), ENT_QUOTES, 'UTF-8') . '">';
$markup_string .= 'Full Story';
$markup_string .= '</a>';
$markup_string .= '</li>' . "\n";
}
return $markup_string;
}
示例4: social_account_on_every_time
/**
* Add / modify for elements
*/
function social_account_on_every_time($cm)
{
$cm->change_element_type('account_type', 'protected');
$cm->change_element_type('account_details', 'protected');
$cm->set_display_name('account_id', 'Instagram username');
$cm->add_required('account_id');
// lets add a field showing the current link if one is available.
$account_id = $cm->get_value('account_id');
if (!empty($account_id)) {
$link = 'http://instagram.com/' . $account_id . '/';
$comment_text = '<a href="' . reason_htmlspecialchars($link) . '">' . reason_htmlspecialchars($link) . '</a>';
$cm->add_element('account_link', 'commentWithLabel', array('text' => $comment_text));
}
}
示例5: init
function init($args = array())
{
parent::init($args);
// REASON_USES_DISTRIBUTED_AUDIENCE_MODEL
if (REASON_USES_DISTRIBUTED_AUDIENCE_MODEL) {
$es = new entity_selector($this->site_id);
} else {
$es = new entity_selector();
}
$es->add_type(id_of('audience_type'));
$this->all_audiences = $es->run_one();
$head =& $this->get_head_items();
$head->add_javascript('/reason_package/reason_4.0/www/js/policy_selector.js');
if (!$this->_in_show_all_mode()) {
if (!empty($this->request['policy_id'])) {
$roots = $this->get_root_nodes();
if (array_key_exists($this->request['policy_id'], $roots)) {
$this->policy = $roots[$this->request['policy_id']];
$this->_add_crumb($this->policy->get_value('name'), get_current_url());
$head_items = $this->get_head_items();
if ($this->policy->get_value('keywords')) {
$head_items->add_head_item('meta', array('name' => 'keywords', 'value' => reason_htmlspecialchars($this->policy->get_value('keywords'))));
}
if ($audience = $this->_get_current_audience()) {
$head_items->add_head_item('link', array('rel' => 'canonical', 'href' => $this->get_no_audience_link()));
}
if ($pages =& $this->get_page_nav()) {
$pages->make_current_page_a_link();
}
$access = $this->_get_access_result($this->policy);
if (false === $access) {
http_response_code(403);
} elseif (null === $access) {
http_response_code(401);
}
} else {
http_response_code(404);
}
}
}
// register the module for inline editing
$inline_edit =& get_reason_inline_editing($this->page_id);
$inline_edit->register_module($this, $this->user_can_inline_edit($this->policy));
if ($inline_edit->available_for_module($this)) {
$head->add_stylesheet(REASON_HTTP_BASE_PATH . 'css/policy/policy_editable.css', '', true);
}
}
示例6: reason_social_account_display_name_handler
/**
* A display name handler for social accounts
*
* Includes the social network's icon
*
* @param mixed $id Reason ID or entity
* @return string
*/
function reason_social_account_display_name_handler($id)
{
if (!is_object($id)) {
$e = new entity($id);
} else {
$e = $id;
}
if ($account_type = $e->get_value('account_type')) {
$helper = new ReasonSocialIntegrationHelper();
$integrator = $helper->get_integrator($account_type, 'SocialAccountProfileLinks');
if ($url = $integrator->get_profile_link_icon($e->id())) {
$integrators = $helper->get_available_integrators();
$alt = isset($integrators[$account_type]) ? $integrators[$account_type] : $account_type;
return '<img src="' . reason_htmlspecialchars($url) . '" alt="' . reason_htmlspecialchars($alt) . '" height="24" width="24" /> ' . $e->get_value('name');
}
}
return $e->get_value('name');
}
示例7: get_markup
function get_markup($events)
{
$ret = '<div id="eventsGalleryModule" class="bigList">' . "\n";
$ret .= '<ul class="events">' . "\n";
foreach ($events as $event) {
$ret .= '<li class="event">' . "\n";
$ret .= '<a href="' . reason_htmlspecialchars($event->get_url()) . '">' . "\n";
$ret .= '<span class="imageWrap">' . "\n";
if ($image = $event->get_image()) {
reason_include_once('classes/sized_image.php');
$rsi = new reasonSizedImage();
$rsi->set_id($image->id());
$rsi->set_width(280);
$rsi->set_height(200);
$url = $rsi->get_url();
$ret .= '<img src="' . htmlspecialchars($url) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" width="295" height="200" class="primaryImage" />' . "\n";
}
$ret .= '</span>' . "\n";
$ret .= '<span class="info">' . "\n";
$ret .= '<span class="meta">' . "\n";
$ret .= '<em class="currency">' . htmlspecialchars($event->temporal_phrase()) . '</em> / ';
$ret .= '<span class="dates">' . htmlspecialchars($event->date_range_phrase()) . '</span>' . "\n";
$ret .= '</span><br />' . "\n";
$ret .= '<span class="name">' . "\n";
$ret .= '<strong class="title">';
$ret .= $event->get_main_title($event);
if ($sub = $event->get_subtitle($event)) {
$ret .= ':';
}
$ret .= '</strong>';
if (!empty($sub)) {
$ret .= '<span class="subtitle">' . $sub . '</span>' . "\n";
}
$ret .= '</span>' . "\n";
$ret .= '</span>' . "\n";
$ret .= '</a>' . "\n";
$ret .= '</li>' . "\n";
}
$ret .= '</ul>' . "\n";
$ret .= '</div>' . "\n";
return $ret;
}
示例8: reason_feature_display_name_handler
/**
* A display name handler for features
*
* Includes a thumbnail of one of the feature's images as part of the display name
*
* @param mixed $id Reason ID or entity
* @return string
*/
function reason_feature_display_name_handler($id)
{
if (!is_object($id)) {
$e = new entity($id);
} else {
$e = $id;
}
if ($images = $e->get_left_relationship('feature_to_image')) {
$image = reset($images);
if ($path = reason_get_image_path($image, 'thumbnail')) {
if (file_exists($path)) {
if ($size = getimagesize($path)) {
return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
}
}
}
} elseif ($media = $e->get_left_relationship('feature_to_media_work')) {
$m = reset($media);
$images = $m->get_left_relationship('av_to_primary_image');
if (!empty($images)) {
$image = reset($images);
if ($path = reason_get_image_path($image, 'thumbnail')) {
if (file_exists($path)) {
if ($size = getimagesize($path)) {
return '<img src="' . htmlspecialchars(reason_get_image_url($image, 'thumbnail'), ENT_QUOTES) . '" width="' . round($size[0] / 2) . '" height="' . round($size[1] / 2) . '" alt="' . reason_htmlspecialchars(strip_tags($image->get_value('description'))) . '" /> ' . $e->get_value('name');
}
}
}
}
switch ($m->get_value('av_type')) {
case 'Audio':
return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/sound.png" width="16" height="16" alt="Audio" /> ' . $e->get_value('name');
case 'Video':
return '<img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/television.png" width="16" height="16" alt="Video" /> ' . $e->get_value('name');
}
}
return $e->get_value('name');
}
示例9: show_child_page
function show_child_page($child,$counter,$even_odd)
{
/* If the page has a link name, use that; otherwise, use its name */
$page_name = $this->get_page_name($child);
$title_attr = '';
if( $page_name != $child->get_value('name') )
{
$title_attr = ' title="'.reason_htmlspecialchars(strip_tags($child->get_value('name')),ENT_QUOTES).'"';
}
$page_name = strip_tags($page_name,'<span><strong><em>');
$link = $this->get_page_link($child);
$classes = array('number'.$counter, $even_odd);
$uname = '';
if($child->get_value( 'unique_name' ))
{
$classes[] = 'uname-'.reason_htmlspecialchars($child->get_value( 'unique_name' ));
}
if($child->get_value('url'))
{
$classes[] = 'jump';
}
echo '<li class="'.implode(' ',$classes).'">';
if($this->params['provide_az_links'] && array_key_exists($child->id(),$this->az))
{
echo '<a name="child_'.$this->az[$child->id()].'"></a>';
}
$image_markup = '';
if($this->params['provide_images'])
{
$image = $this->get_page_image($child->id());
if(!empty($image))
{
if($this->params['thumbnail_width'] != 0 or $this->params['thumbnail_height'] != 0)
{
$rsi = new reasonSizedImage();
if(!empty($rsi))
{
$rsi->set_id($image->id());
if($this->params['thumbnail_width'] != 0)
{
$rsi->set_width($this->params['thumbnail_width']);
}
if($this->params['thumbnail_height'] != 0)
{
$rsi->set_height($this->params['thumbnail_height']);
}
if($this->params['thumbnail_crop'] != '')
{
$rsi->set_crop_style($this->params['thumbnail_crop']);
}
if(!$this->params['html5'])
$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false, $link);
else
$image_markup = get_show_image_html($rsi, true, false, false, '' , '', false );
}
}
else
{
if(!$this->params['html5'])
$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false, $link );
else
$image_markup = get_show_image_html( $image->id(), true, false, false, '' , '', false );
}
}
if(!$this->params['html5'])
echo $image_markup;
}
if($this->params['description_part_of_link'])
{
$element = $this->params['html5'] ? 'h4' : 'strong';
echo '<a href="'.$link.'"'.$title_attr.'>';
if($this->params['html5'])
echo $image_markup;
echo '<'.$element.'>'.$page_name.'</'.$element.'>';
if(!$this->params['html5'])
echo '<br />';
if ( $child->get_value( 'description' ))
{
$element = $this->params['html5'] ? 'div' : 'span';
echo "\n".'<'.$element.' class="childDesc">'.$child->get_value( 'description' ).'</'.$element.'>';
}
echo '</a>';
}
else
{
echo '<h4><a href="'.$link.'"'.$title_attr.'>'.$page_name.'</a></h4>';
if ( $child->get_value( 'description' ))
{
echo "\n".'<div class="childDesc">'.$child->get_value( 'description' ).'</div>';
}
}
echo '</li>'."\n";
}
示例10: get_html_list_item
/**
* @return a string of html markup of a list item
* basically the markup for one feature
*/
function get_html_list_item($view_data)
{
$has_anchor = true;
if ($view_data['destination_url'] == null) {
$has_anchor = false;
}
$height = $this->_view_params['height'];
$anchor_start = '<span class="noLink">';
$image_anchor_start = '<span class="noLink">';
$anchor_end = '</span>';
$image_anchor_end = '</span>';
if ($has_anchor) {
$image_anchor_start = "<a href=\"" . $view_data['destination_url'] . "\" class=\"dest\">";
//style=\"height:".$height."px;\">";
$image_anchor_end = "</a>";
$anchor_start = "<a href=\"" . $view_data['destination_url'] . "\" class=\"dest\">";
$anchor_end = "</a>";
}
$media_str = "";
$type_str = "";
if ($view_data['current_object_type'] == 'img') {
$img_url = $view_data['feature_image_url'][$view_data['current_image_index']];
$img_alt = $view_data['feature_image_alt'][$view_data['current_image_index']];
if ($img_url != "none") {
$media_str = "<div class=\"featureImage\" >\n";
$media_str .= $image_anchor_start . "<img alt=\"" . reason_htmlspecialchars($img_alt) . "\" name=\"big_pic\" src=\"" . $img_url . "\" />" . $image_anchor_end . "\n";
$media_str .= "</div>";
}
$type_str = ' featureTypeImage';
} elseif ($view_data['current_object_type'] == 'av') {
$av_html = $view_data['feature_av_html'][$view_data['current_image_index']];
$img_url = $view_data['feature_av_img_url'][$view_data['current_image_index']];
$img_alt = $view_data['feature_av_img_alt'][$view_data['current_image_index']];
$img_id = "featureVideo-" . $view_data['id'];
$image_anchor_start = "<a href=\"#" . $img_id . "\" style=\"height:" . $height . "px;\" class=\"anchor\">\n";
$image_anchor_end = "</a>";
$text_anchor_start = "<a href=\"#" . $img_id . "\" class=\"anchor\">\n";
$text_anchor_end = '</a>';
if ($img_url != "none") {
$link = $has_anchor ? ' (' . $anchor_start . 'more' . $anchor_end . ')' : '';
$media_str = "<div class=\"featureImage\" >\n";
$media_str .= $image_anchor_start . "<img alt=\"" . reason_htmlspecialchars($img_alt) . "\" name=\"big_pic\" src=\"" . $img_url . "\" />" . $image_anchor_end . "\n";
$media_str .= "</div>";
$media_str .= "<div class=\"featureVideo nofitvids\" id=\"" . $img_id . "\" style=\"\">";
$media_str .= $av_html;
$media_str .= '<h3 class="featureTitle">' . $view_data['title'] . '</h3>' . "\n";
$media_str .= '<div class="featureText">' . $view_data['text'] . $link . '</div>' . "\n";
$media_str .= "</div>";
}
$type_str = ' featureTypeVideo';
}
$title_str = "";
$text_str = "";
if ($view_data['show_text']) {
if ($view_data['current_object_type'] == 'av') {
$title_str = "<h3 class=\"featureTitle\">" . $text_anchor_start . $view_data['title'] . $text_anchor_end . "</h3>\n";
$text_str = "<div class=\"featureText\">" . $text_anchor_start . $view_data['text'] . $text_anchor_end . "</div>\n";
} else {
$title_str = "<h3 class=\"featureTitle\">" . $anchor_start . $view_data['title'] . $anchor_end . "</h3>\n";
$text_str = "<div class=\"featureText\">" . $anchor_start . $view_data['text'] . $anchor_end . "</div>\n";
}
}
$str = "<li id=\"feature-" . $view_data['id'] . "\" class=\"feature " . $view_data['active'] . " sizable\"\n\t\t \t\tstyle=\"background-color:#" . $view_data['bg_color'] . ";\" >\n";
$str .= '<div class="featureContent' . $type_str . '">' . "\n";
$str .= $media_str;
$str .= "<div class=\"featureInfo\">";
$str .= $title_str;
$str .= $text_str;
$str .= $view_data['feature_nav_str'];
$str .= "</div>";
//end featureInfo div
$str .= "</div>\n";
//end featureContent div
$str .= "</li>\n";
return $str;
}
示例11: process
//.........这里部分代码省略.........
//tidy values
$no_tidy = array('state', 'new');
foreach ($values as $key => $val) {
if (!in_array($key, $no_tidy) && !empty($val)) {
$values[$key] = trim(get_safer_html(tidy($val)));
}
}
$id = reason_create_entity($site_id, id_of('image'), $this->user_id, $entry, $values);
if ($id) {
//assign to categories
$categories = $this->get_value('assign_to_categories');
if (!empty($categories)) {
foreach ($categories as $category_id) {
create_relationship($id, $category_id, relationship_id_of('image_to_category'));
}
}
//assign to gallery page
if ($page_id) {
create_relationship($page_id, $id, relationship_id_of('minisite_page_to_image'), array('rel_sort_order' => $sort_order_value));
}
// resize and move photos
$new_name = PHOTOSTOCK . $id . '.' . $type;
$orig_name = PHOTOSTOCK . $id . '_orig.' . $type;
$tn_name = PHOTOSTOCK . $id . '_tn.' . $type;
// Support for new fields; they should be set null by default, but will be
// changed below if a thumbnail/original image is created. This is very messy...
$thumbnail_image_type = null;
$original_image_type = null;
// atomic move the file if possible, copy if necessary
if (is_writable($cur_name)) {
rename($cur_name, $new_name);
} else {
copy($cur_name, $new_name);
}
// create a thumbnail if need be
list($width, $height, $type, $attr) = getimagesize($new_name);
if ($width > REASON_STANDARD_MAX_IMAGE_WIDTH || $height > REASON_STANDARD_MAX_IMAGE_HEIGHT) {
copy($new_name, $orig_name);
resize_image($new_name, REASON_STANDARD_MAX_IMAGE_WIDTH, REASON_STANDARD_MAX_IMAGE_HEIGHT);
$original_image_type = $this->image_types[$type];
}
$thumb_dimensions = get_reason_thumbnail_dimensions($site_id);
if ($width > $thumb_dimensions['width'] || $height > $thumb_dimensions['height']) {
copy($new_name, $tn_name);
resize_image($tn_name, $thumb_dimensions['width'], $thumb_dimensions['height']);
$thumbnail_image_type = $this->image_types[$type];
}
// real original
$my_orig_name = $this->add_name_suffix($cur_name, '-unscaled');
if (file_exists($my_orig_name)) {
// move the original image into the photostock directory
if (is_writable($my_orig_name)) {
rename($my_orig_name, $orig_name);
} else {
copy($my_orig_name, $orig_name);
}
$original_image_type = $this->image_types[$type];
}
$info = getimagesize($new_name);
$size = round(filesize($new_name) / 1024);
// now we have the size of the resized image.
$values = array('width' => $info[0], 'height' => $info[1], 'size' => $size, 'thumbnail_image_type' => $thumbnail_image_type, 'original_image_type' => $original_image_type);
// update with new info - don't archive since this is really just an extension of the creation of the item
// we needed that ID to do something
reason_update_entity($id, $this->user_id, $values, false);
$valid_file_html .= 'completed</li>';
} else {
trigger_error('Unable to create image entity');
$valid_file_html .= '<li>Unable to import ' . $entry . '</li>';
}
sleep(1);
}
$valid_file_html .= '</ul>' . "\n";
$num_image_string = count($this->files) == 1 ? '1 image has ' : count($this->files) . ' images have ';
$valid_file_html .= '<p>' . $num_image_string . 'been successfully imported into Reason.</p>';
$valid_file_html .= '<p>They are now pending.</p>';
$next_steps[] = '<a href="?site_id=' . $site_id . '&type_id=' . id_of('image') . '&user_id=' . $this->user_id . '&cur_module=Lister&state=pending">review & approve imported images</a>';
}
if (isset($this->invalid_files)) {
$invalid_files = array_keys($this->invalid_files);
$invalid_file_html = '<p>The following could not be validated as image files and were not successfully imported.</p>';
$invalid_file_html .= '<ul>';
foreach ($invalid_files as $file) {
$invalid_file_html .= '<li><strong>' . reason_htmlspecialchars($file) . '</strong></li>';
}
$invalid_file_html .= '</ul>';
}
$next_steps[] = '<a href="' . get_current_url() . '">Import another set of images</a>';
if (!isset($this->invalid_files) && !isset($this->files)) {
echo '<p>You did not select any files for upload</p>';
}
if (isset($valid_file_html)) {
echo $valid_file_html;
}
if (isset($invalid_file_html)) {
echo $invalid_file_html;
}
echo '<p>Next Steps:</p><ul><li>' . implode('</li><li>', $next_steps) . '</li></ul>';
$this->show_form = false;
}
示例12: render
public function render()
{
return reason_htmlspecialchars(strip_tags(array_reduce($this->tags, array('TitleTagParser', 'sub'), $this->pattern)));
}
示例13: run
function run()
{
$form = $this->get_form();
// thor_core needs the XML from the form entities thor_content field, and the table name the data is stored in
$xml = $form->get_value('thor_content');
$table_name = 'form_' . $form->id();
$thor_core = new ThorCore($xml, $table_name);
$thor_values = $thor_core->get_rows();
// Loop through the database information to gather the poll results
$pretty_values = array();
if ($thor_values != "") {
foreach ($thor_values as $t_v) {
foreach ($t_v as $key => $value) {
if ($key != "id" && $key != "submitted_by" && $key != "submitter_ip" && $key != "date_created" && $key != "date_modified") {
$pretty_values[] = $value;
}
}
}
}
// Get the total number of results and then find the total results for each option
$responses = array_count_values($pretty_values);
$accumulator = array();
foreach ($responses as $response) {
$accumulator[] = $response;
}
// Get the label for each option
$name = array();
foreach ($responses as $key => $value) {
$name[] = $key;
}
// Calculate the total and get the percentage for each option
$total = 0;
$per = array();
foreach ($accumulator as $key => $value) {
$total += $value;
}
if ($total > 0) {
for ($i = 0; $i <= count($accumulator) - 1; $i++) {
$per[$i] = round($accumulator[$i] / $total * 100) . "%";
}
}
if (!$this->show_results()) {
echo '<p><a href="' . carl_make_link(array('show_results' => 1, 'submission_key' => '')) . '">Show Results</a></p>';
} else {
echo '<p><a href="' . carl_make_link(array('show_results' => 0, 'submission_key' => '')) . '">Hide Results</a></p>';
}
if ($this->show_results()) {
if ($this->sidebar) {
echo '<div id="interactive" class="graph">';
} else {
echo '<div id="graph1" class="graph">';
}
for ($i = 0; $i <= count($accumulator) - 1; $i++) {
echo '<table width="300px" border="solid" cellpadding="5px">
<tr>
<td width="50px">' . reason_htmlspecialchars($per[$i]) . ' </td><td> ' . reason_htmlspecialchars($name[$i]) . '</td>
</tr>
</table>';
}
echo '</div>';
if ($this->sidebar) {
echo '<div id="hover"></div>';
}
echo '<div id="responses"><p><strong>Total responses: ' . $total . '</strong></p></div>';
}
$datas = array();
$lbls = array();
for ($i = 0; $i <= count($accumulator) - 1; $i++) {
$datas[$i] = $accumulator[$i];
$lbls[$i] = $name[$i];
}
// Transfer the labels and totals for each option to polls.js
echo '<script type="text/javascript">' . "\n";
echo 'var data = new Array();' . "\n";
echo 'var lbl = new Array();' . "\n";
echo 'var color = new Array();' . "\n";
for ($i = 0; $i <= count($datas) - 1; $i++) {
$color = isset($this->params['custom_colors'][$i]) ? $this->params['custom_colors'][$i] : "#" . dechex(rand(0, 10000000));
echo 'color[' . $i . '] = "' . addslashes(htmlspecialchars($color)) . '" ;' . "\n";
echo 'data[' . $i . '] =' . addslashes(htmlspecialchars($datas[$i])) . ';' . "\n";
echo 'lbl[' . $i . '] = "' . addslashes(htmlspecialchars($lbls[$i])) . '" ;' . "\n";
}
echo '</script>' . "\n";
}
示例14: get_sanitized_search_string
function get_sanitized_search_string()
{
if(!empty($this->request['search']))
{
return reason_htmlspecialchars($this->request['search']);
}
else
return '';
}
示例15: get_html_markup
/**
* Returns the html markup to display the media with share/download info.
* @return string
*/
public function get_html_markup()
{
$markup = '';
if ($this->media_work->get_value('transcoding_status') == 'ready') {
if (!empty($this->request['displayer_height'])) {
$height = $this->request['displayer_height'];
} else {
$height = $this->av_module->params['default_video_height'];
}
$this->displayer->set_height($height);
$embed_markup = $this->displayer->get_display_markup();
$markup .= $embed_markup;
$mwh = new media_work_helper($this->media_work);
if ($mwh->user_has_access_to_media()) {
if ($this->media_work->get_value('av_type') == 'Video') {
$markup .= $this->size_selector->get_size_selector_html($this->media_work, $height);
}
$markup .= '<div class="share_download_info">' . "\n";
$markup .= '<div class="share">' . "\n";
$markup .= '<h5 class="share_label">Share:</h5>' . "\n";
$markup .= '<ul class="share_list">' . "\n";
$facebook_url = 'http://www.facebook.com/sharer.php?u=' . urlencode(get_current_url()) . '&t=' . urlencode($this->media_work->get_value('name'));
$markup .= '<li><a href="' . $facebook_url . '">Facebook</a></li>' . "\n";
$twitter_url = 'https://twitter.com/share?url=' . urlencode(get_current_url()) . '&text=' . urlencode($this->media_work->get_value('name'));
$markup .= '<li><a href="' . $twitter_url . '">Twitter</a></li>' . "\n";
$markup .= '</ul>' . "\n";
$markup .= '</div>' . "\n";
if ($this->media_work->get_value('show_embed')) {
$markup .= '<div class="embed">' . "\n";
$markup .= '<h5 class="embed_label">Embed:</h5>' . "\n";
$markup .= '<textarea class="embed_code" rows="7" cols="75" readonly="readonly">' . "\n";
$markup .= htmlspecialchars($embed_markup, ENT_QUOTES);
$markup .= '</textarea>' . "\n";
$markup .= '</div>' . "\n";
}
if ($this->media_work->get_value('show_download')) {
$markup .= '<div class="download">' . "\n";
$markup .= '<h5 class="download_label">Download:</h5>' . "\n";
$markup .= '<ul class="media_file_list">' . "\n";
// Offer an original file download link if this parameter is set
if ($this->av_module->params['offer_original_download_link'] && !empty($this->shim)) {
$file_ext = $this->shim->get_source_file_extension($this->media_work);
if ($orig_url = $this->shim->get_original_data_url($this->media_work->get_value('entry_id'))) {
$markup .= '<li class="orig_li"><a href="' . $orig_url . '"">original (.' . $file_ext . ')</a></li>' . "\n";
}
}
if ($this->media_work->get_value('av_type') == 'Video') {
// We must provide the url for each size here so that the javascript has a hook for the download links.
$mp4_vals = array();
$webm_vals = array();
$small_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_SMALL_HEIGHT, MEDIA_WORK_SMALL_HEIGHT);
$small_mp4 = $small_av_files[0];
$mp4_vals['small'] = $small_mp4->get_value('download_url');
$small_webm = $small_av_files[1];
$webm_vals['small'] = $small_webm->get_value('download_url');
$medium_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_MEDIUM_HEIGHT, MEDIA_WORK_MEDIUM_HEIGHT);
$med_mp4 = $medium_av_files[0];
$mp4_vals['medium'] = $med_mp4->get_value('download_url');
$med_webm = $medium_av_files[1];
$webm_vals['medium'] = $med_webm->get_value('download_url');
$large_av_files = $this->displayer->_get_suitable_flavors(MEDIA_WORK_LARGE_HEIGHT, MEDIA_WORK_LARGE_HEIGHT);
$large_mp4 = $large_av_files[0];
$mp4_vals['large'] = $large_mp4->get_value('download_url');
$large_webm = $large_av_files[1];
$webm_vals['large'] = $large_webm->get_value('download_url');
$av_files = $this->displayer->get_media_files();
$markup .= '<li class="mp4_li"><a href="' . $av_files[0]->get_value('download_url') . '"
data-small-url="' . $mp4_vals['small'] . '"
data-medium-url="' . $mp4_vals['medium'] . '"
data-large-url="' . $mp4_vals['large'] . '">.mp4</a></li>' . "\n";
$markup .= '<li class="webm_li"><a href="' . $av_files[1]->get_value('download_url') . '"
data-small-url="' . $webm_vals['small'] . '"
data-medium-url="' . $webm_vals['medium'] . '"
data-large-url="' . $webm_vals['large'] . '">.webm</a></li>' . "\n";
} elseif ($this->media_work->get_value('av_type') == 'Audio') {
$av_files = $this->displayer->get_media_files();
foreach ($av_files as $file) {
$extension = $file->get_value('mime_type');
// people know what mp3 is, not mpeg, so we display mpegs as mp3s
if ($extension == 'audio/mpeg') {
$extension = 'audio/mp3';
}
$parts = explode('/', $extension);
$markup .= '<li class="' . reason_htmlspecialchars(str_replace(' ', '-', end($parts))) . '_li"><a href="' . $file->get_value('download_url') . '">.' . end($parts) . '</a></li>' . "\n";
}
}
$markup .= '</ul>' . "\n";
$markup .= '</div>' . "\n";
}
$markup .= '</div>' . "\n";
}
} else {
if ($this->media_work->get_value('av_type') == 'Video') {
$markup .= '<p>This video is currently processing. Try again later.</p>' . "\n";
} elseif ($this->media_work->get_value('av_type') == 'Audio') {
$markup .= '<p>This audio file is currently processing. Try again later.</p>' . "\n";
//.........这里部分代码省略.........