Plugin Directory

Changeset 2688856


Ignore:
Timestamp:
03/04/2022 11:46:14 AM (4 years ago)
Author:
aaf017
Message:

Reordering optionnal parameters => PHP8 deprecated warnings

Location:
wp-cassify/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-cassify/trunk/admin/admin-menu.php

    r2287310 r2688856  
    12261226               
    12271227                // General settings
    1228                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_base_url', FALSE, $this->wp_cassify_network_activated );                       
    1229                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_protocol_version', FALSE, $this->wp_cassify_network_activated );
     1228                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_base_url', $this->wp_cassify_network_activated, FALSE );                       
     1229                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_protocol_version', $this->wp_cassify_network_activated, FALSE );
    12301230                WP_Cassify_Utils::wp_cassify_update_checkbox( $_POST, 'wp_cassify_disable_authentication', 'disabled', $this->wp_cassify_network_activated );
    12311231                WP_Cassify_Utils::wp_cassify_update_checkbox( $_POST, 'wp_cassify_create_user_if_not_exist', 'create_user_if_not_exist', $this->wp_cassify_network_activated );
     
    12361236                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_ssl_cipher', TRUE, $this->wp_cassify_network_activated );
    12371237                WP_Cassify_Utils::wp_cassify_update_checkbox( $_POST, 'wp_cassify_ssl_check_certificate', 'enabled', $this->wp_cassify_network_activated );
    1238                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_curlopt_cainfo', FALSE, $this->wp_cassify_network_activated );
    1239                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_curlopt_capath', FALSE, $this->wp_cassify_network_activated );
     1238                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_curlopt_cainfo', $this->wp_cassify_network_activated, FALSE );
     1239                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_curlopt_capath', $this->wp_cassify_network_activated, FALSE );
    12401240
    12411241                // Url settings
    1242                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_after_logout', FALSE, $this->wp_cassify_network_activated );
    1243                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_override_service_url', FALSE, $this->wp_cassify_network_activated );
    1244                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_login_servlet', FALSE, $this->wp_cassify_network_activated );
    1245                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_logout_servlet', FALSE, $this->wp_cassify_network_activated );
     1242                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_after_logout', $this->wp_cassify_network_activated, FALSE );
     1243                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_override_service_url', $this->wp_cassify_network_activated, FALSE );
     1244                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_login_servlet', $this->wp_cassify_network_activated, FALSE );
     1245                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_logout_servlet', $this->wp_cassify_network_activated, FALSE );
    12461246               
    12471247                if ( $_POST[ 'wp_cassify_protocol_version' ] == '3' ) {
     
    12611261               
    12621262                // Attributes extraction settings
    1263                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_xpath_query_to_extact_cas_user', FALSE, $this->wp_cassify_network_activated );
    1264                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_xpath_query_to_extact_cas_attributes', FALSE, $this->wp_cassify_network_activated );
    1265                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_attributes_list', FALSE, $this->wp_cassify_network_activated );
     1263                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_xpath_query_to_extact_cas_user', $this->wp_cassify_network_activated, FALSE );
     1264                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_xpath_query_to_extact_cas_attributes', $this->wp_cassify_network_activated, FALSE );
     1265                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_attributes_list', $this->wp_cassify_network_activated, FALSE );
    12661266               
    12671267                // Authorization rules settings
    1268                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_allow_deny_order', FALSE, $this->wp_cassify_network_activated );
     1268                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_allow_deny_order', $this->wp_cassify_network_activated, FALSE );
    12691269                WP_Cassify_Utils::wp_cassify_update_multiple_select( $_POST, 'wp_cassify_autorization_rules', $this->wp_cassify_network_activated );
    1270                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_if_not_allowed', FALSE, $this->wp_cassify_network_activated );
    1271                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_white_list', FALSE, $this->wp_cassify_network_activated );
     1270                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_if_not_allowed', $this->wp_cassify_network_activated, FALSE );
     1271                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_redirect_url_white_list', $this->wp_cassify_network_activated, FALSE );
    12721272               
    12731273                // User roles rules settings
     
    12791279               
    12801280                // Notification settings
    1281                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_host', FALSE, $this->wp_cassify_network_activated );
    1282                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_port', FALSE, $this->wp_cassify_network_activated );
    1283                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_encryption_type', FALSE, $this->wp_cassify_network_activated );
     1281                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_host', $this->wp_cassify_network_activated, FALSE );
     1282                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_port', $this->wp_cassify_network_activated, FALSE );
     1283                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_encryption_type', $this->wp_cassify_network_activated, FALSE );
    12841284                WP_Cassify_Utils::wp_cassify_update_checkbox( $_POST, 'wp_cassify_notifications_smtp_auth', 'enabled', $this->wp_cassify_network_activated );
    1285                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_salt', FALSE, $this->wp_cassify_network_activated );
    1286                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_priority', FALSE, $this->wp_cassify_network_activated );
    1287                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_user', FALSE, $this->wp_cassify_network_activated );
     1285                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_salt', $this->wp_cassify_network_activated, FALSE );
     1286                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_priority', $this->wp_cassify_network_activated, FALSE );
     1287                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_user', $this->wp_cassify_network_activated, FALSE );
    12881288
    12891289                // Store smtp password as encrypted string
     
    13111311                }
    13121312
    1313                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_from', FALSE, $this->wp_cassify_network_activated );
    1314                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_to', FALSE, $this->wp_cassify_network_activated );
    1315                 WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_subject_prefix', FALSE, $this->wp_cassify_network_activated );
     1313                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_from', $this->wp_cassify_network_activated, FALSE );
     1314                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_smtp_to', $this->wp_cassify_network_activated, FALSE );
     1315                WP_Cassify_Utils::wp_cassify_update_textfield( $_POST, 'wp_cassify_notifications_subject_prefix', $this->wp_cassify_network_activated, FALSE );
    13161316
    13171317                // Notifications rules settings
     
    13701370                        $wp_cassify_notifications_priority,
    13711371                        esc_attr( WP_Cassify_Utils::wp_cassify_get_option( $this->wp_cassify_network_activated, 'wp_cassify_notifications_smtp_host' ) ),
    1372                         esc_attr( WP_Cassify_Utils::wp_cassify_get_option( $this->wp_cassify_network_activated, 'wp_cassify_notifications_smtp_port' ) ),
    1373                         $wp_cassify_notifications_smtp_auth_enabled,
    13741372                        $wp_cassify_notifications_encryption_type,
    13751373                        $wp_cassify_notifications_smtp_user,
    1376                         $wp_cassify_notifications_smtp_password
     1374                        $wp_cassify_notifications_smtp_password,
     1375                        esc_attr( WP_Cassify_Utils::wp_cassify_get_option( $this->wp_cassify_network_activated, 'wp_cassify_notifications_smtp_port' ) ),
     1376                        $wp_cassify_notifications_smtp_auth_enabled
    13771377                    );
    13781378                   
     
    15091509               
    15101510                WP_Cassify_Utils::wp_cassify_import_configuration_options(
    1511                     $wp_cassify_import_configuration_options,
    1512                     $this->wp_cassify_network_activated
     1511                    $this->wp_cassify_network_activated,
     1512                    $wp_cassify_import_configuration_options
    15131513                );
    15141514                           
  • wp-cassify/trunk/classes/wp_cassify_plugin.php

    r2688825 r2688856  
    446446                   
    447447                    // Force logout if user is not allowed.
    448                     if (! $this->wp_cassify_is_user_allowed( $cas_user_datas, $wp_cassify_allow_deny_order ) ) {
     448                    if (! $this->wp_cassify_is_user_allowed( $wp_cassify_allow_deny_order, $cas_user_datas ) ) {
    449449                        $this->wp_cassify_logout_if_not_allowed( 'user_is_not_allowed' );
    450450                    }   
     
    506506               
    507507                // Set wordpress user roles if defined in plugin admin settings
    508                 $roles_to_push = $this->wp_cassify_get_roles_to_push( $cas_user_datas, $wp_cassify_user_role_rules, $this->wp_cassify_network_activated, $current_blog_id );
     508                $roles_to_push = $this->wp_cassify_get_roles_to_push( $current_blog_id, $cas_user_datas, $wp_cassify_user_role_rules, $this->wp_cassify_network_activated );
    509509               
    510510                // Define custom plugin filter to override list roles to push.
     
    11481148    /**
    11491149     * Check if user is allow to connect according to autorization rules.
    1150      * @param array $cas_user_datas                 Associative array containing CAS userID and attributes
    1151      * @param string $wp_cassify_allow_deny_order   Order to process authorization rules.
    1152      * @return bool $is_user_allowed                Return true if user is allowed to connect. Return false on the other hand.
    1153      */
    1154     private function wp_cassify_is_user_allowed( $cas_user_datas = array(), $wp_cassify_allow_deny_order ) {
     1150     *
     1151     * @param string    $wp_cassify_allow_deny_order    Order to process authorization rules.
     1152     * @param array     $cas_user_datas                 Associative array containing CAS userID and attributes
     1153     *
     1154     * @return bool     $is_user_allowed                Return true if user is allowed to connect. Return false on the other hand.
     1155     */
     1156    private function wp_cassify_is_user_allowed( $wp_cassify_allow_deny_order, $cas_user_datas = array() ) {
    11551157
    11561158        $is_user_allowed = false;
     
    12251227    /**
    12261228     * Check if user is matched by Conditionnal Rule
     1229     *
     1230     * @param   string  $wp_cassify_rule    WP Cassify rule
    12271231     * @param   array   $cas_user_datas     Associative array containing CAS userID and attributes
    1228      * @param   string  $wp_cassify_rule    WP Cassify rule
     1232     *
    12291233     * @return  bool    $rule_matched       Return true if WP Cassify rule assertion is verified. Return false on the other hand.
    12301234     */
    1231     private function wp_cassify_rule_matched( $cas_user_datas = array(), $wp_cassify_rule ) {
     1235    private function wp_cassify_rule_matched( $wp_cassify_rule, $cas_user_datas = array() ) {
    12321236
    12331237        $rule_matched = false;
     
    12681272                $expiration_rule_value = stripslashes( $expiration_rule_parts[2] );
    12691273               
    1270                 if ( $this->wp_cassify_rule_matched( $cas_user_datas, $expiration_rule_value ) ) {
     1274                if ( $this->wp_cassify_rule_matched( $expiration_rule_value, $cas_user_datas ) ) {
    12711275                   
    12721276                    switch( $expiration_rule_type ) {
     
    12981302    /**
    12991303     * Check if user is matched by Notification Rule
     1304     *
     1305     * @param int       $current_blog_id    The id of the current blog
    13001306     * @param array     $cas_user_datas     Associative array containing CAS userID and attributes
    13011307     * @param array     $role_rules         Array containing all role rules
    13021308     * @param bool      $network_activated  True if plugin is activated over the network
    1303      * @param int       $current_blog_id    The id of the current blog
     1309     *
    13041310     * @return array    $roles_to_push      Array containing roles to push to user
    13051311     */     
    1306     private function wp_cassify_get_roles_to_push( $cas_user_datas = array(), $role_rules = array(), $network_activated = false, $current_blog_id ) {
     1312    private function wp_cassify_get_roles_to_push( $current_blog_id, $cas_user_datas = array(), $role_rules = array(), $network_activated = false ) {
    13071313       
    13081314        $roles_to_push = array();
     
    13211327                        // role_rule_blog_id == 0 match "ALL BLOGS"
    13221328                        if ( ( $role_rule_blog_id == $current_blog_id ) || ( $role_rule_blog_id == 0 ) ) {
    1323                             if ( $this->wp_cassify_rule_matched( $cas_user_datas, $role_rule_expression ) ) {
     1329                            if ( $this->wp_cassify_rule_matched( $role_rule_expression, $cas_user_datas ) ) {
    13241330                                array_push( $roles_to_push, $role_rule_key );
    13251331                            }
     
    13321338                        $role_rule_expression = stripslashes( $role_rule_parts[1] );
    13331339       
    1334                         if ( $this->wp_cassify_rule_matched( $cas_user_datas, $role_rule_expression ) ) {
     1340                        if ( $this->wp_cassify_rule_matched( $role_rule_expression, $cas_user_datas ) ) {
    13351341                            array_push( $roles_to_push, $role_rule_key );
    13361342                        }
     
    13631369                   
    13641370                    if ( $notification_rule_key == $trigger_name ) {
    1365                         if ( $this->wp_cassify_rule_matched( $cas_user_datas, $notification_rule_expression ) ) {
     1371                        if ( $this->wp_cassify_rule_matched( $notification_rule_expression, $cas_user_datas ) ) {
    13661372                            $notification_rule_matched = true;
    13671373                        }                       
     
    15021508            $wp_cassify_notifications_priority,
    15031509            esc_attr( WP_Cassify_Utils::wp_cassify_get_option( $this->wp_cassify_network_activated, 'wp_cassify_notifications_smtp_host' ) ),
     1510            $wp_cassify_notifications_encryption_type,
     1511            $wp_cassify_notifications_smtp_user,
     1512            $wp_cassify_notifications_smtp_password,
    15041513            esc_attr( WP_Cassify_Utils::wp_cassify_get_option( $this->wp_cassify_network_activated, 'wp_cassify_notifications_smtp_port' ) ),
    15051514            $wp_cassify_notifications_smtp_auth_enabled,
    1506             $wp_cassify_notifications_encryption_type,
    1507             $wp_cassify_notifications_smtp_user,
    1508             $wp_cassify_notifications_smtp_password
    15091515        );
    15101516       
  • wp-cassify/trunk/classes/wp_cassify_utils.php

    r2248092 r2688856  
    424424    /**
    425425     * Save plugin options stored in form textfield into database.
     426     *
    426427     * @param array     $post_array                     $_POST array passed by reference
    427428     * @param string    $field_name                     Form field name.
     429     * @param bool      $network_activated              TRUE if plugin is activated on network. false if not.
    428430     * @param bool      $do_not_check_empty             Empty values are accepted.
    429      * @param bool      $network_activated              TRUE if plugin is activated on network. false if not.
    430431     */
    431     public static function wp_cassify_update_textfield( &$post_array, $field_name, $do_not_check_empty = false, $wp_cassify_network_activated ) {
     432    public static function wp_cassify_update_textfield( &$post_array, $field_name, $wp_cassify_network_activated, $do_not_check_empty = false ) {
    432433
    433434        $field_value = '';
     
    595596    /**
    596597     * Import all plugins configuration options
     598     *
     599     * @param bool      $wp_cassify_network_activated
    597600     * @param array     $wp_cassify_import_configuration_options
    598      * @param bool      $wp_cassify_network_activated
    599601     */
    600     public static function wp_cassify_import_configuration_options( $wp_cassify_import_configuration_options = array(), $wp_cassify_network_activated ) {
     602    public static function wp_cassify_import_configuration_options( $wp_cassify_network_activated, $wp_cassify_import_configuration_options = array() ) {
    601603
    602604        global $wpdb;
     
    627629    /**
    628630     * Function used by plugin to send mail.
     631     *
    629632     * @param   string  $from           Sender email address
    630633     * @param   string  $to             Recipient email address
     
    632635     * @param   string  $body           Body message
    633636     * @param   string  $smtp_host      Ip or fqdn of smtp host
     637     * @param   string  $smtp_password  Smtp password
     638     * @return  bool    $send_result    Return TRUE if mail is sended correctly. FAIL if not.
    634639     * @param   string  $smtp_port      Port used by smtp host
    635640     * @param   string  $smtp_auth      Cipher used if authentication
    636      * @param   string  $smtp_password  Smtp password
    637      * @return  bool    $send_result    Return TRUE if mail is sended correctly. FAIL if not.
    638      */
    639     public static function wp_cassify_sendmail( $from, $to, $subject, $body, $priority, $smtp_host, $smtp_port = 25, $smtp_auth = false, $smtp_encryption_type, $smtp_user, $smtp_password ) {
     641     */
     642    public static function wp_cassify_sendmail( $from, $to, $subject, $body, $priority, $smtp_host, $smtp_encryption_type, $smtp_user, $smtp_password, $smtp_port = 25, $smtp_auth = false ) {
    640643       
    641644        // Initialize phpmailer class
Note: See TracChangeset for help on using the changeset viewer.