本文整理汇总了PHP中FLBuilder::render_editor_content方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilder::render_editor_content方法的具体用法?PHP FLBuilder::render_editor_content怎么用?PHP FLBuilder::render_editor_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilder
的用法示例。
在下文中一共展示了FLBuilder::render_editor_content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_layout
/**
* Saves layout data when a user chooses to publish.
*
* @since 1.0
* @param bool $publish Whether to publish the parent post or not.
* @return void
*/
public static function save_layout($publish = true)
{
$editor_content = FLBuilder::render_editor_content();
$post_id = self::get_post_id();
$data = self::get_layout_data('draft', $post_id);
$settings = self::get_layout_settings('draft', $post_id);
// Fire the before action.
do_action('fl_builder_before_save_layout', $post_id, $publish, $data, $settings);
// Delete the old published layout.
self::delete_layout_data('published', $post_id);
self::delete_layout_settings('published', $post_id);
// Save the new published layout.
self::update_layout_data($data, 'published', $post_id);
self::update_layout_settings($settings, 'published', $post_id);
// Clear the asset cache.
self::delete_all_asset_cache($post_id);
self::delete_node_template_asset_cache($post_id);
// Enable the builder to take over the post content.
self::enable();
// Get the post status.
$post_status = get_post_status($post_id);
// Publish the post?
if ($publish) {
$is_draft = strstr($post_status, 'draft');
$is_pending = strstr($post_status, 'pending');
if (current_user_can('publish_posts')) {
$post_status = $is_draft || $is_pending ? 'publish' : $post_status;
} else {
if ($is_draft) {
$post_status = 'pending';
}
}
}
// Update the post with stripped down content.
wp_update_post(array('ID' => self::get_post_id(), 'post_status' => $post_status, 'post_content' => $editor_content));
// Fire the after action.
do_action('fl_builder_after_save_layout', $post_id, $publish, $data, $settings);
}
示例2: save_layout
/**
* Saves layout data when a user chooses to publish.
*
* @since 1.0
* @param bool $publish Whether to publish the parent post or not.
* @return void
*/
public static function save_layout($publish = true)
{
$editor_content = FLBuilder::render_editor_content();
$post_id = self::get_post_id();
$data = self::get_layout_data('draft', $post_id);
// Delete the old published layout.
self::delete_layout_data('published', $post_id);
// Save the new published layout.
self::update_layout_data($data, 'published', $post_id);
// Clear the asset cache.
self::delete_all_asset_cache($post_id);
self::delete_node_template_asset_cache($post_id);
// Enable the builder to take over the post content.
self::enable();
// Get the post status.
$post_status = get_post_status($post_id);
// Publish the post?
if ($publish) {
$post_status = strstr($post_status, 'draft') ? 'publish' : $post_status;
}
// Update the post with stripped down content.
wp_update_post(array('ID' => self::get_post_id(), 'post_status' => $post_status, 'post_content' => $editor_content));
}