public function init_settings() { $show_model = new \Dicentis\Podcast_Post_Type\Dipo_Podcast_Shows_Model(); $shows = $show_model->get_shows(false); $this->register_show_settings(-1); foreach ($shows as $show) { $this->register_show_settings($show->term_id); } }
public function settings_pages() { global $pagenow; //generic HTML and code goes here ?> <h2> <?php _e('Dicentis Podcast Settings', $this->textdomain); ?> </h2><?php if (!isset($_GET['page']) || esc_attr($_GET['page']) != 'dicentis_settings') { return; } if (isset($_GET['tab'])) { $tab = esc_attr($_GET['tab']); } else { $tab = 'shows'; } $this->setting_tabs($tab); if ($pagenow == 'edit.php' && esc_attr($_GET['page']) == 'dicentis_settings') { switch ($tab) { default: case 'shows': $show_model = new \Dicentis\Podcast_Post_Type\Dipo_Podcast_Shows_Model(); $shows = $show_model->get_shows(false); $active_show = 'all_shows'; $active_show_title = 'All Shows'; if (isset($_GET['show'])) { $active_show = esc_attr($_GET['show']); foreach ($shows as $show) { if (0 == strcmp($show->slug, $active_show)) { $active_show_title = $show->name; } } } include $this->properties->get('dipo_templates') . '/settings-shows-template.php'; break; case 'import': if (isset($_POST['dipo_feed_url']) and !empty($_POST['dipo_feed_url'])) { $url = esc_attr($_POST['dipo_feed_url']); $feed_importer = new Feed\Dipo_Feed_Import($url); if (isset($_POST['dipo_feed_match'])) { $feed_match = esc_attr($_POST['dipo_feed_match']); $feed_importer->set_try_match($feed_match); } $feed_array = $feed_importer->get_feed_items(); $show_slug = isset($_POST['dipo_show_select']) ? $_POST['dipo_show_select'] : ''; $result = $feed_importer->import_feed($feed_array[0], $feed_array[1], $show_slug); } $args = array('orderby' => 'name', 'hide_empty' => false); $shows = get_terms('podcast_show', $args); include $this->properties->get('dipo_templates') . '/settings-import-template.php'; break; } } }