/** * Method to get the field input markup for the file field. * Field attributes allow specification of a maximum file size and a string * of accepted file extensions. * * @return string The field input markup. * * @note The field does not include an upload mechanism. * @see JFormFieldFile */ protected function getInput() { // Initialize some field attributes. $accept = $this->element['accept'] ? ' accept="' . (string) $this->element['accept'] . '"' : ''; $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $readonly = (string) $this->element['readonly']; $value = $this->value; $width = $this->element['width'] ? $this->element['width'] : 150; $height = $this->element['height'] ? $this->element['height'] : 150; $crop = $this->element['crop'] ? $this->element['crop'] : 1; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; if ($readonly != 'false' && $readonly) { return JHtml::image($this->value, $this->name, array('width' => 150)); } else { $html = ''; if ($this->value) { $html .= '<div class="image-' . $this->id . '">' . JHtml::image(AKHelper::_('thumb.resize', $this->value, $width, $height, $crop), $this->name, array()) . '</div>'; } $html .= '<input type="file" name="' . $this->getName($this->element['name'] . '_upload') . '" id="' . $this->id . '"' . ' value=""' . $accept . $disabled . $class . $size . $onchange . ' />'; $html .= '<label><input type="checkbox" name="' . $this->getName($this->element['name'] . '_delete') . '" id="' . $this->id . '"' . ' value="1" />' . JText::_('JACTION_DELETE') . '</label>'; $html .= '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '" />'; return $html; } }
function setTitle() { $easyset = AKEasyset::getInstance(); $doc = JFactory::getDocument(); $config = JFactory::getConfig(); $siteName = $config->get('sitename'); $view = JRequest::getVar('view'); $title = $doc->getTitle(); // fix for YOOTheme $title = explode('|', $title); $title = $title[0]; if (AKHelper::isHome()) { $easyset->_siteTitle = $config->get('sitename'); } else { $separator = trim($easyset->params->get('titleSeparator')); $replace['{%SITE%}'] = $siteName; $replace['{%TITLE%}'] = $title; if ('category' == $view || 'categories' == $view) { $replace['{%CATEGORY%}'] = ''; } else { $replace['{%CATEGORY%}'] = $easyset->_catName; } $siteTitle = strtr($easyset->params->get('titleFix'), $replace); $siteTitle = explode('|', $siteTitle); foreach ($siteTitle as $k => $v) { if (!trim($v)) { unset($siteTitle[$k]); continue; } $siteTitle[$k] = trim($siteTitle[$k]); } $siteTitle = implode(" {$separator} ", $siteTitle); $easyset->_siteTitle = $siteTitle; } }
/** * Overloaded bind function to pre-process the params. * * @param array Named array * * @return null|string null is operation was satisfactory, otherwise returns an error * @see JTable::bind */ public function bind($array, $ignore = '') { // For Fields group // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data. // ========================================================================================== $data = array(); $array = AKHelper::_('array.pivotFromTwoDimension', $array); // Set field['param_xxx'] to params // ========================================================================================== if (empty($array['params'])) { $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array())); } // Set params to JRegistry // ========================================================================================== if (isset($array['params']) && is_array($array['params'])) { $registry = new JRegistry(); $registry->loadArray($array['params']); $array['params'] = (string) $registry; } // Bind the rules. // ========================================================================================== if (isset($array['rules']) && is_array($array['rules'])) { $rules = new JAccessRules($array['rules']); $this->setRules($rules); } return parent::bind($array, $ignore); }
/** * Configure the Linkbar. */ public static function addSubmenu($vName = '') { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $app = JFactory::getApplication(); $menus = array(); // Add Category Menu Item if ($app->isAdmin()) { $menus['category'] = array('title' => JText::_('JCATEGORY'), 'url' => 'index.php?option=com_categories&extension=com_webgallery', 'active' => $vName == 'categories'); } // Add View List Menu Items $folders = JFolder::folders(JPATH_ADMINISTRATOR . '/components/com_webgallery/views'); foreach ($folders as $folder) { // Only show ViewList if (substr($folder, -2) == 'es' || substr($folder, -1) == 's') { $menus[$folder] = array('title' => AKHelper::_('system.getConfig', 'system.development_mode', false, 'com_webgallery') ? ucfirst($folder) . ' ' . JText::_('COM_WEBGALLERY_TITLE_LIST') : JText::_('COM_WEBGALLERY_' . strtoupper($folder) . '_TITLE'), 'url' => 'index.php?option=com_webgallery&view=' . $folder, 'active' => $vName == $folder); } } // Trigger for plugin $app->triggerEvent('onAddSubmenu', array('com_webgallery.panel', &$menus)); // AddSubmenu foreach ($menus as $menu) { self::addSubmenuEntry($menu['title'], $menu['url'], $menu['active']); } }
function tranAlias($easyset) { // set translate language $SourceLan = $easyset->params->get('originLan'); $ResultLan = $easyset->params->get('tranLlan', 'en'); // get query $post = JRequest::get('post'); if (!isset($post['jform']) || !isset($post['jform']['alias'])) { return; } $alias = $post['jform']['alias']; $title = $post['jform']['title']; $titleTmp = explode('::', $post['jform']['title']); if (!empty($titleTmp[1])) { $title = $titleTmp[0]; $alias = JFilterOutput::stringURLSafe($titleTmp[1]); } if (trim($alias) == '') { $alias = AKHelper::_('lang.translate', $title, $SourceLan, $ResultLan); $alias = trim($alias); $alias = JFilterOutput::stringURLSafe($alias); $replace = array('aquot' => '', 'a39' => '', '--' => '-'); $alias = strtr($alias, $replace); $alias = trim($alias, '-'); } $post['jform']['alias'] = $alias; $post['jform']['title'] = $title; $input = JFactory::getApplication()->input; JRequest::setVar('jform', $post['jform'], 'method', true); $input->post->set('jform', $post['jform']); $input->request->set('jform', $post['jform']); }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ public function getInput() { if (JVERSION < 3) { AKHelper::_('include.addCSS', 'buttons/delicious-buttons/delicious-buttons.css', 'ww'); } $a = ' <a style="float: left; margin-left: 10px;" class="akmarkdown-help-button btn btn-small delicious light green-pastel" href="http://markitup.jaysalvat.com/examples/" target="_blank">' . JText::_('JHELP') . '</a>'; return '<div class="akmarkdown-help-wrap pull-left fltlft">' . parent::getInput() . '</div>' . $a; }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * Recognized key values include 'name', 'group', 'params', 'language' * (this list is not meant to be comprehensive). * * @since 1.5 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); $this->app = JFactory::getApplication(); AKHelper::_('include.addCSS', 'windwalker-admin.css', 'ww'); self::$instance = $this; }
/** * Set a modal button. */ public static function modal($title = 'JTOOLBAR_BATCH', $selector = 'myModal', $icon = 'checkbox-partial') { AKHelper::_('ui.modal', $selector); $bar = JToolbar::getInstance('toolbar'); $title = JText::_($title); $option = array('class' => 'btn btn-small ' . $selector . '-link', 'icon' => JVERSION >= 3 ? 'icon-' . $icon : $icon); $dhtml = AKHelper::_('ui.modalLink', $title, $selector, $option); $bar->appendButton('Custom', $dhtml, 'batch'); }
/** * Magic method to call all method exists in JText, and add 'COM_COMPONENT_' before every language key. * * Not recommend use this class now. * * @param string The method name. * @param array All arguements. * * @return mixed Return from JText methods. */ static function __callStatic($name, $args) { $option = AKHelper::_('path.getOption'); if (!$option) { $option = JRequest::getVar('option'); } $args[0] = strtoupper(strtoupper($option) . '_' . $args[0]); return call_user_func_array(array('JText', $name), $args); }
/** * createInfoBox * * @param $context * @param $article * @param $params * * @return string */ public static function createInfoBox($context, $article, $params) { $input->{$option} = JRequest::getVar('option'); $view = JRequest::getVar('view'); $layout = JRequest::getVar('layout', 'default'); if ($option != 'com_content' || $view != 'article' || $layout != 'default') { return; } // Include Component Core include_once JPATH_ADMINISTRATOR . '/components/com_userxtd/includes/core.php'; $ux = plgSystemUserxtd::getInstance(); $param = $ux->params; $app = JFactory::getApplication(); $doc = JFactory::getDocument(); UXHelper::_('lang.loadLanguage', 'com_userxtd', 'admin'); if ($app->isAdmin()) { return; } // init params $image_field = $param->get('UserInfo_ImageField', 'BASIC_AVATAR'); $title_field = $param->get('UserInfo_TitleField', 'name'); $about_field = $param->get('UserInfo_AboutField', 'BASIC_ABOUT'); $website_field = $param->get('UserInfo_WebiteField', 'BASIC_WEBSITE'); $width = $param->get('UserInfo_ImageWidth', 150); $height = $param->get('UserInfo_ImageHeight', 150); $crop = $param->get('UserInfo_ImageCrop', 1); $include_css = $param->get('UserInfo_IncludeCSS_Article', 1); // Include CSS if ($include_css) { $doc->addStyleSheet('administrator/components/com_userxtd/includes/bootstrap/css/bootstrap.min.css'); $doc->addStyleSheet('components/com_userxtd/includes/css/userxtd-userinfo.css'); } // handle params $user = UXFactory::getUser($article->created_by); $image = $user->get($image_field); $image = AKHelper::_('thumb.resize', $image, $width, $height, $crop); $link = JRoute::_('index.php?option=com_userxtd&view=user&id=' . $user->get('id')); $link = JHtml::link($link, JText::_('COM_USERXTD_USER_INFO_MORE')); $website_link = $user->get($website_field); $website_link = $website_link ? JHtml::link($website_link, JText::_('COM_USERXTD_USER_INFO_WEBSITE')) : null; // Get Template override $tpl = $app->getTemplate(); $file = JPATH_THEMES . "/{$tpl}/html/plg_userxtd/content/userInfo.php"; if (!JFile::exists($file)) { $file = dirname(__FILE__) . '/tmpl/userInfo.php'; } // Start capturing output into a buffer ob_start(); // Include the requested template filename in the local scope include $file; // Done with the requested template; get the buffer and clear it. $html = ob_get_contents(); ob_end_clean(); return $html; }
/** * Get category link url by category id. * * @param integer $catid Category id to load Table. * @param boolean $absolute Ture to return whole absolute url. * * @return type */ public static function getCategoryLink($catid, $absolute = 0) { include_once JPATH_ROOT . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php'; $path = JRoute::_(ContentHelperRoute::getCategoryRoute($catid)); $host = str_replace('http://' . $_SERVER['HTTP_HOST'], '', JURI::root()); $path = str_replace($host, '', $path); if ($absolute) { return AKHelper::_('uri.pathAddHost', $path); } else { return $path; } }
/** * An ajax connector for QuickAdd JS. */ public function quickAddAjax() { // Init Variables $input = JFactory::getApplication()->input; $data = $input->post->get($input->get('formctrl'), array(), 'array'); $result = new JRegistry(); $result->set('Result', false); $model_name = $input->get('model_name'); $component = $input->get('component'); $extension = $input->get('extension'); // Include Needed Classes JControllerLegacy::addModelPath(JPATH_BASE . "/components/com_{$component}/models"); JForm::addFormPath(JPATH_BASE . "/components/com_{$component}/models/forms"); JForm::addFieldPath(JPATH_BASE . "/components/com_{$component}/models/fields"); JTable::addIncludePath(JPATH_BASE . "/components/com_{$component}/tables"); AKHelper::_('lang.loadLanguage', $extension, null); // Get Model $model = $this->getModel(ucfirst($model_name), ucfirst($component) . 'Model', array('ignore_request' => true)); // For WindWalker Component only if (is_callable(array($model, 'getFieldsName'))) { $fields_name = $model->getFieldsName(); $data = AKHelper::_('array.pivotToTwoDimension', $data, $fields_name); } // Get Form $form = $model->getForm($data, false); if (!$form) { $result->set('errorMsg', $model->getError()); jexit($result); } // Test whether the data is valid. $validData = $model->validate($form, $data); // Check for validation errors. if ($validData === false) { // Get the validation messages. $errors = $model->getErrors(); $errorMsg = is_string($errors[0]) ? $errors[0] : $errors[0]->getMessage(); $result->set('errorMsg', $errorMsg); jexit($result); } // Do Save if (!$model->save($validData)) { // Return Error Message. $result->set('errorMsg', JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError())); jexit($result); } // Set ID $data['id'] = $model->getstate($model_name . '.id'); // Set Result $result->set('Result', true); $result->set('data', $data); jexit($result); }
/** * Method to get the field input markup. * * @return string The field input markup. */ public function getInput() { static $form_setted = false; static $form; $this->getValues(); $this->addFieldJs(); $element = $this->element; $class = (string) $element['class']; $nolabel = (string) $element['nolabel']; $nolabel = $nolabel == 'true' || $nolabel == '1' ? true : false; // Get Field Form // ============================================================= if (!$form_setted) { // ParseValue $data = AKHelper::_('fields.parseAttrs', $this->value); $type = JRequest::getVar('field_type', 'text'); $form = null; // Loading form // ============================================================= JForm::addFormPath(AKPATH_FORM . '/forms/attr'); $form = null; // Event JFactory::getApplication()->triggerEvent('onCCKEngineBeforeFormLoad', array(&$form, &$data, &$this, &$element, &$form_setted)); $form = JForm::getInstance('fields', $type, array('control' => 'attrs'), false, false); // Event JFactory::getApplication()->triggerEvent('onCCKEngineAfterFormLoad', array(&$form, &$data, &$this, &$element, &$form_setted)); $form->bind($data); // Set Default for Options $default = JArrayHelper::getValue($data, 'default'); JRequest::setVar('field_default', $default, 'method', true); $form_setted = true; } $fieldset = (string) $element['fset']; $fieldset = $fieldset ? $fieldset : 'attrs'; $fields = $form->getFieldset($fieldset); $html = '<div class="' . $class . ' ak-cck-' . $fieldset . '">'; foreach ($fields as $field) { if (!$nolabel) { $html .= '<div class="control-group">'; $html .= ' <div class="control-label">' . $field->getLabel() . '</div>'; $html .= ' <div class="controls">' . $field->getInput() . '</div>'; $html .= '</div>'; } else { $html .= '<div class="control-group">'; $html .= $field->getInput(); $html .= '</div>'; } } $html .= '</div>'; return $html; }
/** * Method to display a view. * * @param boolean $cachable If true, the view output will be cached * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. * * @return JController This object to support chaining. * @since 1.5 */ public function display($cachable = false, $urlparams = false) { // Load the submenu. WebgalleryHelper::addSubmenu(JRequest::getCmd('view', 'items')); $view = JRequest::getCmd('view', 'items'); JRequest::setVar('view', $view); parent::display(); // Debug $doc = JFactory::getDocument(); if ((AKDEBUG || JDEBUG) && $doc->getType() == 'html') { echo '<hr style="clear:both;" />'; echo AKHelper::_('system.renderProfiler', 'WindWalker'); } return $this; }
/** * Display the view */ public function display($tpl = null) { $app = JFactory::getApplication(); $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); $this->fields_group = $this->get('FieldsGroup'); $this->fields = $this->get('FieldsName'); $this->canDo = AKHelper::getActions($this->option); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } parent::displayWithPanel($tpl); }
/** * Detect a view is nested table. * * @param string $name Table name. * @param string $option Component element. * * @return boolean is this table a nested table? */ public static function nested($name, $option = null) { if (!$option) { $option = AKHelper::_('path.getOption'); } $option = str_replace('com_', '', $option); if (isset(self::$nested[$option . '.' . $name])) { return self::$nested[$option . '.' . $name]; } JTable::addIncludePath(AKHelper::_('path.getAdmin') . '/components/' . $option . '/tables'); $table = JTable::getInstance($name, ucfirst($option) . 'Table'); if ($table instanceof JTableNested) { return self::$nested[$option . '.' . $name] = true; } else { return self::$nested[$option . '.' . $name] = false; } }
/** * Import a file by URI. * Example: "site://models/items" AS ROOT/components/com_component/models/items.php * <br /> OR "admin://includes/plugins/pro/pro" AS ROOT/administrator/components/com_component/includes/plugins/pro/pro.php * * @param string The file URI. * @param string Component option, eg: com_content. * * @return boolean Include success or not. */ public static function import($uri, $option = null) { $key = $uri; if (isset(self::$files[$key])) { return true; } $uri = explode('://', $uri); $root = AKHelper::_('path.get', $uri[0], $option); $path = $root . '/' . $uri[1] . '.php'; if (JFile::exists($path)) { include_once $path; self::$files[$key] = $path; return true; } else { return false; } }
/** * Update whole table. */ public static function update($name, $option = null) { $option = $option ? $option : AKHelper::_('path.getOption'); if (substr($option, 0, 4) == 'com_') { $component = substr($option, 4); } $model = JModelLegacy::getInstance(ucfirst($name), ucfirst($component) . 'Model', array('ignore_request' => true)); if (!$model instanceof AKRequestModelList) { JError::raiseWarning(500, ucfirst($component) . 'Model' . ucfirst($name) . " Not instance of AKRequestModelList."); return false; } if (!$model->update()) { JError::raiseWarning(500, $model->getError()); return false; } return true; }
/** * Display the view */ public function display($tpl = null) { $app = JFactory::getApplication(); $this->params = JComponentHelper::getParams('com_remoteimage'); $this->canDo = AKHelper::getActions($this->option); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } if (JRequest::getVar('tmpl') == 'component') { $this->modal = true; } else { $this->addToolbar(); } $this->notice(); parent::display($tpl); }
function gTranslate($text, $SourceLan, $ResultLan) { $url = new JURI(); // for APIv2 $url->setHost('https://www.googleapis.com/'); $url->setPath('language/translate/v2'); $query['key'] = 'AIzaSyC04nF4KXjfR2VQ0jsFm5vEd9LbyiXqbKw'; $query['q'] = urlencode($text); $query['source'] = $SourceLan; $query['target'] = $ResultLan; if (!$text) { return; } $url->setQuery($query); $url->toString(); $response = AKHelper::_('curl.getPage', $url->toString()); $json = new JRegistry($response); $r = $json->get('data.translations'); return $r[0]->translatedText; }
/** * Build an SQL query to load the list data. * * @return JDatabaseQuery * @since 1.6 */ protected function getListQuery() { static $executed; if (!$executed) { // Filter and Search $filter = $this->getState('filter', array()); $search = $this->getState('search', array()); $order = $this->getState('list.ordering', 'a.id'); // Key Mapping // ======================================================================== $map = AKHelper::_('system.getConfig', 'keyMap.' . $this->item_name); $filter = AKHelper::_('array.mapKey', $filter, $map); $search = AKHelper::_('array.mapKey', $search, $map); $order = !empty($map->{$order}) ? $map->{$order} : $order; $this->setState('filter', $filter); $this->setState('search', $search); $this->setState('list.ordering', $order); $executed = true; } }
/** * Get the columns from database table. * * @return mixed An array of the field names, or false if an error occurs. * * @since 11.1 */ public function getFields() { static $cache = null; if ($cache === null) { // Lookup the fields for this table only once. $fields = (array) AKHelper::_('system.getConfig', 'keyMap.' . $this->_tbl); if (empty($fields)) { $e = new JException(JText::_('JLIB_DATABASE_ERROR_COLUMNS_NOT_FOUND')); $this->setError($e); return false; } foreach ($fields as $key => &$field) { $obj = new StdClass(); $obj->Default = ''; $obj->Field = $key; $obj->Map = $field; $field = $obj; } $cache = $fields; } return $cache; }
/** * A proxy for call class and functions * * Example: $this->call('folder1.folder2.function', $args) ; * <br /> OR $this->call('folder1.folder2.Class::function', $args) * * @param string $uri The class or function file path. * */ public function call($uri) { // Split paths $path = explode('.', $uri); $func = array_pop($path); $func = explode('::', $func); // set class name of function name. if (isset($func[1])) { $class_name = $func[0]; $func_name = $func[1]; $file_name = $class_name; } else { $class_name = null; $func_name = $func[0]; $file_name = $func_name; } $func_path = implode('/', $path) . '/' . $file_name; $include_path = dirname(__FILE__) . '/lib'; // include file. if (!function_exists($func_name) && !class_exists($class_name)) { $file = AKHelper::_('path.getAdmin') . '/class/' . $func_path . '.php'; if (!file_exists($file)) { $file = dirname(__FILE__) . '/lib/' . $func_path . '.php'; } if (file_exists($file)) { include_once $file; } } // Handle args $args = func_get_args(); array_shift($args); // Call Function if (isset($class_name) && is_callable(array($class_name, $func_name))) { return call_user_func_array(array($class_name, $func_name), $args); } elseif (function_exists($func_name)) { return call_user_func_array($func_name, $args); } }
/** * Attach one inner-plugin. * * @param string $name Plugin name. * * @return boolean Attach success or not. */ public static function attachPlugin($name) { $app = JFactory::getApplication(); $path = AKHelper::_('path.getAdmin') . "/includes/plugins/{$name}/{$name}.php"; $option = JRequest::getVar('option'); $config['params'] = JComponentHelper::getParams($option); if (JFile::exists($path)) { include_once $path; $dispatcher = JDispatcher::getInstance(); $class_name = 'plg' . ucfirst(str_replace('com_', '', $option)) . ucfirst($name); if (class_exists($class_name)) { $plugin = new $class_name($dispatcher, $config); $dispatcher->attach($plugin); self::$plugins[$name] = $plugin; self::$version[$name] = true; return true; } else { return false; } } else { return false; } }
function setMeta($article, $easyset) { if ($easyset->app->isAdmin()) { return; } static $first_article = true; if (!$first_article) { return; } $doc = JFactory::getDocument(); $config = JFactory::getConfig(); if (AKHelper::isHome()) { $easyset->_metaDesc = $config->get('MetaDesc'); } else { $metaDesc = $article->text; $metaDesc = strip_tags($metaDesc); $metaDesc = trim($metaDesc); $metaDesc = JString::substr($metaDesc, 0, $easyset->params->get('maxMetaChar', 250)); $easyset->_metaDesc = $metaDesc; } //if($easyset->params->get('getMeta')) $doc->setDescription('123123123'); $first_article = false; }
/** * Set a URL for browser redirection. * * @param string $url URL to redirect to. * @param string $msg Message to display on redirect. Optional, defaults to value set internally by controller, if any. * @param string $type Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage. * * @return JController This object to support chaining. */ public function setRedirect($url, $msg = null, $type = null) { $task = $this->getTask(); $redirect_tasks = $this->redirect_tasks; if (!$this->redirect) { $this->redirect = AKHelper::_('uri.base64', 'decode', JRequest::getVar('return')); } if ($this->redirect && in_array($task, $redirect_tasks)) { return parent::setRedirect($this->redirect, $msg, $type); } else { return parent::setRedirect($url, $msg, $type); } }
function setContentMeta($article, $easyset) { $metaDesc = null; // This function just need execute one time. static $first_article = true; if (!$first_article) { return; } $doc = JFactory::getDocument(); $config = JFactory::getConfig(); // get menu meta, if nonexists, use article meta if (isset($article->params) && $article->params instanceof JRegistry && isset($article->metadesc)) { $metaDesc = $article->params->get('menu-meta_description', $article->metadesc); } // get meta if (AKHelper::isHome()) { $easyset->_metaDesc = $config->get('MetaDesc'); } elseif ($metaDesc) { $easyset->_metaDesc = $metaDesc; $article->metadesc = ''; } else { // get meta from article content $metaDesc = $article->text; $metaDesc = strip_tags($metaDesc); $metaDesc = preg_replace('/\\{.*\\}/', '', $metaDesc); // filter plgin like:{rsform 1} // remove line $metaDesc = str_replace("\r\n", '', $metaDesc); $metaDesc = str_replace(" ", '', $metaDesc); $metaDesc = trim($metaDesc); $metaDesc = JString::substr($metaDesc, 0, $easyset->params->get('maxMetaChar', 250)); // remove latest word $metaDesc = trim($metaDesc); $metaDesc = explode(' ', $metaDesc); $latestWord = array_pop($metaDesc); if (strlen($latestWord) > 10) { $metaDesc[] = $latestWord; } $metaDesc = implode(' ', $metaDesc); // rebuild paragraph $easyset->_metaDesc = $metaDesc; } // save article and category data to easyset $view = JRequest::getVar('view'); $cat_table = JPath::clean(JPATH_ROOT . '/libraries/joomla/database/table/category.php'); if (JFile::exists($cat_table)) { include_once $cat_table; } $cat = JTable::getInstance('Category'); if ('category' == $view || 'categories' == $view) { $cat->load(JRequest::getVar('id')); $easyset->_catName = $cat->title; // Set default metadesc if exists. if ($cat->metadesc) { $easyset->_metaDesc = $cat->metadesc; } } elseif ('article' == $view) { $cat->load($article->catid); $easyset->_catName = $cat->title; } $easyset->category = $cat; $easyset->article = $article; $first_article = false; }
/** * Get fields from search XML file. * * @return array fields name. */ public function getFullSearchFields() { $file = AKHelper::_('path.get', null, $this->option) . '/models/forms/' . $this->list_name . '/search.xml'; $file = JFile::exists($file) ? $file : AKHelper::_('path.get', null, $this->option) . '/models/forms/' . $this->list_name . '_search.xml'; $xml = simplexml_load_file($file); $field = $xml->xpath('//field[@name="field"]'); $options = $field[0]->option; $fields = array(); foreach ($options as $option) { $attr = $option->attributes(); $fields[] = $attr['value']; } return $fields; }
* * @copyright Copyright (C) 2012 Asikart. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Generated by AKHelper - http://asikart.com */ // no direct access defined('_JEXEC') or die; $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); // Include Helpers // ======================================================================== // Core init, it can use by module, plugin or other component. include_once JPath::clean(JPATH_ADMINISTRATOR . "/components/com_webgallery/includes/core.php"); // Set default option to path helper, then AKHelperPath will helpe us get admin path. AKHelper::_('path.setOption', 'com_webgallery'); // Some useful settings if ($app->isSite()) { // Include Admin language as global language. $lang->load('', JPATH_ADMINISTRATOR); $lang->load('com_webgallery', JPATH_COMPONENT_ADMINISTRATOR); WebgalleryHelper::_('lang.loadAll', $lang->getTag()); // Include Joomla! admin css WebgalleryHelper::_('include.sortedStyle', 'includes/css'); // set Base to fix toolbar anchor bug $doc->setBase(JFactory::getURI()->toString()); } else { WebgalleryHelper::_('lang.loadAll', $lang->getTag()); WebgalleryHelper::_('include.sortedStyle', 'includes/css'); } // Include Fields
} } // Include WindWalker from libraries or component self. // =============================================================== if (!defined('AKPATH_ROOT')) { $inner_ww_path = JPATH_ADMINISTRATOR . "/components/com_remoteimage/windwalker"; $lib_ww_path = JPATH_LIBRARIES . '/windwalker'; if (file_exists($lib_ww_path . '/init.php')) { // From libraries $ww_path = $lib_ww_path; } else { // From Component folder $ww_path = $inner_ww_path; } // Init WindWalker // =============================================================== if (!file_exists($ww_path . '/init.php')) { $message = 'Please install WindWalker Framework libraries.'; throw new Exception($message, 500); } include_once $ww_path . '/init.php'; } else { include_once AKPATH_ROOT . '/init.php'; } include_once JPath::clean(JPATH_ADMINISTRATOR . "/components/com_remoteimage/helpers/remoteimage.php"); include_once JPath::clean(JPATH_ADMINISTRATOR . "/components/com_remoteimage/includes/loader.php"); // Set Component helper prefix, and AKProxy can use component helper first. // If component helper and methods not exists, AKProxy will call AKHelper instead. AKHelper::setPrefix('RemoteimageHelper'); AKHelper::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_remoteimage/helpers');