Code Duplication    Length = 29-30 lines in 2 locations

admin_pages/venues/Venues_Admin_Page.core.php 1 location

@@ 958-986 (lines=29) @@
955
    }
956
957
958
    protected function _trash_or_restore_venues($venue_status = 'trash')
959
    {
960
        // clean status
961
        $venue_status = sanitize_key($venue_status);
962
        // grab status
963
        if (! empty($venue_status)) {
964
            $success = true;
965
            // determine the event id and set to array.
966
            $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
967
            // loop thru events
968
            foreach ($VNU_IDs as $VNU_ID) {
969
                if ($VNU_ID = absint($VNU_ID)) {
970
                    $results = $this->_change_venue_status($VNU_ID, $venue_status);
971
                    $success = $results !== false ? $success : false;
972
                } else {
973
                    $msg = sprintf(
974
                        __(
975
                            'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.',
976
                            'event_espresso'
977
                        ),
978
                        $VNU_ID
979
                    );
980
                    EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
981
                    $success = false;
982
                }
983
            }
984
        } else {
985
            $success = false;
986
            $msg = __(
987
                'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.',
988
                'event_espresso'
989
            );

admin_pages/events/Events_Admin_Page.core.php 1 location

@@ 1984-2013 (lines=30) @@
1981
     * @param  string $event_status
1982
     * @return void
1983
     */
1984
    protected function _trash_or_restore_events($event_status = 'trash')
1985
    {
1986
        // clean status
1987
        $event_status = sanitize_key($event_status);
1988
        // grab status
1989
        if (! empty($event_status)) {
1990
            $success = true;
1991
            // determine the event id and set to array.
1992
            $EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1993
            // loop thru events
1994
            foreach ($EVT_IDs as $EVT_ID) {
1995
                if ($EVT_ID = absint($EVT_ID)) {
1996
                    $results = $this->_change_event_status($EVT_ID, $event_status);
1997
                    $success = $results !== false ? $success : false;
1998
                } else {
1999
                    $msg = sprintf(
2000
                        esc_html__(
2001
                            'An error occurred. Event #%d could not be moved to the trash because a valid event ID was not not supplied.',
2002
                            'event_espresso'
2003
                        ),
2004
                        $EVT_ID
2005
                    );
2006
                    EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2007
                    $success = false;
2008
                }
2009
            }
2010
        } else {
2011
            $success = false;
2012
            $msg = esc_html__(
2013
                'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
2014
                'event_espresso'
2015
            );
2016
            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);