This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //... | |
| public function filter_final_output($buffer) | |
| { | |
| $regex = '%http://[^/]+?\.static\.flickr\.com/[0-9a-f/_]+\w?\.(jpg|png|gif)%i'; | |
| if(preg_match_all($regex, $buffer, $matches, PREG_SET_ORDER)) { | |
| foreach($matches as $match) { | |
| $hashfile = 'flickr.static.' . md5($match[0]) . '.' . $match[1]; | |
| if(!file_exists(HABARI_PATH . '/user/files/' . $hashfile)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PREFIX terms:<http://wiktionary.dbpedia.org/terms/> | |
| PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> | |
| PREFIX dc:<http://purl.org/dc/elements/1.1/> | |
| SELECT ?swordRes ?sword ?slang ?spos | |
| FROM <http://wiktionary.dbpedia.org> | |
| WHERE { | |
| ?swordRes rdfs:label ?sword . | |
| ?swordRes dc:language <http://wiktionary.dbpedia.org/terms/English> . | |
| ?swordRes dc:language ?slang . | |
| ?swordRes terms:hasPoS ?spos . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function test_scrape_allconsuming() { | |
| $out = array(); | |
| for($x = 1;$x <= 43; $x++) { | |
| $p = file_get_contents('http://www.allconsuming.net/person/mikelietz/consumed/book?page=' . $x); | |
| $h = \Habari\HTMLDoc::create($p); | |
| foreach($h->find('strong a') as $node) { | |
| if(preg_match('#^/item/view/#', $node->href, $matches)) { | |
| $p = file_get_contents('http://www.allconsuming.net' . $node->href); | |
| $h2 = \Habari\HTMLDoc::create($p); | |
| $as = $h2->find('a'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function action_before_act_admin( ) { | |
| $this->add_template('dashboard', dirname(__FILE__) . '/templates/dash.php', true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form->insert($form->label_for_habari_username, $inputs = FormControlFieldset::create('inputs')); | |
| $form->move_into($form->label_for_habari_username, $inputs); | |
| $form->move_into($form->label_for_habari_password, $inputs); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function action_modify_form_habari_login(FormUI $form) { | |
| // Remove the reset message | |
| $form->remove($form->reset_message); | |
| // Create a ul wrapper that wraps its children in li's | |
| $buttons = $form->append(FormControlWrapper::create('buttons')->set_setting('wrap_element', 'ul')->set_setting('wrap_each', '<li>%s</li>')); | |
| // Move the login button from the dropbutton to the button wrapper we just created | |
| $form->move_into($form->login, $buttons); | |
| // Remove the dropbutton | |
| $form->remove($form->submit_button); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function filter_list_unit_tests($tests) | |
| { | |
| $unit_tests = glob(dirname(__FILE__). '/units/test_*.php'); | |
| $tests = array_merge($tests, $unit_tests); | |
| return $tests; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Add objects or functions to the post-processing queue, executed via self::process_queue() | |
| * @param QueryRecord|Callable $fn A QueryRecord to call ->update() on, or a function to execute | |
| * @param null|string $name An index to save the queue under, defaults to the SPL object hash for objects | |
| */ | |
| public static function queue($fn, $name = null) | |
| { | |
| if(is_null($name) && is_object($fn)) { | |
| $name = spl_object_hash($fn); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| FormUI::register('registered_form', function(FormUI $form) { | |
| $wrap = $form->append(FormControlWrapper::create('wrap')->set_wrap_each('<div>%s</div>')); | |
| $wrap->append(FormControlLabel::wrap('Sample 1:', new FormControlText('sample1', 'sample1'))); | |
| $wrap->append(FormControlLabel::wrap('Right-side label', new FormControlText('sample2', 'sample2'))->set_template('control.label.onright')); | |
| $wrap->append(FormControlLabel::wrap('Custom right-side label', new FormControlText('sample3', 'sample3'))->set_template_html(function($theme, $control) { | |
| return $theme->content . '<label ' . $theme->_attributes . '>' . $theme->label . '</label>'; | |
| })); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * tiger in the snow (HTML5) | |
| */ | |
| figure { | |
| min-width: 178px; | |
| /** outline: solid 1px red; /* uncomment rule to see figure outline */ | |
| position: relative; | |
| } | |
| img { | |
| max-width: 100%; |