/** * It creates a new ModelContactCounter object class ir if it has been created * before, it return the previous object * * @access public * @since 3.0 * @return ModelContactCounter */ public static function newInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
<div class="contact-counter-metric"> <span class="contact-counter-big"><?php _e('Total contact '); ?> </span> <?php if (Params::getParam('id') != '') { ?> <span class="contact-counter-value"><?php echo cc_contacts_by_listing(Params::getParam('id')); ?> </span> <?php } else { ?> <span class="contact-counter-value"><?php echo ModelContactCounter::newInstance()->getTotalContacts(); ?> </span> <?php } ?> </div> </div> </div> </div> </div> <div class="clear"></div> </div>
function cc_contacts_by_user($userId) { if ($userId != '' && is_numeric($userId)) { return ModelContactCounter::newInstance()->getTotalContactsByUser($userId); } return 0; }