|
@@ 1881-1901 (lines=21) @@
|
| 1878 |
|
* @since Symphony 2.5.2 |
| 1879 |
|
* @return string |
| 1880 |
|
*/ |
| 1881 |
|
public function getPrepopulateString() |
| 1882 |
|
{ |
| 1883 |
|
$prepopulate_querystring = ''; |
| 1884 |
|
|
| 1885 |
|
if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { |
| 1886 |
|
foreach ($_REQUEST['prepopulate'] as $field_id => $value) { |
| 1887 |
|
// Properly decode and re-encode value for output |
| 1888 |
|
$value = rawurlencode(rawurldecode($value)); |
| 1889 |
|
$prepopulate_querystring .= sprintf("prepopulate[%s]=%s&", $field_id, $value); |
| 1890 |
|
} |
| 1891 |
|
$prepopulate_querystring = trim($prepopulate_querystring, '&'); |
| 1892 |
|
} |
| 1893 |
|
|
| 1894 |
|
// This is to prevent the value being interpreted as an additional GET |
| 1895 |
|
// parameter. eg. prepopulate[cat]=Minx&June, would come through as: |
| 1896 |
|
// $_GET['cat'] = Minx |
| 1897 |
|
// $_GET['June'] = '' |
| 1898 |
|
$prepopulate_querystring = preg_replace("/&$/", '', $prepopulate_querystring); |
| 1899 |
|
|
| 1900 |
|
return $prepopulate_querystring ? '?' . $prepopulate_querystring : null; |
| 1901 |
|
} |
| 1902 |
|
|
| 1903 |
|
/** |
| 1904 |
|
* If the entry is being prepopulated, we may want to filter other views by this entry's |
|
@@ 1910-1931 (lines=22) @@
|
| 1907 |
|
* @since Symphony 2.5.2 |
| 1908 |
|
* @return string |
| 1909 |
|
*/ |
| 1910 |
|
public function getFilterString() |
| 1911 |
|
{ |
| 1912 |
|
$filter_querystring = ''; |
| 1913 |
|
|
| 1914 |
|
if (isset($_REQUEST['prepopulate']) && is_array($_REQUEST['prepopulate'])) { |
| 1915 |
|
foreach ($_REQUEST['prepopulate'] as $field_id => $value) { |
| 1916 |
|
$handle = FieldManager::fetchHandleFromID($field_id); |
| 1917 |
|
// Properly decode and re-encode value for output |
| 1918 |
|
$value = rawurlencode(rawurldecode($value)); |
| 1919 |
|
$filter_querystring .= sprintf('filter[%s]=%s&', $handle, $value); |
| 1920 |
|
} |
| 1921 |
|
$filter_querystring = trim($filter_querystring, '&'); |
| 1922 |
|
} |
| 1923 |
|
|
| 1924 |
|
// This is to prevent the value being interpreted as an additional GET |
| 1925 |
|
// parameter. eg. filter[cat]=Minx&June, would come through as: |
| 1926 |
|
// $_GET['cat'] = Minx |
| 1927 |
|
// $_GET['June'] = '' |
| 1928 |
|
$filter_querystring = preg_replace("/&$/", '', $filter_querystring); |
| 1929 |
|
|
| 1930 |
|
return $filter_querystring ? '?' . $filter_querystring : null; |
| 1931 |
|
} |
| 1932 |
|
|
| 1933 |
|
/** |
| 1934 |
|
* Given $_POST values, this function will validate the current timestamp |