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


PHP WP_Post::to_array方法代码示例

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


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

示例1: resolveWordPressPostToModel

 public static function resolveWordPressPostToModel(\WP_Post $post)
 {
     /** @var PostTypeManager $postTypes */
     $postTypes = app('posts.types');
     if ($class = $postTypes->get($post->post_type)) {
         return with(new $class())->newInstance($post->to_array());
     }
     return false;
 }
开发者ID:lara-press,项目名称:framework,代码行数:9,代码来源:Post.php

示例2: normalize

 /**
  * {@inheritdoc}
  */
 public function normalize($blogId, \WP_Post $post)
 {
     $out = $post->to_array();
     unset($out['post_category'], $out['tags_input']);
     $out['terms'] = $this->buildTerms($post);
     if (!empty($post->post_author)) {
         $out['post_author'] = $this->buildAuthor($post);
     }
     return $out;
 }
开发者ID:WPMagnify,项目名称:core,代码行数:13,代码来源:DefaultNormalizer.php

示例3: _handleDataAndSettingsPage

 private function _handleDataAndSettingsPage()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce(filter_input(INPUT_GET, 'nonce'))) {
         if ($this->_chart->post_status == 'auto-draft') {
             $this->_chart->post_status = 'publish';
             wp_update_post($this->_chart->to_array());
         }
         update_post_meta($this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST);
         $render = new Visualizer_Render_Page_Send();
         $render->text = sprintf('[visualizer id="%d"]', $this->_chart->ID);
         wp_iframe(array($render, 'render'));
         return;
     }
     $data = $this->_getChartArray();
     $sidebar = '';
     $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst($data['type']);
     if (class_exists($sidebar_class, true)) {
         $sidebar = new $sidebar_class($data['settings']);
         $sidebar->__series = $data['series'];
         $sidebar->__data = $data['data'];
     } else {
         $sidebar = apply_filters("visualizer_pro_chart_type_sidebar", '', $data);
         if ($sidebar != '') {
             $sidebar->__series = $data['series'];
             $sidebar->__data = $data['data'];
         }
     }
     unset($data['settings']['width'], $data['settings']['height']);
     wp_enqueue_style('visualizer-frame');
     wp_enqueue_style('wp-color-picker');
     wp_enqueue_style('visualizer-frame');
     wp_enqueue_script('visualizer-preview');
     wp_enqueue_script('visualizer-render');
     wp_localize_script('visualizer-render', 'visualizer', array('l10n' => array('remotecsv_prompt' => esc_html__('Please, enter the URL of CSV file:', Visualizer_Plugin::NAME), 'invalid_source' => esc_html__('You have entered invalid URL. Please, insert proper URL.', Visualizer_Plugin::NAME)), 'charts' => array('canvas' => $data)));
     $render = new Visualizer_Render_Page_Data();
     $render->chart = $this->_chart;
     $render->type = $data['type'];
     $render->sidebar = $sidebar;
     if (filter_input(INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN)) {
         $render->button = filter_input(INPUT_GET, 'action') == Visualizer_Plugin::ACTION_EDIT_CHART ? esc_html__('Save Chart', Visualizer_Plugin::NAME) : esc_html__('Create Chart', Visualizer_Plugin::NAME);
     } else {
         $render->button = esc_attr__('Insert Chart', Visualizer_Plugin::NAME);
     }
     if (defined('Visualizer_Pro')) {
         global $Visualizer_Pro;
         $Visualizer_Pro->_enqueueScriptsAndStyles($data);
     }
     $this->_addAction('admin_head', 'renderFlattrScript');
     wp_iframe(array($render, 'render'));
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:50,代码来源:Chart.php

示例4: _handleSettingsPage

 /**
  * Handles chart settigns page.
  *
  * @since 1.0.0
  *
  * @access private
  */
 private function _handleSettingsPage()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST' && wp_verify_nonce(filter_input(INPUT_GET, 'nonce'))) {
         if ($this->_chart->post_status == 'auto-draft') {
             $this->_chart->post_status = 'publish';
             wp_update_post($this->_chart->to_array());
         }
         update_post_meta($this->_chart->ID, Visualizer_Plugin::CF_SETTINGS, $_POST);
         $render = new Visualizer_Render_Page_Send();
         $render->text = sprintf('[visualizer id="%d"]', $this->_chart->ID);
         wp_iframe(array($render, 'render'));
         return;
     }
     $data = $this->_getChartArray();
     $sidebar = '';
     $sidebar_class = 'Visualizer_Render_Sidebar_Type_' . ucfirst($data['type']);
     if (class_exists($sidebar_class, true)) {
         $sidebar = new $sidebar_class($data['settings']);
         $sidebar->__series = $data['series'];
         $sidebar->__data = $data['data'];
     }
     unset($data['settings']['width'], $data['settings']['height']);
     wp_enqueue_style('wp-color-picker');
     wp_enqueue_style('visualizer-frame');
     wp_enqueue_script('visualizer-preview');
     wp_localize_script('visualizer-render', 'visualizer', array('charts' => array('canvas' => $data)));
     $render = new Visualizer_Render_Page_Settings();
     $render->sidebar = $sidebar;
     if (filter_input(INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN)) {
         $render->button = filter_input(INPUT_GET, 'action') == Visualizer_Plugin::ACTION_EDIT_CHART ? esc_html__('Save Chart', Visualizer_Plugin::NAME) : esc_html__('Create Chart', Visualizer_Plugin::NAME);
     } else {
         $render->button = esc_attr__('Insert Chart', Visualizer_Plugin::NAME);
     }
     $this->_addAction('admin_head', 'renderFlattrScript');
     wp_iframe(array($render, 'render'));
 }
开发者ID:CrankMaster336,项目名称:FFW-TR,代码行数:43,代码来源:Chart.php

示例5: save

 public function save()
 {
     wp_insert_post($this->post->to_array());
 }
开发者ID:GlobalTechnology,项目名称:wordpress-ekko-plugin,代码行数:4,代码来源:post.php

示例6: savePost

 /**
  * Insert or update the post.
  *
  * @param   \WP_Post  $post
  * @return  int
  */
 protected final function savePost(\WP_Post $post)
 {
     return wp_insert_post($post->to_array());
 }
开发者ID:asmbs,项目名称:wp-schedule-builder,代码行数:10,代码来源:AbstractPostWriter.php


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