| 1 |
<?php |
| 2 |
// @codingStandardsIgnoreFile |
| 3 |
/** |
| 4 |
* Shortcode `[s2Key /]` (inner processing routines). |
| 5 |
* |
| 6 |
* Copyright: © 2009-2011 |
| 7 |
* {@link http://websharks-inc.com/ WebSharks, Inc.} |
| 8 |
* (coded in the USA) |
| 9 |
* |
| 10 |
* Released under the terms of the GNU General Public License. |
| 11 |
* You should have received a copy of the GNU General Public License, |
| 12 |
* along with this software. In the main directory, see: /licensing/ |
| 13 |
* If not, see: {@link http://www.gnu.org/licenses/}. |
| 14 |
* |
| 15 |
* @package s2Member\s2Key |
| 16 |
* @since 110912 |
| 17 |
*/ |
| 18 |
if(!defined('WPINC')) // MUST have WordPress. |
| 19 |
exit ('Do not access this file directly.'); |
| 20 |
|
| 21 |
if(!class_exists('c_ws_plugin__s2member_sc_keys_in')) |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Shortcode `[s2Key /]` (inner processing routines). |
| 25 |
* |
| 26 |
* @package s2Member\s2Key |
| 27 |
* @since 110912 |
| 28 |
*/ |
| 29 |
class c_ws_plugin__s2member_sc_keys_in |
| 30 |
{ |
| 31 |
/** |
| 32 |
* Handles the Shortcode for: `[s2Key /]`. |
| 33 |
* |
| 34 |
* @package s2Member\s2Key |
| 35 |
* @since 110912 |
| 36 |
* |
| 37 |
* @attaches-to ``add_shortcode('s2Key');`` |
| 38 |
* |
| 39 |
* @param array $attr An array of Attributes. |
| 40 |
* @param string $content Content inside the Shortcode. |
| 41 |
* @param string $shortcode The actual Shortcode name itself. |
| 42 |
* |
| 43 |
* @return string Value of the requested key, or null on failure. |
| 44 |
*/ |
| 45 |
public static function sc_get_key($attr = array(), $content = '', $shortcode = '') |
| 46 |
{ |
| 47 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v; |
| 48 |
do_action('ws_plugin__s2member_before_sc_get_key', get_defined_vars()); |
| 49 |
unset($__refs, $__v); // Allow variables to be modified by reference. |
| 50 |
|
| 51 |
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array)$attr); |
| 52 |
$attr = shortcode_atts(array('file_download' => '', 'directive' => ''), $attr); |
| 53 |
|
| 54 |
//260811 Validate directive. |
| 55 |
if(!in_array($attr['directive'], array('', 'ip-forever', 'universal'), true)) |
| 56 |
$attr['directive'] = ''; |
| 57 |
|
| 58 |
foreach(array_keys(get_defined_vars()) as $__v) $__refs[$__v] =& $$__v; |
| 59 |
do_action('ws_plugin__s2member_before_sc_get_key_after_shortcode_atts', get_defined_vars()); |
| 60 |
unset($__refs, $__v); // Allow variables to be modified by reference. |
| 61 |
|
| 62 |
if($attr['file_download']) // Requesting a File Download Key? |
| 63 |
$get = c_ws_plugin__s2member_files::file_download_key($attr['file_download'], $attr['directive']); |
| 64 |
|
| 65 |
return apply_filters('ws_plugin__s2member_sc_get_key', isset($get) ? $get : '', get_defined_vars()); |
| 66 |
} |
| 67 |
} |
| 68 |
} |
| 69 |
|