type = "textarea"; $o->value = $subject; $obj->colorsVariables = $o; $obj->showCustomCSS = true; * */ //$obj->showButtonNotification = false; $obj->categoriesTopButtons = false; $obj->categoriesTopButtonsShowOnlyOnFirstPage = true; $obj->categoriesTopButtonsShowVideosCount = false; $obj->categoriesTopButtonsFluid = true; $o = new stdClass(); $o->type = array(0 => '-- ' . __("Random")) + self::getLoadersArray(); $o->value = 'avideo'; $obj->pageLoader = $o; return $obj; } static function getLoadersArray() { $files = Layout::getLoadersFiles(); $response = array(); foreach ($files as $key => $value) { $response[$value['name']] = ucfirst($value['name']); } return $response; } static function getLoadersFiles() { global $global; $files = _glob($global['systemRootPath'] . 'plugin/Layout/loaders/', '/.*html/'); $response = array(); foreach ($files as $key => $value) { $name = str_replace('.html', '', basename($value)); $response[$name] = array('path' => $value, 'name' => $name); } return $response; } static public function getLoader($file) { global $global; $files = self::getLoadersFiles(); $name = ''; if (!empty($file)) { foreach ($files as $key => $value) { if ($file == $value['name']) { $name = $value['name']; break; } } } if (empty($name)) { $rand_key = array_rand($files); $name = $files[$rand_key]['name']; } $content = file_get_contents($global['systemRootPath'] . 'plugin/Layout/loaders/' . $name . '.html'); return trim(preg_replace('/\s+/', ' ', str_replace('lds-', 'lds-' . uniqid(), $content))); } static function getLoaderDefault() { global $_getLoaderDefault; if (!isset($_getLoaderDefault)) { $obj = AVideoPlugin::getObjectData('Layout'); $loader = Layout::getLoader($obj->pageLoader->value); //$loader = Layout::getLoader('spinner'); $parts = explode('', $loader); if (preg_match('/style/', $parts[0])) { $parts[0] .= ''; } $_getLoaderDefault = array('css' => $parts[0], 'html' => $parts[1]); } return $_getLoaderDefault; } static function getBGAnimationFiles() { global $global; $files = _glob($global['systemRootPath'] . 'plugin/Layout/animatedBackGrounds/', '/.*php/'); $response = array(); foreach ($files as $key => $value) { $name = basename($value); if($name === 'index.php'){ continue; } $name = str_replace('.php', '', $name); $response[$name] = array('path' => $value, 'name' => $name); } return $response; } static function includeBGAnimationFile($file) { if (empty($file)) { return false; } $files = self::getBGAnimationFiles(); if ($file == 1) { $f = $files[array_rand($files)]; echo ''; include $f['path']; } foreach ($files as $key => $value) { if ($file == $value['name']) { include $value['path']; break; } } return true; } public function getPluginMenu() { global $global; return ""; $filename = $global['systemRootPath'] . 'plugin/Customize/pluginMenu.html'; return file_get_contents($filename); } public function getHeadCode() { global $global; $loaderParts = self::getLoaderDefault(); echo $loaderParts['css']; echo ""; return false; } static function getIconsList() { global $global; include $global['systemRootPath'] . 'plugin/Layout/fontAwesomeFAB.php'; // Fetch variables scss file in variable $font_vars = file_get_contents($global['systemRootPath'] . 'node_modules/@fortawesome/fontawesome-free/scss/_variables.scss'); // Find the position of first $fa-var , as all icon class names start after that $pos = strpos($font_vars, '$fa-var'); // Filter the string and return only the icon class names $font_vars = substr($font_vars, $pos); // Create an array of lines $lines = explode("\n", $font_vars); $fonts_list = array(); foreach ($lines as $line) { // Discard any black line or anything without : if (strpos($line, ':') !== false) { // Icon names and their Unicode Private Use Area values are separated with : and hence, explode them. $t = explode(":", $line); // Remove the $fa-var with fa, to use as css class names. $className = str_replace('$fa-var-', '', $t[0]); if (!in_array($className, $font_awesome_brands)) { $classNameFull = "fa fa-{$className}"; } else { $classNameFull = "fab fa-{$className}"; } $fonts_list[$className] = array($className, $classNameFull, $t[1]); } } return $fonts_list; } static function getSelectSearchable($optionsArray, $name, $selected, $id = "", $class = "", $placeholder = false, $templatePlaceholder='') { global $global; $html = ""; if (empty($global['getSelectSearchable'])) { $html .= ''; $html .= ''; } if (empty($class)) { $class = "js-select-search"; } $html .= ''; // this is just to display something before load the select2 if(empty($templatePlaceholder)){ $html .= ''; }else{ $html .= $templatePlaceholder; } $html .= ''; $global['getSelectSearchable'] = 1; return $html; } static function getIconsSelect($name, $selected = "", $id = "", $class = "") { global $getIconsSelect; $getIconsSelect = 1; $icons = self::getIconsList(); if (empty($id)) { $id = uniqid(); } $code = ""; self::addFooterCode($code); $code = ''; self::addFooterCode($code); return self::getSelectSearchable($icons, $name, $selected, $id, $class . " iconSelect", true); } static function getAvilableFlags() { global $global; $flags = array(); include_once $global['systemRootPath'].'objects/bcp47.php'; $files = _glob("{$global['systemRootPath']}locale", '/^[a-z]{2}(_.*)?.php$/'); foreach ($files as $filename) { $filename = basename($filename); $fileEx = basename($filename, ".php"); $name = $global['bcp47'][$fileEx]['label']; $flag = $global['bcp47'][$fileEx]['flag']; $flags[$fileEx] = array(json_encode(array('text'=>$name, 'icon'=>"flagstrap-icon flagstrap-{$flag}")), $fileEx, 'val3-'.$name); } return $flags; } static function getAllFlags() { global $global; $flags = array(); include_once $global['systemRootPath'].'objects/bcp47.php'; foreach ($global['bcp47'] as $key => $filename) { $name = $filename['label']; $flag = $filename['flag']; $flags[$key] = array(json_encode(array('text'=>$name, 'icon'=>"flagstrap-icon flagstrap-{$flag}")), $key, 'val3-'.$name); } return $flags; } static function getLangsSelect($name, $selected = "", $id = "", $class = "", $flagsOnly=false, $getAll=false) { global $getLangsSelect; $getLangsSelect = 1; if($getAll){ $flags = self::getAllFlags(); }else{ $flags = self::getAvilableFlags(); } if (empty($id)) { $id = uniqid(); } if($selected=='us'){ $selected = 'en_US'; } if(!empty($flags[$selected])){ $selectedJson = _json_decode($flags[$selected][0]); $selectedJsonIcon = $selectedJson->icon; }else{ $selectedJsonIcon = ''; } $code = ""; self::addFooterCode($code); if($flagsOnly){ $code = ''; }else{ $code = ''; } self::addFooterCode($code); $templatePlaceholder = '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . ''; return self::getSelectSearchable($flags, $name, $selected, $id, $class . " flagSelect", true, $templatePlaceholder); } static function getCategorySelect($name, $selected = "", $id = "", $class = "") { $rows = Category::getAllCategories(true, false); array_multisort(array_column($rows, 'hierarchyAndName'), SORT_ASC, $rows); $cats = array(); foreach ($rows as $value) { $cats[$value['id']] = htmlentities(" " . $value['hierarchyAndName']); } if (empty($id)) { $id = uniqid(); } $methodName = __FUNCTION__; $code = "'; self::addFooterCode($code); return self::getSelectSearchable($cats, $name, $selected, $id, $class, true); } static function getUserGroupsSelect($name, $selected = "", $id = "", $class = "") { $rows = UserGroups::getAllUsersGroupsArray(); if (empty($id)) { $id = uniqid(); } $methodName = __FUNCTION__; $code = "'; self::addFooterCode($code); return self::getSelectSearchable($rows, $name, $selected, $id, $class, true); } public function getFooterCode() { global $global; $obj = $this->getDataObject(); $content = ''; if (!empty($global['getSelectSearchable'])) { $content .= ''; // $content .= ''; } $content .= self::_getFooterCode(); return $content; } private static function addFooterCode($code) { global $LayoutaddFooterCode; if (!isset($LayoutaddFooterCode)) { $LayoutaddFooterCode = array(); } $LayoutaddFooterCode[] = $code; } private static function _getFooterCode() { global $LayoutaddFooterCode; if (!isset($LayoutaddFooterCode)) { return ""; } $LayoutaddFooterCode = array_unique($LayoutaddFooterCode); return implode(PHP_EOL, $LayoutaddFooterCode); } public function getHTMLMenuRight() { global $global; $obj = $this->getDataObject(); if (empty($obj->showButtonNotification)) { return false; } include $global['systemRootPath'] . 'plugin/Layout/menuRight.php'; } public function navBarAfter() { global $global; $obj = $this->getDataObject(); if(!AVideoPlugin::isEnabledByName('YouPHPFlix2') && !empty($obj->categoriesTopButtons)){ if(!empty($obj->categoriesTopButtonsShowOnlyOnFirstPage) && !isFirstPage()){ return ''; } include $global['systemRootPath'] . 'plugin/Layout/categoriesTopButtons.php'; } } }