PKPLocale::getParameterNames PHP Method

getParameterNames() static public method

Given a locale string, get the list of parameter references of the form {$myParameterName}.
static public getParameterNames ( $source ) : array
$source string
return array
    static function getParameterNames($source)
    {
        $matches = null;
        PKPString::regexp_match_all('/({\\$[^}]+})/', $source, $matches);
        array_shift($matches);
        // Knock the top element off the array
        if (isset($matches[0])) {
            return $matches[0];
        }
        return array();
    }

Usage Example

 /**
  * @copydoc GridCellProvider::getTemplateVarsFromRowColumn()
  */
 function getTemplateVarsFromRowColumn($row, $column)
 {
     $data = $row->getData();
     switch ($column->getId()) {
         case 'key':
             return array('key' => $row->getId(), 'strong' => !isset($data[MASTER_LOCALE]) || $data[MASTER_LOCALE] === '' || !isset($data[$this->locale]) || $data[$this->locale] === '' || 0 != count(array_diff(PKPLocale::getParameterNames($data[MASTER_LOCALE]), PKPLocale::getParameterNames($data[$this->locale]))));
         case 'value':
             $allLocales = PKPLocale::getAllLocales();
             return array('referenceLocale' => MASTER_LOCALE, 'referenceLocaleName' => $allLocales[MASTER_LOCALE], 'reference' => isset($data[MASTER_LOCALE]) ? $data[MASTER_LOCALE] : '', 'translationLocale' => $this->locale, 'translationLocaleName' => $allLocales[$this->locale], 'translation' => isset($data[$this->locale]) ? $data[$this->locale] : '');
     }
     assert(false);
 }
All Usage Examples Of PKPLocale::getParameterNames