$artistid = $result['artistid']; $artistname = $result['artist']; print "{$id}: {$title}: {$artistid} ({$artist})\n"; print "\nTrack info\n"; $result = $catalog->getTrackInfo("bcbaca8b-9480-4041-b401-17c209d63dca"); $id = $result['id']; $title = $result['title']; $albumid = $result['albumid']; $albumname = $result['album']; $artistid = $result['artistid']; $artistname = $result['artist']; print "{$id}: {$title}: {$artistid} ({$artist}): {$albumid} ({$album})\n"; // // Favorites // $favs = new SimpleFavorites("../database/favorites.sqlite"); $favs->addFavorite("albums", $user, "fake_gid_001"); $favs->addFavorite("albums", $user, "fake_gid_001"); $favs->addFavorite("albums", $user, "fake_gid_001"); $ids = $favs->getFavorites("albums", $user); foreach ($ids as $id) { print "fav: {$id}\n"; } $favs->delFavorite("albums", $user, "fake_gid_001"); // // Ratings // print "\n--------Ratings Tests--------\n"; $ratings = new SimpleRatings("../database/ratings.sqlite"); $ratings->addRating($user, "fake_gid_001", 5); $ratings->addRating($user, "fake_gid_002", 3);
along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * Check Wordpress and PHP versions before instantiating plugin */ register_activation_hook(__FILE__, 'simple_favorites_check_versions'); define('FAVORITES_PLUGIN_FILE', __FILE__); function simple_favorites_check_versions($wp = '3.9', $php = '5.3.2') { global $wp_version; if (version_compare(PHP_VERSION, $php, '<')) { $flag = 'PHP'; } elseif (version_compare($wp_version, $wp, '<')) { $flag = 'WordPress'; } else { return; } $version = 'PHP' == $flag ? $php : $wp; if (function_exists('deactivate_plugins')) { deactivate_plugins(basename(__FILE__)); } wp_die('<p>The <strong>Favorites</strong> plugin requires' . $flag . ' version ' . $version . ' or greater.</p>', 'Plugin Activation Error', array('response' => 200, 'back_link' => TRUE)); } if (!class_exists('Bootstrap')) { simple_favorites_check_versions(); require_once __DIR__ . '/vendor/autoload.php'; require_once __DIR__ . '/app/SimpleFavorites.php'; require_once __DIR__ . '/app/API/functions.php'; SimpleFavorites::init(); }