protected function getInput() { Document::addScript('/core/plugins/authentication/shibboleth/assets/js/admin.js'); Document::addStyleSheet('/core/plugins/authentication/shibboleth/assets/css/jquery-ui.css'); Document::addStyleSheet('/core/plugins/authentication/shibboleth/assets/css/admin.css'); $html = array(); $a = function ($str) { return str_replace('"', '"', $str); }; $val = json_decode($this->value, TRUE); $html[] = '<div class="shibboleth" data-iconify="' . $a(preg_replace('#^' . preg_quote(PATH_CORE) . '#', '', __FILE__)) . '">'; $html[] = '<p class="xml-source"><label>Shibboleth ID provider configuration file: <input type="text" name="xmlPath" value="' . $a($val['xmlPath']) . '" /></label></p>'; list($val['xmlRead'], $val['idps']) = self::getIdpList($val); $html[] = '<p class="info">Save your changes to retry loading ID providers from this file</p>'; $html[] = '<input type="hidden" class="serialized" name="' . $this->name . '" value="' . $a(json_encode($val)) . '" />'; $html[] = '</div>'; // rest of the form is managed on the client side return implode("\n", $html); }
<?php /** * Error Template * * Template used for Special Groups. Will now be auto-created * when admin switches group from type HUB to type Special. * * @author Christopher Smoak * @copyright December 2013 */ // define base path $base = str_replace(PATH_ROOT, '', __DIR__); // add stylesheets and scripts Document::addStyleSheet($base . DS . 'assets/css/main.css'); Document::addStyleSheet($base . DS . 'assets/css/error.css'); Document::addScript($base . DS . 'assets/js/main.js'); ?> <script> jQuery(document).ready(function(jq) { HUB.Modules.ReportProblems.initialize('.report'); }); </script> <div class="super-group-body-wrap group-<?php echo $this->group->get('cn'); ?> "> <div class="super-group-body error-page"> <div class="error-message"><?php echo $this->error->getMessage(); ?>
/** * Edit a type * * @return void */ public function editTask($row = null) { if ($row) { $this->view->row = $row; } else { // Incoming (expecting an array) $id = Request::getVar('id', array(0)); if (is_array($id)) { $id = $id[0]; } else { $id = 0; } // Load the object $this->view->row = new \Components\Publications\Tables\Category($this->database); $this->view->row->load($id); } // Set any errors if ($this->getError()) { $this->view->setError($this->getError()); } $this->view->config = $this->config; // Get all contributable master types $objMT = new \Components\Publications\Tables\MasterType($this->database); $this->view->types = $objMT->getTypes('alias', 1); // Push some styles to the template Document::addStyleSheet('components' . DS . $this->_option . DS . 'assets' . DS . 'css' . DS . 'publications.css'); // Output the HTML $this->view->display(); }
<div id="transcript-toolbar"> <div id="transcript-select"></div> <input type="text" id="transcript-search" placeholder="Search Transcript..." /> <a href="javascript:void(0);" id="font-bigger"></a> <a href="javascript:void(0);" id="font-smaller"></a> </div> <div id="transcripts"></div> </div> </div> <?php } elseif ($type == 'standalone') { ?> <?php $path = DS . trim(substr(PATH_APP, strlen(PATH_ROOT)), DS) . DS . ltrim($path . DS . $this->model->get('url'), DS); $ext = strtolower(Filesystem::extension(PATH_ROOT . $path)); Document::addStyleSheet('//releases.flowplayer.org/5.4.2/skin/minimalist.css'); Document::addScript('//releases.flowplayer.org/5.4.2/flowplayer.min.js'); ?> <div class="flowplayer"> <video id="movie<?php echo rand(0, 1000); ?> " preload controls> <?php switch ($ext) { case 'mov': case 'mp4': case 'm4v': echo '<source src="' . $path . '" type="video/mp4" />'; break; case 'ogg':
/** * Edit a type * * @return void */ public function editTask($row = null) { $this->view->setLayout('curation'); if ($row) { $this->view->row = $row; } else { // Incoming (expecting an array) $id = Request::getVar('id', array(0)); if (is_array($id)) { $id = $id[0]; } else { $id = 0; } // Load the object $this->view->row = new \Components\Publications\Tables\MasterType($this->database); $this->view->row->load($id); $this->view->curation = new \Components\Publications\Models\Curation($this->view->row->curation); // Get blocks model $blocksModel = new \Components\Publications\Models\Blocks($this->database); // Get available blocks $this->view->blocks = $blocksModel->getBlocks('*', " WHERE status=1", " ORDER BY ordering, id"); } // Set any errors if ($this->getError()) { $this->view->setError($this->getError()); } $this->view->config = $this->config; // Get all active categories $objC = new \Components\Publications\Tables\Category($this->database); $this->view->cats = $objC->getCategories(); // Push some styles to the template Document::addStyleSheet('components' . DS . $this->_option . DS . 'assets' . DS . 'css' . DS . 'publications.css'); Document::addScript('components' . DS . $this->_option . DS . 'assets' . DS . 'js' . DS . 'curation.js'); // Output the HTML $this->view->display(); }
/** * Event call to return data for a specific project * * @param object $model Project model * @param string $action Plugin task * @param string $areas Plugins to return data * @return array Return array of html */ public function onProject($model, $action = 'view', $areas = null) { $arr = array('html' => '', 'metadata' => '', 'message' => '', 'error' => ''); // Get this area details $this->_area = $this->onProjectAreas(); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (empty($this->_area) || !in_array($this->_area['name'], $areas)) { return; } } // Check authorization if ($model->exists() && !$model->access('member')) { return $arr; } // Model $this->model = $model; // Load component configs $this->_config = $model->config(); $this->gitpath = $this->_config->get('gitpath', '/opt/local/bin/git'); // Incoming $raw_op = Request::getInt('raw_op', 0); $action = $action ? $action : Request::getVar('action', 'list'); // Get this area details $this->_area = $this->onProjectAreas(); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (empty($this->_area) || !in_array($this->_area['name'], $areas)) { return $arr; } } $this->_database = App::get('db'); $this->_uid = User::get('id'); // Publishing? if ($action == 'browser') { return $this->browser(); } if ($action == 'select') { return $this->select(); } $act_func = 'act_' . $action; if (!method_exists($this, $act_func)) { if ($raw_op) { print json_encode(array('status' => 'success', 'data' => $table)); exit; } else { $act_func = 'act_list'; } } // detect CR as new line ini_set('auto_detect_line_endings', true); if ($raw_op) { $this->{$act_func}(); exit; } else { Document::addScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); Document::addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js'); Document::addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css'); Document::addScript('/core/plugins/projects/databases/res/main.js'); Document::addStyleSheet('/core/plugins/projects/databases/res/main.css'); if (file_exists(__DIR__ . '/res/ds.' . $action . '.js')) { Document::addScript('/core/plugins/projects/databases/res/ds.' . $action . '.js'); } if (file_exists(__DIR__ . '/res/ds.' . $action . '.css')) { Document::addStyleSheet('/core/plugins/projects/databases/res/ds.' . $action . '.css'); } return $this->{$act_func}(); } }
/** * Generate macro output * * @return string */ public function render() { //get the args passed in $content = $this->args; // args will be null if the macro is called without parenthesis. if (!$content) { return ''; } //declare the partial youtube embed url //$youtube_url = 'https://www.youtube.com/embed/'; $video_url = ''; //defaults $default_width = 640; $default_height = 380; $this->config = Component::params('com_wiki'); if ($this->filepath != '') { $this->config->set('filepath', $this->filepath); } //split up the args $args = array_map('trim', explode(',', $content)); $url = $args[0]; // We need to reset thinsg in case of multiple usage of macro $this->attr = array(); // Get single attributes // EX: [[Image(myimage.png, nolink, right)]] $argues = preg_replace_callback('/[, ](left|right|top|center|bottom|[0-9]+(px|%|em)?)(?:[, ]|$)/i', array(&$this, 'parseSingleAttribute'), $content); // Get quoted attribute/value pairs // EX: [[Image(myimage.png, desc="My description, contains, commas")]] $argues = preg_replace_callback('/[, ](alt|altimage|desc|title|width|height|align|border|longdesc|class|id|usemap|link)=(?:["\'])([^"]*)(?:["\'])/i', array(&$this, 'parseAttributeValuePair'), $content); // Get non-quoted attribute/value pairs // EX: [[Image(myimage.png, width=100)]] $argues = preg_replace_callback('/[, ](alt|altimage|desc|title|width|height|align|border|longdesc|class|id|usemap|link)=([^"\',]*)(?:[, ]|$)/i', array(&$this, 'parseAttributeValuePair'), $content); $width = isset($this->attr['width']) && $this->attr['width'] != '' ? $this->attr['width'] : $default_width; $height = isset($this->attr['height']) && $this->attr['height'] != '' ? $this->attr['height'] : $default_height; //check is user entered full youtube url or just Video Id if (!strstr($url, 'http')) { // File path, so assume local if (strstr($url, '/')) { $video_url = $url; } else { // Just a file name. $video_url = $this->_path($url); if (!file_exists($video_url)) { $video_url = $this->_path($url, true); if (!file_exists($video_url)) { return '(video:' . $url . ' not found)' . $this->_path($url); } } } } else { $video_url = $url; } // Default to local $type = 'local'; // YouTube if (stristr($video_url, 'youtube')) { $type = 'youtube'; if (strstr($video_url, '?')) { //split the string into two parts //uri and query string $full_url_parts = explode('?', $video_url); //split apart any key=>value pairs in query string $query_string_parts = explode("%26%2338%3B", urlencode($full_url_parts[1])); //foreach query string parts //explode at equals sign //check to see if v is the first part and if it is set the second part to the video id foreach ($query_string_parts as $qsp) { $pairs_parts = explode("%3D", $qsp); if ($pairs_parts[0] == 'v') { $video_id = $pairs_parts[1]; break; } } $video_url = 'https://www.youtube.com/embed/' . $video_id . '?wmode=transparent'; } } else { if (stristr($video_url, 'vimeo')) { $type = 'vimeo'; } else { if (stristr($video_url, 'blip')) { $type = 'blip'; } else { if (stristr($video_url, 'kaltura')) { $type = 'kaltura'; if (!stristr($video_url, 'iframeembed') && stristr($video_url, 'kmc')) { $partner_id = 0; $uiconf_id = 0; $entry_id = 0; $bits = explode('/', $video_url); foreach ($bits as $i => $bit) { if (strtolower($bit) == 'partner_id') { $partner_id = $bits[$i + 1]; } switch (strtolower($bit)) { case 'partner_id': $partner_id = $bits[$i + 1]; break; case 'uiconf_id': $uiconf_id = $bits[$i + 1]; break; case 'entry_id': $entry_id = $bits[$i + 1]; break; } } $video_url = 'https://www.kaltura.com/p/' . $partner_id . '/sp/' . $partner_id . '00/embedIframeJs/uiconf_id/' . $uiconf_id . '/partner_id/' . $partner_id . '?iframeembed=true&playerId=movie' . rand(0, 1000) . '&entry_id=' . $entry_id . '&flashvars[autoPlay]=false'; } } } } } // Create the embed // Local if ($type == 'local') { $ext = strtolower(Filesystem::extension($video_url)); Document::addStyleSheet('//releases.flowplayer.org/5.4.2/skin/minimalist.css'); Document::addScript('//releases.flowplayer.org/5.4.2/flowplayer.min.js'); $html = '<div class="flowplayer" style="width: ' . $width . 'px; height: ' . $height . 'px;">'; $html .= '<video id="movie' . rand(0, 1000) . '" width="' . $width . '" height="' . $height . '" preload controls>'; switch ($ext) { case 'mov': case 'mp4': case 'm4v': $html .= '<source src="' . $this->_link($url) . '" type="video/mp4" />'; break; case 'ogg': case 'ogv': $html .= '<source src="' . $this->_link($url) . '" type="video/ogg" />'; break; case 'webm': $html .= '<source src="' . $this->_link($url) . '" type="video/webm" />'; break; } $html .= '</video>'; $html .= '</div>'; } else { $html = '<iframe id="movie' . rand(0, 1000) . '" src="' . $video_url . '" width="' . $width . '" height="' . $height . '" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; } // Return the emdeded youtube video return $html; }
* Basic Template * * Template used for Special Groups. Will now be auto-created * when admin switches group from type HUB to type Special. * * @author Christopher Smoak * @copyright December 2012 */ // define base path (without doc root) $base = rtrim(str_replace(PATH_ROOT, '', __DIR__), DS); // define base url for links $baseLink = 'index.php?option=com_groups&cn=' . $this->group->get('cn'); // check to see if were supposed to no display html (template frame) $no_html = Request::getInt('no_html', 0); // add stylesheets and scripts Document::addStyleSheet($base . DS . 'assets/css/main.css'); Document::addScript($base . DS . 'assets/js/main.js'); ?> <?php if (!$no_html) { ?> <group:include type="content" scope="before" /> <div class="super-group-body-wrap group-<?php echo $this->group->get('cn'); ?> "> <div class="super-group-body"> <?php include_once 'includes/header.php';
/** * {xhub:include type="script" component="component" filename="filename"} * {xhub:include type="stylesheet" component="component" filename="filename"} * * @param string $options Tag options (e.g. 'component="support"') * @return string */ private function _include($options) { $regex = "/type\\s*=\\s*(\"|")(script|stylesheet)(\"|")/i"; if (!preg_match($regex, $options, $type)) { return ''; } $regex = "/filename\\s*=\\s*(\"|")([^\"&]+)(\"|")/i"; if (!preg_match($regex, $options, $file)) { return ''; } $regex = "/component\\s*=\\s*(\"|")([^\"&]+)(\"|")/i"; $template = App::get('template')->template; if ($file[2][0] == '/') { $filename = $file[2]; } else { if (preg_match($regex, $options, $component)) { $filename = $this->_templateDir() . '/html/' . $component[2] . '/' . $file[2]; //'templates/' . $template if (!file_exists(PATH_ROOT . $filename)) { $filename = substr(Component::path($component[2]), strlen(PATH_ROOT)) . '/' . $file[2]; } } else { $filename = $this->_templateDir() . '/'; //"/templates/$template/"; if ($type[2] == 'script') { $filename .= 'js/'; } else { $filename .= 'css/'; } $filename .= $file[2]; } } if (!file_exists(PATH_ROOT . $filename)) { return ''; } if ($type[2] == 'script') { Document::addScript(Request::base(true) . '/' . ltrim($filename, '/') . '?v=' . filemtime(PATH_ROOT . $filename)); } else { if ($type[2] == 'stylesheet') { Document::addStyleSheet(Request::base(true) . '/' . ltrim($filename, '/') . '?v=' . filemtime(PATH_ROOT . $filename), 'text/css', 'screen'); } } return ''; }
/** * Generate macro output * * @return string */ public function render() { //get the args passed in $content = $this->args; // args will be null if the macro is called without parenthesis. if (!$content) { return; } //generate a unique id for the slider $id = uniqid(); //get the group $gid = Request::getVar('cn'); //get the group object based on gid $group = \Hubzero\User\Group::getInstance($gid); //check to make sure we have a valid group if (!is_object($group)) { return; } //define a base url $base_url = DS . 'site' . DS . 'groups' . DS . $group->get('gidNumber'); //seperate image list into array of images $slides = explode(',', $content); //array for checked slides $final_slides = array(); //check each passed in slide foreach ($slides as $slide) { //check to see if image is external if (strpos($slide, 'http') === false) { $slide = trim($slide); //check if internal file actually exists if (is_file(PATH_APP . $base_url . DS . $slide)) { $final_slides[] = $base_url . DS . $slide; } } else { $headers = get_headers($slide); if (strpos($headers[0], "OK") !== false) { $final_slides[] = $slide; } } } $html = ''; $html .= '<div class="wiki_slider">'; $html .= '<div id="slider_' . $id . '">'; foreach ($final_slides as $fs) { $html .= '<img src="' . $fs . '" alt="" />'; } $html .= '</div>'; $html .= '<div class="wiki_slider_pager" id="slider_' . $id . '_pager"></div>'; $html .= '</div>'; Document::addStyleSheet('plugins/wiki/parserdefault/macros/macro-assets/slider/slider.css'); Document::addScript('plugins/wiki/parserdefault/macros/macro-assets/slider/slider.js'); Document::addScriptDeclaration(' jQuery(document).ready(function($) { $("#slider_' . $id . '").cycle({ fx: \'scrollHorz\', speed: 450, pager: \'#slider_' . $id . '_pager\' }); }); '); return $html; }
$this->css(); // Check for errors if ($this->getError()) { ?> <p class="error"><?php echo $this->getError(); ?> </p> <?php return; } Document::addScript('/core/plugins/projects/databases/res/dataTables/jquery.dataTables.js'); Document::addStyleSheet('/core/plugins/projects/databases/res/dataTables/jquery.dataTables.css'); Document::addStyleSheet('/core/plugins/projects/databases/res/chosen/chosen.css'); Document::addScript('/core/plugins/projects/databases/res/chosen/chosen.jquery.js'); Document::addStyleSheet('/core/plugins/projects/databases/res/spectrum/spectrum.css'); Document::addScript('/core/plugins/projects/databases/res/spectrum/spectrum.js'); ?> <div id="plg-header"> <h3 class="databases c-header"><a href="<?php echo Route::url('index.php?option=' . $this->option . '&active=databases&alias=' . $this->model->get('alias')); ?> "><?php echo Lang::txt('PLG_PROJECTS_DATABASES'); ?> </a> » <span class="indlist"><?php echo isset($this->db_id) ? Lang::txt('PLG_PROJECTS_DATABASES_UPDATE_DATABASE') : Lang::txt('PLG_PROJECTS_DATA_START'); ?> </span></h3> </div> <div id="prj-db-step-1" class="prj-db-step">
/** * Generate macro output * * @return string */ public function render() { //get the args passed in $content = $this->args; // args will be null if the macro is called without parenthesis. if (!$content) { return; } //generate a unique id for the slider $id = uniqid(); // null base url for now $base_url = ''; // needed objects $db = \App::get('db'); $option = \Request::getCmd('option'); $config = \Component::params($option); // define a base url switch ($option) { case 'com_groups': $cn = \Request::getVar('cn'); $group = Group::getInstance($cn); $base_url = DS . trim($config->get('uploadpath', 'site/groups'), DS) . DS; $base_url .= $group->get('gidNumber') . DS . 'uploads'; break; case 'com_resources': $row = new \Components\Resources\Tables\Resource($db); $row->load($this->pageid); $base_url = DS . trim($config->get('uploadpath', 'site/resources'), DS) . DS; $base_url .= \Components\Resources\Helpers\Html::build_path($row->created, $this->pageid, '') . DS . 'media'; break; } //seperate image list into array of images $slides = array_map('trim', explode(',', $content)); //array for checked slides $final_slides = array(); //check each passed in slide foreach ($slides as $slide) { //check to see if image is external if (strpos($slide, 'http') === false) { $slide = trim($slide); //check if internal file actually exists if (is_file(PATH_APP . $base_url . DS . $slide)) { $final_slides[] = $base_url . DS . $slide; } } else { $headers = get_headers($slide); if (strpos($headers[0], "OK") !== false) { $final_slides[] = $slide; } } } $html = ''; $html .= '<div class="wiki_slider">'; $html .= '<div id="slider_' . $id . '">'; foreach ($final_slides as $fs) { $html .= '<img src="' . $fs . '" alt="" />'; } $html .= '</div>'; $html .= '<div class="wiki_slider_pager" id="slider_' . $id . '_pager"></div>'; $html .= '</div>'; \Document::addStyleSheet('plugins/content/formathtml/macros/macro-assets/slider/slider.css'); \Document::addScript('plugins/content/formathtml/macros/macro-assets/slider/slider.js'); \Document::addScriptDeclaration(' var $jQ = jQuery.noConflict(); $jQ(function() { $jQ("#slider_' . $id . '").cycle({ fx: \'scrollHorz\', speed: 450, pager: \'#slider_' . $id . '_pager\' }); }); '); return $html; }