$orig_action = $action; $event_args = (object) array( 'orig_action' => $orig_action, 'action' => self::prefix( $action ), 'callback' => $callback, 'priority' => $priority ); do_action( self::prefix( 'add_action_before' ), $event_args ); // Revert original action in case it changed $event_args->orig_action = $orig_action; // A filter, for consistency $event_args->action = apply_filters( self::prefix( 'add_action' ), $event_args->action, $event_args ); // Revert original action in case it changed $event_args->orig_action = $orig_action; $event_args->is_added = !empty( $event_args->action ); if ( $event_args->is_added ) $event_args->is_added = add_action( $event_args->action, $event_args->callback, $event_args->priority, 1 ); // Revert original action in case it changed $event_args->orig_action = $orig_action; do_action( self::prefix( 'add_action_after' ), clone $event_args ); return $event_args; } } /** * Generate the singleton instance for the first time. */ WPRSS_FTP::get_instance();
/** * Renders the activate/deactivate license button. * * @since 1.0 */ public function license_activation_callback() { $status = WPRSS_FTP::get_instance()->get_license_status(); if ( $status === 'site_inactive' ) $status = 'inactive'; $valid = $status == 'valid'; $btn_text = $valid ? 'Deactivate License' : 'Activate License'; $btn_name = 'wprss_ftp_license_' . ( $valid? 'deactivate' : 'activate' ); wp_nonce_field( 'wprss_ftp_license_nonce', 'wprss_ftp_license_nonce' ); ?> <input type="submit" class="button-secondary" name="<?php echo $btn_name; ?>" value="<?php _e( $btn_text, WPRSS_TEXT_DOMAIN ); ?>" /> <span id="wprss-ftp-license-status-text"> <strong>Status: <span class="wprss-ftp-license-<?php echo $status; ?>"> <?php _e( ucfirst($status), 'wprss' ); ?> <?php if ( $status === 'valid' ) : ?> <i class="fa fa-check"></i> <?php elseif( $status === 'invalid' ): ?> <i class="fa fa-times"></i> <?php elseif( $status === 'inactive' ): ?> <i class="fa fa-warning"></i> <?php endif; ?> </strong> </span> </span> <style type="text/css"> .wprss-ftp-license-valid { color: green; } .wprss-ftp-license-invalid { color: #b71919; } .wprss-ftp-license-inactive { color: #d19e5b; } #wprss-ftp-license-status-text { margin-left: 8px; line-height: 27px; vertical-align: middle; } </style> <?php }