Example #1
0
 function rjdgshop_shortcode($args)
 {
     $args = wp_parse_args($args, array());
     $items = array();
     if (!empty($args['id'])) {
         $i = new RJDGSHOP($args['item_id']);
         array_push($items, $i);
     } elseif (!empty($args['pattern'])) {
         $r = new RJDGSHOP();
         $items = $r->listByCol($args['pattern']);
         unset($r);
     }
     array_walk($items, create_function('&$i,$k', ' $i=new RJDGSHOP($i->id); $i->_button=RJDGPP::getButton($i);'));
     ob_start();
     require_once dirname(__FILE__) . '/views/table.php';
     return ob_get_clean();
 }
Example #2
0
 public static function getTagList($postID)
 {
     $res = wp_cache_get('tag_post_' . $postID, 'rjdgpp');
     if (empty($res) || is_array($res) && count($res) < 1) {
         $s = new RJDGSHOP();
         $tg = get_the_tags($postID);
         if (is_array($tg)) {
             array_walk($tg, create_function('&$i,$k', '$i=strtolower($i->slug);'));
         } else {
             $tg = array();
         }
         $res = $s->listByMeta($tg, 'tags');
         unset($s);
         wp_cache_set('tag_post_' . $postID, $res, 'rjdgpp', 86400);
     } else {
         $res = array();
     }
     return $res;
 }
Example #3
0
 *   Author: Reynald Jay Cueto
 *   Author URI: http://www.myminipin.com/
 *   Description: For public/non-admin requests
 */
include_once dirname(__FILE__) . '/../../../wp-load.php';
header('Content-Type: application/json');
status_header(200);
$idata = json_decode(file_get_contents('php://input'));
$odata = array('response' => 'failed');
if (!empty($idata->q)) {
    switch ($idata->q) {
        case 'status':
            $t = new RJDGPPTXN();
            if ($t->loadBy('session_id', session_id())) {
                if ($t->isComplete()) {
                    $i = new RJDGSHOP($t->shop_id);
                    if ($i->id) {
                        $url = $i->getDownloadLink();
                        $odata['data']['link'] = $url;
                    }
                }
            }
            break;
        case 'helper':
            if ($idata->txn_id) {
                $txn = new RJDGPPTXN();
                $txn->loadBy('transaction_id', $idata->txn_id);
                if ($txn->isLoaded()) {
                    $file = new RJDGSHOP($txn->shop_id);
                    if ($file->isLoaded() && $txn->isValid()) {
                        $odata['data'] = array('name' => $file->name, 'link' => RJDGPP::getDownloadLink($file) . '&txn_id=' . $txn->transaction_id, 'txn_price' => $txn->price, 'item_price' => $file->price, 'txn_stat' => $txn->payment_status, 'txn_id' => $txn->transaction_id);
Example #4
0
 *
 *   an exclusive file for downloads
 *   
 *   depends: RJSES
 *   		  RJDL
 *   		  RJSHOP
 *   	      RJDGTXN
 */
include dirname(__FILE__) . '/../../../../wp-load.php';
$ar = wp_parse_args($_REQUEST);
$dl = false;
if (empty($ar['i']) || !is_numeric($ar['i'])) {
    //	session_id()
} else {
    RJSES::start();
    $i = new RJDGSHOP($ar['i']);
    $txn = new RJDGPPTXN();
    //$txn->loadByShopObj($i);
    if ($txn->loadBy('transaction_id', $ar['txn_id']) && $i->isLoaded()) {
        if ($txn->isComplete($i)) {
            status_header(200);
            //show pdf
            if (RJDL::http($i->pathname)) {
                $dl = true;
            }
        } else {
            status_header(404);
            $a = $txn->getStatus($i);
            array_walk($a, create_function('&$i,$k', '$i="<li>$i</li>";'));
            get_header();
            echo '<h3>failed with the following erros</h3><ul>' . join('', $a) . '</ul>';
Example #5
0
     $r->hide = 1;
     if ($r->save()) {
         $odata['id'] = $idata['id'];
         $odata['response'] = 'success';
     }
     break;
 case 'show':
     $r = new RJDGSHOP($idata['id']);
     $r->hide = 0;
     if ($r->save()) {
         $odata['id'] = $idata['id'];
         $odata['response'] = 'success';
     }
     break;
 case 'remove_meta':
     $r = new RJDGSHOP();
     if ($r->deleteMeta($idata['id'], $idata['meta'])) {
         $odata['id'] = $idata['id'];
         $odata['response'] = 'success';
     }
     break;
 case 'sandbox':
     if (isset($idata['value']) && $idata['value'] == 1) {
         $odata['response'] = RJDGPP::setSandbox(1);
     }
     if (isset($idata['value']) && $idata['value'] == 0) {
         $odata['response'] = RJDGPP::setSandbox(0);
     }
     $odata['sandbox'] = RJDGPP::isSandbox();
     break;
 case 'setCred':
 public function isValid(&$shop = null)
 {
     if (empty($shop) || !$shop instanceof RJDGSHOP) {
         $shop = new RJDGSHOP($this->shop_id);
     }
     if ($shop->isLoaded()) {
         if ('completed' == strtolower($this->payment_status) && $shop->price == $this->price) {
             return true;
         }
     }
     return false;
 }