/**
  * Устанавливает панель инструментов.
  *
  * @return void
  */
 protected function addToolBar()
 {
     JToolBarHelper::title(JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLDS'), 'helloworld');
     if ($this->canDo->get('core.create')) {
         JToolBarHelper::addNew('helloworld.add');
     }
     if ($this->canDo->get('core.edit')) {
         JToolBarHelper::editList('helloworld.edit');
     }
     if ($this->canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolbarHelper::publish('helloworlds.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('helloworlds.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('helloworlds.archive');
     }
     if ($this->state->get('filter.state') == -2 && $this->canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'helloworlds.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($this->canDo->get('core.edit.state')) {
         JToolBarHelper::trash('helloworlds.trash');
     }
     if ($this->canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_helloworld');
     }
 }
Example #2
0
 /**
  * testGetInvalid
  *
  * @since 2.1.0
  */
 public function testGetInvalid()
 {
     /* result */
     $result = $this->_registry->get('invalidKey');
     /* compare */
     $this->assertEquals(null, $result);
 }
 /**
  * Get the requested Page.
  *
  * @access  public
  */
 public function getPage()
 {
     $_GET['act'] = empty($_GET['act']) ? '' : $_GET['act'];
     switch ($_GET['act']) {
         case 'lostpw':
             $this->showPasswordLost();
             break;
         case 'resetpw':
             $this->showPasswordReset();
             break;
         case 'verify':
             $this->verifyUserAccount();
             break;
         case 'captcha':
             $this->getCaptcha();
             break;
         default:
             $this->showLogin();
             break;
     }
     $this->objTemplate->setVariable('CONTREXX_CHARSET', CONTREXX_CHARSET);
     $endcode = $this->objTemplate->get();
     // replace links from before contrexx 3
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     $ls = new \LinkSanitizer($cx, $cx->getCodeBaseOffsetPath() . $cx->getBackendFolderName() . '/', $endcode);
     $endcode = $ls->replace();
     echo $endcode;
     exit;
 }
/**
 * 	Displays a EasyContactFormsCustomFormEntryFiles detailedMain view
 * 	record
 *
 * @param object $view
 * 	the EasyContactFormsCustomFormEntryFiles detailedMain view object
 * @param object $obj
 * 	a db object
 * @param int $i
 * 	record index
 * @param array $map
 * 	request data
 */
function getCustomFormEntryFilesDetailedMainViewRow($view, $obj, $i, $map)
{
    $obj->File = array('doctype' => 'CustomFormEntryFiles', 'docid' => $obj->get('id'), 'field' => 'File', 'tag' => 'a', 'content' => EasyContactFormsT::get('Download'));
    ?>
  <tr class='ufohighlight <?php 
    EasyContactFormsIHTML::getTrSwapClassName($i);
    ?>
'>
    <td class='firstcolumn'>
      <input type='checkbox' id='<?php 
    echo $view->idJoin('cb', $obj->getId());
    ?>
' value='off' class='ufo-deletecb' onchange='this.value=(this.checked)?"on":"off";'/>
    </td>
    <td>
      <?php 
    echo $obj->get('id');
    ?>
    </td>
    <td>
      <?php 
    echo $obj->get('Description');
    ?>
    </td>
    <td>
      <?php 
    EasyContactFormsIHTML::getFileDownloadLink($obj->File);
    ?>
    </td>
  </tr>
	<?php 
}
 /**
  * login() method return succeeded HTML message of connector
  *
  * @param $sData
  * @return string
  */
 protected function login($sData = '')
 {
     $sLink = '';
     // get back URI
     $sBackURI = self::$oSession->get('back');
     if (!empty($sBackURI)) {
         $sLink = urldecode($sBackURI);
     } else {
         if (version_compare(_PS_VERSION_, '1.4', '>')) {
             $sLink = BT_FPCModuleTools::getAccountPageLink();
         } else {
             global $smarty;
             $sLink = $smarty->_tpl_vars['base_dir_ssl'] . 'my-account.php';
         }
     }
     if (!empty($sData)) {
         $sLink .= (strstr($sLink, '?') ? '&' : '?') . 'data=' . $sData;
     }
     // detect user agent to redirect or close the popup windows and reload the current page
     if (!empty($_SERVER['HTTP_USER_AGENT']) && (stristr($_SERVER['HTTP_USER_AGENT'], 'iphone') || stristr($_SERVER['HTTP_USER_AGENT'], 'mobile'))) {
         header("Location: " . $sLink);
         exit(0);
     } else {
         return '<script>' . '     window.opener.location.href = "' . $sLink . '";' . '     window.opener.focus();' . '     window.close();' . '</script>';
     }
 }
Example #6
0
 /**
  * Method to run before an install/update/uninstall method
  *
  * @param string  $type       is the type of change (install, update or discover_install)
  * @param object  $parent is the class calling this method
  *
  * @return boolean            false if error occurs
  */
 function preflight($type, $parent)
 {
     $app = JFactory::getApplication();
     $jversion = new JVersion();
     $jInstall = new JInstaller('mod_bwpostman_overview');
     // Get component manifest file version
     $this->release = $parent->get("manifest")->version;
     // Manifest file minimum Joomla version
     $this->minimum_joomla_release = $parent->get("manifest")->attributes()->version;
     // abort if the current Joomla release is older
     if (version_compare($jversion->getShortVersion(), $this->minimum_joomla_release, 'lt')) {
         $app->enqueueMessage(JText::sprintf('MOD_BWPOSTMAN_OVERVIEW_INSTALL_ERROR_JVERSION', $this->minimum_joomla_release), 'error');
         return false;
     }
     if (floatval(phpversion()) < 5) {
         $app->enqueueMessage(JText::_('MOD_BWPOSTMAN_OVERVIEW_USES_PHP5'), 'error');
         return false;
     }
     // abort if the component being installed is not newer than the currently installed version
     if ($type == 'update') {
         $oldRelease = $this->getManifestVar('version');
         $app->setUserState('mod_bwpostman_overview.update.oldRelease', $oldRelease);
         if (version_compare($this->release, $oldRelease, 'lt')) {
             $app->enqueueMessage(JText::sprintf('MOD_BWPOSTMAN_OVERVIEW_INSTALL_ERROR_INCORRECT_VERSION_SEQUENCE', $oldRelease, $this->release), 'error');
             return false;
         }
     }
     return true;
 }
Example #7
0
 /**
  * when in form or detailed view, do we want to show the full image or thumbnail/link?
  * @param object $params
  * @return bool
  */
 private function getThumbnail(&$model, &$params, $file)
 {
     if ($this->inTableView || $params->get('make_thumbnail') == '1' && $params->get('fu_show_image') == 1) {
         if (!$params->get('make_thumbnail', false)) {
             return false;
         } else {
             $thumb_url = $model->getStorage()->_getThumb($file);
             $thumb_file = $model->getStorage()->urlToPath($thumb_url);
             $thumb_url_info = pathinfo($thumb_url);
             if (JString::strtolower($thumb_url_info['extension'] == 'pdf')) {
                 $thumb_url = $thumb_url_info['dirname'] . '/' . $thumb_url_info['filename'] . '.' . $this->pdf_thumb_type;
                 $thumb_file_info = pathinfo($thumb_file);
                 $thumb_file = $thumb_file_info['dirname'] . '/' . $thumb_file_info['filename'] . '.' . $this->pdf_thumb_type;
             }
             if ($model->getStorage()->exists($thumb_file)) {
                 return $thumb_url;
             } else {
                 $thumb_file = COM_FABRIK_BASE . 'media/com_fabrik/images/pdf.png';
                 if (JFile::exists($thumb_file)) {
                     return $thumb_file;
                 } else {
                     return false;
                 }
             }
         }
     }
     return false;
 }
Example #8
0
 /**
  * Get the requested Page.
  *
  * @access  public
  */
 public function getPage()
 {
     $_GET['act'] = empty($_GET['act']) ? '' : $_GET['act'];
     switch ($_GET['act']) {
         case 'lostpw':
             $this->showPasswordLost();
             break;
         case 'resetpw':
             $this->showPasswordReset();
             break;
         case 'verify':
             $this->verifyUserAccount();
             break;
         case 'captcha':
             $this->getCaptcha();
             break;
         default:
             $this->showLogin();
             break;
     }
     $this->objTemplate->setVariable('CONTREXX_CHARSET', CONTREXX_CHARSET);
     $endcode = $this->objTemplate->get();
     // replace links from before contrexx 3
     $ls = new \LinkSanitizer(ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/', $endcode);
     $endcode = $ls->replace();
     echo $endcode;
     exit;
 }
Example #9
0
 /**
  * Displays the view
  *
  * @param		string	$tpl	The name of the template file to parse
  *
  * @return	void
  *
  * @since		2.5
  */
 public function display($tpl = null)
 {
     $doc = JFactory::getDocument();
     $doc->addStyleSheet(JURI::root() . 'media/overrider/css/overrider.css');
     JHtml::_('behavior.framework');
     $doc->addScript(JURI::root() . 'media/overrider/js/overrider.js');
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     // Check for errors
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
         return;
     }
     // Check whether the cache has to be refreshed
     $cached_time = JFactory::getApplication()->getUserState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0);
     if (time() - $cached_time > 60 * 5) {
         $this->state->set('cache_expired', true);
     }
     // Add strings for translations in Javascript
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
     JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR');
     $this->addToolbar();
     parent::display($tpl);
 }
Example #10
0
 /**
  * concat the collection
  *
  * @since 3.0.0
  *
  * @param array $optionArray
  * @param array $rewriteArray
  *
  * @return Loader
  */
 public function concat($optionArray = [], $rewriteArray = [])
 {
     $bundleArray = [];
     $restArray = [];
     /* prevent as needed */
     if ($this->_registry->get('noCache')) {
         return $this;
     }
     /* process collection */
     foreach ($this->_collectionArray as $collectionKey => $attributeArray) {
         $path = $attributeArray[$optionArray['attribute']];
         $fileArray = pathinfo($path);
         if (is_file($path) && $fileArray['extension'] === $optionArray['extension']) {
             $bundleArray[] = $attributeArray[$optionArray['attribute']];
         } else {
             $restArray[] = $attributeArray;
         }
     }
     /* cache as needed */
     $cache = new Cache();
     $cache->init($optionArray['directory'], $optionArray['extension']);
     /* load from cache */
     if ($cache->validate($bundleArray, $optionArray['lifetime'])) {
         $this->_collectionArray = $restArray;
         $this->_collectionArray['bundle'] = [$optionArray['attribute'] => $cache->getPath($bundleArray)];
         if ($optionArray['extension'] === 'css') {
             $this->_collectionArray['bundle']['rel'] = 'stylesheet';
         }
     } else {
         $content = $this->_getContent($bundleArray, $rewriteArray);
         $cache->store($bundleArray, $content);
     }
     return $this;
 }
 /**
  * Extract form errors from the API and allocate errors to the form itself
  * @param object $objForm
  * @param object $request
  * @return Form $object
  */
 public function formatFormErrors($objForm, $request)
 {
     if ($request instanceof \Exception) {
         //extract message from exception
         $request = $request->getMessage();
     }
     //end if
     //extract errors from the request return by the API
     $arr_response = explode("||", $request);
     $objResponse = json_decode(trim($arr_response[1]));
     if (!is_object($objResponse)) {
         //errors could not be extracted, append message to first element
         foreach ($objForm->getElements() as $objElement) {
             $objForm->get($objElement->getName())->setMessages(array("An unknown error has occured. Form errors could not be loaded"));
         }
         //end foreach
     } else {
         foreach ($objResponse->data as $objField) {
             if (!isset($objField->messages)) {
                 continue;
             }
             //end if
             if (count($objField->messages) > 0) {
                 $objForm->get($objField->attributes->name)->setMessages((array) $objField->messages);
             }
             //end if
         }
         //end foreach
     }
     //end if
     return $objForm;
 }
Example #12
0
 /**
  * Get content page
  *
  * @access public
  */
 function getPage()
 {
     if (isset($_GET['cmd'])) {
         $action = $_GET['cmd'];
     } elseif (isset($_GET['act'])) {
         $action = $_GET['act'];
     } else {
         $action = '';
     }
     switch ($action) {
         case 'surveypreview':
             $this->SurveyPreview();
             break;
         case 'surveyattend':
             $this->SurveyAttend();
             break;
         case 'questionpreview':
             $this->QuestionPreview();
             break;
         case 'homesurvey':
             $this->surveyOverview();
             break;
         case 'activesurveys':
             $this->activeSurveys();
             break;
         case 'surveybyId':
             $this->surveyById();
             break;
         default:
             $this->surveyOverview();
             break;
     }
     return $this->_objTpl->get();
 }
Example #13
0
	/**
	 * process the plugin, called when form is submitted
	 *
	 * @param object $params
	 * @param object form
	 */

	function onBeforeStore( &$params, &$formModel )
	{
		global $vbulletin;
		define(VB_AREA, 'fabrik');
		define(THIS_SCRIPT, 'fabrik');

		// Initialize some variables
		$db	= FabrikWorker::getDbo();

		$data = $formModel->_formData;

		// Check for request forgeries
		JRequest::checkToken() or jexit('Invalid Token');

		$elementModel = $formModel->getPluginManager()->getElementPlugin($params->get('vb_forum_field'));

		$element = $elementModel->getElement(true);
		$this->map_forum_field = $elementModel->getFullName();

		$this->vb_parent_forum = $params->get('vb_parent', '');

		$method = "POST";
		$url = JURI::base(). "forum/mkforum.php";
		$vars = array();
		$vars['forum_name'] = $data[$this->map_forum_field];
		$vars['forum_parent'] = $this->vb_parent_forum;
		$res = $this->doRequest($method, $url, $vars);
	}
Example #14
0
 /**
  * Retrieve a property from the internal item object
  *
  * @param   string  $key      Property to retrieve
  * @param   mixed   $default
  * @return  string
  */
 public function item($key = '', $default = null)
 {
     if ($key && is_object($this->_item)) {
         return $this->_item->get($key, $default);
     }
     return $this->_item;
 }
Example #15
0
 /**
  * Get the annotations.
  *
  * @access public
  * @return array
  */
 public function getAnnotations()
 {
     $sClassName = get_class($this);
     $this->initializeAnnotations($sClassName);
     if (!($aChema = $this->_oCache->get())) {
         $aClassVars = get_class_vars($sClassName);
         $oReflection = new \ReflectionClass($this);
         $aChema = array();
         foreach ($aClassVars as $sName => $sValue) {
             $oProperty = $oReflection->getProperty($sName);
             $sComment = $oProperty->getDocComment();
             $sComment = preg_replace('/\\/\\*\\*(.*)\\*\\//', '$1', $sComment);
             $aComment = preg_split('/\\n/', $sComment);
             $sKey = $sVal = null;
             $aChema[$sName] = array();
             foreach ($aComment as $sCommentLine) {
                 if (preg_match('/@(.*?): (.*)/i', $sCommentLine, $aMatches)) {
                     $sKey = $aMatches[1];
                     $sKey = $aMatches[2];
                     $aChema[$sName][trim($sKey)] = trim($sVal);
                 }
             }
         }
         unset($oReflection);
         $this->saveAnnotations($aChema);
     }
     return $aChema;
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $canDo = JHelperContent::getActions('com_banners');
     JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_CLIENTS'), 'bookmark banners-clients');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('client.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('client.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::publish('clients.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('clients.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolbarHelper::archiveList('clients.archive');
         JToolbarHelper::checkin('clients.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'clients.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('clients.trash');
     }
     if ($canDo->get('core.admin') || $canDo->get('core.options')) {
         JToolbarHelper::preferences('com_banners');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS');
 }
Example #17
0
 /**
  * Open haystack, find and replace needles, save haystack
  * @param  string $oldFile The haystack
  * @param  mixed  $search  String or array to look for (the needles)
  * @param  mixed  $replace What to replace the needles for?
  * @param  string $newFile Where to save, defaults to $oldFile
  * @return void
  */
 public function replaceAndSave($oldFile, $search, $replace, $newFile = null)
 {
     $newFile = $newFile == null ? $oldFile : $newFile;
     $file = $this->files->get($oldFile);
     $replacing = str_replace($search, $replace, $file);
     $this->files->put($newFile, $replacing);
 }
Example #18
0
 /**
  * process the plugin, called when form is submitted
  *
  * @param object $params
  * @param object form
  */
 function onAfterProcess($params, &$formModel)
 {
     if ($params->get('ask-receipt')) {
         $post = JRequest::get('post');
         if (!array_key_exists('fabrik_email_copy', $post)) {
             return;
         }
     }
     $config =& JFactory::getConfig();
     $w = new FabrikWorker();
     $this->formModel =& $formModel;
     $form =& $formModel->getForm();
     //getEmailData returns correctly formatted {tablename___elementname} keyed results
     //_formData is there for legacy and may allow you to use {elementname} only placeholders for simple forms
     $aData = array_merge($this->getEmailData(), $formModel->_formData);
     $message = $params->get('receipt_message');
     $editURL = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&amp;view=form&amp;fabrik=" . $formModel->get('id') . "&amp;rowid=" . JRequest::getVar('rowid');
     $viewURL = COM_FABRIK_LIVESITE . "index.php?option=com_fabrik&amp;view=details&amp;fabrik=" . $formModel->get('id') . "&amp;rowid=" . JRequest::getVar('rowid');
     $editlink = "<a href=\"{$editURL}\">" . JText::_('EDIT') . "</a>";
     $viewlink = "<a href=\"{$viewURL}\">" . JText::_('VIEW') . "</a>";
     $message = str_replace('{fabrik_editlink}', $editlink, $message);
     $message = str_replace('{fabrik_viewlink}', $viewlink, $message);
     $message = str_replace('{fabrik_editurl}', $editURL, $message);
     $message = str_replace('{fabrik_viewurl}', $viewURL, $message);
     $message = $w->parseMessageForPlaceHolder($message, $aData, false);
     $to = $w->parseMessageForPlaceHolder($params->get('receipt_to'), $aData, false);
     if (empty($to)) {
         // $$$ hugh - not much point trying to send if we don't have a To address
         // (happens frequently if folk don't properly validate their form inputs and are using placeholders)
         // @TODO - might want to add some feedback about email not being sent
         return;
     }
     /*
     // $$$ hugh - this code doesn't seem to be used?
     // it sets $email, which is then never referenced?
     $receipt_email = $params->get('receipt_to');
     if (!$form->record_in_database) {
     	foreach ($aData as $key=>$val) {
     		$aBits = explode('___', $key);
     		$newKey = array_pop( $aBits);
     		if ($newKey == $receipt_email) {
     			$email = $val;
     		}
     	}
     }
     */
     $subject = html_entity_decode($params->get('receipt_subject', ''));
     $subject = $w->parseMessageForPlaceHolder($subject, null, false);
     $from = $config->getValue('mailfrom');
     $fromname = $config->getValue('fromname');
     //darn silly hack for poor joomfish settings where lang parameters are set to overide joomla global config but not mail translations entered
     $rawconfig = new JConfig();
     if ($from === '') {
         $from = $rawconfig->mailfrom;
     }
     if ($fromname === '') {
         $fromname = $rawconfig->fromname;
     }
     $res = JUTility::sendMail($from, $fromname, $to, $subject, $message, true);
 }
 /**
  * testGetInvalid
  *
  * @since 2.1.0
  */
 public function testGetInvalid()
 {
     /* actual */
     $actual = $this->_registry->get('invalidKey');
     /* compare */
     $this->assertEquals(null, $actual);
 }
Example #20
0
 /**
  * Setup
  */
 protected function setUp()
 {
     // get service manager
     $this->serviceLocator = AclBootstrap::getServiceLocator();
     // get acl model
     $this->aclModelBase = $this->serviceLocator->get('Application\\Model\\ModelManager')->getInstance('Acl\\Model\\AclBase');
 }
Example #21
0
 /**
  * Setup
  */
 protected function setUp()
 {
     // get service manager
     $this->serviceLocator = UserBootstrap::getServiceLocator();
     // get base user model instance
     $this->model = $this->serviceLocator->get('Application\\Model\\ModelManager')->getInstance('User\\Model\\UserBase');
 }
 /**
  * Returns a SqlQueriesManager object
  *
  * @return object
  */
 public function getSqlQueriesManager()
 {
     if (!isset($this->_instances['SqlQueriesManager']) || !is_a($this->_instances['SqlQueriesManager'], 'SqlQueriesManager')) {
         $this->_instances['SqlQueriesManager'] = new SqlQueriesManager($this->_config->get('db.driver'));
     }
     return $this->_instances['SqlQueriesManager'];
 }
Example #23
0
 /**
  * Clone the record
  *
  * @param   object  $params      plugin params
  * @param   object  &$formModel  form model
  *
  * @return  bool
  */
 private function _process($params, &$formModel)
 {
     $clone_times_field_id = $params->get('clone_times_field', '');
     $clone_batchid_field_id = $params->get('clone_batchid_field', '');
     if ($clone_times_field_id != '') {
         $elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_times_field_id);
         $element = $elementModel->getElement(true);
         if ($clone_batchid_field_id != '') {
             $elementModel = FabrikWorker::getPluginManager()->getElementPlugin($clone_batchid_field_id);
             $id_element = $id_elementModel->getElement(true);
             $formModel->_formData[$id_element->name] = $formModel->_fullFormData['rowid'];
             $formModel->_formData[$id_element->name . '_raw'] = $formModel->_fullFormData['rowid'];
             $listModel = $formModel->getlistModel();
             $listModel->_oForm = $formModel;
             $primaryKey = FabrikString::shortColName($listModel->getTable()->db_primary_key);
             $formModel->_formData[$primaryKey] = $formModel->_fullFormData['rowid'];
             $formModel->_formData[$primaryKey . '_raw'] = $formModel->_fullFormData['rowid'];
             $listModel->storeRow($formModel->_formData, $formModel->_fullFormData['rowid']);
         }
         // $clone_times_field = $elementModel->getFullName(false, true, false);
         $clone_times = $formModel->_formData[$element->name];
         if (is_numeric($clone_times)) {
             $clone_times = (int) $clone_times;
             $formModel->_formData['Copy'] = 1;
             for ($x = 1; $x < $clone_times; $x++) {
                 $formModel->processToDB();
             }
             return true;
         }
     }
     JError::raiseNotice(JText::_('CLONEERR'), "Couldn't find a valid number of times to clone!");
     return true;
 }
Example #24
0
 /**
  * Assertion for get function return correct values after change default environment
  */
 public function testGetAfterChangeDefaultEnvironment()
 {
     $this->config->setDefaultEnvironment('local');
     $this->assertTrue($this->config->get('debug'));
     $this->assertEquals(null, $this->config->get('execution_time'));
     $this->assertEquals('localhost', $this->config->get('database.host'));
 }
 /**
  * Add sort to admin table list.
  *
  * Add sort by custom field to admin table with list of entries
  *
  * @since 1.7
  *
  * @param object $query QP Query object
  *
  */
 public function pre_get_posts($query)
 {
     /**
      * do not run in admin
      */
     if (!is_admin()) {
         return;
     }
     /**
      * check is main query and is set orderby and post_type
      */
     if ($query->is_main_query() && ($orderby = $query->get('orderby')) && ($post_type = $query->get('post_type'))) {
         $custom_post_types = wpcf_get_active_custom_types();
         /**
          * this CPT exists as a Types CPT?
          */
         if (!isset($custom_post_types[$post_type])) {
             return;
         }
         /**
          * set up meta_key if this CPT has this field to sort
          */
         if ($this->check_has_custom_fields($custom_post_types[$post_type], $orderby)) {
             $query->set('meta_key', $orderby);
         }
     }
 }
Example #26
0
 /**
  * Read a session file.
  *
  * @param int $iId File ID.
  * @return mixed FALSE if not exists, STRING if file exists.
  */
 public function read($iId)
 {
     if (!($sContent = $this->_oDb->get($this->_sPrefix . $iId))) {
         return false;
     }
     return (string) $sContent;
 }
 /**
  * Устанавливает панель инструментов.
  *
  * @return  void
  */
 protected function addToolBar()
 {
     JFactory::getApplication()->input->set('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     JToolBarHelper::title($isNew ? JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') : JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'), 'helloworld');
     // Устанавливаем действия для новых и существующих записей.
     if ($isNew) {
         // Для новых записей проверяем право создания.
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL');
     } else {
         // Для существующих записей проверяем право редактирования.
         if ($this->canDo->get('core.edit')) {
             // Мы можем сохранять новую запись.
             JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY');
             JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE');
             // Мы можем сохранять  в новую запись, но нужна проверка на создание.
             if ($this->canDo->get('core.create')) {
                 JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
             }
         }
         // Для сохранения копии записи проверяем право создания.
         if ($this->canDo->get('core.create')) {
             JToolBarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
         }
         JToolBarHelper::cancel('helloworld.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE');
     }
 }
Example #28
0
 /**
  * render the title
  *
  * @since 3.0.0
  *
  * @return string
  */
 public function render()
 {
     $title = $this->_registry->get('metaTitle') ? $this->_registry->get('metaTitle') : Db::getSetting('title');
     $description = $this->_registry->get('metaDescription') ? $this->_registry->get('metaDescription') : Db::getSetting('description');
     $titleElement = new Html\Element();
     return $titleElement->init('title')->text($title . Db::getSetting('divider') . $description)->render();
 }
Example #29
0
 /**
  * Get cached data from a file by id and group
  *
  * @param   string   $id         The cache data id.
  * @param   string   $group      The cache data group.
  * @param   boolean  $checkTime  True to verify cache time expiration threshold.
  *
  * @return  mixed  Boolean false on failure or a cached data string.
  *
  * @since   11.1
  */
 public function get($id, $group, $checkTime = true)
 {
     self::$CacheLiteInstance->setOption('cacheDir', $this->_root . '/' . $group . '/');
     $this->_getCacheId($id, $group);
     $data = self::$CacheLiteInstance->get($this->rawname, $group);
     return $data;
 }
Example #30
0
 /**
  * Can the row be edited
  *
  * @param   object  $params     plugin params
  * @param   object  $listModel  list model
  * @param   object  $row        current row to test
  *
  * @return boolean
  */
 public function onCanEdit($params, $listModel, $row)
 {
     // If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
     // and we don't have an opinion on per-table edit permissions, so just return true.
     if (is_null($row) || is_null($row[0])) {
         return true;
     }
     if (is_array($row[0])) {
         $data = JArrayHelper::toObject($row[0]);
     } else {
         $data = $row[0];
     }
     $field = str_replace('.', '___', $params->get('caneditrow_field'));
     // If they provided some PHP to eval, we ignore the other settings and just run their code
     $caneditrow_eval = $params->get('caneditrow_eval', '');
     // $$$ rob if no can edit field selected in admin return true
     if (trim($field) == '' && trim($caneditrow_eval) == '') {
         return true;
     }
     if (!empty($caneditrow_eval)) {
         $w = new FabrikWorker();
         $data = JArrayHelper::fromObject($data);
         $caneditrow_eval = $w->parseMessageForPlaceHolder($caneditrow_eval, $data);
         $caneditrow_eval = @eval($caneditrow_eval);
         FabrikWorker::logEval($caneditrow_eval, 'Caught exception on eval in can edit row : %s');
         return $caneditrow_eval;
     } else {
         // No PHP given, so just do a simple match on the specified element and value settings.
         if ($params->get('caneditrow_useraw', '0') == '1') {
             $field .= '_raw';
         }
         $value = $params->get('caneditrow_value');
         return $data->{$field} == $value;
     }
 }