当前位置: 首页>>代码示例>>PHP>>正文


PHP FArrayHelper类代码示例

本文整理汇总了PHP中FArrayHelper的典型用法代码示例。如果您正苦于以下问题:PHP FArrayHelper类的具体用法?PHP FArrayHelper怎么用?PHP FArrayHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FArrayHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInput

 /**
  * Get the input
  *
  * @return string
  */
 protected function getInput()
 {
     $iframeid = $this->id . '_iframe';
     $app = JFactory::getApplication();
     $input = $app->input;
     $cid = $input->get('id', array(0), 'array');
     $cid = FArrayHelper::getValue($cid, 0);
     // $$$ hugh - when creating a new form, no 'cid' ... not sure what to do, so just set it to 0.  Should
     // prolly just return something like 'available after save' ?
     $c = isset($this->form->repeatCounter) ? (int) $this->form->repeatCounter : 0;
     $href = COM_FABRIK_LIVESITE . 'index.php?option=com_fabrik&task=plugin.pluginAjax&plugin=twitter';
     $href .= '&g=form&method=authenticateAdmin&tmpl=component&formid=' . $cid . '&repeatCounter=' . $c;
     $clearjs = '$(\'jform_params_twitter_oauth_token-' . $c . '\').value = \'\';';
     $clearjs .= '$(\'jform_params_twitter_oauth_token_secret-' . $c . '\').value = \'\';';
     $clearjs .= '$(\'jform_params_twitter_oauth_user-' . $c . '\').value = \'\';';
     $clearjs .= "return false;";
     $src = COM_FABRIK_LIVESITE . 'components/com_fabrik/libs/abraham-twitteroauth/images/lighter.png';
     $winOpts = 'width=800,height=460,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
     $js = "window.open('{$href}', 'twitterwins', '" . $winOpts . "');return false;";
     $parsedUrl = parse_url(JUri::root());
     $origin = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
     $str = "\n<script type='text/javascript'>\nwindow.addEventListener('message', function(event) {\n\tif (~event.origin.indexOf('" . $origin . "')) {\n\t\tjQuery(event.data).each(function (i, k) {\n\t\t\tjQuery(k[0]).val(k[1]);\n\t\t});\n\t} else {\n\t\treturn;\n\t}\n});\n</script>\n";
     $str .= '<a href="#" onclick="' . $js . '">';
     $str .= '<img src="' . $src . '" alt="Sign in with Twitter"/></a>';
     $str .= " | <button class=\"button btn\" href=\"#\" onclick=\"{$clearjs}\">";
     $str .= FText::_('PLG_FORM_TWITTER_CLEAR_CREDENTIALS') . "</button><br/>";
     $str .= "<br /><input type=\"hidden\" readonly=\"readonly\" name=\"" . $this->name . "\" id=\"" . $this->id . "\" value=\"" . $this->value . "\" />";
     return $str;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:34,代码来源:twittersignin.php

示例2: display

 /**
  * Display
  *
  * @param   string $tpl Template
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     FabrikHelperHTML::framework();
     $input = $this->app->input;
     $item = $this->get('Item');
     $srcs = array('media/com_fabrik/js/icons.js', 'media/com_fabrik/js/icongen.js', 'media/com_fabrik/js/canvas.js', 'media/com_fabrik/js/history.js', 'media/com_fabrik/js/keynav.js', 'media/com_fabrik/js/tabs.js', 'media/com_fabrik/js/pages.js', 'media/com_fabrik/js/frontpackage.js');
     FabrikHelperHTML::script($srcs);
     FabrikHelperHTML::stylesheet('media/com_fabrik/css/package.css');
     $canvas = $item->params->get('canvas');
     // $$$ rob 08/11/2011 test if component name set but still rendering
     // in option=com_fabrik then we should use fabrik as the package
     if ($input->get('option') === 'com_fabrik') {
         $item->component_name = 'fabrik';
     }
     $tabs = FArrayHelper::getValue($canvas, 'tabs', array('Page 1'));
     $tabs = json_encode($tabs);
     $d = new stdClass();
     $layout = json_encode(FArrayHelper::getValue($canvas, 'layout', $d));
     $id = $this->get('State')->get('package.id');
     $script = "window.addEvent('fabrik.loaded', function() {\n\t\t\tnew FrontPackage({\n\t\ttabs : {$tabs},\n\t\ttabelement : 'packagemenu',\n\t\tpagecontainer : 'packagepages',\n\t\tlayout: {$layout},\n\t\t'packageId': {$id},\n\t\t'package':'{$item->component_name}'\n\t});\n\t\t});";
     FabrikHelperHTML::addScriptDeclaration($script);
     // Force front end templates
     $this->_basePath = COM_FABRIK_FRONTEND . '/views';
     $tmpl = !isset($item->template) ? 'default' : $item->template;
     $this->addTemplatePath($this->_basePath . '/' . $this->_name . '/tmpl/' . $tmpl);
     $text = $this->loadTemplate();
     FabrikHelperHTML::runContentPlugins($text);
     echo $text;
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:36,代码来源:view.html.php

示例3: toggleInList

 /**
  * Set selected elements to be shown/not shown in list
  *
  * @return null
  */
 public function toggleInList()
 {
     // Check for request forgeries
     JSession::checkToken() or die(FText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $app = JFactory::getApplication();
     $input = $app->input;
     $cid = $input->get('cid', array(), 'array');
     $data = array('showInListView' => 1, 'hideFromListView' => 0);
     $task = $this->getTask();
     $value = FArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, FText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->addToListView($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $nText = $this->text_prefix . '_N_ITEMS_ADDED_TO_LIST_VIEW';
             } else {
                 $nText = $this->text_prefix . '_N_ITEMS_REMOVED_FROM_LIST_VIEW';
             }
             $this->setMessage(JText::plural($nText, count($cid)));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:37,代码来源:elements.php

示例4: onLoadJavascriptInstance

 /**
  * Return the javascript to create an instance of the class defined in formJavascriptClass
  *
  * @param   array  $args  Array [0] => string table's form id to contain plugin
  *
  * @return bool
  */
 public function onLoadJavascriptInstance($args)
 {
     if (!$this->canUse()) {
         return;
     }
     /** @var FabrikFEModelList $model */
     $model = $this->getModel();
     $params = $this->getParams();
     $orderEl = $model->getFormModel()->getElement($params->get('order_element'), true);
     $opts = $this->getElementJSOptions();
     $orderElName = FabrikString::safeColNameToArrayKey(FArrayHelper::getValue($model->orderEls, 0, ''));
     $opts->enabled = $orderElName == FabrikString::safeColNameToArrayKey($orderEl->getOrderByName()) ? true : false;
     $opts->listid = $model->getId();
     $opts->orderElementId = $params->get('order_element');
     $opts->handle = $params->get('order_element_as_handle', 1) == 1 ? '.' . $orderEl->getOrderByName() : false;
     $opts->direction = $opts->enabled ? $model->orderDirs[0] : '';
     $opts->transition = '';
     $opts->duration = '';
     $opts->constrain = '';
     $opts->clone = '';
     $opts->revert = '';
     $opts = json_encode($opts);
     $this->jsInstance = "new FbListOrder({$opts})";
     return true;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:32,代码来源:order.php

示例5: getPlugins

 /**
  * Get the list's active/selected plug-ins
  *
  * @return array
  */
 public function getPlugins()
 {
     $item = $this->getItem();
     // Load up the active plug-ins
     $plugins = FArrayHelper::getValue($item->params, 'plugins', array());
     return $plugins;
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:12,代码来源:fabmodeladmin.php

示例6: setDefault

 /**
  * Method to set the home property for a list of items
  *
  * @since	1.6
  *
  * @return null
  */
 public function setDefault()
 {
     // Check for request forgeries
     JSession::checkToken() or die(FText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $input = $app->input;
     // Get items to publish from the request.
     $cid = $input->get('cid', array(), 'array');
     $data = array('setDefault' => 1, 'unsetDefault' => 0);
     $task = $this->getTask();
     $value = FArrayHelper::getValue($data, $task, 0, 'int');
     if ($value == 0) {
         $this->setMessage(FText::_('COM_FABRIK_CONNECTION_CANT_UNSET_DEFAULT'));
     }
     if (empty($cid)) {
         JError::raiseWarning(500, FText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         if ($value != 0) {
             $cid = $cid[0];
             // Get the model.
             $model = $this->getModel();
             // Publish the items.
             if (!$model->setDefault($cid, $value)) {
                 JError::raiseWarning(500, $model->getError());
             } else {
                 $this->setMessage(FText::_('COM_FABRIK_CONNECTION_SET_DEFAULT'));
             }
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:38,代码来源:connections.php

示例7: render

 /**
  * Render uploaded image
  *
  * @param   object &$model  Element model
  * @param   object &$params Element params
  * @param   string $file    Row data for this element
  * @param   object $thisRow All row's data
  *
  * @return  void
  */
 public function render(&$model, &$params, $file, $thisRow = null)
 {
     /*
      * $$$ hugh - added this hack to let people use elementname__title as a title element
      * for the image, to show in the lightbox popup.
      * So we have to work out if we're being called from a table or form
      */
     $formModel = $model->getFormModel();
     $title = basename($file);
     if ($params->get('fu_title_element') == '') {
         $title_name = $model->getFullName(true, false) . '__title';
     } else {
         $title_name = str_replace('.', '___', $params->get('fu_title_element'));
     }
     if ($this->inTableView) {
         if (array_key_exists($title_name, $thisRow)) {
             $title = $thisRow->{$title_name};
         }
     } else {
         if (is_object($formModel)) {
             if (is_array($formModel->data)) {
                 $title = FArrayHelper::getValue($formModel->data, $title_name, '');
             }
         }
     }
     $bits = FabrikWorker::JSONtoData($title, true);
     $title = FArrayHelper::getValue($bits, $model->_repeatGroupCounter, $title);
     $title = htmlspecialchars(strip_tags($title, ENT_NOQUOTES));
     $file = $model->getStorage()->getFileUrl($file);
     $fullSize = $file;
     if (!$this->fullImageInRecord($params)) {
         if ($params->get('fileupload_crop')) {
             $file = $model->getStorage()->_getCropped($fullSize);
         } else {
             $file = $model->getStorage()->_getThumb($file);
         }
     }
     list($width, $height) = $this->imageDimensions($params);
     $file = $model->storage->preRenderPath($file);
     $n = $this->inTableView ? '' : $model->getElement()->name;
     if ($params->get('restrict_lightbox', 1) == 0) {
         $n = '';
     }
     $layout = $model->getLayout('image');
     $displayData = new stdClass();
     $displayData->lightboxAttrs = FabrikHelperHTML::getLightboxAttributes($title, $n);
     $displayData->fullSize = $model->storage->preRenderPath($fullSize);
     $displayData->file = $file;
     $displayData->makeLink = $params->get('make_link', true) && !$this->fullImageInRecord($params);
     $displayData->title = $title;
     $displayData->isJoin = $model->isJoin();
     $displayData->width = $width;
     $displayData->showImage = $params->get('fu_show_image');
     $displayData->inListView = $this->inTableView;
     $displayData->height = $height;
     $displayData->isSlideShow = $this->inTableView && $params->get('fu_show_image_in_table', '0') == '2' || !$this->inTableView && !$formModel->isEditable() && $params->get('fu_show_image', '0') == '3';
     $this->output = $layout->render($displayData);
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:68,代码来源:image.php

示例8: button

 /**
  * Prep the button. Show it if in heading (top of list) but not in rows
  *
  * @param   array  &$args  Arguments
  *
  * @return  bool;
  */
 public function button(&$args)
 {
     $opts = FArrayHelper::getValue($args, 0, array());
     $model = $this->getModel();
     $this->buttonAction = $model->actionMethod();
     $this->context = $model->getRenderContext();
     $heading = (bool) FArrayHelper::getValue($opts, 'heading', false);
     return $heading;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:16,代码来源:webservice.php

示例9: render

 /**
  * Internally render the plugin, and add required script declarations
  * to the document
  *
  * @return  void
  */
 public function render()
 {
     $params = $this->getParams();
     $document = JFactory::getDocument();
     $document->addScript("http://api.simile-widgets.org/runway/1.0/runway-api.js");
     $c = 0;
     $images = (array) $params->get('coverflow_image');
     $titles = (array) $params->get('coverflow_title');
     $subtitles = (array) $params->get('coverflow_subtitle');
     $listIds = (array) $params->get('coverflow_table');
     $eventData = array();
     foreach ($listIds as $listId) {
         $listModel = JModelLegacy::getInstance('List', 'FabrikFEModel');
         $listModel->setId($listId);
         $list = $listModel->getTable();
         $listModel->getPagination(0, 0, 0);
         $image = $images[$c];
         $title = $titles[$c];
         $subtitle = $subtitles[$c];
         $data = $listModel->getData();
         if ($listModel->canView() || $listModel->canEdit()) {
             $elements = $listModel->getElements();
             $imageElement = FArrayHelper::getValue($elements, FabrikString::safeColName($image));
             foreach ($data as $group) {
                 if (is_array($group)) {
                     foreach ($group as $row) {
                         $event = new stdClass();
                         if (!method_exists($imageElement, 'getStorage')) {
                             switch (get_class($imageElement)) {
                                 case 'FabrikModelFabrikImage':
                                     $rootFolder = $imageElement->getParams()->get('selectImage_root_folder');
                                     $rootFolder = JString::ltrim($rootFolder, '/');
                                     $rootFolder = JString::rtrim($rootFolder, '/');
                                     $event->image = COM_FABRIK_LIVESITE . 'images/stories/' . $rootFolder . '/' . $row->{$image . '_raw'};
                                     break;
                                 default:
                                     $event->image = isset($row->{$image . '_raw'}) ? $row->{$image . '_raw'} : '';
                                     break;
                             }
                         } else {
                             $event->image = $imageElement->getStorage()->pathToURL($row->{$image . '_raw'});
                         }
                         $event->title = $title === '' ? '' : (string) strip_tags($row->{$title});
                         $event->subtitle = $subtitle === '' ? '' : (string) strip_tags($row->{$subtitle});
                         $eventData[] = $event;
                     }
                 }
             }
         }
         $c++;
     }
     $json = json_encode($eventData);
     $str = "var coverflow = new FbVisCoverflow({$json});";
     $srcs = FabrikHelperHTML::framework();
     $srcs['Coverflow'] = $this->srcBase . 'coverflow/coverflow.js';
     FabrikHelperHTML::script($srcs, $str);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:63,代码来源:coverflow.php

示例10: validate

 /**
  * Validate the elements data against the rule
  *
  * @param   string  $data           To check
  * @param   int     $repeatCounter  Repeat group counter
  *
  * @return  bool  true if validation passes, false if fails
  */
 public function validate($data, $repeatCounter)
 {
     $params = $this->getParams();
     $elementModel = $this->elementModel;
     // As ornot is a radio button it gets json encoded/decoded as an object
     $orNot = $params->get('userexists_or_not', 'fail_if_exists');
     jimport('joomla.user.helper');
     $result = JUserHelper::getUserId($data);
     if ($this->user->get('guest')) {
         if (!$result) {
             if ($orNot == 'fail_if_exists') {
                 return true;
             }
         } else {
             if ($orNot == 'fail_if_not_exists') {
                 return true;
             }
         }
         return false;
     } else {
         if (!$result) {
             if ($orNot == 'fail_if_exists') {
                 return true;
             }
         } else {
             $userField = $params->get('userexists_user_field');
             $userId = 0;
             if ((int) $userField !== 0) {
                 $userElementModel = FabrikWorker::getPluginManager()->getElementPlugin($userField);
                 $userFullName = $userElementModel->getFullName(true, false);
                 $userField = $userElementModel->getFullName(false, false);
             }
             if (!empty($userField)) {
                 // $$$ the array thing needs fixing, for now just grab 0
                 $formData = $elementModel->getForm()->formData;
                 $userId = FArrayHelper::getValue($formData, $userFullName . '_raw', FArrayHelper::getValue($formData, $userFullName, ''));
                 if (is_array($userId)) {
                     $userId = FArrayHelper::getValue($userId, 0, '');
                 }
             }
             if ($userId != 0) {
                 if ($result == $userId) {
                     return $orNot == 'fail_if_exists' ? true : false;
                 }
                 return false;
             } else {
                 // The connected user is editing his own data
                 if ($result == $this->user->get('id')) {
                     return $orNot == 'fail_if_exists' ? true : false;
                 }
                 return false;
             }
         }
         return false;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:64,代码来源:userexists.php

示例11: render

 /**
  * Draws the html form element
  *
  * @param   array $data          to pre-populate element with
  * @param   int   $repeatCounter repeat group counter
  *
  * @return  string    elements html
  */
 public function render($data, $repeatCounter = 0)
 {
     $range = $this->getRange();
     $fullName = $this->getDataElementFullName();
     $data = FArrayHelper::getValue($data, $fullName);
     if (is_array($data)) {
         $data = ArrayHelper::getValue($data, $repeatCounter);
     }
     return $this->_renderListData($data, $range, $repeatCounter);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:18,代码来源:googleometer.php

示例12: process

 /**
  * Send SMS
  *
  * @param   string  $message  sms message
  * @param   array   $opts     Options
  *
  * @return  void
  */
 public function process($message, $opts)
 {
     $username = FArrayHelper::getValue($opts, 'sms-username');
     $password = FArrayHelper::getValue($opts, 'sms-password');
     $smsfrom = FArrayHelper::getValue($opts, 'sms-from');
     $smsto = FArrayHelper::getValue($opts, 'sms-to');
     $url = sprintf($this->url, $username, $smsto, $smsfrom, urlencode($message));
     $response = FabrikSMS::doRequest('GET', $url, '');
     return strstr($response, 'api_') !== false;
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:18,代码来源:smssza.php

示例13: process

 /**
  * Send SMS
  *
  * @param   string  $message  sms message
  * @param   array   $opts     Options
  *
  * @return  void
  */
 public function process($message, $opts)
 {
     $username = FArrayHelper::getValue($opts, 'sms-username');
     $password = FArrayHelper::getValue($opts, 'sms-password');
     $smsfrom = FArrayHelper::getValue($opts, 'sms-from');
     $smsto = FArrayHelper::getValue($opts, 'sms-to');
     $smstos = explode(',', $smsto);
     foreach ($smstos as $smsto) {
         $url = sprintf($this->url, $username, $password, $smsto, $message);
         FabrikSMS::doRequest('GET', $url, '');
     }
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:20,代码来源:kapow.php

示例14: exifToNumber

 /**
  * Exif to number
  *
  * @param   string  $value   Value
  * @param   string  $format  Format
  *
  * @return string
  */
 protected function exifToNumber($value, $format)
 {
     $spos = JString::strpos($value, '/');
     if ($spos === false) {
         return sprintf($format, $value);
     } else {
         $bits = explode('/', $value, 2);
         $base = FArrayHelper::getValue($bits, 0);
         $divider = FArrayHelper::getValue($bits, 1);
         return $divider == 0 ? sprintf($format, 0) : sprintf($format, $base / $divider);
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:20,代码来源:exif.php

示例15: getAsField_html

 /**
  * Create the SQL select 'name AS alias' segment for list/form queries
  *
  * @param   array  &$aFields    array of element names
  * @param   array  &$aAsFields  array of 'name AS alias' fields
  * @param   array  $opts        options
  *
  * @return  void
  */
 public function getAsField_html(&$aFields, &$aAsFields, $opts = array())
 {
     $dbTable = $this->actualTableName();
     $db = FabrikWorker::getDbo();
     if ($this->app->input->get('c') != 'form') {
         $params = $this->getParams();
         $fullElName = FArrayHelper::getValue($opts, 'alias', $db->qn($dbTable . '___' . $this->getElement()->name));
         $r = 'COUNT(' . $params->get('count_field', '*') . ')';
         $aFields[] = $r . ' AS ' . $fullElName;
         $aAsFields[] = $fullElName;
         $aAsFields[] = $db->qn($dbTable . '___' . $this->getElement()->name . '_raw');
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:22,代码来源:count.php


注:本文中的FArrayHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。