Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eznewsimporter.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: eznewsimporter.php 8080 2001-10-29 16:49:39Z bf $
5 //
6 // Definition of eZNewsImporter class
7 //
8 // Created on: <13-Nov-2000 16:56:48 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
41 // include_once( "classes/ezdb.php" );
42 // include_once( "classes/ezdatetime.php" );
43 // include_once( "ezuser/classes/ezuser.php" );
44
45 class eZNewsImporter
46 {
51 function __construct( $decoder, $site, $category, $login="", $password="", $autoPublish=false )
52 {
53 $this->Site = $site;
54 $this->Decoder = $decoder;
55 $this->Login = $login;
56 $this->Password = $password;
57 $this->AutoPublish = $autoPublish;
58
59 if ( is_a( $category, "eZNewsCategory" ) )
60 {
61 $this->CategoryID = $category->id();
62 }
63 }
64
65 /*
66 \static
67 This funcion returns an array of strings with the avaliable decoders.
68 NOTE: When you create a new decoder you must add it to this function or the decoder will not be avaliable for users to select.
69 */
70 static public function listDecoders( )
71 {
72 $list = array( "rdf", "rss", "backslash" );
73 return $list;
74 }
75
79 function importNews( )
80 {
81 $category = new eZNewsCategory( $this->CategoryID );
82 $this->Decoder = trim( $this->Decoder );
83 switch ( $this->Decoder )
84 {
85 case "nyheter.no" :
86 {
87 // include_once( "eznewsfeed/classes/eznyheternoimporter.php" );
88
89 $importer = new eZNyheterNOImporter( $this->Site, $this->Login, $this->Password );
90
91 $importer->news();
92 $newsList =& $importer->news();
93 }
94 break;
95
96 case "rdf" :
97 {
98 // include_once( "eznewsfeed/classes/ezrdfimporter.php" );
99
100 $importer = new eZRDFImporter( $this->Site, $this->Login, $this->Password );
101 $newsList =& $importer->news();
102 }
103 break;
104
105 case "rss" :
106 {
107 // include_once( "eznewsfeed/classes/ezrssimporter.php" );
108
109 $importer = new eZRSSImporter( $this->Site, $this->Login, $this->Password );
110 $newsList =& $importer->news();
111 }
112 break;
113
114 case "backslash" :
115 {
116 // include_once( "eznewsfeed/classes/ezbackslashimporter.php" );
117
118 $importer = new eZBackslashImporter( $this->Site, $this->Login, $this->Password );
119 $newsList =& $importer->news();
120 }
121 break;
122 }
123
124 if( isset( $newsList ) )
125 {
126 foreach ( $newsList as $newsItem )
127 {
128 if ( $newsItem->store() == true )
129 {
130 if ( $this->AutoPublish == true )
131 {
132 $newsItem->setIsPublished( 1 );
133 }
134 else
135 {
136 $newsItem->setIsPublished( 0 );
137 }
138 $newsItem->store();
139
140 $category->addNews( $newsItem );
141 print( "storing: -" .$newsItem->name() . "<br>");
142 }
143 else
144 {
145 print( "already stored: -" .$newsItem->name() . "<br>");
146 }
147 }
148 }
149 }
150
151 var $Decoder;
152 var $Site;
153 var $Login;
154 var $Password;
155 var $CategoryID;
156 var $AutoPublish;
157 }
158
159 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
eZBackslashImporter
Definition: ezbackslashimporter.php:46
eZNewsCategory
Definition: eznewscategory.php:42
eZNewsImporter
Definition: eznewsimporter.php:46
eZNewsImporter\$Site
$Site
Definition: eznewsimporter.php:152
eZNewsImporter\$CategoryID
$CategoryID
Definition: eznewsimporter.php:155
eZNewsImporter\$Password
$Password
Definition: eznewsimporter.php:154
eZNewsImporter\$AutoPublish
$AutoPublish
Definition: eznewsimporter.php:156
eZNewsImporter\listDecoders
static listDecoders()
Definition: eznewsimporter.php:70
eZNewsImporter\__construct
__construct( $decoder, $site, $category, $login="", $password="", $autoPublish=false)
Definition: eznewsimporter.php:51
eZNewsImporter\importNews
importNews()
Definition: eznewsimporter.php:79
eZNewsImporter\$Decoder
$Decoder
Definition: eznewsimporter.php:151
eZNewsImporter\$Login
$Login
Definition: eznewsimporter.php:153
eZNyheterNOImporter
Definition: eznyheternoimporter.php:45
eZRDFImporter
Definition: ezrdfimporter.php:46
eZRSSImporter
Definition: ezrssimporter.php:46
$newsList
if(isset( $URLQueryString)) $newsList
Definition: newssearch.php:68
Password
</td ></tr >< tr >< td style="color:<?= isset( $error['password1'] ) ?> Password
Definition: step1.php:146
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.