protected function getOptions()
 {
     $element = $this->element;
     $options = array();
     $_plugin = $element['addon'] ? $element['addon'] : null;
     $_plugin_group = $element['addon_group'] ? $element['addon_group'] : 'mediatype';
     $param_filter = $element['param_name'] ? $element['param_name'] : null;
     if ($_plugin && $param_filter) {
         if ($plugin = TZ_Portfolio_PlusPluginHelper::getPlugin($_plugin_group, $_plugin, false)) {
             if (!empty($plugin->params)) {
                 $plg_params = new JRegistry();
                 $plg_params->loadString($plugin->params);
                 if ($image_size = $plg_params->get($param_filter)) {
                     if (!is_array($image_size) && preg_match_all('/(\\{.*?\\})/', $image_size, $match)) {
                         $image_size = $match[1];
                     }
                     foreach ($image_size as $i => $size) {
                         $_size = json_decode($size);
                         $options[$i] = new stdClass();
                         $options[$i]->text = $_size->{$element['param_text']};
                         $options[$i]->value = $_size->{$element['param_value']};
                     }
                 }
             }
         }
     }
     return array_merge(parent::getOptions(), $options);
 }
 protected function _getFieldTypes()
 {
     $data = array();
     $core_path = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . 'extrafields';
     if ($plg_ex = TZ_Portfolio_PlusPluginHelper::getPlugin('extrafields')) {
         $lang = JFactory::getLanguage();
         $field = $this->form->getData();
         $field = $field->toObject();
         foreach ($plg_ex as $i => $plg) {
             $folder = $plg->name;
             $core_f_xml_path = $core_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $folder . '.xml';
             if (JFile::exists($core_f_xml_path)) {
                 $core_class = 'TZ_Portfolio_PlusExtraField' . $folder;
                 if (!class_exists($core_class)) {
                     JLoader::import('com_tz_portfolio_plus.addons.extrafields.' . $folder . '.' . $folder, JPATH_SITE . DIRECTORY_SEPARATOR . 'components');
                 }
                 $core_class = new $core_class($field);
                 $data[$i] = new stdClass();
                 $data[$i]->value = $folder;
                 $core_class->loadLanguage($folder);
                 $key_lang = 'PLG_EXTRAFIELDS_' . strtoupper($folder) . '_TITLE';
                 if ($lang->hasKey($key_lang)) {
                     $data[$i]->text = JText::_($key_lang);
                 } else {
                     $data[$i]->text = (string) $folder;
                 }
             }
         }
     }
     return $data;
 }
Esempio n. 3
0
 public function __construct($field = null, $article = null, $option = array())
 {
     if (!is_object($field)) {
         return false;
     }
     if (count($option)) {
         if (isset($option['control'])) {
             $this->formcontrol = $option['control'];
         }
         if (isset($option['group'])) {
             $this->group = $option['group'];
         }
     }
     $this->id = $field->id;
     $app = JFactory::getApplication();
     if ($field->type) {
         $plugin = TZ_Portfolio_PlusPluginHelper::getPlugin('extrafields', $field->type);
         $this->plugin_params = new JRegistry($plugin->params);
     }
     if (isset($field->params) && !empty($field->params)) {
         $params = new JRegistry($field->params);
         if ($app->isSite()) {
             $this->params = $this->plugin_params->merge($params);
         } else {
             $this->params = $params;
         }
     } else {
         if ($app->isSite()) {
             $this->params = $this->plugin_params;
         } else {
             $this->params = new JRegistry();
         }
     }
     $this->fieldname = $field->type;
     $this->name = $this->formcontrol . '[' . $this->group . '][' . $this->id . ']';
     if ($this->multiple) {
         $this->name .= '[]';
     }
     $this->field = $field;
     $this->loadLanguage($field->type);
     return true;
 }
 protected function getOptions()
 {
     $element = $this->element;
     $options = array();
     $_plugin_group = $element['plugin_group'] ? $element['plugin_group'] : 'mediatype';
     if ($plugins = TZ_Portfolio_PlusPluginHelper::getPlugin($_plugin_group)) {
         $lang = JFactory::getLanguage();
         foreach ($plugins as $plugin) {
             $std = new stdClass();
             $std->value = $plugin->name;
             $lang->load('plg_' . $plugin->type . '_' . $plugin->name, COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . $plugin->type . DIRECTORY_SEPARATOR . $plugin->name);
             if ($lang->hasKey('PLG_' . $plugin->type . '_' . $plugin->name . '_TITLE')) {
                 $std->text = JText::_('PLG_' . $plugin->type . '_' . $plugin->name . '_TITLE');
             } else {
                 $std->text = $plugin->name;
             }
             $options[] = $std;
         }
     }
     return array_merge(parent::getOptions(), $options);
 }
Esempio n. 5
0
 protected function _childrenLayout(&$rows, $children, &$article, &$params, $dispatcher)
 {
     foreach ($children->children as $children) {
         $background = null;
         $color = null;
         $margin = null;
         $padding = null;
         $childRows = array();
         $class = null;
         $rowName = null;
         $responsive = null;
         if (isset($children->name) && $children->name) {
             $rowName = JApplication::stringURLSafe($children->name);
         }
         if (isset($children->{"class"}) && $children->{"class"}) {
             $class = $children->{"class"};
         }
         if (isset($children->responsive) && $children->responsive) {
             $class = $children->responsive;
         }
         if (isset($children->backgroundcolor) && $children->backgroundcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($children->backgroundcolor))) {
             $background = 'background: ' . $children->backgroundcolor . ';';
         }
         if (isset($children->textcolor) && $children->textcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($children->textcolor))) {
             $color = 'color: ' . $children->textcolor . ';';
         }
         if (isset($children->margin) && !empty($children->margin)) {
             $margin = 'margin: ' . $children->margin . ';';
         }
         if (isset($children->padding) && !empty($children->padding)) {
             $padding = 'padding: ' . $children->padding . ';';
         }
         if ($background || $color) {
             $this->document->addStyleDeclaration('
                     #tz-portfolio-template-' . ($rowName ? $rowName : '') . '-inner{
                         ' . $background . $color . $margin . $padding . '
                     }
                 ');
         }
         if (isset($children->linkcolor) && $children->linkcolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($children->linkcolor))) {
             $this->document->addStyleDeclaration('
                         #tz-portfolio-template-' . ($rowName ? $rowName : '') . '-inner a{
                             color: ' . $children->linkcolor . ';
                         }
                     ');
         }
         if (isset($children->linkhovercolor) && $children->linkhovercolor && !preg_match('/^rgba\\([0-9]+\\,\\s+?[0-9]+\\,\\s+?[0-9]+\\,\\s+?0\\)$/i', trim($children->linkhovercolor))) {
             $this->document->addStyleDeclaration('
                         #tz-portfolio-template-' . ($rowName ? $rowName : '') . '-inner a:hover{
                             color: ' . $children->linkhovercolor . ';
                         }
                     ');
         }
         foreach ($children->children as $children) {
             $html = null;
             if ($children->type && $children->type != 'none') {
                 if (in_array($children->type, $this->core_types)) {
                     $html = $this->loadTemplate($children->type);
                 } else {
                     $plugin = $children->type;
                     $layout = null;
                     if (strpos($children->type, ':') != false) {
                         list($plugin, $layout) = explode(':', $children->type);
                     }
                     if ($plugin_obj = TZ_Portfolio_PlusPluginHelper::getPlugin('content', $plugin)) {
                         $className = 'PlgTZ_Portfolio_PlusContent' . ucfirst($plugin);
                         if (!class_exists($className)) {
                             TZ_Portfolio_PlusPluginHelper::importPlugin('content', $plugin);
                         }
                         if (class_exists($className)) {
                             $registry = new JRegistry($plugin_obj->params);
                             $plgClass = new $className($dispatcher, array('type' => $plugin_obj->type, 'name' => $plugin_obj->name, 'params' => $registry));
                             if (method_exists($plgClass, 'onContentDisplayArticleView')) {
                                 $html = $plgClass->onContentDisplayArticleView('com_tz_portfolio_plus.' . $this->getName(), $this->item, $this->item->params, $this->state->get('list.offset'), $layout);
                             }
                         }
                         if (is_array($html)) {
                             $html = implode("\n", $html);
                         }
                     }
                 }
                 $html = trim($html);
             }
             if (!empty($html) || (!empty($children->children) and is_array($children->children))) {
                 if (!empty($children->{"col-lg"}) || !empty($children->{"col-md"}) || !empty($children->{"col-sm"}) || !empty($children->{"col-xs"}) || !empty($children->{"col-lg-offset"}) || !empty($children->{"col-md-offset"}) || !empty($children->{"col-sm-offset"}) || !empty($children->{"col-xs-offset"}) || !empty($children->{"customclass"}) || $children->responsiveclass) {
                     $childRows[] = '<div class="' . (!empty($children->{"col-lg"}) ? 'col-lg-' . $children->{"col-lg"} : '') . (!empty($children->{"col-md"}) ? ' col-md-' . $children->{"col-md"} : '') . (!empty($children->{"col-sm"}) ? ' col-sm-' . $children->{"col-sm"} : '') . (!empty($children->{"col-xs"}) ? ' col-xs-' . $children->{"col-xs"} : '') . (!empty($children->{"col-lg-offset"}) ? ' col-lg-offset-' . $children->{"col-lg-offset"} : '') . (!empty($children->{"col-md-offset"}) ? ' col-md-offset-' . $children->{"col-md-offset"} : '') . (!empty($children->{"col-sm-offset"}) ? ' col-sm-offset-' . $children->{"col-sm-offset"} : '') . (!empty($children->{"col-xs-offset"}) ? ' col-xs-offset-' . $children->{"col-xs-offset"} : '') . (!empty($children->{"customclass"}) ? ' ' . $children->{"customclass"} : '') . ($children->responsiveclass ? ' ' . $children->responsiveclass : '') . '">';
                 }
                 $childRows[] = $html;
                 if (!empty($children->children) and is_array($children->children)) {
                     $this->_childrenLayout($childRows, $children, $article, $params, $dispatcher);
                 }
                 if (!empty($children->{"col-lg"}) || !empty($children->{"col-md"}) || !empty($children->{"col-sm"}) || !empty($children->{"col-xs"}) || !empty($children->{"col-lg-offset"}) || !empty($children->{"col-md-offset"}) || !empty($children->{"col-sm-offset"}) || !empty($children->{"col-xs-offset"}) || !empty($children->{"customclass"}) || $children->responsiveclass) {
                     $childRows[] = '</div>';
                     // Close col tag
                 }
             }
         }
         if (count($childRows)) {
             $rows[] = '<div id="tz-portfolio-template-' . ($rowName ? $rowName : '') . '-inner" class="' . ($class ? $class : '') . ($responsive ? ' ' . $responsive : '') . '">';
             $rows[] = '<div class="row">';
             $rows = array_merge($rows, $childRows);
             $rows[] = '</div>';
             $rows[] = '</div>';
         }
     }
     return;
 }
Esempio n. 6
0
if ($_SERVER['HTTP_HOST'] != $check) {
    die;
}
define('DS', DIRECTORY_SEPARATOR);
define('JPATH_BASE', __DIR__ . DS . '..' . DS . '..' . DS . '..' . DS . '..' . DS . '..' . DS . '..');
require_once JPATH_BASE . DS . 'includes' . DS . 'defines.php';
require_once JPATH_BASE . DS . 'includes' . DS . 'framework.php';
jimport('joomla.database.database');
jimport('joomla.database.table');
$app = JFactory::getApplication('site');
$app->initialise();
$user = JFactory::getUser();
JLoader::import('com_tz_portfolio_plus.includes.framework', JPATH_ADMINISTRATOR . '/components');
// Register TZ_Portfolio_PlusPluginHelper class
tzportfolioplusimport('plugin.helper');
$plugin = TZ_Portfolio_PlusPluginHelper::getPlugin('content', 'vote');
$params = new JRegistry();
$params->loadString($plugin->params);
if ($params->get('access') == 1 && !$user->get('id')) {
    echo 'login';
} else {
    $user_rating = $app->input->getInt('user_rating');
    $cid = $app->input->getInt('cid');
    $db = JFactory::getDbo();
    if ($user_rating >= 1 && $user_rating <= 5) {
        $currip = $_SERVER['REMOTE_ADDR'];
        $query = $db->getQuery(true);
        $query->select('*');
        $query->from('#__tz_portfolio_plus_content_rating');
        $query->where('content_id = ' . $cid);
        $db->setQuery($query);
Esempio n. 7
0
 protected function _getViewHtml($context, &$article, $params, $layout = null)
 {
     list($extension, $vName) = explode('.', $context);
     $input = JFactory::getApplication()->input;
     $addon_id = $input->getInt('addon_id');
     $addon = TZ_Portfolio_PlusPluginHelper::getPlugin($this->_type, $this->_name);
     if (!$addon_id || $addon_id && $addon_id == $addon->id) {
         tzportfolioplusimport('controller.legacy');
         $result = true;
         // Check task with format: addon_name.addon_view.addon_task (example image.default.display);
         $adtask = $input->get('addon_task');
         if ($adtask && strpos($adtask, '.') > 0 && !$addon_id) {
             list($plgname, $adtask) = explode('.', $adtask, 2);
             if ($plgname == $this->_name) {
                 $result = true;
                 $input->set('addon_task', $adtask);
             } else {
                 $result = false;
             }
         }
         if ($result && ($controller = TZ_Portfolio_Plus_AddOnControllerLegacy::getInstance('PlgTZ_Portfolio_Plus' . ucfirst($this->_type) . ucfirst($this->_name), array('base_path' => COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . $this->_type . DIRECTORY_SEPARATOR . $this->_name)))) {
             tzportfolioplusimport('plugin.modelitem');
             $controller->set('addon', $addon);
             $controller->set('article', $article);
             $controller->set('trigger_params', $params);
             $task = $input->get('addon_task');
             if (!$task && !$addon_id) {
                 $input->set('addon_view', $vName);
                 $input->set('addon_layout', 'default');
                 if ($layout) {
                     $input->set('addon_layout', $layout);
                 }
             }
             $html = null;
             try {
                 ob_start();
                 $controller->execute($task);
                 $controller->redirect();
                 $html = ob_get_contents();
                 ob_end_clean();
             } catch (Exception $e) {
                 if ($e->getMessage()) {
                     JFactory::getApplication()->enqueueMessage('Addon ' . $this->_name . ': ' . $e->getMessage(), 'warning');
                 }
             }
             if ($html) {
                 $html = trim($html);
             }
             $input->set('addon_task', null);
             return $html;
         }
     }
 }