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

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