public function run(tubepress_api_event_EventInterface $event) { $errors = array(); $justSubmitted = false; /* are we updating? */ if ($_SERVER['REQUEST_METHOD'] === 'POST' && $this->_httpRequestParams->hasParam('tubepress_save')) { $justSubmitted = true; $errors = $this->_form->onSubmit(); } echo $this->_form->getHtml($errors, $justSubmitted); }
/** * Filter the content (which may be empty). */ public function onAction_admin_enqueue_scripts(tubepress_api_event_EventInterface $eventInterface) { $args = $eventInterface->getSubject(); $hook = $args[0]; /* only run on TubePress settings page */ if ($hook !== 'settings_page_tubepress') { return; } $callback = array($this, '__callbackConvertToWpUrlString'); $cssUrls = $this->_form->getUrlsCSS(); $jsUrls = $this->_form->getUrlsJS(); $cssStrings = array_map($callback, $cssUrls); $jsStrings = array_map($callback, $jsUrls); for ($x = 0; $x < count($cssStrings); $x++) { $this->_wpFunctions->wp_register_style('tubepress-' . $x, $cssStrings[$x]); $this->_wpFunctions->wp_enqueue_style('tubepress-' . $x); } for ($x = 0; $x < count($jsStrings); $x++) { $this->_wpFunctions->wp_register_script('tubepress-' . $x, $jsStrings[$x]); $this->_wpFunctions->wp_enqueue_script('tubepress-' . $x, false, array(), false, false); } }