true )` as argument to this one. * * @param array $args Options to pass to parent constructor * * @return void Constructor does not return */ public function __construct( Ai1ec_Registry_Object $registry, $args = array() ) { $this->_registry = $registry; if ( ! isset( $args['inhibit'] ) ) { parent::__construct( $args ); } } /** * prepare_items function * * Prepares themes for display, applies search filters if available * * @return void **/ public function prepare_items() { global $ct; // setting wp_themes to null in case // other plugins have changed its value unset( $GLOBALS['wp_themes'] ); // get available themes $ct = $this->current_theme_info(); $themes = $this->_registry->get( 'theme.search' ) ->filter_themes(); if ( isset( $ct->name ) && isset( $themes[$ct->name] ) ) { unset( $themes[$ct->name] ); } // sort themes using strnatcasecmp function uksort( $themes, 'strnatcasecmp' ); // themes per page $per_page = 24; // get current page $page = $this->get_pagenum(); $start = ( $page - 1 ) * $per_page; $this->items = array_slice( $themes, $start, $per_page ); // set total themes and themes per page $this->set_pagination_args( array( 'total_items' => count( $themes ), 'per_page' => $per_page, ) ); } /** * Returns html display of themes table * * @return string */ public function display() { $this->tablenav( 'top' ); echo '
', $this->display_rows_or_placeholder(), '
'; $this->tablenav( 'bottom' ); } /** * tablenav function * * @return void */ public function tablenav( $which = 'top' ) { if ( $this->get_pagination_arg( 'total_pages' ) <= 1 ) { return ''; } ?>
pagination( $which ); ?>
enable or install more themes.' ), ai1ec_network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ), ai1ec_network_admin_url( 'theme-install.php' ) ); return; } elseif ( current_user_can( 'manage_network_themes' ) ) { printf( Ai1ec_I18n::__( 'You only have one theme enabled for this site right now. Visit the Network Admin to enable more themes.' ), ai1ec_network_admin_url( 'site-themes.php?id=' . $GLOBALS['blog_id'] ) ); return; } // else, fallthrough. install_themes doesn't help if you // can't enable it. } else { if ( current_user_can( 'install_themes' ) ) { printf( Ai1ec_I18n::__( 'You only have one theme installed right now. You can choose from many free themes in the Timely Theme Directory at any time: just click on the Install Themes tab above.' ), ai1ec_admin_url( AI1EC_THEME_SELECTION_BASE_URL ) ); return; } } // Fallthrough. printf( Ai1ec_I18n::__( 'Only the active theme is available to you. Contact the %s administrator to add more themes.' ), get_site_option( 'site_name' ) ); } /** * get_columns function * * @return array **/ public function get_columns() { return array(); } /** * display_rows function * * @return void **/ function display_rows() { $themes = $this->items; $theme_names = array_keys( $themes ); natcasesort( $theme_names ); foreach ( $theme_names as $theme_name ) { $class = array( 'available-theme' ); ?>
get_stylesheet_directory(); $theme_root_uri = esc_url( $themes[$theme_name]['Theme Root URI'] ); $tags = $themes[$theme_name]['Tags']; // Generate theme activation link. $activate_link = ai1ec_admin_url( AI1EC_THEME_SELECTION_BASE_URL ); $activate_link = add_query_arg( array( 'ai1ec_action' => 'activate_theme', 'ai1ec_theme_dir' => $theme_dir, 'ai1ec_legacy' => false, // hardcoded for 2.2 'ai1ec_stylesheet' => $stylesheet, 'ai1ec_theme_root' => $theme_root, 'ai1ec_theme_url' => $theme_root_uri . '/' . $stylesheet, ), $activate_link ); $activate_link = wp_nonce_url( $activate_link, 'switch-ai1ec_theme_' . $template ); $activate_text = esc_attr( sprintf( Ai1ec_I18n::__( 'Activate “%s”' ), $title ) ); $actions = array(); $actions[] = '' . Ai1ec_I18n::__( 'Activate' ) . ''; $actions = apply_filters( 'theme_action_links', $actions, $themes[$theme_name] ); $actions = implode ( ' | ', $actions ); ?>

%2$s. The stylesheet files are located in %3$s. %4$s uses templates from %5$s. Changes made to the templates will affect both themes.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme ); ?>

%2$s.' ), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?>

_registry->get( 'theme.search' ) ->filter_themes(); $current_theme = $this->get_current_ai1ec_theme(); if ( ! $themes ) { $ct = new stdClass; $ct->name = $current_theme; return $ct; } if ( ! isset( $themes[$current_theme] ) ) { delete_option( 'ai1ec_current_theme' ); $current_theme = $this->get_current_ai1ec_theme(); } $ct = new stdClass; $ct->name = $current_theme; $ct->title = $themes[$current_theme]['Title']; $ct->version = $themes[$current_theme]['Version']; $ct->parent_theme = $themes[$current_theme]['Parent Theme']; $ct->template_dir = $themes[$current_theme]['Template Dir']; $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; $ct->template = $themes[$current_theme]['Template']; $ct->stylesheet = $themes[$current_theme]['Stylesheet']; $ct->screenshot = $themes[$current_theme]['Screenshot']; $ct->description = $themes[$current_theme]['Description']; $ct->author = $themes[$current_theme]['Author']; $ct->tags = $themes[$current_theme]['Tags']; $ct->theme_root = $themes[$current_theme]['Theme Root']; $ct->theme_root_uri = esc_url( $themes[$current_theme]['Theme Root URI'] ); return $ct; } /** * Retrieve current theme display name. * * If the 'current_theme' option has already been set, then it will be returned * instead. If it is not set, then each theme will be iterated over until both * the current stylesheet and current template name. * * @since 1.5.0 * * @return string */ public function get_current_ai1ec_theme() { $option = $this->_registry->get( 'model.option' ); $theme = $option->get( 'ai1ec_current_theme', array() ); return $theme['stylesheet']; } }