/** * Register/queue frontend scripts. * * @access public * @return void */ public static function load_scripts() { global $post; //$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; $suffix = ''; $assets_path = str_replace(array('http:', 'https:'), '', PH()->plugin_url()) . '/assets/'; $frontend_script_path = $assets_path . 'js/frontend/'; // Register any scripts for later use, or used as dependencies wp_register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.3.1', true); if (is_property()) { wp_enqueue_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.5', true); wp_enqueue_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'), PH_VERSION, true); wp_enqueue_style('propertyhive_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css'); wp_enqueue_script('flexslider', $assets_path . 'js/flexslider/jquery.flexslider' . $suffix . '.js', array('jquery'), '2.2.2', true); wp_enqueue_script('flexslider-init', $assets_path . 'js/flexslider/jquery.flexslider.init' . $suffix . '.js', array('jquery', 'flexslider'), PH_VERSION, true); wp_enqueue_style('flexslider_css', $assets_path . 'css/flexslider.css'); wp_enqueue_script('propertyhive_actions', $frontend_script_path . 'actions' . $suffix . '.js', array('jquery'), PH_VERSION, true); wp_enqueue_script('ph-single-property'); } // Global frontend scripts wp_enqueue_script('propertyhive_search', $frontend_script_path . 'search' . $suffix . '.js', array('jquery'), PH_VERSION, true); wp_enqueue_script('propertyhive_make_enquiry', $frontend_script_path . 'make-enquiry' . $suffix . '.js', array('jquery'), PH_VERSION, true); //wp_enqueue_script( 'propertyhive', $frontend_script_path . 'propertyhive' . $suffix . '.js', array( 'jquery' ), PH_VERSION, true ); // CSS Styles $enqueue_styles = self::get_styles(); if ($enqueue_styles) { foreach ($enqueue_styles as $handle => $args) { wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']); } } }
/** * is_propertyhive - Returns true if on a page which uses PropertyHive templates * * @access public * @return bool */ function is_propertyhive() { return apply_filters('is_propertyhive', is_search_results() || is_property() ? true : false); }
function getTeamField($field) { switch ($field) { case 'played': return $this->getGamesPlayed(); break; case 'for_against': return $this->points_for - $this->points_against; break; case 'logo': return $this->logo; break; case 'percentage': // BUG 322 - add % to team columns $denominator = $this->points_against > 0 ? $this->points_against : 1; return round($this->points_for / $denominator * 100, 2); break; default: if (is_property($this, $field)) { return $this->{$field}; } else { return "-"; } break; } }
function getUserLadder($num_to_show, $page = 0, $field = 'points', $dir = 'desc', $round_id = FALSE) { global $database, $jTips; $org_round_id = $round_id; if ($round_id === FALSE) { $round_id = $this->getLatestRound(); } $jHistory = new jHistory($database); $this->getUsers($round_id); $jTipsUsers = array(); $start_from = $num_to_show * $page; $go_to = min($start_from + $num_to_show, count($this->users)); for ($i = $start_from; $i < $go_to; $i++) { $jTipsUser =& $this->users[$i]; $params = array('user_id' => $this->users[$i]->id, 'round_id' => $round_id, 'left_join' => array('type' => 'left_join', 'join_table' => '#__jtips_rounds', 'lhs_table' => '#__jtips_history', 'rhs_table' => '#__jtips_rounds', 'lhs_key' => 'round_id', 'rhs_key' => 'id', 'supplement' => 'AND #__jtips_rounds.scored = 1')); $jHistory->loadByParams($params); if (is_property($jHistory, $field)) { $jTipsUser->{$field} = $jHistory->{$field}; } else { if ($field == 'pointst') { $jTipsUser->{$field} = $jTipsUser->getTotalScore('points'); } else { if ($field == 'prect') { $jTipsUser->{$field} = $jTipsUser->getTotalScore('precision'); } else { if ($field == 'rank') { $jTipsUser->{$field} = $jTipsUser->getRank($org_round_id); } else { if ($field == 'comment') { $jComment = new jComment($database); $params = array('user_id' => $jTipsUser->id, 'round_id' => $round_id); $jComment->loadByParams($params); $jTipsUser->{$field} = !empty($jComment->comment) ? $jComment->comment : ""; } else { $jTipsUser->{$field} = $jTipsUser->getName(); } } } } } array_push($jTipsUsers, $jTipsUser); } //jTipsSortArrayObjects($jTipsUsers, $field, $dir); //return $jTipsUsers; return jTipsUser::sort($jTipsUsers, $field, $dir); }