@@ -568,42 +568,42 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | echo '<div id="pqp-console" class="pqp-box">'; |
| 570 | 570 | |
| 571 | -if($logCount == 0) {
|
|
| 571 | +if ($logCount == 0) {
|
|
| 572 | 572 | echo '<h3>This panel has no log items.</h3>'; |
| 573 | 573 | } |
| 574 | 574 | else {
|
| 575 | 575 | echo '<table class="side" cellspacing="0"> |
| 576 | 576 | <tr> |
| 577 | - <td class="alt1"><var>'.$output['logs']['log_count'].'</var><h4>Logs</h4></td> |
|
| 578 | - <td class="alt2"><var>'.$output['logs']['error_count'].'</var> <h4>Errors</h4></td> |
|
| 577 | + <td class="alt1"><var>'.$output['logs']['log_count'] . '</var><h4>Logs</h4></td> |
|
| 578 | + <td class="alt2"><var>'.$output['logs']['error_count'] . '</var> <h4>Errors</h4></td> |
|
| 579 | 579 | </tr> |
| 580 | 580 | <tr> |
| 581 | - <td class="alt3"><var>'.$output['logs']['memory_count'].'</var> <h4>Memory</h4></td> |
|
| 582 | - <td class="alt4"><var>'.$output['logs']['speed_count'].'</var> <h4>Speed</h4></td> |
|
| 581 | + <td class="alt3"><var>'.$output['logs']['memory_count'] . '</var> <h4>Memory</h4></td> |
|
| 582 | + <td class="alt4"><var>'.$output['logs']['speed_count'] . '</var> <h4>Speed</h4></td> |
|
| 583 | 583 | </tr> |
| 584 | 584 | </table> |
| 585 | 585 | <table class="main" cellspacing="0">'; |
| 586 | 586 | |
| 587 | 587 | $class = ''; |
| 588 | - foreach($output['logs']['debugger_log'] as $log) {
|
|
| 589 | - echo '<tr class="log-'.$log['type'].'"> |
|
| 590 | - <td class="type">'.$log['type'].'</td> |
|
| 591 | - <td class="'.$class.'">'; |
|
| 592 | - if($log['type'] == 'log') {
|
|
| 593 | - echo '<div><pre>'.$log['data'].'</pre></div>'; |
|
| 588 | + foreach ($output['logs']['debugger_log'] as $log) {
|
|
| 589 | + echo '<tr class="log-' . $log['type'] . '"> |
|
| 590 | + <td class="type">'.$log['type'] . '</td> |
|
| 591 | + <td class="'.$class . '">'; |
|
| 592 | + if ($log['type'] == 'log') {
|
|
| 593 | + echo '<div><pre>' . $log['data'] . '</pre></div>'; |
|
| 594 | 594 | } |
| 595 | - elseif($log['type'] == 'memory') {
|
|
| 596 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>'; |
|
| 595 | + elseif ($log['type'] == 'memory') {
|
|
| 596 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['dataType'] . '</em>: ' . $log['name'] . ' </div>'; |
|
| 597 | 597 | } |
| 598 | - elseif($log['type'] == 'speed') {
|
|
| 599 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
|
| 598 | + elseif ($log['type'] == 'speed') {
|
|
| 599 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['name'] . '</em></div>'; |
|
| 600 | 600 | } |
| 601 | - elseif($log['type'] == 'error') {
|
|
| 602 | - echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
|
| 601 | + elseif ($log['type'] == 'error') {
|
|
| 602 | + echo '<div><em>Line ' . $log['line'] . '</em> : ' . $log['data'] . ' <pre>' . $log['file'] . '</pre></div>'; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | echo '</td></tr>'; |
| 606 | - if($class == '') $class = 'alt'; |
|
| 606 | + if ($class == '') $class = 'alt'; |
|
| 607 | 607 | else $class = ''; |
| 608 | 608 | } |
| 609 | 609 | |
@@ -614,24 +614,24 @@ discard block |
||
| 614 | 614 | |
| 615 | 615 | echo '<div id="pqp-speed" class="pqp-box">'; |
| 616 | 616 | |
| 617 | -if($output['logs']['speedCount'] == 0) {
|
|
| 617 | +if ($output['logs']['speedCount'] == 0) {
|
|
| 618 | 618 | echo '<h3>This panel has no log items.</h3>'; |
| 619 | 619 | } |
| 620 | 620 | else {
|
| 621 | 621 | echo '<table class="side" cellspacing="0"> |
| 622 | - <tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr> |
|
| 623 | - <tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr> |
|
| 622 | + <tr><td><var>'.$output['speedTotals']['total'] . '</var><h4>Load Time</h4></td></tr> |
|
| 623 | + <tr><td class="alt"><var>'.$output['speedTotals']['allowed'] . '</var> <h4>Max Execution Time</h4></td></tr> |
|
| 624 | 624 | </table> |
| 625 | 625 | <table class="main" cellspacing="0">'; |
| 626 | 626 | |
| 627 | 627 | $class = ''; |
| 628 | - foreach($output['logs']['console'] as $log) {
|
|
| 629 | - if($log['type'] == 'speed') {
|
|
| 630 | - echo '<tr class="log-'.$log['type'].'"> |
|
| 631 | - <td class="'.$class.'">'; |
|
| 632 | - echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
|
| 628 | + foreach ($output['logs']['console'] as $log) {
|
|
| 629 | + if ($log['type'] == 'speed') {
|
|
| 630 | + echo '<tr class="log-' . $log['type'] . '"> |
|
| 631 | + <td class="'.$class . '">'; |
|
| 632 | + echo '<div><pre>' . $log['data'] . '</pre> <em>' . $log['name'] . '</em></div>'; |
|
| 633 | 633 | echo '</td></tr>'; |
| 634 | - if($class == '') $class = 'alt'; |
|
| 634 | + if ($class == '') $class = 'alt'; |
|
| 635 | 635 | else $class = ''; |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -643,32 +643,32 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | echo '<div id="pqp-queries" class="pqp-box">'; |
| 645 | 645 | |
| 646 | -if($output['queryTotals']['count'] == 0) {
|
|
| 646 | +if ($output['queryTotals']['count'] == 0) {
|
|
| 647 | 647 | echo '<h3>This panel has no log items.</h3>'; |
| 648 | 648 | } |
| 649 | 649 | else {
|
| 650 | 650 | echo '<table class="side" cellspacing="0"> |
| 651 | - <tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr> |
|
| 652 | - <tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr> |
|
| 651 | + <tr><td><var>'.$output['queryTotals']['count'] . '</var><h4>Total Queries</h4></td></tr> |
|
| 652 | + <tr><td class="alt"><var>'.$output['queryTotals']['time'] . '</var> <h4>Total Time</h4></td></tr> |
|
| 653 | 653 | <tr><td><var>0</var> <h4>Duplicates</h4></td></tr> |
| 654 | 654 | </table> |
| 655 | 655 | <table class="main" cellspacing="0">'; |
| 656 | 656 | |
| 657 | 657 | $class = ''; |
| 658 | - foreach($output['queries'] as $query) {
|
|
| 658 | + foreach ($output['queries'] as $query) {
|
|
| 659 | 659 | echo '<tr> |
| 660 | - <td class="'.$class.'">'.$query['sql']; |
|
| 661 | - if($query['explain']) {
|
|
| 660 | + <td class="'.$class . '">' . $query['sql']; |
|
| 661 | + if ($query['explain']) {
|
|
| 662 | 662 | echo '<em> |
| 663 | - Possible keys: <b>'.$query['explain']['possible_keys'].'</b> · |
|
| 664 | - Key Used: <b>'.$query['explain']['key'].'</b> · |
|
| 665 | - Type: <b>'.$query['explain']['type'].'</b> · |
|
| 666 | - Rows: <b>'.$query['explain']['rows'].'</b> · |
|
| 667 | - Speed: <b>'.$query['time'].'</b> |
|
| 663 | + Possible keys: <b>'.$query['explain']['possible_keys'] . '</b> · |
|
| 664 | + Key Used: <b>'.$query['explain']['key'] . '</b> · |
|
| 665 | + Type: <b>'.$query['explain']['type'] . '</b> · |
|
| 666 | + Rows: <b>'.$query['explain']['rows'] . '</b> · |
|
| 667 | + Speed: <b>'.$query['time'] . '</b> |
|
| 668 | 668 | </em>'; |
| 669 | 669 | } |
| 670 | 670 | echo '</td></tr>'; |
| 671 | - if($class == '') $class = 'alt'; |
|
| 671 | + if ($class == '') $class = 'alt'; |
|
| 672 | 672 | else $class = ''; |
| 673 | 673 | } |
| 674 | 674 | |
@@ -679,23 +679,23 @@ discard block |
||
| 679 | 679 | |
| 680 | 680 | echo '<div id="pqp-memory" class="pqp-box">'; |
| 681 | 681 | |
| 682 | -if($output['logs']['memoryCount'] == 0) {
|
|
| 682 | +if ($output['logs']['memoryCount'] == 0) {
|
|
| 683 | 683 | echo '<h3>This panel has no log items.</h3>'; |
| 684 | 684 | } |
| 685 | 685 | else {
|
| 686 | 686 | echo '<table class="side" cellspacing="0"> |
| 687 | - <tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr> |
|
| 688 | - <tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr> |
|
| 687 | + <tr><td><var>'.$output['memoryTotals']['used'] . '</var><h4>Used Memory</h4></td></tr> |
|
| 688 | + <tr><td class="alt"><var>'.$output['memoryTotals']['total'] . '</var> <h4>Total Available</h4></td></tr> |
|
| 689 | 689 | </table> |
| 690 | 690 | <table class="main" cellspacing="0">'; |
| 691 | 691 | |
| 692 | 692 | $class = ''; |
| 693 | - foreach($output['logs']['console'] as $log) {
|
|
| 694 | - if($log['type'] == 'memory') {
|
|
| 695 | - echo '<tr class="log-'.$log['type'].'">'; |
|
| 696 | - echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>'; |
|
| 693 | + foreach ($output['logs']['console'] as $log) {
|
|
| 694 | + if ($log['type'] == 'memory') {
|
|
| 695 | + echo '<tr class="log-' . $log['type'] . '">'; |
|
| 696 | + echo '<td class="' . $class . '"><b>' . $log['data'] . '</b> <em>' . $log['dataType'] . '</em>: ' . $log['name'] . '</td>'; |
|
| 697 | 697 | echo '</tr>'; |
| 698 | - if($class == '') $class = 'alt'; |
|
| 698 | + if ($class == '') $class = 'alt'; |
|
| 699 | 699 | else $class = ''; |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -707,21 +707,21 @@ discard block |
||
| 707 | 707 | |
| 708 | 708 | echo '<div id="pqp-files" class="pqp-box">'; |
| 709 | 709 | |
| 710 | -if($output['fileTotals']['count'] == 0) {
|
|
| 710 | +if ($output['fileTotals']['count'] == 0) {
|
|
| 711 | 711 | echo '<h3>This panel has no log items.</h3>'; |
| 712 | 712 | } |
| 713 | 713 | else {
|
| 714 | 714 | echo '<table class="side" cellspacing="0"> |
| 715 | - <tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr> |
|
| 716 | - <tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr> |
|
| 717 | - <tr><td><var>'.$output['fileTotals']['largest'].'</var> <h4>Largest</h4></td></tr> |
|
| 715 | + <tr><td><var>'.$output['fileTotals']['count'] . '</var><h4>Total Files</h4></td></tr> |
|
| 716 | + <tr><td class="alt"><var>'.$output['fileTotals']['size'] . '</var> <h4>Total Size</h4></td></tr> |
|
| 717 | + <tr><td><var>'.$output['fileTotals']['largest'] . '</var> <h4>Largest</h4></td></tr> |
|
| 718 | 718 | </table> |
| 719 | 719 | <table class="main" cellspacing="0">'; |
| 720 | 720 | |
| 721 | - $class =''; |
|
| 722 | - foreach($output['files'] as $file) {
|
|
| 723 | - echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
|
| 724 | - if($class == '') $class = 'alt'; |
|
| 721 | + $class = ''; |
|
| 722 | + foreach ($output['files'] as $file) {
|
|
| 723 | + echo '<tr><td class="' . $class . '"><b>' . $file['size'] . '</b> ' . $file['name'] . '</td></tr>'; |
|
| 724 | + if ($class == '') $class = 'alt'; |
|
| 725 | 725 | else $class = ''; |
| 726 | 726 | } |
| 727 | 727 | |
@@ -570,8 +570,7 @@ discard block |
||
| 570 | 570 | |
| 571 | 571 | if($logCount == 0) {
|
| 572 | 572 | echo '<h3>This panel has no log items.</h3>'; |
| 573 | -} |
|
| 574 | -else {
|
|
| 573 | +} else {
|
|
| 575 | 574 | echo '<table class="side" cellspacing="0"> |
| 576 | 575 | <tr> |
| 577 | 576 | <td class="alt1"><var>'.$output['logs']['log_count'].'</var><h4>Logs</h4></td> |
@@ -591,20 +590,20 @@ discard block |
||
| 591 | 590 | <td class="'.$class.'">'; |
| 592 | 591 | if($log['type'] == 'log') {
|
| 593 | 592 | echo '<div><pre>'.$log['data'].'</pre></div>'; |
| 594 | - } |
|
| 595 | - elseif($log['type'] == 'memory') {
|
|
| 593 | + } elseif($log['type'] == 'memory') {
|
|
| 596 | 594 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['dataType'].'</em>: '.$log['name'].' </div>'; |
| 597 | - } |
|
| 598 | - elseif($log['type'] == 'speed') {
|
|
| 595 | + } elseif($log['type'] == 'speed') {
|
|
| 599 | 596 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 600 | - } |
|
| 601 | - elseif($log['type'] == 'error') {
|
|
| 597 | + } elseif($log['type'] == 'error') {
|
|
| 602 | 598 | echo '<div><em>Line '.$log['line'].'</em> : '.$log['data'].' <pre>'.$log['file'].'</pre></div>'; |
| 603 | 599 | } |
| 604 | 600 | |
| 605 | 601 | echo '</td></tr>'; |
| 606 | - if($class == '') $class = 'alt'; |
|
| 607 | - else $class = ''; |
|
| 602 | + if($class == '') {
|
|
| 603 | + $class = 'alt'; |
|
| 604 | + } else {
|
|
| 605 | + $class = ''; |
|
| 606 | + } |
|
| 608 | 607 | } |
| 609 | 608 | |
| 610 | 609 | echo '</table>'; |
@@ -616,8 +615,7 @@ discard block |
||
| 616 | 615 | |
| 617 | 616 | if($output['logs']['speedCount'] == 0) {
|
| 618 | 617 | echo '<h3>This panel has no log items.</h3>'; |
| 619 | -} |
|
| 620 | -else {
|
|
| 618 | +} else {
|
|
| 621 | 619 | echo '<table class="side" cellspacing="0"> |
| 622 | 620 | <tr><td><var>'.$output['speedTotals']['total'].'</var><h4>Load Time</h4></td></tr> |
| 623 | 621 | <tr><td class="alt"><var>'.$output['speedTotals']['allowed'].'</var> <h4>Max Execution Time</h4></td></tr> |
@@ -631,8 +629,11 @@ discard block |
||
| 631 | 629 | <td class="'.$class.'">'; |
| 632 | 630 | echo '<div><pre>'.$log['data'].'</pre> <em>'.$log['name'].'</em></div>'; |
| 633 | 631 | echo '</td></tr>'; |
| 634 | - if($class == '') $class = 'alt'; |
|
| 635 | - else $class = ''; |
|
| 632 | + if($class == '') {
|
|
| 633 | + $class = 'alt'; |
|
| 634 | + } else {
|
|
| 635 | + $class = ''; |
|
| 636 | + } |
|
| 636 | 637 | } |
| 637 | 638 | } |
| 638 | 639 | |
@@ -645,8 +646,7 @@ discard block |
||
| 645 | 646 | |
| 646 | 647 | if($output['queryTotals']['count'] == 0) {
|
| 647 | 648 | echo '<h3>This panel has no log items.</h3>'; |
| 648 | -} |
|
| 649 | -else {
|
|
| 649 | +} else {
|
|
| 650 | 650 | echo '<table class="side" cellspacing="0"> |
| 651 | 651 | <tr><td><var>'.$output['queryTotals']['count'].'</var><h4>Total Queries</h4></td></tr> |
| 652 | 652 | <tr><td class="alt"><var>'.$output['queryTotals']['time'].'</var> <h4>Total Time</h4></td></tr> |
@@ -668,8 +668,11 @@ discard block |
||
| 668 | 668 | </em>'; |
| 669 | 669 | } |
| 670 | 670 | echo '</td></tr>'; |
| 671 | - if($class == '') $class = 'alt'; |
|
| 672 | - else $class = ''; |
|
| 671 | + if($class == '') {
|
|
| 672 | + $class = 'alt'; |
|
| 673 | + } else {
|
|
| 674 | + $class = ''; |
|
| 675 | + } |
|
| 673 | 676 | } |
| 674 | 677 | |
| 675 | 678 | echo '</table>'; |
@@ -681,8 +684,7 @@ discard block |
||
| 681 | 684 | |
| 682 | 685 | if($output['logs']['memoryCount'] == 0) {
|
| 683 | 686 | echo '<h3>This panel has no log items.</h3>'; |
| 684 | -} |
|
| 685 | -else {
|
|
| 687 | +} else {
|
|
| 686 | 688 | echo '<table class="side" cellspacing="0"> |
| 687 | 689 | <tr><td><var>'.$output['memoryTotals']['used'].'</var><h4>Used Memory</h4></td></tr> |
| 688 | 690 | <tr><td class="alt"><var>'.$output['memoryTotals']['total'].'</var> <h4>Total Available</h4></td></tr> |
@@ -695,8 +697,11 @@ discard block |
||
| 695 | 697 | echo '<tr class="log-'.$log['type'].'">'; |
| 696 | 698 | echo '<td class="'.$class.'"><b>'.$log['data'].'</b> <em>'.$log['dataType'].'</em>: '.$log['name'].'</td>'; |
| 697 | 699 | echo '</tr>'; |
| 698 | - if($class == '') $class = 'alt'; |
|
| 699 | - else $class = ''; |
|
| 700 | + if($class == '') {
|
|
| 701 | + $class = 'alt'; |
|
| 702 | + } else {
|
|
| 703 | + $class = ''; |
|
| 704 | + } |
|
| 700 | 705 | } |
| 701 | 706 | } |
| 702 | 707 | |
@@ -709,8 +714,7 @@ discard block |
||
| 709 | 714 | |
| 710 | 715 | if($output['fileTotals']['count'] == 0) {
|
| 711 | 716 | echo '<h3>This panel has no log items.</h3>'; |
| 712 | -} |
|
| 713 | -else {
|
|
| 717 | +} else {
|
|
| 714 | 718 | echo '<table class="side" cellspacing="0"> |
| 715 | 719 | <tr><td><var>'.$output['fileTotals']['count'].'</var><h4>Total Files</h4></td></tr> |
| 716 | 720 | <tr><td class="alt"><var>'.$output['fileTotals']['size'].'</var> <h4>Total Size</h4></td></tr> |
@@ -721,8 +725,11 @@ discard block |
||
| 721 | 725 | $class =''; |
| 722 | 726 | foreach($output['files'] as $file) {
|
| 723 | 727 | echo '<tr><td class="'.$class.'"><b>'.$file['size'].'</b> '.$file['name'].'</td></tr>'; |
| 724 | - if($class == '') $class = 'alt'; |
|
| 725 | - else $class = ''; |
|
| 728 | + if($class == '') {
|
|
| 729 | + $class = 'alt'; |
|
| 730 | + } else {
|
|
| 731 | + $class = ''; |
|
| 732 | + } |
|
| 726 | 733 | } |
| 727 | 734 | |
| 728 | 735 | echo '</table>'; |
@@ -239,6 +239,9 @@ |
||
| 239 | 239 | return $text; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | + /** |
|
| 243 | + * @param string $type |
|
| 244 | + */ |
|
| 242 | 245 | private function get_replace_text($entity_type, $entity, $type) |
| 243 | 246 | {
|
| 244 | 247 | switch($entity_type) |
@@ -17,6 +17,9 @@ |
||
| 17 | 17 | return self::run_row_query($query); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $date |
|
| 22 | + */ |
|
| 20 | 23 | public static function getTweetByFields($date, $text) |
| 21 | 24 | {
|
| 22 | 25 | $query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
|
@@ -17,6 +17,9 @@ |
||
| 17 | 17 | return self::run_row_query($query); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $date |
|
| 22 | + */ |
|
| 20 | 23 | public static function getTweetByFields($date, $text) |
| 21 | 24 | {
|
| 22 | 25 | $query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
|
@@ -17,6 +17,9 @@ |
||
| 17 | 17 | return self::run_row_query($query); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $date |
|
| 22 | + */ |
|
| 20 | 23 | public static function getTweetByFields($date, $text) |
| 21 | 24 | {
|
| 22 | 25 | $query = "SELECT * FROM `jpemeric_stream`.`twitter` WHERE `date` = '{$date}' && `text` = '{$text}' LIMIT 1";
|
@@ -55,11 +55,11 @@ |
||
| 55 | 55 | final private function get_list_posts() |
| 56 | 56 | {
|
| 57 | 57 | $post_array = array(); |
| 58 | - foreach($this->get_list_results() as $post) |
|
| 58 | + foreach ($this->get_list_results() as $post) |
|
| 59 | 59 | {
|
| 60 | 60 | $post_array[] = $this->expand_post($post, 'full'); |
| 61 | 61 | } |
| 62 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 62 | + if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 63 | 63 | $this->eject(); |
| 64 | 64 | return $post_array; |
| 65 | 65 | } |
@@ -59,8 +59,9 @@ |
||
| 59 | 59 | {
|
| 60 | 60 | $post_array[] = $this->expand_post($post, 'full'); |
| 61 | 61 | } |
| 62 | - if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') |
|
| 63 | - $this->eject(); |
|
| 62 | + if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
|
|
| 63 | + $this->eject(); |
|
| 64 | + } |
|
| 64 | 65 | return $post_array; |
| 65 | 66 | } |
| 66 | 67 | |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | public function __construct() |
| 14 | 14 | {
|
| 15 | - global $config; |
|
| 15 | + global $config; |
|
| 16 | 16 | $this->headers['From'] = self::$FROM; |
| 17 | 17 | $this->headers['Reply-To'] = "Jacob <{$config->admin_email}>";
|
| 18 | 18 | $this->headers['Bcc'] = "Jacob <{$config->admin_email}>";
|
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | private function process_form() |
| 35 | 35 | {
|
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
|
|
| 36 | + if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
|
|
| 37 | 37 | return (object) array('display' => 'normal');
|
| 38 | 38 | |
| 39 | 39 | Loader::load('utility', 'Validate');
|
| 40 | 40 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string'))
|
|
| 41 | + if (!Validate::checkRequest('post', 'name', 'string'))
|
|
| 42 | 42 | $error_result['name'] = 'please enter your name'; |
| 43 | - if(!Validate::checkRequest('post', 'email', 'string'))
|
|
| 43 | + if (!Validate::checkRequest('post', 'email', 'string'))
|
|
| 44 | 44 | $error_result['email'] = 'please enter a valid email'; |
| 45 | - if(!Validate::checkRequest('post', 'message', 'string'))
|
|
| 45 | + if (!Validate::checkRequest('post', 'message', 'string'))
|
|
| 46 | 46 | $error_result['message'] = 'please write a message'; |
| 47 | 47 | |
| 48 | 48 | $values = (object) array( |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'email' => Request::getPost('email'),
|
| 51 | 51 | 'message' => Request::getPost('message'));
|
| 52 | 52 | |
| 53 | - if(count($error_result) > 0) |
|
| 53 | + if (count($error_result) > 0) |
|
| 54 | 54 | {
|
| 55 | 55 | return (object) array( |
| 56 | 56 | 'display' => 'error', |
@@ -33,17 +33,21 @@ |
||
| 33 | 33 | |
| 34 | 34 | private function process_form() |
| 35 | 35 | {
|
| 36 | - if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
|
|
| 37 | - return (object) array('display' => 'normal');
|
|
| 36 | + if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
|
|
| 37 | + return (object) array('display' => 'normal');
|
|
| 38 | + } |
|
| 38 | 39 | |
| 39 | 40 | Loader::load('utility', 'Validate');
|
| 40 | 41 | $error_result = array(); |
| 41 | - if(!Validate::checkRequest('post', 'name', 'string'))
|
|
| 42 | - $error_result['name'] = 'please enter your name'; |
|
| 43 | - if(!Validate::checkRequest('post', 'email', 'string'))
|
|
| 44 | - $error_result['email'] = 'please enter a valid email'; |
|
| 45 | - if(!Validate::checkRequest('post', 'message', 'string'))
|
|
| 46 | - $error_result['message'] = 'please write a message'; |
|
| 42 | + if(!Validate::checkRequest('post', 'name', 'string')) {
|
|
| 43 | + $error_result['name'] = 'please enter your name'; |
|
| 44 | + } |
|
| 45 | + if(!Validate::checkRequest('post', 'email', 'string')) {
|
|
| 46 | + $error_result['email'] = 'please enter a valid email'; |
|
| 47 | + } |
|
| 48 | + if(!Validate::checkRequest('post', 'message', 'string')) {
|
|
| 49 | + $error_result['message'] = 'please write a message'; |
|
| 50 | + } |
|
| 47 | 51 | |
| 48 | 52 | $values = (object) array( |
| 49 | 53 | 'name' => Request::getPost('name'),
|
@@ -20,6 +20,6 @@ |
||
| 20 | 20 | ) |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | -Router::route($redirect,$direct); |
|
| 23 | +Router::route($redirect, $direct); |
|
| 24 | 24 | |
| 25 | 25 | ?> |
| 26 | 26 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct() |
| 14 | 14 | { |
| 15 | 15 | $extendedPdo = $this->newExtendedPdo(); |
| 16 | - $this->connections = new ConnectionLocator(function () use ($extendedPdo) { |
|
| 16 | + $this->connections = new ConnectionLocator(function() use ($extendedPdo) { |
|
| 17 | 17 | return $extendedPdo; |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -8,21 +8,21 @@ discard block |
||
| 8 | 8 | class MysqlPostRepositoryTest extends \PHPUnit_Framework_TestCase |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - protected $connections; |
|
| 11 | + protected $connections; |
|
| 12 | 12 | |
| 13 | - public function __construct() |
|
| 14 | - { |
|
| 15 | - $extendedPdo = $this->newExtendedPdo(); |
|
| 16 | - $this->connections = new ConnectionLocator(function () use ($extendedPdo) { |
|
| 17 | - return $extendedPdo; |
|
| 18 | - }); |
|
| 19 | - } |
|
| 13 | + public function __construct() |
|
| 14 | + { |
|
| 15 | + $extendedPdo = $this->newExtendedPdo(); |
|
| 16 | + $this->connections = new ConnectionLocator(function () use ($extendedPdo) { |
|
| 17 | + return $extendedPdo; |
|
| 18 | + }); |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - protected function newExtendedPdo() |
|
| 22 | - { |
|
| 23 | - $extendedPdo = new ExtendedPdo('sqlite::memory:'); |
|
| 24 | - $extendedPdo->exec('ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`'); |
|
| 25 | - $extendedPdo->exec(" |
|
| 21 | + protected function newExtendedPdo() |
|
| 22 | + { |
|
| 23 | + $extendedPdo = new ExtendedPdo('sqlite::memory:'); |
|
| 24 | + $extendedPdo->exec('ATTACH DATABASE `jpemeric_blog.db` AS `jpemeric_blog`'); |
|
| 25 | + $extendedPdo->exec(" |
|
| 26 | 26 | CREATE TABLE IF NOT EXISTS `jpemeric_blog`.`post` ( |
| 27 | 27 | `id` integer PRIMARY KEY AUTOINCREMENT, |
| 28 | 28 | `title` varchar(60) NOT NULL, |
@@ -32,48 +32,48 @@ discard block |
||
| 32 | 32 | `body` text NOT NULL, |
| 33 | 33 | `display` integer NOT NULL |
| 34 | 34 | )" |
| 35 | - ); |
|
| 36 | - return $extendedPdo; |
|
| 37 | - } |
|
| 35 | + ); |
|
| 36 | + return $extendedPdo; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - public function newMysqlPostRepository() |
|
| 40 | - { |
|
| 41 | - return new MysqlPostRepository($this->connections); |
|
| 42 | - } |
|
| 39 | + public function newMysqlPostRepository() |
|
| 40 | + { |
|
| 41 | + return new MysqlPostRepository($this->connections); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function testFindByUri() |
|
| 45 | - { |
|
| 46 | - $test_post = array( |
|
| 47 | - 'title' => 'test title', |
|
| 48 | - 'path' => 'test-uri', |
|
| 49 | - 'category' => 'test', |
|
| 50 | - 'date' => date('Y-m-d H:i:s'), |
|
| 51 | - 'body' => 'test content', |
|
| 52 | - 'display' => 1 |
|
| 53 | - ); |
|
| 44 | + public function testFindByUri() |
|
| 45 | + { |
|
| 46 | + $test_post = array( |
|
| 47 | + 'title' => 'test title', |
|
| 48 | + 'path' => 'test-uri', |
|
| 49 | + 'category' => 'test', |
|
| 50 | + 'date' => date('Y-m-d H:i:s'), |
|
| 51 | + 'body' => 'test content', |
|
| 52 | + 'display' => 1 |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - $this->connections->getDefault()->perform(" |
|
| 55 | + $this->connections->getDefault()->perform(" |
|
| 56 | 56 | INSERT INTO jpemeric_blog.post |
| 57 | 57 | (title, path, category, date, body, display) |
| 58 | 58 | VALUES |
| 59 | 59 | (:title, :path, :category, :date, :body, :display)", |
| 60 | - $test_post); |
|
| 60 | + $test_post); |
|
| 61 | 61 | |
| 62 | - $post = $this->newMysqlPostRepository()->findByUri($test_post['path']); |
|
| 63 | - $this->assertSame($test_post['path'], $post['path']); |
|
| 64 | - } |
|
| 62 | + $post = $this->newMysqlPostRepository()->findByUri($test_post['path']); |
|
| 63 | + $this->assertSame($test_post['path'], $post['path']); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function testIsInstanceOfPostRepository() |
|
| 67 | - { |
|
| 68 | - $this->assertInstanceOf( |
|
| 69 | - 'Jacobemerick\Web\Domain\Blog\PostRepository', |
|
| 70 | - $this->newMysqlPostRepository() |
|
| 71 | - ); |
|
| 72 | - } |
|
| 66 | + public function testIsInstanceOfPostRepository() |
|
| 67 | + { |
|
| 68 | + $this->assertInstanceOf( |
|
| 69 | + 'Jacobemerick\Web\Domain\Blog\PostRepository', |
|
| 70 | + $this->newMysqlPostRepository() |
|
| 71 | + ); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - public static function tearDownAfterClass() |
|
| 75 | - { |
|
| 74 | + public static function tearDownAfterClass() |
|
| 75 | + { |
|
| 76 | 76 | // $this->connections->getDefault()->disconnect(); |
| 77 | - unlink('jpemeric_blog.db'); |
|
| 78 | - } |
|
| 77 | + unlink('jpemeric_blog.db'); |
|
| 78 | + } |
|
| 79 | 79 | } |