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


PHP Book::deleteBookObjectCache方法代码示例

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


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

示例1: revokeCurrentImport

 /**
  * Delete 'pressbooks_current_import' option, delete the file too.
  *
  * @return bool
  */
 function revokeCurrentImport()
 {
     $current_import = get_option('pressbooks_current_import');
     if (is_array($current_import) && isset($current_import['file']) && is_file($current_import['file'])) {
         unlink($current_import['file']);
     }
     \Pressbooks\Book::deleteBookObjectCache();
     delete_transient('dirsize_cache');
     /** @see get_dirsize() */
     return delete_option('pressbooks_current_import');
 }
开发者ID:pressbooks,项目名称:pressbooks,代码行数:16,代码来源:class-pb-import.php

示例2: revokeCurrentImport

 /**
  * Simple revoke of an import (user hits the 'cancel' button)
  * 
  * @return type
  */
 static function revokeCurrentImport()
 {
     \Pressbooks\Book::deleteBookObjectCache();
     return delete_option('pbt_current_import');
 }
开发者ID:pressbooks,项目名称:pressbooks-textbook,代码行数:10,代码来源:class-pbt-apisearch.php

示例3: delete_cover_image

/**
 * WP_Ajax hook for pb_delete_cover_image
 */
function delete_cover_image()
{
    if (current_user_can_for_blog(get_current_blog_id(), 'upload_files') && check_ajax_referer('pb-delete-cover-image')) {
        $image_url = $_POST['filename'];
        $pid = $_POST['pid'];
        // Delete old images
        $old_id = \PressBooks\Image\attachment_id_from_url($image_url);
        if ($old_id) {
            wp_delete_attachment($old_id, true);
        }
        update_post_meta($pid, 'pb_cover_image', \PressBooks\Image\default_cover_url());
        \PressBooks\Book::deleteBookObjectCache();
    }
    // @see http://codex.wordpress.org/AJAX_in_Plugins#Error_Return_Values
    // Will append 0 to returned json string if we don't die()
    die;
}
开发者ID:cumi,项目名称:pressbooks,代码行数:20,代码来源:pb-metaboxes.php

示例4: save_attachment

/**
 * WP Hook for action 'wp_update_attachment_metadata'. Deal with user editing cover image from Media Library.
 */
function save_attachment($data, $post_id)
{
    if (empty($data['file'])) {
        return $data;
    }
    // Bail
    $post = get_post($post_id);
    $meta_post = (new \PressBooks\Metadata())->getMetaPost();
    // PHP 5.4+
    $upload_dir = wp_upload_dir();
    $url = untrailingslashit($upload_dir['baseurl']) . "/{$data['file']}";
    if ($meta_post && $post && $post->post_parent == $meta_post->ID) {
        // Update pb_cover_image to point to edited file
        update_post_meta($meta_post->ID, 'pb_cover_image', $url);
        \PressBooks\Book::deleteBookObjectCache();
    } elseif ($post && strpos($post->post_name, 'pb-catalog-logo') === 0) {
        // Update pb_catalog_logo to point to edited file
        update_user_meta($post->post_author, 'pb_catalog_logo', $url);
    }
    return $data;
}
开发者ID:jflowers45,项目名称:pressbooks,代码行数:24,代码来源:pb-image.php

示例5: makeThumbnailsForBookCover

 /**
  * Generate thumbnails for a user uploaded cover
  */
 function makeThumbnailsForBookCover()
 {
     $post = $this->getMetaPost();
     if ($post) {
         $pb_cover_image = get_post_meta($post->ID, 'pb_cover_image', true);
         if ($pb_cover_image && !preg_match('~assets/dist/images/default-book-cover\\.jpg$~', $pb_cover_image)) {
             $path = \Pressbooks\Utility\get_media_path($pb_cover_image);
             $type = wp_check_filetype($path);
             $type = $type['type'];
             // Insert new image, create thumbnails
             $args = array('post_mime_type' => $type, 'post_title' => __('Cover Image', 'pressbooks'), 'post_content' => '', 'post_status' => 'inherit');
             include_once ABSPATH . 'wp-admin/includes/image.php';
             $id = wp_insert_attachment($args, $path, $post->ID);
             wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $path));
             Book::deleteBookObjectCache();
         }
     }
 }
开发者ID:pressbooks,项目名称:pressbooks,代码行数:21,代码来源:class-pb-metadata.php

示例6: function

// -------------------------------------------------------------------------------------------------------------------
// Custom Css
// -------------------------------------------------------------------------------------------------------------------
add_action('admin_menu', '\\PressBooks\\Admin\\CustomCss\\add_menu');
add_action('load-post.php', '\\PressBooks\\Admin\\CustomCss\\redirect_css_editor');
// -------------------------------------------------------------------------------------------------------------------
// SASS
// -------------------------------------------------------------------------------------------------------------------
add_action('update_option_pressbooks_global_typography', '\\PressBooks\\Admin\\Fonts\\update_font_stacks');
if (\PressBooks\Book::isBook()) {
    // Look & Feel
    add_action('after_switch_theme', '\\PressBooks\\Admin\\Fonts\\update_font_stacks');
    // Posts, Meta Boxes
    add_action('updated_postmeta', function ($meta_id, $object_id, $meta_key, $meta_value) {
        if ('pb_language' == $meta_key) {
            \PressBooks\Book::deleteBookObjectCache();
            \PressBooks\Admin\Fonts\update_font_stacks();
        }
    }, 10, 4);
    // Init
    add_action('admin_init', '\\PressBooks\\Admin\\Fonts\\fix_missing_font_stacks');
    add_action('admin_init', '\\PressBooks\\Editor\\add_editor_style');
}
// -------------------------------------------------------------------------------------------------------------------
// "Catch-all" routines, must come after taxonomies and friends
// -------------------------------------------------------------------------------------------------------------------
add_action('init', '\\PressBooks\\Modules\\Export\\Export::formSubmit', 50);
add_action('init', '\\PressBooks\\Modules\\Import\\Import::formSubmit', 50);
add_action('init', '\\PressBooks\\CustomCss::formSubmit', 50);
add_action('init', '\\PressBooks\\Catalog::formSubmit', 50);
// -------------------------------------------------------------------------------------------------------------------
开发者ID:BCcampus,项目名称:candela,代码行数:31,代码来源:hooks-admin.php

示例7: formSubmit

 /**
  * Catch form submissions
  *
  * @see pressbooks/admin/templates/export.php
  */
 static function formSubmit()
 {
     if (false == static::isFormSubmission() || false == current_user_can('edit_posts')) {
         // Don't do anything in this function, bail.
         return;
     }
     // Set locale to UTF8 so escapeshellcmd() doesn't strip valid characters.
     setlocale(LC_CTYPE, 'UTF8', 'en_US.UTF-8');
     putenv('LC_CTYPE=en_US.UTF-8');
     // Download
     if (!empty($_GET['download_export_file'])) {
         $filename = sanitize_file_name($_GET['download_export_file']);
         static::downloadExportFile($filename);
     }
     // Delete
     if (isset($_POST['delete_export_file']) && isset($_POST['filename']) && check_admin_referer('pb-delete-export')) {
         $filename = sanitize_file_name($_POST['filename']);
         $path = static::getExportFolder();
         unlink($path . $filename);
         delete_transient('dirsize_cache');
         /** @see get_dirsize() */
         \PressBooks\Redirect\location(get_bloginfo('url') . '/wp-admin/admin.php?page=pb_export');
     }
     // Export
     if ('yes' == @$_GET['export'] && is_array(@$_POST['export_formats']) && check_admin_referer('pb-export')) {
         // --------------------------------------------------------------------------------------------------------
         // Define modules
         $x = $_POST['export_formats'];
         $modules = array();
         if (isset($x['pdf'])) {
             $modules[] = '\\PressBooks\\Export\\Prince\\Pdf';
         }
         if (isset($x['mpdf'])) {
             $modules[] = '\\PressBooks\\Export\\Mpdf\\Pdf';
         }
         if (isset($x['epub'])) {
             $modules[] = '\\PressBooks\\Export\\Epub\\Epub201';
             // Must be set before MOBI
         }
         if (isset($x['epub3'])) {
             $modules[] = '\\PressBooks\\Export\\Epub3\\Epub3';
             // Must be set before MOBI
         }
         if (isset($x['mobi'])) {
             if (!isset($x['epub'])) {
                 // Make sure Epub source file is generated
                 $modules[] = '\\PressBooks\\Export\\Epub\\Epub201';
                 // Must be set before MOBI
             }
             $modules[] = '\\PressBooks\\Export\\Mobi\\Kindlegen';
             // Must be set after EPUB
         }
         if (isset($x['icml'])) {
             $modules[] = '\\PressBooks\\Export\\InDesign\\Icml';
         }
         if (isset($x['xhtml'])) {
             $modules[] = '\\PressBooks\\Export\\Xhtml\\Xhtml11';
         }
         if (isset($x['wxr'])) {
             $modules[] = '\\PressBooks\\Export\\WordPress\\Wxr';
         }
         if (isset($x['vanillawxr'])) {
             $modules[] = '\\PressBooks\\Export\\WordPress\\VanillaWxr';
         }
         if (isset($x['odt'])) {
             $modules[] = '\\PressBooks\\Export\\Odt\\Odt';
         }
         // --------------------------------------------------------------------------------------------------------
         // Clear cache? Range is 1 hour.
         $last_export = get_option('pressbooks_last_export');
         $within_range = time() - $last_export;
         if ($within_range > 60 * 60) {
             \PressBooks\Book::deleteBookObjectCache();
             update_option('pressbooks_last_export', time());
         }
         // --------------------------------------------------------------------------------------------------------
         // Do Export
         @set_time_limit(300);
         $redirect_url = get_bloginfo('url') . '/wp-admin/admin.php?page=pb_export';
         $conversion_error = array();
         $validation_warning = array();
         $outputs = array();
         foreach ($modules as $module) {
             /** @var \PressBooks\Export\Export $exporter */
             $exporter = new $module(array());
             if (!$exporter->convert()) {
                 $conversion_error[$module] = $exporter->getOutputPath();
             } else {
                 if (!$exporter->validate()) {
                     $validation_warning[$module] = $exporter->getOutputPath();
                 }
             }
             // Add to outputs array
             $outputs[$module] = $exporter->getOutputPath();
             // Stats hook
//.........这里部分代码省略.........
开发者ID:samsruti,项目名称:pressbooks,代码行数:101,代码来源:class-pb-export.php


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