| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfDeprecatedHelpersValidation extends sfValidation |
|---|
| 20 |
{ |
|---|
| 21 |
public function getHeader() |
|---|
| 22 |
{ |
|---|
| 23 |
return 'Checking usage of deprecated helpers'; |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
public function getExplanation() |
|---|
| 27 |
{ |
|---|
| 28 |
return array( |
|---|
| 29 |
'', |
|---|
| 30 |
' The files above use deprecated helpers', |
|---|
| 31 |
' that have been removed in symfony 1.4.', |
|---|
| 32 |
'', |
|---|
| 33 |
' You can find a list of all deprecated helpers under the', |
|---|
| 34 |
' "Helpers" section of the DEPRECATED tutorial:', |
|---|
| 35 |
'', |
|---|
| 36 |
' http://www.symfony-project.org/tutorial/1_4/en/deprecated', |
|---|
| 37 |
'', |
|---|
| 38 |
); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
public function validate() |
|---|
| 42 |
{ |
|---|
| 43 |
$helpers = array( |
|---|
| 44 |
'select_day_tag', 'select_month_tag', 'select_year_tag', 'select_date_tag', 'select_second_tag', |
|---|
| 45 |
'select_minute_tag', 'select_hour_tag', 'select_ampm_tag', 'select_time_tag', 'select_datetime_tag', |
|---|
| 46 |
'select_number_tag', 'select_timezone_tag', 'options_for_select', 'select_tag', 'select_country_tag', |
|---|
| 47 |
'select_language_tag', 'select_currency_tag', 'input_tag', 'input_hidden_tag', 'input_file_tag', |
|---|
| 48 |
'input_password_tag', 'textarea_tag', 'checkbox_tag', 'radiobutton_tag', 'input_date_range_tag', |
|---|
| 49 |
'input_date_tag', 'submit_tag', 'reset_tag', 'submit_image_tag', 'label_for', |
|---|
| 50 |
'object_admin_input_file_tag', 'object_admin_double_list', 'object_admin_select_list', |
|---|
| 51 |
'object_admin_check_list', 'object_input_date_tag', 'object_textarea_tag', 'objects_for_select', |
|---|
| 52 |
'object_select_tag', 'object_select_country_tag', 'object_select_language_tag', 'object_input_hidden_tag', |
|---|
| 53 |
'object_input_tag', 'object_checkbox_tag', 'form_has_error', 'form_error', 'get_callbacks', |
|---|
| 54 |
'get_ajax_options', 'button_to_remote', 'link_to_remote', 'periodically_call_remote', 'form_remote_tag', |
|---|
| 55 |
'submit_to_remote', 'submit_image_to_remote', 'update_element_function', 'evaluate_remote_response', |
|---|
| 56 |
'remote_function', 'observe_field', 'observe_form', 'visual_effect', 'sortable_element', |
|---|
| 57 |
'draggable_element', 'drop_receiving_element', 'input_auto_complete_tag', 'input_in_place_editor_tag', |
|---|
| 58 |
); |
|---|
| 59 |
|
|---|
| 60 |
$found = array(); |
|---|
| 61 |
$files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array( |
|---|
| 62 |
sfConfig::get('sf_apps_dir'), |
|---|
| 63 |
sfConfig::get('sf_lib_dir'), |
|---|
| 64 |
sfConfig::get('sf_test_dir'), |
|---|
| 65 |
sfConfig::get('sf_plugins_dir'), |
|---|
| 66 |
)); |
|---|
| 67 |
foreach ($files as $file) |
|---|
| 68 |
{ |
|---|
| 69 |
$content = sfToolkit::stripComments(file_get_contents($file)); |
|---|
| 70 |
|
|---|
| 71 |
$matches = array(); |
|---|
| 72 |
foreach ($helpers as $helper) |
|---|
| 73 |
{ |
|---|
| 74 |
if (preg_match('#\b'.preg_quote($helper, '#').'\b#', $content)) |
|---|
| 75 |
{ |
|---|
| 76 |
$matches[] = $helper; |
|---|
| 77 |
} |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
if ($matches) |
|---|
| 81 |
{ |
|---|
| 82 |
$found[$file] = implode(', ', $matches); |
|---|
| 83 |
} |
|---|
| 84 |
} |
|---|
| 85 |
|
|---|
| 86 |
return $found; |
|---|
| 87 |
} |
|---|
| 88 |
} |
|---|
| 89 |
|
|---|