Esempio n. 1
0
function parse_table_structure($bDisplay)
{
    global $url_val, $parse_external_url, $seek_offset, $form_properties;
    global $global_table_count, $global_row_count, $global_cell_count, $global_div_count;
    function custom_echo($bDisplay, $string)
    {
        if ($bDisplay == true) {
            echo $string;
        }
    }
    $html = "<html></html>";
    if ($parse_external_url == true) {
        $returned_content = get_data($url_val, $form_properties);
    } else {
        $returned_content = $html;
    }
    $open_table_regex = "/<table[^>]*>/i";
    $close_table_regex = "/<\\/table[^>]*>/i";
    $done = false;
    $count = 0;
    $offset = 0;
    while (!$done) {
        if (preg_match($open_table_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
            if ($seek_offset > $matches[0][1]) {
                $offset = $matches[0][1] + 1;
                $previous_offset = $offset;
                //echo "<BR>location: ".$offset;
                custom_echo($bDisplay, "<BR>location: " . $offset);
                $count++;
            } else {
                $done = true;
            }
        } else {
            $done = true;
        }
    }
    custom_echo($bDisplay, "<BR>There are " . $count . " open table tags preceeding offset " . $seek_offset . ".<BR>");
    $global_table_count = $count;
    //echo "<BR>There are ".$count." open table tags preceeding offset ".$seek_offset.".<BR>";
    if ($count != 0) {
        $open_tr_regex = "/<tr[^>]*>/i";
        $done = false;
        $count = 0;
        $save_offset = $previous_offset;
        $offset = $previous_offset;
        while (!$done) {
            if (preg_match($open_tr_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                if ($seek_offset > $matches[0][1]) {
                    $offset = $matches[0][1] + 1;
                    $previous_offset = $offset;
                    //echo "<BR>location: ".$offset;
                    custom_echo($bDisplay, "<BR>location: " . $offset);
                    $count++;
                } else {
                    $done = true;
                }
            } else {
                $done = true;
            }
        }
        //echo "<BR>There are ".$count." open tr tags between offset ".$save_offset." and ".$seek_offset.".<BR>";
        custom_echo($bDisplay, "<BR>There are " . $count . " open tr tags between offset " . $save_offset . " and " . $seek_offset . ".<BR>");
        $global_row_count = $count;
    }
    if ($count != 0) {
        $open_td_regex = "/<td[^>]*>/i";
        $done = false;
        $count = 0;
        $save_offset = $previous_offset;
        $offset = $previous_offset;
        while (!$done) {
            if (preg_match($open_td_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                if ($seek_offset > $matches[0][1]) {
                    $offset = $matches[0][1] + 1;
                    $previous_offset = $offset;
                    //echo "<BR>location: ".$offset;
                    custom_echo($bDisplay, "<BR>location: " . $offset);
                    $count++;
                } else {
                    $done = true;
                }
            } else {
                $done = true;
            }
        }
        //echo "<BR>There are ".$count." open td tags preceeding offset ".$save_offset." and ".$seek_offset.".<BR>";
        custom_echo($bDisplay, "<BR>There are " . $count . " open td tags preceeding offset " . $save_offset . " and " . $seek_offset . ".<BR>");
        $global_cell_count = $count;
    }
    $close_td_regex = "%</td>(?i)%";
    if (preg_match($close_td_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
        $end = $matches[0][1] + 1;
        $length = $end - $offset;
        //echo "<BR>Contents of last td open and close tags:<BR>";
        //echo "<BR>".htmlspecialchars(substr($returned_content, $offset - 1, $length + 5))."<BR>";
        custom_echo($bDisplay, "<BR>Contents of last td open and close tags:<BR>");
        custom_echo($bDisplay, "<BR>" . htmlspecialchars(substr($returned_content, $offset - 1, $length + 5)) . "<BR>");
    } else {
        echo "Issue with processing open and close td tags.";
    }
    if ($count != 0) {
        $open_div_regex = "/<div[^>]*>/i";
        $done = false;
        $count = 0;
        $save_offset = $previous_offset;
        $offset = $previous_offset;
        while (!$done) {
            if (preg_match($open_div_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
                if ($seek_offset > $matches[0][1]) {
                    $offset = $matches[0][1] + 1;
                    $previous_offset = $offset;
                    //echo "<BR>location: ".$offset;
                    custom_echo($bDisplay, "<BR>location: " . $offset);
                    $count++;
                } else {
                    $done = true;
                }
            } else {
                $done = true;
            }
        }
        //echo "<BR>There are ".$count." open div tags preceeding offset ".$save_offset." and ".$seek_offset.".<BR>";
        custom_echo($bDisplay, "<BR>There are " . $count . " open div tags preceeding offset " . $save_offset . " and " . $seek_offset . ".<BR>");
        $global_div_count = $count;
    }
    //display the contents between the last <div> tag and its corresponding </div> tag
    if ($count > 0) {
        //find the close </div> tag
        $close_div_regex = "%</div>(?i)%";
        if (preg_match($close_div_regex, $returned_content, $matches, PREG_OFFSET_CAPTURE, $offset)) {
            $end = $matches[0][1] + 1;
            $length = $end - $offset;
            //echo "<BR>Contents of last div open and close tags:<BR>";
            //echo "<BR>".htmlspecialchars(substr($returned_content, $offset - 1, $length + 6))."<BR>";
            custom_echo($bDisplay, "<BR>Contents of last div open and close tags:<BR>");
            custom_echo($bDisplay, "<BR>" . htmlspecialchars(substr($returned_content, $offset - 1, $length + 6)) . "<BR>");
        } else {
            echo "<BR>Issue with processing open and close div tags.<BR>";
        }
    }
}
Esempio n. 2
0
										<h3><a href="<?php 
        echo $this->config->base_url();
        ?>
index.php/web/procedimientos#<?php 
        echo $pro->titulo;
        ?>
"><?php 
        echo $pro->titulo;
        ?>
</a><span class="subtitle"><?php 
        echo $pro->sub_titulo;
        ?>
</span></h3>
										<p>
											<?php 
        echo custom_echo($pro->detalle, 150);
        ?>
										</p>
									</div>
								</div>

								<?php 
        echo "</div>";
    }
}
?>
							

							<div class="clear"></div>

							<!--<div class="fright"><a href="#"><i class="i-plain i-xlarge divcenter nobottommargin icon-plus"></i></a></div>-->
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Task</th>
                                <th>Status</th>
                                
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
$i = 1;
foreach ($task as $row) {
    echo '<tr>';
    echo '<td>' . $i++ . '</td>';
    echo '<td>';
    echo custom_echo($row->task, 30);
    echo '</td>';
    echo '<td>';
    echo $row->status;
    echo '</td>';
    echo '</tr>';
}
?>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- /block -->
        </div>

Esempio n. 4
0
    ?>
browseproject/viewproject/<?php 
    echo $row->id;
    ?>
"><?php 
    echo $row->company_name;
    ?>
</a> </b>
			 </div>
              <div class="rating"><img alt="Based on 0 reviews."  src="images/stars-0.png"></div>
			   <div class="description"> <?php 
    echo custom_echo($row->introduction_for_investors, 200);
    ?>
 </div>
               <div class="description"> <?php 
    echo custom_echo($row->company_details, 200);
    ?>
 </div>
             </div>
             <?php 
}
?>
            
             
      </div>
 
 </div>
 
 </div>
</div>
<div class="clear"></div>