本文整理汇总了PHP中create_xml_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP create_xml_tag函数的具体用法?PHP create_xml_tag怎么用?PHP create_xml_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_xml_tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_goodlayers_panel
function save_goodlayers_panel()
{
check_ajax_referer(plugin_basename(__FILE__), 'security');
global $goodlayers_element;
foreach ($goodlayers_element as $elements) {
foreach ($elements as $element) {
// when save sidebar
if ($element['type'] == 'sidebar') {
$sidebar_xml = '<sidebar>';
$sidebar = $_POST[$element['name']];
foreach ($sidebar as $sidebar_name) {
$sidebar_xml = $sidebar_xml . create_xml_tag('name', $sidebar_name);
}
$sidebar_xml = $sidebar_xml . '</sidebar>';
if (!save_option($element['name'], get_option($element['name']), $sidebar_xml)) {
die('-1');
}
// when save uploaded font
} else {
if ($element['type'] == 'uploadfont') {
$uploadfont_xml = '<uploadfont>';
$uploadfont = $_POST[$element['name']];
$uploadfont_file = $_POST[$element['file']];
$num = sizeof($uploadfont);
for ($i = 0; $i < $num; $i++) {
$uploadfont_xml = $uploadfont_xml . '<font>';
$uploadfont_xml = $uploadfont_xml . create_xml_tag('name', $uploadfont[$i]);
$uploadfont_xml = $uploadfont_xml . create_xml_tag('file', $uploadfont_file[$i]);
$uploadfont_xml = $uploadfont_xml . '</font>';
}
$uploadfont_xml = $uploadfont_xml . '</uploadfont>';
if (!save_option($element['name'], get_option($element['name']), $uploadfont_xml)) {
die('-1');
}
// do nothing with dummy button
} else {
if ($element['type'] == 'dummy') {
} else {
$new_option_value = str_replace("\\'", "'", $_POST[$element['name']]);
$new_option_value = str_replace('\\"', '"', $new_option_value);
$new_option_value = str_replace('\\\\', '\\', $new_option_value);
if (!save_option($element['name'], get_option($element['name']), $new_option_value)) {
die('-1');
}
}
}
}
}
}
die('0');
}
示例2: save_post_option_meta
function save_post_option_meta($post_id)
{
global $post_meta_boxes;
$edit_meta_boxes = $post_meta_boxes;
// save
foreach ($edit_meta_boxes as $edit_meta_box) {
if ($edit_meta_box['type'] != 'header' && $edit_meta_box['type'] != 'text' && $edit_meta_box['type'] != 'open' && $edit_meta_box['type'] != 'close') {
// save function for slider
if ($edit_meta_box['type'] == 'imagepicker') {
if (isset($_POST[$edit_meta_box['name']['image']])) {
$num = sizeof($_POST[$edit_meta_box['name']['image']]) - 1;
} else {
$num = -1;
}
$slider_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
$slider_xml = "<slider-item>";
for ($i = 0; $i <= $num; $i++) {
$slider_xml = $slider_xml . "<slider>";
$image_new = stripslashes($_POST[$edit_meta_box['name']['image']][$i]);
$slider_xml = $slider_xml . create_xml_tag('image', $image_new);
$title_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['title']][$i]));
$slider_xml = $slider_xml . create_xml_tag('title', $title_new);
$caption_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['caption']][$i]));
$slider_xml = $slider_xml . create_xml_tag('caption', $caption_new);
$linktype_new = stripslashes($_POST[$edit_meta_box['name']['linktype']][$i]);
$slider_xml = $slider_xml . create_xml_tag('linktype', $linktype_new);
$link_new = stripslashes(htmlspecialchars($_POST[$edit_meta_box['name']['link']][$i]));
$slider_xml = $slider_xml . create_xml_tag('link', $link_new);
$slider_xml = $slider_xml . "</slider>";
}
$slider_xml = $slider_xml . "</slider-item>";
save_meta_data($post_id, $slider_xml, $slider_xml_old, $edit_meta_box['xml']);
} else {
if (isset($_POST[$edit_meta_box['name']])) {
$new_data = stripslashes($_POST[$edit_meta_box['name']]);
} else {
$new_data = '';
}
$old_data = get_post_meta($post_id, $edit_meta_box['name'], true);
save_meta_data($post_id, $new_data, $old_data, $edit_meta_box['name']);
}
}
}
}
示例3: slider_settings
function slider_settings()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
?>
<div class="cp-wrapper bootstrap_admin cp-margin-left">
<!--content area start -->
<div class="hbg top_navigation row-fluid">
<div class="cp-logo span2">
<img src="<?php
echo CP_PATH_URL;
?>
/framework/images/logo.png" class="logo" />
</div>
<div class="sidebar span10">
<?php
echo top_navigation_html_tooltip();
?>
</div>
<?php
//echo top_navigation_html();
?>
</div>
<div class="content-area-main row-fluid">
<!--sidebar start -->
<div class="sidebar-wraper span2">
<div class="sidebar-sublinks">
<ul id="wp_t_o_right_menu">
<li class="slide_settings" id="active_tab"><?php
_e('Slider Settings', 'crunchpress');
?>
</li>
</ul>
</div>
</div>
<!--sidebar end -->
<!--content start -->
<div class="content-area span10">
<?php
//echo top_navigation_html();
?>
<form id="options-panel-form" name="cp-panel-form">
<div class="panel-elements" id="panel-elements">
<div class="panel-element" id="panel-element-save-complete">
<div class="panel-element-save-text">
<?php
_e('Save Options Complete', 'crunchpress');
?>
.</div>
<div class="panel-element-save-arrow"></div>
</div>
<div class="panel-element">
<?php
if (isset($action) and $action == 'slider_settings') {
$slider_settings_xml = '<slider_settings>';
$slider_settings_xml = $slider_settings_xml . create_xml_tag('select_slider', $select_slider);
// $slider_settings_xml = $slider_settings_xml . '<flex_slider_settings>';
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('animation_type_flex',$animation_type_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('reverse_order_flex',$reverse_order_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('startat_flex_slider',$startat_flex_slider);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('auto_play_flex',$auto_play_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('animation_speed_flex',$animation_speed_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('pause_on_flex',$pause_on_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('navigation_on_flex',$navigation_on_flex);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('arrow_on_flex',$arrow_on_flex);
// $slider_settings_xml = $slider_settings_xml . '</flex_slider_settings>';
// $slider_settings_xml = $slider_settings_xml . '<anything_slider_settings>';
//$slider_settings_xml = $slider_settings_xml . create_xml_tag('slide_mod_anything',$slide_mod_anything);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('auto_play_anything',$auto_play_anything);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('pause_on_anything',$pause_on_anything);
// $slider_settings_xml = $slider_settings_xml . create_xml_tag('animation_speed_anything',$animation_speed_anything);
// $slider_settings_xml = $slider_settings_xml . '</anything_slider_settings>';
$slider_settings_xml = $slider_settings_xml . '<bx_slider_settings>';
$slider_settings_xml = $slider_settings_xml . create_xml_tag('slide_order_bx', $slide_order_bx);
$slider_settings_xml = $slider_settings_xml . create_xml_tag('auto_play_bx', $auto_play_bx);
$slider_settings_xml = $slider_settings_xml . create_xml_tag('pause_on_bx', $pause_on_bx);
$slider_settings_xml = $slider_settings_xml . create_xml_tag('animation_speed_bx', $animation_speed_bx);
$slider_settings_xml = $slider_settings_xml . create_xml_tag('show_bullets', $show_bullets);
$slider_settings_xml = $slider_settings_xml . create_xml_tag('show_arrow', $show_arrow);
$slider_settings_xml = $slider_settings_xml . '</bx_slider_settings>';
$slider_settings_xml = $slider_settings_xml . '</slider_settings>';
if (!save_option('slider_settings', get_option('slider_settings'), $slider_settings_xml)) {
die(json_encode($return_data));
}
die(json_encode(array('success' => '0')));
}
$select_slider = '';
//Flex slider
$animation_type_flex = '';
$reverse_order_flex = '';
$startat_flex_slider = '';
$auto_play_flex = '';
$animation_speed_flex = '';
$pause_on_flex = '';
$navigation_on_flex = '';
//.........这里部分代码省略.........
示例4: save_fields
/**
* Loops through and saves field data
* @since 1.0.0
* @param array $meta_box Metabox config array
* @param int $object_id Object ID
* @param string $object_type Type of object being saved. (e.g., post, user, or comment)
*/
public static function save_fields($meta_box, $object_id, $object_type = '')
{
$meta_box = self::set_mb_defaults($meta_box);
$meta_box['show_on'] = empty($meta_box['show_on']) ? array('key' => false, 'value' => false) : $meta_box['show_on'];
self::set_object_id($object_id);
// Set/get type
$object_type = self::set_object_type($object_type ? $object_type : self::set_mb_type($meta_box));
if (!apply_filters('cmb_show_on', true, $meta_box)) {
return;
}
// save field ids of those that are updated
self::$updated = array();
foreach ($meta_box['fields'] as $field_args) {
if ('group' == $field_args['type']) {
self::save_group($field_args);
} elseif ('media_picker' == $field_args['type']) {
// Save XML field
if (isset($_POST[$field_args['xml_name']['image']])) {
$num = sizeof($_POST[$field_args['xml_name']['image']]) - 1;
} else {
$num = -1;
}
$slider_xml = "<slide-set>";
for ($i = 0; $i <= $num; $i++) {
$slider_xml = $slider_xml . "<slide>";
$image = stripslashes($_POST[$field_args['xml_name']['image']][$i]);
$slider_xml = $slider_xml . create_xml_tag('image', $image);
$image_url = stripslashes($_POST[$field_args['xml_name']['image_url']][$i]);
$slider_xml = $slider_xml . create_xml_tag('image_url', $image_url);
$link_url = stripslashes($_POST[$field_args['xml_name']['link_url']][$i]);
$slider_xml = $slider_xml . create_xml_tag('link_url', $link_url);
$title = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['title']][$i]));
$slider_xml = $slider_xml . create_xml_tag('title', $title);
$description = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['description']][$i]));
$slider_xml = $slider_xml . create_xml_tag('description', $description);
$media_url = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['media_url']][$i]));
$slider_xml = $slider_xml . create_xml_tag('media_url', $media_url);
$embed_type = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['embed_type']][$i]));
$slider_xml = $slider_xml . create_xml_tag('embed_type', $embed_type);
$timeout = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['timeout']][$i]));
$slider_xml = $slider_xml . create_xml_tag('timeout', $timeout);
$autoplay = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['autoplay']][$i]));
$slider_xml = $slider_xml . create_xml_tag('autoplay', $autoplay);
$stage_content = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['stage_content']][$i]));
$slider_xml = $slider_xml . create_xml_tag('stage_content', $stage_content);
$title_overlay = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['title_overlay']][$i]));
$slider_xml = $slider_xml . create_xml_tag('title_overlay', $title_overlay);
$gallery3d_pieces = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_pieces']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_pieces', $gallery3d_pieces);
$gallery3d_depthoffset = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_depthoffset']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_depthoffset', $gallery3d_depthoffset);
$gallery3d_cubedist = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_cubedist']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_cubedist', $gallery3d_cubedist);
$gallery3d_tween = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_tween']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_tween', $gallery3d_tween);
$gallery3d_transtime = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_transtime']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_transtime', $gallery3d_transtime);
$gallery3d_seconds = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['gallery3d_seconds']][$i]));
$slider_xml = $slider_xml . create_xml_tag('gallery3d_seconds', $gallery3d_seconds);
$css_classes = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['css_classes']][$i]));
$slider_xml = $slider_xml . create_xml_tag('css_classes', $css_classes);
$filter_tags = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['filter_tags']][$i]));
$slider_xml = $slider_xml . create_xml_tag('filter_tags', $filter_tags);
$readmore_link = stripslashes(htmlspecialchars($_POST[$field_args['xml_name']['readmore_link']][$i]));
$slider_xml = $slider_xml . create_xml_tag('readmore_link', $readmore_link);
$slider_xml = $slider_xml . "</slide>";
}
global $post;
$old = get_post_meta($post->ID, $field_args['xml'], true);
$new = $slider_xml . "</slide-set>";
if ($new && $new != $old) {
update_post_meta($post->ID, $field_args['xml'], $new);
} elseif ('' == $new && $old) {
delete_post_meta($post->ID, $field_args['xml'], $old);
}
// Save default fields
$field = new cmb_Meta_Box_field($field_args);
self::save_field(self::sanitize_field($field), $field);
} else {
// Save default fields
$field = new cmb_Meta_Box_field($field_args);
self::save_field(self::sanitize_field($field), $field);
}
}
// If options page, save the updated options
if ($object_type == 'options-page') {
self::save_option($object_id);
}
do_action("cmb_save_{$object_type}_fields", $object_id, $meta_box['id'], self::$updated, $meta_box);
}
示例5: save_page_option_meta
function save_page_option_meta($post_id)
{
global $page_meta_boxes;
$edit_meta_boxes = $page_meta_boxes;
foreach ($edit_meta_boxes as $edit_meta_box) {
if ($edit_meta_box['type'] == 'page-option-item') {
if (isset($_POST[$edit_meta_box['size']])) {
$num = sizeof($_POST[$edit_meta_box['size']]);
} else {
$num = 0;
}
$item_xml = '<item-tag>';
$item_content_num = array();
for ($i = 0; $i < $num; $i++) {
$item_type_new = $_POST[$edit_meta_box['item']][$i];
$item_xml = $item_xml . '<' . $item_type_new . '>';
$item_size_new = $_POST[$edit_meta_box['size']][$i];
$item_xml = $item_xml . create_xml_tag('size', $item_size_new);
$item_content = $edit_meta_box['name'][$item_type_new];
if (!isset($item_content_num[$item_type_new])) {
$item_content_num[$item_type_new] = 1;
if ($item_type_new == 'Slider') {
$item_content_num['slider-item'] = 0;
} else {
if ($item_type_new == 'Accordion') {
$item_content_num['accordion-item'] = 0;
} else {
if ($item_type_new == 'Tab') {
$item_content_num['tab-item'] = 0;
} else {
if ($item_type_new == 'Toggle-Box') {
$item_content_num['toggle-box-item'] = 0;
}
}
}
}
}
foreach ($item_content as $key => $value) {
if ($key == 'slider-item') {
$item_xml = $item_xml . '<' . $key . '>';
$slider_num = $_POST[$value['slider-num']][$item_content_num[$item_type_new]];
for ($j = 0; $j < $slider_num; $j++) {
$item_xml = $item_xml . '<slider>';
$temp = isset($_POST[$value['image']][$item_content_num['slider-item']]) ? $_POST[$value['image']][$item_content_num['slider-item']] : '';
$item_xml = $item_xml . create_xml_tag('image', $temp);
$temp = isset($_POST[$value['title']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['title']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('title', $temp);
$temp = isset($_POST[$value['linktype']][$item_content_num['slider-item']]) ? $_POST[$value['linktype']][$item_content_num['slider-item']] : '';
$item_xml = $item_xml . create_xml_tag('linktype', $temp);
$temp = isset($_POST[$value['link']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['link']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('link', $temp);
$temp = isset($_POST[$value['caption']][$item_content_num['slider-item']]) ? htmlspecialchars($_POST[$value['caption']][$item_content_num['slider-item']]) : '';
$item_xml = $item_xml . create_xml_tag('caption', $temp);
$item_xml = $item_xml . '</slider>';
$item_content_num['slider-item']++;
}
$item_xml = $item_xml . '</' . $key . '>';
} else {
if ($key == "tab-item") {
$item_xml = $item_xml . '<' . $key . '>';
if ($item_type_new == "Accordion") {
$tab_type = 'accordion-item';
} else {
if ($item_type_new == "Toggle-Box") {
$tab_type = 'toggle-box-item';
} else {
$tab_type = 'tab-item';
}
}
$tab_num = $_POST[$value['tab-num']][$item_content_num[$item_type_new]];
for ($j = 0; $j < $tab_num; $j++) {
$item_xml = $item_xml . '<tab>';
$temp = isset($_POST[$value['title']][$item_content_num[$tab_type]]) ? htmlspecialchars($_POST[$value['title']][$item_content_num[$tab_type]]) : '';
$item_xml = $item_xml . create_xml_tag('title', $temp);
$temp = isset($_POST[$value['caption']][$item_content_num[$tab_type]]) ? htmlspecialchars($_POST[$value['caption']][$item_content_num[$tab_type]]) : '';
$item_xml = $item_xml . create_xml_tag('caption', $temp);
$temp = isset($_POST[$value['active']][$item_content_num[$tab_type]]) ? $_POST[$value['active']][$item_content_num[$tab_type]] : '';
$item_xml = $item_xml . create_xml_tag('active', $temp);
$item_xml = $item_xml . '</tab>';
$item_content_num[$tab_type]++;
}
$item_xml = $item_xml . '</' . $key . '>';
} else {
if (isset($_POST[$value['name']][$item_content_num[$item_type_new]])) {
$item_value = htmlspecialchars($_POST[$value['name']][$item_content_num[$item_type_new]]);
$item_xml = $item_xml . create_xml_tag($key, $item_value);
} else {
$item_xml = $item_xml . create_xml_tag($key, '');
}
}
}
}
$item_xml = $item_xml . '</' . $item_type_new . '>';
$item_content_num[$item_type_new]++;
}
$item_xml = $item_xml . '</item-tag>';
$item_xml_old = get_post_meta($post_id, $edit_meta_box['xml'], true);
save_meta_data($post_id, $item_xml, $item_xml_old, $edit_meta_box['xml']);
} else {
if ($edit_meta_box['type'] == 'imagepicker') {
//.........这里部分代码省略.........
示例6: print_item_size
echo print_item_size('element1-1', "mt0 top-layer-slider-wrapper");
echo '<div class="slider-wrapper fullwidth" >';
echo do_shortcode('[layerslider id="' . $layer_slider_id . '"]');
echo "<div class='slider-top-shadow slider-gimmick'></div>";
echo "<div class='slider-bottom-shadow slider-gimmick'></div>";
echo "<div class='slider-bottom-gimmick slider-gimmick'></div>";
echo '</div>';
echo '</div>';
// slider-wrapper
} else {
if ($gdl_top_slider_type != "No Slider" && $gdl_top_slider_type != '') {
echo print_item_size('element1-1', "mt0");
$slider_xml = "<Slider>" . create_xml_tag('size', 'full-width');
$slider_xml = $slider_xml . create_xml_tag('height', get_post_meta($post->ID, 'page-option-top-slider-height', true));
$slider_xml = $slider_xml . create_xml_tag('width', 980);
$slider_xml = $slider_xml . create_xml_tag('slider-type', $gdl_top_slider_type);
$slider_xml = $slider_xml . $gdl_top_slider_xml;
$slider_xml = $slider_xml . "</Slider>";
$slider_xml_dom = new DOMDocument();
$slider_xml_dom->loadXML($slider_xml);
print_slider_item($slider_xml_dom->documentElement);
echo "</div>";
}
}
$left_sidebar = get_post_meta($post->ID, "page-option-choose-left-sidebar", true);
$right_sidebar = get_post_meta($post->ID, "page-option-choose-right-sidebar", true);
echo "<div class='gdl-page-float-left'>";
echo "<div class='gdl-page-item'>";
// Page title and content
$gdl_show_title = get_post_meta($post->ID, 'page-option-show-title', true);
$gdl_show_content = get_post_meta($post->ID, 'page-option-show-content', true);
示例7: print_post_slider_item
function print_post_slider_item($item_xml)
{
$num_fetch = find_xml_value($item_xml, 'num-fetch');
$num_excerpt = find_xml_value($item_xml, 'num-excerpt');
$show_caption = find_xml_value($item_xml, 'show-caption');
$category = find_xml_value($item_xml, 'category', false);
$category = $category == 'All' ? '' : $category;
if (!empty($category)) {
$category_term = get_term_by('name', $category, 'category');
$category = $category_term->slug;
}
$postslider_xml = "<single-item><Post-Slider>";
$postslider_xml = $postslider_xml . create_xml_tag('size', find_xml_value($item_xml, 'size'));
$postslider_xml = $postslider_xml . create_xml_tag('width', find_xml_value($item_xml, 'width'));
$postslider_xml = $postslider_xml . create_xml_tag('height', find_xml_value($item_xml, 'height'));
$postslider_xml = $postslider_xml . create_xml_tag('slider-type', find_xml_value($item_xml, 'slider-type'));
$postslider_xml = $postslider_xml . "<slider-item>";
query_posts(array('post_type' => 'post', 'category_name' => $category, 'posts_per_page' => $num_fetch));
while (have_posts()) {
the_post();
$postslider_xml = $postslider_xml . "<slider>";
$postslider_xml = $postslider_xml . create_xml_tag('image', get_post_thumbnail_id(get_the_ID()));
$postslider_xml = $postslider_xml . create_xml_tag('linktype', 'Link to URL');
$postslider_xml = $postslider_xml . create_xml_tag('link', htmlspecialchars(get_permalink()));
if ($show_caption == "Yes") {
$postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()));
$postslider_xml = $postslider_xml . create_xml_tag('caption', htmlspecialchars(substr(get_the_excerpt(), 0, $num_excerpt)));
}
$postslider_xml = $postslider_xml . "</slider>";
}
$postslider_xml = $postslider_xml . "</slider-item>";
$postslider_xml = $postslider_xml . "</Post-Slider></single-item>";
$slider_xml_val = new DOMDocument();
$slider_xml_val->loadXML($postslider_xml);
foreach ($slider_xml_val->documentElement->childNodes as $slider_item_xml) {
print_slider_item($slider_item_xml);
}
wp_reset_query();
}
示例8: homepage_settings
function homepage_settings()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
?>
<?php
if (isset($action) and $action == 'homepage_settings') {
$homepage_xml = '<homepage_settings>';
$homepage_xml = $homepage_xml . create_xml_tag('homepage_newsline_on', $homepage_newsline_on);
$homepage_xml = $homepage_xml . create_xml_tag('header_headline', htmlspecialchars(stripslashes($header_headline)));
$homepage_xml = $homepage_xml . create_xml_tag('section_headline_category', $section_headline_category);
$homepage_xml = $homepage_xml . create_xml_tag('homepage_twitter_on', $homepage_twitter_on);
$homepage_xml = $homepage_xml . create_xml_tag('header_twitter', htmlspecialchars(stripslashes($header_twitter)));
$homepage_xml = $homepage_xml . create_xml_tag('consumer_key', $consumer_key);
$homepage_xml = $homepage_xml . create_xml_tag('consumer_secret', $consumer_secret);
$homepage_xml = $homepage_xml . create_xml_tag('user_token', $user_token);
$homepage_xml = $homepage_xml . create_xml_tag('user_secret', $user_secret);
$homepage_xml = $homepage_xml . create_xml_tag('twitter_id', htmlspecialchars(stripslashes($twitter_id)));
$homepage_xml = $homepage_xml . create_xml_tag('homepage_layout_on', $homepage_layout_on);
// $homepage_xml = $homepage_xml . create_xml_tag('section_select_background',$section_select_background);
// $homepage_xml = $homepage_xml . create_xml_tag('section_scheme',$section_scheme);
// $homepage_xml = $homepage_xml . create_xml_tag('section_patren',$section_patren);
// $homepage_xml = $homepage_xml . create_xml_tag('section_body_patren',$section_body_patren);
$homepage_xml = $homepage_xml . create_xml_tag('footer_sec_title', htmlspecialchars(stripslashes($footer_sec_title)));
$homepage_xml = $homepage_xml . create_xml_tag('home_page_layout', $home_page_layout);
$homepage_xml = $homepage_xml . '</homepage_settings>';
if (!save_option('homepage_settings', get_option('homepage_settings'), $homepage_xml)) {
die(json_encode($return_data));
}
die(json_encode(array('success' => '0')));
}
$homepage_newsline_on = '';
$header_headline = '';
$section_headline_category = '';
$homepage_twitter_on = '';
$header_twitter = '';
$consumer_key = '';
$consumer_secret = '';
$user_token = '';
$user_secret = '';
$twitter_id = '';
$homepage_on = '';
$homepage_layout_on = '';
// $section_select_background = '';
// $section_scheme = '';
// $section_patren = '';
// $section_body_patren = '';
$footer_sec_title = '';
$home_page_layout = '';
$cp_typography_settings = get_option('homepage_settings');
if ($cp_typography_settings != '') {
$cp_typo = new DOMDocument();
$cp_typo->loadXML($cp_typography_settings);
$homepage_newsline_on = find_xml_value($cp_typo->documentElement, 'homepage_newsline_on');
$header_headline = find_xml_value($cp_typo->documentElement, 'header_headline');
$section_headline_category = find_xml_value($cp_typo->documentElement, 'section_headline_category');
$homepage_twitter_on = find_xml_value($cp_typo->documentElement, 'homepage_twitter_on');
$header_twitter = find_xml_value($cp_typo->documentElement, 'header_twitter');
$consumer_key = find_xml_value($cp_typo->documentElement, 'consumer_key');
$consumer_secret = find_xml_value($cp_typo->documentElement, 'consumer_secret');
$user_token = find_xml_value($cp_typo->documentElement, 'user_token');
$user_secret = find_xml_value($cp_typo->documentElement, 'user_secret');
$twitter_id = find_xml_value($cp_typo->documentElement, 'twitter_id');
$homepage_layout_on = find_xml_value($cp_typo->documentElement, 'homepage_layout_on');
// $section_select_background = find_xml_value($cp_typo->documentElement,'section_select_background');
// $section_scheme = find_xml_value($cp_typo->documentElement,'section_scheme');
// $section_patren = find_xml_value($cp_typo->documentElement,'section_patren');
// $section_body_patren = find_xml_value($cp_typo->documentElement,'section_body_patren');
$footer_sec_title = find_xml_value($cp_typo->documentElement, 'footer_sec_title');
$home_page_layout = find_xml_value($cp_typo->documentElement, 'home_page_layout');
}
?>
<div id="wrapper_backend cp-margin-left">
<div id="header_theme_options"> <span id="backend_logo"> <h1> <a href="#"><h3> <?php
_e('CrunchPress Framework', 'crunchpress');
?>
</h3>
</a> </h1> </span>
</div>
<div class="wrapper_1">
<?php
echo top_navigation_html();
?>
</div>
<div class="below_wrapper tabs">
<div class="wrapper_left">
<ul id="wp_t_o_right_menu">
<li class="home_layout" id="active_tab"><?php
_e('Home Page Layout', 'crunchpress');
?>
</li>
<li class="footer_area"><?php
_e('Footer Layout', 'crunchpress');
?>
</li>
</ul>
//.........这里部分代码省略.........
示例9: save_default_post_option_meta
function save_default_post_option_meta($post_id)
{
global $post_id;
// init array
$post_social = '';
$sidebars = '';
$right_sidebar_post = '';
$left_sidebar_post = '';
$audio_url_type = '';
$post_thumbnail = '';
$video_url_type = '';
$select_slider_type = '';
// save
foreach ($_REQUEST as $keys => $values) {
${$keys} = $values;
}
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return;
}
if (isset($default_post) and $default_post == 'post') {
$new_data = '<post_detail>';
$new_data = $new_data . create_xml_tag('post_social', $post_social);
$new_data = $new_data . create_xml_tag('sidebar_post', $sidebars);
$new_data = $new_data . create_xml_tag('right_sidebar_post', $right_sidebar_post);
$new_data = $new_data . create_xml_tag('left_sidebar_post', $left_sidebar_post);
$new_data = $new_data . create_xml_tag('audio_url_type', $audio_url_type);
$new_data = $new_data . create_xml_tag('post_thumbnail', $post_thumbnail);
$new_data = $new_data . create_xml_tag('video_url_type', $video_url_type);
$new_data = $new_data . create_xml_tag('select_slider_type', $select_slider_type);
$new_data = $new_data . '</post_detail>';
//Saving Sidebar and Social Sharing Settings as XML
$old_data = get_post_meta($post_id, 'post_detail_xml', true);
save_meta_data($post_id, $new_data, $old_data, 'post_detail_xml');
}
}
示例10: general_options
function general_options()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
?>
<div class="cp-wrapper bootstrap_admin cp-margin-left">
<!--content area start -->
<div class="hbg top_navigation row-fluid">
<div class="cp-logo span2">
<img src="<?php
echo CP_PATH_URL;
?>
/framework/images/logo.png" class="logo" alt="logo" />
</div>
<div class="sidebar span10">
<?php
echo top_navigation_html_tooltip();
?>
</div>
<?php
//echo top_navigation_html();
?>
</div>
<div class="content-area-main row-fluid">
<!--sidebar start -->
<div class="sidebar-wraper span2">
<div class="sidebar-sublinks">
<ul id="wp_t_o_right_menu">
<li id="active_tab" class="logo" >
<?php
_e('Logo Settings', 'crunchpress');
?>
</li>
<li class="color_style">
<?php
_e('Style & Color Scheme', 'crunchpress');
?>
</li>
<li class="hr_settings">
<?php
_e('Header Settings', 'crunchpress');
?>
</li>
<li class="ft_settings">
<?php
_e('Footer Settings', 'crunchpress');
?>
</li>
<li class="misc_settings">
<?php
_e('MISC Settings', 'crunchpress');
?>
</li>
<li class="maintenance_mode_settings">
<?php
_e('Maintenance Mode Settings', 'crunchpress');
?>
</li>
<?php
if (!class_exists('Envato_WordPress_Theme_Upgrader')) {
} else {
?>
<li class="envato_api">
<?php
_e('User API Settings', 'crunchpress');
?>
</li>
<?php
}
?>
</ul>
</div>
</div>
<!--sidebar end -->
<!--content start -->
<div class="content-area span10">
<?php
//echo top_navigation_html();
?>
<form id="options-panel-form" name="cp-panel-form">
<div class="panel-elements" id="panel-elements">
<div class="panel-element" id="panel-element-save-complete">
<div class="panel-element-save-text">
<?php
_e('Save Options Complete', 'crunchpress');
?>
.</div>
<div class="panel-element-save-arrow"></div>
</div>
<div class="panel-element">
<?php
if (isset($action) and $action == 'general_options') {
$general_logo_xml = '<general_settings>';
$general_logo_xml = $general_logo_xml . create_xml_tag('header_logo', htmlspecialchars(stripslashes($header_logo)));
$general_logo_xml = $general_logo_xml . create_xml_tag('logo_width', $logo_width);
//.........这里部分代码省略.........
示例11: social_settings
function social_settings()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
?>
<div class="cp-wrapper bootstrap_admin cp-margin-left">
<!--content area start -->
<div class="hbg top_navigation row-fluid">
<div class="cp-logo span2">
<img src="<?php
echo CP_PATH_URL;
?>
/framework/images/logo.png" class="logo" />
</div>
<div class="sidebar span10">
<?php
echo top_navigation_html_tooltip();
?>
</div>
<?php
//echo top_navigation_html();
?>
</div>
<div class="content-area-main row-fluid">
<!--sidebar start -->
<div class="sidebar-wraper span2">
<div class="sidebar-sublinks">
<ul id="wp_t_o_right_menu">
<li class="social_networking" id="active_tab"><?php
_e('Social Networking', 'crunchpress');
?>
</li>
<li class="social_sharing"><?php
_e('Social Sharing', 'crunchpress');
?>
</li>
</ul>
</div>
</div>
<!--sidebar end -->
<!--content start -->
<div class="content-area span10">
<?php
//echo top_navigation_html();
?>
<form id="options-panel-form" name="cp-panel-form">
<div class="panel-elements" id="panel-elements">
<div class="panel-element" id="panel-element-save-complete">
<div class="panel-element-save-text">
<?php
_e('Save Options Complete', 'crunchpress');
?>
.</div>
<div class="panel-element-save-arrow"></div>
</div>
<div class="panel-element">
<?php
//Social Sharing and Networking Values Saving as XML
if (isset($action) and $action == 'social_settings') {
$social_xml = '<social_settings>';
$social_xml = $social_xml . create_xml_tag('facebook_network', htmlspecialchars(stripslashes($facebook_network)));
$social_xml = $social_xml . create_xml_tag('twitter_network', htmlspecialchars(stripslashes($twitter_network)));
$social_xml = $social_xml . create_xml_tag('delicious_network', htmlspecialchars(stripslashes($delicious_network)));
$social_xml = $social_xml . create_xml_tag('google_plus_network', htmlspecialchars(stripslashes($google_plus_network)));
//$social_xml = $social_xml . create_xml_tag('su_network',$su_network);
$social_xml = $social_xml . create_xml_tag('linked_in_network', htmlspecialchars(stripslashes($linked_in_network)));
//$social_xml = $social_xml . create_xml_tag('digg_network',$digg_network);
//$social_xml = $social_xml . create_xml_tag('myspace_network',$myspace_network);
//$social_xml = $social_xml . create_xml_tag('reddit_network',$reddit_network);
$social_xml = $social_xml . create_xml_tag('youtube_network', htmlspecialchars(stripslashes($youtube_network)));
$social_xml = $social_xml . create_xml_tag('flickr_network', htmlspecialchars(stripslashes($flickr_network)));
//$social_xml = $social_xml . create_xml_tag('picasa_network',$picasa_network);
$social_xml = $social_xml . create_xml_tag('vimeo_network', htmlspecialchars(stripslashes($vimeo_network)));
$social_xml = $social_xml . create_xml_tag('pinterest_network', htmlspecialchars(stripslashes($pinterest_network)));
$social_xml = $social_xml . create_xml_tag('Instagram_network', htmlspecialchars(stripslashes($Instagram_network)));
$social_xml = $social_xml . create_xml_tag('github_network', htmlspecialchars(stripslashes($github_network)));
$social_xml = $social_xml . create_xml_tag('skype_network', htmlspecialchars(stripslashes($skype_network)));
//Social Sharing
$social_xml = $social_xml . create_xml_tag('facebook_sharing', htmlspecialchars(stripslashes($facebook_sharing)));
$social_xml = $social_xml . create_xml_tag('twitter_sharing', htmlspecialchars(stripslashes($twitter_sharing)));
$social_xml = $social_xml . create_xml_tag('stumble_sharing', htmlspecialchars(stripslashes($stumble_sharing)));
$social_xml = $social_xml . create_xml_tag('delicious_sharing', htmlspecialchars(stripslashes($delicious_sharing)));
$social_xml = $social_xml . create_xml_tag('googleplus_sharing', htmlspecialchars(stripslashes($googleplus_sharing)));
$social_xml = $social_xml . create_xml_tag('digg_sharing', htmlspecialchars(stripslashes($digg_sharing)));
$social_xml = $social_xml . create_xml_tag('myspace_sharing', htmlspecialchars(stripslashes($myspace_sharing)));
$social_xml = $social_xml . create_xml_tag('reddit_sharing', htmlspecialchars(stripslashes($reddit_sharing)));
$social_xml = $social_xml . '</social_settings>';
if (!save_option('social_settings', get_option('social_settings'), $social_xml)) {
die(json_encode($return_data));
}
die(json_encode(array('success' => '0')));
}
//Social Networking
$facebook_network = '';
$twitter_network = '';
$delicious_network = '';
//.........这里部分代码省略.........
示例12: save_goodlayers_panel
function save_goodlayers_panel()
{
// check_ajax_referer(plugin_basename(__FILE__),'security');
global $goodlayers_element;
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
foreach ($goodlayers_element as $elements) {
foreach ($elements as $element) {
// when save sidebar
if ($element['type'] == 'sidebar') {
$sidebar_xml = '<sidebar>';
if (!empty($_POST[$element['name']])) {
$sidebar = $_POST[$element['name']];
} else {
$sidebar = array();
}
foreach ($sidebar as $sidebar_name) {
$sidebar_xml = $sidebar_xml . create_xml_tag('name', $sidebar_name);
}
$sidebar_xml = $sidebar_xml . '</sidebar>';
if (!save_option($element['name'], get_option($element['name']), $sidebar_xml)) {
die(json_encode($return_data));
}
// when save uploaded font
} else {
if ($element['type'] == 'uploadfont') {
$uploadfont_xml = '<uploadfont>';
if (!empty($_POST[$element['name']]) && !empty($_POST[$element['file']])) {
$uploadfont = $_POST[$element['name']];
$uploadfont_file = $_POST[$element['file']];
$num = sizeof($uploadfont);
for ($i = 0; $i < $num; $i++) {
$uploadfont_xml = $uploadfont_xml . '<font>';
$uploadfont_xml = $uploadfont_xml . create_xml_tag('name', $uploadfont[$i]);
$uploadfont_xml = $uploadfont_xml . create_xml_tag('file', $uploadfont_file[$i]);
$uploadfont_xml = $uploadfont_xml . '</font>';
}
}
$uploadfont_xml = $uploadfont_xml . '</uploadfont>';
if (!save_option($element['name'], get_option($element['name']), $uploadfont_xml)) {
die(json_encode($return_data));
}
// do nothing with dummy button
} else {
if ($element['type'] == 'dummy' || $element['type'] == 'import-export') {
} else {
if (!empty($element['name'])) {
if (!empty($_POST[$element['name']])) {
$new_option_value = str_replace("\\'", "'", $_POST[$element['name']]);
$new_option_value = str_replace('\\"', '"', $new_option_value);
$new_option_value = str_replace('\\\\', '\\', $new_option_value);
} else {
$new_option_value = '';
}
if (!save_option($element['name'], get_option($element['name']), $new_option_value)) {
die(json_encode($return_data));
}
}
}
}
}
}
}
// call the function to generate the style-custom.css file.
gdl_generate_style_custom();
die(json_encode(array('success' => '0')));
}
示例13: typography_settings
function typography_settings()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
if (isset($action) and $action == 'typography_settings') {
$typography_xml = '<typography_settings>';
$typography_xml = $typography_xml . create_xml_tag('font_google', $font_google);
$typography_xml = $typography_xml . create_xml_tag('font_size_normal', $font_size_normal);
$typography_xml = $typography_xml . create_xml_tag('font_google_heading', $font_google_heading);
$typography_xml = $typography_xml . create_xml_tag('menu_font_google', $menu_font_google);
$typography_xml = $typography_xml . create_xml_tag('heading_h1', $heading_h1);
$typography_xml = $typography_xml . create_xml_tag('heading_h2', $heading_h2);
$typography_xml = $typography_xml . create_xml_tag('heading_h3', $heading_h3);
$typography_xml = $typography_xml . create_xml_tag('heading_h4', $heading_h4);
$typography_xml = $typography_xml . create_xml_tag('heading_h5', $heading_h5);
$typography_xml = $typography_xml . create_xml_tag('heading_h6', $heading_h6);
$typography_xml = $typography_xml . create_xml_tag('embed_typekit_code', htmlspecialchars(stripslashes($embed_typekit_code)));
$typography_xml = $typography_xml . '</typography_settings>';
$font_setting_xml = '<typekit_font>';
$sidebars = $_POST['typekit_font'];
foreach ($sidebars as $keys => $values) {
$font_setting_xml = $font_setting_xml . create_xml_tag('typekit_font', $values);
}
$font_setting_xml = $font_setting_xml . '</typekit_font>';
save_option('typokit_settings', get_option('typokit_settings'), $font_setting_xml);
if (!save_option('typography_settings', get_option('typography_settings'), $typography_xml)) {
die(json_encode($return_data));
}
die(json_encode(array('success' => '0')));
}
$font_google = '';
$font_size_normal = '';
$menu_font_google = '';
$fonts_array = '';
$font_google_heading = '';
$heading_h1 = '';
$heading_h2 = '';
$heading_h3 = '';
$heading_h4 = '';
$heading_h5 = '';
$heading_h6 = '';
$embed_typekit_code = '';
$cp_typography_settings = get_option('typography_settings');
//$dd = find_xml_node($logo_uploa_d,'logo_upload');
if ($cp_typography_settings != '') {
$cp_typo = new DOMDocument();
$cp_typo->loadXML($cp_typography_settings);
$font_google = find_xml_value($cp_typo->documentElement, 'font_google');
$font_size_normal = find_xml_value($cp_typo->documentElement, 'font_size_normal');
$menu_font_google = find_xml_value($cp_typo->documentElement, 'menu_font_google');
$font_google_heading = find_xml_value($cp_typo->documentElement, 'font_google_heading');
$heading_h1 = find_xml_value($cp_typo->documentElement, 'heading_h1');
$heading_h2 = find_xml_value($cp_typo->documentElement, 'heading_h2');
$heading_h3 = find_xml_value($cp_typo->documentElement, 'heading_h3');
$heading_h4 = find_xml_value($cp_typo->documentElement, 'heading_h4');
$heading_h5 = find_xml_value($cp_typo->documentElement, 'heading_h5');
$heading_h6 = find_xml_value($cp_typo->documentElement, 'heading_h6');
$embed_typekit_code = find_xml_value($cp_typo->documentElement, 'embed_typekit_code');
}
?>
<div class="cp-wrapper bootstrap_admin cp-margin-left">
<!--content area start -->
<div class="hbg top_navigation row-fluid">
<div class="cp-logo span2">
<img src="<?php
echo CP_PATH_URL;
?>
/framework/images/logo.png" class="logo" />
</div>
<div class="sidebar span10">
<?php
echo top_navigation_html_tooltip();
?>
</div>
<?php
//echo top_navigation_html();
?>
</div>
<div class="content-area-main row-fluid">
<!--sidebar start -->
<div class="sidebar-wraper span2">
<div class="sidebar-sublinks">
<ul id="wp_t_o_right_menu">
<li class="font_family" id="active_tab"><?php
_e('Font Family', 'crunchpress');
?>
</li>
<li class="font_size"><?php
_e('Font Size', 'crunchpress');
?>
</li>
<li class="type_kit_font"><?php
_e('Type Kit Font', 'crunchpress');
?>
//.........这里部分代码省略.........
示例14: sidebar_settings
function sidebar_settings()
{
foreach ($_REQUEST as $keys => $values) {
${$keys} = trim($values);
}
?>
<div class="cp-wrapper bootstrap_admin cp-margin-left">
<!--content area start -->
<div class="hbg top_navigation row-fluid">
<div class="cp-logo span2">
<img src="<?php
echo CP_PATH_URL;
?>
/framework/images/logo.png" class="logo" />
</div>
<div class="sidebar span10">
<?php
echo top_navigation_html_tooltip();
?>
</div>
<?php
//echo top_navigation_html();
?>
</div>
<div class="content-area-main row-fluid">
<!--sidebar start -->
<div class="sidebar-wraper span2">
<div class="sidebar-sublinks">
<ul id="wp_t_o_right_menu">
<li id="active_tab" class="sidebar_settings"><?php
_e('Add New Sidebar', 'crunchpress');
?>
</li>
</ul>
</div>
</div>
<!--content start -->
<div class="content-area span10">
<?php
//echo top_navigation_html();
?>
<form id="options-panel-form" name="cp-panel-form">
<div class="panel-elements" id="panel-elements">
<div class="panel-element" id="panel-element-save-complete">
<div class="panel-element-save-text">
<?php
_e('Save Options Complete', 'crunchpress');
?>
.</div>
<div class="panel-element-save-arrow"></div>
</div>
<div class="panel-element">
<?php
$return_data = array('success' => '-1', 'alert' => 'Save option failed, please try contacting your host provider to increase the post_max_size and suhosin.post.max_vars varialble on the server.');
//Sidebar settings Saved
if (isset($action) and $action == 'sidebar_settings') {
$sidebar_xml = '<sidebar_settings>';
if (isset($_POST['sidebar'])) {
$sidebars = $_POST['sidebar'];
foreach ($sidebars as $keys => $values) {
$sidebar_xml = $sidebar_xml . create_xml_tag('sidebar_name', $values);
}
}
$sidebar_xml = $sidebar_xml . '</sidebar_settings>';
if (!save_option('sidebar_settings', get_option('sidebar_settings'), $sidebar_xml)) {
die(json_encode($return_data));
}
die(json_encode(array('success' => '0')));
}
//Sidebar values getting from database
$cp_sidebar_settings = get_option('sidebar_settings');
?>
</div>
<ul class="sidebar_settings">
<li class="active_tab" id="sidebar_settings">
<div class="row-fluid">
<div class="panel-input span8">
<div class="panel-title">
<h3> <?php
_e('Add Sidebar Name', 'crunchpress');
?>
</h3>
</div>
<input type="text" id="add-more-sidebar" value="type title here" rel="type title here">
<div id="add-more-sidebar" class="add-more-sidebar"></div>
</div>
<div class="span4 right-box-sec"><p><?php
_e('Add New Sidebars(Widget Areas) here you can manage them from Dashboard > Appearance > Widgets.', 'crunchpress');
?>
</p></div>
<div id="selected-sidebar" class="selected-sidebar first span12">
<div class="default-sidebar-item" id="sidebar-item">
<div class="panel-delete-sidebar"></div>
<div class="slider-item-text"></div>
<input type="hidden" id="sidebar">
</div>
<?php
//Sidebar addition
//.........这里部分代码省略.........
示例15: print_top_post_slider_item
function print_top_post_slider_item($category, $num_fetch, $width, $height)
{
global $gdl_date_format;
$category = $category == 'All' ? '' : $category;
$postslider_xml = "<single-item><Post-Slider>";
$postslider_xml = $postslider_xml . create_xml_tag('width', $width);
$postslider_xml = $postslider_xml . create_xml_tag('height', $height);
$postslider_xml = $postslider_xml . create_xml_tag('slider-type', 'Carousel Slider');
$postslider_xml = $postslider_xml . "<slider-item>";
query_posts(array('post_type' => 'post', 'category_name' => $category, 'posts_per_page' => $num_fetch));
while (have_posts()) {
the_post();
$postslider_xml = $postslider_xml . "<slider>";
$postslider_xml = $postslider_xml . create_xml_tag('image', get_post_thumbnail_id(get_the_ID()));
$postslider_xml = $postslider_xml . create_xml_tag('linktype', 'Link to URL');
$postslider_xml = $postslider_xml . create_xml_tag('link', htmlspecialchars(get_permalink()));
$postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()));
$postslider_xml = $postslider_xml . create_xml_tag('caption', __('Posted on ', 'gdl_front_end') . get_the_time($gdl_date_format));
$postslider_xml = $postslider_xml . create_xml_tag('comment', get_comments_number(get_the_ID()));
$postslider_xml = $postslider_xml . "</slider>";
}
$postslider_xml = $postslider_xml . "</slider-item>";
$postslider_xml = $postslider_xml . "</Post-Slider></single-item>";
$postslider_xml = gdl_remove_non_utf8($postslider_xml);
$slider_xml_val = new DOMDocument();
$slider_xml_val->loadXML($postslider_xml);
foreach ($slider_xml_val->documentElement->childNodes as $slider_item_xml) {
print_slider_item($slider_item_xml);
}
wp_reset_query();
}