Skip to content

Commit

Permalink
Simple url
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayoola FALOLA committed May 20, 2019
1 parent 2d5bfbd commit 40d9e14
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ protected function init()
// idn_to_ascii( );
$filter = new Ayoola_Filter_Transliterate();
$values['article_url'] = $filter->filter( $values['article_title'] );


$filter = new Ayoola_Filter_SimplyUri();
$values['article_url'] = $filter->filter( $values['article_url'] );

$filter = new Ayoola_Filter_Name();
$filter->replace = '-';
if( function_exists( 'mb_substr') )
Expand Down
8 changes: 6 additions & 2 deletions pagecarton/core/library/Ayoola/Doc/Upload/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public function init()
@$_POST['name'] = $_POST['name'] ? : '_file_';
$filter = new Ayoola_Filter_Transliterate();
$_POST['name'] = $filter->filter( $_POST['name'] );

$filter = new Ayoola_Filter_SimplyUrl();
$_POST['name'] = $filter->filter( $_POST['name'] );

// if( ! Ayoola_Abstract_Table::hasPriviledge( ) )
$filenameToUse = null;
@$docSettings['allowed_uploaders'] = @$docSettings['allowed_uploaders'] ? : array();
Expand Down Expand Up @@ -209,7 +213,7 @@ public function init()
}
$url .= date( 'Y/m/d/' );
$filter = new Ayoola_Filter_Name();
$filter->replace = '_';
$filter->replace = '-';

// var_export( strtolower( array_pop( explode( '.', trim( $_POST['suggested_url'], '.' ) ) ) ) );
if( ! in_array( strlen( $extension ), range( 1, 4 ) ) )
Expand All @@ -219,7 +223,7 @@ public function init()
// $_POST['name'] = array_shift( explode( '.', $_POST['name'] ) );
$_POST['name'] = substr( $_POST['name'], 0, 30 );
$_POST['name'] = $_POST['name'] ? : uniqid();
$_POST['name'] = str_replace( '.', '_', $_POST['name'] );
$_POST['name'] = str_replace( '.', '-', $_POST['name'] );
$newName = $filter->filter( $_POST['name'] );
$dir .= $url;
Ayoola_Doc::createDirectory( $dir );
Expand Down

0 comments on commit 40d9e14

Please sign in to comment.