Skip to content

Instantly share code, notes, and snippets.

@hissy
Last active December 12, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hissy/4705216 to your computer and use it in GitHub Desktop.
Save hissy/4705216 to your computer and use it in GitHub Desktop.
<?php
defined('C5_EXECUTE') or die("Access Denied.");
class ContentBlockController extends Concrete5_Controller_Block_Content {
function translateTo($text) {
// keep links valid
// $url1 = str_replace('/', '\/', BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME);
$url2 = str_replace('/', '\/', BASE_URL . DIR_REL);
$url3 = View::url('/download_file', 'view_inline');
$url3 = str_replace('/', '\/', $url3);
$url3 = str_replace('-', '\-', $url3);
$url4 = View::url('/download_file', 'view');
$url4 = str_replace('/', '\/', $url4);
$url4 = str_replace('-', '\-', $url4);
$text = preg_replace(
array(
// '/' . $url1 . '\?cID=([0-9]+)/i',
'/' . $url3 . '([0-9]+)\//i',
'/' . $url4 . '([0-9]+)\//i',
'/' . $url2 . '/i'),
array(
// '{CCM:CID_\\1}',
'{CCM:FID_\\1}',
'{CCM:FID_DL_\\1}',
'{CCM:BASE_URL}')
, $text);
return $text;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment