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


PHP Book::isBook方法代码示例

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


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

示例1: registerThemeDirectories

 /**
  * Register theme directories, set a filter that hides themes under certain conditions
  */
 function registerThemeDirectories()
 {
     // No trailing slash, otherwise we get a double slash bug
     // @see \PressBooks\Metadata::fixDoubleSlashBug
     register_theme_directory(PB_PLUGIN_DIR . 'themes-root');
     register_theme_directory(PB_PLUGIN_DIR . 'themes-book');
     if (is_admin()) {
         if (Book::isBook()) {
             add_filter('allowed_themes', array($this, 'allowedBookThemes'));
         } else {
             add_filter('allowed_themes', array($this, 'allowedRootThemes'));
         }
     }
 }
开发者ID:jflowers45,项目名称:pressbooks,代码行数:17,代码来源:class-pb-pressbooks.php

示例2: adminMenuAdjuster

	/**
	 * Adds and Removes some admin buttons
	 * 
	 * @since 1.0.1
	 */
	function adminMenuAdjuster() {
		if ( \Pressbooks\Book::isBook() ) {
			add_menu_page( __( 'Import', $this->plugin_slug ), __( 'Import', $this->plugin_slug ), 'edit_posts', 'pb_import', '\PressBooks\Admin\Laf\display_import', '', 15 );
			add_options_page( __( 'PressBooks Textbook Settings', $this->plugin_slug ), __( 'PB Textbook', $this->plugin_slug ), 'manage_options', $this->plugin_slug . '-settings', array( $this, 'displayPluginAdminPage' ) );
			add_menu_page( __( 'PressBooks Textbook', $this->plugin_slug ), __( 'PB Textbook', $this->plugin_slug ), 'edit_posts', $this->plugin_slug , array( $this, 'displayPBTPage' ), '', 64 );
			// check if the functionality we need is available
			if ( class_exists('\PressBooks\Api_v1\Api') ){
				add_submenu_page( $this->plugin_slug, __('Search and Import', $this->plugin_slug), __('Search and Import', $this->plugin_slug), 'edit_posts', 'api_search_import',array( $this, 'displayApiSearchPage' ), '', 65 );
			}
			add_submenu_page( $this->plugin_slug, __('Download Textbooks', $this->plugin_slug), __('Download Textbooks', $this->plugin_slug), 'edit_posts', 'download_textbooks',array( $this, 'displayDownloadTextbooks' ), '', 66 );
			add_menu_page( 'Plugins', 'Plugins', 'manage_network_plugins', 'plugins.php', '', 'dashicons-admin-plugins', 67 );
			remove_menu_page( 'pb_sell' );
		}
	}
开发者ID:hughmcguire,项目名称:pressbooks-textbook,代码行数:19,代码来源:class-pbt-textbook-admin.php

示例3: add_theme

function add_theme($themes)
{
    $merge_themes = array();
    if (\Pressbooks\Book::isBook()) {
        $registered_themes = search_theme_directories();
        foreach ($registered_themes as $key => $val) {
            if ($val['theme_root'] == __DIR__ . '/themes') {
                $merge_themes[$key] = 1;
            }
        }
        // add our theme
        $themes = array_merge($themes, $merge_themes);
    }
    return $themes;
}
开发者ID:BCcampus,项目名称:candela,代码行数:15,代码来源:candela-utility.php

示例4: add_themes_to_filter

 /**
  * Add the plugin's specific themes to the PressBooks theme filter.
  * Inspirated from Textbook's one.
  *
  * @since    0.1
  * @param    array $themes The currently allowed themes in PressBooks
  * @return   array The array from the input, with the plugin's themes
  */
 public function add_themes_to_filter($themes)
 {
     $pbt_themes = array();
     if (\Pressbooks\Book::isBook()) {
         $registered_themes = search_theme_directories();
         foreach ($registered_themes as $key => $val) {
             if ($val['theme_root'] == plugin_dir_path(dirname(__FILE__)) . 'themes') {
                 $pbt_themes[$key] = 1;
             }
         }
         // add our theme to the whitelist
         $themes = array_merge($themes, $pbt_themes);
         return $themes;
     } else {
         return $themes;
     }
 }
开发者ID:Books4Languages,项目名称:Pressbooks-Lingua-Theme,代码行数:25,代码来源:class-pressbooks-lingua-theme-themes.php

示例5: hide_menus

function hide_menus()
{
    global $wpdb;
    $user = wp_get_current_user();
    $restricted = $wpdb->get_results('SELECT * FROM wp_sitemeta WHERE meta_key = "pressbooks_network_managers"');
    if ($restricted) {
        $restricted = maybe_unserialize($restricted[0]->meta_value);
    } else {
        $restricted = array();
    }
    if (in_array($user->ID, $restricted) && !\PressBooks\Book::isBook()) {
        remove_menu_page("themes.php");
        remove_menu_page("plugins.php");
        remove_menu_page("settings.php");
        remove_menu_page("update-core.php");
        remove_menu_page("admin.php?page=pb_stats");
    }
}
开发者ID:samsruti,项目名称:pressbooks,代码行数:18,代码来源:pb-network-managers.php

示例6: adminMenuAdjuster

 /**
  * Adds and Removes some admin buttons
  * 
  * @since 1.0.1
  */
 function adminMenuAdjuster()
 {
     if (\Pressbooks\Book::isBook()) {
         add_menu_page(__('Import', $this->plugin_slug), __('Import', $this->plugin_slug), 'edit_posts', 'pb_import', '\\Pressbooks\\Admin\\Laf\\display_import', 'dashicons-upload', 15);
         add_options_page(__('Pressbooks Textbook Settings', $this->plugin_slug), __('PB Textbook', $this->plugin_slug), 'manage_options', $this->plugin_slug . '-settings', array($this, 'displayPluginAdminPage'));
         add_menu_page(__('Pressbooks Textbook', $this->plugin_slug), __('PB Textbook', $this->plugin_slug), 'edit_posts', $this->plugin_slug, array($this, 'displayPBTPage'), 'dashicons-tablet', 64);
         // check if the functionality we need is available
         if (class_exists('\\Pressbooks\\Modules\\Api_v1\\Api')) {
             add_submenu_page($this->plugin_slug, __('Search and Import', $this->plugin_slug), __('Search and Import', $this->plugin_slug), 'edit_posts', 'api_search_import', array($this, 'displayApiSearchPage'), '', 65);
         }
         add_submenu_page($this->plugin_slug, __('Download Textbooks', $this->plugin_slug), __('Download Textbooks', $this->plugin_slug), 'edit_posts', 'download_textbooks', array($this, 'displayDownloadTextbooks'), '', 66);
         if (version_compare(PB_PLUGIN_VERSION, '2.7') >= 0) {
             remove_menu_page('pb_publish');
         } else {
             remove_menu_page('pb_sell');
         }
     }
 }
开发者ID:pressbooks,项目名称:pressbooks-textbook,代码行数:23,代码来源:class-pbt-textbook-admin.php

示例7: deletePost

 /**
  * Put a Part/Chapter/Front Matter/Back Matter in the trash
  *
  * @param int $pid
  *
  * @return bool
  */
 static function deletePost($pid)
 {
     if (false == Book::isBook() || wp_is_post_revision($pid) || 'auto-draft' == get_post_status($pid)) {
         return false;
     }
     /** @var $wpdb \wpdb */
     global $wpdb;
     // remove chapter/part/front matter
     // decrement order of everything with a higher order, and if chapter, only within that part
     $post = get_post($pid);
     $order = $post->menu_order;
     $type = $post->post_type;
     $parent = $post->post_parent;
     $query = "UPDATE {$wpdb->posts} SET menu_order = menu_order - 1 WHERE menu_order > {$order} AND post_type = '{$type}' ";
     if ('chapter' == $type) {
         $query .= " AND post_parent = {$parent} ";
     }
     $success = $wpdb->query($query);
     clean_post_cache($post);
     if ('part' == $type) {
         // We're setting two things here - the new post_parent (to the first part)
         // And the new menu order for the chapters that were in the part being deleted.
         $new_parent_id = $wpdb->get_var("SELECT ID\n\t\t\t\t\t\t\t\t\t\t FROM {$wpdb->posts}\n\t\t\t\t\t\t\t\t\t\tWHERE post_type = 'part'\n\t\t\t\t\t\t\t\t\t\t  AND post_status = 'publish'\n\t\t\t\t\t\t\t\t\t\t  AND NOT ID = {$pid}\n\t\t\t\t\t\t\t\t\t ORDER BY menu_order\n\t\t\t\t\t\t\t\t\t\tLIMIT 1 ");
         if ($new_parent_id) {
             $existing_numposts = $wpdb->get_var("SELECT COUNT(1) AS numposts FROM {$wpdb->posts} WHERE post_type = 'chapter' AND post_parent = {$new_parent_id} ");
             $query = "UPDATE {$wpdb->posts} SET post_parent = {$new_parent_id}, menu_order = menu_order + {$existing_numposts} WHERE post_parent = {$pid} AND post_type = 'chapter' ";
             $success = $wpdb->query($query);
         } else {
             $query = "UPDATE {$wpdb->posts} SET post_status = 'trash' WHERE post_parent = {$pid} AND post_type = 'chapter' ";
             $success = $wpdb->query($query);
         }
         wp_cache_flush();
     }
     static::deleteBookObjectCache();
     return $success ? true : false;
 }
开发者ID:stackpoet,项目名称:pressbooks,代码行数:43,代码来源:class-pb-book.php

示例8: array

<?php

/**
 * Change core WordPress strings using $overrides array.
 *
 * @author  PressBooks <code@pressbooks.com>
 * @license GPLv2 (or any later version)
 * @see     pressbooks/includes/pb-l10n.php
 */
$overrides = array('My Sites' => 'Mina Böcker', 'Create a New Site' => 'Skapa en ny bok');
if (\PressBooks\Book::isBook()) {
    $overrides['Settings'] = 'Inställningar';
    $overrides['Visit Site'] = 'Besök Bok';
    $overrides['Edit Site'] = 'Visa Bok';
    $overrides['Du har använt din utrymmeskvot. Vänligen ta bort filer innan du lägger upp.'] = 'Tyvärr, du har använt alla dina lagringskvoten. Vill du ha mer utrymme? Uppgradera din bok.';
}
return $overrides;
开发者ID:Emaratilicious,项目名称:oddibooks,代码行数:17,代码来源:core-sv_SE.php

示例9: add_menu

/**
 * Add Edit CSS menu.
 */
function add_menu()
{
    if (Book::isBook() && CustomCss::isCustomCss()) {
        add_theme_page(__('Edit CSS', 'pressbooks'), __('Edit CSS', 'pressbooks'), 'edit_theme_options', 'pb_custom_css', __NAMESPACE__ . '\\display_custom_css');
    }
}
开发者ID:cumi,项目名称:pressbooks,代码行数:9,代码来源:pb-customcss.php

示例10: filterChildThemes

	/**
	 * Pressbooks filters allowed themes, this adds our themes to the list
	 * 
	 * @since 1.0.7
	 * @param array $themes
	 * @return array
	 */
	function filterChildThemes( $themes ) {
		$pbt_themes = array();

		if ( \Pressbooks\Book::isBook() ) {
			$registered_themes = search_theme_directories();

			foreach ( $registered_themes as $key => $val ) {
				if ( $val['theme_root'] == PBT_PLUGIN_DIR . 'themes-book' ) {
					$pbt_themes[$key] = 1;
				}
			}
			// add our theme
			$themes = array_merge( $themes, $pbt_themes );

			return $themes;
		} else {
			return $themes;
		}
	}
开发者ID:hughmcguire,项目名称:pressbooks-textbook,代码行数:26,代码来源:pressbooks-textbook.php


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