Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [regex] wyciaganie odwolan do funkcji
Forum PHP.pl > Forum > PHP
czerwoony
Mój problem polega na tym ze chciałbym wyciągnąć wszystkie wywołana funkcji z gotowego pliku php.. wiem ze to się da zrobić właśnie przez regex.. ale to dla mnie magia

przykładowy plik z którego chce skorzystać
  1. <?php
  2.  
  3. function node_help($section) {
  4. switch ($section) {
  5. case 'admin/help#node':
  6. $output = '<p>'. t('All content in a website is stored and treated as <b>nodes</b>. Therefore nodes are any postings such as blogs, stories, polls and forums. 
    The node module manages these content types and is one of the strengths of Drupal
     over other content management systems.'
    ) .'</p>';
  7. $output .= '<p>'. t('Treating all content as nodes allows the flexibility of creating new types of co
    ntent. It also allows you to painlessly apply new features or changes to all cont
    ent. Comments are not stored as nodes but are always associated with a node.'
    ) .'</p>';
  8. $output .= t('<p>You can</p>
  9. <ul>
  10. <li>search for content at <a href="%search">search</a>.</li>
  11. <li>administer nodes at <a href="%admin-settings-content-types">administer &gt;&gt; settings &gt;&gt; content types</a>.</li>
  12. </ul>
  13. ', array('%search' => url('search'), '%admin-settings-content-types' => url('admin/settings/content-types')));
  14. $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%node">Node page</a>.', array('%node' => 'http://drupal.org/handbook/modules/node/')) .'</p>';
  15. return $output;
  16. case 'admin/modules#description':
  17. return t('Allows content to be submitted to the site and displayed on pages.');
  18. case 'admin/node/configure':
  19. case 'admin/node/configure/settings':
  20. return t('<p>Settings for the core of Drupal. Almost everything is a node so these setting
    s will affect most of the site.</p>'
    );
  21. case 'admin/node':
  22. return t('<p>Below is a list of all of the posts on your site. Other forms of content are 
    listed elsewhere (e.g. <a href="%comments">comments</a>).</p><p>Clicking a title views the post, while clicking an author's name views their user information.</p>'
    , array('%comments' => url('admin/comment')));
  23. case 'admin/node/search':
  24. return t('<p>Enter a simple pattern to search for a post. This can include the wildcard ch
    aracter *.<br />For example, a search for "br*" might return "bread bakers", "our daily bread" and "brenda".</p>'
    );
  25. }
  26.  
  27. if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'revisions') {
  28. return t('The revisions let you track differences between multiple versions of a post.');
  29. }
  30.  
  31. if (arg(0) == 'node' && arg(1) == 'add' && $type = arg(2)) {
  32. return variable_get($type .'_help', '');
  33. }
  34. }
  35.  
  36. ?>

więcej przykładowych plików tu> cvs.drupal.org|drupal|modules

konkretnie chodzi mi o funkcje "t()"... tzn

np.
Kod
t('The forum %term has been deleted.', array('%term' => theme('placeholder', $form_values['name']))

Kod
t('forum container')



doszedłem do takiego rozwiązania ...ale to jest syf
  1. <?php
  2.  
  3. //to tylko przykład pobieram je lokalnie
  4. $subject = file_get_contents("http://cvs.drupal.org/viewcvs/*checkout*/drupal/drupal/modules/forum.module");
  5.  
  6. preg_match_all('/t[ ]+(.*)[\(]['|\"](.*)(\,*)['|\"][\)]/', $subject, $result);
  7. print_r($result);
  8.  
  9. ?>
crash
Spróbuj wyrażenia: /t\(.*?\)/
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.