Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 3 4 [5] 6 7 ... 10
 41 
 on: March 01, 2013, 09:58:24 am 
Started by jjones3535a - Last post by nukpana
Quote
More recent versions of WordPress do not generate URLs with dates in them anymore... instead they new use page IDs.
@Doug, Can you provide a link to this? AFAIK, this only happens on an install by default, then if you want the link with the date in it, you set it:
http://codex.wordpress.org/Using_Permalinks

For sNews, links like this is possible - MDJ started that path here: http://www.mdj.us/snews-cms/hacks-mods/compact-archives-for-snews-17/
Example on Sven's site: http://on-air.hiseo.fr/archive/
Incorporating it, that is a different story.

 42 
 on: February 28, 2013, 06:18:48 am 
Started by jjones3535a - Last post by Keyrocks
More recent versions of WordPress do not generate URLs with dates in them anymore by default... instead they new use page IDs unless Permalinks is enabled.
WordPress URL Example - http://  mydomain.com/?page_id=19

Your site is generating links with dates as well as .html at the end of them. At any rate, it is not possible to do this with sNews. sNews generates search-engine-friendly URLs for better search engine optimization by adding the category and (if any) subcategory + the article or page title to the base URL ... without any file extention on the end.

 43 
 on: February 27, 2013, 08:29:11 am 
Started by jjones3535a - Last post by deathcrot
i have same problem with u :( on this http://www.ngrambe.net now i using blogspot :( :'(

 44 
 on: February 26, 2013, 07:19:38 pm 
Started by sibas - Last post by stephane
Hello Sibas,
Looks great. Everything seems working fine.

But I don't understand how the IPN script from Paypal work ?
And also how is generate the user name and file name to download ?

Thanks for your help if you can.
Stef

 45 
 on: February 25, 2013, 09:50:50 am 
Started by nukpana - Last post by nukpana
I stated here that I was working on a rewrite of this.  I will post some of the ideas/code:

Extension base:
The previous iteration shown in the above post was ok at the time, but needed to be refactored and things removed/re-purposed:

The basis of the code is a simple static Event class very similar to the code posted here and here

Code: [Select]
<?php

#---------- Event Class --------------------------------------------------------

class Event {
static private 
$_events = array();

final static function on$event$func$priority 10 ) {
if( is_callable($func) ) {
self::$_events[$event][$priority][] = $func;
}
ksort_recursive(self::$_events);
}

final static function trigger$event$var null ) {
if( isset(self::$_events[$event]) ) { 
foreach( self::$_events[$event] as $i => $calls ) {
foreach( $calls as $func ) {
if( is_callable($func) ) {
$var call_user_func($func$var);
}
}
}
}
return $var;
}
}

Now, the plugin API for users:
Code: [Select]
<?php

class 
Ext implements Observer {
private
$_name;

final function __construct() {
$this->_name get_class($this);
}

final function bind($event$func$priority 10) {
Event::on($event$func$priority);
}

final function commit() {
if( method_exists($this'main') ) {
$this->main();
}
}

final function updateObservable $subject ) {
$method '';
switch( $subject->getState() ) {
case( 'activated_' $this->_name ):
$method 'install';
break;

case( 'deactivated_' $this->_name  ):
$method 'uninstall';
break;
}
Event::on($subject->getState(), array($this$method));
}
}

Alot smaller and clearer than before.  I removed adding hook/callaback in the plugin.ini as I didn't feel it being needed, since you would still need to call the Ext class in your plugin - just add the call in the main() method. Also removed is the Registry class and ext() call to the Extension registry, since this got very code heavy trying to process all of the information in and out of the array.  Now the extensions are managed by the Extensions class and the hook/callbacks are managed by the Event class.  The Registry was a good idea for a future logger addon, but again, for a core system, was this really needed at this point?

The other functionality went to the Event class (sorting) & Extensions class (requirements):
Code: [Select]
<?php

final class 
Extensions extends AddOn {
private 
$_db;

function __construct() {
$this->_db db();
$this->_init();
}

private function _init() {
$this->_active = array();
$sql 'SELECT name 
FROM plugins;'
;
foreach ( $this->_db->query($sql) as $r ) {
$this->_active[] = $r['name'];
}
}

function load() {
foreach( $this->_active as $ext ) {
$file $this->_requiredFiles($ext);

$met_requirements false;
if( file_exists($file['index']) && file_exists($file['ini']) ) {

$met_requirements $this->_checkRequirements($file['ini']);
if( $met_requirements === true ) {
require( $file['index'] );

if( class_exists($ext) ) {
$i = new $ext;
$i->commit();
$this->attach($i);
}
}
}
}


function parse() {
$dir opendir(EXT_PATH);
if( $dir ) {
while( false !== ($ext readdir($dir)) ) {
$file $this->_requiredFiles($ext);

if(    $file != '.' 
&& $file != '..' 
&& file_exists($file['index'])
&& file_exists($file['ini'])
) {

$this->_list[$ext] = $this->data($file['ini']);

if( in_array($ext$this->_active) ) {
$this->_list[$ext]['active'] = TRUE;
}
}
}
}
return $this->_list;
}

protected function data$file ) {
$array parse_ini_file($fileTRUE);
return strip_tags_deep($array);
}

protected function set$addon ) {
if( !$this->exists($addon) ) {
$sth $this->_db->query("
INSERT INTO plugins 
VALUES(:name);"
);
$sth->execute(array(':name' => $addon));
}
}

protected function delete$addon ) {
if( $this->exists($addon) ) {
$sth $this->_db->query("
DELETE 
FROM plugins
WHERE name = :name;"
);
$sth->execute(array(':name' => $addon));
}
}

function process$str ) {
$addon '';
switch (true) {
// Ex: activate_Extension
case (strpos($str'activate') === ):
$addon substr($str'9');

$this->set($addon);
// Set observable event "activated_$addon"
$this->setState('activated_' $addon);
break;
// Ex: deactivate_Extension
case (strpos($str'deactivate') === ):
$addon substr($str'11');

$this->delete($addon);
// Set observable event "deactivated_$addon"
$this->setState('deactivated_' $addon);
break;
}
}

function exists$name ) {
return in_array($name$this->_active); 
}

private function _checkRequirements$file ) {
$is_met true;
$data $this->data($file);
if( isset($data['plugin.dependencies']['requires']) ) {
$requirement $data['plugin.dependencies']['requires'];

foreach( $requirement as $dep ) {
if( !in_array($dep$this->_active) ) {
$is_met false;
}
}
}
return $is_met;
}

private function _requiredFiles$extName ) {
return array(
"index" => EXT_PATH'/' .$extName'/index.php',
"ini" => EXT_PATH'/' .$extName'/plugin.ini'
);
}
}


The observer class is redone slightly to incorporate the Event::trigger method:
Code: [Select]
<?php

#---------- Observable & Observer classes --------------------------------------

interface Observer {
function updateObservable $subject );
}

class Observable {
private 
$_state,
$_observers = array();

final function attachObserver $observer ) {
$i array_search($observer$this->_observers);
if( $i === false ) {
$this->_observers[] = $observer;
}
}

final function notify() {
foreach( $this->_observers as $observer ) {
$observer->update$this );
}
}

final function setState$state ) {
$this->_state $state;
$this->notify();

Event::trigger$this->_state );
}

final function getState() {
return $this->_state;
}
}

I noted removal of the Registry class also effects the Language functionality slightly, including the removal of the strtr function, which, upon reviewing some of the sNews language strings, didn't really need this.. (yet):
Code: [Select]
<?php

final class 
Languages extends AddOn {
private
$_data = array();

function __construct() {
$this->_active Options::get('language');
}

function load() {
$array = array();
$file LANG_PATH .'/'$this->_active '.php';
if( file_exists($file) ) {
$this->_data = require $file;
}


function parse() {
$dir opendir(LANG_PATH);
if ($dir) {
while (false !== ($file readdir($dir))) {
if (   $file != '.' 
&& $file != '..' 
&& file_exists(LANG_PATH .'/'$file)
) {
$filename basename($file'.php');
$this->_list[$filename] = array();

if( $filename === $this->_active ) {
$this->_list[$filename]['active'] = TRUE;
}
}
}
}
return $this->_list;
}

protected function set$addon ) {
Options::set'language'$addon );
}

function process$str ) {
$this->set$str );
}

function getData() {
return $this->_data;
}
}

// Languages class wrapper
// Methods to be used by *_addon procedural functions
function languages() {
static $lang;
if( !$lang ) {
$lang = new Languages;
}
return $lang;
}

function lang() {
return languages()->getData();
}

function __$string, array $args NULL ) {
return value($stringlang())
value($stringlang())
$string;
}


 46 
 on: February 24, 2013, 01:22:30 pm 
Started by sibas - Last post by philmoz
Set form up with radio buttons.
One for names.
One for city.
(obviously a field for your search query is also required)

When form entered, use the activated radio to direct search query to the relevant function.

 47 
 on: February 23, 2013, 07:18:06 pm 
Started by sibas - Last post by sibas
Hi there, I have stuck with the following!
I have 2 different forms to search names, and cities, so except the function search() I have function search_names() and function search_city()

Now my problem is that I don't want to have 3 different forms and I don't want to use ajax, I want to have one and with some option stuff to change to the right function.

Is there any idea how to make work this!

 48 
 on: February 21, 2013, 03:11:28 pm 
Started by Fred K - Last post by Fred K
Fred, not really reading the whole thread, I would use 2 functions instead of one - to check the username and to check the password.

Yeah, no, you're absolutely right. This was more an exercise in reworking the existing check in as simple a fashion as possible, given my PHP dumbness, and getting it to work. That aside, username and password would be better off as two entities (as far as checking goes), yes. Anyway, I learned a bunch - not the least that preg_match (as well as preg_replace) is way faster than ctype_alnum. Faster is good-er, no? ;)

Reading the whole thread isn't mandatory btw, just the OP and my comment just before yours. :D

 49 
 on: February 21, 2013, 03:03:04 pm 
Started by MadsPH - Last post by Fred K
... I would be able to manage it according to the other hardcoded pages, correct? :)

Correct.

 50 
 on: February 21, 2013, 02:49:01 pm 
Started by MadsPH - Last post by MadsPH
Hello! :)

I'm new to the forum. Cheers.

So far it's been great with pages, however I'd like to add some static links to my menu.

I have tried doing this, but then I get it at the end of the menu. I'd like to control the order in which the links appear.
It's essentially the same thing it's doing though.

Just adding to the menu list will not give you full control over the order.

I wouldn't be able to put my page between the pages that sNews offer using the ui, but I would be able to manage it according to the other hardcoded pages, correct? :)

Pages: 1 ... 3 4 [5] 6 7 ... 10