本文整理汇总了PHP中wpdm_query_var函数的典型用法代码示例。如果您正苦于以下问题:PHP wpdm_query_var函数的具体用法?PHP wpdm_query_var怎么用?PHP wpdm_query_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpdm_query_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Packages
function Packages($params = array('items_per_page' => 10, 'title' => false, 'desc' => false, 'order_by' => 'date', 'order' => 'desc', 'paging' => false, 'toolbar' => 1, 'template' => '', 'cols' => 3, 'colspad' => 2, 'colsphone' => 1, 'tags' => '', 'categorirs' => '', 'year' => '', 'month' => ''))
{
$params['order_by'] = isset($params['order_field']) && $params['order_field'] != '' && !isset($params['order_by']) ? $params['order_field'] : $params['order_by'];
$scparams = $params;
$defaults = array('items_per_page' => 10, 'title' => false, 'desc' => false, 'order_by' => 'date', 'order' => 'desc', 'paging' => false, 'toolbar' => 1, 'template' => 'link-template-panel', 'cols' => 3, 'colspad' => 2, 'colsphone' => 1);
$params = shortcode_atts($defaults, $params, 'wpdm_packages');
if (is_array($params)) {
extract($params);
}
$cwd_class = "col-md-" . (int) (12 / $cols);
$cwdsm_class = "col-sm-" . (int) (12 / $colspad);
$cwdxs_class = "col-xs-" . (int) (12 / $colsphone);
if (isset($id)) {
$id = trim($id, ", ");
$cids = explode(",", $id);
}
global $wpdb, $current_user, $post, $wp_query;
if (isset($order_by) && !isset($order_field)) {
$order_field = $order_by;
}
$order_field = isset($order_field) ? $order_field : 'date';
$order_field = isset($_GET['orderby']) ? $_GET['orderby'] : $order_field;
$order = isset($order) ? $order : 'desc';
$order = isset($_GET['order']) ? $_GET['order'] : $order;
$cp = wpdm_query_var('cp', 'num');
if (!$cp) {
$cp = 1;
}
$params = array('post_type' => 'wpdmpro', 'paged' => $cp, 'posts_per_page' => $items_per_page, 'include_children' => false);
if (isset($scparams['month']) && $scparams['month'] != '') {
$params['monthnum'] = $scparams['month'];
}
if (isset($scparams['year']) && $scparams['year'] != '') {
$params['year'] = $scparams['year'];
}
if (isset($scparams['day']) && $scparams['day'] != '') {
$params['day'] = $scparams['day'];
}
if (isset($scparams['search']) && $scparams['search'] != '') {
$params['s'] = $scparams['search'];
}
if (isset($scparams['tag']) && $scparams['tag'] != '') {
$params['tag'] = $scparams['tag'];
}
if (isset($scparams['tag_id']) && $scparams['tag_id'] != '') {
$params['tag_id'] = $scparams['tag_id'];
}
if (isset($scparams['tag__and']) && $scparams['tag__and'] != '') {
$params['tag__and'] = explode(",", $scparams['tag__and']);
}
if (isset($scparams['tag__in']) && $scparams['tag__in'] != '') {
$params['tag__in'] = explode(",", $scparams['tag__in']);
}
if (isset($scparams['tag__not_in']) && $scparams['tag__not_in'] != '') {
$params['tag__not_in'] = explode(",", $scparams['tag__not_in']);
}
if (isset($scparams['tag_slug__and']) && $scparams['tag_slug__and'] != '') {
$params['tag_slug__and'] = explode(",", $scparams['tag_slug__and']);
}
if (isset($scparams['tag_slug__in']) && $scparams['tag_slug__in'] != '') {
$params['tag_slug__in'] = explode(",", $scparams['tag_slug__in']);
}
if (isset($scparams['categories']) && $scparams['categories'] != '') {
$operator = isset($scparams['operator']) ? $scparams['operator'] : 'OR';
$params['tax_query'] = array(array('taxonomy' => 'wpdmcategory', 'field' => 'slug', 'terms' => explode(",", $scparams['categories']), 'include_children' => isset($scparams['include_children']) && $scparams['include_children'] != '' ? $scparams['include_children'] : false, 'operator' => $operator));
}
if (get_option('_wpdm_hide_all', 0) == 1) {
$params['meta_query'] = array(array('key' => '__wpdm_access', 'value' => '"guest"', 'compare' => 'LIKE'));
if (is_user_logged_in()) {
global $current_user;
$params['meta_query'][] = array('key' => '__wpdm_access', 'value' => $current_user->roles[0], 'compare' => 'LIKE');
$params['meta_query']['relation'] = 'OR';
}
}
$order_fields = array('__wpdm_download_count', '__wpdm_view_count', '__wpdm_package_size_b');
if (!in_array("__wpdm_" . $order_field, $order_fields)) {
$params['orderby'] = $order_field;
$params['order'] = $order;
} else {
$params['orderby'] = 'meta_value_num';
$params['meta_key'] = "__wpdm_" . $order_field;
$params['order'] = $order;
}
$params = apply_filters("wpdm_packages_query_params", $params);
$packs = new \WP_Query($params);
$total = $packs->found_posts;
$pages = ceil($total / $items_per_page);
$page = isset($_GET['cp']) ? $_GET['cp'] : 1;
$start = ($page - 1) * $items_per_page;
if (!isset($paging) || intval($paging) == 1) {
$pag = new \WPDM\libs\Pagination();
$pag->items($total);
$pag->nextLabel(' ► ');
$pag->prevLabel(' ◄ ');
$pag->limit($items_per_page);
$pag->currentPage($page);
}
$burl = get_permalink();
$url = $_SERVER['REQUEST_URI'];
//get_permalink();
//.........这里部分代码省略.........
示例2: enqueueScripts
/**
* Enqueue admin scripts & styles
*/
function enqueueScripts()
{
if (get_post_type() == 'wpdmpro' || in_array(wpdm_query_var('page'), array('settings', 'emails', 'wpdm-stats', 'templates', 'importable-files', 'wpdm-addons', 'orders', 'pp-license'))) {
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-form');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-timepicker', WPDM_BASE_URL . 'assets/js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-slider'));
wp_enqueue_style('icons', plugins_url() . '/download-manager/assets/css/icons.css');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_media();
wp_enqueue_script('jquery-choosen', plugins_url('/download-manager/assets/js/chosen.jquery.min.js'), array('jquery'));
wp_enqueue_style('choosen-css', plugins_url('/download-manager/assets/css/chosen.css'));
wp_enqueue_style('jqui-css', plugins_url('/download-manager/assets/jqui/theme/jquery-ui.css'));
wp_enqueue_script('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/js/bootstrap.min.js'), array('jquery'));
wp_enqueue_script('wpdm-admin', plugins_url('/download-manager/assets/js/wpdm-admin.js'), array('jquery'));
wp_enqueue_style('font-awesome', WPDM_BASE_URL . 'assets/font-awesome/css/font-awesome.min.css');
wp_enqueue_style('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/css/bootstrap.css'));
wp_enqueue_style('wpdm-bootstrap-theme', plugins_url('/download-manager/assets/bootstrap/css/bootstrap-theme.min.css'));
wp_enqueue_style('wpdm-admin-styles', plugins_url('/download-manager/assets/css/admin-styles.css'));
}
}
示例3: Dashboard
/**
* @usage Short-code function for front-end UI
* @return string
*/
function Dashboard()
{
global $current_user;
wp_reset_query();
$currentAccess = maybe_unserialize(get_option('__wpdm_front_end_access', array()));
$task = get_query_var('adb_page');
$task = explode("/", $task);
if ($task[0] == 'edit-package') {
$pid = $task[1];
}
if ($task[0] == 'page') {
$task[0] = '';
set_query_var('paged', $task[1]);
}
$task = $task[0];
if (!array_intersect($currentAccess, $current_user->roles) && is_user_logged_in()) {
return "<div class='w3eden'><div class='alert alert-danger'>" . wpautop(stripslashes(get_option('__wpdm_front_end_access_blocked', __('Sorry, Your Are Not Allowed!', 'wpdmpro')))) . "</div></div>";
}
$id = wpdm_query_var('ID');
$tabs = array();
$tabs = apply_filters('wpdm_frontend', $tabs);
$burl = get_permalink();
$sap = strpos($burl, '?') ? '&' : '?';
ob_start();
include \WPDM\Template::Locate('author-dashboard.php');
$data = ob_get_clean();
return $data;
}
示例4: Preview
/**
* @usage Preview link/page template
*/
function Preview()
{
error_reporting(0);
$wposts = array();
$template = wpdm_query_var("template", "html");
$type = wpdm_query_var("_type", "html");
$args = array('post_type' => 'wpdmpro', 'posts_per_page' => 1);
$wposts = get_posts($args);
$html = "";
foreach ($wposts as $p) {
$package = (array) $p;
$html .= FetchTemplate($template, $package, $type);
}
if (count($wposts) == 0) {
$html = "<div class='col-md-12'><div class='alert alert-info'>" . __('No package found! Please create at least 1 package to see template preview', 'wpdmpro') . "</div> </div>";
}
$html = "<div class='w3eden'>" . $html . "</div><div style='clear:both'></div>";
echo $html;
die;
}
示例5: wpdm_query_var
}
</style>
<div class="wpdm-front"><br>
<form id="wpdm-pf" action="" method="post">
<div class="row">
<div class="col-md-8">
<input type="hidden" id="act" name="act" value="<?php
echo wpdm_query_var('task', 'txt') == 'edit-package' ? '_ep_wpdm' : '_ap_wpdm';
?>
" />
<input type="hidden" name="id" id="id" value="<?php
echo wpdm_query_var('id', 'num');
?>
" />
<div class="form-group">
<input id="title" class="form-control input-lg" placeholder="Enter title here" type="text" value="<?php
echo isset($post->post_title) ? $post->post_title : '';
?>
" name="pack[post_title]" /><br/>
</div>
<div class="form-group">
<?php
$cont = isset($post) ? $post->post_content : '';
wp_editor(stripslashes($cont), 'post_content', array('textarea_name' => 'pack[post_content]'));
?>
</div>
示例6: wpdm_embed_category
function wpdm_embed_category($params = array('id' => '', 'operator' => 'IN', 'items_per_page' => 10, 'title' => false, 'desc' => false, 'order_field' => 'create_date', 'order' => 'desc', 'paging' => false, 'toolbar' => 1, 'template' => '', 'cols' => 3, 'colspad' => 2, 'colsphone' => 1))
{
extract($params);
$fnparams = $params;
if (!isset($id)) {
return;
}
if (!isset($items_per_page)) {
$items_per_page = 10;
}
if (!isset($template)) {
$template = 'link-template-calltoaction3.php';
}
if (!isset($cols)) {
$cols = 1;
}
if (!isset($colspad)) {
$colspad = 1;
}
if (!isset($colsphone)) {
$colsphone = 1;
}
if (!isset($toolbar)) {
$toolbar = 1;
}
$taxo = 'wpdmcategory';
if (isset($tag) && $tag == 1) {
$taxo = 'post_tag';
}
$cwd_class = "col-md-" . (int) (12 / $cols);
$cwdsm_class = "col-sm-" . (int) (12 / $colspad);
$cwdxs_class = "col-xs-" . (int) (12 / $colsphone);
$id = trim($id, ", ");
$cids = explode(",", $id);
global $wpdb, $current_user, $post, $wp_query;
$order_field = isset($order_field) ? $order_field : 'publish_date';
$order_field = isset($_GET['orderby']) ? $_GET['orderby'] : $order_field;
$order = isset($order) ? $order : 'desc';
$order = isset($_GET['order']) ? $_GET['order'] : $order;
$operator = isset($operator) ? $operator : 'IN';
$cpvar = 'cp_' . $cids[0];
$cp = wpdm_query_var($cpvar, 'num');
if (!$cp) {
$cp = 1;
}
$params = array('post_type' => 'wpdmpro', 'paged' => $cp, 'posts_per_page' => $items_per_page, 'include_children' => false, 'tax_query' => array(array('taxonomy' => $taxo, 'field' => 'slug', 'terms' => $cids, 'operator' => $operator)));
if (get_option('_wpdm_hide_all', 0) == 1) {
$params['meta_query'] = array(array('key' => '__wpdm_access', 'value' => 'guest', 'compare' => 'LIKE'));
if (is_user_logged_in()) {
global $current_user;
$params['meta_query'][] = array('key' => '__wpdm_access', 'value' => $current_user->roles[0], 'compare' => 'LIKE');
$params['meta_query']['relation'] = 'OR';
}
}
$params['orderby'] = $order_field;
$params['order'] = $order;
$params = apply_filters("wpdm_embed_category_query_params", $params);
$packs = new WP_Query($params);
$total = $packs->found_posts;
$pages = ceil($total / $items_per_page);
$page = isset($_GET[$cpvar]) ? $_GET[$cpvar] : 1;
$start = ($page - 1) * $items_per_page;
if (!isset($paging) || $paging == 1) {
$pag = new \WPDM\libs\Pagination();
$pag->items($total);
$pag->nextLabel(' ► ');
$pag->prevLabel(' ◄ ');
$pag->limit($items_per_page);
$pag->currentPage($page);
}
$burl = get_permalink();
$url = $_SERVER['REQUEST_URI'];
//get_permalink();
$url = strpos($url, '?') ? $url . '&' : $url . '?';
$url = preg_replace("/[\\&]*{$cpvar}=[0-9]+[\\&]*/", "", $url);
$url = strpos($url, '?') ? $url . '&' : $url . '?';
if (!isset($paging) || $paging == 1) {
$pag->urlTemplate($url . "{$cpvar}=[%PAGENO%]");
}
$html = '';
$templates = maybe_unserialize(get_option("_fm_link_templates", true));
if (isset($templates[$template])) {
$template = $templates[$template]['content'];
}
global $post;
while ($packs->have_posts()) {
$packs->the_post();
$pack = (array) $post;
$repeater = "<div class='{$cwd_class} {$cwdsm_class} {$cwdxs_class}'>" . FetchTemplate($template, $pack) . "</div>";
$html .= $repeater;
}
wp_reset_query();
$html = "<div class='row'>{$html}</div>";
$cname = array();
foreach ($cids as $cid) {
$cat = get_term_by('slug', $cid, $taxo);
$cname[] = $cat->name;
}
$cats = implode(", ", $cname);
//Added from v4.2.1
//.........这里部分代码省略.........
示例7: wpdm_query_var
<?php
$invoice = wpdm_query_var('invoice', 'txt') ? wpdm_query_var('invoice', 'txt') : '';
if ($invoice != '') {
$oorder = new Order();
$order = $oorder->GetOrder($invoice);
if ($order->uid != 0) {
$invoice = '';
}
}
$redirect = isset($_GET['redirect_to']) ? $_GET['redirect_to'] : get_permalink(get_the_ID());
?>
<div class="w3eden be-member">
<div style="width: 350px;max-width: 98%;margin: 50px auto">
<div class="btn-group btn-group-justified" id="be-member-btns">
<a href="#wpdmlogin" data-toggle="tab" class="btn btn-info btn-lg active"><?php
_e('Log In', 'wpdmpro');
?>
</a>
<a href="#wpdmregister" data-toggle="tab" class="btn btn-info btn-lg"><?php
_e('Register', 'wpdmpro');
?>
</a>
</div>
<div class="tab-content">
示例8: wpdm_embed_tree
function wpdm_embed_tree()
{
if (wpdm_query_var('task', 'txt') != 'wpdm_tree') {
return;
}
global $wpdb;
$cats = get_terms('wpdmcategory', array('hide_empty' => false));
echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
// All Cats
$scat = wpdm_query_var('dir') == '/' ? '' : wpdm_query_var('dir', 'txt');
foreach ($cats as $id => $cat) {
if ($cat->parent == intval($scat)) {
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . $cat->term_id . "\">" . $cat->name . "</a></li>";
}
}
// All files
$params = array('post_type' => 'wpdmpro', 'posts_per_page' => 9999);
//if($scat!='')
$params['tax_query'] = array(array('taxonomy' => 'wpdmcategory', 'field' => 'term_id', 'terms' => $scat, 'include_children' => false));
$packs = new WP_Query($params);
while ($packs->have_posts()) {
$packs->the_post();
$files = maybe_unserialize(get_post_meta(get_the_ID(), '__wpdm_files', true));
if (count($files) == 1) {
$ext = explode(".", $files[0]);
$ext = end($ext);
}
if (count($files) > 1) {
$ext = 'zip';
}
if (!is_array($files) || count($files) == 0) {
$ext = '_blank';
}
if (wpdm_query_var('ddl', 'int') == 0 || wpdm_is_locked(get_the_ID())) {
echo "<li class=\"file ext_{$ext}\"><a href='" . get_permalink(get_the_ID()) . "' rel='" . get_permalink(get_the_ID()) . "'>" . get_the_title() . "</a></li>";
} else {
echo "<li class=\"file ext_{$ext}\"><a href='" . wpdm_download_url(get_the_ID()) . "' rel='" . wpdm_download_url(get_the_ID()) . "'>" . get_the_title() . "</a></li>";
}
}
echo "</ul>";
die;
}
示例9: isset
$default['page'] = '[thumb_700x400]
<br style="clear:both"/>
[description]
<fieldset class="pack_stats">
<legend><b>Package Statistics</b></legend>
<table class="table table-bordered">
<tr><td>Total Downloads:</td><td>[download_count]</td></tr>
<tr><td>Stock Limit:</td><td>[quota]</td></tr>
<tr><td>Total Files:</td><td>[file_count]</td></tr>
</table>
</fieldset><br>
[download_link]';
$ttype = isset($_GET['_type']) ? esc_attr($_GET['_type']) : 'link';
$tpl = maybe_unserialize(get_option("_fm_{$ttype}_templates", array()));
if (wpdm_query_var('tplid', 'txt') != "") {
$tpl = isset($tpl[wpdm_query_var('tplid', 'txt')]) ? $tpl[wpdm_query_var('tplid', 'txt')] : array();
}
$tpl['content'] = isset($tpl['content']) ? $tpl['content'] : $default[$ttype];
if (isset($_GET['clone']) && $_GET['clone'] != '') {
$ltpldir = get_stylesheet_directory() . '/download-manager/' . $ttype . '-templates/';
if (!file_exists($ltpldir) || !file_exists($ltpldir . basename($_GET['clone']))) {
$ltpldir = WPDM_BASE_DIR . 'tpls/' . $ttype . '-templates/';
}
if (file_exists($ltpldir . basename($_GET['clone']))) {
$template = file_get_contents($ltpldir . basename($_GET['clone']));
$regx = isset($_GET['_type']) && $_GET['_type'] == 'link' ? "/<\\!\\-\\-[\\s]*WPDM[\\s]+Link[\\s]+Template[\\s]*:([^\\-\\->]+)\\-\\->/" : "/<\\!\\-\\-[\\s]*WPDM[\\s]+Template[\\s]*:([^\\-\\->]+)\\-\\->/";
$type = ucfirst($_GET['_type']);
$tpl['title'] = "New {$ttype} Template";
$tpl['content'] = preg_replace($regx, "", $template);
}
}
示例10: wpdm_categories_checkboxed_tree
}
wpdm_categories_checkboxed_tree($cparent, $term_list);
echo "</ul>";
?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><b><?php
_e('Main Preview Image', 'wpdmpro');
?>
</b></div>
<div class="inside">
<div id="img"><?php
if (has_post_thumbnail(wpdm_query_var('id', 'num'))) {
$thumbnail_id = get_post_thumbnail_id(wpdm_query_var('id', 'num'));
$thumbnail_url = wp_get_attachment_image_src($thumbnail_id, 'full', true);
?>
<p><img src="<?php
echo $thumbnail_url[0];
?>
" width="240" alt="preview" /><input type="hidden" name="file[preview]" value="<?php
echo $thumbnail_url[0];
?>
" id="fpvw" /></p>
<a href="#" id="rmvp" class="text-danger">Remove Featured Image</a>
<?php
} else {
?>
<a href="#" id="wpdm-featured-image"> </a>
<input type="hidden" name="file[preview]" value="" id="fpvw" />
示例11: wpdm_query_var
}
?>
</a></th>
<th style="" class="manage-column column-media" id="media" scope="col" align="center"><a href='<?php
echo $burl . $sap;
?>
sfield=publish_date&sorder=<?php
echo wpdm_query_var('sorder') == 'asc' ? 'desc' : 'asc';
echo $qr;
?>
&paged=<?php
echo $paged;
?>
'><span>Publish Date</span> <?php
if (wpdm_query_var('sfield') == 'publish_date') {
echo wpdm_query_var('sorder') == 'asc' ? '<i class="fa fa-chevron-up" style="color:#D2322D;margin-left:10px"></i>' : '<i class="fa fa-chevron-down" style="color:#D2322D;margin-left:10px"></i>';
}
?>
</a></th>
<th style="" class="manage-column column-media" id="media" scope="col" align="center">Status</th>
<th style="" class="manage-column column-media" id="media" scope="col" align="center">Actions</th>
</tr>
</tfoot>
<tbody class="list:post" id="the-list">
<?php
while ($res->have_posts()) {
$res->the_post();
global $post;
?>
<tr valign="top" class="alternate author-self status-inherit" id="post-<?php
示例12: Explore
function Explore()
{
if (wpdm_query_var('page', 'txt') != 'wpdm-google-drive' || !current_user_can('edit_posts')) {
return;
}
$wpdm_google_drive = maybe_unserialize(get_option('__wpdm_google_drive', array()));
if (!isset($wpdm_google_drive['api_key']) || $wpdm_google_drive['api_key'] == '') {
wp_die("Missing Google Drive API Credentials! <a href='edit.php?post_type=wpdmpro&page=settings&tab=cloud-storage' target='_blank'>Configure Here</a>");
}
echo "<!DOCTYPE html><html><head></head><body>";
$client = new Google_Client();
$client->setClientId($wpdm_google_drive['client_id']);
$client->setClientSecret($wpdm_google_drive['client_secret']);
$client->addScope(Google_Service_Drive::DRIVE);
$client->addScope(Google_Service_Drive::DRIVE_FILE);
$client->addScope(Google_Service_Drive::DRIVE_READONLY);
$client->addScope(Google_Service_Drive::DRIVE_APPDATA);
$client->addScope(Google_Service_Drive::DRIVE_APPS_READONLY);
$client->addScope(Google_Service_Drive::DRIVE_METADATA_READONLY);
$client->setRedirectUri(admin_url('/?page=wpdm-google-drive'));
$access_token = isset($_SESSION['wpdmgd_access_token']) ? $_SESSION['wpdmgd_access_token'] : '';
if ($access_token == '') {
$auth_url = $client->createAuthUrl();
if (isset($_GET['code'])) {
$_SESSION['gacode'] = $_GET['code'];
$client->authenticate($_GET['code']);
?>
<script>
window.opener.location = window.opener.location;
window.close();
</script>
<?php
} else {
?>
<script src="<?php
echo includes_url('/js/jquery/jquery.js');
?>
"></script>
<link rel="stylesheet" href="<?php
echo WPDM_BASE_URL;
?>
bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="<?php
echo WPDM_BASE_URL;
?>
font-awesome/css/font-awesome.min.css"/>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,800' rel='stylesheet'
type='text/css'>
<style>
.w3eden *:not(.fa) {
font-family: 'Open Sans', arial, helvetica, sans-serif;
font-size: 10pt;
}
td, th {
vertical-align: middle !important;
}
</style>
<div class="w3eden">
<table style="width: 100%;height: 300px">
<tr>
<td style="vertical-align: middle;text-align: center">
<a class="btn btn-danger" href="#"
onclick='window.open("<?php
echo $auth_url;
?>
", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");return false;'><i
class="fa fa-google"></i> Login to Google Drive</a>
</td>
</tr>
</table>
</div>
<?php
//echo '<script>window.open("'.$auth_url.'", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=500, left=500, width=400, height=400");</script>';
die;
}
$access_token = $client->getAccessToken();
$_SESSION['wpdmgd_access_token'] = $access_token;
die;
} else {
$client->setAccessToken($access_token);
}
if ($client->isAccessTokenExpired()) {
$access_token = '';
unset($_SESSION['wpdmgd_access_token']);
try {
$code = isset($_SESSION['gacode']) ? $_SESSION['gacode'] : '';
$client->authenticate($code);
$NewAccessToken = json_decode($client->getAccessToken());
$client->refreshToken($NewAccessToken->refresh_token);
} catch (Exception $e) {
$auth_url = $client->createAuthUrl();
?>
<script src="<?php
echo includes_url('/js/jquery/jquery.js');
?>
"></script>
<link rel="stylesheet" href="<?php
echo WPDM_BASE_URL;
//.........这里部分代码省略.........
示例13: pluginUpdate
function pluginUpdate()
{
if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == 1) {
delete_option('__wpdm_suname');
delete_option('__wpdm_supass');
delete_option('__wpdm_purchased_items');
delete_option('__wpdm_freeaddons');
die('<script>location.href="edit.php?post_type=wpdmpro&page=settings&tab=plugin-update";</script>Refreshing...');
}
if (isset($_POST['__wpdm_suname']) && $_POST['__wpdm_suname'] != '') {
update_option('__wpdm_suname', $_POST['__wpdm_suname']);
update_option('__wpdm_supass', $_POST['__wpdm_supass']);
delete_option('__wpdm_purchased_items');
delete_option('__wpdm_freeaddons');
$purchased_items = remote_get('http://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&user=' . get_option('__wpdm_suname') . '&pass=' . urlencode(get_option('__wpdm_supass')));
$ret = json_decode($purchased_items);
if (isset($ret->error) && $ret->error != '') {
die('Login Failed! Please recheck your login info.');
} else {
update_option('__wpdm_purchased_items', $purchased_items);
die('<script>location.href=location.href;</script>Login successful. Refreshing...');
}
}
if (get_option('__wpdm_suname') != '') {
$purchased_items = get_option('__wpdm_purchased_items', false);
if (!$purchased_items || wpdm_query_var('newpurchase') != '') {
$purchased_items = remote_get('http://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&user=' . get_option('__wpdm_suname') . '&pass=' . urlencode(get_option('__wpdm_supass')));
update_option('__wpdm_purchased_items', $purchased_items);
}
$purchased_items = json_decode($purchased_items);
if (isset($purchased_items->error)) {
delete_option('__wpdm_suname');
delete_option('__wpdm_purchased_items');
}
if (isset($purchased_items->error)) {
$purchased_items->error = str_replace("[redirect]", admin_url("edit.php?post_type=wpdmpro&page=settings&tab=plugin-update"), $purchased_items->error);
}
}
if (get_option('__wpdm_freeaddons') == '' || wpdm_query_var('newpurchase') != '' || 1) {
$freeaddons = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getPackageList&cat_id=1148');
update_option('__wpdm_freeaddons', $freeaddons);
}
$freeaddons = json_decode(get_option('__wpdm_freeaddons'));
include WPDM_BASE_DIR . 'admin/tpls/settings/addon-update.php';
}
示例14: maybe_unserialize
[download_link]';
$default['page'] = '[thumb_700x400]
<br style="clear:both"/>
[description]
<fieldset class="pack_stats">
<legend><b>Package Statistics</b></legend>
<table>
<tr><td>Total Downloads:</td><td>[download_count]</td></tr>
<tr><td>Stock Limit:</td><td>[quota]</td></tr>
<tr><td>Total Files:</td><td>[file_count]</td></tr>
</table>
</fieldset><br>
[download_link]';
$tpl = maybe_unserialize(get_option("_fm_{$ttype}_templates", array()));
if (wpdm_query_var('tplid', 'txt') != "") {
$tpl = isset($tpl[$_GET['tplid']]) ? $tpl[$_GET['tplid']] : array();
}
$tpl['content'] = isset($tpl['content']) ? $tpl['content'] : $default[$ttype];
if (isset($_GET['clone']) && $_GET['clone'] != '' && file_exists(WPDM_BASE_DIR . '/templates/' . $_GET['clone'])) {
$template = file_get_contents(WPDM_BASE_DIR . '/templates/' . $_GET['clone']);
$regx = isset($_GET['_type']) && $_GET['_type'] == 'link' ? "/<\\!\\-\\-[\\s]*WPDM[\\s]+Link[\\s]+Template[\\s]*:([^\\-\\->]+)\\-\\->/" : "/<\\!\\-\\-[\\s]*WPDM[\\s]+Template[\\s]*:([^\\-\\->]+)\\-\\->/";
$type = ucfirst($_GET['_type']);
$tpl['title'] = "New {$type} Template";
$tpl['content'] = preg_replace($regx, "", $template);
}
?>
<tbody class="list:post" id="the-list">
<tr valign="top" class="alternate author-self status-inherit" id="post-8">
示例15: EditProfile
public function EditProfile()
{
global $wpdb, $current_user, $wp_query;
wp_reset_query();
$currentAccess = maybe_unserialize(get_option('__wpdm_front_end_access', array()));
if (!array_intersect($currentAccess, $current_user->roles) && is_user_logged_in()) {
return WPDM_Messages::Error(wpautop(stripslashes(get_option('__wpdm_front_end_access_blocked'))), -1);
}
$cond_uid = wpdm_multi_user("and uid='{$current_user->ID}'");
$id = wpdm_query_var('ID');
ob_start();
if (is_user_logged_in()) {
include wpdm_tpl_path('wpdm-edit-user-profile.php');
} else {
include wpdm_tpl_path('wpdm-be-member.php');
}
$data = ob_get_clean();
return $data;
}