コード例 #1
0
ファイル: ListingsTable.php プロジェクト: booklein/wpbookle
 function displayMessageRow($item)
 {
     $listing_title = '';
     // show errors and warnings on published and prepared items
     if (in_array($item['status'], array('published', 'changed', 'prepared', 'verified'))) {
         $history = maybe_unserialize($item['last_errors']);
         $tips_errors = array();
         $tips_warnings = array();
         if (is_array($history)) {
             foreach ($history['errors'] as $result) {
                 $tips_errors[] = '<b>' . $result->SeverityCode . ':</b> ' . $result->ShortMessage . ' (' . $result->ErrorCode . ')';
             }
             foreach ($history['warnings'] as $result) {
                 // hide redundant warnings like:
                 // 21917091 - Warning: Requested StartPrice and Quantity revision is redundant
                 // 21917092 - Warning: Requested Quantity revision is redundant.
                 // 21916620 - Warning: Variations with quantity '0' will be removed
                 if (in_array($result->ErrorCode, array(21917091, 21917092, 21916620))) {
                     continue;
                 }
                 $tips_warnings[] = '<b>' . $result->SeverityCode . ':</b> ' . $result->ShortMessage . ' (' . $result->ErrorCode . ')';
             }
         }
         if (!empty($tips_errors)) {
             $listing_title .= '<!br><small style="color:darkred">' . join('<br>', $tips_errors) . '</small><br>';
         }
         if (!empty($tips_warnings)) {
             $listing_title .= '<small><!br><a href="#" onclick="jQuery(\'#warnings_container_' . $item['id'] . '\').slideToggle();return false;">&raquo; ' . '' . sizeof($tips_warnings) . ' warning(s)' . '</a></small><br>';
             $listing_title .= '<div id="warnings_container_' . $item['id'] . '" style="display:none">';
             $listing_title .= '<small>' . join('<br>', $tips_warnings) . '</small>';
             $listing_title .= '</div>';
         }
     }
     // show gallery warning on published items - since only published items have an updated details column
     if (in_array($item['status'], array('published'))) {
         // check PictureDetails.GalleryStatus
         $item_details = WPL_Model::decodeObject($item['details'], false, true);
         if (is_object($item_details) && is_object($item_details->PictureDetails) && $item_details->PictureDetails->getGalleryStatus() == 'ImageProcessingError') {
             $msg = '<b>eBay could not process your gallery image:</b><br>' . $item_details->PictureDetails->getGalleryErrorInfo();
             $listing_title .= '<small style="color:darkred">' . $msg . '</small><br>';
         }
     }
     if (empty($listing_title)) {
         return;
     }
     echo '</tr>';
     echo '<tr>';
     // echo '<td colspan="'.sizeof( $this->_column_headers[0] ).'">';
     echo '<td>&nbsp;</td>';
     echo '<td colspan="7">';
     echo $listing_title;
     echo '</td>';
 }
コード例 #2
0
 static function findItemByEbayID($id, $decode_details = true)
 {
     global $wpdb;
     $table = $wpdb->prefix . self::TABLENAME;
     $item = $wpdb->get_row($wpdb->prepare("\n\t\t\tSELECT *\n\t\t\tFROM {$table}\n\t\t\tWHERE ebay_id = %s\n\t\t", $id));
     // if no listing was found, check previous item IDs
     if (!$item) {
         $id = esc_sql($id);
         $item = $wpdb->get_row("\n\t\t\t\tSELECT *\n\t\t\t\tFROM {$table}\n\t\t\t\tWHERE history LIKE '%{$id}%'\n\t\t\t");
     }
     if (!$item) {
         return false;
     }
     if (!$decode_details) {
         return $item;
     }
     $item->profile_data = WPL_Model::decodeObject($item->profile_data, true);
     $item->details = WPL_Model::decodeObject($item->details);
     return $item;
 }