Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbackslashimporter.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbackslashimporter.php 9277 2002-02-26 17:27:44Z br $
5 //
6 // Definition of ezbackslashimporter class
7 //
8 // Created on: <02-Jan-2001 14:14:55 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
40 // include_once( "classes/ezdb.php" );
41 // include_once( "classes/ezdatetime.php" );
42 // include_once( "eznewsfeed/classes/eznews.php" );
43 // include_once( "ezxml/classes/ezxml.php" );
44
45 class eZBackslashImporter
46 {
50 function __construct( $site, $login="", $password="" )
51 {
52 $this->Site = $site;
53 $this->Login = $login;
54 $this->Password = $password;
55 }
56
60 function &news( )
61 {
62 $db =& eZDB::globalDatabase();
63 $return_array = array();
64
65 if (!($fp = @fopen($this->Site, "r"))) {
66 // include_once( "classes/ezlog.php" );
67 eZPBLog::writeWarning( "RSS read failure: ".$this->Site."\n" );
68 return false;
69 }
70
71 $output = "";
72 while ( !feof ( $fp ) )
73 {
74 $output .= fgets( $fp, 4096 );
75 }
76
77 fclose( $fp );
78
79 $params["TrimWhiteSpace"] = true;
80 $doc =& eZXML::domTree( $output, $params );
81 if ( count( $doc->children ) > 0 )
82 foreach ( $doc->children as $child )
83 {
84 if ( $child->name == "backslash" || $child->name == "linuxtoday" )
85 {
86 foreach ( $child->children as $channel )
87 {
88 if ( $channel->name == "story" )
89 {
90 $title = "";
91 $link = "";
92 $description = "";
93
94 foreach ( $channel->children as $item )
95 {
96 $content = "";
97 foreach ( $item->children as $value )
98 {
99 if ( $value->name == "text" )
100 {
101 $content = $value->content;
102 }
103 }
104
105 switch ( $item->name )
106 {
107 case "title" :
108 {
109 $title = $content;
110 }
111 break;
112
113 case "url" :
114 {
115 $link = $content;
116 }
117 break;
118
119 case "time" :
120 {
121 $publishingDate = $content;
122 }
123 break;
124 }
125 }
126
127 $news = new eZNews();
128 $news->setName( $title );
129 $news->setURL( $link );
130
131 if ( ereg( "([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $publishingDate, $valueArray ) )
132 {
133 $year = ( $valueArray[1] );
134 $month = ( $valueArray[2] );
135 $day = ( $valueArray[3] );
136 $hour = ( $valueArray[4] );
137 $minute = ( $valueArray[5] );
138 $second = ( $valueArray[6] );
139
140 $dateTime = new eZDateTime( $year, $month, $day, $hour, $minute, $second );
141 $news->setOriginalPublishingDate( $dateTime );
142 }
143
144 $return_array[] = $news;
145 }
146 }
147 }
148 }
149
150 return $return_array;
151 }
152
153 var $Site;
154 var $Login;
155 var $Password;
156 }
157
158 ?>
$day
else $day
Definition: appointmentedit.php:665
$year
else $year
Definition: appointmentedit.php:655
$month
else $month
Definition: appointmentedit.php:660
$dateTime
$dateTime
Definition: authorview.php:77
eZBackslashImporter
Definition: ezbackslashimporter.php:46
eZBackslashImporter\$Login
$Login
Definition: ezbackslashimporter.php:154
eZBackslashImporter\$Site
$Site
Definition: ezbackslashimporter.php:153
eZBackslashImporter\__construct
__construct( $site, $login="", $password="")
Definition: ezbackslashimporter.php:50
eZBackslashImporter\$Password
$Password
Definition: ezbackslashimporter.php:155
eZBackslashImporter\news
& news()
Definition: ezbackslashimporter.php:60
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZNews
Definition: eznews.php:63
eZPBLog\writeWarning
static writeWarning( $warning)
Definition: ezpblog.php:177
eZXML\domTree
static domTree( $xmlDoc, $params=array())
Definition: ezxml.php:60
$item
$item
Definition: classes/admin/linklist.php:228
$fp
$fp
Definition: export.php:97
$doc
$doc
Definition: export.php:93
$minute
$minute
Definition: export_froogle.php:311
$hour
$hour
Definition: export_froogle.php:310
$db
$db
Definition: ezarticle/user/authorlist.php:53
$content
$content
Definition: ezimagecatalogue/admin/filedownload.php:53
$link
$link
Definition: ezlink/admin/attributeedit.php:49
$news
if( $Action=="Insert") if( $Action=="Update") if( $Action=="Delete") $news
Definition: eznewsfeed/admin/categoryedit.php:69
$output
$output
Definition: formpreview.php:81
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+.