Exemplo n.º 1
0
 /**
  * Handles the Shortcode for: `[s2Key /]`.
  *
  * @package s2Member\s2Key
  * @since 110912
  *
  * @attaches-to ``add_shortcode("s2Key");``
  *
  * @param array $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  * @return string Value of the requested key, or null on failure.
  */
 public static function sc_get_key($attr = FALSE, $content = FALSE, $shortcode = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_key", get_defined_vars());
     unset($__refs, $__v);
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array("file_download" => "", "directive" => ""), $attr);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("ws_plugin__s2member_before_sc_get_key_after_shortcode_atts", get_defined_vars());
     unset($__refs, $__v);
     if ($attr["file_download"]) {
         // Requesting a File Download Key?
         $get = c_ws_plugin__s2member_files::file_download_key($attr["file_download"], $attr["directive"]);
     }
     return apply_filters("ws_plugin__s2member_sc_get_key", isset($get) ? $get : null, get_defined_vars());
 }
Exemplo n.º 2
0
 /**
  * Handles the Shortcode for: `[s2Key /]`.
  *
  * @package s2Member\s2Key
  * @since 110912
  *
  * @attaches-to ``add_shortcode('s2Key');``
  *
  * @param array  $attr An array of Attributes.
  * @param string $content Content inside the Shortcode.
  * @param string $shortcode The actual Shortcode name itself.
  *
  * @return string Value of the requested key, or null on failure.
  */
 public static function sc_get_key($attr = array(), $content = '', $shortcode = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_key', get_defined_vars());
     unset($__refs, $__v);
     // Allow variables to be modified by reference.
     $attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
     $attr = shortcode_atts(array('file_download' => '', 'directive' => ''), $attr);
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_sc_get_key_after_shortcode_atts', get_defined_vars());
     unset($__refs, $__v);
     // Allow variables to be modified by reference.
     if ($attr['file_download']) {
         // Requesting a File Download Key?
         $get = c_ws_plugin__s2member_files::file_download_key($attr['file_download'], $attr['directive']);
     }
     return apply_filters('ws_plugin__s2member_sc_get_key', isset($get) ? $get : '', get_defined_vars());
 }
Exemplo n.º 3
0
 function s2member_file_download_key($file = FALSE, $directive = FALSE)
 {
     return c_ws_plugin__s2member_files::file_download_key($file, $directive);
 }
Exemplo n.º 4
0
 /**
  * Checks a File Download Key for validity.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param string $file Input File Download to validate.
  * @param string $key Input File Download Key to validate.
  *
  * @return bool True if valid, else false.
  */
 public static function check_file_download_key($file = '', $key = '')
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('_ws_plugin__s2member_before_check_file_download_key', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     if ($file && is_string($file) && ($file = trim($file, '/')) && $key && is_string($key)) {
         if ($key === c_ws_plugin__s2member_files::file_download_key($file) || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file)) {
             $valid = TRUE;
         } else {
             if ($key === c_ws_plugin__s2member_files::file_download_key($file, 'ip-forever') || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file, 'ip-forever')) {
                 $valid = TRUE;
             } else {
                 if ($key === c_ws_plugin__s2member_files::file_download_key($file, 'universal') || $key === c_ws_plugin__s2member_files::file_download_key('/' . $file, 'universal')) {
                     $valid = TRUE;
                 }
             }
         }
         // File Download Key is valid.
     }
     return apply_filters('ws_plugin__s2member_check_file_download_key', isset($valid) && $valid ? TRUE : FALSE, get_defined_vars());
 }
Exemplo n.º 5
0
 /**
  * Checks a File Download Key for validity.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param str $file Input File Download to validate.
  * @param str $key Input File Download Key to validate.
  * @return bool True if valid, else false.
  */
 public static function check_file_download_key($file = FALSE, $key = FALSE)
 {
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action("_ws_plugin__s2member_before_check_file_download_key", get_defined_vars());
     unset($__refs, $__v);
     if ($file && is_string($file) && ($file = trim($file, "/")) && $key && is_string($key)) {
         if ($key === c_ws_plugin__s2member_files::file_download_key($file) || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file)) {
             $valid = true;
         } else {
             if ($key === c_ws_plugin__s2member_files::file_download_key($file, "ip-forever") || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file, "ip-forever")) {
                 $valid = true;
             } else {
                 if ($key === c_ws_plugin__s2member_files::file_download_key($file, "universal") || $key === c_ws_plugin__s2member_files::file_download_key("/" . $file, "universal")) {
                     $valid = true;
                 }
             }
         }
     }
     return apply_filters("ws_plugin__s2member_check_file_download_key", isset($valid) && $valid ? true : false, get_defined_vars());
 }