Plugin Directory

Changeset 3331817


Ignore:
Timestamp:
07/22/2025 01:25:29 AM (8 months ago)
Author:
vasyltech
Message:

Official 7.0.7

Location:
advanced-access-manager
Files:
595 added
6 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • advanced-access-manager/trunk/aam.php

    r3315883 r3331817  
    44 * Plugin Name: Advanced Access Manager
    55 * Description: Powerfully robust WordPress plugin designed to help you control every aspect of your website, your way.
    6  * Version: 7.0.6
     6 * Version: 7.0.7
    77 * Author: VasylTech LLC <support@aamplugin.com>
    88 * Author URI: https://aamportal.com
     
    285285    define('AAM_MEDIA', plugins_url('/media', __FILE__));
    286286    define('AAM_KEY', 'advanced-access-manager');
    287     define('AAM_VERSION', '7.0.6');
     287    define('AAM_VERSION', '7.0.7');
    288288    define('AAM_BASEDIR', __DIR__);
    289289
  • advanced-access-manager/trunk/application/Framework/Policy/Marker.php

    r3286780 r3331817  
    88 */
    99
    10 use Vectorface\Whip\Whip;
     10use Vectorface\Whip\Whip,
     11    DeviceDetector\ClientHints,
     12    DeviceDetector\DeviceDetector,
     13    DeviceDetector\Parser\Client\Browser,
     14    DeviceDetector\Parser\OperatingSystem;
    1115
    1216/**
     
    2529     * @access protected
    2630     *
    27      * @version 7.0.0
     31     * @version 7.0.7
    2832     */
    2933    protected static $map = array(
    3034        'USER'              => 'AAM_Framework_Policy_Marker::get_user_value',
     35        'USER_AGENT'        => 'AAM_Framework_Policy_Marker::get_user_agent',
    3136        'USER_OPTION'       => 'AAM_Framework_Policy_Marker::get_user_option_value',
    3237        'USER_META'         => 'AAM_Framework_Policy_Marker::get_user_meta_value',
     
    3742        'HTTP_COOKIE'       => 'AAM_Framework_Policy_Marker::get_cookie',
    3843        'PHP_SERVER'        => 'AAM_Framework_Policy_Marker::get_server',
    39         'PHP_GLOBAL'        => 'AAM_Framework_Policy_Marker::get_global_variable',
    40         'ARGS'              => 'AAM_Framework_Policy_Marker::get_arg_value',
     44        'CALLBACK'          => 'AAM_Framework_Policy_Marker::get_from_callback',
    4145        'ENV'               => 'getenv',
    4246        'CONST'             => 'AAM_Framework_Policy_Marker::get_constant',
     
    4852        'WP_NETWORK_OPTION' => 'AAM_Framework_Policy_Marker::get_network_option',
    4953        'THE_POST'          => 'AAM_Framework_Policy_Marker::get_current_post_prop',
    50         'JWT'               => 'AAM_Framework_Policy_Marker::get_jwt_claim'
     54        'JWT'               => 'AAM_Framework_Policy_Marker::get_jwt_claim',
     55        // Below markers can have complex xpath - they are treated differently
     56        'PHP_GLOBAL'        => 'AAM_Framework_Policy_Marker::get_global_variable',
     57        'ARGS'              => 'AAM_Framework_Policy_Marker::get_arg_value',
     58        'AAM_API'           => 'AAM_Framework_Policy_Marker::get_api',
    5159    );
    5260
    5361    /**
    5462     * Evaluate expression and replace markers
     63     *
     64     * The following method takes into consideration the following scenarios:
     65     * - Literal values: 1, "hello", true, 3.4 or [1,2,3]
     66     * - Single marker: "${PHP_GLOBAL.env}"
     67     * - Single marker with static addition: "${PHP_QUERY.ref}-more"
     68     * - Multiple marker with or without addition: "${WP_USER.first}-${WP_USER.last}"
     69     * - All above with typecast
    5570     *
    5671     * @param string  $exp
    5772     * @param array   $args
    58      * @param boolean $type_cast [Optional]
     73     * @param boolean $typecast [Optional]
    5974     *
    6075     * @return mixed
    6176     * @access public
    6277     *
    63      * @version 7.0.0
    64      */
    65     public static function execute($exp, $args = [], $type_cast = true)
    66     {
    67         if (preg_match_all('/(\$\{[^}]+\})/', $exp, $match)) {
    68             foreach ($match[1] as $marker) {
    69                 $value = self::get_marker_value($marker, $args);
    70                 $value = is_null($value) ? '' : $value;
    71 
    72                 // Replace marker in the expression BUT ONLY if there are multiple
    73                 // markers in the expression
    74                 if (count($match[1]) > 1) {
    75                     $exp = str_replace(
    76                         $marker,
    77                         (is_scalar($value) ? $value : json_encode($value)),
    78                         $exp
    79                     );
    80                 } else {
    81                     $exp = $value;
     78     * @version 7.0.7
     79     */
     80    public static function execute($exp, $args = [], $typecast = true)
     81    {
     82        if (is_string($exp)) { // Evaluate only strings
     83            // Removing typecast so we have a clean marker set
     84            $clean        = preg_replace('/^\(\*([\w]+)\)/i', '', $exp);
     85            $has_typecast = strlen($clean) !== strlen($exp);
     86
     87            if (preg_match_all('/(\$\{[^}]+\})/', $clean, $match)) {
     88                // Iterate over each marker in the expression and concatenate it
     89                // all into one string. Take into consideration that some markers may
     90                // return not a scalar value
     91                $multi_markers = count($match[1]) > 1;
     92                $result        = $multi_markers ? $clean : '';
     93
     94                foreach ($match[1] as $marker) {
     95                    $token = self::get_marker_value($marker, $args);
     96
     97                    // If multiple markers are in the expression, apply a specific way
     98                    // of merging them into one string
     99                    if ($multi_markers) {
     100                        if (is_bool($token)) {
     101                            $token = $token ? 'true' : 'false';
     102                        } elseif (is_null($token)) {
     103                            $token = '';
     104                        } elseif (is_scalar($token)) {
     105                            $token = (string) $token;
     106                        } else {
     107                            $token = json_encode($token);
     108                        }
     109
     110                        $result = str_replace($marker, $token, $result);
     111                    } elseif (strlen($clean) !== strlen($marker)) { // Has addition?
     112                        $result = str_replace($marker, (string) $token, $clean);
     113                    } else {
     114                        $result = $token;
     115                    }
    82116                }
    83             }
    84         }
    85 
    86         // Perform type casting if necessary
    87         return $type_cast ? AAM_Framework_Policy_Typecast::execute($exp) : $exp;
     117            } else { // Just pass whatever is (e.g. "(*int)5" or "true")
     118                $result = $clean;
     119            }
     120
     121            // Perform type casting if necessary
     122            if ($has_typecast && $typecast) {
     123                $result = AAM_Framework_Policy_Typecast::execute($exp, $result);
     124            }
     125        } else {
     126            $result = $exp;
     127        }
     128
     129        return $result;
    88130    }
    89131
     
    97139     * @access public
    98140     *
    99      * @version 7.0.0
     141     * @version 7.0.7
    100142     */
    101143    public static function get_marker_value($marker, $args = [])
    102144    {
    103         $parts = explode('.', preg_replace('/^\$\{([^}]+)\}$/', '${1}', $marker), 2);
    104 
    105         if (array_key_exists($parts[0], self::$map)) {
    106             if ($parts[0] === 'ARGS') {
    107                 $value = call_user_func(self::$map[$parts[0]], $parts[1], $args);
     145        // Stripping the marker wrapper if present ${}
     146        if (strpos($marker, '${') === 0) {
     147            $marker = trim($marker, '${}');
     148        }
     149
     150        // Splitting marker into
     151        $segments = explode('.', $marker, 2);
     152
     153        if (count($segments) === 2) { // Marker has to have source and xpath
     154            if (array_key_exists($segments[0], self::$map)) {
     155                $value = call_user_func(
     156                    self::$map[$segments[0]],
     157                    $segments[1],
     158                    $args
     159                );
    108160            } else {
    109                 $value = call_user_func(self::$map[$parts[0]], $parts[1], $args);
    110             }
    111         } elseif ($parts[0] === 'CALLBACK') {
    112             $value = self::evaluate_callback($parts[1], $args);
     161                $value = apply_filters(
     162                    'aam_policy_marker_value_filter',
     163                    null,
     164                    $segments[0],
     165                    $segments[1],
     166                    $args
     167                );
     168            }
    113169        } else {
    114             $value = apply_filters(
    115                 'aam_policy_marker_value_filter', null, $parts[0], $parts[1], $args
     170            _doing_it_wrong(
     171                __CLASS__ . '::' . __METHOD__,
     172                sprintf('Invalid marker: %s', $marker),
     173                AAM_VERSION
    116174            );
     175
     176            $value = null;
    117177        }
    118178
    119179        return $value;
    120     }
    121 
    122     /**
    123      * Evaluate CALLBACK expression
    124      *
    125      * @param string $exp
    126      * @param array  $args
    127      *
    128      * @return mixed
    129      * @access protected
    130      *
    131      * @version 7.0.0
    132      */
    133     protected static function evaluate_callback($exp, $args)
    134     {
    135         $response = null;
    136         $cb       = self::_parse_function($exp, $args);
    137 
    138         if (!is_null($cb)) {
    139             if (is_callable($cb['func']) || function_exists($cb['func'])) {
    140                 $result = call_user_func_array($cb['func'], $cb['args']);
    141 
    142                 if (!empty($cb['xpath'])) {
    143                     $response = AAM_Framework_Policy_Xpath::get_value_by_xpath(
    144                         $result, $cb['xpath']
    145                     );
    146                 } else {
    147                     $response = $result;
    148                 }
    149             }
    150         }
    151 
    152         return $response;
    153     }
    154 
    155     /**
    156      * Parse CALLBACK expression
    157      *
    158      * @param string $exp
    159      * @param array  $args
    160      *
    161      * @return array
    162      * @access private
    163      *
    164      * @version 7.0.0
    165      */
    166     private static function _parse_function($exp, $args)
    167     {
    168         $response = null;
    169         $regex    = '/^([^(]+)\(?([^)]*)\)?(.*)$/i';
    170 
    171         if (preg_match($regex, $exp, $match)) {
    172             // The second part is the collection of arguments that we pass to
    173             // the function
    174             $markers = array_map('trim', explode(',', $match[2]));
    175             $values  = [];
    176 
    177             foreach($markers as $marker) {
    178                 if (preg_match('/^\'.*\'$/', $marker) === 1) { // This is literal string
    179                     array_push($values, trim($marker, '\''));
    180                 } elseif (strpos($marker, '.') !== false) { // Potentially another marker
    181                     array_push(
    182                         $values,
    183                         self::get_marker_value('${' . $marker . '}', $args)
    184                     );
    185                 } else {
    186                     array_push($values, $marker);
    187                 }
    188             }
    189 
    190             $response = array(
    191                 'func'  => trim($match[1]),
    192                 'args'  => $values,
    193                 'xpath' => trim($match[3])
    194             );
    195         }
    196 
    197         return $response;
    198180    }
    199181
     
    255237
    256238    /**
     239     * Get USER_AGENT value
     240     *
     241     * This marker utilizes the Device Detector functionality
     242     *
     243     * @param string $xpath
     244     *
     245     * @return string
     246     * @access protected
     247     *
     248     * @version 7.0.7
     249     */
     250    protected static function get_user_agent($xpath)
     251    {
     252        $detector = new DeviceDetector(
     253            AAM_Framework_Manager::_()->misc->get($_SERVER, 'HTTP_USER_AGENT'),
     254            ClientHints::factory($_SERVER)
     255        );
     256
     257        $detector->parse();
     258
     259        // Normalize the path
     260        $prop = strtolower($xpath);
     261
     262        // If xpath starts with "is", assume methods like isSmartphone or isTv
     263        if (strpos($xpath, 'is') === 0) {
     264            $value = call_user_func([$detector, $xpath]);
     265        } elseif (in_array($prop, [ 'getosfamily', 'osfamily' ], true)) {
     266            $value = OperatingSystem::getOsFamily($detector->getOs('name'));
     267        }  elseif (in_array($prop, [ 'getbrowserfamily', 'browserfamily' ], true)) {
     268            $value = Browser::getBrowserFamily($detector->getClient('name'));
     269        } else {
     270            $value = null;
     271        }
     272
     273        return $value;
     274    }
     275
     276    /**
    257277     * Get user option value(s)
    258278     *
     
    313333
    314334        return $result;
    315     }
    316 
    317     /**
    318      * Get inline argument
    319      *
    320      * @param string $xpath
    321      * @param array  $args
    322      *
    323      * @return mixed
    324      * @access protected
    325      *
    326      * @version 7.0.0
    327      */
    328     protected static function get_arg_value($xpath, $args)
    329     {
    330         return AAM_Framework_Policy_Xpath::get_value_by_xpath($args, $xpath);
    331335    }
    332336
     
    552556
    553557    /**
    554      * Get global variable's value
    555      *
    556      * @param string $xpath
    557      *
    558      * @return mixed
    559      * @access protected
    560      *
    561      * @version 7.0.0
    562      */
    563     protected static function get_global_variable($xpath)
    564     {
    565         return AAM_Framework_Policy_Xpath::get_value_by_xpath($GLOBALS, $xpath);
    566     }
    567 
    568     /**
    569558     * Get value from query params
    570559     *
     
    679668    }
    680669
     670    /**
     671     * Evaluate CALLBACK expression
     672     *
     673     * @param string $xpath
     674     * @param array  $args
     675     *
     676     * @return mixed
     677     * @access protected
     678     *
     679     * @version 7.0.7
     680     */
     681    protected static function get_from_callback($xpath, $args)
     682    {
     683        $value = null;
     684        $cb    = self::_parse_callback($xpath, $args);
     685
     686        if (!is_null($cb)) {
     687            if (is_callable($cb['func']) || function_exists($cb['func'])) {
     688                $value = call_user_func_array($cb['func'], $cb['args']);
     689            }
     690        }
     691
     692        return $value;
     693    }
     694
     695    /**
     696     * Get global variable's value
     697     *
     698     * @param string $xpath
     699     * @param array  $args
     700     *
     701     * @return mixed
     702     * @access protected
     703     *
     704     * @version 7.0.7
     705     */
     706    protected static function get_global_variable($xpath, $args)
     707    {
     708        return self::_resolve_complex_chain($GLOBALS, $xpath, $args);
     709    }
     710
     711    /**
     712     * Get AAM API
     713     *
     714     * @param string $xpath
     715     * @param array  $args
     716     *
     717     * @return mixed
     718     * @access protected
     719     *
     720     * @version 7.0.7
     721     */
     722    protected static function get_api($xpath, $args)
     723    {
     724        return self::_resolve_complex_chain(AAM::api(), $xpath, $args);
     725    }
     726
     727    /**
     728     * Get inline argument
     729     *
     730     * @param string $xpath
     731     * @param array  $args
     732     *
     733     * @return mixed
     734     * @access protected
     735     *
     736     * @version 7.0.7
     737     */
     738    protected static function get_arg_value($xpath, $args)
     739    {
     740        return self::_resolve_complex_chain($args, $xpath, $args);
     741    }
     742
     743    /**
     744     * Resolve complex marker
     745     *
     746     * @param mixed  $source
     747     * @param string $xpath
     748     * @param array  $args
     749     *
     750     * @return mixed
     751     * @access private
     752     * @static
     753     *
     754     * @version 7.0.7
     755     */
     756    private static function _resolve_complex_chain($source, $xpath, $args)
     757    {
     758        $result = $source;
     759
     760        // Splitting the xpath into sub-segments
     761        foreach(self::_parse_to_segments($xpath) as $segment) {
     762            if (strpos($segment, '(') !== false) { // This segment calls method
     763                if (is_object($result)) {
     764                    $cb = self::_parse_callback($segment, $args);
     765
     766                    if ($cb !== null) {
     767                        $result = call_user_func_array(
     768                            [ $result, $cb['func'] ],
     769                            $cb['args']
     770                        );
     771                    } else {
     772                        $result = null;
     773                    }
     774                } else {
     775                    $result = null;
     776                }
     777            } else {
     778                $result = AAM_Framework_Policy_Xpath::get_value_by_xpath(
     779                    $result, $segment
     780                );
     781            }
     782        }
     783
     784        return $result;
     785    }
     786
     787    /**
     788     * Parse callback expression
     789     *
     790     * @param string $exp
     791     * @param array  $args
     792     *
     793     * @return array
     794     * @access private
     795     *
     796     * @version 7.0.7
     797     */
     798    private static function _parse_callback($exp, $args)
     799    {
     800        $response = null;
     801        $regex    = '/^([^(]+)\(?([^)]*)\)?(.*)$/i';
     802
     803        if (preg_match($regex, $exp, $match)) {
     804            // The second part is the collection of arguments that we pass to
     805            // the function
     806            $markers = array_map('trim', explode(',', $match[2]));
     807            $values  = [];
     808
     809            foreach($markers as $marker) {
     810                if (preg_match('/^\'.*\'$/', $marker) === 1) { // This is literal string
     811                    array_push($values, trim($marker, '\''));
     812                } elseif (strpos($marker, '.') !== false) { // Potentially another marker
     813                    array_push($values, self::get_marker_value($marker, $args));
     814                } else {
     815                    array_push($values, $marker);
     816                }
     817            }
     818
     819            $response = [
     820                'func'  => trim($match[1]),
     821                'args'  => $values
     822            ];
     823        }
     824
     825        return $response;
     826    }
     827
     828    /**
     829     * Parse marker into segments that will be used to get value
     830     *
     831     * Example of markers:
     832     *  - CALLBACK.MyApp\Auth::isRegistered
     833     *  - CALLBACK.is_admin
     834     *  - CALLBACK.is_network_active()
     835     *  - PHP_GLOBAL.Players[0].profile.name
     836     *  - USER.address["physical"].zip
     837     *  - PHP_GLOBAL.Country[USA][NC][Charlotte]
     838     *  - MARKER.0929431.amount
     839     *  - AAM_API.posts.is_restricted(abc)
     840     *  - PHP_GLOBAL.user.get_order(45).is_fulfilled
     841     *  - CALLBACK.sanitize_title(USER.display_name)
     842     *  - CALLBACK.sanitize_title(USER.roles[3].is_active, true)
     843     *  - CALLBACK.current_user_can('edit_post', 10)
     844     *
     845     * @param string $str
     846     * @return array
     847     *
     848     * @access private
     849     * @static
     850     *
     851     * @version 7.0.7
     852     */
     853    private static function _parse_to_segments($str)
     854    {
     855        $in_args = $in_index = $in_str = false;
     856        $results = [];
     857        $segment = '';
     858
     859        for($i = 0; $i < strlen($str); $i++) {
     860            $chr = $str[$i];
     861
     862            if ($chr === '.') {
     863                if (!$in_args && !$in_index && !$in_str) {
     864                    array_push($results, $segment);
     865                    $segment = '';
     866                } else {
     867                    $segment .= $chr;
     868                }
     869            } else {
     870                if (in_array($chr, ['"', "'"], true)) {
     871                    $in_str = !$in_str;
     872                } elseif ($chr === '[') {
     873                    $in_index = true;
     874                } elseif ($chr === ']') {
     875                    $in_index = false;
     876                } elseif ($chr === '(') {
     877                    $in_args = true;
     878                } elseif ($chr === ')') {
     879                    $in_args = false;
     880                }
     881
     882                $segment .= $chr;
     883            }
     884        }
     885
     886        if (!empty($segment)) {
     887            array_push($results, $segment);
     888        }
     889
     890        return $results;
     891    }
     892
    681893}
  • advanced-access-manager/trunk/application/Framework/Policy/Typecast.php

    r3286780 r3331817  
    2121     *
    2222     * @param string $expression
     23     * @param mixed  $value
    2324     *
    2425     * @return mixed
    2526     * @access public
    2627     *
    27      * @version 7.0.0
     28     * @version 7.0.7
    2829     */
    29     public static function execute($expression)
     30    public static function execute($expression, $value)
    3031    {
     32        // Note! It make no sense to have multiple type casting for one expression
     33        // due to the fact that they all would have to be concatenated as a string.
     34        // This is why we only extracted a typecast mentioned at the beginning of the
     35        // expression
    3136        $regex = '/^\(\*([\w]+)\)(.*)/i';
    32 
    33         // Note! It make no sense to have multiple type casting for one expression
    34         // due to the fact that they all would have to be concatenated as a string
    3537
    3638        // If there is type casting, perform it
    3739        if (preg_match($regex, $expression, $scale)) {
    38             $expression = self::_typecast($scale[2], $scale[1]);
     40            $result = self::_typecast($value, $scale[1]);
     41        } else {
     42            $result = $value;
    3943        }
    4044
    41         return $expression;
     45        return $result;
    4246    }
    4347
     
    5256     * @access protected
    5357     *
    54      * @version 7.0.0
     58     * @version 7.0.7
    5559     */
    5660    private static function _typecast($value, $type)
     
    98102
    99103            case 'array':
    100                 $value = is_string($value) ? json_decode($value, true) : (array) $value;
     104                if (is_string($value)) {
     105                    $candidate = json_decode($value, true);
     106                    $value     = is_null($candidate) ? [] : (array) $candidate;
     107                }  else {
     108                    $value = (array) $value;
     109                }
    101110                break;
    102111
  • advanced-access-manager/trunk/application/Framework/Policy/Xpath.php

    r3286780 r3331817  
    2626     *
    2727     * @return mixed
     28     * @access private
    2829     *
    29      * @access private
    3030     * @version 7.0.0
    3131     */
     
    7575    {
    7676        $result = trim(
    77             str_replace(
    78                 array('["', '[', '"]', ']', '..'), '.', $xpath
    79             ),
     77            str_replace([ '["', '[', '"]', ']', '..' ], '.', $xpath),
    8078            ' .' // white space is important!
    8179        );
  • advanced-access-manager/trunk/application/Framework/Proxy/User.php

    r3286780 r3331817  
    137137     *
    138138     * @return AAM_Framework_Proxy_User
    139      *
    140      * @access public
     139     * @access public
     140     *
    141141     * @version 7.0.0
    142142     */
     
    216216     *
    217217     * @return void
    218      *
    219      * @access public
     218     * @access public
     219     *
    220220     * @version 7.0.0
    221221     */
     
    245245     *
    246246     * @return boolean
    247      *
    248      * @access public
     247     * @access public
     248     *
    249249     * @version 7.0.0
    250250     */
     
    258258     *
    259259     * @return boolean
    260      *
    261      * @access public
     260     * @access public
     261     *
    262262     * @version 7.0.0
    263263     */
     
    281281     *
    282282     * @return mixed
    283      *
    284      * @access public
     283     * @access public
     284     *
    285285     * @since 7.0.0
    286286     */
     
    310310     *
    311311     * @return mixed
    312      *
    313      * @access public
     312     * @access public
     313     *
    314314     * @since 7.0.0
    315315     */
     
    334334     *
    335335     * @return void
    336      *
    337      * @access public
     336     * @access public
     337     *
    338338     * @since 7.0.0
    339339     */
     
    347347     *
    348348     * @return void
    349      *
    350349     * @access private
     350     *
    351351     * @version 7.0.0
    352352     */
     
    384384     *
    385385     * @return void
    386      *
    387386     * @access private
     387     *
    388388     * @version 7.0.0
    389389     */
  • advanced-access-manager/trunk/application/Framework/Service/Posts.php

    r3315883 r3331817  
    902902     *
    903903     * @return AAM_Framework_Resource_Post
    904      *
    905904     * @access private
     905     *
    906906     * @version 7.0.0
    907907     */
  • advanced-access-manager/trunk/application/Framework/Utility/AccessLevels.php

    r3286780 r3331817  
    3232     * Get access level
    3333     *
    34      * @param string  $type
    35      * @param mixed   $identifier
     34     * @param string $type
     35     * @param mixed  $identifier
    3636     *
    3737     * @return AAM_Framework_AccessLevel_Interface
    38      *
    39      * @access public
     38     * @access public
     39     *
    4040     * @version 7.0.0
    4141     */
     
    7474     *
    7575     * @return AAM_Framework_AccessLevel_Role
    76      *
    77      * @access public
     76     * @access public
     77     *
    7878     * @version 7.0.0
    7979     */
     
    104104     *
    105105     * @return AAM_Framework_AccessLevel_User
    106      *
    107      * @access public
     106     * @access public
     107     *
    108108     * @version 7.0.0
    109109     */
     
    133133     *
    134134     * @return AAM_Framework_AccessLevel_Visitor
    135      *
    136      * @access public
     135     * @access public
     136     *
    137137     * @version 7.0.0
    138138     */
     
    153153     *
    154154     * @return AAM_Framework_AccessLevel_Default
    155      *
    156      * @access public
     155     * @access public
     156     *
    157157     * @version 7.0.0
    158158     */
     
    175175     *
    176176     * @return WP_User
    177      *
    178177     * @access private
     178     *
    179179     * @version 7.0.0
    180180     */
  • advanced-access-manager/trunk/application/Restful/Roles.php

    r3286780 r3331817  
    355355     * @access private
    356356     *
    357      * @version 7.0.0
     357     * @version 7.0.7
    358358     */
    359359    private function _clone_settings($role, $parent)
    360360    {
    361         $service = AAM::api()->settings([
    362             'access_level_type' => AAM_Framework_Type_AccessLevel::ROLE,
    363             'access_level_id'   => $role->slug
    364         ]);
    365 
    366         $cloned = $service->get_settings([
    367             'access_level_type' => AAM_Framework_Type_AccessLevel::ROLE,
    368             'access_level_id'   => $parent->slug
    369         ]);
     361        // Base role
     362        $service = AAM::api()->settings(sprintf('%s:%s',
     363            AAM_Framework_Type_AccessLevel::ROLE,
     364            $role->slug
     365        ));
     366
     367        // From role
     368        $from = AAM::api()->settings(sprintf('%s:%s',
     369            AAM_Framework_Type_AccessLevel::ROLE,
     370            $parent->slug
     371        ));
    370372
    371373        // Clone the settings
    372         return $service->set_settings($cloned);
     374        return $service->set_settings($from->get_settings());
    373375    }
    374376
  • advanced-access-manager/trunk/autoloader.php

    r3286780 r3331817  
    3737     * @access protected
    3838     *
    39      * @version 7.0.0
     39     * @version 7.0.7
    4040     */
    41     protected static $class_map = array(
    42         'Psr\Http\Message\MessageInterface'                 => self::PSRHM_BASEDIR . '/MessageInterface.php',
    43         'Psr\Http\Message\RequestInterface'                 => self::PSRHM_BASEDIR . '/RequestInterface.php',
    44         'Psr\Http\Message\ResponseInterface'                => self::PSRHM_BASEDIR . '/ResponseInterface.php',
    45         'Psr\Http\Message\ServerRequestInterface'           => self::PSRHM_BASEDIR . '/ServerRequestInterface.php',
    46         'Psr\Http\Message\StreamInterface'                  => self::PSRHM_BASEDIR . '/StreamInterface.php',
    47         'Psr\Http\Message\UploadedFileInterface'            => self::PSRHM_BASEDIR . '/UploadedFileInterface.php',
    48         'Psr\Http\Message\UriInterface'                     => self::PSRHM_BASEDIR . '/UriInterface.php',
    49         'Vectorface\Whip\IpRange\IpRange'                   => self::WHIP_BASEDIR . '/IpRange/IpRange.php',
    50         'Vectorface\Whip\IpRange\IpWhitelist'               => self::WHIP_BASEDIR . '/IpRange/IpWhitelist.php',
    51         'Vectorface\Whip\IpRange\Ipv4Range'                 => self::WHIP_BASEDIR . '/IpRange/Ipv4Range.php',
    52         'Vectorface\Whip\IpRange\Ipv6Range'                 => self::WHIP_BASEDIR . '/IpRange/Ipv6Range.php',
    53         'Vectorface\Whip\Request\Psr7RequestAdapter'        => self::WHIP_BASEDIR . '/Request/Psr7RequestAdapter.php',
    54         'Vectorface\Whip\Request\RequestAdapter'            => self::WHIP_BASEDIR . '/Request/RequestAdapter.php',
    55         'Vectorface\Whip\Request\SuperglobalRequestAdapter' => self::WHIP_BASEDIR . '/Request/SuperglobalRequestAdapter.php',
    56         'Vectorface\Whip\Whip'                              => self::WHIP_BASEDIR . '/Whip.php',
    57     );
     41    protected static $class_map = [];
    5842
    5943    /**
  • advanced-access-manager/trunk/readme.txt

    r3315883 r3331817  
    55Requires PHP: 5.6.0
    66Tested up to: 6.8.1
    7 Stable tag: 7.0.6
     7Stable tag: 7.0.7
    88
    99Your WordPress security starts within — with AAM. Take control of your WordPress website and solve security gaps today.
     
    6060
    6161== Changelog ==
     62
     63= 7.0.7 =
     64* Fixed: Uncaught Error: preg_match(): Argument #2 ($subject) must be of type string, array given in /.../Framework/Policy/Typecast.php on line 37 [https://github.com/aamplugin/advanced-access-manager/issues/474](https://github.com/aamplugin/advanced-access-manager/issues/474)
     65* Fixed: Uncaught Error: Call to a member function get_settings() on null in /.../application/Restful/Roles.php [https://github.com/aamplugin/advanced-access-manager/issues/479](https://github.com/aamplugin/advanced-access-manager/issues/479)
     66* New: New access policy marker AAM_API [https://github.com/aamplugin/advanced-access-manager/issues/475](https://github.com/aamplugin/advanced-access-manager/issues/475)
     67* New: Allow function expression anywhere within JSON policy xpath [https://github.com/aamplugin/advanced-access-manager/issues/476](https://github.com/aamplugin/advanced-access-manager/issues/476)
     68* New: Give the ability to define conditions based on user's OS, device, browser, brand, model, etc. [https://github.com/aamplugin/advanced-access-manager/issues/477](https://github.com/aamplugin/advanced-access-manager/issues/477)
    6269
    6370= 7.0.6 =
  • advanced-access-manager/trunk/vendor/autoload.php

    r2796840 r3331817  
    11<?php
    22
    3 /**
    4  * ======================================================================
    5  * LICENSE: This file is subject to the terms and conditions defined in *
    6  * file 'license.txt', which is part of this source code package.       *
    7  * ======================================================================
    8  */
     3// autoload.php @generated by Composer
    94
    10 //Composer Semver for Policy dependency versioning
    11 if (!class_exists('Composer\Semver')) {
    12     spl_autoload_register(function($class_name) {
    13         if (strpos($class_name, 'Composer\Semver') === 0) {
    14             $normalized = str_replace(
    15                 array('Composer\Semver', '\\'),
    16                 array('composer', '/'),
    17                 $class_name
    18             );
    19             $filename = __DIR__ . '/' . $normalized . '.php';
     5if (PHP_VERSION_ID < 50600) {
     6    if (!headers_sent()) {
     7        header('HTTP/1.1 500 Internal Server Error');
     8    }
     9    $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
     10    if (!ini_get('display_errors')) {
     11        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
     12            fwrite(STDERR, $err);
     13        } elseif (!headers_sent()) {
     14            echo $err;
    2015        }
     16    }
     17    trigger_error(
     18        $err,
     19        E_USER_ERROR
     20    );
     21}
    2122
    22         if (!empty($filename) && file_exists($filename)) {
    23             require_once $filename;
    24         }
    25     });
    26 }
     23require_once __DIR__ . '/composer/autoload_real.php';
     24
     25return ComposerAutoloaderInit9666f71e5b586ecf908dd5d7d2d79db6::getLoader();
Note: See TracChangeset for help on using the changeset viewer.