当前位置: 首页>>代码示例>>PHP>>正文


PHP c_ws_plugin__s2member_utils_conds::is_localhost方法代码示例

本文整理汇总了PHP中c_ws_plugin__s2member_utils_conds::is_localhost方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_conds::is_localhost方法的具体用法?PHP c_ws_plugin__s2member_utils_conds::is_localhost怎么用?PHP c_ws_plugin__s2member_utils_conds::is_localhost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c_ws_plugin__s2member_utils_conds的用法示例。


在下文中一共展示了c_ws_plugin__s2member_utils_conds::is_localhost方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     if (is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
         echo '<form id="ws-updates-form" action="http://websharks-inc.us1.list-manage1.com/subscribe/post?u=8f347da54d66b5298d13237d9&amp;id=19e9d213bc" method="post" target="_blank">' . "\n";
         echo '<input type="hidden" name="group[1][4]" id="ws-updates-group" value="4" />' . "\n";
         /**/
         if (!is_ssl() && !c_ws_plugin__s2member_utils_conds::is_localhost()) {
             echo '<div class="ws-menu-page-r-group-header">' . "\n";
             echo '<ins class="open">-</ins>Latest News<em>!</em>' . "\n";
             echo '</div>' . "\n";
             /**/
             echo '<div class="ws-menu-page-r-group" style="display:block;">' . "\n";
             echo '<script type="text/javascript" src="http://feeds.feedburner.com/s2member-updates?format=sigpro&amp;nItems=3&amp;openLinks=new&amp;displayTitle=false&amp;displayFeedIcon=false&amp;displayExcerpts=false&amp;displayAuthor=false&amp;displayDate=false&amp;displayEnclosures=false&amp;displayLinkToFeed=false"></script>' . "\n";
             echo '</div>' . "\n";
         }
         /**/
         echo '<div class="ws-menu-page-r-group-header">' . "\n";
         echo '<ins>+</ins>Email Updates<em>!</em>' . "\n";
         echo '</div>' . "\n";
         /**/
         echo '<div class="ws-menu-page-r-group">' . "\n";
         /**/
         echo '<div id="ws-updates-div-fname">' . "\n";
         echo '<label for="ws-updates-fname">First Name: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="FNAME" id="ws-updates-fname" value="' . esc_attr($user->first_name) . '" />' . "\n";
         echo '</div>' . "\n";
         /**/
         echo '<div id="ws-updates-div-lname">' . "\n";
         echo '<label for="ws-updates-lname">Last Name: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="LNAME" id="ws-updates-lname" value="' . esc_attr($user->last_name) . '" />' . "\n";
         echo '</div>' . "\n";
         /**/
         echo '<div id="ws-updates-div-email">' . "\n";
         echo '<label for="ws-updates-email">Email Address: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="EMAIL" id="ws-updates-email" value="' . format_to_edit($user->user_email) . '" />' . "\n";
         echo '</div>' . "\n";
         /**/
         if (!is_ssl() && !c_ws_plugin__s2member_utils_conds::is_localhost()) {
             echo '<div id="ws-updates-div-subs">' . "\n";
             echo '<script type="text/javascript" src="http://websharks-inc.us1.list-manage.com/subscriber-count?b=31&u=8c67d547-edf6-41c5-807d-2d2d0e6cffd1&id=19e9d213bc"></script>' . "\n";
             echo '</div>' . "\n";
         }
         /**/
         echo '<div id="ws-updates-div-priv">' . "\n";
         echo '( <a href="' . esc_attr(c_ws_plugin__s2member_readmes::parse_readme_value("Privacy URI")) . '" target="_blank">we DO respect your privacy</a> )' . "\n";
         echo '</div>' . "\n";
         /**/
         echo '<div id="ws-updates-div-submit">' . "\n";
         echo '<input type="submit" value="Subscribe" name="subscribe" />' . "\n";
         echo '</div>' . "\n";
         /**/
         echo '</div>' . "\n";
         /**/
         echo '</form>' . "\n";
     }
 }
开发者ID:vinvinh315,项目名称:maintainwebsolutions.com,代码行数:56,代码来源:updates.inc.php

示例2: __construct

 public function __construct()
 {
     if (is_object($user = wp_get_current_user()) && ($user_id = $user->ID)) {
         echo '<form id="ws-updates-form" action="http://websharks-inc.us1.list-manage1.com/subscribe/post?u=8f347da54d66b5298d13237d9&amp;id=19e9d213bc" method="post" target="_blank">' . "\n";
         if (!is_ssl() && !c_ws_plugin__s2member_utils_conds::is_localhost()) {
             echo '<div class="ws-menu-page-r-group-header open">' . "\n";
             echo '   <i class="fa fa-rss"></i> s2 News' . "\n";
             echo '</div>' . "\n";
             echo '<div class="ws-menu-page-r-group open">' . "\n";
             echo '<script type="text/javascript" src="http://feeds.feedburner.com/s2member?format=sigpro&amp;nItems=5&amp;openLinks=new&amp;displayTitle=false&amp;displayFeedIcon=false&amp;displayExcerpts=false&amp;displayAuthor=false&amp;displayDate=false&amp;displayEnclosures=false&amp;displayLinkToFeed=false"></script>' . "\n";
             echo '➘ <a href="' . esc_attr(c_ws_plugin__s2member_readmes::parse_readme_value("Knowledge Base")) . '" target="_blank" rel="external">More updates...</a>' . "\n";
             echo '</div>' . "\n";
         }
         echo '<div class="ws-menu-page-r-group-header">' . "\n";
         echo '   <i class="fa fa-envelope"></i> s2 Updates' . "\n";
         echo '</div>' . "\n";
         echo '<div class="ws-menu-page-r-group">' . "\n";
         echo '<p style="text-align:center; font-size:90%;"><strong>Hi ' . esc_html(wp_get_current_user()->first_name) . ' :-)</strong><br />Subscribe here! We\'ll keep you informed about all things related to s2Member.</p>' . "\n";
         echo '<div id="ws-updates-div-fname">' . "\n";
         echo '<label for="ws-updates-fname">First Name: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="FNAME" id="ws-updates-fname" value="' . esc_attr($user->first_name) . '" />' . "\n";
         echo '</div>' . "\n";
         echo '<div id="ws-updates-div-lname">' . "\n";
         echo '<label for="ws-updates-lname">Last Name: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="LNAME" id="ws-updates-lname" value="' . esc_attr($user->last_name) . '" />' . "\n";
         echo '</div>' . "\n";
         echo '<div id="ws-updates-div-email">' . "\n";
         echo '<label for="ws-updates-email">Email Address: *</label><br />' . "\n";
         echo '<input type="text" aria-required="true" autocomplete="off" name="EMAIL" id="ws-updates-email" value="' . format_to_edit($user->user_email) . '" />' . "\n";
         echo '</div>' . "\n";
         if (!is_ssl() && !c_ws_plugin__s2member_utils_conds::is_localhost()) {
             echo '<div id="ws-updates-div-subs">' . "\n";
             echo '<script type="text/javascript" src="http://websharks-inc.us1.list-manage.com/subscriber-count?b=31&u=8c67d547-edf6-41c5-807d-2d2d0e6cffd1&id=19e9d213bc"></script>' . "\n";
             echo '</div>' . "\n";
         }
         echo '<div id="ws-updates-div-priv">' . "\n";
         echo '(<a href="' . esc_attr(c_ws_plugin__s2member_readmes::parse_readme_value("Privacy URI")) . '" target="_blank">privacy policy</a>)' . "\n";
         echo '</div>' . "\n";
         echo '<div id="ws-updates-div-submit">' . "\n";
         echo '<input type="submit" value="Subscribe" name="subscribe" />' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         echo '</form>' . "\n";
     }
 }
开发者ID:donwea,项目名称:nhap.org,代码行数:45,代码来源:updates.inc.php

示例3: __construct


//.........这里部分代码省略.........
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="password" autocomplete="off" name="ws_plugin__s2member_amazon_s3_files_secret_key" id="ws-plugin--s2member-amazon-s3-files-secret-key" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_s3_files_secret_key"]) . '" /><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Access Keys (leading to: Legacy Security Credentials)</code>.<br />' . "\n";
         echo 'Amazon is deprecating Secret Access Keys, but they ARE still required for digitally signed URLs.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '</tbody>' . "\n";
         echo '</table>' . "\n";
         echo '</div>' . "\n";
         echo '</div>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_after_amazon_s3", get_defined_vars());
     }
     if (apply_filters("ws_plugin__s2member_during_down_ops_page_during_left_sections_display_amazon_cf", true, get_defined_vars())) {
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_before_amazon_cf", get_defined_vars());
         echo '<div class="ws-menu-page-group" title="Amazon S3/CloudFront CDN Storage Option"' . (!empty(c_ws_plugin__s2member_menu_pages::$pre_display_errors["cf_files_auto_configure_distros"]) ? ' default-state="open"' : '') . '>' . "\n";
         echo '<div class="ws-menu-page-section ws-plugin--s2member-amazon-cf-section">' . "\n";
         echo '<h3>Amazon S3/CloudFront CDN Storage &amp; Delivery (optional)</h3>' . "\n";
         echo '<a href="http://aws.amazon.com/cloudfront/" target="_blank"><img src="' . esc_attr($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["dir_url"]) . '/images/amazon-logo.png" class="ws-menu-page-right" style="width:250px; height:100px; border:0;" alt="." /></a>' . "\n";
         echo '<p>Please note, all of this is optional. s2Member can be configured to ONLY use Amazon S3 <em>(i.e. without Amazon CloudFront)</em>. Or, s2Member can be configured to use BOTH Amazon S3 and Amazon CloudFront together. If you don\'t want to use Amazon CloudFront, please leave this entire section empty. The configuration options in this section are ONLY required if you are planning to use both Amazon S3 and Amazon CloudFront together.</p>' . "\n";
         echo '<p>Amazon Simple Storage Service (<a href="http://aws.amazon.com/s3/" target="_blank" rel="external">Amazon S3</a>) combined with <a href="http://aws.amazon.com/cloudfront/" target="_blank" rel="external">Amazon CloudFront</a>. Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Services <em>(i.e. Amazon S3 Storage)</em> to give developers and businesses an easy way to distribute content to end users with low latency, and with high data transfer speeds. Amazon CloudFront delivers your static and streaming content using a global network of edge locations. Requests for your Amazon S3 Bucket Objects <em>(i.e. your protected files)</em> are automatically routed to the nearest edge location, so content is delivered with the best possible performance. s2Member has been integrated with both Amazon S3 and with Amazon CloudFront. So <em>(if you wish)</em>, instead of using the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory, you can store all of your protected files inside an Amazon S3 Bucket and serve them via Amazon CloudFront. But again, please understand, the configuration options in this section are ONLY required if you\'re going to use both Amazon S3 &amp; CloudFront together.</p>' . "\n";
         echo '<p><strong>One of the great things about Amazon CloudFront</strong>, is its ability to <strong>stream/seek media files</strong> in the truest sense of the word. For sites delivering protected <em>FLV/MP4/OGG/WEBM</em> and other streaming audio/video file types over the <em>RTMP</em> protocol, Amazon CloudFront is our recommendation. Once you\'ve successfully configured s2Member to use both Amazon S3 and Amazon CloudFront together, please review the section below regarding <code>JW Player &amp; RTMP Protocol Examples</code>. s2Member will automatically serve your protected files over the <em>RTMP</em> protocol using an Amazon CloudFront Streaming Distribution.</p>' . "\n";
         echo '<p>If you configure the options below, s2Member will assume all protected files are inside your Amazon S3 Bucket; and the <code>/' . esc_html(c_ws_plugin__s2member_utils_dirs::basename_dir_app_data($GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["files_dir"])) . '/</code> directory is no longer used at all. That being said, all other aspects of s2Member\'s File Download protection remain the same. The only thing that changes, is the location of your protected files. In other words, Basic Download Restrictions, Download Keys, Custom Capability and/or Membership Level Files will all continue to work just as before. The only difference is that s2Member will use your Amazon S3 Bucket, automatically connecting it to both of the Amazon CloudFront Distributions, which s2Member auto-configures for you <em>(see below)</em>. In this way, s2Member uses Amazon CloudFront as a CDN <em>(i.e. Content Delivery Network)</em> for your protected files.</p>' . "\n";
         echo '<p>s2Member assumes that you\'re creating a new Amazon S3 Bucket, specifically for this installation; and that your Bucket is NOT available publicly. In other words, if you type this URL into your browser <em>(i.e. <code>http://your-bucket-name.s3.amazonaws.com/</code>)</em>, you should get an error that says: <code>Access Denied</code>. That\'s good, that\'s exactly what you want. You can create your Amazon S3 Bucket using the <a href="https://console.aws.amazon.com/s3/home" target="_blank" rel="external">Amazon interface</a>. Or, some people prefer to use this popular Firefox extension (<a href="http://www.s3fox.net/" target="_blank" rel="external">S3 Fox Organizer</a>). You will also need to enable CloudFront inside your Web Services account at Amazon. Don\'t worry about creating or configuring any CloudFront Distributions, s2Member will auto-create and auto-configure those for you, allowing you to serve protected files.</p>' . "\n";
         do_action("ws_plugin__s2member_during_down_ops_page_during_left_sections_during_amazon_cf", get_defined_vars());
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member\'s auto-configuration routines for Amazon CloudFront (below), are designed to create &amp; configure various components on your Amazon Web Services account, which are all requirements for you to <a href="http://docs.amazonwebservices.com/AmazonCloudFront/2010-11-01/DeveloperGuide/index.html?HowToPrivateContent.html" target="_blank" rel="external">serve protected files through the Amazon S3/CloudFront combination</a>. These components include: an Origin Access Identity, read permissions for the Origin Access Identity, and two private content Distributions. One private content Distribution for file downloads, and another private content Distribution for streaming media files; both connected to and sourced by your Amazon S3 Bucket. In addition, s2Member will automatically configure an ACL &amp; Policy (i.e. permissions) on your Amazon S3 Bucket to make sure your protected object/files are NOT available to the public.</em></p>' . "\n";
         echo '<p><em><strong>Dev Note w/Technical Details:</strong> s2Member uses "Digitally Signed URLs", authenticated by the Amazon CloudFront API. Documented for developers <a href="http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html" target="_blank" rel="external">here</a>. To put it simply, s2Member will generate Amazon CloudFront URLs (internally); which allow Customers temporary access to specific files inside your S3 Bucket — via CloudFront Distributions. s2Member\'s Digitally Signed URLs leading to Amazon S3/CloudFront, give a Customer 24 hours to connect to the file inside your S3 Bucket. This connection period of 24 hours is largely irrelevant when used in combination with s2Member, because access is renewed for another 24 hours each time you make a file available to a User/Member, and they are authenticated by your configuration of s2Member. This connection period of 24 hours is just a secondary line of defense to further prevent the possibility of link sharing. If you need to change this connection timeout of <code>24 hours</code> for some reason (not likely), you can use this WordPress Filter: <code>ws_plugin__s2member_amazon_cf_file_expires_time</code>.</em></p>' . "\n";
         echo '<p><em><strong>Linking To Protected Files:</strong> RTMP streams are special, but nothing else changes. s2Member\'s integration with Amazon S3/CloudFront serves protected files through the same links that all s2Member site owners use. For example, you might use: <code>' . esc_html(site_url("/?s2member_file_download=example-file.zip")) . '</code>, where <strong>s2member_file_download</strong> = the file, relative to the root of your Amazon S3 Bucket. In other words, just the file name in most cases. s2Member will redirect Users/Members to a digitally signed Amazon CloudFront URL, which allows them access to a particular file via Amazon CloudFront. For further details, please review this section of your Dashboard: <code>s2Member -› Download Options -› Basic Download Restrictions</code>. Also see: <code>s2Member -› Download Options -› Advanced Mod-Rewrite Linkage</code>. If you\'re streaming audio/video files over the RTMP protocol, please review the section below: <code>JW Player &amp; RTMP Protocol Examples</code>.</em></p>' . "\n";
         echo '<p><em><strong>Content Type, Disposition &amp; Inline Files:</strong> An IMPORTANT issue. The query string parameter <code>&amp;s2member_file_inline=yes</code> does NOTHING for files served via Amazon CloudFront. s2Member has NO control over the <code>Content-Type</code> and/or <code>Content-Disposition</code> headers for a file being served through Amazon CloudFront, and CloudFront servers do NOT automatically determine the MIME type for the objects they serve. Therefore, when you upload a file to your Amazon S3 Bucket, you should set its Content-Type header. That is, you MUST configure headers yourself (such as <code>Content-Type: video/webm</code>, or <code>Content-Disposition: inline|attachment</code>) that you want Amazon CloudFront to send for a particular file. It\'s quite easy. You do this by setting <code>Properties -› Metadata (i.e. headers)</code> on a per-file basis, from inside your Amazon S3 Management Console. In short, when you upload a file to your Amazon S3 Bucket, if you want that file to be served a certain way, be sure to configure its <code>Properties -› Metadata</code> accordingly.</em></p>' . "\n";
         echo stripos(PHP_OS, "win") === 0 && c_ws_plugin__s2member_utils_conds::is_localhost() ? '<p><em><strong>Localhost Developers:</strong> s2Member\'s Amazon CloudFront integration requires the <a href="http://php.net/manual/en/function.openssl-sign.php" target="_blank" rel="external">openssl_sign()</a> function in PHP so it can digitially sign CloudFront URLs. This function is sometimes problematic on localhost servers such as WAMP &amp; EasyPHP. We recommend installing <a href="http://www.slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="external">this lightweight alternative for Windows</a> while you\'re developing. s2Member will automatically find it here: <code>C:\\OpenSSL-Win[32/64]\\bin\\openssl.exe</code>.' . (file_exists("c:\\openssl-win32\\bin\\openssl.exe") || file_exists("c:\\openssl-win64\\bin\\openssl.exe") ? ' <strong class="ws-menu-page-hilite">( s2Member has detected that OpenSSL-Win[32/64] IS installed in the correct location, thank you! )</strong>' : ' <strong class="ws-menu-page-hilite">(s2Member has detected that OpenSSL-Win[32/64] is NOT currently available)</strong>') . '</em></p>' . "\n" : '';
         if ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"] === "configured") {
             echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon CloudFront Distributions are: ( ALREADY configured! )</strong></em>' . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"] ? '<br /><em class="ws-menu-page-hilite">Downloads Distribution CNAME:</em> <em><code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_downloads_dname"]) . '</code></em>' : '') . ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"] ? '<br /><em class="ws-menu-page-hilite">Streaming Distribution CNAME:</em> <em><code>' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_cname"]) . ' &mdash;&raquo; ' . esc_html($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distro_streaming_dname"]) . '</code></em>' : '') . '</p>' . "\n";
         } else {
             if (!$GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_distros_auto_config_status"]) {
                 echo '<p><em class="ws-menu-page-hilite"><strong>Your Amazon CloudFront Distributions are: (NOT yet auto-configured).</strong></em></p>' . "\n";
             }
         }
         echo '<div class="ws-menu-page-hr"></div>' . "\n";
         echo '<table class="form-table" style="margin-top:0;">' . "\n";
         echo '<tbody>' . "\n";
         echo '<tr>' . "\n";
         echo '<th style="padding-top:0;">' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-id">' . "\n";
         echo 'Amazon CloudFront Key Pair ID (your Key Pair ID):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
         echo '<input type="text" autocomplete="off" name="ws_plugin__s2member_amazon_cf_files_private_key_id" id="ws-plugin--s2member-amazon-cf-files-private-key-id" value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" data-s-prev-config-value="' . format_to_edit($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["amazon_cf_files_private_key_id"]) . '" /><br />' . "\n";
         echo 'See: <code>Amazon Web Services Account -› Security Credentials -› Key Pairs</code>.' . "\n";
         echo '</td>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<th>' . "\n";
         echo '<label for="ws-plugin--s2member-amazon-cf-files-private-key-entry">' . "\n";
         echo 'Amazon CloudFront Private Key (contents of your <code>pk-[***].pem</code> file):' . "\n";
         echo '</label>' . "\n";
         echo '</th>' . "\n";
         echo '</tr>' . "\n";
         echo '<tr>' . "\n";
         echo '<td>' . "\n";
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:67,代码来源:down-ops.inc.php

示例4: amazon_cf_url

 /**
  * Creates an Amazon CloudFront RSA-SHA1 signature URL.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param string $file Input file path, to be signed by this routine.
  * @param bool   $stream Is this resource file to be served as streaming media?
  * @param bool   $inline Is this resource file to be served inline, or no?
  * @param bool   $ssl Is this resource file to be served via SSL, or no?
  * @param string $basename The absolute basename of the resource file.
  * @param string $mimetype The MIME content-type of the resource file.
  *
  * @return string An RSA-SHA1 signature URL for Amazon CloudFront.
  */
 public static function amazon_cf_url($file = '', $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = '', $mimetype = '')
 {
     $file = trim((string) $file, '/');
     // Trim & force string.
     $url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
     $url_e_file = str_ireplace('%2F', '/', $url_e_file);
     foreach ($GLOBALS['WS_PLUGIN__']['s2member']['o'] as $option => $option_value) {
         if (preg_match('/^amazon_cf_files_/', $option) && ($option = preg_replace('/^amazon_cf_files_/', '', $option))) {
             $cfc[$option] = $option_value;
         }
     }
     $cfc['expires'] = strtotime('+' . apply_filters('ws_plugin__s2member_amazon_cf_file_expires_time', '24 hours', get_defined_vars()));
     $cf_extn = strtolower(substr($file, strrpos($file, '.') + 1));
     // Parses the file extension out so we can scan it in some special scenarios.
     $cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? FALSE : TRUE;
     // Do NOT restrict access to a particular IP during `localhost` development. The IP may NOT be the same one Amazon CloudFront sees.
     $cf_stream_extn_resource_exclusions = array_unique((array) apply_filters('ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions', array('mp3'), get_defined_vars()));
     // MP3 files should NOT include an extension in their resource reference.
     $cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, '.')) : $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
     $cf_url = $stream ? 'rtmp' . ($ssl ? 'e' : '') . '://' . ($cfc['distro_streaming_cname'] ? $cfc['distro_streaming_cname'] : $cfc['distro_streaming_dname']) . '/cfx/st/' . $file : 'http' . ($ssl ? 's' : '') . '://' . ($cfc['distro_downloads_cname'] ? $cfc['distro_downloads_cname'] : $cfc['distro_downloads_dname']) . '/' . $url_e_file;
     $cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER['REMOTE_ADDR']) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc['expires'] . '}}}]}';
     $cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
     $cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array('+', '=', '/'), array('-', '_', '~'), FALSE);
     $cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array('+', '=', '/'), array('-', '_', '~'), FALSE);
     return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array('Policy' => $cf_base64_url_safe_policy, 'Signature' => $cf_base64_url_safe_signature, 'Key-Pair-Id' => $cfc['private_key_id']))), $cf_url);
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:41,代码来源:files-in.inc.php

示例5: remote

 /**
  * Responsible for all remote communications processed by s2Member.
  *
  * Uses ``wp_remote_request()`` through the `WP_Http` class.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string $url Full URL with possible query string parameters.
  * @param string|array $post_body Optional. Either a string of POST data, or an array.
  * @param array $args Optional. An array of additional arguments used by ``wp_remote_request()``.
  * @param bool $return_array Optional. If true, instead of a string, we return an array with elements:
  * 	`code` *(http response code)*, `message` *(http response message)*, `headers` *(an array of lowercase headers)*, `body` *(the response body string)*, `response` *(full response array)*.
  * @return str|array|bool Requested response str|array from remote location *(see ``$return_array`` parameter )*; else (bool)`false` on failure.
  */
 public static function remote($url = FALSE, $post_body = FALSE, $args = FALSE, $return_array = FALSE)
 {
     if (!$url || !is_string($url)) {
         return false;
     }
     $args = !is_array($args) ? array() : $args;
     $args['s2member'] = WS_PLUGIN__S2MEMBER_VERSION;
     // s2Member connection.
     $args['httpversion'] = !isset($args['httpversion']) ? '1.1' : $args['httpversion'];
     $args['user-agent'] = !isset($args['user-agent']) ? 's2Member v' . WS_PLUGIN__S2MEMBER_VERSION . '; ' . home_url() : $args['user-agent'];
     if (!isset($args['sslverify']) && c_ws_plugin__s2member_utils_conds::is_localhost()) {
         $args['sslverify'] = FALSE;
     } else {
         if (!isset($args['sslverify']) && strcasecmp(self::parse_url($url, PHP_URL_HOST), $_SERVER['HTTP_HOST']) === 0) {
             $args['sslverify'] = FALSE;
         }
     }
     // Don't require verification when posting to self.
     if ($post_body && (is_array($post_body) || is_string($post_body))) {
         $args = array_merge($args, array('method' => 'POST', 'body' => $post_body));
     }
     if (!empty($args['method']) && strcasecmp((string) $args['method'], 'DELETE') === 0 && version_compare(get_bloginfo('version'), '3.4', '<')) {
         add_filter('use_curl_transport', '__return_false', 111209554);
     }
     foreach (array_keys(get_defined_vars()) as $__v) {
         $__refs[$__v] =& ${$__v};
     }
     do_action('ws_plugin__s2member_before_wp_remote_request', get_defined_vars());
     unset($__refs, $__v);
     // Housekeeping.
     $response = wp_remote_request($url, $args);
     remove_filter('use_curl_transport', '__return_false', 111209554);
     if ($return_array && !is_wp_error($response) && is_array($response)) {
         $a = array('code' => (int) wp_remote_retrieve_response_code($response));
         $a = array_merge($a, array('message' => wp_remote_retrieve_response_message($response)));
         $a = array_merge($a, array('headers' => wp_remote_retrieve_headers($response)));
         $a = array_merge($a, array('body' => wp_remote_retrieve_body($response)));
         $a = array_merge($a, array('response' => $response));
         return $a;
         // Return array w/ ``$response`` too.
     }
     if (!is_wp_error($response) && is_array($response)) {
         return wp_remote_retrieve_body($response);
     }
     return false;
     // Remote request failed, return false.
 }
开发者ID:codeforest,项目名称:s2member,代码行数:62,代码来源:utils-urls.inc.php

示例6: remote

 /**
  * Responsible for all remote communications processed by s2Member.
  *
  * Uses ``wp_remote_request()`` through the `WP_Http` class.
  *
  * @package s2Member\Utilities
  * @since 3.5
  *
  * @param string $url Full URL with possible query string parameters.
  * @param string|array $post_vars Optional. Either a string of POST vars, or an array.
  * @param array $args Optional. An array of additional arguments used by ``wp_remote_request()``.
  * @param bool $return_array Optional. If true, instead of a string, we return an array with elements:
  * 	`code` *(http response code)*, `message` *(http response message)*, `headers` *(an array of lowercase headers)*, `body` *(the response body string)*, `response` *(full response array)*.
  * @return str|array|bool Requested response str|array from remote location *(see ``$return_array`` parameter )*; else (bool)`false` on failure.
  */
 public static function remote($url = FALSE, $post_vars = FALSE, $args = FALSE, $return_array = FALSE)
 {
     if ($url && is_string($url)) {
         $args = !is_array($args) ? array() : $args;
         $args["s2member"] = WS_PLUGIN__S2MEMBER_VERSION;
         // Indicates this is an s2Member connection.
         $args["httpversion"] = !isset($args["httpversion"]) ? "1.1" : $args["httpversion"];
         if (!isset($args["sslverify"]) && c_ws_plugin__s2member_utils_conds::is_localhost()) {
             $args["sslverify"] = FALSE;
         }
         // Force this off on localhost installs.
         if ((is_array($post_vars) || is_string($post_vars)) && !empty($post_vars)) {
             $args = array_merge($args, array("method" => "POST", "body" => $post_vars));
         }
         if (!empty($args["method"]) && strcasecmp((string) $args["method"], "DELETE") === 0 && version_compare(get_bloginfo("version"), "3.4", "<")) {
             add_filter("use_curl_transport", "__return_false", 111209554);
         }
         foreach (array_keys(get_defined_vars()) as $__v) {
             $__refs[$__v] =& ${$__v};
         }
         do_action("ws_plugin__s2member_before_wp_remote_request", get_defined_vars());
         unset($__refs, $__v);
         $response = wp_remote_request($url, $args);
         remove_filter("use_curl_transport", "__return_false", 111209554);
         if ($return_array && !is_wp_error($response) && is_array($response)) {
             $a = array("code" => (int) wp_remote_retrieve_response_code($response));
             $a = array_merge($a, array("message" => wp_remote_retrieve_response_message($response)));
             $a = array_merge($a, array("headers" => wp_remote_retrieve_headers($response)));
             $a = array_merge($a, array("body" => wp_remote_retrieve_body($response)));
             $a = array_merge($a, array("response" => $response));
             return $a;
         } else {
             if (!is_wp_error($response) && is_array($response)) {
                 return wp_remote_retrieve_body($response);
             } else {
                 // Else this remote request has failed completely. Return false.
                 return false;
             }
         }
         // Remote request failed, return false.
     } else {
         // Else, return false.
         return false;
     }
 }
开发者ID:EliasGoldberg,项目名称:troop-sim,代码行数:60,代码来源:utils-urls.inc.php

示例7: amazon_cf_url

 /**
  * Creates an Amazon CloudFront RSA-SHA1 signature URL.
  *
  * @package s2Member\Files
  * @since 110926
  *
  * @param str $file Input file path, to be signed by this routine.
  * @param bool $stream Is this resource file to be served as streaming media?
  * @param bool $inline Is this resource file to be served inline, or no?
  * @param bool $ssl Is this resource file to be served via SSL, or no?
  * @param str $basename The absolute basename of the resource file.
  * @param str $mimetype The MIME content-type of the resource file.
  * @return str An RSA-SHA1 signature URL for Amazon CloudFront.
  */
 public static function amazon_cf_url($file = FALSE, $stream = FALSE, $inline = FALSE, $ssl = FALSE, $basename = FALSE, $mimetype = FALSE)
 {
     $file = trim((string) $file, "/");
     $url_e_file = c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode($file));
     $url_e_file = str_ireplace("%2F", "/", $url_e_file);
     foreach ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"] as $option => $option_value) {
         if (preg_match("/^amazon_cf_files_/", $option) && ($option = preg_replace("/^amazon_cf_files_/", "", $option))) {
             $cfc[$option] = $option_value;
         }
     }
     $cfc["expires"] = strtotime("+" . apply_filters("ws_plugin__s2member_amazon_cf_file_expires_time", "24 hours", get_defined_vars()));
     $cf_extn = strtolower(substr($file, strrpos($file, ".") + 1));
     $cf_ip_res = c_ws_plugin__s2member_utils_conds::is_localhost() ? false : true;
     $cf_stream_extn_resource_exclusions = array_unique((array) apply_filters("ws_plugin__s2member_amazon_cf_file_streaming_extension_resource_exclusions", array("mp3"), get_defined_vars()));
     $cf_resource = $stream ? in_array($cf_extn, $cf_stream_extn_resource_exclusions) ? substr($file, 0, strrpos($file, ".")) : $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
     $cf_url = $stream ? "rtmp" . ($ssl ? "e" : "") . "://" . ($cfc["distro_streaming_cname"] ? $cfc["distro_streaming_cname"] : $cfc["distro_streaming_dname"]) . "/cfx/st/" . $file : "http" . ($ssl ? "s" : "") . "://" . ($cfc["distro_downloads_cname"] ? $cfc["distro_downloads_cname"] : $cfc["distro_downloads_dname"]) . "/" . $url_e_file;
     $cf_policy = '{"Statement":[{"Resource":"' . c_ws_plugin__s2member_utils_strings::esc_dq($cf_resource) . '","Condition":{' . ($cf_ip_res ? '"IpAddress":{"AWS:SourceIp":"' . c_ws_plugin__s2member_utils_strings::esc_dq($_SERVER["REMOTE_ADDR"]) . '/32"},' : '') . '"DateLessThan":{"AWS:EpochTime":' . (int) $cfc["expires"] . '}}}]}';
     $cf_signature = c_ws_plugin__s2member_files_in::amazon_cf_rsa_sign($cf_policy);
     $cf_base64_url_safe_policy = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_policy, array("+", "=", "/"), array("-", "_", "~"), false);
     $cf_base64_url_safe_signature = c_ws_plugin__s2member_utils_strings::base64_url_safe_encode($cf_signature, array("+", "=", "/"), array("-", "_", "~"), false);
     return add_query_arg(c_ws_plugin__s2member_utils_strings::urldecode_ur_chars_deep(urlencode_deep(array("Policy" => $cf_base64_url_safe_policy, "Signature" => $cf_base64_url_safe_signature, "Key-Pair-Id" => $cfc["private_key_id"]))), $cf_url);
 }
开发者ID:novichkovv,项目名称:candoweightloss,代码行数:36,代码来源:files-in.inc.php


注:本文中的c_ws_plugin__s2member_utils_conds::is_localhost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。