当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Theme::is_allowed方法代码示例

本文整理汇总了PHP中WP_Theme::is_allowed方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Theme::is_allowed方法的具体用法?PHP WP_Theme::is_allowed怎么用?PHP WP_Theme::is_allowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Theme的用法示例。


在下文中一共展示了WP_Theme::is_allowed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: single_row

 /**
  * @global string $status
  * @global array  $totals
  *
  * @param WP_Theme $theme
  */
 public function single_row($theme)
 {
     global $status, $totals;
     if ($this->is_site_themes) {
         $allowed = $theme->is_allowed('site', $this->site_id);
     } else {
         $allowed = $theme->is_allowed('network');
     }
     $stylesheet = $theme->get_stylesheet();
     $class = !$allowed ? 'inactive' : 'active';
     $id = sanitize_html_class($theme->get_stylesheet());
     if (!empty($totals['upgrade']) && !empty($theme->update)) {
         $class .= ' update';
     }
     echo "<tr id='{$id}' class='{$class}'>";
     $this->single_row_columns($theme);
     echo "</tr>";
     if ($this->is_site_themes) {
         remove_action("after_theme_row_{$stylesheet}", 'wp_theme_update_row');
     }
     /**
      * Fires after each row in the Multisite themes list table.
      *
      * @since 3.1.0
      *
      * @param string   $stylesheet Directory name of the theme.
      * @param WP_Theme $theme      Current WP_Theme object.
      * @param string   $status     Status of the theme.
      */
     do_action('after_theme_row', $stylesheet, $theme, $status);
     /**
      * Fires after each specific row in the Multisite themes list table.
      *
      * The dynamic portion of the hook name, `$stylesheet`, refers to the
      * directory name of the theme, most often synonymous with the template
      * name of the theme.
      *
      * @since 3.5.0
      *
      * @param string   $stylesheet Directory name of the theme.
      * @param WP_Theme $theme      Current WP_Theme object.
      * @param string   $status     Status of the theme.
      */
     do_action("after_theme_row_{$stylesheet}", $stylesheet, $theme, $status);
 }
开发者ID:alenteria,项目名称:vitrari,代码行数:51,代码来源:class-wp-ms-themes-list-table.php

示例2: single_row

 /**
  * @global string $status
  * @global int $page
  * @global string $s
  * @global array $totals
  * @param WP_Theme $theme
  */
 public function single_row($theme)
 {
     global $status, $page, $s, $totals;
     $context = $status;
     if ($this->is_site_themes) {
         $url = "site-themes.php?id={$this->site_id}&amp;";
         $allowed = $theme->is_allowed('site', $this->site_id);
     } else {
         $url = 'themes.php?';
         $allowed = $theme->is_allowed('network');
     }
     // Pre-order.
     $actions = array('enable' => '', 'disable' => '', 'edit' => '', 'delete' => '');
     $stylesheet = $theme->get_stylesheet();
     $theme_key = urlencode($stylesheet);
     if (!$allowed) {
         if (!$theme->errors()) {
             $actions['enable'] = '<a href="' . esc_url(wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $stylesheet)) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ($this->is_site_themes ? __('Enable') : __('Network Enable')) . '</a>';
         }
     } else {
         $actions['disable'] = '<a href="' . esc_url(wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $stylesheet)) . '" title="' . esc_attr__('Disable this theme') . '">' . ($this->is_site_themes ? __('Disable') : __('Network Disable')) . '</a>';
     }
     if (current_user_can('edit_themes')) {
         $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme_key) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
     }
     if (!$allowed && current_user_can('delete_themes') && !$this->is_site_themes && $stylesheet != get_option('stylesheet') && $stylesheet != get_option('template')) {
         $actions['delete'] = '<a href="' . esc_url(wp_nonce_url('themes.php?action=delete-selected&amp;checked[]=' . $theme_key . '&amp;theme_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-themes')) . '" title="' . esc_attr__('Delete this theme') . '" class="delete">' . __('Delete') . '</a>';
     }
     /**
      * Filter the action links displayed for each theme in the Multisite
      * themes list table.
      *
      * The action links displayed are determined by the theme's status, and
      * which Multisite themes list table is being displayed - the Network
      * themes list table (themes.php), which displays all installed themes,
      * or the Site themes list table (site-themes.php), which displays the
      * non-network enabled themes when editing a site in the Network admin.
      *
      * The default action links for the Network themes list table include
      * 'Network Enable', 'Network Disable', 'Edit', and 'Delete'.
      *
      * The default action links for the Site themes list table include
      * 'Enable', 'Disable', and 'Edit'.
      *
      * @since 2.8.0
      *
      * @param array    $actions An array of action links.
      * @param WP_Theme $theme   The current WP_Theme object.
      * @param string   $context Status of the theme.
      */
     $actions = apply_filters('theme_action_links', array_filter($actions), $theme, $context);
     /**
      * Filter the action links of a specific theme in the Multisite themes
      * list table.
      *
      * The dynamic portion of the hook name, `$stylesheet`, refers to the
      * directory name of the theme, which in most cases is synonymous
      * with the template name.
      *
      * @since 3.1.0
      *
      * @param array    $actions An array of action links.
      * @param WP_Theme $theme   The current WP_Theme object.
      * @param string   $context Status of the theme.
      */
     $actions = apply_filters("theme_action_links_{$stylesheet}", $actions, $theme, $context);
     $class = !$allowed ? 'inactive' : 'active';
     $checkbox_id = "checkbox_" . md5($theme->get('Name'));
     $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select') . " " . $theme->display('Name') . "</label>";
     $id = sanitize_html_class($theme->get_stylesheet());
     if (!empty($totals['upgrade']) && !empty($theme->update)) {
         $class .= ' update';
     }
     echo "<tr id='{$id}' class='{$class}'>";
     list($columns, $hidden) = $this->get_column_info();
     foreach ($columns as $column_name => $column_display_name) {
         $style = '';
         if (in_array($column_name, $hidden)) {
             $style = ' style="display:none;"';
         }
         switch ($column_name) {
             case 'cb':
                 echo "<th scope='row' class='check-column'>{$checkbox}</th>";
                 break;
             case 'name':
                 echo "<td class='theme-title'{$style}><strong>" . $theme->display('Name') . "</strong>";
                 echo $this->row_actions($actions, true);
                 echo "</td>";
                 break;
             case 'description':
                 echo "<td class='column-description desc'{$style}>";
                 if ($theme->errors()) {
                     $pre = $status == 'broken' ? __('Broken Theme:') . ' ' : '';
//.........这里部分代码省略.........
开发者ID:kuryerov,项目名称:portfolio,代码行数:101,代码来源:class-wp-ms-themes-list-table.php

示例3: wp_theme_update_row

/**
 *
 * @param string   $theme_key
 * @param WP_Theme $theme
 * @return false|void
 */
function wp_theme_update_row($theme_key, $theme)
{
    $current = get_site_transient('update_themes');
    if (!isset($current->response[$theme_key])) {
        return false;
    }
    $r = $current->response[$theme_key];
    $theme_name = $theme['Name'];
    $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $current->response[$theme_key]['url']);
    $wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
    $active = $theme->is_allowed('network') ? ' active' : '';
    echo '<tr class="plugin-update-tr' . $active . '" id="' . esc_attr($theme->get_stylesheet() . '-update') . '" data-slug="' . esc_attr($theme->get_stylesheet()) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
    if (!current_user_can('update_themes')) {
        /* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number */
        printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>.'), $theme_name, esc_url($details_url), esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])), $r['new_version']);
    } elseif (empty($r['package'])) {
        /* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number */
        printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>'), $theme_name, esc_url($details_url), esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])), $r['new_version']);
    } else {
        /* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number, 5: update URL, 6: accessibility text */
        printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" class="update-link" aria-label="%6$s">update now</a>.'), $theme_name, esc_url($details_url), esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])), $r['new_version'], wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key), esc_attr(sprintf(__('Update %s now'), $theme_name)));
    }
    /**
     * Fires at the end of the update message container in each
     * row of the themes list table.
     *
     * The dynamic portion of the hook name, `$theme_key`, refers to
     * the theme slug as found in the WordPress.org themes repository.
     *
     * @since 3.1.0
     *
     * @param WP_Theme $theme The WP_Theme object.
     * @param array    $r {
     *     An array of metadata about the available theme update.
     *
     *     @type string $new_version New theme version.
     *     @type string $url         Theme URL.
     *     @type string $package     Theme update package URL.
     * }
     */
    do_action("in_theme_update_message-{$theme_key}", $theme, $r);
    echo '</div></td></tr>';
}
开发者ID:BoldGrid,项目名称:WordPress,代码行数:49,代码来源:update.php

示例4: column_description

 /**
  * Handles the description column output.
  *
  * @since 4.3.0
  * @access public
  *
  * @global string $status
  * @global array  $totals
  *
  * @param WP_Theme $theme The current WP_Theme object.
  */
 public function column_description($theme)
 {
     global $status, $totals;
     if ($theme->errors()) {
         $pre = $status === 'broken' ? __('Broken Theme:') . ' ' : '';
         echo '<p><strong class="error-message">' . $pre . $theme->errors()->get_error_message() . '</strong></p>';
     }
     if ($this->is_site_themes) {
         $allowed = $theme->is_allowed('site', $this->site_id);
     } else {
         $allowed = $theme->is_allowed('network');
     }
     $class = !$allowed ? 'inactive' : 'active';
     if (!empty($totals['upgrade']) && !empty($theme->update)) {
         $class .= ' update';
     }
     echo "<div class='theme-description'><p>" . $theme->display('Description') . "</p></div>\n\t\t\t<div class='{$class} second theme-version-author-uri'>";
     $stylesheet = $theme->get_stylesheet();
     $theme_meta = array();
     if ($theme->get('Version')) {
         $theme_meta[] = sprintf(__('Version %s'), $theme->display('Version'));
     }
     $theme_meta[] = sprintf(__('By %s'), $theme->display('Author'));
     if ($theme->get('ThemeURI')) {
         $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__('Visit theme homepage') . '">' . __('Visit Theme Site') . '</a>';
     }
     /**
      * Filter the array of row meta for each theme in the Multisite themes
      * list table.
      *
      * @since 3.1.0
      *
      * @param array    $theme_meta An array of the theme's metadata,
      *                             including the version, author, and
      *                             theme URI.
      * @param string   $stylesheet Directory name of the theme.
      * @param WP_Theme $theme      WP_Theme object.
      * @param string   $status     Status of the theme.
      */
     $theme_meta = apply_filters('theme_row_meta', $theme_meta, $stylesheet, $theme, $status);
     echo implode(' | ', $theme_meta);
     echo '</div>';
 }
开发者ID:kadrim1,项目名称:metsayhistu,代码行数:54,代码来源:class-wp-ms-themes-list-table.php


注:本文中的WP_Theme::is_allowed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。