Mini Shell

Direktori : /home/admin/web/mcpv.demarco.ddnsfree.com/public_html/wp-includes/Text/Diff/Engine/
Upload File :
Current File : /home/admin/web/mcpv.demarco.ddnsfree.com/public_html/wp-includes/Text/Diff/Engine/shell.php

<?php
/**
 * Class used internally by Diff to actually compute the diffs.
 *
 * This class uses the Unix `diff` program via shell_exec to compute the
 * differences between the two input arrays.
 *
 * Copyright 2007-2010 The Horde Project (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you did
 * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
 *
 * @author  Milian Wolff <mail@milianw.de>
 * @package Text_Diff
 * @since   0.3.0
 */
class Text_Diff_Engine_shell {

    /**
     * Path to the diff executable
     *
     * @var string
     */
    var $_diffCommand = 'diff';

    /**
     * Returns the array of differences.
     *
     * @param array $from_lines lines of text from old file
     * @param array $to_lines   lines of text from new file
     *
     * @return array all changes made (array with Text_Diff_Op_* objects)
     */
    function diff($from_lines, $to_lines)
    {
        array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
        array_walk($to_lines, array('Text_Diff', 'trimNewlines'));

        $temp_dir = Text_Diff::_getTempDir();

        // Execute gnu diff or similar to get a standard diff file.
        $from_file = tempnam($temp_dir, 'Text_Diff');
        $to_file = tempnam($temp_dir, 'Text_Diff');
        $fp = fopen($from_file, 'w');
        fwrite($fp, implode("\n", $from_lines));
        fclose($fp);
        $fp = fopen($to_file, 'w');
        fwrite($fp, implode("\n", $to_lines));
        fclose($fp);
        $diff = shell_exec($this->_diffCommand . ' ' . $from_file . ' ' . $to_file);
        unlink($from_file);
        unlink($to_file);

        if (is_null($diff)) {
            // No changes were made
            return array(new Text_Diff_Op_copy($from_lines));
        }

        $from_line_no = 1;
        $to_line_no = 1;
        $edits = array();

        // Get changed lines by parsing something like:
        // 0a1,2
        // 1,2c4,6
        // 1,5d6
        preg_match_all('#^(\d+)(?:,(\d+))?([adc])(\d+)(?:,(\d+))?$#m', $diff,
            $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            if (!isset($match[5])) {
                // This paren is not set every time (see regex).
                $match[5] = false;
            }

            if ($match[3] == 'a') {
                $from_line_no--;
            }

            if ($match[3] == 'd') {
                $to_line_no--;
            }

            if ($from_line_no < $match[1] || $to_line_no < $match[4]) {
                // copied lines
                assert($match[1] - $from_line_no == $match[4] - $to_line_no);
                array_push($edits,
                    new Text_Diff_Op_copy(
                        $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
                        $this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
            }

            switch ($match[3]) {
            case 'd':
                // deleted lines
                array_push($edits,
                    new Text_Diff_Op_delete(
                        $this->_getLines($from_lines, $from_line_no, $match[2])));
                $to_line_no++;
                break;

            case 'c':
                // changed lines
                array_push($edits,
                    new Text_Diff_Op_change(
                        $this->_getLines($from_lines, $from_line_no, $match[2]),
                        $this->_getLines($to_lines, $to_line_no, $match[5])));
                break;

            case 'a':
                // added lines
                array_push($edits,
                    new Text_Diff_Op_add(
                        $this->_getLines($to_lines, $to_line_no, $match[5])));
                $from_line_no++;
                break;
            }
        }

        if (!empty($from_lines)) {
            // Some lines might still be pending. Add them as copied
            array_push($edits,
                new Text_Diff_Op_copy(
                    $this->_getLines($from_lines, $from_line_no,
                                     $from_line_no + count($from_lines) - 1),
                    $this->_getLines($to_lines, $to_line_no,
                                     $to_line_no + count($to_lines) - 1)));
        }

        return $edits;
    }

    /**
     * Get lines from either the old or new text
     *
     * @access private
     *
     * @param array $text_lines Either $from_lines or $to_lines (passed by reference).
     * @param int   $line_no    Current line number (passed by reference).
     * @param int   $end        Optional end line, when we want to chop more
     *                          than one line.
     *
     * @return array The chopped lines
     */
    function _getLines(&$text_lines, &$line_no, $end = false)
    {
        if (!empty($end)) {
            $lines = array();
            // We can shift even more
            while ($line_no <= $end) {
                array_push($lines, array_shift($text_lines));
                $line_no++;
            }
        } else {
            $lines = array(array_shift($text_lines));
            $line_no++;
        }

        return $lines;
    }

}
October 2, 2021 – Base de données MCPV "Prestataires"

Day: October 2, 2021

We evaluate the efficiency, knowledge, and accessibility of

Motorcycle landmark Buffalo Chip plans Nevada casino opening in 2028 Akwesasne Mohawk Casino Resort has everything you’re looking for when you want to get away for fun! With over 1,200 of the latest slot machines, Vegas-style table games, and sports betting at Sticks Sports Book, you can choose how you want to win. We’ve also…

Read More

Using it within the bathe is a treat

The 7 Greatest Sex Toys Of 2025, Reviewed By Specialists I adore the Maude Band’s minimalist design — it appears extra like a piece of up to date artwork than a sex toy. The silicone is extremely delicate and stretchy, making it comfy for extended wear. While the vibrations are gentle, my companion finds they…

Read More

It’s USB rechargeable, water resistant, and easy to scrub,

The 7 Finest Sex Toys Of 2025, Reviewed By Specialists Relatively quiet vibrators are a should for folks with roommates, children, and/or skinny walls. While testing Scrotum Bondage Bag, we prioritized discreet vibrators over loud ones; many reviewers in contrast a vibrator’s noise level to others they examined, or have tried prior to now. On…

Read More

Whether you are interested in native laws

Homepage Little River On Line Casino Resort Beyond playing, casinos provide a complete entertainment experience. Local casinos usually function stay live shows, comedy exhibits, and other entertainment events, providing a complete leisure experience past gaming. Music lovers can take pleasure in quite lots of live weekend performances, including genres similar to rock, R&B, pop, jazz,…

Read More

Experience within the pleasure – and pain – you crave with

The Eleven Absolute Best Sex Toys how to make a girl sqirt, Based On Enthusiastic Reviews On the other hand, the latter threw out different suction wave intensities at random adamand eve sex toys tenga onacup, making the masturbation expertise thrilling. In addition, experienced customers in search of intense sensations might have to go for…

Read More

A globally acknowledged e-wallet

Your Trusted Hub For Sweepstakes Casinos Today’s vote to cease each casino proposals is a reflection of the community’s needs,” mentioned Assemblymember Tony Simone, who was on both CACs. But even the backing of big names including Jay-Z and Al Sharpton wasn’t enough to overcome local pushback , including from the influential Broadway League business…

Read More

While testing, we prioritized discreet vibrators over loud

Intercourse Toys Adult Toys For Males adult toys, Ladies & Couples Ladies adult toys, it’s time to fulfill your deepest wishes with our collection of sex toys designed specifically for women. Whether you are seeking intense clitoral stimulation, mind-blowing G-spot orgasms, or all-encompassing pleasure, we now have every thing you need to unlock new ranges…

Read More

The design signifies that no matter which one you choose

Lelo Bestsellers The Most Effective Selling Sex Toys On The Earth On a associated notice, a lot of our testers additionally most well-liked vibrators that were straightforward to stow away or pack for travel, versus bulkier merchandise that took up extra space. These handheld vibrators generate rumbly sensations that can be applied to the clitoris,…

Read More

Jack Rabbit Vibrator 5 Row – $85Our top-selling rabbit

Buy Grownup Sex Toys On-line The Explore Your Self Retailer In addition chastity belt butt plug sex swing harness, the cellular app presents unique choices, together with music sync, sound-activated vibrations, and ‘Voice Control adult spreader bar,’ a mode that responds to your instructions through AI. We-Vibe Sync 2 outperformed all the penetrative sex toys…

Read More

There are also butt plugs and strap-ons for hands-free anal

Store Sex Toys On-line No point out of web site name on your bank statement and data internet hosting on safe servers to ensure 100 percent safety while buying. All the merchandise on our web site are one hundred pc authorized with proper customs clearance and required certificates. Expand your horizons with Captive Bedroom gear…

Read More