| Server IP : 194.30.32.123 / Your IP : 216.73.216.89 Web Server : Apache System : Linux 4f6650a08421 5.10.0-44-amd64 #1 SMP Debian 5.10.257-1 (2026-05-27) x86_64 User : ftpbegirale ( 1001) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,curl_multi_exec,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /expert/htwebs/www.begirale.com/public/wp-content/themes/perspective-theme/include/ |
Upload File : |
<?php
//adding columns start
add_filter('manage_reviews_posts_columns', 'review_columns_add');
function review_columns_add($columns) {
$columns['category'] = 'Category';
$columns['author'] = 'Author';
return $columns;
}
add_action('manage_reviews_posts_custom_column', 'review_columns');
function review_columns($name) {
global $post;
switch ($name) {
case 'category':
$categories = get_the_terms( $post->ID, 'review-category' );
if($categories <> ""){
$couter_comma = 0;
foreach ( $categories as $category ) {
echo $category->name;
$couter_comma++;
if ( $couter_comma < count($categories) ) {
echo ", ";
}
}
}
break;
case 'author':
echo get_the_author();
break;
}
}
//adding columns end
function cs_review_register() {
$labels = array(
'name' => 'Reviews',
'add_new_item' => 'Add New Review',
'edit_item' => 'Edit Review',
'new_item' => 'New Review Item',
'add_new' => 'Add New Review',
'view_item' => 'View Review Item',
'search_items' => 'Search Review',
'not_found' => 'Nothing found',
'not_found_in_trash' => 'Nothing found in Trash',
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'menu_icon' => get_template_directory_uri() . '/images/admin/review-icon.png',
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => null,
'supports' => array('title','editor','thumbnail', 'comments' )
);
register_post_type( 'reviews' , $args );
}
add_action('init', 'cs_review_register');
// adding cat start
$labels = array(
'name' => 'Review Categories',
'search_items' => 'Search Review Categories',
'edit_item' => 'Edit Review Category',
'update_item' => 'Update Review Category',
'add_new_item' => 'Add New Category',
'menu_name' => 'Review Categories',
);
register_taxonomy('review-category',array('reviews'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'review-category' ),
));
// adding cat end
// adding tag start
$labels = array(
'name' => 'Review Tags',
'singular_name' => 'review-tag',
'search_items' => 'Search Tags',
'popular_items' => 'Popular Tags',
'all_items' => 'All Tags',
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => 'Edit Tag',
'update_item' => 'Update Tag',
'add_new_item' => 'Add New Tag',
'new_item_name' => 'New Tag Name',
'separate_items_with_commas' => 'Separate tags with commas',
'add_or_remove_items' => 'Add or remove tags',
'choose_from_most_used' => 'Choose from the most used tags',
'menu_name' => 'Review Tags',
);
register_taxonomy('review-tag','reviews',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'review-tag' ),
));
// adding tag end
// adding review meta info start
add_action( 'add_meta_boxes', 'cs_meta_review_add' );
function cs_meta_review_add()
{
add_meta_box( 'cs_meta_review', 'Review Options', 'cs_meta_review', 'reviews', 'normal', 'high' );
}
function cs_meta_review( $post ) {
$cs_review = get_post_meta($post->ID, "cs_review", true);
global $xmlObject;
if ( $cs_review <> "" ) {
$xmlObject = new SimpleXMLElement($cs_review);
$sub_title = $xmlObject->sub_title;
$header_banner_options = $xmlObject->header_banner_options;
$header_banner = $xmlObject->header_banner;
$slider_id = htmlspecialchars($xmlObject->slider_id);
$review_date = $xmlObject->review_date;
$review_credit_hours = $xmlObject->review_credit_hours;
// $review_fee = $xmlObject->review_fee;
$review_social = $xmlObject->review_social;
$rating_styles = $xmlObject->rating_styles;
$rating_position = $xmlObject->rating_position;
$switch_footer_widgets = $xmlObject->switch_footer_widgets;
}
else {
$sub_title = '';
$header_banner_options ='';
$header_banner = '';
$slider_id = '';
$review_date = '';
$review_credit_hours = '';
// $review_fee = '';
$review_social = '';
$rating_styles = '';
$rating_position = '';
$switch_footer_widgets = '';
}
?>
<div class="page-wrap page-opts left" style="overflow:hidden; position:relative; height: 1432px;">
<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/scripts/admin/select.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/scripts/admin/prettyCheckable.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri()?>/scripts/admin/jquery.scrollTo-min.js"></script>
<div class="option-sec" style="margin-bottom:0;">
<div class="opt-conts">
<ul class="form-elements">
<li class="to-label"><label>Sub Title</label></li>
<li class="to-field">
<input type="text" name="sub_title" value="<?php echo $sub_title ?>" />
<p>Put the sub title.</p>
</li>
</ul>
<ul class="form-elements">
<li class="to-label"><label>Header Banner Options</label></li>
<li class="to-field">
<select name="header_banner_options" class="dropdown" onchange="javascript:toggle_header_banner(this.value)">
<option <?php if($header_banner_options=="Default Image")echo "selected";?> >Default Image</option>
<option <?php if($header_banner_options=="No Image")echo "selected";?> >No Image</option>
<option <?php if($header_banner_options=="No Header")echo "selected";?> >No Header</option>
<option <?php if($header_banner_options=="Custom Image")echo "selected";?> >Custom Image</option>
<option <?php if($header_banner_options=="Slider")echo "selected";?> >Slider</option>
</select>
<p></p>
</li>
<ul class="form-elements noborder" id="default_image" style="display:<?php if($header_banner_options=="Default Image" or $header_banner_options == "")echo 'inline"';else echo 'none';?>" >
<li class="to-label"></li>
<li class="to-field"><p>Default image (subheader-bg.png) can be replaced from images folder</p></li>
</ul>
<ul class="form-elements noborder" id="custom_image" style="display:<?php if($header_banner_options=="Custom Image")echo 'inline"';else echo 'none';?>" >
<li class="to-label"><label>Header Banner</label></li>
<li class="to-field">
<input id="header_banner" name="header_banner" value="<?php echo $header_banner?>" type="text" class="small" />
<input id="header_banner" name="header_banner" type="button" class="uploadfile left" value="Browse"/>
</li>
</ul>
<ul class="form-elements noborder" id="layer_slider" style="display:<?php if($header_banner_options == "Slider")echo "inline"; else echo "none"; ?>" >
<li class="to-label">
<label>Use Short Code</label>
</li>
<li class="to-field">
<input type="text" id="slider_id" name="slider_id" class="txtfield" value="<?php echo $slider_id;?>" />
</li>
<li class="to-label"></li>
<li class="to-field">
<p>Please enter the Layer/Other Slider Short Code like [layerslider id="1"]</p>
</li>
</ul>
</ul>
<ul class="form-elements noborder">
<li class="to-label"><label>Social Sharing</label></li>
<li class="to-field">
<div class="on-off"><input type="checkbox" name="review_social" value="on" class="myClass" <?php if($review_social=='on')echo "checked"?> /></div>
<p>Make Social Sharing On/Off</p>
</li>
</ul>
<ul class="form-elements">
<li class="to-label"><label>Footer Widgets</label></li>
<li class="to-field">
<div class="on-off"><input type="checkbox" name="switch_footer_widgets" class="myClass" <?php if(empty($switch_footer_widgets) || $switch_footer_widgets == "on"){ echo "checked"; } ?> /></div>
<p>Make footer widgets On/Off</p>
</li>
</ul>
</div>
<div class="clear"></div>
</div>
<div class="boxes tracklists">
<div id="add_item" class="poped-up">
<div class="opt-head">
<h5>Add Item</h5>
<a href="javascript:closepopedup('add_item')" class="closeit"> </a>
<div class="clear"></div>
</div>
<ul class="form-elements">
<li class="to-label"><label>Item Title</label></li>
<li class="to-field">
<input type="text" id="subject_title_dummy" name="subject_title_dummy" value="Item Title" />
<p>Put item title</p>
</li>
</ul>
<ul class="form-elements">
<li class="to-label"><label>Rating</label></li>
<li class="to-field">
<input type="text" id="rating_value" name="rating_value" maxlength="3" />
<p>Put the rating value (1 to 100)</p>
</li>
</ul>
<ul class="form-elements noborder">
<li class="to-label"></li>
<li class="to-field"><input type="button" value="Add to List" onclick="cs_add_item_to_list('<?php echo admin_url('admin-ajax.php')?>', '<?php echo get_template_directory_uri()?>')" /></li>
</ul>
</div>
<script>
jQuery(document).ready(function($) {
$("#total_tracks").sortable({
cancel : 'td div.poped-up',
});
});
</script>
<div class="opt-head">
<h4 style="padding-top:12px;">Rating</h4>
<ul class="form-elements noborder" >
<li class="to-label"><label>Rating Styles</label></li>
<li class="to-field">
<select name="rating_styles" class="dropdown" style=" border:1px solid #ccc;">
<option <?php if($rating_styles=="Stars")echo "selected";?> >Stars</option>
<option <?php if($rating_styles=="Points")echo "selected";?> >Points</option>
<option <?php if($rating_styles=="Percent")echo "selected";?> >Percent</option>
</select>
</li>
</ul>
<ul class="form-elements noborder" >
<li class="to-label"><label>Rating Position</label></li>
<li class="to-field">
<select name="rating_position" class="dropdown" style=" border:1px solid #ccc;">
<option <?php if($rating_position=="left")echo "selected";?> value="left">Left</option>
<option <?php if($rating_position=="right")echo "selected";?> value="right">Right</option>
<option <?php if($rating_position=="top")echo "selected";?> value="top">Top</option>
<option <?php if($rating_position=="bottom")echo "selected";?> value="bottom">Bottom</option>
</select>
</li>
</ul>
<a href="javascript:openpopedup('add_item')" class="button">Add Item</a>
<div class="clear"></div>
</div>
<table class="to-table" border="0" cellspacing="0">
<thead>
<tr>
<th style="width:80%;">Item Title</th>
<th style="width:80%;" class="centr">Actions</th>
</tr>
</thead>
<tbody id="total_tracks">
<?php
global $counter_subject, $subject_title, $subject_instructor , $subject_credit, $subject_class_timing,$rating_value;
$counter_subject = $post->ID;
if ( $cs_review <> "" ) {
foreach ( $xmlObject as $track ){
if ( $track->getName() == "subject" ) {
$subject_title = $track->subject_title;
$rating_value = $track->rating_value;
$counter_subject++;
cs_add_item_to_list();
}
}
}
?>
</tbody>
</table>
</div>
<?php cs_meta_layout() ?>
<input type="hidden" name="review_meta_form" value="1" />
<div class="clear"></div>
</div>
<div class="clear"></div>
<?php
}
if ( isset($_POST['review_meta_form']) and $_POST['review_meta_form'] == 1 ) {
if ( empty($_POST['cs_layout']) ) $_POST['cs_layout'] = 'none';
add_action( 'save_post', 'cs_meta_album_save' );
function cs_meta_album_save( $post_id )
{
$sxe = new SimpleXMLElement("<review></review>");
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( empty($_POST["sub_title"]) ) $_POST["sub_title"] = "";
if ( empty($_POST["header_banner_options"]) ) $_POST["header_banner_options"] = "";
if ( empty($_POST["header_banner"]) ) $_POST["header_banner"] = "";
if ( empty($_POST["slider_id"]) ) $_POST["slider_id"] = "";
if ( empty($_POST["review_social"]) ) $_POST["review_social"] = "";
if ( empty($_POST["rating_styles"]) ) $_POST["rating_styles"] = "";
if ( empty($_POST["rating_position"]) ) $_POST["rating_position"] = "";
if ( empty($_POST["switch_footer_widgets"]) ) $_POST["switch_footer_widgets"] = "";
$sxe = cs_save_layout_xml($sxe);
$sxe->addChild('sub_title', $_POST['sub_title'] );
$sxe->addChild('header_banner_options', $_POST['header_banner_options'] );
$sxe->addChild('header_banner', $_POST['header_banner'] );
$sxe->addChild('slider_id', $_POST['slider_id'] );
$sxe->addChild('review_social', $_POST['review_social'] );
$sxe->addChild('rating_styles', $_POST['rating_styles'] );
$sxe->addChild('rating_position', $_POST['rating_position'] );
$sxe->addChild('switch_footer_widgets', $_POST['switch_footer_widgets'] );
$counter = 0;
if ( isset($_POST['subject_title']) ) {
foreach ( $_POST['subject_title'] as $count ){
$track = $sxe->addChild('subject');
$track->addChild('subject_title', htmlspecialchars($_POST['subject_title'][$counter]) );
$track->addChild('rating_value', htmlspecialchars($_POST['rating_value'][$counter]) );
$counter++;
}
}
update_post_meta( $post_id, 'cs_review', $sxe->asXML() );
}
}
// adding review meta info end
?>