コード例 #1
0
/**
 * Deletes a visit record
 *
 * @since 1.2
 * @return bool
 */
function affwp_delete_visit($visit)
{
    if (is_object($visit) && isset($visit->visit_id)) {
        $visit_id = $visit->visit_id;
    } elseif (is_numeric($visit)) {
        $visit_id = absint($visit);
    } else {
        return false;
    }
    // Decrease the visit count
    affwp_decrease_affiliate_visit_count($visit_id);
    if (affiliate_wp()->visits->delete($visit_id)) {
        do_action('affwp_delete_visit', $visit_id);
        return true;
    }
    return false;
}
コード例 #2
0
 function test_adjust_affiliate_visit_count()
 {
     $this->assertEquals(1, affwp_increase_affiliate_visit_count($this->_affiliate_id));
     $this->assertEquals(2, affwp_increase_affiliate_visit_count($this->_affiliate_id));
     $this->assertEquals(1, affwp_decrease_affiliate_visit_count($this->_affiliate_id));
     $this->assertFalse(affwp_decrease_affiliate_visit_count($this->_affiliate_id2));
 }