Forum Replies Created

Viewing 15 replies - 16 through 30 (of 72 total)
  • In fact, the plugin needs a few improvements as default values for arrays, compact these arrays…
    but, in this case and in a quickly way, line 200 change by this:

    if ( !empty($identifiers[$i]['text']) )
    	$footnotes[$identifiers[$i]['use_footnote']]['text']	= $identifiers[$i]['text'];
    if ( !empty($identifiers[$i]['symbol']) )
    	$footnotes[$identifiers[$i]['use_footnote']]['symbol']	= $identifiers[$i]['symbol'];

    ??

    And… a new small code improvement (right after):
    Change this redundant and innecessary code:

    // Footnotes and identifiers are stored in the array
    $use_full_link		= false;
    if ( is_feed() ) $use_full_link	= true;
    if ( is_preview() ) $use_full_link = false;

    $use_full_link is set to false except if is_feed(), we dont’t need set to false, again, if is_preview().
    So, set allways to false and true if is_feed():

    // Footnotes and identifiers are stored in the array
    $use_full_link		= (bool) is_feed() ? true : false;

    or more strict:

    // Footnotes and identifiers are stored in the array
    $use_full_link		= (bool) !is_feed() ? false : true;

    Thread Starter Covi

    (@covi)

    I’ve written my own Plugin, I hope to publish it as soon as possible :S

    Features:
    No Javascript required, can be based on CSS level 1 (classes: active, current…), level 2.1 (advanced selectors) and 3 (CSS3 selectors :target, :nth, etc).

    My next development aims to use <section> html5 elements (with tabs, of course).
    *Section attrs for active tab and Sections params this is not hard ??

    The format for shortcode is:

    [Sections]
    [Section:Name]
    ...
    [/Section]
    [Section:Name]
    ...
    [/Section]
    [/Sections]

    This outputs:

    <div class="tabs">
    
    <ul class="tabs-navigation">
    <li class="active current"><a href="#name-of-section-formated" title="Name of section">Name of section</a></li>
    <li><a href="#name-of-another-section-formated" title="Name of another section">Name of another section</a></li>
    </ul>
    
    <div id="name-of-section-formated" class="active current">
    ...
    </div>
    
    <div id="name-of-section-another-formated">
    ...
    </div>
    
    </div>

    Autop sucks ??

    mmm… just one more thing:
    I’m focusing on “PHP coding standars”, I think this is the most important point so that people can help you to improve it (if necessary).

    S! and sorry for my poor English ??

    Ok, glad to be helpful ??
    I’ll try to migrate all the shortcodes to OOP -a little more complicated, of course-, and mailed you the result. Do you like the suggestion?

    Thx for ur work ??

    Ok, sorry:
    eshop_shortcodes.php
    https://wordpress.pastebin.com/DwvksV8S

    Templates example:
    eshop_cart_items.phtml
    https://wordpress.pastebin.com/6KNETzdM

    eshop_default.phtml
    https://wordpress.pastebin.com/bhaERW7J

    Sorry, ATM, I don’t have time to register on forum. I want help you if you need it.
    See you later ??

    I forgot the most important:
    …and you can use the templates through all system (DRY, Don’t repeat yourself with html code in each function).

    …mmm ideas: att for template.
    e.g. you can set an ol list, and dl
    We only need setup options for $eshopTemplate to use a diferent template. We don’t need rewrite the html tags inside script.

    Oops… I was working on it. So sorry by style, you’re right, it’s not constructive… I’m nuts ??


    I’ve written a small improvement (I think) based on template html system and a coding standard for PHP (ZF based). In this case for shortcodes functions:
    I like OOP and not too many html tags inside scripts, …even when PHP is a embed HTML script language :S
    eshop-shortcodes.php
    `
    [snipped code blocks – please use https://wordpress.pastebin.com as per the forum guidelines]

    Now, you have 3 arrays of items vars and you can use your templates to apply your html structure.
    You get only Data: $tplProducts, $tplItems and $tplOptions.
    And you can apply your View: your template, e.g. renaming the original template.

    I would work to improve (if necessary and you want) the plugin based in this concept ??

    One more time, …excuse my previous message :S

    eshop is good… till you try to improve (or extend) it: I’m so sorry, but the code sucks ??
    *PHP-Nuke time :S

    Forum: Themes and Templates
    In reply to: Great work
    Thread Starter Covi

    (@covi)

    […]
    Simple way index.php:
    call_user_func_array(array(WP_Theme_MyTheme_Controller_Index, 'renderView'), array($wp_query));

    *wp_query is optional.

    Forum: Themes and Templates
    In reply to: Great work
    Thread Starter Covi

    (@covi)

    Oops… sorry for… about 1 year delay ??

    …and the reply is “yes”, I’m using this system on all of my themes. For example at: https://laguardiadejaen.com.

    But, ATM, is not a public work. I’m working on it to publish at Google Code, Gitub… ??


    This example implements the new theme with NameSpaces and Controllers instead files (home.php, archive.php…):

    -- MyTheme/
    ------ Controller/
    -------- Front.php -- FronController: methods for all controllers
    You can add hooks from extensions to all controllers, example:
    public static function getPostImage($postID = null) {
    	if ( method_exists('WP_Theme_MyTheme_Extension_Images', 'getPostImage') )
    		return WP_Theme_MyTheme_Extension_Images::getPostImage($postID);
    	else return '';
    }
    Controllers extends Front controller:
    -------- Index.php -- your index.php file
    Example methods from FrontController:
    self::getPostImage();
    -------- Home.php  -- ...
    -------- Archive.php
    ------ Extension/
    -------- Images.php -- Example to call a method from controller:
    WP_Theme_MyTheme_Extension_Images::getPostImage();
    ------ Widget/
    ------ Helper/
    ------ MyTheme.php


    functions.php load and init the theme class, example using Zend_Autoloader:

    [...]
    $configFile 	= APPLICATION_PATH . DS . 'app.xml';
    $Theme 		= new WP_Theme_MyTheme($configFile, $autoloader);

    The class is your functions.php POO, this init your supports, extensiones, widgets…

    Now, you only need a simple index file to call the Controller of your app, its a bridge between WP and your app system:

    // AutoControllers:
    if ( is_home() )
    	$ControllerName = 'Home';
    elseif ( is_archive() || is_search() )
    	$ControllerName = 'Archive';
    elseif ( is_attachment() )
    	$ControllerName = 'Attachment';
    else
    	$ControllerName = 'Index';
    
    // ### Run...
    $ClassName = "WP_Theme_MyTheme_Controller_{$ControllerName}";
    call_user_func_array(array($ClassName, 'renderView'), array($wp_query));

    Thread Starter Covi

    (@covi)

    Thanks for your quickly reply James ??
    But… if I’m not wrong… this strings are in core code, not in translations, right?

    Yeah, I meant simply adding a filter that removes the shortcode on the index page for example, useful if you only show excerpts.

    Btw I have switched to a different TOC plugin (wptoc), iirc because your HTML didn’t validate.

    Idem :S

    Forum: Themes and Templates
    In reply to: Great work
    Thread Starter Covi

    (@covi)

    Extended with namespaces:

    <?php
    class WP_Theme_MyTheme implements WP_Theme
    {
    }

    Structure:
    WP/
    — Theme.php (class WP_Theme)
    — Theme/
    — MyTheme.php (class WP_Theme_MyTheme)
    — optional subdirs for theme: WP_Theme_MyTheme_Filter /Filter/
    — Filter/
    —- Filter.php (interface WP_Theme_Filter)

    ^^!

    ?However, I’d be interested in getting the sticky posts and the category posts in the same query. Is this possible??

    [Bump], me too.

    ??

Viewing 15 replies - 16 through 30 (of 72 total)