/wp-content/themes/ProjectTheme/functions.php
PHP | 8285 lines | 5093 code | 2217 blank | 975 comment | 892 complexity | 23aade3d04310846c28d6956076780e4 MD5 | raw file
Possible License(s): GPL-2.0, MIT, GPL-3.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- /***************************************************************************
- *
- * ProjectTheme - copyright (c) - sitemile.com
- * The only project theme for wordpress on the world wide web.
- *
- * Coder: Andrei Dragos Saioc
- * Email: sitemile[at]sitemile.com | andreisaioc[at]gmail.com
- * More info about the theme here: http://sitemile.com/products/wordpress-project-freelancer-theme/
- * since v1.2.5.3
- *
- ***************************************************************************/
-
- load_theme_textdomain( 'ProjectTheme', TEMPLATEPATH . '/languages' );
- // load the theme template for translation
-
- DEFINE("PROJECTTHEME_VERSION", "1.4.2b");
- DEFINE("PROJECTTHEME_RELEASE", "14 January 2014");
-
- //----------------------------------------------------------
-
- add_theme_support( 'post-thumbnails' );
- remove_action('wp_head', 'wp_generator');
-
- //----------------------------------------------------------
-
- global $current_theme_locale_name, $category_url_link, $location_url_link, $projects_url_nm;
- $current_theme_locale_name = 'ProjectTheme';
-
- $category_url_link = "classification";
- $cc = get_option('projectTheme_category_slug_link');
- if(!empty($cc) && ProjectTheme_using_permalinks()) $category_url_link = $cc;
-
- $location_url_link = "location";
- $cc = get_option('projectTheme_location_slug_link');
- if(!empty($cc) && ProjectTheme_using_permalinks()) $location_url_link = $cc;
-
- $projects_url_nm = "projects";
- $cc = get_option('projectTheme_projects_slug_link');
- if(!empty($cc) && ProjectTheme_using_permalinks()) $projects_url_nm = $cc;
- //------------------ file includes -----------------------------
-
- include('lib/first_run.php');
- include('lib/first_run_emails.php');
- include('lib/admin_menu.php');
- include('lib/post_new.php');
- include('lib/cronjob.php');
-
- include('lib/all_categories.php');
- include('lib/all_locations.php');
- include('lib/advanced_search.php');
-
- include('lib/blog_page.php');
- include('lib/recently_closed.php');
- include('lib/provider_search.php');
- include('lib/all-posted-projects.php');
-
- //---------------
-
- include('lib/widgets/browse-by-category.php');
- include('lib/widgets/browse-by-location.php');
- include('lib/widgets/best-rated-users.php');
- include('lib/widgets/most-visited-projects.php');
- include('lib/widgets/featured-projects.php');
- include('lib/widgets/ending-soonest.php');
- include('lib/widgets/latest-posted-projects.php');
-
- //---------------
-
- include('lib/login_register/custom2.php');
-
- include('lib/my_account/my_account.php');
- include('lib/my_account/personal_information.php');
- include('lib/my_account/payments.php');
- include('lib/my_account/private_messages.php');
- include('lib/my_account/feedbacks.php');
- //include('lib/my_account/disputes.php');
-
- include('lib/my_account/completed_projects.php');
- include('lib/my_account/awaiting_payments.php');
- include('lib/my_account/outstanding_payments.php');
- include('lib/my_account/awaiting_completion.php');
- include('lib/my_account/unpublished_projects.php');
- include('lib/my_account/closed_projects.php');
- include('lib/my_account/active_projects.php');
-
- include('lib/my_account/outstanding_project.php');
- include('lib/my_account/delivered_projects.php');
-
- include('lib/my_account/won_projects.php');
- include('lib/my_account/bid_projects.php');
- include('lib/my_account/pay_for_project.php');
- include('lib/my_account/pay_with_credits.php');
- //include 'lib/social/social.php';
-
- //--------------------------------------------------------------
- //------------ hooks and filters -------------------------------
- add_action('save_post', 'projectTheme_save_custom_fields');
- add_action('generate_rewrite_rules', 'projectTheme_rewrite_rules' );
- add_action('query_vars', 'ProjectTheme_add_query_vars');
- add_action("template_redirect", 'ProjectTheme_template_redirect');
- add_action('init', 'ProjectTheme_create_post_type' );
- add_action('wp_head', 'ProjectTheme_add_js_coin_slider');
- add_action('the_content', 'ProjectTheme_display_my_account_page');
- add_action('the_content', 'ProjectTheme_display_my_account_pay_with_credits');
- add_action('the_content', 'ProjectTheme_display_my_account_outstanding_projects');
- add_action('the_content', 'ProjectTheme_display_my_account_awaiting_payments_page');
-
- add_action('the_content', 'ProjectTheme_display_advanced_search_disp_page');
- add_action('the_content', 'ProjectTheme_display_my_account_pay_for_project');
- add_action('the_content', 'ProjectTheme_display_my_account_awaiting_completion_page');
- add_action('the_content', 'ProjectTheme_display_provider_search_disp_page');
-
- add_filter('the_content', 'ProjectTheme_display_blog_content_page');
- add_filter('the_content', 'ProjectTheme_display_latest_closed_projects_page');
-
- add_action('the_content', 'ProjectTheme_display_all_locations_page');
- add_action('the_content', 'ProjectTheme_display_all_categories_page');
- add_action('the_content', 'ProjectTheme_display_my_account_personal_info');
- add_action('the_content', 'ProjectTheme_display_my_account_payments');
- add_action('the_content', 'ProjectTheme_display_my_account_private_messages');
- add_action('the_content', 'ProjectTheme_display_my_account_feedbacks');
- add_action('the_content', 'ProjectTheme_display_my_account_delivered_projects');
-
- add_action('the_content', 'ProjectTheme_display_my_account_active_projects');
- add_action('the_content', 'ProjectTheme_display_my_account_unpublished_projects');
- add_action('the_content', 'ProjectTheme_display_my_account_outstanding_payments');
- add_action('the_content', 'ProjectTheme_display_my_account_closed_projects');
- add_action('the_content', 'ProjectTheme_display_my_account_completed_projects');
-
- add_action('the_content', 'ProjectTheme_display_my_account_won_projects');
- add_action('the_content', 'ProjectTheme_display_my_account_bid_projects');
- add_action('the_content', 'ProjectTheme_display_all_projects_page');
-
- add_action('draft_to_publish', 'ProjectTheme_run_when_post_published',10,1);
-
- add_action('the_content', 'ProjectTheme_display_post_new_pg');
- add_action('admin_menu', 'ProjectTheme_set_admin_menu');
- add_action('admin_head', 'ProjectTheme_admin_style_sheet');
- add_action('widgets_init', 'ProjectTheme_framework_init_widgets' );
- add_action("manage_project_posts_custom_column", "ProjectTheme_my_custom_columns");
- add_filter("manage_edit-project_columns", "ProjectTheme_my_projects_columns");
- add_action('wp_enqueue_scripts', 'ProjectTheme_add_theme_styles');
- add_action('wp_head', 'ProjectTheme_custom_css_thing');
- add_action('admin_notices', 'projectTheme_admin_notices');
- add_filter('wp_head', 'ProjectTheme_add_max_nr_of_images');
- add_filter("ProjectTheme_get_regular_post_project", 'projectTheme_get_post_main_function', 0, 1);
-
- add_filter( 'manage_edit-project_sortable_columns', 'ProjectTheme_sortable_cake_column' );
- add_action( 'pre_get_posts', 'ProjectTheme_my_backend_projects_orderby' );
- add_filter("ProjectTheme_get_post_blog_function", 'ProjectTheme_get_post_blog_function', 1);
- add_filter("projectTheme_get_post_outstanding_project_function", 'projectTheme_get_post_outstanding_project_function', 1);
- add_filter("projectTheme_get_post_paid_function", 'projectTheme_get_post_paid_function', 1);
- add_filter("projectTheme_get_post_pay_function", 'projectTheme_get_post_pay_function', 1);
- add_filter("projectTheme_get_post_awaiting_compl_function", 'projectTheme_get_post_awaiting_compl_function', 1);
- add_filter("projectTheme_get_post_awaiting_payment_function", 'projectTheme_get_post_awaiting_payment_function', 1);
- add_filter('wp_mail_from', 'ProjectTheme_1_mail_from');
- add_filter('wp_mail_from_name', 'ProjectTheme_1_mail_from_name');
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_1_mail_from()
- {
- $emailaddress = 'wordpress@wordpress.org';
- $opt = get_option('ProjectTheme_email_addr_from');
- if(!empty($opt)) $emailaddress = $opt;
- return $emailaddress;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_1_mail_from_name()
- {
- $sendername = 'WordPress';
- $opt = get_option('ProjectTheme_email_name_from');
- if(!empty($opt)) $sendername = $opt;
- return $sendername;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_run_when_post_published($post)
- {
- if(is_array($post))
- {
- if($post['post_type'] == 'project'):
-
- ProjectTheme_send_email_subscription($post['ID']);
- ProjectTheme_send_email_posted_project_approved($post['ID']);
- ProjectTheme_send_email_posted_project_approved_admin($post['ID']);
-
- endif;
- }
-
- if(is_object($post))
- {
- if($post->post_type == 'project'):
-
- ProjectTheme_send_email_subscription($post->ID);
- ProjectTheme_send_email_posted_project_approved($post->ID);
- ProjectTheme_send_email_posted_project_approved_admin($post->ID);
-
- endif;
- }
- }
-
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_search_into($custid, $val)
- {
- global $wpdb;
- $s = "select * from ".$wpdb->prefix."project_custom_relations where custid='$custid'";
- $r = $wpdb->get_results($s);
-
- if(count($r) == 0) return 0;
- else
- foreach($r as $row) // = mysql_fetch_object($r))
- {
- if($row->catid == $val) return 1;
- }
- return 0;
- }
- function projectTheme_search_into_users($custid, $val)
- {
- global $wpdb;
- $s = "select * from ".$wpdb->prefix."project_user_custom_relations where custid='$custid'";
- $r = $wpdb->get_results($s);
-
- if(count($r) == 0) return 0;
- else
- foreach($r as $row) // = mysql_fetch_object($r))
- {
- if($row->catid == $val) return 1;
- }
- return 0;
- }
- function ProjectTheme_register_my_menus() {
- register_nav_menu( 'primary-projecttheme-header', 'ProjectTheme Top Header Menu' );
- register_nav_menu( 'primary-projecttheme-main-header', 'ProjectTheme Main Header Menu' );
- }
-
- add_action( 'init', 'ProjectTheme_register_my_menus' );
- function cimy_update_ExtraFields_new_me() {
- global $wpdb, $wpdb_data_table, $user_ID, $max_length_value, $fields_name_prefix, $cimy_uef_file_types, $user_level, $cimy_uef_domain;
- include_once(ABSPATH.'/wp-admin/includes/user.php');
- // if updating meta-data from registration post then exit
- if (isset($_POST['cimy_post']))
- return;
- if (isset($_POST['user_id'])) {
- $get_user_id = $_POST['user_id'];
- if (!current_user_can('edit_user', $get_user_id))
- return;
- }
- else
- return;
-
- //echo "asd";
-
- if(!function_exists('get_cimyFields')) return;
-
- $get_user_id = intval($get_user_id);
- $profileuser = get_user_to_edit($get_user_id);
- $user_login = $profileuser->user_login;
- $user_displayname = $profileuser->display_name;
- $extra_fields = get_cimyFields(false, true);
- $query = "UPDATE ".$wpdb_data_table." SET VALUE=CASE FIELD_ID";
- $i = 0;
- $field_ids = "";
- $mail_changes = "";
- foreach ($extra_fields as $thisField) {
- $field_id = $thisField["ID"];
- $name = $thisField["NAME"];
- $type = $thisField["TYPE"];
- $label = $thisField["LABEL"];
- $rules = $thisField["RULES"];
- $unique_id = $fields_name_prefix.$field_id;
- $input_name = $fields_name_prefix.esc_attr($name);
- $field_id_data = $input_name."_".$field_id."_data";
- $advanced_options = cimy_uef_parse_advanced_options($rules["advanced_options"]);
- cimy_insert_ExtraFields_if_not_exist($get_user_id, $field_id);
- // if the current user LOGGED IN has not enough permissions to see the field, skip it
- // apply only for EXTRA FIELDS
- if ($rules['show_level'] == 'view_cimy_extra_fields')
- {
- if (!current_user_can($rules['show_level']))
- continue;
- }
- else if ($user_level < $rules['show_level'])
- continue;
- // if show_level == anonymous then do NOT ovverride other show_xyz rules
- if ($rules['show_level'] == -1) {
- // if flag to show the field in the profile is NOT activated, skip it
- if (!$rules['show_in_profile'])
- continue;
- }
- $prev_value = $wpdb->escape(stripslashes($_POST[$input_name."_".$field_id."_prev_value"]));
- if (cimy_uef_is_field_disabled($type, $rules['edit'], $prev_value))
- continue;
- if ((isset($_POST[$input_name])) && (!in_array($type, $cimy_uef_file_types))) {
- if ($type == "dropdown-multi")
- $field_value = stripslashes(implode(",", $_POST[$input_name]));
- else
- $field_value = stripslashes($_POST[$input_name]);
- if ($type == "picture-url")
- $field_value = str_replace('../', '', $field_value);
- if (isset($rules['max_length']))
- $field_value = substr($field_value, 0, $rules['max_length']);
- else
- $field_value = substr($field_value, 0, $max_length_value);
- $field_value = $wpdb->escape($field_value);
- if ($i > 0)
- $field_ids.= ", ";
- else
- $i = 1;
- $field_ids.= $field_id;
- $query.= " WHEN ".$field_id." THEN ";
- switch ($type) {
- case 'dropdown':
- case 'dropdown-multi':
- $ret = cimy_dropDownOptions($label, $field_value);
- $label = $ret['label'];
- case 'picture-url':
- case 'textarea':
- case 'textarea-rich':
- case 'password':
- case 'text':
- $value = "'".$field_value."'";
- $prev_value = "'".$prev_value."'";
- break;
- case 'checkbox':
- $value = $field_value == '1' ? "'YES'" : "'NO'";
- $prev_value = $prev_value == "YES" ? "'YES'" : "'NO'";
- break;
- case 'radio':
- $value = $field_value == $field_id ? "'selected'" : "''";
- $prev_value = "'".$prev_value."'";
- break;
- }
- $query.= $value;
- }
- // when a checkbox is not selected then it isn't present in $_POST at all
- // file input in html also is not present into $_POST at all so manage here
- else {
- $rules = $thisField['RULES'];
- if (in_array($type, $cimy_uef_file_types)) {
- if ($type == "avatar") {
- // since avatars are drawn max to 512px then we can save bandwith resizing, do it!
- $rules['equal_to'] = 512;
- }
- if (isset($_POST[$input_name.'_del']))
- $delete_file = true;
- else
- $delete_file = false;
- if (isset($_POST[$input_name."_".$field_id."_prev_value"]))
- $old_file = stripslashes($_POST[$input_name."_".$field_id."_prev_value"]);
- else
- $old_file = false;
- $field_value = cimy_manage_upload($input_name, $user_login, $rules, $old_file, $delete_file, $type, (!empty($advanced_options["filename"])) ? $advanced_options["filename"] : "");
- if ((!empty($field_value)) || ($delete_file)) {
- if ($i > 0)
- $field_ids.= ", ";
- else
- $i = 1;
- $field_ids.= $field_id;
- $value = "'".$field_value."'";
- $prev_value = "'".$prev_value."'";
- $query.= " WHEN ".$field_id." THEN ";
- $query.= $value;
- }
- else {
- $prev_value = $value;
- $file_on_server = cimy_uef_get_dir_or_filename($user_login, $old_file, false);
- if (($type == "picture") || ($type == "avatar"))
- cimy_uef_crop_image($file_on_server, $field_id_data);
- }
- }
- if ($type == 'checkbox') {
- // if can be editable then write NO
- // there is no way to understand if was YES or NO previously
- // without adding other hidden inputs so write always
- if ($i > 0)
- $field_ids.= ", ";
- else
- $i = 1;
- $field_ids.= $field_id;
- $field_value = "NO";
- $value = "'".$field_value."'";
- $prev_value = $prev_value == "YES" ? "'YES'" : "'NO'";
- $query.= " WHEN ".$field_id." THEN ";
- $query.= $value;
- }
- if ($type == 'dropdown-multi') {
- // if can be editable then write ''
- // there is no way to understand if was YES or NO previously
- // without adding other hidden inputs so write always
- if ($i > 0)
- $field_ids.= ", ";
- else
- $i = 1;
- $field_ids.= $field_id;
- $field_value = '';
- $value = "'".$field_value."'";
- $prev_value = "'".$prev_value."'";
- $ret = cimy_dropDownOptions($label, $field_value);
- $label = $ret['label'];
- $query.= " WHEN ".$field_id." THEN ";
- $query.= $value;
- }
- }
- if (($rules["email_admin"]) && ($value != $prev_value) && ($type != "registration-date")) {
- $mail_changes.= sprintf(__("%s previous value: %s new value: %s", $cimy_uef_domain), $label, stripslashes($prev_value), stripslashes($value));
- $mail_changes.= "\r\n";
- }
- }
- if ($i > 0) {
- $query.=" ELSE FIELD_ID END WHERE FIELD_ID IN(".$field_ids.") AND USER_ID = ".$get_user_id;
- // $query WILL BE: UPDATE <table> SET VALUE=CASE FIELD_ID WHEN <field_id1> THEN <value1> [WHEN ... THEN ...] ELSE FIELD_ID END WHERE FIELD_ID IN(<field_id1>, [<field_id2>...]) AND USER_ID=<user_id>
- $wpdb->query($query);
- }
- // mail only if set and if there is something to mail
- if (!empty($mail_changes)) {
- $admin_email = get_option('admin_email');
- $mail_subject = sprintf(__("%s (%s) has changed one or more fields", $cimy_uef_domain), $user_displayname, $user_login);
- wp_mail($admin_email, $mail_subject, $mail_changes);
- }
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_add_max_nr_of_images()
- {
- ?>
-
- <script type="text/javascript">
- <?php
- $ProjectTheme_enable_max_images_limit = get_option('ProjectTheme_enable_max_images_limit');
- if($ProjectTheme_enable_max_images_limit == "yes")
- {
- $projectTheme_nr_max_of_images = get_option('projectTheme_nr_max_of_images');
- if(empty($projectTheme_nr_max_of_images)) $projectTheme_nr_max_of_images = 10;
- }
- else $ProjectTheme_enable_max_images_limit = 1000;
-
- if(empty($projectTheme_nr_max_of_images)) $projectTheme_nr_max_of_images = 100;
-
- ?>
-
-
-
- var maxNrImages_PT = <?php echo $projectTheme_nr_max_of_images; ?>;
-
- </script>
-
- <?php
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_save_custom_fields($pid)
- {
- $pst = get_post($pid);
-
- if($pst->post_type == "project"):
- if(isset($_POST['fromadmin']))
- {
-
- update_post_meta($pid, 'finalised_posted', '1');
-
- $ending = get_post_meta($pid,"ending",true);
- $views = get_post_meta($pid,"views",true);
- $closed = get_post_meta($pid,"closed",true);
-
- $reverse = get_post_meta($pid, "reverse", true);
-
- update_post_meta($pid,"ending",strtotime($_POST['ending']));
- if(empty($views)) update_post_meta($pid,"views",0);
-
-
- if($reverse == "yes") update_post_meta($pid, "reverse", "yes");
- else update_post_meta($pid, "reverse", "no");
-
- update_post_meta($pid, "budgets", $_POST["budgets"]);
-
- if($_POST['hide_project'] == '1')
- update_post_meta($pid,"hide_project",'1');
- else
- update_post_meta($pid,"hide_project",'0');
-
-
- if($_POST['featureds'] == '1')
- update_post_meta($pid,"featured",'1');
- else
- update_post_meta($pid,"featured",'0');
-
- if($_POST['closed'] == '1')
- {
-
- update_post_meta($pid,"closed",'1');
- }
- else
- {
- if($closed == "1") update_post_meta($pid,"ending",current_time('timestamp',0) + 30*24*3600);
- update_post_meta($pid,"closed",'0');
-
- }
-
- if(isset($_POST['private_bids']))
- update_post_meta($pid, "private_bids", $_POST['private_bids']);
-
-
- if(isset($_POST['price']))
- update_post_meta($pid,"price",$_POST['price']);
-
- if(isset($_POST['Location']))
- update_post_meta($pid,"Location",$_POST['Location']);
-
- for($i=0;$i<count($_POST['custom_field_id']);$i++)
- {
- $id = $_POST['custom_field_id'][$i];
- $valval = $_POST['custom_field_value_'.$id];
-
- if(is_array($valval))
- {
- delete_post_meta($pid, 'custom_field_ID_'.$id);
-
- for($k=0;$k<count($valval);$k++)
- add_post_meta($pid, 'custom_field_ID_'.$id, $valval[$k]);
- }
- else
- update_post_meta($pid, 'custom_field_ID_'.$id, $valval);
- }
- }
-
- update_post_meta($pid,'unpaid','0');
- do_action('ProjectTheme_execute_on_submit_1', $pid);
- endif;
- }
-
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_custom_css_thing()
- {
- $str = get_option('projectTheme_custom_CSS');
- $opt = stripslashes($str);
- if(!empty($op)):
-
- ?>
- <style type="text/css">
- <?php echo $opt; ?>
- </style>
- <?php
- endif;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- add_action('wp_print_scripts', 'projecttheme_my_enqueue_scripts');
- function wp_tiny_mce_mine( $teeny = false, $settings = false ) {
-
-
- static $num = 1;
-
- if ( ! class_exists('_WP_Editors' ) )
- require_once( ABSPATH . WPINC . '/class-wp-editor.php' );
-
- $editor_id = 'content' . $num++;
-
- $set = array(
- 'teeny' => $teeny,
- 'tinymce' => $settings ? $settings : true,
- 'quicktags' => false
- );
-
- $set = _WP_Editors::parse_settings($editor_id, $set);
- _WP_Editors::editor_settings($editor_id, $set);
- }
-
- function projecttheme_my_enqueue_scripts() {
- wp_enqueue_script( 'tiny_mce' );
- wp_tiny_mce_mine();
- }
- function ProjectTheme_get_my_pagination_main($url, $current_page, $field_page, $total_pages, $other = '')
- {
- $s = '';
- $s .= '<div class="wp-pagenavi"> <span class="pages">'.sprintf(__('Page %s of %s','ProjectTheme'), $current_page, $total_pages).'</span>';
-
- $batch = 5;
- $raport = ceil($current_page/$batch) - 1; if ($raport < 0) $raport = 0;
- $start = $raport * $batch + 1;
- $end = $start + $batch - 1;
-
- if($end > $total_pages) $end = $total_pages;
-
- $previous_pg = $current_page - 1;
-
-
- $next_pg = $current_page + 1;
- if($next_pg > $total_pages) $next_pg = 1;
-
- //----------------------
-
- if($current_page > 1)
- $s .= '<a href="'.$url.'&'.$field_page.'=1'.$other.'">« '.__('First','Walleto').'</a>';
-
- if($previous_pg > 0)
- $s.= '<a href="'.$url.'&'.$field_page.'='.$previous_pg.$other.'">«</a>';
-
-
- for($i = $start; $i <= $end; $i ++) {
- if ($i == $current_page) {
- $s .= '<span class="current">'.$i.'</span>';
- } else {
-
- $s .= '<a class="page larger" href="'.$url.'&'.$field_page.'='.$i.$other.'">'.$i.'</a>';
-
- }
- }
-
- //extend
- if($end < $total_pages) $s .= '<span class="extend">...</span>';
-
- $next_pg = $current_page + 1;
- if($next_pg > $total_pages) $next_pg = 1;
-
- if($total_pages > $current_page)
- $s .= '<a href="'.$url.'&'.$field_page.'='.$next_pg.$other.'" class="page larger">»</a>';
-
- if($total_pages > $current_page)
- $s .= '<a href="'.$url.'&'.$field_page.'='.$total_pages.$other.'" class="page larger">'.__('Last','ProjectTheme').' »</a>';
-
- return $s.'</div>';
-
- }
- function ProjectTheme_add_theme_styles()
- {
- global $wp_query;
- $new_Project_step = $wp_query->query_vars['post_new_step'];
- $p_action = $wp_query->query_vars['p_action'];
-
- // Register the style like this for a theme:
- // (First the unique name for the style (custom-style) then the src,
- // then dependencies and ver no. and media type)
- wp_register_style( 'bootstrap_style1', get_bloginfo('template_url').'/css/bootstrap_min.css', array(), '20120822', 'all' );
- wp_register_style( 'bootstrap_style2', get_bloginfo('template_url').'/css/css.css', array(), '20120822', 'all' );
- wp_register_style( 'bootstrap_style3', get_bloginfo('template_url').'/css/bootstrap_responsive.css', array(), '20120822', 'all' );
- wp_register_style( 'bootstrap_ie6', get_bloginfo('template_url').'/css/bootstrap_ie6.css', array(), '20120822', 'all' );
- wp_register_style( 'bootstrap_gal', get_bloginfo('template_url').'/css/bootstrap_gal.css', array(), '20120822', 'all' );
- wp_register_style( 'fileupload_ui', get_bloginfo('template_url').'/css/fileupload_ui.css', array(), '20120822', 'all' );
- wp_register_style( 'mega_menu_thing', get_bloginfo('template_url').'/css/menu.css', array(), '20120822', 'all' );
- wp_register_style( 'uploadify_css', get_bloginfo('template_url').'/lib/uploadify/uploadify.css', array(), '20120822', 'all' );
- wp_register_script( 'social_pr', get_bloginfo('template_url').'/js/connect.js');
-
- wp_register_style( 'bx_styles', get_bloginfo('template_url').'/css/bx_styles.css', array(), '20120822', 'all' );
- wp_register_script( 'easing', get_bloginfo('template_url').'/js/jquery.easing.1.3.js');
- wp_register_script( 'bx_slider', get_bloginfo('template_url').'/js/jquery.bxSlider.min.js');
-
-
-
- wp_register_script( 'html5_js', get_bloginfo('template_url').'/js/html5.js');
- wp_register_script( 'jquery_ui', get_bloginfo('template_url').'/js/vendor/jquery.ui.widget.js');
- wp_register_script( 'templ_min', get_bloginfo('template_url').'/js/templ.min.js');
- wp_register_script( 'load_image', get_bloginfo('template_url').'/js/load_image.min.js');
- wp_register_script( 'canvas_to_blob', get_bloginfo('template_url').'/js/canvas_to_blob.js');
- wp_register_script( 'iframe_transport', get_bloginfo('template_url').'/js/jquery.iframe-transport.js');
-
- wp_register_script( 'fileupload_main', get_bloginfo('template_url').'/js/jquery.fileupload.js');
- wp_register_script( 'fileupload_fp', get_bloginfo('template_url').'/js/jquery.fileupload-fp.js');
- wp_register_script( 'fileupload_ui', get_bloginfo('template_url').'/js/jquery.fileupload-ui.js');
-
- wp_register_script( 'locale_thing', get_bloginfo('template_url').'/js/locale.js');
- wp_register_script( 'main_thing', get_bloginfo('template_url').'/js/main.js');
- wp_register_script( 'uploadify_js', get_bloginfo('template_url').'/lib/uploadify/jquery.uploadify-3.1.js');
-
- wp_enqueue_script( 'jqueryhoverintent', get_bloginfo('template_url') . '/js/jquery.hoverIntent.minified.js', array('jquery') );
- wp_enqueue_script( 'dcjqmegamenu', get_bloginfo('template_url') . '/js/jquery.dcmegamenu.1.3.4.min.js', array('jquery') );
-
- global $wp_styles, $wp_scripts;
-
- wp_enqueue_script( 'social_pr' );
-
- wp_enqueue_style( 'bx_styles' );
- wp_enqueue_script( 'easing' );
- wp_enqueue_script( 'bx_slider' );
- wp_enqueue_script( 'jqueryhoverintent' );
- wp_enqueue_script( 'dcjqmegamenu' );
-
- wp_enqueue_style( 'mega_menu_thing' );
-
- global $post;
- $ssl = get_option('ProjectTheme_my_account_personal_info_id');
-
- if($new_Project_step == "2" or $p_action == "edit_project" or $p_action == "repost_project" or $post->ID == $ssl ):
- // enqueing:
- wp_enqueue_style( 'bootstrap_style1' );
- wp_enqueue_style( 'bootstrap_style2' );
- wp_enqueue_style( 'bootstrap_style3' );
- wp_enqueue_style( 'bootstrap_ie6' );
- wp_enqueue_style( 'bootstrap_gal' );
- wp_enqueue_style( 'fileupload_ui' );
- wp_enqueue_style( 'uploadify_css' );
-
-
- wp_enqueue_script( 'html5_js' );
- wp_enqueue_script( 'jquery_ui' );
- wp_enqueue_script( 'templ_min' );
- wp_enqueue_script( 'load_image' );
- wp_enqueue_script( 'canvas_to_blob' );
- wp_enqueue_script( 'iframe_transport' );
-
- wp_enqueue_script( 'fileupload_main' );
- wp_enqueue_script( 'fileupload_fp' );
- wp_enqueue_script( 'fileupload_ui' );
- wp_enqueue_script( 'locale_thing' );
- wp_enqueue_script( 'main_thing' );
- wp_enqueue_script( 'uploadify_js' );
-
- $wp_styles->add_data('bootstrap_ie6', 'conditional', 'lte IE 7');
-
-
- endif;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_2_user_types()
- {
- $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp');
- if( $ProjectTheme_enable_2_user_tp == "yes") return true;
- return false;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- /*function ProjectTheme_is_user_provider($uid)
- {
- if(!ProjectTheme_2_user_types()) return true;
-
- //----------------------
-
- $can_do_both = get_user_meta($uid, 'can_do_both', true);
- if($can_do_both == "yes") return true;
-
- //----------------------
-
- $user_tp = get_user_meta($uid, 'user_tp', true);
- if($user_tp == "service_provider") return true;
-
- $user = get_userdata($uid);
-
- if($user->user_level == 10) return true;
- return false;
- }*/
- function ProjectTheme_is_user_provider($uid)
- {
- if(!ProjectTheme_2_user_types()) return true;
-
- //----------------------
-
- $can_do_both = get_user_meta($uid, 'can_do_both', true);
- if($can_do_both == "yes") return true;
-
- //----------------------
- $user_data = get_userdata($uid);
-
- $user_roles = $user_data->roles;
-
-
- if(is_array($user_roles))
- $user_role = array_shift($user_roles);
- if($user_role == "service_provider") return true;
-
-
- $user_tp = get_user_meta($uid, 'user_tp', true);
- if($user_tp == "service_provider") return true;
- if($user_role == "administrator") return true;
-
- $user = get_userdata($uid);
-
- if($user->user_level == 10) return true;
- return false;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
-
- /*function ProjectTheme_is_user_business($uid)
- {
- if(!ProjectTheme_2_user_types()) return true;
-
- //----------------------
-
- $can_do_both = get_user_meta($uid, 'can_do_both', true);
- if($can_do_both == "yes") return true;
-
- //----------------------
-
- $user_tp = get_user_meta($uid, 'user_tp', true);
- if($user_tp != "service_provider") return true;
-
- $user = get_userdata($uid);
-
- if($user->user_level == 10) return true;
- return false;
-
-
- } */
- function ProjectTheme_is_user_business($uid)
- {
- if(!ProjectTheme_2_user_types()) return true;
-
- //----------------------
-
- $can_do_both = get_user_meta($uid, 'can_do_both', true);
- if($can_do_both == "yes") return true;
-
- //----------------------
-
- $user = get_userdata($uid);
-
- $user_roles = $user->roles;
- if(is_array($user_roles))
- $user_role = array_shift($user_roles);
-
- if($user_role == "business_owner") return true;
- if($user_role == "administrator") return true;
-
- if($user->user_level == 10) return true;
- return false;
-
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function project_isValidEmail($email){
- return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
-
- function projectTheme_small_post()
- {
- $ending = get_post_meta(get_the_ID(), 'ending', true);
- $sec = $ending - current_time('timestamp',0);
- $location = get_post_meta(get_the_ID(), 'Location', true);
-
- $price = get_post_meta(get_the_ID(), 'price', true);
- $closed = get_post_meta(get_the_ID(), 'closed', true);
- $featured = get_post_meta(get_the_ID(), 'featured', true);
- $private_bids = get_post_meta(get_the_ID(), 'at', true);
-
- ?>
- <div class="post" id="post-<?php the_ID(); ?>">
-
-
- <?php if($featured == "1"): ?>
- <div class="featured-two"></div>
- <?php endif; ?>
-
-
-
- <?php if($private_bids == "yes" or $private_bids == "1"): ?>
- <div class="sealed-two"></div>
- <?php endif; ?>
-
-
-
- <div class="image_holder2">
- <a href="<?php the_permalink(); ?>"><img width="50" height="50" class="image_class"
- src="<?php echo ProjectTheme_get_first_post_image(get_the_ID(),75,65); ?>" /></a>
- </div>
- <div class="title_holder2" >
- <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
- <?php
- the_title();
-
- ?></a></h2>
-
- <p class="mypostedon2">
- <?php _e("Posted in",'ProjectTheme');?> <?php echo get_the_term_list( get_the_ID(), 'project_cat', '', ', ', '' ); ?><br/>
-
- <?php
-
- $ProjectTheme_enable_project_location = get_option('ProjectTheme_enable_project_location');
- if($ProjectTheme_enable_project_location == "yes"):
-
- ?>
-
- <?php _e("Location",'ProjectTheme');?>: <?php
-
- $lc = get_the_term_list( get_the_ID(), 'project_location', '', ', ', '' );
- echo (empty($lc) ? __("not defined",'ProjectTheme') : $lc );
-
- endif;
-
- ?> </p>
-
-
- </div></div> <?php
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_is_home()
- {
- global $current_user, $wp_query;
- $p_action = $wp_query->query_vars['p_action'];
-
- if(!empty($p_action)) return false;
- if(is_home()) return true;
- return false;
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_replace_stuff_for_me($find, $replace, $subject)
- {
- $i = 0;
- foreach($find as $item)
- {
- $replace_with = $replace[$i];
- $subject = str_replace($item, $replace_with, $subject);
- $i++;
- }
-
- return $subject;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_winner_bid($pid)
- {
- global $wpdb;
- $s = "select * from ".$wpdb->prefix."project_bids where pid='$pid' and winner='1'";
- $r = $wpdb->get_results($s);
-
- return $r[0];
- }
- function projectTheme_get_bid_by_uid($pid, $uid)
- {
- global $wpdb;
- $s = "select * from ".$wpdb->prefix."project_bids where pid='$pid' and uid='$uid'";
- $r = $wpdb->get_results($s);
-
- return $r[0];
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
-
- function ProjectTheme_my_backend_projects_orderby( $query ) {
- if( ! is_admin() )
- return;
-
- $post_type = $query->query_vars['post_type'];
- $orderby = $query->get( 'orderby');
-
- if($post_type == "project"):
-
- $query->set('meta_key','ending');
- $query->set('orderby','meta_value_num');
-
- if( 'exp' == $orderby ) {
- $query->set('meta_key','ending');
- $query->set('orderby','meta_value_num');
- }
-
- if( 'feat' == $orderby ) {
- $query->set('meta_key','featured');
- $query->set('orderby','meta_value_num');
- }
-
- endif;
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_sortable_cake_column( $columns ) {
- $columns['exp'] = 'exp';
- $columns['feat'] = 'feat';
- return $columns;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function ProjectTheme_my_projects_columns($columns) //this function display the columns headings
- {
- $columns = array(
- "cb" => "<input type=\"checkbox\" />",
- "title" => __("Project Title","ProjectTheme"),
- "author" => __("Author","ProjectTheme"),
- "posted" => __("Posted On","ProjectTheme"),
- "price" => __("Price","ProjectTheme"),
- "exp" => __("Expires in","ProjectTheme"),
- "feat" => __("Featured","ProjectTheme"),
- "approveds" => __("Approved","ProjectTheme"),
- "thumbnail" => __("Thumbnail","ProjectTheme"),
- "options" => __("Options","ProjectTheme")
- );
- return $columns;
- }
-
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
-
- function ProjectTheme_my_custom_columns($column)
- {
- global $post;
- if ("ID" == $column) echo $post->ID; //displays title
- elseif ("description" == $column) echo $post->ID; //displays the content excerpt
- elseif ("posted" == $column) echo date_i18n('jS \of F, Y \<\b\r\/\>H:i:s',strtotime($post->post_date)); //displays the content excerpt
- elseif ("thumbnail" == $column)
- {
- echo '<a href="'.get_bloginfo('siteurl').'/wp-admin/post.php?post='.$post->ID.'&action=edit"><img class="image_class"
- src="'.ProjectTheme_get_first_post_image($post->ID,75,65).'" width="75" height="65" /></a>'; //shows up our post thumbnail that we previously created.
- }
-
- elseif ("author" == $column)
- {
- echo $post->post_author;
- }
-
- elseif ("approveds" == $column)
- {
- $paid = get_post_meta($post->ID, 'paid', true);
-
- if($post->post_status == "draft") echo "No";
- else echo "Yes";
- }
-
- elseif ("feat" == $column)
- {
- $f = get_post_meta($post->ID,'featured', true);
- if($f == "1") echo __("Yes","ProjectTheme");
- else echo __("No","ProjectTheme");
- }
-
- elseif ("price" == $column)
- {
- echo ProjectTheme_get_budget_name_string_fromID(get_post_meta($post->ID,'budgets',true));
- }
-
- elseif ("exp" == $column)
- {
- $ending = get_post_meta($post->ID, 'ending', true);
- echo ProjectTheme_prepare_seconds_to_words($ending - current_time('timestamp',0));
- }
-
- elseif ("options" == $column)
- {
- echo '<div style="padding-top:20px">';
- echo '<a class="awesome" href="'.get_bloginfo('siteurl').'/wp-admin/post.php?post='.$post->ID.'&action=edit">Edit</a> ';
- echo '<a class="awesome" href="'.get_permalink($post->ID).'" target="_blank">View</a> ';
- echo '<a class="trash" href="'.get_delete_post_link($post->ID).'">Trash</a> ';
- echo '</div>';
- }
-
- }
-
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
-
- function ProjecTheme_get_budgets_dropdown($selected = '', $class = '' , $rui = 0)
- {
- $ech = '<select name="budgets" class="'.$class.'">';
-
- global $wpdb;
- $s = "select * from ".$wpdb->prefix."project_bidding_intervals order by low_limit asc";
- $r = $wpdb->get_results($s);
-
- if($rui == 1) $ech .= '<option value="">'.__('Select','ProjectTheme').'</option>';
-
- foreach($r as $row)
- {
- $nm = ProjectTheme_get_budget_name_string($row);
- $ech .= '<option value="'.$row->id.'" '.($row->id == $selected ? 'selected="selected"' : '').'>'.$nm.'</option>';
-
- }
-
- return $ech.'</select>';
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_set_metaboxes()
- {
-
- add_meta_box( 'project_custom_fields', 'Project Custom Fields', 'projectTheme_custom_fields_html', 'project', 'advanced','high' );
- add_meta_box( 'project_images', 'Project Images', 'projectTheme_theme_project_images', 'project', 'advanced', 'high' );
- add_meta_box( 'project_files', 'Project Files', 'projectTheme_theme_project_files', 'project', 'advanced', 'high' );
- add_meta_box( 'project_bids', 'Project Bids', 'projectTheme_theme_project_bids', 'project', 'advanced', 'high' );
- add_meta_box( 'project_dets', 'Project Details', 'projectTheme_theme_project_dts', 'project', 'side', 'high' );
-
- }
- function projectTheme_custom_fields_html()
- {
- global $post, $wpdb;
- $pid = $post->ID;
- ?>
- <table width="100%">
- <input type="hidden" value="1" name="fromadmin" />
- <?php
- $cat = wp_get_object_terms($pid, 'project_cat');
- $catidarr = $cat[0]->term_id;
-
-
- $arr = ProjectTheme_get_project_category_fields($catidarr, $pid);
-
- for($i=0;$i<count($arr);$i++)
- {
-
- echo '<tr>';
- echo '<td>'.$arr[$i]['field_name'].$arr[$i]['id'].':</td>';
- echo '<td>'.$arr[$i]['value'];
- do_action('ProjectTheme_step3_after_custom_field_'.$arr[$i]['id'].'_field');
- echo '</td>';
- echo '</tr>';
-
-
- }
-
- ?>
-
-
- </table>
- <?php
-
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_theme_project_dts()
- {
- global $post;
- $pid = $post->ID;
- $price = get_post_meta($pid, "price", true);
- $location = get_post_meta($pid, "Location", true);
- $f = get_post_meta($pid, "featured", true);
- $t = get_post_meta($pid, "closed", true);
- $hide_project = get_post_meta($pid, "hide_project", true);
-
-
- ?>
-
- <ul id="post-new4">
- <input name="fromadmin" type="hidden" value="1" />
-
-
- <li>
- <h2><?php echo __('Price','ProjectTheme'); ?>:</h2>
- <p>
-
- <?php
-
- $sel = get_post_meta($pid, 'budgets', true);
- echo ProjecTheme_get_budgets_dropdown($sel, 'do_input');
-
- ?>
-
- </p>
- </li>
-
-
-
- <li>
- <h2><?php echo __('Sealed Bids','ProjectTheme'); ?>:</h2>
- <p><select name="private_bids">
- <option value="0" <?php if(get_post_meta($pid,'private_bids',true) == "0") echo 'selected="selected"'; ?>><?php _e("No",'ProjectTheme'); ?></option>
- <option value="1" <?php if(get_post_meta($pid,'private_bids',true) == "1") echo 'selected="selected"'; ?>><?php _e("Yes",'ProjectTheme'); ?></option>
-
- </select>
- </p>
- </li>
-
- <li>
- <h2><?php _e("Feature this project",'ProjectTheme');?>:</h2>
- <p><input type="checkbox" value="1" name="featureds" <?php if($f == '1') echo ' checked="checked" '; ?> /></p>
- </li>
-
-
- <li>
- <h2><?php _e("Hide this project",'ProjectTheme');?>:</h2>
- <p><input type="checkbox" value="1" name="hide_project" <?php if($hide_project == '1') echo ' checked="checked" '; ?> /></p>
- </li>
-
-
- <li>
- <h2><?php _e("Closed",'ProjectTheme');?>:</h2>
- <p><input type="checkbox" value="1" name="closed" <?php if($t == '1') echo ' checked="checked" '; ?> /></p>
- </li>
-
-
- <li>
- <h2><?php _e("Address",'ProjectTheme');?>:</h2>
- <p><input type="text" value="<?php echo get_post_meta($pid,'Location',true); ?>" name="Location" /></p>
- </li>
-
-
-
-
- <li>
- <h2>
-
-
-
-
-
- <link rel="stylesheet" media="all" type="text/css" href="<?php echo get_bloginfo('template_url'); ?>/css/ui-thing.css" />
- <script type="text/javascript" language="javascript" src="<?php echo get_bloginfo('template_url'); ?>/js/jquery-ui-timepicker-addon.js"></script>
-
-
-
-
- <?php _e("Project Ending On",'ProjectTheme'); ?>:</h2>
- <p><input type="text" name="ending" id="ending" value="<?php
-
- $d = get_post_meta($pid,'ending',true);
-
- if(!empty($d)) {
- $r = date_i18n('m/d/Y H:i:s', $d);
- echo $r;
- }
- ?>" class="do_input" /></p>
- </li>
-
- <script>
- jQuery(document).ready(function() {
- jQuery('#ending').datetimepicker({
- showSecond: true,
- timeFormat: 'hh:mm:ss'
- });});
-
- </script>
-
-
- </ul>
-
- <?php
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_highest_bid($pid)
- {
- global $wpdb;
- $s = "select bid from ".$wpdb->prefix."project_bids where pid='$pid' order by bid desc limit 1";
- $r = $wpdb->get_results($s);
-
- if(count($r) == 0)
- {
- $start_price = get_post_meta($pid, 'start_price', true);
- if(empty($start_price)) return false;
- return $start_price;
-
- }
-
-
- $r = $r[0];
- return $r->bid;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_highest_bid_owner($pid)
- {
- global $wpdb;
- $s = "select bid from ".$wpdb->prefix."project_bids where pid='$pid' order by bid desc limit 1";
- $r = $wpdb->get_results($s);
-
- if(count($r) == 0)
- return false;
-
- $r = $r[0];
- return $r->uid;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_bid_values($pid)
- {
- global $wpdb;
- $s = "select bid from ".$wpdb->prefix."project_bids where pid='$pid' order by bid desc";
- $r = $wpdb->get_results($s);
-
- return $r;
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_current_price($pid = '')
- {
- if(empty($pid)) $pid = get_the_ID();
- $only_buy_now = get_post_meta($pid, 'only_buy_now' ,true);
-
- if($only_buy_now == '1') return get_post_meta($pid, 'buy_now', true);
-
- $reverse = get_post_meta($pid, "reverse", true);
- if($reverse == "yes") return get_post_meta($pid, 'price', true);
- else
- {
- $bids = projectTheme_get_bid_values($pid);
-
- if(count($bids) == 0)
- {
- $start = projectTheme_get_start_price($pid);
- return ($start == false ? 0 : $start );
- }
- else
- {
- return projectTheme_get_highest_bid($pid);
- }
-
- }
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_get_start_price($pid = '')
- {
- if(empty($pid)) $pid = get_the_ID();
- $price = get_post_meta($pid, 'start_price', true);
-
- if(empty($price)) $price = false;
- return $price;
-
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- add_filter('post_type_link', 'ProjectTheme_post_type_link_filter_function', 1, 3);
- function ProjectTheme_post_type_link_filter_function( $post_link, $id = 0, $leavename = FALSE ) {
-
- global $category_url_link;
-
- if ( strpos('%project_cat%', $post_link) === 'FALSE' ) {
- return $post_link;
- }
- $post = get_post($id);
- if ( !is_object($post) || $post->post_type != 'project' ) {
- return str_replace("project_cat", $category_url_link ,$post_link);
- }
- $terms = wp_get_object_terms($post->ID, 'project_cat');
- if ( !$terms ) {
- return str_replace('%project_cat%', 'uncategorized', $post_link);
- }
- return str_replace('%project_cat%', $terms[0]->slug, $post_link);
- }
- /*************************************************************
- *
- * ProjectTheme (c) sitemile.com - function
- *
- **************************************************************/
- function projectTheme_theme_project_files()
- {
- global $current_user;
- get_currentuserinfo();
- $cid = $current_user->ID;
-
- global $post;
- $pid = $post->ID;
- $cwd = str_replace('wp-admin','',getcwd());
- $cwd .= 'wp-content/uploads';
- //echo get_template_directory();
- ?>
- <div style="overflow:hidden">
-
- <script type="text/javascript" src="<?php echo get_bloginfo('template_url'); ?>/lib/uploadify/jquery.uploadify-3.1.js"></script>
- <link rel="stylesheet" href="<?php echo get_bloginfo('template_url'); ?>/lib/uploadify/uploadify.css" type="text/css" />
-
- <script type="text/javascript">
-
- function delete_this(id)
- {
- jQuery.ajax({
- method: 'get',
- url : '<?php echo get_bloginfo('siteurl');?>/index.php/?_ad_delete_pid='+id,
- dataType : 'text',
- success: function (text) { jQuery('#image_ss'+id).remove(); }
- });
- //alert("a");
-
- }
-
-
- jQuery(function() {
-
- jQuery("#fileUpload3").uploadify({
- height : 30,
- auto: true,
- swf : '<?php echo get_bloginfo('template_url'); ?>/lib/uploadify/uploadify.swf',
- uploader : '<?php echo get_bloginfo('template_url'); ?>/lib/uploadify/uploady2.php',
- width : 120,
- fileTypeExts : '*.zip;*.pdf;*.doc;*.docx',
- fileTypeDesc : '<?php _e('Select Project Files','ProjectTheme'); ?>',
- formData : {'ID':<?php echo $pid; ?>,'author':<?php echo $cid; ?>},
- onUploadSuccess : function(file, data, response) {
-
- //alert(data);
- var bar = data.split("|");
-
- jQuery('#thumbnails2').append('<div class="div_div" id="image_ss'+bar[1]+'" > ' + bar[0] + '" <a href="javascript: void(0)" onclick="delete_this('+ bar[1] +')"><img border="0" src="<?php echo get_bloginfo('template_url'); ?>/images/delete_icon.png" border="0" /></a></div>');
- }
-
-
-
- });
-
-
- });
-
-
- </script>
-
- <style type="text/css">
- .div_div1
- {
- margin-left:5px; float:left;
- width:100%;
- margin-top:10px;
- }
-
- </style>
-
- <div id="fileUpload3">You have a problem with your javascript</div>
- <div id="thumbnails2" style="overflow:hidden;margin-top:20px">
-
- <?php
- $args = array(
- 'order' => 'ASC',
- 'orderby' => 'menu_order',
- 'post_type' => 'attachment',
- 'post_parent' => $pid,
- 'post_status' => null,
- 'numberposts' => -1,
- );
- $attachments = get_posts($args);
- if ($attachments) {
- foreach ($at…
Large files files are truncated, but you can click here to view the full file