false, // deprecated 'userid' => false, 'user' => false, // 7.4: unofficial 'nickname' => false, 'nick' => false, 'author' => false, 'authors' => false, 'year' => false, 'years' => false, 'itemtype' => false, // for selecting by itemtype; assumes one type 'item_type' => 'items', 'data_type' => false, // deprecated 'datatype' => 'items', 'collection_id' => false, 'collection' => false, 'collections' => false, 'item_key' => false, 'item' => false, 'items' => false, 'inclusive' => 'yes', 'tag_name' => false, 'tag' => false, 'tags' => false, 'style' => false, 'limit' => false, 'sortby' => 'default', 'order' => false, 'sort' => false, 'title' => 'no', 'image' => false, 'images' => false, 'showimage' => 'no', 'showtags' => 'no', 'downloadable' => 'no', 'download' => 'no', 'shownotes' => false, 'note' => false, 'notes' => 'no', 'abstract' => false, 'abstracts' => 'no', 'cite' => 'no', 'citeable' => false, 'metadata' => false, 'target' => false, 'urlwrap' => false, 'highlight' => false, 'forcenumber' => false, 'forcenumbers' => false ), $atts ); global $post, $wpdb; // +---------------------------+ // | FORMAT & CLEAN PARAMETERS | // +---------------------------+ // 3.9.10: Use the Zotpress_prep_ajax_request_vars() function on bib, lib $zpr = Zotpress_prep_ajax_request_vars($wpdb, $zp_atts); // +-------------+ // | GET ACCOUNT | // +-------------+ // CHECK: Is this needed? Isn't it already in zotpress.php? // CHECK: Yes, but it's not being called ... no idea why ... // Turn on/off minified versions if testing/live $minify = ''; if ( ZOTPRESS_LIVEMODE ) $minify = '.min'; wp_enqueue_script( 'zotpress.shortcode.bib'.$minify.'.js' ); $zp_account = false; if ( $zpr['nickname'] !== false ) { $zp_account = $wpdb->get_row( $wpdb->prepare( " SELECT * FROM `".$wpdb->prefix."zotpress` WHERE `nickname`=%s ", array( $zpr['nickname'] ) ), OBJECT ); if ( is_null($zp_account) ): return "
Sorry, but the selected Zotpress nickname can't be found.
"; endif; $zpr["api_user_id"] = $zp_account->api_user_id; } elseif ( $zpr["api_user_id"] !== false ) { $zp_account = $wpdb->get_row( $wpdb->prepare( " SELECT * FROM `".$wpdb->prefix."zotpress` WHERE `api_user_id`=%s ", array( $zpr["api_user_id"] ) ), OBJECT ); if ( is_null($zp_account) ): return "Sorry, but the selected Zotpress account can't be found.
"; endif; $zpr["api_user_id"] = $zp_account->api_user_id; } elseif ( $zpr["nickname"] === false && $zpr["api_user_id"] === false ) { if ( get_option("Zotpress_DefaultAccount") !== false ) { $zpr["api_user_id"] = get_option("Zotpress_DefaultAccount"); $zp_account = $wpdb->get_row( $wpdb->prepare( " SELECT * FROM `".$wpdb->prefix."zotpress` WHERE `api_user_id`=%s ", array( $zpr["api_user_id"] ) ), OBJECT ); } else { // When all else fails ... assume one account $zp_account = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."zotpress LIMIT 1", OBJECT); $zpr["api_user_id"] = $zp_account->api_user_id; } } // Generate instance id for shortcode $temp_item_key = is_array( $zpr['item_key'] ) ? implode( "-", $zpr['item_key']) : $zpr['item_key']; $temp_collection_id = is_array( $zpr['collection_id'] ) ? implode( "-", $zpr['collection_id']) : $zpr['collection_id']; $temp_tag_name = is_array( $zpr['tag_id'] ) ? implode( "-", $zpr['tag_id']) : $zpr['tag_id']; $temp_author = is_array( $zpr['author'] ) ? implode( "-", $zpr['author']) : $zpr['author']; $temp_year = is_array( $zpr['year'] ) ? implode( "-", $zpr['year']) : $zpr['year']; $temp_sortby = is_array( $zpr['sortby'] ) ? implode( "-", $zpr['sortby']) : $zpr['sortby']; // REVIEW: Added post ID // 7.3.10: REVIEW: Removed $nickname, $item_type // $instance_id = "zotpress-".md5($post->ID.$api_user_id.$nickname.$temp_author.$temp_year.$itemtype.$item_type.$temp_collection_id.$temp_item_key.$temp_tag_name.$style.$temp_sortby.$order.$limit.$showimage.$showtags.$downloadable.$shownotes.$citeable.$inclusive); $instance_id = "zotpress-".md5($post->ID.$zpr["api_user_id"].$temp_author.$temp_year.$zpr['itemtype'].$temp_collection_id.$temp_item_key.$temp_tag_name.$zpr['style'].$temp_sortby.$zpr['order'].$zpr['limit'].$zpr['showimage'].$zpr['showtags'].$zpr['downloadable'].$zpr['shownotes'].$zpr['citeable'].$zpr['inclusive']); // Prepare item key if ( $zpr['item_key'] && gettype( $zpr['item_key'] ) != "string" ) $zpr['item_key'] = implode( ",", $zpr['item_key'] ); // Prepare collection if ( $zpr['collection_id'] && gettype( $zpr['collection_id'] ) != "string" ) $zpr['collection_id'] = implode( ",", $zpr['collection_id'] ); // Prepare tags if ( $zpr['tag_id'] && gettype( $zpr['tag_id'] ) != "string" ) $zpr['tag_id'] = implode( ",", $zpr['tag_id'] ); // Account for single or multiple years: if ( $zpr['year'] && is_array($zpr['year']) ) $zpr['year'] = implode( ",", $zpr['year'] ); // Set up request vars $request_start = 0; $request_last = 0; $overwrite_last_request = false; // Set up Library vars $is_dropdown = false; $maxresults = 50; $maxperpage = 10; $maxtags = 100; // Set up Search vars $term = false; // Set up Update vars $update = false; $zp_output = '