humanmade /
backupwordpress
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace HM\BackUpWordPress; |
||
| 4 | |||
| 5 | $filesize = get_site_size_text( $schedule ); |
||
| 6 | |||
| 7 | // Backup Type |
||
| 8 | $type = strtolower( human_get_type( $schedule->get_type() ) ); |
||
| 9 | |||
| 10 | // Backup Time |
||
| 11 | $day = date_i18n( 'l', $schedule->get_next_occurrence( false ) ); |
||
| 12 | |||
| 13 | // Next Backup |
||
| 14 | $next_backup = 'title="' . esc_attr( sprintf( __( 'The next backup will be on %1$s at %2$s %3$s', 'backupwordpress' ), date_i18n( get_option( 'date_format' ), $schedule->get_next_occurrence( false ) ), date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ), date_i18n( 'T', $schedule->get_next_occurrence( false ) ) ) ) . '"'; |
||
| 15 | |||
| 16 | // Backup status |
||
| 17 | $status = new Backup_Status( $schedule->get_id() ); |
||
| 18 | |||
| 19 | // Backup Re-occurrence |
||
| 20 | switch ( $schedule->get_reoccurrence() ) : |
||
| 21 | |||
| 22 | case 'hourly' : |
||
| 23 | |||
| 24 | $reoccurrence = date_i18n( 'i', $schedule->get_next_occurrence( false ) ) === '00' ? '<span ' . $next_backup . '>' . __( 'hourly on the hour', 'backupwordpress' ) . '</span>' : sprintf( __( 'hourly at %s minutes past the hour', 'backupwordpress' ), '<span ' . $next_backup . '>' . intval( date_i18n( 'i', $schedule->get_next_occurrence( false ) ) ) ) . '</span>'; |
||
| 25 | |||
| 26 | break; |
||
| 27 | |||
| 28 | case 'daily' : |
||
| 29 | |||
| 30 | $reoccurrence = sprintf( __( 'daily at %s', 'backupwordpress' ), '<span ' . $next_backup . '>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' ); |
||
| 31 | |||
| 32 | break; |
||
| 33 | |||
| 34 | case 'twicedaily' : |
||
| 35 | |||
| 36 | $times[] = date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ); |
||
| 37 | $times[] = date_i18n( get_option( 'time_format' ), strtotime( '+ 12 hours', $schedule->get_next_occurrence( false ) ) ); |
||
| 38 | |||
| 39 | sort( $times ); |
||
| 40 | |||
| 41 | $reoccurrence = sprintf( __( 'every 12 hours at %1$s & %2$s', 'backupwordpress' ), '<span ' . $next_backup . '>' . esc_html( reset( $times ) ) . '</span>', '<span>' . esc_html( end( $times ) ) ) . '</span>'; |
||
| 42 | |||
| 43 | break; |
||
| 44 | |||
| 45 | View Code Duplication | case 'weekly' : |
|
| 46 | |||
| 47 | $reoccurrence = sprintf( __( 'weekly on %1$s at %2$s', 'backupwordpress' ), '<span ' . $next_backup . '>' .esc_html( $day ) . '</span>', '<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' ); |
||
| 48 | |||
| 49 | break; |
||
| 50 | |||
| 51 | View Code Duplication | case 'fortnightly' : |
|
| 52 | |||
| 53 | $reoccurrence = sprintf( __( 'every two weeks on %1$s at %2$s', 'backupwordpress' ), '<span ' . $next_backup . '>' . $day . '</span>', '<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' ); |
||
| 54 | |||
| 55 | break; |
||
| 56 | |||
| 57 | View Code Duplication | case 'monthly' : |
|
| 58 | |||
| 59 | $reoccurrence = sprintf( __( 'on the %1$s of each month at %2$s', 'backupwordpress' ), '<span ' . $next_backup . '>' . esc_html( date_i18n( 'jS', $schedule->get_next_occurrence( false ) ) ) . '</span>', '<span>' . esc_html( date_i18n( get_option( 'time_format' ), $schedule->get_next_occurrence( false ) ) ) . '</span>' ); |
||
| 60 | |||
| 61 | break; |
||
| 62 | |||
| 63 | case 'manually' : |
||
| 64 | |||
| 65 | $reoccurrence = __( 'manually', 'backupwordpress' ); |
||
| 66 | |||
| 67 | break; |
||
| 68 | |||
| 69 | default : |
||
| 70 | |||
| 71 | $reoccurrence = __( 'manually', 'backupwordpress' ); |
||
| 72 | $schedule->set_reoccurrence( 'manually' ); |
||
| 73 | |||
| 74 | endswitch; |
||
| 75 | |||
| 76 | $server = '<code title="' . __( 'Check the help tab to learn how to change where your backups are stored.', 'backupwordpress' ) . '">' . esc_attr( str_replace( Path::get_home_path(), '', Path::get_path() ) ) . '</code>'; |
||
| 77 | |||
| 78 | // Backup to keep |
||
| 79 | switch ( $schedule->get_max_backups() ) : |
||
| 80 | |||
| 81 | case 1 : |
||
| 82 | |||
| 83 | $backup_to_keep = sprintf( __( 'store the most recent backup in %s', 'backupwordpress' ), $server ); |
||
| 84 | |||
| 85 | break; |
||
| 86 | |||
| 87 | case 0 : |
||
| 88 | |||
| 89 | $backup_to_keep = sprintf( __( 'don\'t store any backups in on this server', 'backupwordpress' ), Path::get_path() ); |
||
| 90 | |||
| 91 | break; |
||
| 92 | |||
| 93 | default : |
||
| 94 | |||
| 95 | $backup_to_keep = sprintf( __( 'store the last %1$s backups in %2$s', 'backupwordpress' ), esc_html( $schedule->get_max_backups() ), $server ); |
||
| 96 | |||
| 97 | endswitch; |
||
| 98 | |||
| 99 | $email_msg = ''; |
||
| 100 | $services = array(); |
||
| 101 | |||
| 102 | foreach ( Services::get_services( $schedule ) as $file => $service ) { |
||
| 103 | |||
| 104 | if ( is_wp_error( $service ) ) { |
||
| 105 | $email_msg = $service->get_error_message(); |
||
|
0 ignored issues
–
show
|
|||
| 106 | } elseif ( 'Email' === $service->name ) { |
||
| 107 | $email_msg = wp_kses_post( $service->display() ); |
||
| 108 | } elseif ( $service->is_service_active() && $service->display() ) { |
||
| 109 | $services[] = esc_html( $service->display() ); |
||
| 110 | } |
||
| 111 | } |
||
| 112 | |||
| 113 | if ( ! empty( $services ) && count( $services ) > 1 ) { |
||
| 114 | $services[ count( $services ) -2 ] .= ' & ' . $services[ count( $services ) -1 ]; |
||
| 115 | array_pop( $services ); |
||
| 116 | } ?> |
||
| 117 | |||
| 118 | <div class="hmbkp-schedule-sentence<?php if ( $status->get_status() ) { ?> hmbkp-running<?php } ?>"> |
||
| 119 | |||
| 120 | <?php $sentence = sprintf( _x( 'Backup my %1$s %2$s %3$s, %4$s.', '1: Backup Type 2: Total size of backup 3: Schedule 4: Number of backups to store', 'backupwordpress' ), '<span>' . esc_html( $type ) . '</span>', $filesize, $reoccurrence, $backup_to_keep ); |
||
| 121 | |||
| 122 | if ( $email_msg ) { |
||
| 123 | $sentence .= ' ' . $email_msg; |
||
| 124 | } |
||
| 125 | |||
| 126 | if ( $services ) { |
||
|
0 ignored issues
–
show
The expression
$services of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent. Consider making the comparison explicit by using Loading history...
|
|||
| 127 | $sentence .= ' ' . sprintf( __( 'Send a copy of each backup to %s.', 'backupwordpress' ), implode( ', ', $services ) ); |
||
| 128 | } |
||
| 129 | |||
| 130 | echo $sentence; ?> |
||
| 131 | |||
| 132 | <?php if ( Schedules::get_instance()->get_schedule( $schedule->get_id() ) ) : |
||
| 133 | schedule_status( $schedule ); |
||
| 134 | endif; ?> |
||
| 135 | |||
| 136 | <?php require( HMBKP_PLUGIN_PATH . 'admin/schedule-settings.php' ); ?> |
||
| 137 | |||
| 138 | </div> |
||
| 139 | |||
| 140 | <?php |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Returns a formatted string containing the calculated total site size or a message |
||
| 144 | * to indicate it is being calculated. |
||
| 145 | * |
||
| 146 | * @param HM\BackUpWordPress\Scheduled_Backup $schedule |
||
| 147 | * |
||
| 148 | * @return string |
||
| 149 | */ |
||
| 150 | function get_site_size_text( Scheduled_Backup $schedule ) { |
||
| 151 | |||
| 152 | if ( isset( $_GET['hmbkp_add_schedule'] ) ) { |
||
| 153 | return ''; |
||
| 154 | } |
||
| 155 | |||
| 156 | $site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() ); |
||
| 157 | |||
| 158 | if ( 'database' === $schedule->get_type() || $site_size->is_site_size_cached() ) { |
||
| 159 | return sprintf( |
||
| 160 | '(<code title="' . __( 'Backups will be compressed and should be smaller than this.', 'backupwordpress' ) . '">%s</code>)', |
||
| 161 | esc_html( $site_size->get_formatted_site_size() ) |
||
| 162 | ); |
||
| 163 | } |
||
| 164 | |||
| 165 | return ''; |
||
| 166 | } |
||
| 167 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.