Пример #1
0
 function test_pmp_render_template()
 {
     $this->expectOutputRegex('/<h2>Search the Platform<\\/h2>/');
     pmp_render_template('search.php', array('PMP' => array(), 'creators' => array(), 'profiles' => array()));
 }
Пример #2
0
/**
 * Render the plugin's series and properties pages
 *
 * @since 0.2
 */
function pmp_collections_page()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    if ($_GET['page'] == 'pmp-properties-menu') {
        $name = 'Properties';
        $profile = 'property';
    } else {
        if ($_GET['page'] == 'pmp-series-menu') {
            $name = 'Series';
            $profile = 'series';
        }
    }
    if (isset($_POST['pmp-unset-default-' . $profile])) {
        delete_option('pmp_default_' . $profile);
    }
    $sdk = new SDKWrapper();
    $pmp_collection = $sdk->query2json('queryDocs', array('profile' => $profile, 'writeable' => 'true', 'limit' => 9999));
    $context = array('PMP' => pmp_json_obj(array('default_collection' => get_option('pmp_default_' . $profile, false), 'pmp_collection' => $pmp_collection, 'profile' => $profile, 'name' => $name)), 'name' => $name, 'profile' => $profile);
    pmp_render_template('collections.php', $context);
}