OSDN Git Service

WordPressテンプレート機能更新。
authornaoki hirata <naoki@magic3.org>
Fri, 30 Jun 2017 01:28:36 +0000 (10:28 +0900)
committernaoki hirata <naoki@magic3.org>
Fri, 30 Jun 2017 01:28:36 +0000 (10:28 +0900)
include/addons/bloglib/blogLib.php
include/addons/bloglib/blogLibDb.php
include/wp/contentApi.php
include/wp/wp-includes/taxonomy.php

index 8b85fd9..36a64f0 100644 (file)
@@ -221,15 +221,39 @@ class blogLib extends Addon
         * @param string        $langId                         言語
         * @param int           $order                          取得順(0=昇順,1=降順)
         * @param function      $callback                       コールバック関数
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
         * @param string        $blogId                         ブログID(nullのとき指定なし)
         * @return                      なし
         */
-       function getPublicContentList($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $callback, $blogId = null)
+       function getPublicContentList($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $callback, $categoryId = null, $blogId = null)
        {
                global $gEnvManager;
                
                $userId = $gEnvManager->getCurrentUserId();
-               $this->db->getPublicEntryItems($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $callback, $blogId);
+               $this->db->getPublicEntryItems($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $callback, $categoryId, $blogId);
+       }
+       /**
+        * 公開中のエントリーの前後のエントリー項目を取得
+        *
+        * @param int       $type                               前後記事のタイプ(0=前方,1=後方)
+        * @param timestamp $regDate                    基準となる記事の登録日時
+        * @param timestamp $now                                現在日時(現在日時より未来の投稿日時の記事は取得しない)
+        * @param timestamp     $startDt                        期間(開始日)
+        * @param timestamp     $endDt                          期間(終了日)
+        * @param array         $keywords                       検索キーワード
+        * @param string        $langId                         言語
+        * @param int           $order                          取得順(0=昇順,1=降順)
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
+        * @param string        $blogId                         ブログID(nullのとき指定なし)
+        * @return array                                                記事のレコード。取得なしの場合はfalseを返す。
+        */
+       function getPublicPrevNextEntry($type, $regDate, $now, $startDt, $endDt, $keywords, $langId, $order, $categoryId = null, $blogId = null)
+       {
+               global $gEnvManager;
+               
+               $userId = $gEnvManager->getCurrentUserId();
+               $row = $this->db->getPublicPrevNextEntry($type, $regDate, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $categoryId, $blogId);
+               return $row;
        }
 }
 ?>
index 2ae37e7..c949cdb 100644 (file)
@@ -293,10 +293,11 @@ class blogLibDb extends BaseDb
         * @param int           $order                          取得順(0=昇順,1=降順)
         * @param int       $userId                             参照制限用ユーザID
         * @param function      $callback                       コールバック関数
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
         * @param string        $blogId                         ブログID(nullのとき指定なし)
         * @return                      なし
         */
-       function getPublicEntryItems($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $callback, $blogId = null)
+       function getPublicEntryItems($limit, $page, $entryId, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $callback, $categoryId = null, $blogId = null)
        {
                $offset = $limit * ($page -1);
                if ($offset < 0) $offset = 0;
@@ -319,60 +320,9 @@ class blogLibDb extends BaseDb
                }
                
                // ##### 任意設定の検索条件 #####
-               // タイトルと記事、ユーザ定義フィールドを検索
-               if (!empty($keywords)){
-                       for ($i = 0; $i < count($keywords); $i++){
-                               $keyword = addslashes($keywords[$i]);// 「'"\」文字をエスケープ
-                               $queryStr .=    'AND (be_name LIKE \'%' . $keyword . '%\' ';
-                               $queryStr .=    'OR be_html LIKE \'%' . $keyword . '%\' ';
-                               $queryStr .=    'OR be_html_ext LIKE \'%' . $keyword . '%\' ';
-                               $queryStr .=    'OR be_description LIKE \'%' . $keyword . '%\' ';
-                               $queryStr .=    'OR be_option_fields LIKE \'%' . $keyword . '%\') ';    // ユーザ定義フィールド
-                       }
-               }
-       
-               // 期間で指定
-               if (!empty($startDt)){
-                       $queryStr .=    'AND ? <= be_regist_dt ';
-                       $params[] = $startDt;
-               }
-               if (!empty($endDt)){
-                       $queryStr .=    'AND be_regist_dt < ? ';
-                       $params[] = $endDt;
-               }
-               
-               // ブログID
-               if (isset($blogId)){
-                       $queryStr .=    'AND be_blog_id = ? ';          $params[] = $blogId;
-               }
-       
-               // ##### ユーザによる参照制限 #####
-               // ゲストユーザはユーザ制限のない記事のみ参照可能
-               if (empty($userId)){
-                       $queryStr .= 'AND be_user_limited = false ';            // ユーザ制限のないデータ
-               }
-               // ブログごとの参照制限
-               $queryStr .=     'AND (be_blog_id = \'\' ';
-               $queryStr .=     'OR (be_blog_id != \'\' ';
-               $queryStr .=     'AND ((bl_owner_id = ? AND bl_owner_id != 0) ';        $params[] = $userId;
-               $queryStr .=     'OR bl_user_limited = false ';
-               $queryStr .=     'OR (bl_user_limited = true AND bl_limited_user_id = \'\' AND 0 != ' . $userId . ') ';
-               $queryStr .=     'OR (bl_user_limited = true AND bl_limited_user_id != \'\' AND bl_limited_user_id LIKE \'%' . M3_USER_ID_SEPARATOR . $userId . M3_USER_ID_SEPARATOR . '%\')))) ';
-               
-               // ##### コンテンツの参照制限 #####
-               // アクティブな記事のみ取得
-               $queryStr .=     'AND be_status = ? ';          $params[] = 2;  // 「公開」(2)データを表示
-               $queryStr .=     'AND be_regist_dt <= ? ';      $params[] = $now;               // 投稿日時が現在日時よりも過去のものを取得
-       
-               // 公開期間を指定
-               $queryStr .=    'AND (be_active_start_dt = ? OR (be_active_start_dt != ? AND be_active_start_dt <= ?)) ';
-               $queryStr .=    'AND (be_active_end_dt = ? OR (be_active_end_dt != ? AND be_active_end_dt > ?)) ';
-               $params[] = $initDt;
-               $params[] = $initDt;
-               $params[] = $now;
-               $params[] = $initDt;
-               $params[] = $initDt;
-               $params[] = $now;
+               list($condQueryStr, $condParams) = $this->_createPublicSearchCondition($now, $startDt, $endDt, $keywords, $userId, $categoryId, $blogId);
+               $queryStr .= $condQueryStr;
+               $params = array_merge($params, $condParams);
 
                if (empty($entryId)){
                        $ord = '';
@@ -390,10 +340,11 @@ class blogLibDb extends BaseDb
         * @param array         $keywords                       検索キーワード
         * @param string        $langId                         言語
         * @param int       $userId                             参照制限用ユーザID
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
         * @param string        $blogId                         ブログID(nullのとき指定なし)
         * @return int                                                  項目数
         */
-       function getPublicEntryItemsCount($now, $startDt, $endDt, $keywords, $langId, $userId, $blogId = null)
+       function getPublicEntryItemsCount($now, $startDt, $endDt, $keywords, $langId, $userId, $categoryId = null, $blogId = null)
        {
                $initDt = $this->gEnv->getInitValueOfTimestamp();               // 日時初期化値
                $params = array();
@@ -403,6 +354,42 @@ class blogLibDb extends BaseDb
                $queryStr .=    'AND be_history_index >= 0 ';           // 正規(Regular)記事を対象
                $queryStr .=    'AND be_language_id = ? ';      $params[] = $langId;
                
+               // ##### 任意設定の検索条件 #####
+               list($condQueryStr, $condParams) = $this->_createPublicSearchCondition($now, $startDt, $endDt, $keywords, $userId, $categoryId, $blogId);
+               $queryStr .= $condQueryStr;
+               $params = array_merge($params, $condParams);
+
+               return $this->selectRecordCount($queryStr, $params);
+       }
+       /**
+        * 公開中のエントリー項目の検索条件を作成
+        *
+        * @param timestamp $now                                現在日時
+        * @param timestamp     $startDt                        期間(開始日)
+        * @param timestamp     $endDt                          期間(終了日)
+        * @param array         $keywords                       検索キーワード
+        * @param int       $userId                             ユーザID
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
+        * @param string        $blogId                         ブログID(nullのとき指定なし)
+        * @return array                                                クエリー文字列と配列パラメータの連想配列
+        */
+       function _createPublicSearchCondition($now, $startDt, $endDt, $keywords, $userId, $categoryId = null, $blogId = null)
+       {
+               $initDt = $this->gEnv->getInitValueOfTimestamp();               // 日時初期化値
+               $queryStr = '';
+               $params = array();
+       
+               // ##### 検索条件 #####
+               // 取得期間
+               if (!empty($startDt)){
+                       $queryStr .=    'AND ? <= be_regist_dt ';
+                       $params[] = $startDt;
+               }
+               if (!empty($endDt)){
+                       $queryStr .=    'AND be_regist_dt < ? ';
+                       $params[] = $endDt;
+               }
+               
                // タイトルと記事、ユーザ定義フィールドを検索
                if (!empty($keywords)){
                        for ($i = 0; $i < count($keywords); $i++){
@@ -414,18 +401,40 @@ class blogLibDb extends BaseDb
                                $queryStr .=    'OR be_option_fields LIKE \'%' . $keyword . '%\') ';    // ユーザ定義フィールド
                        }
                }
-                       
+               
                // ブログID
                if (isset($blogId)){
-                       $queryStr .=    'AND be_blog_id = ? ';          $params[] = $blogId;
+                       $queryStr .=    'AND be_blog_id = ? ';
+                       $params[] = $blogId;
                }
                
+               // カテゴリー
+               if (isset($categoryId)){
+                       $queryStr .=     'AND bw_category_id = ? ';
+                       $params[] = $categoryId;// 記事カテゴリー
+               }
+
+               // ##### コンテンツ参照制限 #####
+               // 公開状態
+               $queryStr .=     'AND be_status = ? ';          $params[] = 2;  // 「公開」(2)データを表示
+               $queryStr .=     'AND be_regist_dt <= ? ';      $params[] = $now;               // 投稿日時が現在日時よりも過去のものを取得
+       
+               // 公開期間
+               $queryStr .=    'AND (be_active_start_dt = ? OR (be_active_start_dt != ? AND be_active_start_dt <= ?)) ';
+               $queryStr .=    'AND (be_active_end_dt = ? OR (be_active_end_dt != ? AND be_active_end_dt > ?)) ';
+               $params[] = $initDt;
+               $params[] = $initDt;
+               $params[] = $now;
+               $params[] = $initDt;
+               $params[] = $initDt;
+               $params[] = $now;
+               
                // ##### ユーザ参照制限 #####
                // ゲストユーザはユーザ制限のない記事のみ参照可能
                if (empty($userId)){
                        $queryStr .= 'AND be_user_limited = false ';            // ユーザ制限のないデータ
                }
-               // ブログごとの参照制限
+               // ブログごとのユーザ参照制限
                $queryStr .=     'AND (be_blog_id = \'\' ';
                $queryStr .=     'OR (be_blog_id != \'\' ';
                $queryStr .=     'AND ((bl_owner_id = ? AND bl_owner_id != 0) ';        $params[] = $userId;
@@ -433,31 +442,77 @@ class blogLibDb extends BaseDb
                $queryStr .=     'OR (bl_user_limited = true AND bl_limited_user_id = \'\' AND 0 != ' . $userId . ') ';
                $queryStr .=     'OR (bl_user_limited = true AND bl_limited_user_id != \'\' AND bl_limited_user_id LIKE \'%' . M3_USER_ID_SEPARATOR . $userId . M3_USER_ID_SEPARATOR . '%\')))) ';
                
-               // 検索条件
-               if (!empty($startDt)){
-                       $queryStr .=    'AND ? <= be_regist_dt ';
-                       $params[] = $startDt;
-               }
-               if (!empty($endDt)){
-                       $queryStr .=    'AND be_regist_dt < ? ';
-                       $params[] = $endDt;
-               }
+               return array($queryStr, $params);
+       }
+       /**
+        * 公開中のエントリーの前後のエントリー項目を取得
+        *
+        * @param int       $type                               前後記事のタイプ(0=前方,1=後方)
+        * @param timestamp $regDate                    基準となる記事の登録日時
+        * @param timestamp $now                                現在日時(現在日時より未来の投稿日時の記事は取得しない)
+        * @param timestamp     $startDt                        期間(開始日)
+        * @param timestamp     $endDt                          期間(終了日)
+        * @param array         $keywords                       検索キーワード
+        * @param string        $langId                         言語
+        * @param int           $order                          取得順(0=昇順,1=降順)
+        * @param int       $userId                             参照制限用ユーザID
+        * @param int           $categoryId                     カテゴリーID(nullのとき指定なし)
+        * @param string        $blogId                         ブログID(nullのとき指定なし)
+        * @return array                                                記事のレコード。取得なしの場合はfalseを返す。
+        */
+       function getPublicPrevNextEntry($type, $regDate, $now, $startDt, $endDt, $keywords, $langId, $order, $userId, $categoryId = null, $blogId = null)
+       {
+               $retStatus = false;
+                                       
+               if ($regDate == $this->gEnv->getInitValueOfTimestamp()){
+                       return false;
+               } else {
+                       $isPrev = true;         // 前方データを取得するかどうか
+                       $params = array();
+                       $queryStr  = 'SELECT distinct(be_serial) FROM blog_entry LEFT JOIN blog_id ON be_blog_id = bl_id AND bl_deleted = false ';
+                       $queryStr .=   'RIGHT JOIN blog_entry_with_category ON be_serial = bw_entry_serial ';
+                       $queryStr .=   'WHERE be_deleted = false ';     // 削除されていない
+                       $queryStr .=     'AND be_history_index >= 0 ';          // 正規(Regular)記事を対象
+                       $queryStr .=     'AND be_language_id = ? ';     $params[] = $langId;
+                       
+                       // ソート順を決める
+                       if ($type == 1) $isPrev = false;
+                       if ($order == 1) $isPrev = !$isPrev;
+                       
+                       if ($isPrev){                   // 前の記事を取得する場合
+                               $queryStr .=     'AND be_regist_dt < ? '; $params[] = $regDate;         // ***** 登録日時で前後を取得 *****
+                       } else {
+                               $queryStr .=     'AND ? < be_regist_dt '; $params[] = $regDate;         // ***** 登録日時で前後を取得 *****
+                       }
                
-               // ##### アクティブな記事のみ取得 #####
-               $queryStr .=    'AND be_status = ? ';           $params[] = 2;  // 「公開」(2)データを表示
-               $queryStr .=    'AND be_regist_dt <= ? ';       $params[] = $now;               // 投稿日時が現在日時よりも過去のものを取得
+                       // 検索条件を付加
+                       list($condQueryStr, $condParams) = $this->_createPublicSearchCondition($now, $startDt, $endDt, $keywords, $userId, $categoryId, $blogId);
+                       $queryStr .= $condQueryStr;
+                       $params = array_merge($params, $condParams);
+               
+                       // シリアル番号を取得
+                       $serialArray = array();
+                       $ret = $this->selectRecords($queryStr, $params, $serialRows);
+                       if ($ret){
+                               for ($i = 0; $i < count($serialRows); $i++){
+                                       $serialArray[] = $serialRows[$i]['be_serial'];
+                               }
+                       }
+                       $serialStr = implode(',', $serialArray);
+                       if (empty($serialStr)) $serialStr = '0';        // 0レコードのときはダミー値を設定
        
-               // 公開期間を指定
-               $queryStr .=    'AND (be_active_start_dt = ? OR (be_active_start_dt != ? AND be_active_start_dt <= ?)) ';
-               $queryStr .=    'AND (be_active_end_dt = ? OR (be_active_end_dt != ? AND be_active_end_dt > ?)) ';
-               $params[] = $initDt;
-               $params[] = $initDt;
-               $params[] = $now;
-               $params[] = $initDt;
-               $params[] = $initDt;
-               $params[] = $now;
-
-               return $this->selectRecordCount($queryStr, $params);
+                       $queryStr  = 'SELECT * FROM blog_entry LEFT JOIN blog_id ON be_blog_id = bl_id AND bl_deleted = false ';
+                       $queryStr .=   'LEFT JOIN _login_user ON be_regist_user_id = lu_id AND lu_deleted = false ';
+                       $queryStr .=   'WHERE be_serial in (' . $serialStr . ') ';
+               
+                       $ord = '';
+                       if ($isPrev) $ord = 'DESC ';
+                       $queryStr .=   'ORDER BY be_regist_dt ' . $ord . 'LIMIT 1';// 投稿順
+                       $ret = $this->selectRecord($queryStr, $params, $row);
+                       if ($ret) $retStatus = $row;
+               }
+               return $retStatus;
        }
+
 }
 ?>
index 4d0ccd3..2222ada 100644 (file)
@@ -24,8 +24,10 @@ class ContentApi extends BaseApi
        private $langId;                                // コンテンツの言語(コンテンツ取得用)
        private $limit;                                 // コンテンツ取得数(コンテンツ取得用)
        private $pageNo;                                // ページ番号(1~)(コンテンツ取得用)
+       private $order;                                 // コンテンツ並び順(0=昇順,1=降順)
        private $contentArray;                  // 取得コンテンツ
        private $contentId;                             // 表示するコンテンツのID(複数の場合は配列)
+       private $prevNextBaseValue;             // 前後のコンテンツ取得用のベース値
        
        const CF_DEFAULT_CONTENT_TYPE = 'default_content_type';         // デフォルトコンテンツタイプ取得用
        const DEFAULT_CONTENT_TYPE = 'blog';            // デフォルトコンテンツタイプのデフォルト値
@@ -129,8 +131,9 @@ class ContentApi extends BaseApi
                // 初期値設定
                $this->langId = $gEnvManager->getCurrentLanguage();                             // コンテンツの言語(コンテンツ取得用)
                $this->limit = $viewCount;                                      // コンテンツ取得数(コンテンツ取得用)
-               $this->pageNo = 1;                              // ページ番号(コンテンツ取得用)
-               $this->now = date("Y/m/d H:i:s");       // 現在日時
+               $this->pageNo = 1;                                                      // ページ番号(コンテンツ取得用)
+               $this->order = 1;                                                       // コンテンツ並び順。デフォルトは降順。
+               $this->now = date("Y/m/d H:i:s");                       // 現在日時
                
                // パラメータ値で更新
                if (!empty($langId)) $this->langId = $langId;                           // コンテンツの言語(コンテンツ取得用)
@@ -156,33 +159,46 @@ class ContentApi extends BaseApi
                $addonObj = $this->_getAddonObj();
                
                // データ取得
-               $addonObj->getPublicContentList($this->limit, $this->pageNo, $entryId, $this->now, $startDt, $endDt, $keywords, $this->langId, $order, array($this, '_itemListLoop'), null/*ブログID*/);
+               $addonObj->getPublicContentList($this->limit, $this->pageNo, $entryId, $this->now, $startDt, $endDt, $keywords, $this->langId, $this->order, array($this, '_itemListLoop'),  null/*カテゴリーID*/, null/*ブログID*/);
                
                return $this->contentArray;
        }
        /**
-        * [WordPressã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ç\94¨API]ç·\8fã\82³ã\83³ã\83\86ã\83³ã\83\84æ\95°を取得
+        * [WordPressã\83\86ã\83³ã\83\97ã\83¬ã\83¼ã\83\88ç\94¨API]ç\8f¾å\9c¨å\8f\96å¾\97中ã\81®ã\82³ã\83³ã\83\86ã\83³ã\83\84å\9fºæº\96ã\81§å\89\8dã\81®ã\82³ã\83³ã\83\86ã\83³ã\83\84を取得
         *
-        * @return int                                          コンテンツ数
+        * @return object                               WP_Postオブジェクト
         */
-/*     function getContentCount()
+       function getPrevContent()
        {
+               // 戻り値初期化
+               $wpPostObj = false;
+               
+               // アドオンオブジェクト取得
                $addonObj = $this->_getAddonObj();
-               $idArray = $addonObj->getPublicContentCount($this->langId, $this->limit, $this->pageNo);
-               return $idArray;
-       }*/
+               
+               $row = $addonObj->getPublicPrevNextEntry(0/*前方データ*/, $this->prevNextBaseValue, $this->now, $startDt, $endDt, $keywords, $this->langId, $this->order, null/*カテゴリーID*/, null/*ブログID*/);
+               if ($row) $wpPostObj = $this->_createWP_Post($row);
+
+               return $wpPostObj;
+       }
        /**
-        * [WordPressテンプレート用API]コンテンツ取得
+        * [WordPressテンプレート用API]現在取得中のコンテンツ基準で次のコンテンツを取得
         *
-        * @param array     $ids                                コンテンツID
-        * @return array                                                コンテンツデータ
+        * @return object                               WP_Postオブジェクト
         */
-/*     function selectContent($ids)
+       function getNextContent()
        {
+               // 戻り値初期化
+               $wpPostObj = false;
+               
+               // アドオンオブジェクト取得
                $addonObj = $this->_getAddonObj();
-               $retValue = $addonObj->getList($langId, $limit, $pageNo, $rows);
-               return $retValue;
-       }*/
+               
+               $row = $addonObj->getPublicPrevNextEntry(1/*後方データ*/, $this->prevNextBaseValue, $this->now, $startDt, $endDt, $keywords, $this->langId, $this->order, null/*カテゴリーID*/, null/*ブログID*/);
+               if ($row) $wpPostObj = $this->_createWP_Post($row);
+
+               return $wpPostObj;
+       }
        /**
         * 取得したデータをテンプレートに設定する
         *
@@ -193,30 +209,51 @@ class ContentApi extends BaseApi
         */
        function _itemListLoop($index, $fetchedRow, $param)
        {
-               // レコード値取得
+               $wpPostObj = $this->_createWP_Post($fetchedRow);
+               $this->contentArray[] = $wpPostObj;
+               
+               // 前後のコンテンツ取得用のベース値を保存。単一コンテンツ表示の場合に使用。
+               switch ($this->contentType){
+               case M3_VIEW_TYPE_CONTENT:              // 汎用コンテンツ
+                       $this->prevNextBaseValue = $wpPostObj->ID;              // 前後のコンテンツ取得用のベース値(ID)
+                       break;
+               case M3_VIEW_TYPE_BLOG: // ブログ
+                       $this->prevNextBaseValue = $wpPostObj->post_date;               // 前後のコンテンツ取得用のベース値(登録日時)
+                       break;
+               }
+               return true;
+       }
+       /**
+        * テーブル行データからWP_Postオブジェクトを作成
+        *
+        * @param array $row                    テーブル行データ
+        * @return object                               WP_Postオブジェクト
+        */
+       function _createWP_Post($row)
+       {
                // IDを解析しエラーチェック。複数の場合は配列に格納する。
                switch ($this->contentType){
                case M3_VIEW_TYPE_CONTENT:              // 汎用コンテンツ
-                       $serial = $fetchedRow['cn_serial'];
-                       $id             = $fetchedRow['cn_id'];
-                       $title  = $fetchedRow['cn_name'];
-                       $authorId               = $fetchedRow['cn_create_user_id'];             // コンテンツ登録者
-                       $authorName             = $fetchedRow['lu_name'];                               // コンテンツ登録者名
+                       $serial = $row['cn_serial'];
+                       $id             = $row['cn_id'];
+                       $title  = $row['cn_name'];
+                       $authorId               = $row['cn_create_user_id'];            // コンテンツ登録者
+                       $authorName             = $row['lu_name'];                              // コンテンツ登録者名
                        $authorUrl              = '';                   // コンテンツ登録者URL
-                       $date                   = $fetchedRow['cn_create_dt'];
-                       $contentHtml    = $fetchedRow['cn_html'];
-                       $thumbSrc               = $fetchedRow['cn_thumb_src'];  // サムネールの元のファイル(リソースディレクトリからの相対パス)
+                       $date                   = $row['cn_create_dt'];
+                       $contentHtml    = $row['cn_html'];
+                       $thumbSrc               = $row['cn_thumb_src']; // サムネールの元のファイル(リソースディレクトリからの相対パス)
                        break;
                case M3_VIEW_TYPE_BLOG: // ブログ
-                       $serial = $fetchedRow['be_serial'];
-                       $id             = $fetchedRow['be_id'];
-                       $title  = $fetchedRow['be_name'];
-                       $authorId               = $fetchedRow['be_regist_user_id'];             // コンテンツ登録者
-                       $authorName             = $fetchedRow['lu_name'];                               // コンテンツ登録者名
+                       $serial = $row['be_serial'];
+                       $id             = $row['be_id'];
+                       $title  = $row['be_name'];
+                       $authorId               = $row['be_regist_user_id'];            // コンテンツ登録者
+                       $authorName             = $row['lu_name'];                              // コンテンツ登録者名
                        $authorUrl              = '';                   // コンテンツ登録者URL
-                       $date                   = $fetchedRow['be_regist_dt'];
-                       $contentHtml    = $fetchedRow['be_html'];
-                       $thumbSrc               = $fetchedRow['be_thumb_src'];  // サムネールの元のファイル(リソースディレクトリからの相対パス)
+                       $date                   = $row['be_regist_dt'];
+                       $contentHtml    = $row['be_html'];
+                       $thumbSrc               = $row['be_thumb_src']; // サムネールの元のファイル(リソースディレクトリからの相対パス)
                        break;
                }
 
@@ -254,8 +291,7 @@ class ContentApi extends BaseApi
                $post->authorUrl = $authorUrl;                          // コンテンツ登録者URL
                
                $wpPostObj = new WP_Post($post);
-               $this->contentArray[] = $wpPostObj;
-               return true;
+               return $wpPostObj;
        }
        /**
         * Magic3マクロを変換してHTMLを作成
index bd99024..d4c2f60 100644 (file)
@@ -253,9 +253,10 @@ function get_taxonomy( $taxonomy ) {
  * @return bool Whether the taxonomy exists.
  */
 function taxonomy_exists( $taxonomy ) {
-       global $wp_taxonomies;
+//     global $wp_taxonomies;
 
-       return isset( $wp_taxonomies[$taxonomy] );
+//     return isset( $wp_taxonomies[$taxonomy] );
+       return true;
 }
 
 /**