lundi 2 novembre 2015

wordpress lambad expression syntax highlighting

I tried Syntax Highlighter MT in wordpress.org and

<pre class="brush: c#; highlight: [1, 3]">
IEnumerable<MyEntity> LoadMyEntities(Expression<Func<MyEntity, bool >> predicate)
{
    return Context.MyEntities.Where(predicate);
}
</pre>

gives me enter image description here

I guess it messed up the >>with sth..Any ideas? Is there any good alternative syntax highlighter?



via Chebli Mohamed

dimanche 1 novembre 2015

Wordpress Theme Upload Error

PHP Warning:  require_once(D:\inetpub\vhosts\r3katelier.com\httpdocs\wp-content\themes\theme/include/common.php): failed to open stream: No such file or directory in D:\inetpub\vhosts\r3katelier.com\httpdocs\wp-content\themes\theme\functions.php on line 3

PHP Fatal error:  require_once(): Failed opening required 'D:\inetpub\vhosts\r3katelier.com\httpdocs\wp-content\themes\theme/include/common.php' (include_path='.;./includes;./pear') in D:\inetpub\vhosts\r3katelier.com\httpdocs\wp-content\themes\theme\functions.php on line 3

I recently had a huge screw up with my pluggin update and i deleted all my files from my server and tried to do everything from scratch. But now when i upload the theme i get the above error. Kindly, help me resolve this as my server company is useless. Thanks so much



via Chebli Mohamed

TinyMCE paste as HTML

Is it possible to paste HTML into the "Visual" editor in Wordpress without needing to switch back to the "Text" editor. I need to paste in HTML frequently, however every time I switch to Text view- my place on the webpage changes and I need to re-read to find the right place.



via Chebli Mohamed

Unable to push to SVN repository without breaking composer dependancies

I have a published Wordpress plugin that's hosted on their SVN repository. I don't use SVN except for pushing updates to this project. I've managed to push a few minor updates in the past without problems. But I've spent this entire weekend struggling to push a simple update as I've done in the past.

For reasons I cannot figure out, Composer dependancies aren't getting published. My plugin works fine locally. I copy the files into the /trunk of my local SVN repository manually (yea it sucks doing it this way...) and then execute the following commands:

$ svn update trunk/* $ svn ci -m 'changes for 1.2.3' $ svn cp trunk tags/1.2.3 $ svn ci -m 'tagged 1.2.3'

When I delete my local copy of the plugin and then install it using the published copy from Wordpress it's broken and it won't work unless I run composer install (which runs and installs a bunch of missing dependancies).

WHY!??!?!?!

Does SVN ignore things in a vendor/ directory? What am I missing?



via Chebli Mohamed

WordPress gravity forms pricing discount based on quantity

I'm trying to set a variable price for a product based on quantity using WordPress Gravity Forms.

i.e.

1-25 Qty ($12 each) 26-50 Qty ($10 each) 51-100 Qty ($8 each)

Any way to do this?

-Thanks.



via Chebli Mohamed

Check If Folder Exists Is Not Working

I'm trying to get this function to recognize if a folder exists on the server, but it's not working. I've tried is_dir function as well but no luck.

This script is trying to be utilized in a Wordpress plugin, but it's using the php-based function to look if a file/folder exists. Any idea why it's not recognizing that the /docs folder exists? I've verified that $filename is actually pulling up the correct file path on server.

function docs_settings_page() {
    $filename = get_stylesheet_directory_uri()."/docs/";
    if(file_exists($filename)) {
        echo "The folder exists!";
    }
    else {
        echo "Sorry - the file does not exist.";
    }
}

function docs_create_menu() {
    // Do stuff here
}

add_action('admin_menu', 'docs_create_menu');



via Chebli Mohamed

How can i give inline code access to post variable when using AJAX Post?

How do i get the value from the form post that im posting within a plugin I am wanting to retrieve it i thought if i insert the form via short code that the variable on the main page would be carried over but its not maybe I need to add a shortcode that is accessable to the form inline and the insert statement above anyone any ideas.

IE On kids dashbarod page where i implment short code I already have a variable declaired called player id. This is unique to the signed in player. I need to reference that wihtin my plugin form so i can access it through the post variable or is it better using update_options my main concern their is the child could overide it in view source ?.

         wp_register_style( 'ajaxgogreen-style', plugins_url( '/css/modal.css', __FILE__ ), array(), '20120208', 'all' );
  wp_enqueue_style( 'ajaxgogreen-style' );
        // including ajax script in the plugin Myajax.ajaxurl
        wp_localize_script( 'gogreen', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php')));
        function updateRedeemPoints(){
        $playerId = $_POST['playerId'];
        $points=$_POST['points'];
        global $wpdb;
        $wpdb->insert( 
            '4hSIc_pods_player_ranking', 
            array( 
                'points_to_redeem' =>$points,
                'player_id'=>'339393',
                'date_to_be_awarded' => current_time('mysql', 1),
                'approved'=>'false'

            ));


        echo 'test';
        }
        add_action('wp_ajax_updateRedeemPoints', 'updateRedeemPoints');
        add_action('wp_ajax_nopriv_updateRedeemPoints', 'updateRedeemPoints');
                function show_form(){


                    echo "<div id='thanks-modal' class='modal fade' tabindex='-1' role='dialog'  aria-labelledby='myModalLabel' aria-hidden='true'>";
                    echo "<div class='modal-dialog'>";
                    echo "<div class='modal-content'>";
                    echo "<div class='modal-header'>";
                    echo "<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>×</button>";
                    echo "<h4 class='modal-title'>Redeem Points</h4>";
                    echo "</div>";
                        echo "<form class='form-horizontal'  class='contact' name='redemmpointsForm' id='redemmpointsForm' >";
                        echo " <div class='form-group'>";
                        echo "<h3>You may only redeem the maxium points of : <?php echo $maxpoints;?></h3>";
                        echo "<input type='hidden' name='playerid' value='<?php echo $playerId;;?>' />";
                        echo "<input type='number'  valuemax='<?php echo $maxpoints;?>' name='points' id='points' class='form-control' placeholder='How many points do you wish to redeem.' />";
                        echo "<label class='control-label col-md-4' for='Comments'>Comments?</label>";
                        echo "<input type='text' name='comments' />";

                        echo "     </div>";
                        echo "    <div class='form-group'>";
                        echo "            <div class='col-md-6'>";
                        echo "                <input type='button' class='btn btn-success' name='submit' id='submit' Text='Submit'>";
                        echo "     <a href='#' class='btn' data-dismiss='modal'>Close</a>";
                        echo "         </div>";
                        echo "      </div>";
                        echo "</form>";
                    echo "      </div>";
                            echo "      </div>";
                                echo "      </div>";
            }



        add_shortcode( 'go_greenredempoints', 'gs_redeemplugin' );

So my confusion is to what i need in this function to make player id availbe to inline form for the post. Or should i use update option and store it.

    function gs_redeemplugin($atts) {


        ob_start();

         extract( shortcode_atts( array(
            'playerId' => 'myvalue'

        ), $atts ) );




        show_form();
        return ob_get_clean();
    }



via Chebli Mohamed