public function findMatch($request, $setAsCurrent = false) { _d($request, 'find Match'); _d($setAsCurrent, 'setAsCurrent'); foreach ($this->routes as $route) { if ($route->matches($request)) { if ($setAsCurrent) { $this->current = $route; } return $route; } } return false; }
$User = get_userdata($Note->value->author); ?> <tr> <th class="column-author column-username"><?php echo get_avatar($User->ID, 32); ?> <?php echo esc_html($User->display_name); ?> <br /> <span><?php echo _d(get_option('date_format'), $Note->created); ?> </span> <span><?php echo _d(get_option('time_format'), $Note->created); ?> </span></th> <td> <div id="note-<?php echo $Note->id; ?> "> <?php if ($Note->value->sent == 1) { ?> <p class="notesent"><?php _e('Sent to the Customer:', 'Shopp'); ?> </p> <?php
} elseif ($user) { ?> <div class="user-card"> <img src="<?php echo $user->photoUrl; ?> " alt=""> <div class="user-data"> Name: <?php echo _e($user->firstName . ' ' . $user->lastName); ?> <br> Nickname: <?php echo _d($user->nickname, 'empty'); ?> <br> Profile: <a href="<?php echo $user->profileUrl; ?> "><?php echo $user->profileUrl; ?> </a><br> </div> </div> <div class="sign-out"><a href="signout.php">Выйти</a></div> <?php
function notes_meta_box($Purchase) { global $Notes; add_filter('shopp_order_note', 'esc_html'); add_filter('shopp_order_note', 'wptexturize'); add_filter('shopp_order_note', 'convert_chars'); add_filter('shopp_order_note', 'make_clickable'); add_filter('shopp_order_note', 'force_balance_tags'); add_filter('shopp_order_note', 'convert_smilies'); add_filter('shopp_order_note', 'wpautop'); ?> <form action="<?php echo ShoppAdminController::url(array('id' => $Purchase->id)); ?> " method="post"> <?php if (!empty($Notes->meta)) { ?> <table> <?php foreach ($Notes->meta as $Note) { $User = get_userdata($Note->value->author); ?> <tr> <th class="column-author column-username"><?php echo get_avatar($User->ID, 32); ?> <?php echo esc_html($User->display_name); ?> <br /> <span><?php echo _d(get_option('date_format'), $Note->created); ?> </span> <span><?php echo _d(get_option('time_format'), $Note->created); ?> </span></th> <td> <div id="note-<?php echo $Note->id; ?> "> <?php if ($Note->value->sent == 1) { ?> <p class="notesent"><?php _e('Sent to the Customer:', 'Shopp'); ?> </p> <?php } ?> <?php echo apply_filters('shopp_order_note', $Note->value->message); ?> </div> <p class="notemeta"> <span class="notectrls"> <button type="submit" name="delete-note[<?php echo $Note->id; ?> ]" value="delete" class="button-secondary deletenote"><small>Delete</small></button> <button type="button" name="edit-note[<?php echo $Note->id; ?> ]" value="edit" class="button-secondary editnote"><small>Edit</small></button> <?php do_action('shopp_order_note_controls'); ?> </span> </p> </td> </tr> <?php } ?> </table> <?php } ?> <div id="notation"> <p><label for="notes"><?php _e('New Note', 'Shopp'); ?> :</label><br /> <textarea name="note" id="note" cols="50" rows="10"></textarea></p> <?php do_action('shopp_order_new_note_ui'); ?> <p class="alignright"> <button type="button" name="cancel-note" value="cancel" id="cancel-note-button" class="button-secondary"><?php _e('Cancel', 'Shopp'); ?> </button> <button type="submit" name="save-note" value="save" class="button-primary"><?php _e('Save Note', 'Shopp'); ?> </button> </p> <div class="alignright options"> <input type="checkbox" name="send-note" id="send-note" value="1"> <label for="send-note"><?php _e('Send to customer', 'Shopp'); ?> </label> </div> </div> <p class="alignright" id="add-note"> <button type="button" name="add-note" value="add" id="add-note-button" class="button-secondary"><?php _e('Add Note', 'Shopp'); ?> </button></p> <br class="clear" /> </form> <?php }
<div id="order"> <br class="clear" /> <div id="receipt" class="shopp"> <table class="transaction" cellspacing="0"> <tr><th><?php _e('Order Num', 'Shopp'); ?> :</th><td><?php echo $Purchase->id; ?> </td></tr> <tr><th><?php _e('Order Date', 'Shopp'); ?> :</th><td><?php echo _d(get_option('date_format'), $Purchase->created); ?> </td></tr> <?php if (!empty($Purchase->card) && !empty($Purchase->cardtype)) { ?> <tr><th><?php _e('Billed To', 'Shopp'); ?> :</th><td><?php !empty($Purchase->card) ? printf("%'X16d", $Purchase->card) : ''; ?> <?php echo !empty($Purchase->cardtype) ? '(' . $Purchase->cardtype . ')' : ''; ?> </td></tr><?php
</div> </td> <td class="discount column-discount<?php echo in_array('discount',$hidden)?' hidden':''; ?>"><?php if ($Promotion->type == "Percentage Off") echo percentage($Promotion->discount); if ($Promotion->type == "Amount Off") echo money($Promotion->discount); if ($Promotion->type == "Free Shipping") echo $this->Settings->get("free_shipping_text"); if ($Promotion->type == "Buy X Get Y Free") echo __('Buy','Ecart').' '.$Promotion->buyqty.' '.__('Get','Ecart').' '.$Promotion->getqty.' '.__('Free','Ecart'); ?></td> <td class="applied column-applied<?php echo in_array('applied',$hidden)?' hidden':''; ?>"><?php echo $Promotion->target; ?></td> <td class="eff column-eff<?php echo in_array('eff',$hidden)?' hidden':''; ?>"><strong><?php echo $status[$Promotion->status]; ?></strong><?php $starts = (mktimestamp($Promotion->starts) > 1) ? _d(get_option('date_format'),mktimestamp($Promotion->starts)) : _d(get_option('date_format'),mktimestamp($Promotion->created)); $ends = (mktimestamp($Promotion->ends) > 1) ? " — " . _d(get_option('date_format'),mktimestamp($Promotion->ends)) : ", " . __('does not expire','Ecart'); echo "<br />".$starts.$ends; ?></td> </tr> <?php endforeach; ?> </tbody> <?php else: ?> <tbody><tr><td colspan="5"><?php _e('No promotions found.','Ecart'); ?></td></tr></tbody> <?php endif; ?> </table> </form> <div class="tablenav"> <?php if ($page_links) echo "<div class='tablenav-pages'>$page_links</div>"; ?> <div class="clear"></div> </div>
function tag ($property,$options=array()) { global $Ecart; $taxes = isset($options['taxes'])?$options['taxes']:false; $taxrate = 0; if ($property == "item-unitprice" || $property == "item-total") $taxrate = ecart_taxrate($taxes); // Return strings with no options switch ($property) { case "receipt": // Skip the receipt processing when sending order notifications in admin without the receipt if (defined('WP_ADMIN') && isset($_POST['receipt']) && $_POST['receipt'] == "no") return; if (isset($options['template']) && is_readable(ECART_TEMPLATES."/".$options['template'])) return $this->receipt($template); else return $this->receipt(); break; case "url": return ecarturl(false,'account'); break; case "id": return $this->id; break; case "customer": return $this->customer; break; case "date": if (empty($options['format'])) $options['format'] = get_option('date_format').' '.get_option('time_format'); return _d($options['format'],((is_int($this->created))?$this->created:mktimestamp($this->created))); break; case "card": return (!empty($this->card))?sprintf("%'X16d",$this->card):''; break; case "cardtype": return $this->cardtype; break; case "txnid": case "transactionid": return $this->txnid; break; case "firstname": return esc_html($this->firstname); break; case "lastname": return esc_html($this->lastname); break; case "company": return esc_html($this->company); break; case "email": return esc_html($this->email); break; case "phone": return esc_html($this->phone); break; case "address": return esc_html($this->address); break; case "xaddress": return esc_html($this->xaddress); break; case "city": return esc_html($this->city); break; case "state": if (strlen($this->state > 2)) return esc_html($this->state); $regions = Lookup::country_zones(); $states = $regions[$this->country]; return $states[$this->state]; break; case "postcode": return esc_html($this->postcode); break; case "country": $countries = $Ecart->Settings->get('target_markets'); return $countries[$this->country]; break; case "shipaddress": return esc_html($this->shipaddress); break; case "shipxaddress": return esc_html($this->shipxaddress); break; case "shipcity": return esc_html($this->shipcity); break; case "shipstate": if (strlen($this->shipstate > 2)) return esc_html($this->shipstate); $regions = Lookup::country_zones(); $states = $regions[$this->country]; return $states[$this->shipstate]; break; case "shippostcode": return esc_html($this->shippostcode); break; case "shipcountry": $countries = $Ecart->Settings->get('target_markets'); return $countries[$this->shipcountry]; break; case "shipmethod": return esc_html($this->shipmethod); break; case "totalitems": return count($this->purchased); break; case "has-items": case "hasitems": if (empty($this->purchased)) $this->load_purchased(); return (count($this->purchased) > 0); break; case "items": if (!isset($this->_items_loop)) { reset($this->purchased); $this->_items_loop = true; } else next($this->purchased); if (current($this->purchased) !== false) return true; else { unset($this->_items_loop); return false; } case "item-id": $item = current($this->purchased); return $item->id; break; case "item-product": $item = current($this->purchased); return $item->product; break; case "item-price": $item = current($this->purchased); return $item->price; break; case "item-name": $item = current($this->purchased); return $item->name; break; case "item-description": $item = current($this->purchased); return $item->description; break; case "item-options": if (!isset($options['after'])) $options['after'] = ""; $item = current($this->purchased); return (!empty($item->optionlabel))?$options['before'].$item->optionlabel.$options['after']:''; break; case "item-sku": $item = current($this->purchased); return $item->sku; break; case "item-download": $item = current($this->purchased); if (empty($item->download)) return ""; if (!isset($options['label'])) $options['label'] = __('Download','Ecart'); $classes = ""; if (isset($options['class'])) $classes = ' class="'.$options['class'].'"'; $request = ECART_PRETTYURLS? "download/$item->dkey": array('src'=>'download','ecart_download'=>$item->dkey); $url = ecarturl($request,'catalog'); return '<a href="'.$url.'"'.$classes.'>'.$options['label'].'</a>'; break; case "item-quantity": $item = current($this->purchased); return $item->quantity; break; case "item-unitprice": $item = current($this->purchased); $amount = $item->unitprice+($this->taxing == 'inclusive'?$item->unittax:0); return money($amount); break; case "item-total": $item = current($this->purchased); $amount = $item->total+($this->taxing == 'inclusive'?$item->unittax*$item->quantity:0); return money($amount); break; case "item-has-inputs": case "item-hasinputs": $item = current($this->purchased); return (count($item->data) > 0); break; case "item-inputs": $item = current($this->purchased); if (!isset($this->_iteminputs_loop)) { reset($item->data); $this->_iteminputs_loop = true; } else next($item->data); if (current($item->data) !== false) return true; else { unset($this->_iteminputs_loop); return false; } break; case "item-input": $item = current($this->purchased); $data = current($item->data); $name = key($item->data); if (isset($options['name'])) return esc_html($name); return esc_html($data); break; case "item-inputs-list": case "item-inputslist": case "item-inputs-list": case "iteminputslist": $item = current($this->purchased); if (empty($item->data)) return false; $before = ""; $after = ""; $classes = ""; $excludes = array(); if (!empty($options['class'])) $classes = ' class="'.$options['class'].'"'; if (!empty($options['exclude'])) $excludes = explode(",",$options['exclude']); if (!empty($options['before'])) $before = $options['before']; if (!empty($options['after'])) $after = $options['after']; $result .= $before.'<ul'.$classes.'>'; foreach ($item->data as $name => $data) { if (in_array($name,$excludes)) continue; $result .= '<li><strong>'.esc_html($name).'</strong>: '.esc_html($data).'</li>'; } $result .= '</ul>'.$after; return $result; break; case "item-has-addons": case "item-hasaddons": $item = current($this->purchased); return (count($item->addons) > 0); break; case "item-addons": $item = current($this->purchased); if (!isset($this->_itemaddons_loop)) { reset($item->addons->meta); $this->_itemaddons_loop = true; } else next($item->addons->meta); if (current($item->addons->meta) !== false) return true; else { unset($this->_itemaddons_loop); return false; } break; case "item-addons": $item = current($this->purchased); $addon = current($item->addons->meta); if (isset($options['id'])) return esc_html($addon->id); if (isset($options['name'])) return esc_html($addon->name); if (isset($options['label'])) return esc_html($addon->name); if (isset($options['type'])) return esc_html($addon->value->type); if (isset($options['onsale'])) return $addon->value->onsale; if (isset($options['inventory'])) return $addon->value->inventory; if (isset($options['sku'])) return esc_html($addon->value->sku); if (isset($options['unitprice'])) return money($addon->value->unitprice); return money($addon->value->unitprice); break; case "item-addons-list": case "item-addonslist": case "item-addons-list": case "itemaddonslist": $item = current($this->purchased); if (empty($item->addons)) return false; $defaults = array( 'prices' => "on", 'download' => __('Download','Ecart'), 'before' => '', 'after' => '', 'classes' => '', 'excludes' => '' ); $options = array_merge($defaults,$options); extract($options); $class = !empty($classes)?' class="'.join(' ',explode(',',$classes)).'"':''; $taxrate = 0; if ($item->unitprice > 0) $taxrate = round($item->unittax/$item->unitprice,4); $result = $before.'<ul'.$class.'>'; foreach ($item->addons->meta as $id => $addon) { if (in_array($addon->name,$excludes)) continue; if ($this->taxing == "inclusive") $price = $addon->value->unitprice+($addon->value->unitprice*$taxrate); else $price = $addon->value->unitprice; $link = false; if (isset($addon->value->download) && isset($addon->value->dkey)) { $dkey = $addon->value->dkey; $request = ECART_PRETTYURLS?"download/$dkey":array('ecart_download'=>$dkey); $url = ecarturl($request,'catalog'); $link = '<br /><a href="'.$url.'">'.$download.'</a>'; } $pricing = value_is_true($prices)?" (".money($price).")":""; $result .= '<li>'.esc_html($addon->name.$pricing).$link.'</li>'; } $result .= '</ul>'.$after; return $result; break; case "has-data": case "hasdata": return (is_array($this->data) && count($this->data) > 0); break; case "orderdata": if (!isset($this->_data_loop)) { reset($this->data); $this->_data_loop = true; } else next($this->data); if (current($this->data) !== false) return true; else { unset($this->_data_loop); return false; } break; case "data": if (!is_array($this->data)) return false; $data = current($this->data); $name = key($this->data); if (isset($options['name'])) return esc_html($name); return esc_html($data); break; case "promolist": case "promo-list": $output = ""; if (!empty($this->promos)) { $output .= '<ul>'; foreach ($this->promos as $promo) $output .= '<li>'.$promo.'</li>'; $output .= '</ul>'; } return $output; case "has-promo": case "haspromo": if (empty($options['name'])) return false; return (in_array($options['name'],$this->promos)); break; case "subtotal": return money($this->subtotal); break; case "hasfreight": return (!empty($this->shipmethod) || $this->freight > 0); case "freight": return money($this->freight); break; case "hasdownloads": return ($this->downloads); case "hasdiscount": return ($this->discount > 0); case "discount": return money($this->discount); break; case "hastax": return ($this->tax > 0)?true:false; case "tax": return money($this->tax); break; case "total": return money($this->total); break; case "status": $labels = $Ecart->Settings->get('order_status'); if (empty($labels)) $labels = array(''); return $labels[$this->status]; break; case "paid": return ($this->txnstatus == "CHARGED"); break; case "notpaid": return ($this->txnstatus != "CHARGED"); break; case "payment": $labels = Lookup::payment_status_labels(); return isset($labels[$this->txnstatus])?$labels[$this->txnstatus]:$this->txnstatus; break; } }
/** * Provides the date the purchase order was created * * @api `shopp('purchase.date')` * @since 1.0 * * @param string $result The output * @param array $options The options * - **format**: Sets the PHP date formatting to use. Defaults to the WordPress date and time formats * @param ShoppPurchase $O The working object * @return string The purchase order date **/ public static function date($result, $options, $O) { if (empty($options['format'])) { $options['format'] = get_option('date_format') . ' ' . get_option('time_format'); } return _d($options['format'], is_int($O->created) ? $O->created : sDB::mktime($O->created)); }
function notes_meta_box ($Purchase) { global $Notes; add_filter('ecart_order_note', 'esc_html'); add_filter('ecart_order_note', 'wptexturize'); add_filter('ecart_order_note', 'convert_chars'); add_filter('ecart_order_note', 'make_clickable'); add_filter('ecart_order_note', 'force_balance_tags'); add_filter('ecart_order_note', 'convert_smilies'); add_filter('ecart_order_note', 'wpautop'); ?> <?php if (!empty($Notes->meta)): ?> <table> <?php foreach ($Notes->meta as $Note): $User = get_userdata($Note->value->author); ?> <tr> <th><?php echo esc_html($User->user_nicename); ?><br /> <span><?php echo _d(get_option('date_format').' '.get_option('time_format'), $Note->created); ?></span></th> <td> <div id="note-<?php echo $Note->id; ?>"> <?php echo apply_filters('ecart_order_note',$Note->value->message); ?> </div> <p class="notemeta"> <span class="notectrls"> <button type="submit" name="delete-note[<?php echo $Note->id; ?>]" value="delete" class="button-secondary deletenote"><small>Delete</small></button> <button type="button" name="edit-note[<?php echo $Note->id; ?>]" value="edit" class="button-secondary editnote"><small>Edit</small></button> <?php do_action('ecart_order_note_controls'); ?> </span> </p> </td> </tr> <?php endforeach; ?> </table> <?php endif; ?> <div id="notation"> <p><label for="notes"><?php _e('New Note','Ecart'); ?>:</label><br /> <textarea name="note" id="note" cols="50" rows="10"></textarea></p> <?php do_action('ecart_order_new_note_ui'); ?> <p class="alignright"> <button type="button" name="cancel-note" value="cancel" id="cancel-note-button" class="button-secondary"><?php _e('Cancel','Ecart'); ?></button> <button type="submit" name="save-note" value="save" class="button-primary"><?php _e('Save Note','Ecart'); ?></button> </p> </div> <p class="alignright" id="add-note"> <button type="button" name="add-note" value="add" id="add-note-button" class="button-secondary"><?php _e('Add Note','Ecart'); ?></button></p> <br class="clear" /> <?php }
?> )</a></span> </div> <?php } else { ?> <div class="entry"> <h2><a href="<?php echo _u('e', $rows[$c][0], $rows[$c][1]); ?> "><?php echo $rows[$c][2]; ?> </a></h2> <span class="s_date"><?php echo _d('j F Y', $rows[$c][4]); ?> </span> <?php if ($rows[$c][7] == 'y' || $rows[$c][7] == 'c' && $rows[$c][9] != 0) { ?> <span class="s_comments"><a href="<?php echo _u('e', $rows[$c][0], $rows[$c][1]); ?> #comentarios"><?php echo $rows[$c][9] == 0 ? 'Sin comentarios' : "{$rows[$c][9]} Comentario(s)"; ?> </a></span> <?php } ?>
?> "><?php echo $Promotion->scope; ?> </td> <td class="eff column-eff<?php echo in_array('eff', $hidden) ? ' hidden' : ''; ?> "><strong><?php echo $status[$Promotion->status]; ?> </strong><?php if (mktimestamp($Promotion->starts > 1) && mktimestamp($Promotion->ends) > 1) { echo "<br />" . _d(get_option('date_format'), mktimestamp($Promotion->starts)) . " — " . _d(get_option('date_format'), mktimestamp($Promotion->ends)); } else { echo "<br />" . _d(get_option('date_format'), mktimestamp($Promotion->created)) . ", " . __('does not expire', 'Shopp'); } ?> </td> </tr> <?php } ?> </tbody> <?php } else { ?> <tbody><tr><td colspan="5"><?php _e('No promotions found.', 'Shopp'); ?> </td></tr></tbody>
echo BASE_STATIC; ?> images/no-avatar.png" alt="" width="54" height="54" /></div> <div class="ccontent"> <div class="cinfo"> <a href="#comment-<?php echo $rowsC[$c][3]; ?> ">#<?php echo $rowsC[$c][3]; ?> </a> <b><?php echo empty($rowsC[$c][6]) ? $rowsC[$c][4] : "<a rel=\"nofollow\" href=\"{$rowsC[$c][6]}\" target=\"_blank\">{$rowsC[$c][4]}</a>"; ?> </b> el <?php echo _d('j F Y', $rowsC[$c][8]); ?> . <?php if (COMMENTS_STATUS == 'y') { ?> <span class="creply"><a href="#comentar" onclick="javascript:re('<?php echo $rowsC[$c][3]; ?> ', '<?php echo $rowsC[$c][4]; ?> ')">Responder</a></span><?php } ?> </div>
/** * Shortcut for _d(); die; * * @param mixed $var * @return void */ function _dd($var) { _d($var); die; }
function tag($property, $options = array()) { global $Shopp; if ($property == "item-unitprice" || $property == "item-total") { $taxrate = shopp_taxrate($options['taxes']); } // Return strings with no options switch ($property) { case "url": return $Shopp->link('cart'); break; case "id": return $this->id; break; case "date": if (empty($options['format'])) { $options['format'] = get_option('date_format'); } return _d($options['format'], is_int($this->created) ? $this->created : mktimestamp($this->created)); break; case "card": return !empty($this->card) ? sprintf("%'X16d", $this->card) : ''; break; case "cardtype": return $this->cardtype; break; case "transactionid": return $this->transactionid; break; case "firstname": return $this->firstname; break; case "lastname": return $this->lastname; break; case "company": return $this->company; break; case "email": return $this->email; break; case "phone": return $this->phone; break; case "address": return $this->address; break; case "xaddress": return $this->xaddress; break; case "city": return $this->city; break; case "state": if (strlen($this->state > 2)) { return $this->state; } $regions = $Shopp->Settings->get('zones'); $states = $regions[$this->country]; return $states[$this->state]; break; case "postcode": return $this->postcode; break; case "country": $countries = $Shopp->Settings->get('target_markets'); return $countries[$this->country]; break; case "shipaddress": return $this->shipaddress; break; case "shipxaddress": return $this->shipxaddress; break; case "shipcity": return $this->shipcity; break; case "shipstate": if (strlen($this->shipstate > 2)) { return $this->shipstate; } $regions = $Shopp->Settings->get('zones'); $states = $regions[$this->country]; return $states[$this->shipstate]; break; case "shippostcode": return $this->shippostcode; break; case "shipcountry": $countries = $Shopp->Settings->get('target_markets'); return $countries[$this->shipcountry]; break; case "shipmethod": return $this->shipmethod; break; case "totalitems": return count($this->purchased); break; case "hasitems": if (count($this->purchased) > 0) { return true; } else { return false; } break; case "items": if (!$this->looping) { reset($this->purchased); $this->looping = true; } else { next($this->purchased); } if (current($this->purchased)) { return true; } else { $this->looping = false; reset($this->purchased); return false; } case "item-id": $item = current($this->purchased); return $item->id; break; case "item-product": $item = current($this->purchased); return $item->product; break; case "item-price": $item = current($this->purchased); return $item->price; break; case "item-name": $item = current($this->purchased); return $item->name; break; case "item-description": $item = current($this->purchased); return $item->description; break; case "item-options": $item = current($this->purchased); return !empty($item->optionlabel) ? $options['before'] . $item->optionlabel . $options['after'] : ''; break; case "item-sku": $item = current($this->purchased); return $item->sku; break; case "item-download": $item = current($this->purchased); if (empty($item->download)) { return ""; } if (!isset($options['label'])) { $options['label'] = __('Download', 'Shopp'); } $classes = ""; if (isset($options['class'])) { $classes = ' class="' . $options['class'] . '"'; } if (SHOPP_PERMALINKS) { $url = $Shopp->shopuri . "download/" . $item->dkey; } else { $url = add_query_arg('shopp_download', $item->dkey, $Shopp->link('account')); } return '<a href="' . $url . '"' . $classes . '>' . $options['label'] . '</a>'; break; case "item-quantity": $item = current($this->purchased); return $item->quantity; break; case "item-unitprice": $item = current($this->purchased); return money($item->unitprice + $item->unitprice * $taxrate); break; case "item-total": $item = current($this->purchased); return money($item->total + $item->total * $taxrate); break; case "item-has-inputs": case "item-hasinputs": $item = current($this->purchased); return count($item->data) > 0; break; case "item-inputs": $item = current($this->purchased); if (!$this->itemdataloop) { reset($item->data); $this->itemdataloop = true; } else { next($item->data); } if (current($item->data)) { return true; } else { $this->itemdataloop = false; return false; } break; case "item-input": $item = current($this->purchased); $data = current($item->data); $name = key($item->data); if (isset($options['name'])) { return $name; } return $data; break; case "item-inputs-list": case "item-inputslist": case "item-inputs-list": case "iteminputslist": $item = current($this->purchased); if (empty($item->data)) { return false; } $before = ""; $after = ""; $classes = ""; $excludes = array(); if (!empty($options['class'])) { $classes = ' class="' . $options['class'] . '"'; } if (!empty($options['exclude'])) { $excludes = explode(",", $options['exclude']); } if (!empty($options['before'])) { $before = $options['before']; } if (!empty($options['after'])) { $after = $options['after']; } $result .= $before . '<ul' . $classes . '>'; foreach ($item->data as $name => $data) { if (in_array($name, $excludes)) { continue; } $result .= '<li><strong>' . $name . '</strong>: ' . $data . '</li>'; } $result .= '</ul>' . $after; return $result; break; case "has-data": case "hasdata": return is_array($this->data) && count($this->data) > 0; break; case "orderdata": if (!$this->dataloop) { reset($this->data); $this->dataloop = true; } else { next($this->data); } if (current($this->data) !== false) { return true; } else { $this->dataloop = false; return false; } break; case "data": if (!is_array($this->data)) { return false; } $data = current($this->data); $name = key($this->data); if (isset($options['name'])) { return $name; } return $data; break; case "has-promo": case "haspromo": if (empty($options['name'])) { return false; } return in_array($options['name'], $this->promos); break; case "subtotal": return money($this->subtotal); break; case "hasfreight": return !empty($this->shipmethod) || $this->freight > 0; case "freight": return money($this->freight); break; case "hasdiscount": return $this->discount > 0; case "discount": return money($this->discount); break; case "hastax": return $this->tax > 0 ? true : false; case "tax": return money($this->tax); break; case "total": return money($this->total); break; case "status": $labels = $Shopp->Settings->get('order_status'); if (empty($labels)) { $labels = array(''); } return $labels[$this->status]; break; } }
/** * Helper to provide formated timeframes * * @internal * @since 1.0 * * @param string $result The output * @param array $options The options * @param ShoppShiprates $O The working object * @return string The formatted estimate **/ private static function _delivery_format($estimate, $options = array()) { $periods = array('h' => 3600, 'd' => 86400, 'w' => 604800, 'm' => 2592000); $defaults = array('dateformat' => get_option('date_format'), 'dateseparator' => '—'); $options = array_merge($defaults, $options); extract($options, EXTR_SKIP); if (!$dateformat) { $dateformat = 'F j, Y'; } $estimates = explode("-", $estimate); if (empty($estimates)) { return ""; } if (count($estimates) > 1 && $estimates[0] == $estimates[1]) { $estimates = array($estimates[0]); } $result = ""; for ($i = 0; $i < count($estimates); $i++) { list($interval, $p) = sscanf($estimates[$i], '%d%s'); if (empty($interval)) { $interval = 1; } if (empty($p)) { $p = 'd'; } if (!empty($result)) { $result .= $dateseparator; } $result .= _d($dateformat, current_time('timestamp') + $interval * $periods[$p]); } return $result; }
<?php for ($c = 0; $c <= $totalForT; $c++) { ?> <div class="trackback"><a name="comment-<?php echo $rowsT[$c][0]; ?> "></a> <div class="ccontent"> <div class="cinfo"><b><a rel="nofollow" href="<?php echo $rowsT[$c][4]; ?> " target="_blank"><?php echo $rowsT[$c][5]; ?> </a></b> el <?php echo _d('j F Y', $rowsT[$c][7]); ?> .</div> <p><b><?php echo $rowsT[$c][3]; ?> </b><br /> <?php echo $rowsT[$c][6]; ?> </p> </div> </div> <?php if ($c != count($rowsT)) { ?>
function getRecordClass() { if (!isset($this->record_class[$this->record_shape_type])) { _d("Unable to find record class ({$this->record_shape_type}) [" . getArray($this->record_class) . "]"); return $this->setError(sprintf(INEXISTENT_RECORD_CLASS, $this->record_shape_type)); } _d("Returning record class ({$this->record_shape_type}) " . $this->record_class[$this->record_shape_type]); return $this->record_class[$this->record_shape_type]; }
function class_dump($class) { $class = new ReflectionClass($class); _d($class->getStaticProperties()); }
function tag ($property,$options=array()) { global $Ecart; $Order =& $Ecart->Order; $checkout = false; if (isset($Ecart->Flow->Controller->checkout)) $checkout = $Ecart->Flow->Controller->checkout; // Return strings with no options switch ($property) { case "url": return ecarturl(array('acct'=>null),'account',$Ecart->Gateways->secure); break; case "action": $action = null; if (isset($this->pages[$_GET['acct']])) $action = $_GET['acct']; return ecarturl(array('acct'=>$action),'account'); break; case "accounturl": return ecarturl(false,'account'); break; case "recover-url": return add_query_arg('acct','recover',ecarturl(false,'account')); case "registration-form": $regions = Lookup::country_zones(); add_storefrontjs("var regions = ".json_encode($regions).";",true); return $_SERVER['REQUEST_URI']; break; case "registration-errors": $Errors =& EcartErrors(); if (!$Errors->exist(ECART_ERR)) return false; ob_start(); include(ECART_TEMPLATES.'/errors.php'); $markup = ob_get_contents(); ob_end_clean(); return $markup; break; case "register": return '<input type="submit" name="ecart_registration" value="Register" />'; break; case "process": if (!empty($_GET['acct']) && isset($this->pages[$_GET['acct']])) return $_GET['acct']; return false; case "loggedin": return $Ecart->Order->Customer->login; break; case "notloggedin": return (!$Ecart->Order->Customer->login && $Ecart->Settings->get('account_system') != "none"); break; case "login-label": $accounts = $Ecart->Settings->get('account_system'); $label = __('Email Address','Ecart'); if ($accounts == "wordpress") $label = __('Login Name','Ecart'); if (isset($options['label'])) $label = $options['label']; return $label; break; case "email-login": case "loginname-login": case "account-login": $id = "account-login".($checkout?"-checkout":''); if (!empty($_POST['account-login'])) $options['value'] = $_POST['account-login']; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; return '<input type="text" name="account-login" id="'.$id.'"'.inputattrs($options).' />'; break; case "password-login": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; $id = "password-login".($checkout?"-checkout":''); if (!empty($_POST['password-login'])) $options['value'] = $_POST['password-login']; return '<input type="password" name="password-login" id="'.$id.'"'.inputattrs($options).' />'; break; case "recover-button": if (!isset($options['value'])) $options['value'] = __('Get New Password','Ecart'); return '<input type="submit" name="recover-login" id="recover-button"'.inputattrs($options).' />'; break; case "submit-login": // Deprecating case "login-button": if (!isset($options['value'])) $options['value'] = __('Login','Ecart'); $string = ""; $id = "submit-login"; $request = $_GET; if (isset($request['acct']) && $request['acct'] == "logout") unset($request['acct']); if ($checkout) { $id .= "-checkout"; $string .= '<input type="hidden" name="process-login" id="process-login" value="false" />'; $string .= '<input type="hidden" name="redirect" value="checkout" />'; } else $string .= '<input type="hidden" name="process-login" value="true" /><input type="hidden" name="redirect" value="'.ecarturl($request,'account',$Order->security()).'" />'; $string .= '<input type="submit" name="submit-login" id="'.$id.'"'.inputattrs($options).' />'; return $string; break; case "profile-saved": $saved = (isset($this->_saved) && $this->_saved); unset($this->_saved); return $saved; case "password-changed": $change = (isset($this->_password_change) && $this->_password_change); unset($this->_password_change); return $change; case "errors-exist": return true; $Errors = &EcartErrors(); return ($Errors->exist(ECART_AUTH_ERR)); break; case "login-errors": // @deprecated case "errors": if (!apply_filters('ecart_show_account_errors',true)) return false; $Errors = &EcartErrors(); if (!$Errors->exist(ECART_AUTH_ERR)) return false; ob_start(); include(ECART_TEMPLATES."/errors.php"); $errors = ob_get_contents(); ob_end_clean(); return $errors; break; case "menu": if (!isset($this->_menu_looping)) { reset($this->menus); $this->_menu_looping = true; } else next($this->menus); if (current($this->menus) !== false) return true; else { unset($this->_menu_looping); reset($this->menus); return false; } break; case "management": $page = current($this->menus); if (array_key_exists('url',$options)) return ecarturl(array('acct'=>$page->request),'account'); if (array_key_exists('action',$options)) return $page->request; return $page->label; case "accounts": return $Ecart->Settings->get('account_system'); break; case "hasaccount": $system = $Ecart->Settings->get('account_system'); if ($system == "wordpress") return ($this->wpuser != 0); elseif ($system == "ecart") return (!empty($this->password)); else return false; case "wpuser-created": return $this->newuser; case "order-lookup": $auth = $Ecart->Settings->get('account_system'); if ($auth != "none") return true; if (!empty($_POST['vieworder']) && !empty($_POST['purchaseid'])) { require_once("Purchase.php"); $Purchase = new Purchase($_POST['purchaseid']); if ($Purchase->email == $_POST['email']) { $Ecart->Purchase = $Purchase; $Purchase->load_purchased(); ob_start(); include(ECART_TEMPLATES."/receipt.php"); $content = ob_get_contents(); ob_end_clean(); return apply_filters('ecart_order_lookup',$content); } } ob_start(); include(ECART_ADMIN_PATH."/orders/account.php"); $content = ob_get_contents(); ob_end_clean(); return apply_filters('ecart_order_lookup',$content); break; case "firstname": if (isset($options['mode']) && $options['mode'] == "value") return $this->firstname; if (!empty($this->firstname)) $options['value'] = $this->firstname; return '<input type="text" name="firstname" id="firstname"'.inputattrs($options).' />'; break; case "lastname": if (isset($options['mode']) && $options['mode'] == "value") return $this->lastname; if (!empty($this->lastname)) $options['value'] = $this->lastname; return '<input type="text" name="lastname" id="lastname"'.inputattrs($options).' />'; break; case "company": if (isset($options['mode']) && $options['mode'] == "value") return $this->company; if (!empty($this->company)) $options['value'] = $this->company; return '<input type="text" name="company" id="company"'.inputattrs($options).' />'; break; case "email": if (isset($options['mode']) && $options['mode'] == "value") return $this->email; if (!empty($this->email)) $options['value'] = $this->email; return '<input type="text" name="email" id="email"'.inputattrs($options).' />'; break; case "loginname": if (isset($options['mode']) && $options['mode'] == "value") return $this->loginname; if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (!empty($this->loginname)) $options['value'] = $this->loginname; return '<input type="text" name="loginname" id="login"'.inputattrs($options).' />'; break; case "password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; if (isset($options['mode']) && $options['mode'] == "value") return strlen($this->password) == 34?str_pad('•',8):$this->password; $options['value'] = ""; return '<input type="password" name="password" id="password"'.inputattrs($options).' />'; break; case "confirm-password": if (!isset($options['autocomplete'])) $options['autocomplete'] = "off"; $options['value'] = ""; return '<input type="password" name="confirm-password" id="confirm-password"'.inputattrs($options).' />'; break; case "phone": if (isset($options['mode']) && $options['mode'] == "value") return $this->phone; if (!empty($this->phone)) $options['value'] = $this->phone; return '<input type="text" name="phone" id="phone"'.inputattrs($options).' />'; break; case "hasinfo": case "has-info": if (!is_object($this->info) || empty($this->info->meta)) return false; if (!isset($this->_info_looping)) { reset($this->info->meta); $this->_info_looping = true; } else next($this->info->meta); if (current($this->info->meta) !== false) return true; else { unset($this->_info_looping); reset($this->info->meta); return false; } break; case "info": $defaults = array( 'mode' => 'input', 'type' => 'text', 'name' => false, 'value' => false ); $options = array_merge($defaults,$options); extract($options); if ($this->_info_looping) $info = current($this->info->meta); elseif ($name !== false && is_object($this->info->named[$name])) $info = $this->info->named[$name]; switch ($mode) { case "name": return $info->name; break; case "value": return $info->value; break; } if (!$name && !empty($info->name)) $options['name'] = $info->name; elseif (!$name) return false; if (!$value && !empty($info->value)) $options['value'] = $info->value; $allowed_types = array("text","password","hidden","checkbox","radio"); $type = in_array($type,$allowed_types)?$type:'hidden'; return '<input type="'.$type.'" name="info['.$options['name'].']" id="customer-info-'.sanitize_title_with_dashes($options['name']).'"'.inputattrs($options).' />'; break; // SHIPPING TAGS case "shipping": return $Order->Shipping; case "shipping-address": if ($options['mode'] == "value") return $Order->Shipping->address; if (!empty($Order->Shipping->address)) $options['value'] = $Order->Shipping->address; return '<input type="text" name="shipping[address]" id="shipping-address" '.inputattrs($options).' />'; break; case "shipping-xaddress": if ($options['mode'] == "value") return $Order->Shipping->xaddress; if (!empty($Order->Shipping->xaddress)) $options['value'] = $Order->Shipping->xaddress; return '<input type="text" name="shipping[xaddress]" id="shipping-xaddress" '.inputattrs($options).' />'; break; case "shipping-city": if ($options['mode'] == "value") return $Order->Shipping->city; if (!empty($Order->Shipping->city)) $options['value'] = $Order->Shipping->city; return '<input type="text" name="shipping[city]" id="shipping-city" '.inputattrs($options).' />'; break; case "shipping-province": case "shipping-state": if ($options['mode'] == "value") return $Order->Shipping->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($Order->Shipping->state)) { $options['selected'] = $Order->Shipping->state; $options['value'] = $Order->Shipping->state; } $countries = Lookup::countries(); $output = false; $country = $base['country']; if (!empty($Order->Shipping->country)) $country = $Order->Shipping->country; if (!array_key_exists($country,$countries)) $country = key($countries); if (empty($options['type'])) $options['type'] = "menu"; $regions = Lookup::country_zones(); $states = $regions[$country]; if (is_array($states) && $options['type'] == "menu") { $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="shipping[state]" id="shipping-state" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="" selected="selected">'.$label.'</option>'; $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; } else if ($options['type'] == "menu") { $options['disabled'] = 'disabled'; $options['class'] = ($options['class']?" ":null).'unavailable'; $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="shipping[state]" id="shipping-state" '.inputattrs($options,$select_attrs).'></select>'; } else $output .= '<input type="text" name="shipping[state]" id="shipping-state" '.inputattrs($options).'/>'; return $output; break; case "shipping-postcode": if ($options['mode'] == "value") return $Order->Shipping->postcode; if (!empty($Order->Shipping->postcode)) $options['value'] = $Order->Shipping->postcode; return '<input type="text" name="shipping[postcode]" id="shipping-postcode" '.inputattrs($options).' />'; break; case "shipping-country": if ($options['mode'] == "value") return $Order->Shipping->country; $base = $Ecart->Settings->get('base_operations'); if (!empty($Order->Shipping->country)) $options['selected'] = $Order->Shipping->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $countries = $Ecart->Settings->get('target_markets'); $output = '<select name="shipping[country]" id="shipping-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "same-shipping-address": $label = __("Same shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; $checked = ' checked="checked"'; if (isset($options['checked']) && !value_is_true($options['checked'])) $checked = ''; $output = '<label for="same-shipping"><input type="checkbox" name="sameshipaddress" value="on" id="same-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; case "residential-shipping-address": $label = __("Residential shipping address","Ecart"); if (isset($options['label'])) $label = $options['label']; if (isset($options['checked']) && value_is_true($options['checked'])) $checked = ' checked="checked"'; $output = '<label for="residential-shipping"><input type="hidden" name="shipping[residential]" value="no" /><input type="checkbox" name="shipping[residential]" value="yes" id="residential-shipping" '.$checked.' /> '.$label.'</label>'; return $output; break; // BILLING TAGS case "billing-address": if ($options['mode'] == "value") return $Order->Billing->address; if (!empty($Order->Billing->address)) $options['value'] = $Order->Billing->address; return '<input type="text" name="billing[address]" id="billing-address" '.inputattrs($options).' />'; break; case "billing-xaddress": if ($options['mode'] == "value") return $Order->Billing->xaddress; if (!empty($Order->Billing->xaddress)) $options['value'] = $Order->Billing->xaddress; return '<input type="text" name="billing[xaddress]" id="billing-xaddress" '.inputattrs($options).' />'; break; case "billing-city": if ($options['mode'] == "value") return $Order->Billing->city; if (!empty($Order->Billing->city)) $options['value'] = $Order->Billing->city; return '<input type="text" name="billing[city]" id="billing-city" '.inputattrs($options).' />'; break; case "billing-province": case "billing-state": if ($options['mode'] == "value") return $Order->Billing->state; if (!isset($options['selected'])) $options['selected'] = false; if (!empty($Order->Billing->state)) { $options['selected'] = $Order->Billing->state; $options['value'] = $Order->Billing->state; } if (empty($options['type'])) $options['type'] = "menu"; $countries = Lookup::countries(); $output = false; $country = $base['country']; if (!empty($Order->Billing->country)) $country = $Order->Billing->country; if (!array_key_exists($country,$countries)) $country = key($countries); $regions = Lookup::country_zones(); $states = $regions[$country]; if (is_array($states) && $options['type'] == "menu") { $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[state]" id="billing-state" '.inputattrs($options,$select_attrs).'>'; $output .= '<option value="" selected="selected">'.$label.'</option>'; $output .= menuoptions($states,$options['selected'],true); $output .= '</select>'; } else if ($options['type'] == "menu") { $options['disabled'] = 'disabled'; $options['class'] = ($options['class']?" ":null).'unavailable'; $label = (!empty($options['label']))?$options['label']:''; $output = '<select name="billing[state]" id="billing-state" '.inputattrs($options,$select_attrs).'></select>'; } else $output .= '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>'; return $output; break; case "billing-postcode": if ($options['mode'] == "value") return $Order->Billing->postcode; if (!empty($Order->Billing->postcode)) $options['value'] = $Order->Billing->postcode; return '<input type="text" name="billing[postcode]" id="billing-postcode" '.inputattrs($options).' />'; break; case "billing-country": if ($options['mode'] == "value") return $Order->Billing->country; $base = $Ecart->Settings->get('base_operations'); if (!empty($Order->Billing->country)) $options['selected'] = $Order->Billing->country; else if (empty($options['selected'])) $options['selected'] = $base['country']; $countries = $Ecart->Settings->get('target_markets'); $output = '<select name="billing[country]" id="billing-country" '.inputattrs($options,$select_attrs).'>'; $output .= menuoptions($countries,$options['selected'],true); $output .= '</select>'; return $output; break; case "save-button": if (!isset($options['label'])) $options['label'] = __('Save','Ecart'); $result = '<input type="hidden" name="customer" value="true" />'; $result .= '<input type="submit" name="save" id="save-button"'.inputattrs($options).' />'; return $result; break; case "marketing": if ($options['mode'] == "value") return $this->marketing; if (!empty($this->marketing) && value_is_true($this->marketing)) $options['checked'] = true; $attrs = array("accesskey","alt","checked","class","disabled","format", "minlength","maxlength","readonly","size","src","tabindex", "title"); $input = '<input type="hidden" name="marketing" value="no" />'; $input .= '<input type="checkbox" name="marketing" id="marketing" value="yes" '.inputattrs($options,$attrs).' />'; return $input; break; // Downloads UI tags case "hasdownloads": case "has-downloads": return (!empty($this->downloads)); break; case "downloads": if (empty($this->downloads)) return false; if (!isset($this->_dowload_looping)) { reset($this->downloads); $this->_dowload_looping = true; } else next($this->downloads); if (current($this->downloads) !== false) return true; else { unset($this->_dowload_looping); reset($this->downloads); return false; } break; case "download": $download = current($this->downloads); $df = get_option('date_format'); $properties = unserialize($download->properties); $string = ''; if (array_key_exists('id',$options)) $string .= $download->download; if (array_key_exists('purchase',$options)) $string .= $download->purchase; if (array_key_exists('name',$options)) $string .= $download->name; if (array_key_exists('variation',$options)) $string .= $download->optionlabel; if (array_key_exists('downloads',$options)) $string .= $download->downloads; if (array_key_exists('key',$options)) $string .= $download->dkey; if (array_key_exists('created',$options)) $string .= $download->created; if (array_key_exists('total',$options)) $string .= money($download->total); if (array_key_exists('filetype',$options)) $string .= $properties['mimetype']; if (array_key_exists('size',$options)) $string .= readableFileSize($download->size); if (array_key_exists('date',$options)) $string .= _d($df,mktimestamp($download->created)); if (array_key_exists('url',$options)) $string .= ECART_PRETTYURLS? ecarturl("download/$download->dkey"): ecarturl(array('ecart_download'=>$download->dkey),'account'); return $string; break; // Downloads UI tags case "haspurchases": case "has-purchases": $filters = array(); if (isset($options['daysago'])) $filters['where'] = "UNIX_TIMESTAMP(o.created) > UNIX_TIMESTAMP()-".($options['daysago']*86400); if (empty($Ecart->purchases)) $this->load_orders($filters); return (!empty($Ecart->purchases)); break; case "purchases": if (!isset($this->_purchaseloop)) { reset($Ecart->purchases); $Ecart->Purchase = current($Ecart->purchases); $this->_purchaseloop = true; } else { $Ecart->Purchase = next($Ecart->purchases); } if (current($Ecart->purchases) !== false) return true; else { unset($this->_purchaseloop); return false; } break; case "receipt": // DEPRECATED case "order": return ecarturl(array('acct'=>'order','id'=>$Ecart->Purchase->id),'account'); break; } }
public static function query($query) { _g('DB::query'); _d($query); _u(); $result = self::run_query($query, self::OP_QUERY); return $result; }
protected function prepareOutput() { if ($this->output_prepared) { return; } _g('prepare output'); $this->generateMissingDefinitions(); $this->exposeDefinitions(); $assetsOrder = $this->buildDependencyTrees(); $assetsOrder['head'] = array_values(array_unique($assetsOrder['head'])); $assetsOrder['bottom'] = array_values(array_unique(array_diff($assetsOrder['bottom'], $assetsOrder['head']))); _d($assetsOrder); $headStyles = []; $headScripts = []; $bottomScripts = []; foreach ($assetsOrder['head'] as $name) { if ($this->definitions[$name]->type == AssetType::STYLE) { $headStyles[] = $name; } else { $headScripts[] = $name; } } foreach ($assetsOrder['bottom'] as $name) { if ($this->definitions[$name]->type == AssetType::STYLE) { $headStyles[] = $name; } else { $bottomScripts[] = $name; } } _d($headStyles, 'head styles'); _d($headScripts, 'head scripts'); _d($bottomScripts, 'bottom scripts'); $headStylesGroups = []; $assetGroup = new OutputGroup(); foreach ($headStyles as $name) { $newAsset = new Asset($this->definitions[$name], $this); } }
<?php if (isset($NoEntries)) { ?> <p class="MsgInfo">Aún no hay entradas que mostrar.</p> <?php } else { ?> <?php for ($c = 0; $c <= $totalFor; $c++) { ?> <?php if (isset($rows[$c][5])) { ?> <b><?php echo _d('F \\d\\e Y', $rows[$c][3]); ?> :</b> <ul> <?php } ?> <li><a href="<?php echo _u('e', $rows[$c][0], $rows[$c][1]); ?> "><?php echo $rows[$c][2]; ?> </a></li> <?php if (isset($rows[$c][6])) {
#!/usr/local/eyou/toolmail/opt/bin/php <?php $path = '/usr/local/eyou/toolmail/data/rrds/esop.eyou.net/dev/'; $rrd_file = 'load_fifteen.rrd'; $rrd_file = 'net_rx_bytes__lo.rrd'; $opt = ['AVERAGE', '-r', '600', '-s', '-1h']; var_dump($opt); $ret = rrd_fetch($path . $rrd_file, $opt); var_export($ret); exit; function _d($d) { return date('Y-m-d H:i:s', $d); } $ret['start'] = _d($ret['start']); $ret['end'] = _d($ret['end']); $arr = []; foreach ($ret['data']['sum'] as $k => $v) { $arr[_d($k)] = $v; } $ret['data']['sum'] = $arr; print_r($ret);
function _ed($date) { echo _d($date); }
/** * Provides ecart('shipping') template API functionality * * Used primarily in the summary.php template * * @since 1.0 * * @return mixed **/ function shippingtag ($property,$options=array()) { global $Ecart; $result = ""; switch ($property) { case "url": return is_ecart_page('checkout')?ecarturl(false,'confirm-order'):ecarturl(false,'cart'); case "hasestimates": return apply_filters('ecart_shipping_hasestimates',!empty($this->shipping)); break; case "options": case "methods": if (!isset($this->sclooping)) $this->sclooping = false; if (!$this->sclooping) { reset($this->shipping); $this->sclooping = true; } else next($this->shipping); if (current($this->shipping) !== false) return true; else { $this->sclooping = false; reset($this->shipping); return false; } break; case "option-menu": case "method-menu": // @todo Add options for differential pricing and estimated delivery dates $_ = array(); $_[] = '<select name="shipmethod" class="ecart shipmethod">'; foreach ($this->shipping as $method) { $selected = ((isset($Ecart->Order->Shipping->method) && $Ecart->Order->Shipping->method == $method->name))?' selected="selected"':false; $_[] = '<option value="'.$method->name.'"'.$selected.'>'.$method->name.' &mdash '.money($method->amount).'</option>'; } $_[] = '</select>'; return join("",$_); break; case "option-name": case "method-name": $option = current($this->shipping); return $option->name; break; case "method-selected": $method = current($this->shipping); return ((isset($Ecart->Order->Shipping->method) && $Ecart->Order->Shipping->method == $method->name)); break; case "option-cost": case "method-cost": $option = current($this->shipping); return money($option->amount); break; case "method-selector": $method = current($this->shipping); $checked = ''; if ((isset($Ecart->Order->Shipping->method) && $Ecart->Order->Shipping->method == $method->name)) $checked = ' checked="checked"'; $result = '<input type="radio" name="shipmethod" value="'.$method->name.'" class="ecart shipmethod" '.$checked.' />'; return $result; break; case "option-delivery": case "method-delivery": $periods = array("h"=>3600,"d"=>86400,"w"=>604800,"m"=>2592000); $option = current($this->shipping); if (!$option->delivery) return ""; $estimates = explode("-",$option->delivery); $format = get_option('date_format'); if (count($estimates) > 1 && $estimates[0] == $estimates[1]) $estimates = array($estimates[0]); $result = ""; for ($i = 0; $i < count($estimates); $i++) { list($interval,$p) = sscanf($estimates[$i],'%d%s'); if (empty($interval)) $interval = 1; if (empty($p)) $p = 'd'; if (!empty($result)) $result .= "—"; $result .= _d($format,mktime()+($interval*$periods[$p])); } return $result; } }
<div class="wrap ecart"> <div class="icon32"></div> <h2><?php _e('Order','Ecart'); ?> #<?php echo $Purchase->id; ?> <span class="date"><?php echo _d(get_option('date_format'), $Purchase->created); ?> <small><?php echo date(get_option('time_format'),$Purchase->created); ?></small></span></h2> <?php if (!empty($updated)): ?><div id="message" class="updated fade"><p><?php echo $updated; ?></p></div><?php endif; ?> <?php include("navigation.php"); ?> <br class="clear" /> <form action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" method="post" id="order-updates"> <div id="order"> <div class="title"> <div id="titlewrap"> <input type="submit" id="print-button" value="<?php _e('Print Order','Ecart'); ?>" class="button" /><br/> </div> </div> <?php if (sizeof($Purchase->purchased) > 0): ?> <table class="widefat" cellspacing="0"> <thead> <tr> <th scope="col" class="item"><?php _e('Items Ordered','Ecart'); ?></th> <th scope="col"><?php _e('Quantity','Ecart'); ?></th> <th scope="col" class="money"><?php _e('Item Price','Ecart'); ?></th> <th scope="col" class="money"><?php _e('Item Total','Ecart'); ?></th> </tr> </thead> <tbody> <?php $even = false; foreach ($Purchase->purchased as $id => $Item):
<?php /* * Name: StatsD Interface * Author: Shish <*****@*****.**> * License: GPLv2 * Visibility: admin * Description: Sends Shimmie stats to a StatsD server * Documentation: * define('STATSD_HOST', 'my.server.com:8125'); in shimmie.conf.php to set the host */ _d("STATSD_HOST", null); function dstat($name, $val) { StatsDInterface::$stats["shimmie.{$name}"] = $val; } class StatsDInterface extends Extension { public static $stats = array(); private function _stats($type) { global $config, $_event_count, $database, $_execs, $_load_start; $time = microtime(true) - $_load_start; StatsDInterface::$stats["shimmie.{$type}.hits"] = "1|c"; StatsDInterface::$stats["shimmie.{$type}.time"] = "{$time}|ms"; StatsDInterface::$stats["shimmie.{$type}.time-db"] = "{$database->dbtime}|ms"; StatsDInterface::$stats["shimmie.{$type}.memory"] = memory_get_peak_usage(true) . "|c"; StatsDInterface::$stats["shimmie.{$type}.files"] = count(get_included_files()) . "|c"; StatsDInterface::$stats["shimmie.{$type}.queries"] = $_execs . "|c"; StatsDInterface::$stats["shimmie.{$type}.events"] = $_event_count . "|c"; StatsDInterface::$stats["shimmie.{$type}.cache-hits"] = $database->cache->get_hits() . "|c";
// string file to log performance data into _d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers _d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes _d("SPEED_HAX", false); // boolean do some questionable things in the name of performance _d("COMPILE_ELS", false); // boolean pre-build the list of event listeners _d("NICE_URLS", false); // boolean force niceurl mode _d("SEARCH_ACCEL", false); // boolean use search accelerator _d("WH_SPLITS", 1); // int how many levels of subfolders to put in the warehouse _d("VERSION", '2.5.5'); // string shimmie version _d("TIMEZONE", null); // string timezone _d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable _d("EXTRA_EXTS", ""); // optional extra extensions /* * Calculated settings - you should never need to change these * directly, only the things they're built from */ _d("SCORE_VERSION", 'develop/' . VERSION); // string SCore version _d("ENABLED_EXTS", CORE_EXTS . "," . EXTRA_EXTS);
/** * Provides a property or list of properties for the current download from the downloads loop * * @api `shopp('customer.download')` * @since 1.3 * * @param string $result The output * @param array $options The options * @param ShoppCustomer $O The working object * @return string The download property list **/ public static function download($result, $options, $O) { $download = $O->_download; $df = get_option('date_format'); $string = ''; if (array_key_exists('id', $options)) { $string .= $download->download; } if (array_key_exists('purchase', $options)) { $string .= $download->purchase; } if (array_key_exists('name', $options)) { $string .= $download->name; } if (array_key_exists('variation', $options)) { $string .= $download->optionlabel; } if (array_key_exists('downloads', $options)) { $string .= $download->downloads; } if (array_key_exists('key', $options)) { $string .= $download->dkey; } if (array_key_exists('created', $options)) { $string .= $download->created; } if (array_key_exists('total', $options)) { $string .= money($download->total); } if (array_key_exists('filetype', $options)) { $string .= $download->mime; } if (array_key_exists('size', $options)) { $string .= readableFileSize($download->size); } if (array_key_exists('date', $options)) { $string .= _d($df, $download->created); } if (array_key_exists('url', $options)) { $string .= Shopp::url('' == get_option('permalink_structure') ? array('src' => 'download', 'shopp_download' => $download->dkey) : 'download/' . $download->dkey, 'account'); } return $string; }
/** * shippingtag() * shopp('shipping','...') * Used primarily in the summary.php template **/ function shippingtag($property, $options = array()) { global $Shopp; $ShipCosts =& $this->data->ShipCosts; $result = ""; switch ($property) { case "hasestimates": return count($ShipCosts) > 0; break; case "methods": if (!isset($this->sclooping)) { $this->sclooping = false; } if (!$this->sclooping) { reset($ShipCosts); $this->sclooping = true; } else { next($ShipCosts); } if (current($ShipCosts)) { return true; } else { $this->sclooping = false; reset($ShipCosts); return false; } break; case "method-name": return key($ShipCosts); break; case "method-cost": $method = current($ShipCosts); return money($method['cost']); break; case "method-selector": $method = current($ShipCosts); $checked = ''; if (isset($this->data->Order->Shipping->method) && $this->data->Order->Shipping->method == $method['name'] || $method['cost'] == $this->data->Totals->shipping) { $checked = ' checked="checked"'; } $result .= '<input type="radio" name="shipmethod" value="' . $method['name'] . '" class="shipmethod" ' . $checked . ' rel="' . $method['cost'] . '" />'; return $result; break; case "method-delivery": $periods = array("h" => 3600, "d" => 86400, "w" => 604800, "m" => 2592000); $method = current($ShipCosts); $estimates = explode("-", $method['delivery']); $format = get_option('date_format'); if ($estimates[0] == $estimates[1]) { $estimates = array($estimates[0]); } $result = ""; for ($i = 0; $i < count($estimates); $i++) { list($interval, $p) = sscanf($estimates[$i], '%d%s'); if (!empty($result)) { $result .= "—"; } $result .= _d($format, mktime() + $interval * $periods[$p]); } return $result; } }