HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/pmw24/wp-content/plugins/advanced-access-manager/Application/Shortcode/Factory.php
<?php

/**
 * ======================================================================
 * LICENSE: This file is subject to the terms and conditions defined in *
 * file 'license.txt', which is part of this source code package.       *
 * ======================================================================
 */

/**
 * AAM Shortcode
 * 
 * @package AAM
 * @author Vasyl Martyniuk <vasyl@vasyltech.com>
 */
class AAM_Shortcode_Factory {
    
    /**
     *
     * @var type 
     */
    protected $strategy = null;
    
    /**
     * Initialize shortcode factory
     * 
     * @param type $args
     * @param type $content
     */
    public function __construct($args, $content) {
        $context = !empty($args['context']) ? $args['context'] : 'content';
        
        $classname = 'AAM_Shortcode_Strategy_' . ucfirst($context);
        
        if (class_exists($classname)) {
            $this->strategy = new $classname($args, $content);
        } else {
            $this->strategy = apply_filters(
                    'aam-shortcode-filter', null, $context, $args, $content
            );
        }
    }
    
    /**
     * 
     * @return string
     */
    public function process() {
        if (is_a($this->strategy, 'AAM_Shortcode_Strategy_Interface')) {
            $content = $this->strategy->run();
        } else {
            $content = __('No valid strategy found for the given context', AAM_KEY);
        }
        
        return $content;
    }
    
}