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


PHP WPFB_Core::GetPostUrl方法代码示例

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


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

示例1: PrintJS

 static function PrintJS()
 {
     static $printed = false;
     if ($printed) {
         return;
     }
     $printed = true;
     wp_print_scripts(WPFB);
     $context_menu = current_user_can('upload_files') && !empty(WPFB_Core::$settings->file_context_menu) && !is_admin();
     $conf = array('ql' => !is_admin(), 'hl' => (int) WPFB_Core::$settings->hide_links, 'pl' => WPFB_Core::$settings->disable_permalinks ? 0 : (int) (!!get_option('permalink_structure')), 'hu' => trailingslashit(home_url()), 'db' => WPFB_Core::$settings->download_base, 'fb' => WPFB_Core::GetPostUrl(WPFB_Core::$settings->file_browser_post_id), 'cm' => (int) $context_menu, 'ajurl' => WPFB_Core::$ajax_url, 'ajurlpub' => WPFB_Core::$ajax_url_public);
     if ($context_menu) {
         $conf['fileEditUrl'] = admin_url("admin.php?page=wpfilebase_files&action=editfile&file_id=");
         //wp_print_scripts('jquery-contextmenu');
         //wp_print_styles	('jquery-contextmenu');
     }
     echo "<script type=\"text/javascript\">\n//<![CDATA[\n", 'wpfbConf=', json_encode($conf), ';';
     if ($context_menu) {
         echo "wpfbContextMenu=[\n\t{'", __('Edit'), "':{onclick:wpfb_menuEdit,icon:'" . WPFB_PLUGIN_URI . "extras/jquery/contextmenu/page_white_edit.png'}, },\n\tjQuery.contextMenu.separator,\n\t{'", __('Delete'), "':{onclick:wpfb_menuDel,icon:'" . WPFB_PLUGIN_URI . "extras/jquery/contextmenu/delete_icon.gif'}}\n];\n";
     }
     echo "function wpfb_ondl(file_id,file_url,file_path){ ", WPFB_Core::$settings->dlclick_js, " }";
     echo "\n//]]>\n</script>\n";
 }
开发者ID:noxian,项目名称:WP-Filebase,代码行数:22,代码来源:Output.php

示例2: ParseQuery

 static function ParseQuery(&$query)
 {
     // conditional loading of the search hooks
     global $wp_query;
     if (!empty($wp_query->query_vars['s'])) {
         wpfb_loadclass('Search');
     }
     if (!empty($_GET['wpfb_s']) || !empty($_GET['s'])) {
         WPFB_Core::$file_browser_search = true;
         add_filter('the_excerpt', array(__CLASS__, 'SearchExcerptFilter'), 100);
         // must be lower than 11 (before do_shortcode) and after wpautop (>9)
     }
     // check if current post is file browser
     if (($id = self::GetPostId($query)) == WPFB_Core::$settings->file_browser_post_id) {
         wpfb_loadclass('File', 'Category');
         if (!empty($_GET['wpfb_file'])) {
             self::$file_browser_item = WPFB_File::GetFile($_GET['wpfb_file']);
         } elseif (!empty($_GET['wpfb_cat'])) {
             self::$file_browser_item = WPFB_Category::GetCat($_GET['wpfb_cat']);
         } else {
             $url = (is_ssl() ? 'https' : 'http') . '://' . $_SERVER["HTTP_HOST"] . stripslashes($_SERVER['REQUEST_URI']);
             if (($qs = strpos($url, '?')) !== false) {
                 $url = substr($url, 0, $qs);
             }
             // remove query string
             $path = trim(substr($url, strlen(WPFB_Core::GetPostUrl($id))), '/');
             if (!empty($path)) {
                 self::$file_browser_item = WPFB_Item::GetByPath(urldecode($path));
                 if (is_null(self::$file_browser_item)) {
                     self::$file_browser_item = WPFB_Item::GetByPath($path);
                 }
             }
         }
     }
 }
开发者ID:Seravo,项目名称:WP-Filebase,代码行数:35,代码来源:Core.php

示例3: widget

 function widget($args, $instance)
 {
     wpfb_loadclass('File', 'Category', 'Output');
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget, $before_title . (empty($title) ? __('Search Files', WPFB) : $title) . $after_title;
     $prefix = "wpfb-search-widget-" . $this->id_base;
     $fbp_id = WPFB_Core::$settings->file_browser_post_id;
     $action = WPFB_Core::GetPostUrl($fbp_id);
     $p_in_query = strpos($action, '?') !== false;
     // no permalinks?
     $action = $p_in_query ? remove_query_arg(array('p', 'post_id', 'page_id', 'wpfb_s')) : $action;
     echo WPFB_Output::GetSearchForm($action, $p_in_query ? array('p' => $fbp_id) : null, "");
     echo $after_widget;
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:15,代码来源:Widget.php

示例4: Download

 function Download()
 {
     global $wpdb, $current_user, $user_ID;
     @error_reporting(0);
     wpfb_loadclass('Category', 'Download');
     $downloader_ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
     get_currentuserinfo();
     $logged_in = !empty($user_ID);
     $user_role = $logged_in ? reset($current_user->roles) : null;
     // get user's highest role (like in user-eidt.php)
     $is_admin = current_user_can('manage_options');
     // check user level
     if (!$this->CurUserCanAccess()) {
         $this->DownloadDenied('inaccessible_msg');
     }
     // check offline
     if ($this->file_offline && !$is_admin) {
         wp_die(WPFB_Core::$settings->file_offline_msg);
     }
     // check referrer
     if ($this->file_direct_linking != 1) {
         // if referer check failed, redirect to the file post
         if (!WPFB_Download::RefererCheck()) {
             $url = WPFB_Core::GetPostUrl($this->file_post_id);
             if (empty($url)) {
                 $url = home_url();
             }
             wp_redirect($url);
             exit;
         }
     }
     // check traffic
     if ($this->IsLocal() && !WPFB_Download::CheckTraffic($this->file_size)) {
         header('HTTP/1.x 503 Service Unavailable');
         wp_die(WPFB_Core::$settings->traffic_exceeded_msg);
     }
     // check daily user limit
     if (!$is_admin && WPFB_Core::$settings->daily_user_limits) {
         if (!$logged_in) {
             $this->DownloadDenied('inaccessible_msg');
         }
         $today = intval(date('z'));
         $usr_dls_today = intval(get_user_option(WPFB_OPT_NAME . '_dls_today'));
         $usr_last_dl_day = intval(date('z', intval(get_user_option(WPFB_OPT_NAME . '_last_dl'))));
         if ($today != $usr_last_dl_day) {
             $usr_dls_today = 0;
         }
         // check for limit
         $dl_limit = intval(WPFB_Core::GetOpt('daily_limit_' . $user_role));
         if ($dl_limit > 0 && $usr_dls_today >= $dl_limit) {
             $this->DownloadDenied(sprintf(WPFB_Core::$settings->daily_limit_exceeded_msg, $dl_limit));
         }
         $usr_dls_today++;
         update_user_option($user_ID, WPFB_OPT_NAME . '_dls_today', $usr_dls_today);
         update_user_option($user_ID, WPFB_OPT_NAME . '_last_dl', time());
     }
     // count download
     if (!$is_admin || !WPFB_Core::$settings->ignore_admin_dls) {
         $last_dl_time = mysql2date('U', $this->file_last_dl_time, false);
         if (empty($this->file_last_dl_ip) || $this->file_last_dl_ip != $downloader_ip || time() - $last_dl_time > 86400) {
             $wpdb->query("UPDATE " . $wpdb->wpfilebase_files . " SET file_hits = file_hits + 1, file_last_dl_ip = '" . $downloader_ip . "', file_last_dl_time = '" . current_time('mysql') . "' WHERE file_id = " . (int) $this->file_id);
         }
     }
     // external hooks
     do_action('wpfilebase_file_downloaded', $this->file_id);
     $url = $this->GetRemoteUri();
     $is_local_remote = !empty($url) && parse_url($url, PHP_URL_SCHEME) === 'file' && is_readable($url);
     // download or redirect
     if ($this->IsLocal() || $is_local_remote) {
         $bw = 'bitrate_' . ($logged_in ? 'registered' : 'unregistered');
         WPFB_Download::SendFile($is_local_remote ? $url : $this->GetLocalPath(), array('bandwidth' => WPFB_Core::$settings->{$bw}, 'etag' => $this->file_hash, 'md5_hash' => WPFB_Core::$settings->fake_md5 ? null : $this->file_hash, 'force_download' => WPFB_Core::$settings->force_download || $this->file_force_download, 'cache_max_age' => 10, 'filename' => empty($this->file_name_original) ? $this->file_name : $this->file_name_original));
     } else {
         //header('HTTP/1.1 301 Moved Permanently');
         header('Cache-Control: no-store, no-cache, must-revalidate');
         header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
         header('Location: ' . $url);
     }
     exit;
 }
开发者ID:TishoTM,项目名称:WP-Filebase,代码行数:79,代码来源:File.php


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